From b7415f058655fdab2dae4f226b7faeb13729232c Mon Sep 17 00:00:00 2001 From: Reifonas Date: Fri, 20 Feb 2026 07:20:32 -0300 Subject: [PATCH] First commit - backup RDOC --- .gitattributes | 2 + .github/SECRETS_SETUP.md | 110 + .github/workflows/auto-sync-deploy.yml | 263 + .github/workflows/deploy.yml | 64 + .gitignore | 109 + .trae/documents/Analise_Otimizacao_RDO.md | 352 + .../documents/Arquitetura_BD_RDO_Completa.md | 1106 +++ .trae/documents/Arquitetura_Tecnica_RDO.md | 815 ++ .trae/documents/PRD_RDO_Mobile_App.md | 129 + .vercel/project.json | 1 + .vercelignore | 7 + Dockerfile | 39 + README.md | 62 + auto-sync-config.json | 28 + capacitor.config.ts | 9 + database_scripts/check_data.sql | 13 + dist/_headers | 4 + dist/assets/css/index-DXaaJsOA.css | 1 + dist/assets/js/Auth-KZISTjMo.js | 1 + dist/assets/js/AuthCallback-DlZVcD4W.js | 1 + dist/assets/js/Cadastros-QZZ_REjv.js | 1 + dist/assets/js/Configuracoes-LYuviA0-.js | 1 + dist/assets/js/CreateObra-BwwQt_hK.js | 1 + dist/assets/js/CreateRDO-Bhe5_7xI.js | 1 + dist/assets/js/CreateTask-BlEDuvPM.js | 1 + dist/assets/js/Dashboard-BPPxBqO4.js | 1 + dist/assets/js/DatabaseTest-BA9LjsoE.js | 1 + dist/assets/js/ManualInstrucoes-G3xr1xLl.js | 1 + .../js/NeuralNetworkBackground-CER-dIFD.js | 1 + dist/assets/js/ObraDetails-S1VcIvXW.js | 1 + dist/assets/js/ObraTasks-Cy-rxhIo.js | 1 + dist/assets/js/RDODetails-tkR9ftO-.js | 5 + dist/assets/js/Reports-BmqmPZPj.js | 1 + dist/assets/js/SelectOrganization-Cb4zDKko.js | 1 + dist/assets/js/ThemeToggle-Cryh6OOS.js | 1 + dist/assets/js/configStore-DS-p50om.js | 1 + dist/assets/js/form-vendor-vQotxSmE.js | 1 + dist/assets/js/index-doec96Hx.js | 3 + dist/assets/js/query-vendor-BLVqILA6.js | 9 + dist/assets/js/react-vendor-CqRd3GwO.js | 32 + dist/assets/js/router-vendor-D4by-_6Z.js | 12 + dist/assets/js/state-vendor-DHadhBU5.js | 3 + dist/assets/js/supabase-vendor-CnnNSQLo.js | 25 + dist/assets/js/ui-vendor-CyRvbSfR.js | 424 + dist/assets/js/useInviteCode-BxOSdQOT.js | 12 + dist/assets/js/useUserStore-VOdYc7Zm.js | 1 + dist/assets/js/zod-7IfHMaWP.js | 1 + dist/assets/png/tracksteel-logo-CJR9ckUT.png | 1 + dist/favicon.svg | 4 + dist/icon-192x192.svg | 4 + dist/icon-512x512.svg | 4 + dist/index.html | 23 + dist/manifest.json | 27 + dist/tracksteel-logo.png | 1 + documentation/AI_RULES.md | 56 + documentation/APLICAR_MIGRATIONS_AGORA.md | 173 + documentation/ARQUITETURA_MULTI_TENANT.md | 531 ++ documentation/AUTO-SYNC-README.md | 129 + documentation/CHECKLIST_IMPLEMENTACAO.md | 484 ++ documentation/COMECE_AQUI.md | 340 + documentation/CONECTAR_SUPABASE_RDO.md | 214 + documentation/DEPLOYMENT_COMPLETO.md | 220 + documentation/ENTREGA_COMPLETA.md | 438 + documentation/INDICE_DOCUMENTACAO.md | 430 + documentation/INSTRUCOES_CONEXAO_RAPIDA.txt | 112 + documentation/INSTRUCOES_DEPLOY_SUPABASE.md | 144 + documentation/LICENCE.md | 1 + documentation/Manual_RDO_Livro.html | 477 ++ documentation/Manual_RDO_Livro.md | 284 + documentation/Manual_Usuario_RDO.md | 693 ++ documentation/PLANO_SAAS_MULTI_TENANT.md | 423 + documentation/PRONTO_PARA_DESENVOLVIMENTO.md | 163 + documentation/PROXIMOS_PASSOS.md | 210 + documentation/README-AUTO-SYNC.md | 403 + documentation/README_DEPLOY.md | 253 + documentation/README_SAAS_MULTI_TENANT.md | 361 + documentation/RESUMO_ACOES_PRIORITARIAS.md | 399 + documentation/RESUMO_EXECUTIVO_CONEXAO.md | 128 + documentation/SETUP_VISUAL.md | 309 + documentation/STATUS_DEPLOYMENT.md | 147 + documentation/temp-base64.txt | 1 + eslint.config.js | 28 + fix_admin_permissions.sql | 55 + fix_admin_permissions_v2.sql | 72 + fix_config_tables_rls.sql | 82 + fix_nuclear_rls.sql | 59 + fix_nuclear_rls_v2.sql | 67 + fix_permissions_rls.sql | 93 + fix_rls_definitivo.sql | 175 + index.html | 25 + ios/.gitignore | 13 + ios/App/App.xcodeproj/project.pbxproj | 408 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AppIcon.appiconset/AppIcon-512@2x.png | Bin 0 -> 110522 bytes .../AppIcon.appiconset/Contents.json | 14 + ios/App/App/Assets.xcassets/Contents.json | 6 + .../Splash.imageset/Contents.json | 23 + .../Splash.imageset/splash-2732x2732-1.png | Bin 0 -> 41273 bytes .../Splash.imageset/splash-2732x2732-2.png | Bin 0 -> 41273 bytes .../Splash.imageset/splash-2732x2732.png | Bin 0 -> 41273 bytes .../App/Base.lproj/LaunchScreen.storyboard | 32 + ios/App/App/Base.lproj/Main.storyboard | 19 + ios/App/App/Info.plist | 49 + ios/App/Podfile | 23 + logging-config.json | 81 + migrate_mockups_to_db.sql | 440 + netlify.toml | 21 + package-lock.json | 7073 +++++++++++++++++ package.json | 71 + postcss.config.js | 10 + public/_headers | 4 + public/favicon.svg | 4 + public/icon-192x192.svg | 4 + public/icon-512x512.svg | 4 + public/manifest.json | 27 + public/tracksteel-logo.png | 1 + railway.json | 22 + render.yaml | 47 + scripts/apply-migrations-cli.sh | 53 + scripts/apply-migrations.js | 102 + scripts/apply-migrations.ps1 | 48 + scripts/auto-sync-github.ps1 | 246 + scripts/auto-sync.js | 358 + scripts/auto-syncRDO.ps1 | 178 + scripts/check-supabase-status.js | 110 + scripts/check_data.js | 4 + scripts/check_database.js | 57 + scripts/confirm-user-email.js | 68 + scripts/create-confirmed-user.js | 51 + scripts/deploy-migrations.js | 147 + scripts/file-watcher.ps1 | 460 ++ scripts/logging-notifications.ps1 | 575 ++ scripts/setup-supabase.js | 102 + scripts/start-auto-sync.bat | 17 + scripts/start-auto-sync.ps1 | 476 ++ scripts/start.js | 32 + scripts/test-login.js | 42 + scripts/test-user-creation.js | 44 + scripts/test_buttons.js | 47 + scripts/test_final_functionality.js | 89 + scripts/verify-supabase.js | 99 + setup_full_db.sql | 227 + src/App.tsx | 95 + src/assets/logo-base64.ts | 4 + src/assets/react.svg | 1 + src/assets/tracksteel-logo.png | 1 + src/components/BottomNav.tsx | 72 + src/components/CameraCapture.tsx | 181 + src/components/Empty.tsx | 8 + src/components/ErrorBoundary.tsx | 210 + src/components/ManageInvites.tsx | 754 ++ src/components/NeuralNetworkBackground.tsx | 134 + src/components/OfflineIndicator.tsx | 219 + src/components/OfflineStatus.tsx | 222 + src/components/TaskLogModal.tsx | 248 + src/components/ThemeToggle.tsx | 45 + src/components/auth/LoginForm.tsx | 159 + src/components/auth/MFASetup.tsx | 209 + src/components/auth/MFAVerification.tsx | 117 + src/components/auth/ProtectedRoute.tsx | 69 + src/components/auth/RegisterForm.tsx | 302 + src/components/auth/SocialLoginButtons.tsx | 110 + .../config/CondicoesClimaticasConfig.tsx | 421 + src/components/config/FuncoesCargosConfig.tsx | 434 + src/components/config/MateriaisConfig.tsx | 473 ++ .../config/TiposAtividadeConfig.tsx | 301 + .../config/TiposEquipamentoConfig.tsx | 463 ++ .../config/TiposOcorrenciaConfig.tsx | 481 ++ src/config/routes.tsx | 323 + src/contexts/AuthContext.tsx | 48 + src/db/db.ts | 48 + src/hooks/index.ts | 12 + src/hooks/queries/index.ts | 7 + src/hooks/queries/useObras.ts | 320 + src/hooks/queries/useRdos.ts | 435 + src/hooks/queries/useUsers.ts | 242 + src/hooks/useAuth.ts | 438 + src/hooks/useInviteCode.ts | 363 + src/hooks/useMFA.ts | 163 + src/hooks/useOffline.ts | 474 ++ src/hooks/useRDO.ts | 82 + src/hooks/useRealtimeSync.ts | 210 + src/hooks/useSocialAuth.ts | 141 + src/hooks/useSupabaseData.ts | 148 + src/hooks/useTheme.ts | 29 + src/index.css | 66 + src/layouts/MainLayout.tsx | 16 + src/lib/cacheManager.ts | 333 + src/lib/offlineDb.ts | 292 + src/lib/queryClient.ts | 158 + src/lib/reactQueryConfig.ts | 181 + src/lib/supabase.ts | 226 + src/lib/utils.ts | 6 + src/main.tsx | 10 + src/pages/Auth.tsx | 164 + src/pages/AuthCallback.tsx | 81 + src/pages/Cadastros.tsx | 638 ++ src/pages/Configuracoes.tsx | 389 + src/pages/CreateObra.tsx | 281 + src/pages/CreateRDO.tsx | 429 + src/pages/CreateTask.tsx | 464 ++ src/pages/Dashboard.tsx | 288 + src/pages/DatabaseTest.tsx | 270 + src/pages/Home.tsx | 3 + src/pages/ManualInstrucoes.tsx | 1058 +++ src/pages/ObraDetails.tsx | 570 ++ src/pages/ObraTasks.tsx | 905 +++ src/pages/RDODetails.tsx | 390 + src/pages/Reports.tsx | 652 ++ src/pages/SelectOrganization.tsx | 310 + src/pages/SyncLogsPage.tsx | 228 + src/pages/Tasks.tsx | 591 ++ src/providers/OfflineProvider.tsx | 251 + src/providers/QueryProvider.tsx | 46 + src/providers/index.ts | 3 + src/services/conflictResolver.ts | 210 + src/services/mfaService.ts | 259 + src/services/syncService.ts | 454 ++ src/stores/configStore.ts | 397 + src/stores/index.ts | 147 + src/stores/migration-plan.md | 57 + src/stores/useAppStateStore.ts | 315 + src/stores/useAppStore.ts | 313 + src/stores/useObraStore.ts | 359 + src/stores/useTaskStore.ts | 576 ++ src/stores/useUserStore.ts | 236 + src/tests/database-connection.test.ts | 298 + src/types/api.types.ts | 470 ++ src/types/database.types.ts | 598 ++ src/types/domain.types.ts | 347 + src/types/index.ts | 358 + src/types/taskLog.ts | 66 + src/types/validation.types.ts | 391 + src/utils/dateUtils.ts | 151 + src/utils/taskLogManager.ts | 228 + src/vite-env.d.ts | 1 + supabase/.temp/cli-latest | 1 + supabase/.temp/gotrue-version | 1 + supabase/.temp/pooler-url | 1 + supabase/.temp/postgres-version | 1 + supabase/.temp/project-ref | 1 + supabase/.temp/rest-version | 1 + supabase/.temp/storage-version | 1 + ...41202000001_create_multi_tenant_schema.sql | 502 ++ ...02000002_create_functions_and_triggers.sql | 405 + .../20241202000003_create_rls_policies.sql | 452 ++ .../20241202000004_seed_initial_data.sql | 381 + .../20241206120000_fix_rls_recursion.sql | 99 + .../20241206130000_create_aux_tables.sql | 85 + supabase/migrations/fix_table_permissions.sql | 173 + supabase/migrations/insert_mock_data.sql | 67 + supabase_debug.sql | 14 + supabase_migration_completa.sql | 337 + supabase_migration_convites.sql | 264 + tailwind.config.js | 32 + tsconfig.json | 36 + vercel.json | 28 + verificar_usuario.sql | 21 + vite.config.ts | 120 + 259 files changed, 51707 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/SECRETS_SETUP.md create mode 100644 .github/workflows/auto-sync-deploy.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .gitignore create mode 100644 .trae/documents/Analise_Otimizacao_RDO.md create mode 100644 .trae/documents/Arquitetura_BD_RDO_Completa.md create mode 100644 .trae/documents/Arquitetura_Tecnica_RDO.md create mode 100644 .trae/documents/PRD_RDO_Mobile_App.md create mode 100644 .vercel/project.json create mode 100644 .vercelignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 auto-sync-config.json create mode 100644 capacitor.config.ts create mode 100644 database_scripts/check_data.sql create mode 100644 dist/_headers create mode 100644 dist/assets/css/index-DXaaJsOA.css create mode 100644 dist/assets/js/Auth-KZISTjMo.js create mode 100644 dist/assets/js/AuthCallback-DlZVcD4W.js create mode 100644 dist/assets/js/Cadastros-QZZ_REjv.js create mode 100644 dist/assets/js/Configuracoes-LYuviA0-.js create mode 100644 dist/assets/js/CreateObra-BwwQt_hK.js create mode 100644 dist/assets/js/CreateRDO-Bhe5_7xI.js create mode 100644 dist/assets/js/CreateTask-BlEDuvPM.js create mode 100644 dist/assets/js/Dashboard-BPPxBqO4.js create mode 100644 dist/assets/js/DatabaseTest-BA9LjsoE.js create mode 100644 dist/assets/js/ManualInstrucoes-G3xr1xLl.js create mode 100644 dist/assets/js/NeuralNetworkBackground-CER-dIFD.js create mode 100644 dist/assets/js/ObraDetails-S1VcIvXW.js create mode 100644 dist/assets/js/ObraTasks-Cy-rxhIo.js create mode 100644 dist/assets/js/RDODetails-tkR9ftO-.js create mode 100644 dist/assets/js/Reports-BmqmPZPj.js create mode 100644 dist/assets/js/SelectOrganization-Cb4zDKko.js create mode 100644 dist/assets/js/ThemeToggle-Cryh6OOS.js create mode 100644 dist/assets/js/configStore-DS-p50om.js create mode 100644 dist/assets/js/form-vendor-vQotxSmE.js create mode 100644 dist/assets/js/index-doec96Hx.js create mode 100644 dist/assets/js/query-vendor-BLVqILA6.js create mode 100644 dist/assets/js/react-vendor-CqRd3GwO.js create mode 100644 dist/assets/js/router-vendor-D4by-_6Z.js create mode 100644 dist/assets/js/state-vendor-DHadhBU5.js create mode 100644 dist/assets/js/supabase-vendor-CnnNSQLo.js create mode 100644 dist/assets/js/ui-vendor-CyRvbSfR.js create mode 100644 dist/assets/js/useInviteCode-BxOSdQOT.js create mode 100644 dist/assets/js/useUserStore-VOdYc7Zm.js create mode 100644 dist/assets/js/zod-7IfHMaWP.js create mode 100644 dist/assets/png/tracksteel-logo-CJR9ckUT.png create mode 100644 dist/favicon.svg create mode 100644 dist/icon-192x192.svg create mode 100644 dist/icon-512x512.svg create mode 100644 dist/index.html create mode 100644 dist/manifest.json create mode 100644 dist/tracksteel-logo.png create mode 100644 documentation/AI_RULES.md create mode 100644 documentation/APLICAR_MIGRATIONS_AGORA.md create mode 100644 documentation/ARQUITETURA_MULTI_TENANT.md create mode 100644 documentation/AUTO-SYNC-README.md create mode 100644 documentation/CHECKLIST_IMPLEMENTACAO.md create mode 100644 documentation/COMECE_AQUI.md create mode 100644 documentation/CONECTAR_SUPABASE_RDO.md create mode 100644 documentation/DEPLOYMENT_COMPLETO.md create mode 100644 documentation/ENTREGA_COMPLETA.md create mode 100644 documentation/INDICE_DOCUMENTACAO.md create mode 100644 documentation/INSTRUCOES_CONEXAO_RAPIDA.txt create mode 100644 documentation/INSTRUCOES_DEPLOY_SUPABASE.md create mode 100644 documentation/LICENCE.md create mode 100644 documentation/Manual_RDO_Livro.html create mode 100644 documentation/Manual_RDO_Livro.md create mode 100644 documentation/Manual_Usuario_RDO.md create mode 100644 documentation/PLANO_SAAS_MULTI_TENANT.md create mode 100644 documentation/PRONTO_PARA_DESENVOLVIMENTO.md create mode 100644 documentation/PROXIMOS_PASSOS.md create mode 100644 documentation/README-AUTO-SYNC.md create mode 100644 documentation/README_DEPLOY.md create mode 100644 documentation/README_SAAS_MULTI_TENANT.md create mode 100644 documentation/RESUMO_ACOES_PRIORITARIAS.md create mode 100644 documentation/RESUMO_EXECUTIVO_CONEXAO.md create mode 100644 documentation/SETUP_VISUAL.md create mode 100644 documentation/STATUS_DEPLOYMENT.md create mode 100644 documentation/temp-base64.txt create mode 100644 eslint.config.js create mode 100644 fix_admin_permissions.sql create mode 100644 fix_admin_permissions_v2.sql create mode 100644 fix_config_tables_rls.sql create mode 100644 fix_nuclear_rls.sql create mode 100644 fix_nuclear_rls_v2.sql create mode 100644 fix_permissions_rls.sql create mode 100644 fix_rls_definitivo.sql create mode 100644 index.html create mode 100644 ios/.gitignore create mode 100644 ios/App/App.xcodeproj/project.pbxproj create mode 100644 ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png create mode 100644 ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ios/App/App/Assets.xcassets/Contents.json create mode 100644 ios/App/App/Assets.xcassets/Splash.imageset/Contents.json create mode 100644 ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png create mode 100644 ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png create mode 100644 ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png create mode 100644 ios/App/App/Base.lproj/LaunchScreen.storyboard create mode 100644 ios/App/App/Base.lproj/Main.storyboard create mode 100644 ios/App/App/Info.plist create mode 100644 ios/App/Podfile create mode 100644 logging-config.json create mode 100644 migrate_mockups_to_db.sql create mode 100644 netlify.toml create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 public/_headers create mode 100644 public/favicon.svg create mode 100644 public/icon-192x192.svg create mode 100644 public/icon-512x512.svg create mode 100644 public/manifest.json create mode 100644 public/tracksteel-logo.png create mode 100644 railway.json create mode 100644 render.yaml create mode 100644 scripts/apply-migrations-cli.sh create mode 100644 scripts/apply-migrations.js create mode 100644 scripts/apply-migrations.ps1 create mode 100644 scripts/auto-sync-github.ps1 create mode 100644 scripts/auto-sync.js create mode 100644 scripts/auto-syncRDO.ps1 create mode 100644 scripts/check-supabase-status.js create mode 100644 scripts/check_data.js create mode 100644 scripts/check_database.js create mode 100644 scripts/confirm-user-email.js create mode 100644 scripts/create-confirmed-user.js create mode 100644 scripts/deploy-migrations.js create mode 100644 scripts/file-watcher.ps1 create mode 100644 scripts/logging-notifications.ps1 create mode 100644 scripts/setup-supabase.js create mode 100644 scripts/start-auto-sync.bat create mode 100644 scripts/start-auto-sync.ps1 create mode 100644 scripts/start.js create mode 100644 scripts/test-login.js create mode 100644 scripts/test-user-creation.js create mode 100644 scripts/test_buttons.js create mode 100644 scripts/test_final_functionality.js create mode 100644 scripts/verify-supabase.js create mode 100644 setup_full_db.sql create mode 100644 src/App.tsx create mode 100644 src/assets/logo-base64.ts create mode 100644 src/assets/react.svg create mode 100644 src/assets/tracksteel-logo.png create mode 100644 src/components/BottomNav.tsx create mode 100644 src/components/CameraCapture.tsx create mode 100644 src/components/Empty.tsx create mode 100644 src/components/ErrorBoundary.tsx create mode 100644 src/components/ManageInvites.tsx create mode 100644 src/components/NeuralNetworkBackground.tsx create mode 100644 src/components/OfflineIndicator.tsx create mode 100644 src/components/OfflineStatus.tsx create mode 100644 src/components/TaskLogModal.tsx create mode 100644 src/components/ThemeToggle.tsx create mode 100644 src/components/auth/LoginForm.tsx create mode 100644 src/components/auth/MFASetup.tsx create mode 100644 src/components/auth/MFAVerification.tsx create mode 100644 src/components/auth/ProtectedRoute.tsx create mode 100644 src/components/auth/RegisterForm.tsx create mode 100644 src/components/auth/SocialLoginButtons.tsx create mode 100644 src/components/config/CondicoesClimaticasConfig.tsx create mode 100644 src/components/config/FuncoesCargosConfig.tsx create mode 100644 src/components/config/MateriaisConfig.tsx create mode 100644 src/components/config/TiposAtividadeConfig.tsx create mode 100644 src/components/config/TiposEquipamentoConfig.tsx create mode 100644 src/components/config/TiposOcorrenciaConfig.tsx create mode 100644 src/config/routes.tsx create mode 100644 src/contexts/AuthContext.tsx create mode 100644 src/db/db.ts create mode 100644 src/hooks/index.ts create mode 100644 src/hooks/queries/index.ts create mode 100644 src/hooks/queries/useObras.ts create mode 100644 src/hooks/queries/useRdos.ts create mode 100644 src/hooks/queries/useUsers.ts create mode 100644 src/hooks/useAuth.ts create mode 100644 src/hooks/useInviteCode.ts create mode 100644 src/hooks/useMFA.ts create mode 100644 src/hooks/useOffline.ts create mode 100644 src/hooks/useRDO.ts create mode 100644 src/hooks/useRealtimeSync.ts create mode 100644 src/hooks/useSocialAuth.ts create mode 100644 src/hooks/useSupabaseData.ts create mode 100644 src/hooks/useTheme.ts create mode 100644 src/index.css create mode 100644 src/layouts/MainLayout.tsx create mode 100644 src/lib/cacheManager.ts create mode 100644 src/lib/offlineDb.ts create mode 100644 src/lib/queryClient.ts create mode 100644 src/lib/reactQueryConfig.ts create mode 100644 src/lib/supabase.ts create mode 100644 src/lib/utils.ts create mode 100644 src/main.tsx create mode 100644 src/pages/Auth.tsx create mode 100644 src/pages/AuthCallback.tsx create mode 100644 src/pages/Cadastros.tsx create mode 100644 src/pages/Configuracoes.tsx create mode 100644 src/pages/CreateObra.tsx create mode 100644 src/pages/CreateRDO.tsx create mode 100644 src/pages/CreateTask.tsx create mode 100644 src/pages/Dashboard.tsx create mode 100644 src/pages/DatabaseTest.tsx create mode 100644 src/pages/Home.tsx create mode 100644 src/pages/ManualInstrucoes.tsx create mode 100644 src/pages/ObraDetails.tsx create mode 100644 src/pages/ObraTasks.tsx create mode 100644 src/pages/RDODetails.tsx create mode 100644 src/pages/Reports.tsx create mode 100644 src/pages/SelectOrganization.tsx create mode 100644 src/pages/SyncLogsPage.tsx create mode 100644 src/pages/Tasks.tsx create mode 100644 src/providers/OfflineProvider.tsx create mode 100644 src/providers/QueryProvider.tsx create mode 100644 src/providers/index.ts create mode 100644 src/services/conflictResolver.ts create mode 100644 src/services/mfaService.ts create mode 100644 src/services/syncService.ts create mode 100644 src/stores/configStore.ts create mode 100644 src/stores/index.ts create mode 100644 src/stores/migration-plan.md create mode 100644 src/stores/useAppStateStore.ts create mode 100644 src/stores/useAppStore.ts create mode 100644 src/stores/useObraStore.ts create mode 100644 src/stores/useTaskStore.ts create mode 100644 src/stores/useUserStore.ts create mode 100644 src/tests/database-connection.test.ts create mode 100644 src/types/api.types.ts create mode 100644 src/types/database.types.ts create mode 100644 src/types/domain.types.ts create mode 100644 src/types/index.ts create mode 100644 src/types/taskLog.ts create mode 100644 src/types/validation.types.ts create mode 100644 src/utils/dateUtils.ts create mode 100644 src/utils/taskLogManager.ts create mode 100644 src/vite-env.d.ts create mode 100644 supabase/.temp/cli-latest create mode 100644 supabase/.temp/gotrue-version create mode 100644 supabase/.temp/pooler-url create mode 100644 supabase/.temp/postgres-version create mode 100644 supabase/.temp/project-ref create mode 100644 supabase/.temp/rest-version create mode 100644 supabase/.temp/storage-version create mode 100644 supabase/migrations/20241202000001_create_multi_tenant_schema.sql create mode 100644 supabase/migrations/20241202000002_create_functions_and_triggers.sql create mode 100644 supabase/migrations/20241202000003_create_rls_policies.sql create mode 100644 supabase/migrations/20241202000004_seed_initial_data.sql create mode 100644 supabase/migrations/20241206120000_fix_rls_recursion.sql create mode 100644 supabase/migrations/20241206130000_create_aux_tables.sql create mode 100644 supabase/migrations/fix_table_permissions.sql create mode 100644 supabase/migrations/insert_mock_data.sql create mode 100644 supabase_debug.sql create mode 100644 supabase_migration_completa.sql create mode 100644 supabase_migration_convites.sql create mode 100644 tailwind.config.js create mode 100644 tsconfig.json create mode 100644 vercel.json create mode 100644 verificar_usuario.sql create mode 100644 vite.config.ts diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/SECRETS_SETUP.md b/.github/SECRETS_SETUP.md new file mode 100644 index 0000000..32d4268 --- /dev/null +++ b/.github/SECRETS_SETUP.md @@ -0,0 +1,110 @@ +# Configuração de Secrets para GitHub Actions + +Para que a automação funcione corretamente, você precisa configurar os seguintes secrets no seu repositório GitHub: + +## Como Configurar Secrets + +1. Vá para o seu repositório no GitHub +2. Clique em **Settings** (Configurações) +3. No menu lateral, clique em **Secrets and variables** > **Actions** +4. Clique em **New repository secret** +5. Adicione cada secret listado abaixo + +## Secrets Necessários + +### 🔑 REMOTE_REPO_TOKEN +**Descrição:** Token de acesso pessoal para o repositório remoto `https://github.com/Reifonas/TS_RDO.git` + +**Como obter:** +1. Vá para GitHub Settings > Developer settings > Personal access tokens > Tokens (classic) +2. Clique em "Generate new token (classic)" +3. Selecione as permissões: + - `repo` (acesso completo a repositórios) + - `workflow` (atualizar workflows) + - `write:packages` (se usar packages) +4. Copie o token gerado +5. Cole no secret `REMOTE_REPO_TOKEN` + +### 🌐 NETLIFY_AUTH_TOKEN (Opcional) +**Descrição:** Token de autenticação do Netlify para deploy automático + +**Como obter:** +1. Faça login no Netlify +2. Vá para User settings > Applications > Personal access tokens +3. Clique em "New access token" +4. Dê um nome e clique em "Generate token" +5. Copie o token e cole no secret `NETLIFY_AUTH_TOKEN` + +### 🆔 NETLIFY_SITE_ID (Opcional) +**Descrição:** ID do site no Netlify + +**Como obter:** +1. No dashboard do Netlify, clique no seu site +2. Vá para Site settings > General > Site details +3. Copie o "Site ID" +4. Cole no secret `NETLIFY_SITE_ID` + +## Verificação da Configuração + +Após configurar os secrets, você pode testar a automação: + +1. **Teste Manual:** + - Vá para Actions no seu repositório + - Clique em "Auto Sync and Deploy" + - Clique em "Run workflow" + - Marque "Force deploy" se quiser forçar + +2. **Teste Automático:** + - Faça qualquer alteração no código + - Commit e push para a branch main + - A action será executada automaticamente + +## Estrutura dos Secrets + +``` +Repository Secrets: +├── REMOTE_REPO_TOKEN # Token para repositório remoto (OBRIGATÓRIO) +├── NETLIFY_AUTH_TOKEN # Token Netlify (opcional) +├── NETLIFY_SITE_ID # ID do site Netlify (opcional) +└── GITHUB_TOKEN # Automático (não precisa configurar) +``` + +## Troubleshooting + +### ❌ Erro: "Authentication failed" +- Verifique se o `REMOTE_REPO_TOKEN` está correto +- Confirme se o token tem as permissões necessárias +- Verifique se o token não expirou + +### ❌ Erro: "Repository not found" +- Confirme se o repositório `Reifonas/TS_RDO` existe +- Verifique se o token tem acesso ao repositório + +### ❌ Erro de Deploy Netlify +- Verifique se `NETLIFY_AUTH_TOKEN` e `NETLIFY_SITE_ID` estão corretos +- Confirme se o site existe no Netlify + +## Logs e Monitoramento + +Para acompanhar a execução: +1. Vá para **Actions** no seu repositório +2. Clique na execução desejada +3. Expanda os jobs para ver os logs detalhados + +## Segurança + +⚠️ **IMPORTANTE:** +- Nunca compartilhe seus tokens +- Use tokens com permissões mínimas necessárias +- Revogue tokens antigos quando não precisar mais +- Monitore o uso dos tokens regularmente + +## Frequência de Execução + +A action executa: +- ✅ A cada push na branch main ou develop +- ✅ A cada pull request para main +- ✅ A cada 30 minutos (agendado) +- ✅ Manualmente quando solicitado + +Para alterar a frequência, edite o arquivo `.github/workflows/auto-sync-deploy.yml` \ No newline at end of file diff --git a/.github/workflows/auto-sync-deploy.yml b/.github/workflows/auto-sync-deploy.yml new file mode 100644 index 0000000..a97f592 --- /dev/null +++ b/.github/workflows/auto-sync-deploy.yml @@ -0,0 +1,263 @@ +name: Auto Sync and Deploy + +# Triggers para execução da action +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + schedule: + # Executa a cada 30 minutos + - cron: '*/30 * * * *' + workflow_dispatch: + inputs: + force_deploy: + description: 'Force deploy even without changes' + required: false + default: 'false' + type: boolean + target_branch: + description: 'Target branch for deployment' + required: false + default: 'main' + type: string + +env: + NODE_VERSION: '18' + PNPM_VERSION: '8' + TARGET_REPO: 'Reifonas/TS_RDO' + +jobs: + # Job para verificar mudanças + check-changes: + runs-on: ubuntu-latest + outputs: + has-changes: ${{ steps.changes.outputs.has-changes }} + changed-files: ${{ steps.changes.outputs.changed-files }} + steps: + - name: Checkout código + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Verificar mudanças + id: changes + run: | + if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ inputs.force_deploy }}" = "true" ]; then + echo "has-changes=true" >> $GITHUB_OUTPUT + echo "changed-files=scheduled-run" >> $GITHUB_OUTPUT + else + CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD || echo "") + if [ -n "$CHANGED_FILES" ]; then + echo "has-changes=true" >> $GITHUB_OUTPUT + echo "changed-files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + echo "has-changes=false" >> $GITHUB_OUTPUT + echo "changed-files=" >> $GITHUB_OUTPUT + fi + fi + + # Job para build e testes + build-and-test: + needs: check-changes + if: needs.check-changes.outputs.has-changes == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout código + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Instalar dependências + run: pnpm install --frozen-lockfile + + - name: Executar linting + run: pnpm run lint + continue-on-error: true + + - name: Executar testes + run: pnpm run test + continue-on-error: true + + - name: Build do projeto + run: pnpm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-files + path: dist/ + retention-days: 1 + + # Job para sincronização com repositório remoto + sync-to-remote: + needs: [check-changes, build-and-test] + if: needs.check-changes.outputs.has-changes == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout código atual + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Configurar Git + run: | + git config --global user.name "Auto Sync Bot" + git config --global user.email "auto-sync@rdo-app.com" + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-files + path: dist/ + + - name: Preparar arquivos para sincronização + run: | + # Criar diretório temporário + mkdir -p /tmp/sync-repo + + # Copiar arquivos essenciais (excluir node_modules, logs, etc.) + rsync -av --exclude='node_modules' \ + --exclude='.git' \ + --exclude='logs' \ + + --exclude='.env.local' \ + --exclude='*.log' \ + --exclude='.trae' \ + --exclude='android' \ + --exclude='ios' \ + ./ /tmp/sync-repo/ + + - name: Clonar repositório remoto + env: + REMOTE_TOKEN: ${{ secrets.REMOTE_REPO_TOKEN }} + run: | + cd /tmp + git clone https://${REMOTE_TOKEN}@github.com/${{ env.TARGET_REPO }}.git remote-repo + cd remote-repo + git checkout ${{ inputs.target_branch || 'main' }} || git checkout -b ${{ inputs.target_branch || 'main' }} + + - name: Sincronizar arquivos + run: | + cd /tmp/remote-repo + + # Remover arquivos antigos (exceto .git) + find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + + + # Copiar novos arquivos + cp -r /tmp/sync-repo/* . + cp -r /tmp/sync-repo/.* . 2>/dev/null || true + + # Adicionar todos os arquivos + git add . + + - name: Commit e Push para repositório remoto + env: + REMOTE_TOKEN: ${{ secrets.REMOTE_REPO_TOKEN }} + run: | + cd /tmp/remote-repo + + # Verificar se há mudanças + if git diff --staged --quiet; then + echo "Nenhuma mudança para sincronizar" + exit 0 + fi + + # Criar mensagem de commit + COMMIT_MSG="Auto-sync from RDO-C: $(date '+%Y-%m-%d %H:%M:%S')" + if [ "${{ needs.check-changes.outputs.changed-files }}" != "scheduled-run" ]; then + COMMIT_MSG="$COMMIT_MSG\n\nChanged files:\n${{ needs.check-changes.outputs.changed-files }}" + fi + + # Commit e push + git commit -m "$COMMIT_MSG" + git push origin ${{ inputs.target_branch || 'main' }} + + # Job para deploy (se necessário) + deploy: + needs: [check-changes, build-and-test, sync-to-remote] + if: needs.check-changes.outputs.has-changes == 'true' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - name: Checkout código + uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-files + path: dist/ + + - name: Deploy para Netlify + uses: nwtgck/actions-netlify@v3.0 + with: + publish-dir: './dist' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Auto-deploy from commit ${{ github.sha }}" + enable-pull-request-comment: false + enable-commit-comment: true + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 10 + + # Job para notificações + notify: + needs: [check-changes, build-and-test, sync-to-remote, deploy] + if: always() && needs.check-changes.outputs.has-changes == 'true' + runs-on: ubuntu-latest + steps: + - name: Notificar sucesso + if: needs.sync-to-remote.result == 'success' + run: | + echo "✅ Sincronização concluída com sucesso!" + echo "Repositório: ${{ env.TARGET_REPO }}" + echo "Branch: ${{ inputs.target_branch || 'main' }}" + echo "Commit: ${{ github.sha }}" + + - name: Notificar falha + if: needs.sync-to-remote.result == 'failure' || needs.build-and-test.result == 'failure' + run: | + echo "❌ Falha na sincronização!" + echo "Verifique os logs para mais detalhes." + exit 1 + + # Job para limpeza + cleanup: + needs: [check-changes, build-and-test, sync-to-remote, deploy, notify] + if: always() + runs-on: ubuntu-latest + steps: + - name: Limpar artifacts + uses: actions/github-script@v7 + with: + script: | + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.runId, + }); + + for (const artifact of artifacts.data.artifacts) { + if (artifact.name === 'build-files') { + await github.rest.actions.deleteArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: artifact.id, + }); + console.log(`Artifact ${artifact.name} removido`); + } + } \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..7562839 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,64 @@ +name: Deploy to GitHub Pages + +on: + # Executa no push para a branch main + push: + branches: [ main ] + # Permite execução manual + workflow_dispatch: + +# Define permissões necessárias para o GITHUB_TOKEN +permissions: + contents: read + pages: write + id-token: write + +# Permite apenas um deploy por vez +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Job de build + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm run build + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './dist' + + # Job de deploy + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b809be9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,109 @@ +# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore + +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +# Android Profiling +*.hprof + +# Cordova plugins for Capacitor +capacitor-cordova-android-plugins + +# Copied web assets +app/src/main/assets/public + +# Generated Config files +app/src/main/assets/capacitor.config.json +app/src/main/assets/capacitor.plugins.json +app/src/main/res/xml/config.xml +node_modules +.env +.env.* +dist +dist-ssr +*.local +.DS_Store +chaves secretas criadas no goolge cloud.txt diff --git a/.trae/documents/Analise_Otimizacao_RDO.md b/.trae/documents/Analise_Otimizacao_RDO.md new file mode 100644 index 0000000..245b97f --- /dev/null +++ b/.trae/documents/Analise_Otimizacao_RDO.md @@ -0,0 +1,352 @@ +# Análise Completa e Plano de Otimização - Aplicativo RDO + +## 1. Resumo Executivo + +Este documento apresenta uma análise detalhada da estrutura atual do aplicativo RDO (Relatório Diário de Obra) e propõe um plano abrangente de otimização, refatoração e modernização do código. O objetivo é melhorar a performance, legibilidade, manutenibilidade e seguir as melhores práticas atuais de desenvolvimento. + +## 2. Análise da Arquitetura Atual + +### 2.1 Pontos Fortes Identificados +- ✅ Uso de TypeScript para tipagem estática +- ✅ Arquitetura baseada em React 18 com hooks modernos +- ✅ Integração com Supabase para backend-as-a-service +- ✅ Implementação de React Query para gerenciamento de estado servidor +- ✅ Uso de Zustand para estado global +- ✅ Configuração de PWA com Capacitor +- ✅ Implementação de modo offline com Dexie +- ✅ Estrutura de pastas organizada + +### 2.2 Problemas Críticos Identificados + +#### 2.2.1 Duplicação de Lógica de Estado +- ❌ **Problema**: Existem dois sistemas paralelos para gerenciamento de obras: + - `src/hooks/useObras.ts` (useState + useEffect) + - `src/hooks/queries/useObras.ts` (React Query) + - `src/stores/useObraStore.ts` (Zustand) +- ❌ **Impacto**: Inconsistência de dados, complexidade desnecessária, bugs potenciais + +#### 2.2.2 Configuração TypeScript Permissiva +- ❌ **Problema**: `tsconfig.json` com `strict: false` e outras verificações desabilitadas +- ❌ **Impacto**: Perda de benefícios da tipagem estática, bugs em runtime + +#### 2.2.3 Estrutura de Rotas Repetitiva +- ❌ **Problema**: Código repetitivo no `App.tsx` com múltiplas rotas similares +- ❌ **Impacto**: Dificulta manutenção e adiciona verbosidade + +#### 2.2.4 Falta de Padronização de Componentes +- ❌ **Problema**: Componentes sem padrão consistente de props e estrutura +- ❌ **Impacto**: Dificuldade de manutenção e reutilização + +## 3. Plano de Otimização Detalhado + +### 3.1 Fase 1: Consolidação da Arquitetura de Estado (Prioridade Alta) + +#### 3.1.1 Migração para Arquitetura Unificada +**Objetivo**: Eliminar duplicações e criar uma única fonte de verdade + +**Ações**: +1. **Manter apenas React Query + Zustand**: + - Remover hooks baseados em useState (`useObras.ts`, `useRdos.ts`, etc.) + - Usar React Query para estado servidor (dados do Supabase) + - Usar Zustand apenas para estado cliente (UI, configurações) + +2. **Reestruturar hooks de queries**: + ```typescript + // Estrutura otimizada + src/hooks/ + ├── queries/ + │ ├── useObrasQuery.ts // React Query apenas + │ ├── useRdosQuery.ts // React Query apenas + │ └── useUsersQuery.ts // React Query apenas + ├── stores/ + │ ├── useUIStore.ts // Estado da UI + │ ├── useConfigStore.ts // Configurações + │ └── useOfflineStore.ts // Estado offline + └── index.ts + ``` + +3. **Implementar padrão de custom hooks compostos**: + ```typescript + // Exemplo: useObra.ts + export const useObra = (id: string) => { + const query = useObraQuery(id); + const mutation = useUpdateObraMutation(); + const uiState = useUIStore(); + + return { + ...query, + update: mutation.mutate, + isUpdating: mutation.isPending, + // Lógica composta + }; + }; + ``` + +#### 3.1.2 Otimização do React Query +**Configurações aprimoradas**: +```typescript +// queryClient.ts otimizado +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 5 * 60 * 1000, // 5 minutos + gcTime: 10 * 60 * 1000, // 10 minutos + retry: (failureCount, error) => { + if (error?.status === 401) return false; + return failureCount < 3; + }, + refetchOnWindowFocus: false, // Otimização mobile + }, + }, +}); +``` + +### 3.2 Fase 2: Modernização do TypeScript (Prioridade Alta) + +#### 3.2.1 Configuração Strict +```json +// tsconfig.json otimizado +{ + "compilerOptions": { + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "exactOptionalPropertyTypes": true, + "noUncheckedIndexedAccess": true + } +} +``` + +#### 3.2.2 Melhoria dos Tipos +1. **Criar tipos específicos do domínio**: + ```typescript + // types/domain.ts + export type ObraStatus = 'ativa' | 'pausada' | 'concluida' | 'cancelada'; + export type UserRole = 'admin' | 'engenheiro' | 'mestre_obra' | 'usuario'; + + export interface ObraWithRelations extends Obra { + responsavel?: Usuario; + rdos?: RDO[]; + } + ``` + +2. **Implementar branded types para IDs**: + ```typescript + export type ObraId = string & { readonly brand: unique symbol }; + export type UserId = string & { readonly brand: unique symbol }; + ``` + +### 3.3 Fase 3: Refatoração de Componentes (Prioridade Média) + +#### 3.3.1 Sistema de Design Consistente +1. **Criar componentes base reutilizáveis**: + ```typescript + // components/ui/ + ├── Button/ + │ ├── Button.tsx + │ ├── Button.types.ts + │ └── Button.stories.tsx + ├── Input/ + ├── Modal/ + └── Card/ + ``` + +2. **Implementar compound components**: + ```typescript + // Exemplo: Modal compound component + export const Modal = { + Root: ModalRoot, + Header: ModalHeader, + Body: ModalBody, + Footer: ModalFooter, + }; + ``` + +#### 3.3.2 Otimização de Performance +1. **Implementar React.memo estratégico**: + ```typescript + export const ObraCard = React.memo(({ obra }: { obra: Obra }) => { + // Componente otimizado + }); + ``` + +2. **Usar React.lazy para code splitting**: + ```typescript + const ObraDetails = React.lazy(() => import('./pages/ObraDetails')); + ``` + +3. **Implementar virtualization para listas grandes**: + ```typescript + import { FixedSizeList as List } from 'react-window'; + ``` + +### 3.4 Fase 4: Otimização de Rotas (Prioridade Média) + +#### 3.4.1 Configuração Declarativa de Rotas +```typescript +// routes/config.ts +export const routes = [ + { + path: '/', + element: Dashboard, + protected: true, + layout: MainLayout, + }, + { + path: '/obra/:id', + element: ObraDetails, + protected: true, + layout: null, // Tela cheia + }, +] as const; + +// App.tsx simplificado +export default function App() { + return ( + + + + + + + + ); +} +``` + +### 3.5 Fase 5: Otimizações de Performance (Prioridade Média) + +#### 3.5.1 Bundle Optimization +1. **Configurar Vite para otimização**: + ```typescript + // vite.config.ts + export default defineConfig({ + build: { + rollupOptions: { + output: { + manualChunks: { + vendor: ['react', 'react-dom'], + supabase: ['@supabase/supabase-js'], + ui: ['@radix-ui/react-dialog', '@radix-ui/react-select'], + }, + }, + }, + }, + }); + ``` + +2. **Implementar preloading estratégico**: + ```typescript + // Preload de rotas críticas + const prefetchObraDetails = (obraId: string) => { + queryClient.prefetchQuery({ + queryKey: ['obra', obraId], + queryFn: () => getObra(obraId), + }); + }; + ``` + +#### 3.5.2 Otimização de Imagens e Assets +1. **Implementar lazy loading de imagens** +2. **Usar WebP com fallback** +3. **Configurar service worker para cache de assets** + +### 3.6 Fase 6: Melhorias de DX (Developer Experience) + +#### 3.6.1 Ferramentas de Desenvolvimento +1. **Configurar ESLint mais rigoroso**: + ```javascript + // eslint.config.js + export default [ + ...tseslint.configs.strictTypeChecked, + { + rules: { + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + 'react-hooks/exhaustive-deps': 'error', + }, + }, + ]; + ``` + +2. **Implementar Prettier com configuração consistente** +3. **Configurar Husky para pre-commit hooks** + +#### 3.6.2 Testing Strategy +1. **Implementar testes unitários com Vitest** +2. **Testes de integração com Testing Library** +3. **E2E tests com Playwright** + +## 4. Cronograma de Implementação + +### Sprint 1 (2 semanas) - Fundação +- [ ] Configurar TypeScript strict mode +- [ ] Consolidar arquitetura de estado (Fase 1) +- [ ] Remover hooks duplicados +- [ ] Configurar ferramentas de desenvolvimento + +### Sprint 2 (2 semanas) - Componentes +- [ ] Criar sistema de design base +- [ ] Refatorar componentes principais +- [ ] Implementar compound components +- [ ] Otimizar performance com React.memo + +### Sprint 3 (1 semana) - Rotas e Performance +- [ ] Refatorar sistema de rotas +- [ ] Implementar code splitting +- [ ] Otimizar bundle com Vite +- [ ] Configurar preloading + +### Sprint 4 (1 semana) - Finalização +- [ ] Testes e validação +- [ ] Documentação +- [ ] Deploy e monitoramento + +## 5. Métricas de Sucesso + +### 5.1 Performance +- **Bundle size**: Redução de 30% +- **First Contentful Paint**: < 1.5s +- **Largest Contentful Paint**: < 2.5s +- **Time to Interactive**: < 3s + +### 5.2 Qualidade de Código +- **TypeScript coverage**: 100% +- **ESLint errors**: 0 +- **Test coverage**: > 80% +- **Duplicação de código**: < 5% + +### 5.3 Developer Experience +- **Build time**: Redução de 40% +- **Hot reload**: < 200ms +- **Type checking**: < 5s + +## 6. Riscos e Mitigações + +### 6.1 Riscos Identificados +1. **Breaking changes durante refatoração** + - *Mitigação*: Implementar testes abrangentes antes das mudanças + +2. **Regressões de funcionalidade** + - *Mitigação*: Refatoração incremental com validação contínua + +3. **Resistência da equipe às mudanças** + - *Mitigação*: Documentação clara e treinamento + +### 6.2 Plano de Rollback +- Manter branches de feature para cada fase +- Implementar feature flags para mudanças críticas +- Monitoramento contínuo em produção + +## 7. Conclusão + +Este plano de otimização transformará o aplicativo RDO em uma aplicação moderna, performática e maintível. A implementação incremental garante baixo risco enquanto maximiza os benefícios de cada melhoria. + +A consolidação da arquitetura de estado e a modernização do TypeScript são as prioridades mais altas, pois impactam diretamente na estabilidade e manutenibilidade do código. + +Com a implementação completa deste plano, esperamos: +- **50% de redução** no tempo de desenvolvimento de novas features +- **30% de melhoria** na performance da aplicação +- **90% de redução** em bugs relacionados a tipos +- **Experiência de desenvolvimento** significativamente melhorada \ No newline at end of file diff --git a/.trae/documents/Arquitetura_BD_RDO_Completa.md b/.trae/documents/Arquitetura_BD_RDO_Completa.md new file mode 100644 index 0000000..1ef92bc --- /dev/null +++ b/.trae/documents/Arquitetura_BD_RDO_Completa.md @@ -0,0 +1,1106 @@ +# Arquitetura Completa de Banco de Dados - RDO Mobile App + +## 1. Visão Geral da Arquitetura de Dados + +### 1.1 Estratégia de Banco de Dados + +O sistema RDO Mobile utiliza **Supabase** como solução Backend-as-a-Service (BaaS), fornecendo: +- **PostgreSQL** como banco de dados principal +- **Autenticação** integrada com Row Level Security (RLS) +- **Storage** para arquivos e imagens +- **Real-time subscriptions** para sincronização em tempo real +- **Edge Functions** para lógica de negócio complexa + +### 1.2 Arquitetura de Conexão + +```mermaid +graph TD + A[React Frontend] --> B[Supabase Client SDK] + B --> C[Supabase API Gateway] + C --> D[PostgreSQL Database] + C --> E[Supabase Auth] + C --> F[Supabase Storage] + C --> G[Real-time Engine] + + subgraph "Frontend Layer" + A + H[Zustand Store] + I[TanStack Query Cache] + J[IndexedDB Offline] + end + + subgraph "Supabase Backend" + C + D + E + F + G + K[Row Level Security] + L[Edge Functions] + end + + A --> H + A --> I + A --> J + D --> K + C --> L +``` + +## 2. Modelo de Dados Completo + +### 2.1 Diagrama Entidade-Relacionamento + +```mermaid +erDiagram + USUARIOS ||--o{ OBRAS : gerencia + USUARIOS ||--o{ RDOS : cria + OBRAS ||--o{ RDOS : possui + OBRAS ||--o{ TAREFAS : contem + RDOS ||--o{ RDO_ATIVIDADES : possui + RDOS ||--o{ RDO_MAO_OBRA : registra + RDOS ||--o{ RDO_EQUIPAMENTOS : utiliza + RDOS ||--o{ RDO_OCORRENCIAS : reporta + RDOS ||--o{ RDO_ANEXOS : contem + RDOS ||--o{ RDO_INSPECOES_SOLDA : possui + RDOS ||--o{ RDO_VERIFICACOES_TORQUE : possui + TAREFAS ||--o{ TASK_LOGS : possui + USUARIOS ||--o{ TASK_LOGS : executa + + USUARIOS { + uuid id PK + string email UK + string nome + string telefone + string cargo + string role + boolean ativo + timestamp created_at + timestamp updated_at + } + + OBRAS { + uuid id PK + string nome + string descricao + string endereco + string cep + string cidade + string estado + uuid responsavel_id FK + date data_inicio + date data_prevista_fim + decimal progresso_geral + string status + jsonb configuracoes + timestamp created_at + timestamp updated_at + } + + RDOS { + uuid id PK + uuid obra_id FK + uuid criado_por FK + date data_relatorio + string condicoes_climaticas + text observacoes_gerais + string status + uuid aprovado_por FK + timestamp aprovado_em + timestamp created_at + timestamp updated_at + } + + RDO_ATIVIDADES { + uuid id PK + uuid rdo_id FK + string tipo_atividade + text descricao + string localizacao + decimal percentual_concluido + integer ordem + timestamp created_at + } + + RDO_MAO_OBRA { + uuid id PK + uuid rdo_id FK + string funcao + integer quantidade + decimal horas_trabalhadas + text observacoes + timestamp created_at + } + + RDO_EQUIPAMENTOS { + uuid id PK + uuid rdo_id FK + string nome_equipamento + string tipo + decimal horas_utilizadas + decimal combustivel_gasto + text observacoes + timestamp created_at + } + + RDO_OCORRENCIAS { + uuid id PK + uuid rdo_id FK + string tipo_ocorrencia + text descricao + string gravidade + text acao_tomada + timestamp created_at + } + + RDO_ANEXOS { + uuid id PK + uuid rdo_id FK + string nome_arquivo + string tipo_arquivo + string url_storage + integer tamanho_bytes + text descricao + timestamp created_at + } + + RDO_INSPECOES_SOLDA { + uuid id PK + uuid rdo_id FK + string identificacao_junta + string status_inspecao + string metodo_inspecao + text observacoes + uuid inspecionado_por FK + timestamp created_at + } + + RDO_VERIFICACOES_TORQUE { + uuid id PK + uuid rdo_id FK + string identificacao_parafuso + decimal torque_especificado + decimal torque_aplicado + string status_verificacao + text observacoes + uuid verificado_por FK + timestamp created_at + } + + TAREFAS { + uuid id PK + uuid obra_id FK + string titulo + text descricao + string status + string prioridade + uuid responsavel_id FK + date data_inicio + date data_fim + decimal progresso + jsonb metadados + timestamp created_at + timestamp updated_at + } + + TASK_LOGS { + uuid id PK + uuid task_id FK + uuid usuario_id FK + string tipo_evento + text descricao + jsonb detalhes + timestamp created_at + } +``` + +## 3. Scripts de Criação do Banco de Dados + +### 3.1 Tabelas Principais + +```sql +-- Habilitar extensões necessárias +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; + +-- Tabela de Usuários +CREATE TABLE usuarios ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + email VARCHAR(255) UNIQUE NOT NULL, + nome VARCHAR(100) NOT NULL, + telefone VARCHAR(20), + cargo VARCHAR(50), + role VARCHAR(20) DEFAULT 'usuario' CHECK (role IN ('admin', 'engenheiro', 'mestre_obra', 'usuario')), + ativo BOOLEAN DEFAULT true, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Obras +CREATE TABLE obras ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + nome VARCHAR(200) NOT NULL, + descricao TEXT, + endereco TEXT, + cep VARCHAR(10), + cidade VARCHAR(100), + estado VARCHAR(2), + responsavel_id UUID REFERENCES usuarios(id), + data_inicio DATE, + data_prevista_fim DATE, + progresso_geral DECIMAL(5,2) DEFAULT 0.00, + status VARCHAR(20) DEFAULT 'ativa' CHECK (status IN ('ativa', 'pausada', 'concluida', 'cancelada')), + configuracoes JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de RDOs +CREATE TABLE rdos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + obra_id UUID NOT NULL REFERENCES obras(id) ON DELETE CASCADE, + criado_por UUID NOT NULL REFERENCES usuarios(id), + data_relatorio DATE NOT NULL, + condicoes_climaticas VARCHAR(50) NOT NULL, + observacoes_gerais TEXT, + status VARCHAR(20) DEFAULT 'rascunho' CHECK (status IN ('rascunho', 'enviado', 'aprovado', 'rejeitado')), + aprovado_por UUID REFERENCES usuarios(id), + aprovado_em TIMESTAMP WITH TIME ZONE, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + UNIQUE(obra_id, data_relatorio) +); + +-- Tabela de Atividades do RDO +CREATE TABLE rdo_atividades ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + tipo_atividade VARCHAR(100) NOT NULL, + descricao TEXT NOT NULL, + localizacao VARCHAR(200), + percentual_concluido DECIMAL(5,2) DEFAULT 0.00, + ordem INTEGER DEFAULT 1, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Mão de Obra do RDO +CREATE TABLE rdo_mao_obra ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + funcao VARCHAR(100) NOT NULL, + quantidade INTEGER NOT NULL DEFAULT 1, + horas_trabalhadas DECIMAL(4,2) NOT NULL DEFAULT 8.00, + observacoes TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Equipamentos do RDO +CREATE TABLE rdo_equipamentos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + nome_equipamento VARCHAR(100) NOT NULL, + tipo VARCHAR(50), + horas_utilizadas DECIMAL(4,2) DEFAULT 0.00, + combustivel_gasto DECIMAL(6,2) DEFAULT 0.00, + observacoes TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Ocorrências do RDO +CREATE TABLE rdo_ocorrencias ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + tipo_ocorrencia VARCHAR(100) NOT NULL, + descricao TEXT NOT NULL, + gravidade VARCHAR(20) DEFAULT 'baixa' CHECK (gravidade IN ('baixa', 'media', 'alta', 'critica')), + acao_tomada TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Anexos do RDO +CREATE TABLE rdo_anexos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + nome_arquivo VARCHAR(255) NOT NULL, + tipo_arquivo VARCHAR(50), + url_storage TEXT NOT NULL, + tamanho_bytes INTEGER, + descricao TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Inspeções de Solda +CREATE TABLE rdo_inspecoes_solda ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + identificacao_junta VARCHAR(100) NOT NULL, + status_inspecao VARCHAR(20) DEFAULT 'pendente' CHECK (status_inspecao IN ('aprovado', 'reprovado', 'pendente')), + metodo_inspecao VARCHAR(50), + observacoes TEXT, + inspecionado_por UUID REFERENCES usuarios(id), + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Verificações de Torque +CREATE TABLE rdo_verificacoes_torque ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + identificacao_parafuso VARCHAR(100) NOT NULL, + torque_especificado DECIMAL(6,2), + torque_aplicado DECIMAL(6,2) NOT NULL, + status_verificacao VARCHAR(20) DEFAULT 'conforme' CHECK (status_verificacao IN ('conforme', 'nao_conforme')), + observacoes TEXT, + verificado_por UUID REFERENCES usuarios(id), + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Tarefas +CREATE TABLE tarefas ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + obra_id UUID NOT NULL REFERENCES obras(id) ON DELETE CASCADE, + titulo VARCHAR(200) NOT NULL, + descricao TEXT, + status VARCHAR(20) DEFAULT 'pendente' CHECK (status IN ('pendente', 'em_andamento', 'concluida', 'cancelada')), + prioridade VARCHAR(20) DEFAULT 'media' CHECK (prioridade IN ('baixa', 'media', 'alta', 'urgente')), + responsavel_id UUID REFERENCES usuarios(id), + data_inicio DATE, + data_fim DATE, + progresso DECIMAL(5,2) DEFAULT 0.00, + metadados JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Tabela de Logs de Tarefas +CREATE TABLE task_logs ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + task_id UUID NOT NULL REFERENCES tarefas(id) ON DELETE CASCADE, + usuario_id UUID NOT NULL REFERENCES usuarios(id), + tipo_evento VARCHAR(20) NOT NULL CHECK (tipo_evento IN ('inicio', 'pausa', 'retomada', 'conclusao', 'revisao', 'edicao', 'cancelamento')), + descricao TEXT, + detalhes JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); +``` + +### 3.2 Índices para Performance + +```sql +-- Índices para otimização de consultas +CREATE INDEX idx_usuarios_email ON usuarios(email); +CREATE INDEX idx_usuarios_role ON usuarios(role); +CREATE INDEX idx_usuarios_ativo ON usuarios(ativo); + +CREATE INDEX idx_obras_responsavel ON obras(responsavel_id); +CREATE INDEX idx_obras_status ON obras(status); +CREATE INDEX idx_obras_data_inicio ON obras(data_inicio); + +CREATE INDEX idx_rdos_obra_data ON rdos(obra_id, data_relatorio); +CREATE INDEX idx_rdos_criado_por ON rdos(criado_por); +CREATE INDEX idx_rdos_status ON rdos(status); +CREATE INDEX idx_rdos_data_relatorio ON rdos(data_relatorio DESC); + +CREATE INDEX idx_rdo_atividades_rdo ON rdo_atividades(rdo_id); +CREATE INDEX idx_rdo_mao_obra_rdo ON rdo_mao_obra(rdo_id); +CREATE INDEX idx_rdo_equipamentos_rdo ON rdo_equipamentos(rdo_id); +CREATE INDEX idx_rdo_ocorrencias_rdo ON rdo_ocorrencias(rdo_id); +CREATE INDEX idx_rdo_anexos_rdo ON rdo_anexos(rdo_id); + +CREATE INDEX idx_tarefas_obra ON tarefas(obra_id); +CREATE INDEX idx_tarefas_responsavel ON tarefas(responsavel_id); +CREATE INDEX idx_tarefas_status ON tarefas(status); +CREATE INDEX idx_tarefas_data_fim ON tarefas(data_fim); + +CREATE INDEX idx_task_logs_task ON task_logs(task_id); +CREATE INDEX idx_task_logs_usuario ON task_logs(usuario_id); +CREATE INDEX idx_task_logs_created_at ON task_logs(created_at DESC); + +-- Índices para busca textual +CREATE INDEX idx_obras_nome_trgm ON obras USING gin(nome gin_trgm_ops); +CREATE INDEX idx_rdos_observacoes_trgm ON rdos USING gin(observacoes_gerais gin_trgm_ops); +``` + +### 3.3 Triggers para Auditoria + +```sql +-- Função para atualizar timestamp +CREATE OR REPLACE FUNCTION update_updated_at_column() +RETURNS TRIGGER AS $$ +BEGIN + NEW.updated_at = NOW(); + RETURN NEW; +END; +$$ language 'plpgsql'; + +-- Triggers para updated_at +CREATE TRIGGER update_usuarios_updated_at BEFORE UPDATE ON usuarios FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); +CREATE TRIGGER update_obras_updated_at BEFORE UPDATE ON obras FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); +CREATE TRIGGER update_rdos_updated_at BEFORE UPDATE ON rdos FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); +CREATE TRIGGER update_tarefas_updated_at BEFORE UPDATE ON tarefas FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); +``` + +## 4. Row Level Security (RLS) + +### 4.1 Políticas de Segurança + +```sql +-- Habilitar RLS em todas as tabelas +ALTER TABLE usuarios ENABLE ROW LEVEL SECURITY; +ALTER TABLE obras ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdos ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_atividades ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_mao_obra ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_equipamentos ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_ocorrencias ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_anexos ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_inspecoes_solda ENABLE ROW LEVEL SECURITY; +ALTER TABLE rdo_verificacoes_torque ENABLE ROW LEVEL SECURITY; +ALTER TABLE tarefas ENABLE ROW LEVEL SECURITY; +ALTER TABLE task_logs ENABLE ROW LEVEL SECURITY; + +-- Políticas para usuários +CREATE POLICY "Usuários podem ver próprio perfil" ON usuarios FOR SELECT USING (auth.uid() = id); +CREATE POLICY "Usuários podem atualizar próprio perfil" ON usuarios FOR UPDATE USING (auth.uid() = id); +CREATE POLICY "Admins podem gerenciar usuários" ON usuarios FOR ALL USING (auth.jwt() ->> 'role' = 'admin'); + +-- Políticas para obras +CREATE POLICY "Usuários podem ver obras onde participam" ON obras FOR SELECT USING ( + auth.uid() = responsavel_id OR + auth.jwt() ->> 'role' IN ('admin', 'engenheiro') +); + +CREATE POLICY "Engenheiros e admins podem criar obras" ON obras FOR INSERT WITH CHECK ( + auth.jwt() ->> 'role' IN ('admin', 'engenheiro') +); + +CREATE POLICY "Responsáveis podem atualizar suas obras" ON obras FOR UPDATE USING ( + auth.uid() = responsavel_id OR + auth.jwt() ->> 'role' IN ('admin', 'engenheiro') +); + +-- Políticas para RDOs +CREATE POLICY "Usuários podem ver RDOs de suas obras" ON rdos FOR SELECT USING ( + EXISTS ( + SELECT 1 FROM obras + WHERE obras.id = rdos.obra_id + AND (obras.responsavel_id = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro')) + ) +); + +CREATE POLICY "Usuários podem criar RDOs" ON rdos FOR INSERT WITH CHECK ( + auth.uid() = criado_por AND + EXISTS ( + SELECT 1 FROM obras + WHERE obras.id = obra_id + AND (obras.responsavel_id = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro', 'mestre_obra')) + ) +); + +CREATE POLICY "Criadores podem atualizar próprios RDOs" ON rdos FOR UPDATE USING ( + auth.uid() = criado_por AND status = 'rascunho' +); + +-- Políticas para tabelas relacionadas ao RDO +CREATE POLICY "Acesso baseado no RDO" ON rdo_atividades FOR ALL USING ( + EXISTS ( + SELECT 1 FROM rdos + WHERE rdos.id = rdo_atividades.rdo_id + AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro')) + ) +); + +-- Aplicar política similar para todas as tabelas rdo_* +CREATE POLICY "Acesso baseado no RDO" ON rdo_mao_obra FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_mao_obra.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +CREATE POLICY "Acesso baseado no RDO" ON rdo_equipamentos FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_equipamentos.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +CREATE POLICY "Acesso baseado no RDO" ON rdo_ocorrencias FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_ocorrencias.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +CREATE POLICY "Acesso baseado no RDO" ON rdo_anexos FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_anexos.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +CREATE POLICY "Acesso baseado no RDO" ON rdo_inspecoes_solda FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_inspecoes_solda.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +CREATE POLICY "Acesso baseado no RDO" ON rdo_verificacoes_torque FOR ALL USING ( + EXISTS (SELECT 1 FROM rdos WHERE rdos.id = rdo_verificacoes_torque.rdo_id AND (rdos.criado_por = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro'))) +); + +-- Políticas para tarefas +CREATE POLICY "Usuários podem ver tarefas de suas obras" ON tarefas FOR SELECT USING ( + EXISTS ( + SELECT 1 FROM obras + WHERE obras.id = tarefas.obra_id + AND (obras.responsavel_id = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro')) + ) OR responsavel_id = auth.uid() +); + +CREATE POLICY "Usuários podem criar tarefas" ON tarefas FOR INSERT WITH CHECK ( + EXISTS ( + SELECT 1 FROM obras + WHERE obras.id = obra_id + AND (obras.responsavel_id = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro', 'mestre_obra')) + ) +); + +-- Políticas para task_logs +CREATE POLICY "Usuários podem ver logs de suas tarefas" ON task_logs FOR SELECT USING ( + EXISTS ( + SELECT 1 FROM tarefas + WHERE tarefas.id = task_logs.task_id + AND (tarefas.responsavel_id = auth.uid() OR auth.jwt() ->> 'role' IN ('admin', 'engenheiro')) + ) +); + +CREATE POLICY "Usuários podem criar logs" ON task_logs FOR INSERT WITH CHECK ( + auth.uid() = usuario_id +); +``` + +## 5. Configuração do Cliente Supabase + +### 5.1 Configuração Básica + +```typescript +// src/lib/supabase.ts +import { createClient } from '@supabase/supabase-js' +import { Database } from './database.types' + +const supabaseUrl = import.meta.env.VITE_SUPABASE_URL +const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY + +export const supabase = createClient(supabaseUrl, supabaseAnonKey, { + auth: { + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: true + }, + realtime: { + params: { + eventsPerSecond: 10 + } + } +}) + +// Tipos TypeScript gerados automaticamente +export type Tables = Database['public']['Tables'][T]['Row'] +export type Enums = Database['public']['Enums'][T] +``` + +### 5.2 Hooks Customizados para Dados + +```typescript +// src/hooks/useRDOs.ts +import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' +import { supabase } from '../lib/supabase' +import { Tables } from '../lib/supabase' + +type RDO = Tables<'rdos'> +type RDOWithDetails = RDO & { + atividades: Tables<'rdo_atividades'>[] + mao_obra: Tables<'rdo_mao_obra'>[] + equipamentos: Tables<'rdo_equipamentos'>[] + ocorrencias: Tables<'rdo_ocorrencias'>[] + anexos: Tables<'rdo_anexos'>[] +} + +export function useRDOs(obraId: string) { + return useQuery({ + queryKey: ['rdos', obraId], + queryFn: async () => { + const { data, error } = await supabase + .from('rdos') + .select(` + *, + atividades:rdo_atividades(*), + mao_obra:rdo_mao_obra(*), + equipamentos:rdo_equipamentos(*), + ocorrencias:rdo_ocorrencias(*), + anexos:rdo_anexos(*) + `) + .eq('obra_id', obraId) + .order('data_relatorio', { ascending: false }) + + if (error) throw error + return data as RDOWithDetails[] + } + }) +} + +export function useCreateRDO() { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: async (rdoData: Partial & { + atividades?: Partial>[] + mao_obra?: Partial>[] + equipamentos?: Partial>[] + ocorrencias?: Partial>[] + }) => { + const { atividades, mao_obra, equipamentos, ocorrencias, ...rdo } = rdoData + + // Criar RDO principal + const { data: rdoCreated, error: rdoError } = await supabase + .from('rdos') + .insert(rdo) + .select() + .single() + + if (rdoError) throw rdoError + + // Inserir dados relacionados + if (atividades?.length) { + const { error } = await supabase + .from('rdo_atividades') + .insert(atividades.map(a => ({ ...a, rdo_id: rdoCreated.id }))) + if (error) throw error + } + + if (mao_obra?.length) { + const { error } = await supabase + .from('rdo_mao_obra') + .insert(mao_obra.map(m => ({ ...m, rdo_id: rdoCreated.id }))) + if (error) throw error + } + + if (equipamentos?.length) { + const { error } = await supabase + .from('rdo_equipamentos') + .insert(equipamentos.map(e => ({ ...e, rdo_id: rdoCreated.id }))) + if (error) throw error + } + + if (ocorrencias?.length) { + const { error } = await supabase + .from('rdo_ocorrencias') + .insert(ocorrencias.map(o => ({ ...o, rdo_id: rdoCreated.id }))) + if (error) throw error + } + + return rdoCreated + }, + onSuccess: (data) => { + queryClient.invalidateQueries({ queryKey: ['rdos', data.obra_id] }) + } + }) +} +``` + +### 5.3 Store Zustand Integrado + +```typescript +// src/stores/rdoStore.ts +import { create } from 'zustand' +import { persist } from 'zustand/middleware' +import { supabase } from '../lib/supabase' +import { Tables } from '../lib/supabase' + +type RDO = Tables<'rdos'> +type Obra = Tables<'obras'> + +interface RDOState { + // Estado + currentObra: Obra | null + rdos: RDO[] + loading: boolean + error: string | null + + // Ações + setCurrentObra: (obra: Obra) => void + loadRDOs: (obraId: string) => Promise + createRDO: (rdoData: Partial) => Promise + updateRDO: (id: string, updates: Partial) => Promise + deleteRDO: (id: string) => Promise + + // Real-time + subscribeToRDOs: (obraId: string) => () => void +} + +export const useRDOStore = create()(persist( + (set, get) => ({ + // Estado inicial + currentObra: null, + rdos: [], + loading: false, + error: null, + + // Ações + setCurrentObra: (obra) => set({ currentObra: obra }), + + loadRDOs: async (obraId) => { + set({ loading: true, error: null }) + try { + const { data, error } = await supabase + .from('rdos') + .select('*') + .eq('obra_id', obraId) + .order('data_relatorio', { ascending: false }) + + if (error) throw error + set({ rdos: data, loading: false }) + } catch (error) { + set({ error: (error as Error).message, loading: false }) + } + }, + + createRDO: async (rdoData) => { + set({ loading: true, error: null }) + try { + const { data, error } = await supabase + .from('rdos') + .insert(rdoData) + .select() + .single() + + if (error) throw error + + set(state => ({ + rdos: [data, ...state.rdos], + loading: false + })) + + return data + } catch (error) { + set({ error: (error as Error).message, loading: false }) + throw error + } + }, + + updateRDO: async (id, updates) => { + set({ loading: true, error: null }) + try { + const { error } = await supabase + .from('rdos') + .update(updates) + .eq('id', id) + + if (error) throw error + + set(state => ({ + rdos: state.rdos.map(rdo => + rdo.id === id ? { ...rdo, ...updates } : rdo + ), + loading: false + })) + } catch (error) { + set({ error: (error as Error).message, loading: false }) + } + }, + + deleteRDO: async (id) => { + set({ loading: true, error: null }) + try { + const { error } = await supabase + .from('rdos') + .delete() + .eq('id', id) + + if (error) throw error + + set(state => ({ + rdos: state.rdos.filter(rdo => rdo.id !== id), + loading: false + })) + } catch (error) { + set({ error: (error as Error).message, loading: false }) + } + }, + + subscribeToRDOs: (obraId) => { + const subscription = supabase + .channel(`rdos-${obraId}`) + .on( + 'postgres_changes', + { + event: '*', + schema: 'public', + table: 'rdos', + filter: `obra_id=eq.${obraId}` + }, + (payload) => { + const { eventType, new: newRecord, old: oldRecord } = payload + + set(state => { + switch (eventType) { + case 'INSERT': + return { rdos: [newRecord as RDO, ...state.rdos] } + case 'UPDATE': + return { + rdos: state.rdos.map(rdo => + rdo.id === newRecord.id ? newRecord as RDO : rdo + ) + } + case 'DELETE': + return { + rdos: state.rdos.filter(rdo => rdo.id !== oldRecord.id) + } + default: + return state + } + }) + } + ) + .subscribe() + + return () => subscription.unsubscribe() + } + }), + { + name: 'rdo-store', + partialize: (state) => ({ currentObra: state.currentObra }) + } +)) +``` + +## 6. Estratégias de Cache e Offline + +### 6.1 Configuração do TanStack Query + +```typescript +// src/lib/queryClient.ts +import { QueryClient } from '@tanstack/react-query' +import { persistQueryClient } from '@tanstack/react-query-persist-client-core' +import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister' + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 5 * 60 * 1000, // 5 minutos + gcTime: 10 * 60 * 1000, // 10 minutos + retry: 3, + refetchOnWindowFocus: false, + refetchOnReconnect: true + }, + mutations: { + retry: 1 + } + } +}) + +// Persistir cache no localStorage +const localStoragePersister = createSyncStoragePersister({ + storage: window.localStorage, + key: 'rdo-cache' +}) + +persistQueryClient({ + queryClient, + persister: localStoragePersister, + maxAge: 24 * 60 * 60 * 1000 // 24 horas +}) + +export { queryClient } +``` + +### 6.2 Service Worker para Offline + +```typescript +// src/sw.ts +import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching' +import { registerRoute } from 'workbox-routing' +import { StaleWhileRevalidate, CacheFirst } from 'workbox-strategies' + +// Precache de arquivos estáticos +precacheAndRoute(self.__WB_MANIFEST) +cleanupOutdatedCaches() + +// Cache de API calls +registerRoute( + ({ url }) => url.origin === 'https://your-supabase-url.supabase.co', + new StaleWhileRevalidate({ + cacheName: 'supabase-api', + plugins: [ + { + cacheKeyWillBeUsed: async ({ request }) => { + return `${request.url}?${Date.now()}` + } + } + ] + }) +) + +// Cache de imagens +registerRoute( + ({ request }) => request.destination === 'image', + new CacheFirst({ + cacheName: 'images', + plugins: [ + { + cacheExpiration: { + maxEntries: 100, + maxAgeSeconds: 30 * 24 * 60 * 60 // 30 dias + } + } + ] + }) +) +``` + +## 7. Monitoramento e Analytics + +### 7.1 Métricas de Performance + +```sql +-- Views para relatórios e analytics +CREATE VIEW vw_obras_dashboard AS +SELECT + o.id, + o.nome, + o.status, + o.progresso_geral, + COUNT(r.id) as total_rdos, + COUNT(CASE WHEN r.status = 'aprovado' THEN 1 END) as rdos_aprovados, + COUNT(t.id) as total_tarefas, + COUNT(CASE WHEN t.status = 'concluida' THEN 1 END) as tarefas_concluidas, + AVG(CASE WHEN t.status = 'concluida' THEN t.progresso END) as progresso_medio_tarefas +FROM obras o +LEFT JOIN rdos r ON o.id = r.obra_id +LEFT JOIN tarefas t ON o.id = t.obra_id +GROUP BY o.id, o.nome, o.status, o.progresso_geral; + +CREATE VIEW vw_produtividade_mensal AS +SELECT + DATE_TRUNC('month', r.data_relatorio) as mes, + o.nome as obra, + COUNT(r.id) as rdos_criados, + COUNT(ra.id) as atividades_executadas, + SUM(rm.quantidade * rm.horas_trabalhadas) as total_horas_trabalhadas +FROM rdos r +JOIN obras o ON r.obra_id = o.id +LEFT JOIN rdo_atividades ra ON r.id = ra.rdo_id +LEFT JOIN rdo_mao_obra rm ON r.id = rm.rdo_id +GROUP BY DATE_TRUNC('month', r.data_relatorio), o.nome +ORDER BY mes DESC; +``` + +### 7.2 Logs de Auditoria + +```sql +-- Tabela de auditoria +CREATE TABLE audit_logs ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + table_name VARCHAR(50) NOT NULL, + record_id UUID NOT NULL, + action VARCHAR(10) NOT NULL CHECK (action IN ('INSERT', 'UPDATE', 'DELETE')), + old_values JSONB, + new_values JSONB, + user_id UUID REFERENCES usuarios(id), + timestamp TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Função de auditoria +CREATE OR REPLACE FUNCTION audit_trigger_function() +RETURNS TRIGGER AS $$ +BEGIN + IF TG_OP = 'DELETE' THEN + INSERT INTO audit_logs (table_name, record_id, action, old_values, user_id) + VALUES (TG_TABLE_NAME, OLD.id, TG_OP, row_to_json(OLD), auth.uid()); + RETURN OLD; + ELSIF TG_OP = 'UPDATE' THEN + INSERT INTO audit_logs (table_name, record_id, action, old_values, new_values, user_id) + VALUES (TG_TABLE_NAME, NEW.id, TG_OP, row_to_json(OLD), row_to_json(NEW), auth.uid()); + RETURN NEW; + ELSIF TG_OP = 'INSERT' THEN + INSERT INTO audit_logs (table_name, record_id, action, new_values, user_id) + VALUES (TG_TABLE_NAME, NEW.id, TG_OP, row_to_json(NEW), auth.uid()); + RETURN NEW; + END IF; + RETURN NULL; +END; +$$ LANGUAGE plpgsql; + +-- Aplicar triggers de auditoria +CREATE TRIGGER audit_rdos AFTER INSERT OR UPDATE OR DELETE ON rdos FOR EACH ROW EXECUTE FUNCTION audit_trigger_function(); +CREATE TRIGGER audit_obras AFTER INSERT OR UPDATE OR DELETE ON obras FOR EACH ROW EXECUTE FUNCTION audit_trigger_function(); +``` + +## 8. Backup e Recuperação + +### 8.1 Estratégia de Backup + +```sql +-- Função para backup incremental +CREATE OR REPLACE FUNCTION create_incremental_backup() +RETURNS TABLE(table_name TEXT, records_count BIGINT) AS $$ +DECLARE + backup_timestamp TIMESTAMP := NOW(); +BEGIN + -- Criar tabela de controle de backup se não existir + CREATE TABLE IF NOT EXISTS backup_control ( + id SERIAL PRIMARY KEY, + table_name VARCHAR(50), + last_backup TIMESTAMP, + created_at TIMESTAMP DEFAULT NOW() + ); + + -- Backup das tabelas principais + RETURN QUERY + SELECT 'rdos'::TEXT, COUNT(*) FROM rdos WHERE updated_at > COALESCE( + (SELECT last_backup FROM backup_control WHERE table_name = 'rdos'), + '1970-01-01'::TIMESTAMP + ); + + -- Atualizar controle de backup + INSERT INTO backup_control (table_name, last_backup) + VALUES ('rdos', backup_timestamp) + ON CONFLICT (table_name) DO UPDATE SET last_backup = backup_timestamp; +END; +$$ LANGUAGE plpgsql; +``` + +## 9. Configurações de Ambiente + +### 9.1 Variáveis de Ambiente + +```bash +# .env.local +VITE_SUPABASE_URL=https://your-project.supabase.co +VITE_SUPABASE_ANON_KEY=your-anon-key +VITE_SUPABASE_SERVICE_ROLE_KEY=your-service-role-key + +# Configurações de cache +VITE_CACHE_TTL=300000 +VITE_OFFLINE_ENABLED=true + +# Configurações de upload +VITE_MAX_FILE_SIZE=10485760 +VITE_ALLOWED_FILE_TYPES=image/*,application/pdf +``` + +### 9.2 Configuração de Produção + +```typescript +// src/config/database.ts +export const databaseConfig = { + development: { + supabaseUrl: import.meta.env.VITE_SUPABASE_URL, + supabaseKey: import.meta.env.VITE_SUPABASE_ANON_KEY, + enableRealtime: true, + enableCache: true, + cacheTimeout: 5 * 60 * 1000 + }, + production: { + supabaseUrl: import.meta.env.VITE_SUPABASE_URL, + supabaseKey: import.meta.env.VITE_SUPABASE_ANON_KEY, + enableRealtime: true, + enableCache: true, + cacheTimeout: 10 * 60 * 1000, + enableCompression: true, + maxRetries: 3 + } +} + +export const getCurrentConfig = () => { + const env = import.meta.env.MODE + return databaseConfig[env as keyof typeof databaseConfig] || databaseConfig.development +} +``` + +Esta documentação fornece uma base sólida para implementar uma conexão completa com banco de dados no projeto RDO Mobile, incluindo esquema de dados, segurança, performance e estratégias offline. \ No newline at end of file diff --git a/.trae/documents/Arquitetura_Tecnica_RDO.md b/.trae/documents/Arquitetura_Tecnica_RDO.md new file mode 100644 index 0000000..e0b6d28 --- /dev/null +++ b/.trae/documents/Arquitetura_Tecnica_RDO.md @@ -0,0 +1,815 @@ +# Documento de Arquitetura Técnica - RDO Mobile App + +## 1. Design da Arquitetura + +```mermaid +graph TD + A[Usuário Mobile] --> B[React Native/PWA Frontend] + B --> C[Supabase SDK] + C --> D[Supabase Backend] + + subgraph "Frontend Layer" + B + E[Zustand State Management] + F[React Hook Form] + G[Framer Motion] + H[Tailwind CSS] + end + + subgraph "Backend as a Service (Supabase)" + D + I[PostgreSQL Database] + J[Authentication] + K[Storage (Fotos/Docs)] + L[Real-time Subscriptions] + end + + subgraph "Funcionalidades Offline" + M[IndexedDB Cache] + N[Service Worker] + O[Background Sync] + end + + B --> M + N --> B + O --> C +``` + +## 2. Descrição das Tecnologias + +* **Frontend**: React\@18 + TypeScript + Vite + Tailwind CSS + +* **Mobile**: PWA (Progressive Web App) com Capacitor para recursos nativos + +* **Estado**: Zustand para gerenciamento de estado global + +* **Formulários**: React Hook Form + Zod para validação + +* **Animações**: Framer Motion para microinterações + +* **UI Components**: Headless UI + Radix UI primitives + +* **Ícones**: Phosphor Icons + +* **Backend**: Supabase (PostgreSQL + Auth + Storage + Real-time) + +* **Cache**: TanStack Query para cache de dados + +* **Offline**: Workbox para service workers + +## 3. Definições de Rotas + +| Rota | Propósito | +| ----------------------- | --------------------------------------------- | +| / | Dashboard principal com visão geral das obras | +| /obra/:id | Detalhes específicos de uma obra | +| /obra/:id/rdo/novo | Formulário para criar novo RDO | +| /obra/:id/rdo/:rdoId | Visualizar/editar RDO específico | +| /obra/:id/tarefas | Lista de tarefas da obra | +| /cadastros | Menu principal de cadastros | +| /cadastros/obras | Formulário de cadastro de obras | +| /cadastros/usuarios | Gerenciamento de usuários | +| /cadastros/equipamentos | Cadastro de equipamentos | +|
|
| +| /cadastros/atividades | Tipos de atividades padrão | +| /relatorios | Dashboard de relatórios e exportações | +| /perfil | Configurações do usuário | +| /configuracoes | Configurações do aplicativo | + +## 4. Definições de API + +### 4.1 APIs Principais + +**Autenticação de Usuário** + +``` +POST /auth/v1/token +``` + +Request: + +| Nome do Parâmetro | Tipo | Obrigatório | Descrição | +| ----------------- | ------ | ----------- | ---------------- | +| email | string | true | Email do usuário | +| password | string | true | Senha do usuário | + +Response: + +| Nome do Parâmetro | Tipo | Descrição | +| ----------------- | ------ | ---------------------------- | +| access\_token | string | Token JWT para autenticação | +| user | object | Dados do usuário autenticado | + +**Criar RDO** + +``` +POST /rest/v1/rdos +``` + +Request: + +| Nome do Parâmetro | Tipo | Obrigatório | Descrição | +| --------------------- | ------ | ----------- | ------------------------------ | +| obra\_id | uuid | true | ID da obra | +| data\_relatorio | date | true | Data do relatório | +| condicoes\_climaticas | string | true | Condições do tempo | +| atividades | array | true | Lista de atividades executadas | +| mao\_de\_obra | array | false | Funcionários presentes | +| equipamentos | array | false | Equipamentos utilizados | +| ocorrencias | array | false | Ocorrências registradas | + +Response: + +| Nome do Parâmetro | Tipo | Descrição | +| ----------------- | --------- | ------------------- | +| id | uuid | ID do RDO criado | +| status | string | Status do relatório | +| created\_at | timestamp | Data de criação | + +Exemplo: + +```json +{ + "obra_id": "123e4567-e89b-12d3-a456-426614174000", + "data_relatorio": "2024-01-15", + "condicoes_climaticas": "Ensolarado", + "atividades": [ + { + "tipo": "Concretagem", + "descricao": "Concretagem da laje do 2º pavimento", + "percentual_concluido": 75 + } + ] +} +``` + +**Listar Obras** + +``` +GET /rest/v1/obras +``` + +Response: + +| Nome do Parâmetro | Tipo | Descrição | +| ----------------- | ------ | ---------------------------------------- | +| id | uuid | ID da obra | +| nome | string | Nome da obra | +| endereco | string | Endereço da obra | +| status | string | Status atual (ativa, pausada, concluída) | +| progresso | number | Percentual de conclusão | + +## 5. Arquitetura do Servidor + +```mermaid +graph TD + A[Cliente Mobile] --> B[Supabase Edge Functions] + B --> C[Supabase Auth] + B --> D[PostgreSQL Database] + B --> E[Supabase Storage] + + subgraph "Supabase Backend" + C + D + E + F[Real-time Engine] + G[Row Level Security] + end + + subgraph "Edge Functions" + H[Geração de Relatórios PDF] + I[Processamento de Imagens] + J[Notificações Push] + end + + B --> H + B --> I + B --> J +``` + +## 6. Modelo de Dados + +### 6.1 Definição do Modelo de Dados + +```mermaid +erDiagram + USUARIOS ||--o{ OBRAS : gerencia + USUARIOS ||--o{ RDOS : cria + OBRAS ||--o{ RDOS : possui + OBRAS ||--o{ TAREFAS : contem + RDOS ||--o{ RDO_ATIVIDADES : possui + RDOS ||--o{ RDO_MAO_OBRA : registra + RDOS ||--o{ RDO_EQUIPAMENTOS : utiliza + RDOS ||--o{ RDO_OCORRENCIAS : reporta + RDOS ||--o{ RDO_ANEXOS : contem + RDOS ||--o{ RDO_INSPECOES_SOLDA : possui + RDOS ||--o{ RDO_VERIFICACOES_TORQUE : possui + TAREFAS ||--o{ TASK_LOGS : possui + USUARIOS ||--o{ TASK_LOGS : executa + + USUARIOS { + uuid id PK + string email UK + string nome + string telefone + string cargo + string role + boolean ativo + timestamp created_at + timestamp updated_at + } + + OBRAS { + uuid id PK + string nome + string descricao + string endereco + string cep + string cidade + string estado + uuid responsavel_id FK + date data_inicio + date data_prevista_fim + decimal progresso_geral + string status + jsonb configuracoes + timestamp created_at + timestamp updated_at + } + + RDOS { + uuid id PK + uuid obra_id FK + uuid criado_por FK + date data_relatorio + string condicoes_climaticas + text observacoes_gerais + string status + uuid aprovado_por FK + timestamp aprovado_em + timestamp created_at + timestamp updated_at + } + + RDO_ATIVIDADES { + uuid id PK + uuid rdo_id FK + string tipo_atividade + text descricao + string localizacao + decimal percentual_concluido + integer ordem + timestamp created_at + } + + RDO_MAO_OBRA { + uuid id PK + uuid rdo_id FK + string funcao + integer quantidade + decimal horas_trabalhadas + text observacoes + timestamp created_at + } + + RDO_EQUIPAMENTOS { + uuid id PK + uuid rdo_id FK + string nome_equipamento + string tipo + decimal horas_utilizadas + decimal combustivel_gasto + text observacoes + timestamp created_at + } + + RDO_OCORRENCIAS { + uuid id PK + uuid rdo_id FK + string tipo_ocorrencia + text descricao + string gravidade + text acao_tomada + timestamp created_at + } + + RDO_ANEXOS { + uuid id PK + uuid rdo_id FK + string nome_arquivo + string tipo_arquivo + string url_storage + integer tamanho_bytes + text descricao + timestamp created_at + } + + RDO_INSPECOES_SOLDA { + uuid id PK + uuid rdo_id FK + string identificacao_junta + string status_inspecao + string metodo_inspecao + text observacoes + uuid inspecionado_por FK + timestamp created_at + } + + RDO_VERIFICACOES_TORQUE { + uuid id PK + uuid rdo_id FK + string identificacao_parafuso + decimal torque_especificado + decimal torque_aplicado + string status_verificacao + text observacoes + uuid verificado_por FK + timestamp created_at + } + + TAREFAS { + uuid id PK + uuid obra_id FK + string titulo + text descricao + string status + string prioridade + uuid responsavel_id FK + date data_inicio + date data_fim + decimal progresso + jsonb metadados + timestamp created_at + timestamp updated_at + } + + TASK_LOGS { + uuid id PK + uuid task_id FK + uuid usuario_id FK + string tipo_evento + text descricao + jsonb detalhes + timestamp created_at + } + RDOS ||--o{ OCORRENCIAS : possui + RDOS ||--o{ ANEXOS : contem + OBRAS ||--o{ TAREFAS : possui + EQUIPAMENTOS ||--o{ EQUIPAMENTOS_UTILIZADOS : referencia + + USUARIOS { + uuid id PK + string email + string nome + string funcao + string telefone + timestamp created_at + timestamp updated_at + } + + OBRAS { + uuid id PK + string nome + string endereco + string descricao + date data_inicio + date data_prevista_fim + string status + decimal progresso_percentual + uuid responsavel_id FK + timestamp created_at + } + + RDOS { + uuid id PK + uuid obra_id FK + uuid criado_por FK + date data_relatorio + string condicoes_climaticas + text observacoes_gerais + string status + timestamp created_at + } + + ATIVIDADES { + uuid id PK + uuid rdo_id FK + string tipo_atividade + text descricao + string localizacao + decimal percentual_concluido + time hora_inicio + time hora_fim + } + + MAO_DE_OBRA { + uuid id PK + uuid rdo_id FK + string nome_funcionario + string funcao + decimal horas_trabalhadas + boolean presente + } + + EQUIPAMENTOS { + uuid id PK + string nome + string tipo + string modelo + string status + text observacoes + } + + EQUIPAMENTOS_UTILIZADOS { + uuid id PK + uuid rdo_id FK + uuid equipamento_id FK + decimal horas_operacao + decimal combustivel_consumido + text observacoes + } + + OCORRENCIAS { + uuid id PK + uuid rdo_id FK + string tipo + text descricao + string gravidade + boolean resolvida + } + + ANEXOS { + uuid id PK + uuid rdo_id FK + string tipo + string url_arquivo + string nome_arquivo + text descricao + } + + TAREFAS { + uuid id PK + uuid obra_id FK + string titulo + text descricao + date data_prevista + string status + string prioridade + uuid responsavel_id FK + } +``` + +### 6.2 Linguagem de Definição de Dados (DDL) + +**Tabela de Usuários (usuarios)** +```sql +-- Criar tabela +CREATE TABLE usuarios ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + email VARCHAR(255) UNIQUE NOT NULL, + nome VARCHAR(100) NOT NULL, + telefone VARCHAR(20), + cargo VARCHAR(100), + role VARCHAR(20) DEFAULT 'user' CHECK (role IN ('admin', 'supervisor', 'user')), + ativo BOOLEAN DEFAULT true, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Criar índices +CREATE INDEX idx_usuarios_email ON usuarios(email); +CREATE INDEX idx_usuarios_role ON usuarios(role); +CREATE INDEX idx_usuarios_ativo ON usuarios(ativo); + +-- Dados iniciais +INSERT INTO usuarios (email, nome, cargo, role) VALUES +('admin@rdo.com', 'Administrador', 'Gerente de Projeto', 'admin'), +('supervisor@rdo.com', 'Supervisor', 'Supervisor de Obra', 'supervisor'), +('user@rdo.com', 'Usuário Padrão', 'Técnico', 'user'); +``` + +**Tabela de Obras (obras)** +```sql +CREATE TABLE obras ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + nome VARCHAR(255) NOT NULL, + descricao TEXT, + endereco TEXT, + cep VARCHAR(10), + cidade VARCHAR(100), + estado VARCHAR(2), + responsavel_id UUID REFERENCES usuarios(id), + data_inicio DATE, + data_prevista_fim DATE, + progresso_geral DECIMAL(5,2) DEFAULT 0.00, + status VARCHAR(20) DEFAULT 'planejamento' CHECK (status IN ('planejamento', 'em_andamento', 'pausada', 'concluida', 'cancelada')), + configuracoes JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_obras_responsavel ON obras(responsavel_id); +CREATE INDEX idx_obras_status ON obras(status); +CREATE INDEX idx_obras_data_inicio ON obras(data_inicio); +``` + +**Tabela de RDOs (rdos)** +```sql +CREATE TABLE rdos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + obra_id UUID NOT NULL REFERENCES obras(id), + criado_por UUID NOT NULL REFERENCES usuarios(id), + data_relatorio DATE NOT NULL, + condicoes_climaticas VARCHAR(100), + observacoes_gerais TEXT, + status VARCHAR(20) DEFAULT 'rascunho' CHECK (status IN ('rascunho', 'enviado', 'aprovado', 'rejeitado')), + aprovado_por UUID REFERENCES usuarios(id), + aprovado_em TIMESTAMP WITH TIME ZONE, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdos_obra ON rdos(obra_id); +CREATE INDEX idx_rdos_criado_por ON rdos(criado_por); +CREATE INDEX idx_rdos_data_relatorio ON rdos(data_relatorio); +CREATE INDEX idx_rdos_status ON rdos(status); +``` + +**Tabela de Atividades do RDO (rdo_atividades)** +```sql +CREATE TABLE rdo_atividades ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + tipo_atividade VARCHAR(100) NOT NULL, + descricao TEXT, + localizacao VARCHAR(255), + percentual_concluido DECIMAL(5,2) DEFAULT 0.00, + ordem INTEGER DEFAULT 0, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_atividades_rdo ON rdo_atividades(rdo_id); +CREATE INDEX idx_rdo_atividades_tipo ON rdo_atividades(tipo_atividade); +``` + +**Tabela de Mão de Obra (rdo_mao_obra)** +```sql +CREATE TABLE rdo_mao_obra ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + funcao VARCHAR(100) NOT NULL, + quantidade INTEGER NOT NULL DEFAULT 1, + horas_trabalhadas DECIMAL(5,2) NOT NULL DEFAULT 0.00, + observacoes TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_mao_obra_rdo ON rdo_mao_obra(rdo_id); +CREATE INDEX idx_rdo_mao_obra_funcao ON rdo_mao_obra(funcao); +``` + +**Tabela de Equipamentos (rdo_equipamentos)** +```sql +CREATE TABLE rdo_equipamentos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + nome_equipamento VARCHAR(255) NOT NULL, + tipo VARCHAR(100), + horas_utilizadas DECIMAL(5,2) DEFAULT 0.00, + combustivel_gasto DECIMAL(8,2) DEFAULT 0.00, + observacoes TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_equipamentos_rdo ON rdo_equipamentos(rdo_id); +CREATE INDEX idx_rdo_equipamentos_tipo ON rdo_equipamentos(tipo); +``` + +**Tabela de Ocorrências (rdo_ocorrencias)** +```sql +CREATE TABLE rdo_ocorrencias ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + tipo_ocorrencia VARCHAR(100) NOT NULL, + descricao TEXT NOT NULL, + gravidade VARCHAR(20) DEFAULT 'baixa' CHECK (gravidade IN ('baixa', 'media', 'alta', 'critica')), + acao_tomada TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_ocorrencias_rdo ON rdo_ocorrencias(rdo_id); +CREATE INDEX idx_rdo_ocorrencias_tipo ON rdo_ocorrencias(tipo_ocorrencia); +CREATE INDEX idx_rdo_ocorrencias_gravidade ON rdo_ocorrencias(gravidade); +``` + +**Tabela de Anexos (rdo_anexos)** +```sql +CREATE TABLE rdo_anexos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + nome_arquivo VARCHAR(255) NOT NULL, + tipo_arquivo VARCHAR(50), + url_storage TEXT NOT NULL, + tamanho_bytes INTEGER, + descricao TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_anexos_rdo ON rdo_anexos(rdo_id); +CREATE INDEX idx_rdo_anexos_tipo ON rdo_anexos(tipo_arquivo); +``` + +**Tabela de Inspeções de Solda (rdo_inspecoes_solda)** +```sql +CREATE TABLE rdo_inspecoes_solda ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + identificacao_junta VARCHAR(100) NOT NULL, + status_inspecao VARCHAR(20) DEFAULT 'pendente' CHECK (status_inspecao IN ('pendente', 'aprovada', 'rejeitada', 'retrabalho')), + metodo_inspecao VARCHAR(100), + observacoes TEXT, + inspecionado_por UUID REFERENCES usuarios(id), + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_inspecoes_solda_rdo ON rdo_inspecoes_solda(rdo_id); +CREATE INDEX idx_rdo_inspecoes_solda_status ON rdo_inspecoes_solda(status_inspecao); +``` + +**Tabela de Verificações de Torque (rdo_verificacoes_torque)** +```sql +CREATE TABLE rdo_verificacoes_torque ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + rdo_id UUID NOT NULL REFERENCES rdos(id) ON DELETE CASCADE, + identificacao_parafuso VARCHAR(100) NOT NULL, + torque_especificado DECIMAL(8,2) NOT NULL, + torque_aplicado DECIMAL(8,2) NOT NULL, + status_verificacao VARCHAR(20) DEFAULT 'conforme' CHECK (status_verificacao IN ('conforme', 'nao_conforme', 'retrabalho')), + observacoes TEXT, + verificado_por UUID REFERENCES usuarios(id), + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_rdo_verificacoes_torque_rdo ON rdo_verificacoes_torque(rdo_id); +CREATE INDEX idx_rdo_verificacoes_torque_status ON rdo_verificacoes_torque(status_verificacao); +``` + +**Tabela de Tarefas (tarefas)** +```sql +CREATE TABLE tarefas ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + obra_id UUID NOT NULL REFERENCES obras(id), + titulo VARCHAR(255) NOT NULL, + descricao TEXT, + status VARCHAR(20) DEFAULT 'pendente' CHECK (status IN ('pendente', 'em_andamento', 'concluida', 'cancelada')), + prioridade VARCHAR(20) DEFAULT 'media' CHECK (prioridade IN ('baixa', 'media', 'alta', 'urgente')), + responsavel_id UUID REFERENCES usuarios(id), + data_inicio DATE, + data_fim DATE, + progresso DECIMAL(5,2) DEFAULT 0.00, + metadados JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_tarefas_obra ON tarefas(obra_id); +CREATE INDEX idx_tarefas_responsavel ON tarefas(responsavel_id); +CREATE INDEX idx_tarefas_status ON tarefas(status); +CREATE INDEX idx_tarefas_prioridade ON tarefas(prioridade); +``` + +**Tabela de Logs de Tarefas (task_logs)** +```sql +CREATE TABLE task_logs ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + task_id UUID NOT NULL REFERENCES tarefas(id) ON DELETE CASCADE, + usuario_id UUID NOT NULL REFERENCES usuarios(id), + tipo_evento VARCHAR(50) NOT NULL, + descricao TEXT, + detalhes JSONB DEFAULT '{}', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE INDEX idx_task_logs_task ON task_logs(task_id); +CREATE INDEX idx_task_logs_usuario ON task_logs(usuario_id); +CREATE INDEX idx_task_logs_tipo ON task_logs(tipo_evento); +CREATE INDEX idx_task_logs_created_at ON task_logs(created_at DESC); +``` + +**Tabela de Obras** + +```sql +-- Criar tabela de obras +CREATE TABLE obras ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + nome VARCHAR(200) NOT NULL, + endereco TEXT NOT NULL, + descricao TEXT, + data_inicio DATE NOT NULL, + data_prevista_fim DATE, + status VARCHAR(20) DEFAULT 'ativa' CHECK (status IN ('ativa', 'pausada', 'concluida')), + progresso_percentual DECIMAL(5,2) DEFAULT 0.00, + responsavel_id UUID REFERENCES usuarios(id), + orcamento_total DECIMAL(15,2), + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Criar índices +CREATE INDEX idx_obras_status ON obras(status); +CREATE INDEX idx_obras_responsavel ON obras(responsavel_id); +CREATE INDEX idx_obras_data_inicio ON obras(data_inicio DESC); + +-- Políticas RLS +ALTER TABLE obras ENABLE ROW LEVEL SECURITY; + +CREATE POLICY "Usuários podem ver obras que participam" ON obras + FOR SELECT USING ( + responsavel_id = auth.uid() OR + EXISTS ( + SELECT 1 FROM usuarios + WHERE id = auth.uid() AND funcao IN ('Gestor', 'Engenheiro') + ) + ); + +-- Permissões +GRANT SELECT ON obras TO anon; +GRANT ALL PRIVILEGES ON obras TO authenticated; +``` + +**Tabela de RDOs** + +```sql +-- Criar tabela de RDOs +CREATE TABLE rdos ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + obra_id UUID NOT NULL REFERENCES obras(id) ON DELETE CASCADE, + criado_por UUID NOT NULL REFERENCES usuarios(id), + data_relatorio DATE NOT NULL, + condicoes_climaticas VARCHAR(50) NOT NULL, + temperatura_min DECIMAL(4,1), + temperatura_max DECIMAL(4,1), + observacoes_gerais TEXT, + status VARCHAR(20) DEFAULT 'rascunho' CHECK (status IN ('rascunho', 'enviado', 'aprovado')), + aprovado_por UUID REFERENCES usuarios(id), + aprovado_em TIMESTAMP WITH TIME ZONE, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Criar índices +CREATE INDEX idx_rdos_obra_id ON rdos(obra_id); +CREATE INDEX idx_rdos_data_relatorio ON rdos(data_relatorio DESC); +CREATE INDEX idx_rdos_status ON rdos(status); +CREATE INDEX idx_rdos_criado_por ON rdos(criado_por); + +-- Constraint única para evitar múltiplos RDOs na mesma data/obra +CREATE UNIQUE INDEX idx_rdos_obra_data_unique ON rdos(obra_id, data_relatorio); + +-- Políticas RLS +ALTER TABLE rdos ENABLE ROW LEVEL SECURITY; + +CREATE POLICY "Usuários podem ver RDOs das suas obras" ON rdos + FOR SELECT USING ( + EXISTS ( + SELECT 1 FROM obras + WHERE id = obra_id AND ( + responsavel_id = auth.uid() OR + EXISTS ( + SELECT 1 FROM usuarios + WHERE usuarios.id = auth.uid() AND funcao IN ('Gestor', 'Engenheiro') + ) + ) + ) + ); + +-- Permissões +GRANT SELECT ON rdos TO anon; +GRANT ALL PRIVILEGES ON rdos TO authenticated; +``` + +**Dados Iniciais** + +```sql +-- Inserir tipos de atividades padrão +INSERT INTO tipos_atividades (nome, categoria) VALUES +('Escavação', 'Terraplanagem'), +('Fundação', 'Estrutura'), +('Concretagem', 'Estrutura'), +('Alvenaria', 'Vedação'), +('Instalação Elétrica', 'Instalações'), +('Instalação Hidráulica', 'Instalações'), +('Revestimento', 'Acabamento'), +('Pintura', 'Acabamento'); + +-- Inserir condições climáticas padrão +INSERT INTO condicoes_climaticas (descricao) VALUES +('Ensolarado'), +('Parcialmente Nublado'), +('Nublado'), +('Chuvisco'), +('Chuva Leve'), +('Chuva Forte'), +('Tempestade'); +``` + diff --git a/.trae/documents/PRD_RDO_Mobile_App.md b/.trae/documents/PRD_RDO_Mobile_App.md new file mode 100644 index 0000000..1db8c46 --- /dev/null +++ b/.trae/documents/PRD_RDO_Mobile_App.md @@ -0,0 +1,129 @@ +# Documento de Requisitos do Produto - App RDO Mobile + +## 1. Visão Geral do Produto + +O **RDO Mobile** é um aplicativo mobile-first para registro e acompanhamento diário de atividades em obras de construção civil. O app facilita o processo de criação de Relatórios Diários de Obra (RDO), permitindo que engenheiros, mestres de obra e gestores registrem atividades, mão de obra, equipamentos, condições climáticas e ocorrências de forma prática e organizada. + +O produto visa substituir os relatórios em papel ou Excel por uma solução digital moderna, melhorando a comunicação entre canteiro de obra, escritório e clientes, proporcionando acompanhamento em tempo real do progresso das obras. + +## 2. Funcionalidades Principais + +### 2.1 Papéis de Usuário + +| Papel | Método de Registro | Permissões Principais | +|-------|-------------------|----------------------| +| Mestre de Obra | Cadastro por convite | Criar e editar RDOs, registrar atividades, gerenciar mão de obra | +| Engenheiro | Cadastro por convite | Todas as permissões + aprovar RDOs, gerar relatórios | +| Gestor | Cadastro administrativo | Visualizar todas as obras, relatórios consolidados, gerenciar usuários | +| Cliente | Acesso por convite | Visualizar progresso da obra, relatórios aprovados | + +### 2.2 Módulos Funcionais + +Nosso aplicativo RDO Mobile consiste nas seguintes páginas principais: + +1. **Dashboard Principal**: visão geral das obras, indicadores de progresso, últimas atividades +2. **Detalhes da Obra**: informações específicas da obra, histórico de RDOs, galeria de fotos +3. **Criar RDO**: formulário completo para registro diário de atividades +4. **Lista de Tarefas**: gerenciamento de atividades planejadas e executadas +5. **Cadastros**: formulários para obras, usuários, equipamentos e tipos de atividades +6. **Relatórios**: visualização e exportação de relatórios consolidados + +### 2.3 Detalhes das Páginas + +| Nome da Página | Nome do Módulo | Descrição da Funcionalidade | +|----------------|----------------|-----------------------------| +| Dashboard Principal | Visão Geral | Exibir cards das obras ativas, indicadores de progresso, últimos RDOs criados, notificações importantes | +| Dashboard Principal | Navegação Rápida | Acesso rápido para criar novo RDO, visualizar obras, acessar cadastros | +| Detalhes da Obra | Informações da Obra | Mostrar dados da obra, cronograma, responsáveis, localização | +| Detalhes da Obra | Histórico RDO | Listar RDOs anteriores com filtros por data, status, responsável | +| Detalhes da Obra | Galeria de Fotos | Visualizar fotos organizadas por data, com zoom e compartilhamento | +| Criar RDO | Informações Básicas | Campos para data, obra, responsável, condições climáticas | +| Criar RDO | Atividades Executadas | Adicionar atividades com descrição, localização, percentual concluído | +| Criar RDO | Mão de Obra | Registrar funcionários presentes, horas trabalhadas, função | +| Criar RDO | Equipamentos | Listar equipamentos utilizados, horas de operação, combustível | +| Criar RDO | Ocorrências | Registrar problemas, acidentes, atrasos com descrição detalhada | +| Criar RDO | Anexos | Adicionar fotos, documentos, assinaturas digitais | +| Lista de Tarefas | Tarefas Planejadas | Visualizar atividades programadas para o dia/semana | +| Lista de Tarefas | Controle de Execução | Marcar tarefas como iniciadas, em andamento, concluídas | +| Lista de Tarefas | Progresso Visual | Mostrar percentual de conclusão com barras de progresso | +| Cadastros | Cadastro de Obras | Formulário com dados da obra, endereço, responsáveis, cronograma | +| Cadastros | Cadastro de Usuários | Registrar funcionários com foto, função, permissões | +| Cadastros | Cadastro de Equipamentos | Listar equipamentos com especificações, manutenção, disponibilidade | +| Cadastros | Tipos de Atividades | Definir categorias de atividades padrão para seleção rápida | +| Relatórios | Relatórios Consolidados | Gerar relatórios por período, obra, tipo de atividade | +| Relatórios | Exportação | Exportar relatórios em PDF, Excel, compartilhar por email/WhatsApp | + +## 3. Fluxo Principal + +**Fluxo do Mestre de Obra:** +1. Acessa o dashboard e visualiza as obras sob sua responsabilidade +2. Seleciona uma obra específica para trabalhar +3. Cria um novo RDO diário preenchendo todas as seções obrigatórias +4. Adiciona fotos e registra ocorrências se necessário +5. Submete o RDO para aprovação do engenheiro +6. Acompanha o status das tarefas planejadas + +**Fluxo do Engenheiro:** +1. Revisa RDOs pendentes de aprovação +2. Analisa o progresso geral das obras no dashboard +3. Gera relatórios consolidados para apresentação +4. Gerencia cadastros de equipamentos e atividades + +```mermaid +graph TD + A[Dashboard Principal] --> B[Selecionar Obra] + B --> C[Detalhes da Obra] + C --> D[Criar Novo RDO] + C --> E[Lista de Tarefas] + C --> F[Histórico RDOs] + D --> G[Preencher Atividades] + G --> H[Registrar Mão de Obra] + H --> I[Adicionar Equipamentos] + I --> J[Registrar Ocorrências] + J --> K[Anexar Fotos] + K --> L[Submeter RDO] + A --> M[Cadastros] + M --> N[Obras] + M --> O[Usuários] + M --> P[Equipamentos] + A --> Q[Relatórios] +``` + +## 4. Design da Interface do Usuário + +### 4.1 Estilo de Design + +- **Cores Primárias**: Azul #2563EB (confiança, profissionalismo), Laranja #F97316 (energia, ação) +- **Cores Secundárias**: Cinza #64748B (neutro), Verde #10B981 (sucesso), Vermelho #EF4444 (alertas) +- **Estilo dos Botões**: Neumorphism com bordas arredondadas (12px), sombras sutis, efeitos de pressão +- **Tipografia**: Inter (títulos 18-24px), Open Sans (corpo 14-16px), peso regular e semi-bold +- **Layout**: Cards com Glassmorphism, navegação bottom tab, espaçamentos de 16px/24px +- **Ícones**: Phosphor Icons com estilo outline, tamanho 24px para ações principais + +### 4.2 Visão Geral do Design das Páginas + +| Nome da Página | Nome do Módulo | Elementos da UI | +|----------------|----------------|----------------| +| Dashboard Principal | Cards de Obras | Cards com glassmorphism, gradiente sutil azul-roxo, sombra 0 4px 20px rgba(0,0,0,0.1), bordas arredondadas 16px | +| Dashboard Principal | Indicadores | Gráficos circulares com animação, cores verde/amarelo/vermelho para status, fonte Inter 14px | +| Dashboard Principal | Navegação | Bottom navigation com 5 tabs, ícones Phosphor, background blur, altura 80px | +| Criar RDO | Formulário | Floating labels com animação, campos com border-radius 12px, validação em tempo real com cores | +| Criar RDO | Seções Expansíveis | Accordion com ícones de seta, transição suave 300ms, background rgba(255,255,255,0.1) | +| Lista de Tarefas | Cards de Tarefa | Swipe actions (verde para concluir, vermelho para excluir), checkbox animado, progress bar | +| Lista de Tarefas | Filtros | Chips com seleção múltipla, cores Material Design 3, espaçamento 8px | +| Cadastros | Formulários | Stepper horizontal, campos agrupados em cards, botões flutuantes para ações | +| Relatórios | Gráficos | Charts.js com tema dark/light, cores consistentes, animações de entrada | + +### 4.3 Responsividade + +**Mobile-first** com adaptação para tablets. Layouts flexíveis usando CSS Grid e Flexbox, tamanhos em rem (base 16px), espaçamentos escaláveis (16px/24px/32px). Safe areas para dispositivos com notch/dynamic island. Suporte a orientação portrait e landscape para tablets. + +**Gestos de Navegação:** +- Swipe para direita: voltar à tela anterior +- Swipe para baixo: pull-to-refresh nas listas +- Swipe horizontal em cards: ações rápidas (editar/excluir) +- Long press: menu contextual +- Pinch to zoom: galeria de fotos + +**Dark Mode Automático:** +Detecção da preferência do sistema com toggle manual. Paleta adaptada: backgrounds #1F2937, cards #374151, textos #F9FAFB, acentos mantidos com ajuste de saturação. \ No newline at end of file diff --git a/.vercel/project.json b/.vercel/project.json new file mode 100644 index 0000000..8f04d72 --- /dev/null +++ b/.vercel/project.json @@ -0,0 +1 @@ +{"projectId":"prj_yIejbjdWxs5ZZ5YWOEHm8UAqDS8k","orgId":"team_KY59uhtbyLyWDtIuz7Ew3uEk","projectName":"trae_42fqthkv","neverMindDeployCard":true} \ No newline at end of file diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..a48e5d3 --- /dev/null +++ b/.vercelignore @@ -0,0 +1,7 @@ +node_modules +build +dist +.git +.trae +.log +.figma \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4349c78 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# Use Node.js 18 Alpine como base +FROM node:18-alpine AS base + +# Instalar pnpm +RUN npm install -g pnpm + +# Definir diretório de trabalho +WORKDIR /app + +# Copiar arquivos de dependências +COPY package.json pnpm-lock.yaml ./ + +# Instalar dependências +RUN pnpm install --frozen-lockfile + +# Copiar código fonte +COPY . . + +# Build da aplicação +RUN pnpm run build + +# Estágio de produção +FROM node:18-alpine AS production + +# Instalar pnpm e serve +RUN npm install -g pnpm serve + +# Definir diretório de trabalho +WORKDIR /app + +# Copiar arquivos buildados +COPY --from=base /app/dist ./dist +COPY --from=base /app/package.json ./ + +# Expor porta +EXPOSE $PORT + +# Comando para iniciar o servidor +CMD ["sh", "-c", "serve -s dist -l ${PORT:-3000}"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa76918 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# 🏗️ TSteelRDO - Sistema de Gestão de Diário de Obra (RDO) + +Este é um sistema multi-tenant para gestão de canteiros de obras, construído com React, Vite e Supabase. + +## 🚀 Como Começar + +1. **Instalar dependências:** + + ```bash + npm install + ``` + +2. **Configurar variáveis de ambiente:** + - O arquivo `.env` já deve estar configurado na raiz. + +3. **Rodar em desenvolvimento:** + + ```bash + npm run dev + ``` + +4. **Rodar scripts de utilidade (Banco/Deploy):** + + ```bash + # Verificar status do Supabase + node scripts/check-supabase-status.js + + # Aplicar Migrations (modo Manual/Script) + node scripts/deploy-migrations.js + ``` + +## 📂 Estrutura do Projeto + +- **`src/`**: Código fonte da aplicação frontend (React). + - `components/`: Componentes reutilizáveis. + - `pages/`: Páginas da aplicação. + - `hooks/`: Custom hooks. + - `lib/`: Configurações de serviços (Supabase cliente, etc). + +- **`documentation/`**: Documentação detalhada, arquitetura, manuais e guias de implementação (antigos e novos). + - Consulte `documentation/ARQUITETURA_MULTI_TENANT.md` para entender o modelo de dados. + +- **`scripts/`**: Scripts de automação, deploy, verificação de status e testes manuais. + +- **`database_scripts/`**: Backups, scripts SQL manuais e dumps. + +- **`supabase/`**: Configurações oficiais do Supabase (migrations, seeds). + +## 🛠️ Tecnologias + +- **Frontend**: React + Vite + TypeScript +- **Estilização**: TailwindCSS +- **Backend/Banco**: Supabase (PostgreSQL + Auth + Storage) +- **Mobile**: Capacitor (Configurado para Android/iOS) + +## 🔐 Autenticação e Multi-Tenancy + +O sistema utiliza RLS (Row Level Security) nativo do Postgres e Supabase Auth para garantir isolamento total dos dados entre organizações (Tenants). + +--- + +> _Para mais detalhes, consulte a pasta `documentation/`._ diff --git a/auto-sync-config.json b/auto-sync-config.json new file mode 100644 index 0000000..c6d8769 --- /dev/null +++ b/auto-sync-config.json @@ -0,0 +1,28 @@ +{ + "repository": { + "remote_url": "https://github.com/Reifonas/TS_RDO.git", + "branch": "main", + "auto_push": true + }, + "monitoring": { + "watch_interval": 30, + "continuous_mode": false, + "verbose_logging": true + }, + + "logging": { + "enabled": true, + "retention_days": 7, + "log_level": "INFO" + }, + "git": { + "auto_commit_message_template": "Auto-sync: {timestamp} - {changes}", + "pull_before_push": true, + "use_rebase": true + }, + "notifications": { + "enabled": true, + "success_notifications": false, + "error_notifications": true + } +} \ No newline at end of file diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 0000000..8b168a2 --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,9 @@ +import type { CapacitorConfig } from '@capacitor/cli'; + +const config: CapacitorConfig = { + appId: 'com.example.rdomain', + appName: 'RDO-main', + webDir: 'dist' +}; + +export default config; diff --git a/database_scripts/check_data.sql b/database_scripts/check_data.sql new file mode 100644 index 0000000..8e1adc1 --- /dev/null +++ b/database_scripts/check_data.sql @@ -0,0 +1,13 @@ +-- Verificar dados nas tabelas principais +SELECT 'obras' as tabela, COUNT(*) as total FROM obras +UNION ALL +SELECT 'usuarios' as tabela, COUNT(*) as total FROM usuarios +UNION ALL +SELECT 'rdos' as tabela, COUNT(*) as total FROM rdos +UNION ALL +SELECT 'tipos_atividade' as tabela, COUNT(*) as total FROM tipos_atividade +UNION ALL +SELECT 'condicoes_climaticas' as tabela, COUNT(*) as total FROM condicoes_climaticas +UNION ALL +SELECT 'funcionarios' as tabela, COUNT(*) as total FROM funcionarios +ORDER BY tabela; \ No newline at end of file diff --git a/dist/_headers b/dist/_headers new file mode 100644 index 0000000..a6c1565 --- /dev/null +++ b/dist/_headers @@ -0,0 +1,4 @@ +# Headers básicos +/* + X-Frame-Options: DENY + X-Content-Type-Options: nosniff \ No newline at end of file diff --git a/dist/assets/css/index-DXaaJsOA.css b/dist/assets/css/index-DXaaJsOA.css new file mode 100644 index 0000000..2a353c9 --- /dev/null +++ b/dist/assets/css/index-DXaaJsOA.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:1rem;padding-left:1rem}@media (min-width: 475px){.container{max-width:475px}}@media (min-width: 640px){.container{max-width:640px;padding-right:1.5rem;padding-left:1.5rem}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px;padding-right:2rem;padding-left:2rem}}@media (min-width: 1280px){.container{max-width:1280px;padding-right:2.5rem;padding-left:2.5rem}}@media (min-width: 1536px){.container{max-width:1536px;padding-right:3rem;padding-left:3rem}}.pointer-events-none{pointer-events:none}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.-bottom-2{bottom:-.5rem}.bottom-0{bottom:0}.bottom-14{bottom:3.5rem}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-12{top:3rem}.top-4{top:1rem}.top-\[65px\]{top:65px}.top-full{top:100%}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.order-first{order:-9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mt-8{margin-top:-2rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-8{margin-left:2rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-65px\)\]{height:calc(100vh - 65px)}.h-full{height:100%}.h-px{height:1px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(80vh-120px\)\]{max-height:calc(80vh - 120px)}.min-h-\[44px\]{min-height:44px}.min-h-\[72px\]{min-height:72px}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-80{width:20rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[140px\]{min-width:140px}.min-w-\[80px\]{min-width:80px}.min-w-fit{min-width:-moz-fit-content;min-width:fit-content}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.touch-manipulation{touch-action:manipulation}.resize-none{resize:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.justify-self-end{justify-self:end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-200\/50{border-color:#bfdbfe80}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-emerald-200\/50{border-color:#a7f3d080}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-200\/50{border-color:#e5e7eb80}.border-gray-200\/80{border-color:#e5e7ebcc}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-300\/50{border-color:#d1d5db80}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-200\/50{border-color:#bbf7d080}.border-green-400{--tw-border-opacity: 1;border-color:rgb(74 222 128 / var(--tw-border-opacity, 1))}.border-green-400\/30{border-color:#4ade804d}.border-indigo-200\/50{border-color:#c7d2fe80}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-200\/50{border-color:#fed7aa80}.border-orange-400{--tw-border-opacity: 1;border-color:rgb(251 146 60 / var(--tw-border-opacity, 1))}.border-purple-200\/50{border-color:#e9d5ff80}.border-purple-400{--tw-border-opacity: 1;border-color:rgb(192 132 252 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-400\/30{border-color:#f871714d}.border-red-400\/50{border-color:#f8717180}.border-teal-200\/50{border-color:#99f6e480}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-white\/20{border-color:#fff3}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-200\/50{border-color:#fef08a80}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity, 1))}.border-yellow-400\/30{border-color:#facc154d}.border-t-transparent{border-top-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-400\/20{background-color:#4ade8033}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-teal-50{--tw-bg-opacity: 1;background-color:rgb(240 253 250 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-white\/50{background-color:#ffffff80}.bg-white\/70{background-color:#ffffffb3}.bg-white\/80{background-color:#fffc}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-300\/90{background-color:#fde047e6}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-600{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from: #eff6ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 246 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-50{--tw-gradient-from: #ecfdf5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 253 245 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-50{--tw-gradient-from: #f0fdf4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(240 253 244 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-50{--tw-gradient-from: #fff7ed var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 247 237 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-50{--tw-gradient-from: #faf5ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(250 245 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-teal-50{--tw-gradient-from: #f0fdfa var(--tw-gradient-from-position);--tw-gradient-to: rgb(240 253 250 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-yellow-50{--tw-gradient-from: #fefce8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(254 252 232 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-blue-300{--tw-gradient-to: rgb(147 197 253 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #93c5fd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #fff var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-cyan-50{--tw-gradient-to: #ecfeff var(--tw-gradient-to-position)}.to-emerald-50{--tw-gradient-to: #ecfdf5 var(--tw-gradient-to-position)}.to-emerald-600{--tw-gradient-to: #059669 var(--tw-gradient-to-position)}.to-indigo-100{--tw-gradient-to: #e0e7ff var(--tw-gradient-to-position)}.to-indigo-50{--tw-gradient-to: #eef2ff var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-600{--tw-gradient-to: #9333ea var(--tw-gradient-to-position)}.to-red-50{--tw-gradient-to: #fef2f2 var(--tw-gradient-to-position)}.to-teal-50{--tw-gradient-to: #f0fdfa var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.fill-white{fill:#fff}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-24{padding-bottom:6rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-12{padding-left:3rem}.pl-3{padding-left:.75rem}.pl-8{padding-left:2rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-emerald-900{--tw-text-opacity: 1;color:rgb(6 78 59 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-200{--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-800{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.text-indigo-900{--tw-text-opacity: 1;color:rgb(49 46 129 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-purple-900{--tw-text-opacity: 1;color:rgb(88 28 135 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-red-900{--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity, 1))}.text-teal-500{--tw-text-opacity: 1;color:rgb(20 184 166 / var(--tw-text-opacity, 1))}.text-teal-700{--tw-text-opacity: 1;color:rgb(15 118 110 / var(--tw-text-opacity, 1))}.text-teal-900{--tw-text-opacity: 1;color:rgb(19 78 74 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.placeholder-blue-200::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(191 219 254 / var(--tw-placeholder-opacity, 1))}.placeholder-blue-200::placeholder{--tw-placeholder-opacity: 1;color:rgb(191 219 254 / var(--tw-placeholder-opacity, 1))}.placeholder-blue-200\/50::-moz-placeholder{color:#bfdbfe80}.placeholder-blue-200\/50::placeholder{color:#bfdbfe80}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.opacity-0{opacity:0}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-blue-500\/30{--tw-shadow-color: rgb(59 130 246 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/50{--tw-shadow-color: rgb(59 130 246 / .5);--tw-shadow: var(--tw-shadow-colored)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.ring-offset-2{--tw-ring-offset-width: 2px}.drop-shadow-2xl{--tw-drop-shadow: drop-shadow(0 25px 25px rgb(0 0 0 / .15));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-lg{--tw-backdrop-blur: blur(16px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*{box-sizing:border-box}html,body{overflow-x:hidden;width:100%;max-width:100vw}#root{width:100%;max-width:100vw;overflow-x:hidden}@keyframes fade-in{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-up{0%{opacity:0;transform:translateY(30px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .8s ease-out}.animate-slide-up{animation:slide-up .6s ease-out .2s both}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-blue-200\/50:hover{border-color:#bfdbfe80}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-green-200:hover{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity, 1))}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-200:hover{--tw-bg-opacity: 1;background-color:rgb(233 213 255 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/15:hover{background-color:#ffffff26}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-yellow-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-700:hover{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.hover\:from-blue-600:hover{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-green-600:hover{--tw-gradient-from: #16a34a var(--tw-gradient-from-position);--tw-gradient-to: rgb(22 163 74 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-emerald-700:hover{--tw-gradient-to: #047857 var(--tw-gradient-to-position)}.hover\:to-purple-700:hover{--tw-gradient-to: #7e22ce var(--tw-gradient-to-position)}.hover\:text-blue-200:hover{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-800:hover{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-red-500:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-4:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(96 165 250 / var(--tw-ring-opacity, 1))}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-blue-500\/20:focus{--tw-ring-color: rgb(59 130 246 / .2)}.focus\:ring-blue-500\/50:focus{--tw-ring-color: rgb(59 130 246 / .5)}.focus\:ring-red-500\/20:focus{--tw-ring-color: rgb(239 68 68 / .2)}.focus\:ring-yellow-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(250 204 21 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-transparent:focus{--tw-ring-offset-color: transparent}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-blue-400:disabled{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.disabled\:bg-gray-400:disabled{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}.dark\:divide-gray-700:is(.dark *)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(55 65 81 / var(--tw-divide-opacity, 1))}.dark\:border-blue-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.dark\:border-blue-700\/50:is(.dark *){border-color:#1d4ed880}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-emerald-700\/50:is(.dark *){border-color:#04785780}.dark\:border-gray-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:border-gray-600\/50:is(.dark *){border-color:#4b556380}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-gray-700\/50:is(.dark *){border-color:#37415180}.dark\:border-gray-700\/80:is(.dark *){border-color:#374151cc}.dark\:border-green-700\/50:is(.dark *){border-color:#15803d80}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-indigo-700\/50:is(.dark *){border-color:#4338ca80}.dark\:border-orange-700\/50:is(.dark *){border-color:#c2410c80}.dark\:border-purple-700\/50:is(.dark *){border-color:#7e22ce80}.dark\:border-red-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.dark\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.dark\:border-red-900\/30:is(.dark *){border-color:#7f1d1d4d}.dark\:border-teal-700\/50:is(.dark *){border-color:#0f766e80}.dark\:border-yellow-700\/50:is(.dark *){border-color:#a1620780}.dark\:bg-blue-800\/50:is(.dark *){background-color:#1e40af80}.dark\:bg-blue-900\/20:is(.dark *){background-color:#1e3a8a33}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700\/30:is(.dark *){background-color:#3741514d}.dark\:bg-gray-700\/50:is(.dark *){background-color:#37415180}.dark\:bg-gray-700\/70:is(.dark *){background-color:#374151b3}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-800\/70:is(.dark *){background-color:#1f2937b3}.dark\:bg-gray-800\/80:is(.dark *){background-color:#1f2937cc}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900\/80:is(.dark *){background-color:#111827cc}.dark\:bg-green-800\/50:is(.dark *){background-color:#16653480}.dark\:bg-green-900\/20:is(.dark *){background-color:#14532d33}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-indigo-900\/20:is(.dark *){background-color:#312e8133}.dark\:bg-orange-900\/20:is(.dark *){background-color:#7c2d1233}.dark\:bg-orange-900\/30:is(.dark *){background-color:#7c2d124d}.dark\:bg-purple-900\/20:is(.dark *){background-color:#581c8733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-800\/50:is(.dark *){background-color:#991b1b80}.dark\:bg-red-900\/20:is(.dark *){background-color:#7f1d1d33}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-teal-900\/20:is(.dark *){background-color:#134e4a33}.dark\:bg-yellow-900\/20:is(.dark *){background-color:#713f1233}.dark\:bg-yellow-900\/30:is(.dark *){background-color:#713f124d}.dark\:from-blue-900\/20:is(.dark *){--tw-gradient-from: rgb(30 58 138 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 58 138 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-emerald-900\/20:is(.dark *){--tw-gradient-from: rgb(6 78 59 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 78 59 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-gray-900:is(.dark *){--tw-gradient-from: #111827 var(--tw-gradient-from-position);--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-green-900\/20:is(.dark *){--tw-gradient-from: rgb(20 83 45 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(20 83 45 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-900\/20:is(.dark *){--tw-gradient-from: rgb(49 46 129 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-orange-900\/20:is(.dark *){--tw-gradient-from: rgb(124 45 18 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(124 45 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-purple-900\/20:is(.dark *){--tw-gradient-from: rgb(88 28 135 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(88 28 135 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-teal-900\/20:is(.dark *){--tw-gradient-from: rgb(19 78 74 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(19 78 74 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-yellow-900\/20:is(.dark *){--tw-gradient-from: rgb(113 63 18 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(113 63 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:via-gray-800:is(.dark *){--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #1f2937 var(--tw-gradient-via-position), var(--tw-gradient-to)}.dark\:to-blue-900\/20:is(.dark *){--tw-gradient-to: rgb(30 58 138 / .2) var(--tw-gradient-to-position)}.dark\:to-cyan-900\/20:is(.dark *){--tw-gradient-to: rgb(22 78 99 / .2) var(--tw-gradient-to-position)}.dark\:to-emerald-900\/20:is(.dark *){--tw-gradient-to: rgb(6 78 59 / .2) var(--tw-gradient-to-position)}.dark\:to-gray-900:is(.dark *){--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.dark\:to-indigo-900\/20:is(.dark *){--tw-gradient-to: rgb(49 46 129 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-900\/20:is(.dark *){--tw-gradient-to: rgb(124 45 18 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-900\/20:is(.dark *){--tw-gradient-to: rgb(131 24 67 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-900\/20:is(.dark *){--tw-gradient-to: rgb(88 28 135 / .2) var(--tw-gradient-to-position)}.dark\:to-red-900\/20:is(.dark *){--tw-gradient-to: rgb(127 29 29 / .2) var(--tw-gradient-to-position)}.dark\:to-teal-900\/20:is(.dark *){--tw-gradient-to: rgb(19 78 74 / .2) var(--tw-gradient-to-position)}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-emerald-100:is(.dark *){--tw-text-opacity: 1;color:rgb(209 250 229 / var(--tw-text-opacity, 1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-100:is(.dark *){--tw-text-opacity: 1;color:rgb(220 252 231 / var(--tw-text-opacity, 1))}.dark\:text-green-200:is(.dark *){--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-100:is(.dark *){--tw-text-opacity: 1;color:rgb(224 231 255 / var(--tw-text-opacity, 1))}.dark\:text-indigo-200:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-orange-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.dark\:text-orange-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.dark\:text-purple-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.dark\:text-purple-200:is(.dark *){--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.dark\:text-purple-300:is(.dark *){--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.dark\:text-red-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-teal-100:is(.dark *){--tw-text-opacity: 1;color:rgb(204 251 241 / var(--tw-text-opacity, 1))}.dark\:text-teal-300:is(.dark *){--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity, 1))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:placeholder-gray-400:is(.dark *)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.dark\:placeholder-gray-400:is(.dark *)::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.dark\:ring-offset-gray-800:is(.dark *){--tw-ring-offset-color: #1f2937}.dark\:hover\:border-blue-400:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.dark\:hover\:border-gray-500:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.dark\:hover\:bg-blue-900\/20:hover:is(.dark *){background-color:#1e3a8a33}.dark\:hover\:bg-blue-900\/50:hover:is(.dark *){background-color:#1e3a8a80}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700\/50:hover:is(.dark *){background-color:#37415180}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-green-900\/50:hover:is(.dark *){background-color:#14532d80}.dark\:hover\:bg-purple-900\/50:hover:is(.dark *){background-color:#581c8780}.dark\:hover\:bg-red-900\/20:hover:is(.dark *){background-color:#7f1d1d33}.dark\:hover\:text-blue-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:hover\:text-white:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 475px){.xs\:inline{display:inline}.xs\:hidden{display:none}}@media (min-width: 640px){.sm\:top-\[73px\]{top:73px}.sm\:order-none{order:0}.sm\:mx-auto{margin-left:auto;margin-right:auto}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:h-2{height:.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-6{height:1.5rem}.sm\:h-\[calc\(100vh-73px\)\]{height:calc(100vh - 73px)}.sm\:min-h-0{min-height:0px}.sm\:min-h-\[80px\]{min-height:80px}.sm\:w-2{width:.5rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-6{width:1.5rem}.sm\:w-80{width:20rem}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-32{max-width:8rem}.sm\:max-w-md{max-width:28rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-start{justify-content:flex-start}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-2{padding:.5rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:p-8{padding:2rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-2{padding-left:.5rem;padding-right:.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-1{padding-top:.25rem;padding-bottom:.25rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-3{padding-top:.75rem;padding-bottom:.75rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:pl-10{padding-left:2.5rem}.sm\:pr-4{padding-right:1rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:block{display:block}.md\:hidden{display:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:sticky{position:sticky}.lg\:z-auto{z-index:auto}.lg\:ml-0{margin-left:0}.lg\:hidden{display:none}.lg\:min-h-\[88px\]{min-height:88px}.lg\:w-80{width:20rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:gap-4{gap:1rem}.lg\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.lg\:p-6{padding:1.5rem}.lg\:p-8{padding:2rem}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-8{padding-top:2rem;padding-bottom:2rem}.lg\:pt-8{padding-top:2rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width: 1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:text-4xl{font-size:2.25rem;line-height:2.5rem}} diff --git a/dist/assets/js/Auth-KZISTjMo.js b/dist/assets/js/Auth-KZISTjMo.js new file mode 100644 index 0000000..af4ff6c --- /dev/null +++ b/dist/assets/js/Auth-KZISTjMo.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as h,d as P,u as S}from"./router-vendor-D4by-_6Z.js";import{s as j,u as y}from"./index-doec96Hx.js";import{N as $}from"./NeuralNetworkBackground-CER-dIFD.js";import"./react-vendor-CqRd3GwO.js";import"./ui-vendor-CyRvbSfR.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const M=()=>{const[n,l]=h.useState(!1),[m,i]=h.useState(null),d=async o=>{try{l(!0),i(null);const{data:s,error:t}=await j.auth.signInWithOAuth({provider:o,options:{redirectTo:`${window.location.origin}/auth/callback`,queryParams:{access_type:"offline",prompt:"consent"}}});if(t)throw t;return{data:s,error:null}}catch(s){const t=s instanceof Error?s.message:"Erro ao fazer login";return i({message:t,provider:o}),{data:null,error:t}}finally{l(!1)}};return{loading:n,error:m,signInWithGoogle:()=>d("google"),signInWithMicrosoft:()=>d("azure"),signInWithProvider:d,linkProvider:async o=>{try{l(!0),i(null);const{data:s,error:t}=await j.auth.linkIdentity({provider:o});if(t)throw t;return{data:s,error:null}}catch(s){const t=s instanceof Error?s.message:"Erro ao vincular conta";return i({message:t,provider:o}),{data:null,error:t}}finally{l(!1)}},unlinkProvider:async o=>{try{l(!0),i(null);const{data:{user:s}}=await j.auth.getUser();if(!s)throw new Error("Usuário não autenticado");const t=s.identities?.find(v=>v.provider===o);if(!t)throw new Error(`Conta ${o} não vinculada`);const{data:u,error:g}=await j.auth.unlinkIdentity(t);if(g)throw g;return{data:u,error:null}}catch(s){const t=s instanceof Error?s.message:"Erro ao desvincular conta";return i({message:t,provider:o}),{data:null,error:t}}finally{l(!1)}},hasProvider:async o=>{const{data:{user:s}}=await j.auth.getUser();return s?.identities?.some(t=>t.provider===o)??!1}}},F=({mode:n="login",onSuccess:l,onError:m})=>{const{loading:i,signInWithGoogle:d,signInWithMicrosoft:x,linkProvider:r}=M(),f=async()=>{const{error:o}=n==="login"?await d():await r("google");o?m?.(o):l?.()},c=async()=>{const{error:o}=n==="login"?await x():await r("azure");o?m?.(o):l?.()},b=n==="login"?"Entrar com":"Vincular";return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:f,disabled:i,className:"w-full flex items-center justify-center gap-3 px-4 py-3 bg-white border-2 border-gray-300 rounded-lg hover:bg-gray-50 hover:border-gray-400 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed group",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),e.jsxs("span",{className:"font-medium text-gray-700",children:[b," Google"]})]}),e.jsxs("button",{onClick:c,disabled:i,className:"w-full flex items-center justify-center gap-3 px-4 py-3 bg-white border-2 border-gray-300 rounded-lg hover:bg-gray-50 hover:border-gray-400 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 23 23",children:[e.jsx("path",{fill:"#f3f3f3",d:"M0 0h23v23H0z"}),e.jsx("path",{fill:"#f35325",d:"M1 1h10v10H1z"}),e.jsx("path",{fill:"#81bc06",d:"M12 1h10v10H12z"}),e.jsx("path",{fill:"#05a6f0",d:"M1 12h10v10H1z"}),e.jsx("path",{fill:"#ffba08",d:"M12 12h10v10H12z"})]}),e.jsxs("span",{className:"font-medium text-gray-700",children:[b," Microsoft"]})]}),n==="login"&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-gray-300"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"px-2 bg-white text-gray-500",children:"ou"})})]})]})},z=({onSuccess:n,onSwitchToRegister:l})=>{const{login:m,loading:i,error:d,clearError:x}=y(),[r,f]=h.useState({email:"",password:""}),[c,b]=h.useState(!1),o=async t=>{if(t.preventDefault(),x(),!r.email||!r.password)return;(await m(r)).success&&n&&n()},s=t=>{const{name:u,value:g}=t.target;f(v=>({...v,[u]:g}))};return e.jsx("div",{className:"w-full max-w-md mx-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Entrar"}),e.jsx("p",{className:"text-blue-200",children:"Acesse sua conta"})]}),d&&e.jsx("div",{className:"mb-4 p-3 bg-red-500/20 border border-red-400/30 rounded-xl backdrop-blur-sm",children:e.jsx("p",{className:"text-red-200 text-sm",children:d})}),e.jsx(F,{mode:"login",onSuccess:n,onError:t=>{}}),e.jsxs("form",{onSubmit:o,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-white mb-2",children:"Email"}),e.jsx("input",{type:"email",id:"email",name:"email",value:r.email,onChange:s,required:!0,className:"w-full px-4 py-3 bg-white/10 border border-white/20 rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200",placeholder:"seu@email.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-white mb-2",children:"Senha"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:c?"text":"password",id:"password",name:"password",value:r.password,onChange:s,required:!0,className:"w-full px-4 py-3 bg-white/10 border border-white/20 rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 pr-12",placeholder:"Sua senha"}),e.jsx("button",{type:"button",onClick:()=>b(!c),className:"absolute inset-y-0 right-0 pr-4 flex items-center text-blue-200 hover:text-white transition-colors duration-200",children:c?"🙈":"👁️"})]})]}),e.jsx("button",{type:"submit",disabled:i||!r.email||!r.password,className:"w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white py-3 px-6 rounded-xl hover:from-blue-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-lg hover:shadow-xl font-semibold",children:i?e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Entrando..."]}):"Entrar"})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("button",{type:"button",className:"text-blue-300 hover:text-white text-sm font-medium transition-colors duration-200",onClick:()=>{alert("Funcionalidade de recuperação de senha será implementada em breve")},children:"Esqueceu sua senha?"})}),l&&e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("p",{className:"text-blue-200 text-sm",children:["Não tem uma conta?"," ",e.jsx("button",{type:"button",onClick:l,className:"text-blue-300 hover:text-white font-medium transition-colors duration-200",children:"Cadastre-se"})]})})]})})},D=({onSuccess:n,onSwitchToLogin:l})=>{const{register:m,loading:i,error:d,clearError:x}=y(),[r,f]=h.useState({nome:"",email:"",password:"",confirmPassword:"",cpf:"",telefone:""}),[c,b]=h.useState(!1),[o,s]=h.useState(!1),[t,u]=h.useState({}),g=()=>{const a={};return r.nome.trim()||(a.nome="Nome é obrigatório"),r.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.email)||(a.email="Email inválido"):a.email="Email é obrigatório",r.password?r.password.length<6&&(a.password="Senha deve ter pelo menos 6 caracteres"):a.password="Senha é obrigatória",r.password!==r.confirmPassword&&(a.confirmPassword="Senhas não coincidem"),r.cpf&&!/^\d{11}$/.test(r.cpf.replace(/\D/g,""))&&(a.cpf="CPF deve ter 11 dígitos"),r.telefone&&!/^\d{10,11}$/.test(r.telefone.replace(/\D/g,""))&&(a.telefone="Telefone deve ter 10 ou 11 dígitos"),u(a),Object.keys(a).length===0},v=async a=>{if(a.preventDefault(),x(),u({}),!g())return;(await m({nome:r.nome,email:r.email,password:r.password,cpf:r.cpf||void 0,telefone:r.telefone||void 0})).success&&(alert("Cadastro realizado com sucesso! Verifique seu email para confirmar a conta."),n&&n())},w=a=>{const{name:p,value:E}=a.target;f(N=>({...N,[p]:E})),t[p]&&u(N=>({...N,[p]:""}))},k=a=>a.replace(/\D/g,"").replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4"),C=a=>{const p=a.replace(/\D/g,"");return p.length<=10?p.replace(/(\d{2})(\d{4})(\d{4})/,"($1) $2-$3"):p.replace(/(\d{2})(\d{5})(\d{4})/,"($1) $2-$3")};return e.jsx("div",{className:"w-full max-w-md mx-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Cadastrar"}),e.jsx("p",{className:"text-blue-200",children:"Crie sua conta"})]}),d&&e.jsx("div",{className:"mb-4 p-3 bg-red-500/20 border border-red-400/30 rounded-xl backdrop-blur-sm",children:e.jsx("p",{className:"text-red-200 text-sm",children:d})}),e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"nome",className:"block text-sm font-medium text-white mb-2",children:"Nome Completo *"}),e.jsx("input",{type:"text",id:"nome",name:"nome",value:r.nome,onChange:w,required:!0,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${t.nome?"border-red-400/50":"border-white/20"}`,placeholder:"Seu nome completo"}),t.nome&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.nome})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-white mb-2",children:"Email *"}),e.jsx("input",{type:"email",id:"email",name:"email",value:r.email,onChange:w,required:!0,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${t.email?"border-red-400/50":"border-white/20"}`,placeholder:"seu@email.com"}),t.email&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.email})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"cpf",className:"block text-sm font-medium text-white mb-2",children:"CPF"}),e.jsx("input",{type:"text",id:"cpf",name:"cpf",value:k(r.cpf),onChange:a=>w({...a,target:{...a.target,value:a.target.value.replace(/\D/g,"")}}),maxLength:14,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${t.cpf?"border-red-400/50":"border-white/20"}`,placeholder:"000.000.000-00"}),t.cpf&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.cpf})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"telefone",className:"block text-sm font-medium text-white mb-2",children:"Telefone"}),e.jsx("input",{type:"text",id:"telefone",name:"telefone",value:C(r.telefone),onChange:a=>w({...a,target:{...a.target,value:a.target.value.replace(/\D/g,"")}}),maxLength:15,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${t.telefone?"border-red-400/50":"border-white/20"}`,placeholder:"(11) 99999-9999"}),t.telefone&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.telefone})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-white mb-2",children:"Senha *"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:c?"text":"password",id:"password",name:"password",value:r.password,onChange:w,required:!0,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 pr-10 ${t.password?"border-red-400/50":"border-white/20"}`,placeholder:"Mínimo 6 caracteres"}),e.jsx("button",{type:"button",onClick:()=>b(!c),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-blue-200 hover:text-white",children:c?"🙈":"👁️"})]}),t.password&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.password})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-white mb-2",children:"Confirmar Senha *"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:o?"text":"password",id:"confirmPassword",name:"confirmPassword",value:r.confirmPassword,onChange:w,required:!0,className:`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 pr-10 ${t.confirmPassword?"border-red-400/50":"border-white/20"}`,placeholder:"Confirme sua senha"}),e.jsx("button",{type:"button",onClick:()=>s(!o),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-blue-200 hover:text-white",children:o?"🙈":"👁️"})]}),t.confirmPassword&&e.jsx("p",{className:"text-red-300 text-xs mt-1",children:t.confirmPassword})]}),e.jsx("button",{type:"submit",disabled:i,className:"w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white py-3 px-4 rounded-xl hover:from-blue-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 focus:ring-offset-transparent disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 font-medium backdrop-blur-sm",children:i?e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Cadastrando..."]}):"Cadastrar"})]}),l&&e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("p",{className:"text-blue-200 text-sm",children:["Já tem uma conta?"," ",e.jsx("button",{type:"button",onClick:l,className:"text-white hover:text-blue-200 font-medium underline transition-colors duration-200",children:"Entrar"})]})})]})})},L="/assets/png/tracksteel-logo-CJR9ckUT.png",R=()=>{const n=P(),l=S(),{isAuthenticated:m,loading:i,bypassLogin:d}=y(),[x,r]=h.useState("login");h.useEffect(()=>{if(m&&!i){const s=l.state?.from?.pathname||"/dashboard";n(s,{replace:!0})}},[m,i,n,l]),h.useEffect(()=>{const s=l.pathname;s.includes("register")||s.includes("cadastro")?r("register"):r("login")},[l.pathname]);const f=()=>{const s=l.state?.from?.pathname||"/dashboard";n(s,{replace:!0})},c=async()=>{try{if((await d()).success){const t=l.state?.from?.pathname||"/dashboard";n(t,{replace:!0})}}catch{}},b=()=>{r("login"),n("/login",{replace:!0})},o=()=>{r("register"),n("/register",{replace:!0})};return i?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Carregando..."})]})}):e.jsxs("div",{className:"min-h-screen relative flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8 overflow-hidden",children:[e.jsx($,{}),e.jsxs("div",{className:"relative z-10 max-w-md w-full space-y-8 animate-fade-in",children:[e.jsx("div",{className:"text-center",children:e.jsxs("div",{className:"mx-auto mb-6",children:[e.jsx("div",{className:"bg-white/10 backdrop-blur-md rounded-xl shadow-lg border border-white/20 p-6 mb-4 inline-block",children:e.jsxs("div",{className:"w-40 h-30 flex items-center justify-center",children:[e.jsx("img",{src:L,alt:"TrackSteel Logo",width:"160",height:"120",className:"mx-auto drop-shadow-2xl",onLoad:()=>{},onError:s=>{const t=s.target;t.style.display="none";const u=t.nextElementSibling;u&&(u.style.display="block")}}),e.jsx("div",{className:"hidden text-white text-center",style:{display:"none"},children:e.jsxs("svg",{className:"w-40 h-30 mx-auto mb-2",viewBox:"0 0 160 120",fill:"none",children:[e.jsx("rect",{width:"160",height:"120",rx:"8",fill:"rgba(255,255,255,0.1)",stroke:"rgba(255,255,255,0.3)"}),e.jsx("text",{x:"80",y:"65",textAnchor:"middle",className:"fill-white text-lg font-bold",children:"LOGO"})]})})]})}),e.jsx("div",{className:"mt-4",children:e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-blue-300 to-transparent w-32 mx-auto"})})]})}),e.jsxs("div",{className:"flex bg-white/10 backdrop-blur-sm border border-white/20 rounded-xl p-1 mb-6",children:[e.jsx("button",{onClick:()=>r("login"),className:`flex-1 py-3 px-4 rounded-lg text-sm font-semibold transition-all duration-200 ${x==="login"?"bg-white/20 text-white shadow-lg":"text-blue-200 hover:text-white hover:bg-white/10"}`,children:"Entrar"}),e.jsx("button",{onClick:()=>r("register"),className:`flex-1 py-3 px-4 rounded-lg text-sm font-semibold transition-all duration-200 ${x==="register"?"bg-white/20 text-white shadow-lg":"text-blue-200 hover:text-white hover:bg-white/10"}`,children:"Cadastrar"})]}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-400/30 rounded-xl backdrop-blur-sm p-4",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-yellow-300",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("h3",{className:"text-sm font-semibold text-yellow-200",children:"Modo Desenvolvimento"})})]}),e.jsxs("div",{className:"ml-8",children:[e.jsx("p",{className:"text-sm text-yellow-100 mb-3",children:"Botão temporário para acesso direto ao sistema sem autenticação."}),e.jsx("button",{onClick:c,className:"bg-yellow-300/90 hover:bg-yellow-200 text-yellow-900 font-medium py-2 px-4 rounded-lg text-sm transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-yellow-400 focus:ring-offset-2 shadow-lg hover:shadow-xl",children:"🚧 Entrar sem Login (DEV)"})]})]})}),e.jsx("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl shadow-2xl border border-white/20 p-8 transition-all duration-300 hover:bg-white/15 animate-slide-up",children:x==="login"?e.jsx(z,{onSuccess:f,onSwitchToRegister:o}):e.jsx(D,{onSuccess:f,onSwitchToLogin:b})}),e.jsx("div",{className:"text-center text-sm text-gray-300",children:e.jsx("p",{className:"italic",children:"Desenvolvido por TrackSteel"})})]})]})};export{R as default}; diff --git a/dist/assets/js/AuthCallback-DlZVcD4W.js b/dist/assets/js/AuthCallback-DlZVcD4W.js new file mode 100644 index 0000000..76f4214 --- /dev/null +++ b/dist/assets/js/AuthCallback-DlZVcD4W.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{d as w,r as t}from"./router-vendor-D4by-_6Z.js";import{s as i}from"./index-doec96Hx.js";import{a0 as j,c as b,a2 as N}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const _=()=>{const o=w(),[s,c]=t.useState("loading"),[g,n]=t.useState("Processando autenticação..."),l=t.useCallback(async()=>{try{const a=new URLSearchParams(window.location.search),d=a.get("error"),x=a.get("error_description");if(d)throw new Error(x||d);const{data:{session:r},error:m}=await i.auth.getSession();if(m)throw m;if(!r)throw new Error("Nenhuma sessão encontrada");const{data:u,error:h}=await i.from("usuarios").select("id, organizacao_id").eq("id",r.user.id).single();if(!u&&h?.code==="PGRST116"){const{error:p}=await i.from("usuarios").insert({id:r.user.id,email:r.user.email,nome:r.user.user_metadata.full_name||r.user.email?.split("@")[0]})}c("success"),n("Login realizado com sucesso!");const f=u?.organizacao_id;setTimeout(()=>{o(f?"/":"/selecionar-organizacao")},1e3)}catch(a){c("error"),n(a instanceof Error?a.message:"Erro ao processar autenticação"),setTimeout(()=>{o("/login")},3e3)}},[o]);return t.useEffect(()=>{l()},[l]),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-2xl shadow-xl p-8 max-w-md w-full",children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="loading"&&e.jsx(j,{className:"w-16 h-16 text-blue-500 animate-spin"}),s==="success"&&e.jsx(b,{className:"w-16 h-16 text-green-500"}),s==="error"&&e.jsx(N,{className:"w-16 h-16 text-red-500"}),e.jsxs("div",{className:"text-center",children:[e.jsxs("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:[s==="loading"&&"Processando...",s==="success"&&"Sucesso!",s==="error"&&"Erro"]}),e.jsx("p",{className:"text-gray-600",children:g})]}),s==="loading"&&e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-blue-500 h-2 rounded-full animate-pulse w-2/3"})}),s!=="loading"&&e.jsx("p",{className:"text-sm text-gray-500",children:s==="success"?"Redirecionando para o sistema...":"Redirecionando para o login..."})]})})})};export{_ as AuthCallback}; diff --git a/dist/assets/js/Cadastros-QZZ_REjv.js b/dist/assets/js/Cadastros-QZZ_REjv.js new file mode 100644 index 0000000..2fa79c1 --- /dev/null +++ b/dist/assets/js/Cadastros-QZZ_REjv.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as d,L as y}from"./router-vendor-D4by-_6Z.js";import{T as A}from"./ThemeToggle-Cryh6OOS.js";import{P,B as u,U as T,W as R,S as $,d as U,A as l,m as r,E as x,e as g,f as L,g as m,h as b,M as z,i as F,j as I,k as O,l as G}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const p=[{id:"1",nome:"Edifício Residencial Aurora",endereco:"Rua das Flores, 123 - Centro",cliente:"Construtora ABC Ltda",responsavel:"João Silva",data_inicio:"2024-01-01",data_previsao:"2024-12-31",status:"em_andamento",progresso:45,orcamento:25e5},{id:"2",nome:"Centro Comercial Plaza",endereco:"Av. Principal, 456 - Bairro Novo",cliente:"Investimentos XYZ S.A.",responsavel:"Maria Santos",data_inicio:"2024-02-15",data_previsao:"2025-06-30",status:"em_andamento",progresso:25,orcamento:5e6}],j=[{id:"1",nome:"João Silva",email:"joao.silva@empresa.com",telefone:"(11) 99999-9999",funcao:"Engenheiro Civil",empresa:"Construtora ABC",status:"ativo",data_cadastro:"2024-01-01",ultimo_acesso:"2024-01-15"},{id:"2",nome:"Maria Santos",email:"maria.santos@empresa.com",telefone:"(11) 88888-8888",funcao:"Arquiteta",empresa:"Construtora ABC",status:"ativo",data_cadastro:"2024-01-05",ultimo_acesso:"2024-01-14"}],v=[{id:"1",nome:"Betoneira 400L",tipo:"Betoneira",modelo:"BT-400",fabricante:"Menegotti",ano_fabricacao:2022,numero_serie:"BT400-2022-001",status:"em_uso",obra_atual:"Edifício Residencial Aurora",proximo_manutencao:"2024-03-01"},{id:"2",nome:"Guindaste 20T",tipo:"Guindaste",modelo:"GR-20",fabricante:"Liebherr",ano_fabricacao:2021,numero_serie:"GR20-2021-005",status:"disponivel",proximo_manutencao:"2024-02-15"}],i={obras:{planejamento:{label:"Planejamento",color:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"},em_andamento:{label:"Em Andamento",color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},pausada:{label:"Pausada",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},concluida:{label:"Concluída",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"}},usuarios:{ativo:{label:"Ativo",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},inativo:{label:"Inativo",color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300"}},equipamentos:{disponivel:{label:"Disponível",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},em_uso:{label:"Em Uso",color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},manutencao:{label:"Manutenção",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},inativo:{label:"Inativo",color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300"}}};function Y(){const[s,k]=d.useState("obras"),[f,N]=d.useState(""),[h,w]=d.useState(!1),[t,n]=d.useState(null),_=[{id:"obras",label:"Obras",icon:u,count:p.length},{id:"usuarios",label:"Usuários",icon:T,count:j.length},{id:"equipamentos",label:"Equipamentos",icon:R,count:v.length}],C=a=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(a),o=a=>new Date(a).toLocaleDateString("pt-BR"),E=({obra:a})=>e.jsxs(r.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg mb-2",children:a.nome}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(I,{className:"w-4 h-4"}),a.endereco]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(O,{className:"w-4 h-4"}),a.cliente]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(G,{className:"w-4 h-4"}),o(a.data_inicio)," - ",o(a.data_previsao)]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>n(t===a.id?null:a.id),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Mais opções","aria-label":"Mais opções",children:e.jsx(x,{className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),e.jsx(l,{children:t===a.id&&e.jsx(r.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute right-0 top-full mt-2 w-48 bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:e.jsxs("div",{className:"p-2",children:[e.jsxs(y,{to:`/obra/${a.id}`,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(g,{className:"w-4 h-4"}),"Visualizar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(m,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),"Excluir"]})]})})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${i.obras[a.status].color}`,children:i.obras[a.status].label}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:C(a.orcamento)})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Progresso"}),e.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[a.progresso,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:e.jsx(r.div,{initial:{width:0},animate:{width:`${a.progresso}%`},transition:{duration:.5,ease:"easeOut"},className:"h-2 bg-blue-500 rounded-full"})})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:[e.jsx("strong",{children:"Responsável:"})," ",a.responsavel]})]}),S=({usuario:a})=>e.jsxs(r.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-semibold",children:a.nome.split(" ").map(c=>c[0]).join("").toUpperCase()}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg",children:a.nome}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.funcao})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>n(t===a.id?null:a.id),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Mais opções","aria-label":"Mais opções",children:e.jsx(x,{className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),e.jsx(l,{children:t===a.id&&e.jsx(r.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute right-0 top-full mt-2 w-48 bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(g,{className:"w-4 h-4"}),"Visualizar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(m,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),"Excluir"]})]})})})]})]}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(z,{className:"w-4 h-4"}),a.email]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(F,{className:"w-4 h-4"}),a.telefone]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300",children:[e.jsx(u,{className:"w-4 h-4"}),a.empresa]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${i.usuarios[a.status].color}`,children:i.usuarios[a.status].label}),e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Último acesso: ",o(a.ultimo_acesso)]})]}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Cadastrado em: ",o(a.data_cadastro)]})]}),M=({equipamento:a})=>e.jsxs(r.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg mb-2",children:a.nome}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[e.jsx("strong",{children:"Tipo:"})," ",a.tipo]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[e.jsx("strong",{children:"Modelo:"})," ",a.modelo]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[e.jsx("strong",{children:"Fabricante:"})," ",a.fabricante]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>n(t===a.id?null:a.id),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Mais opções","aria-label":"Mais opções",children:e.jsx(x,{className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),e.jsx(l,{children:t===a.id&&e.jsx(r.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute right-0 top-full mt-2 w-48 bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(g,{className:"w-4 h-4"}),"Visualizar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(L,{className:"w-4 h-4"}),"Manutenção"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(m,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),"Excluir"]})]})})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${i.equipamentos[a.status].color}`,children:i.equipamentos[a.status].label}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.ano_fabricacao})]}),a.obra_atual&&e.jsx("div",{className:"mb-3",children:e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[e.jsx("strong",{children:"Obra atual:"})," ",a.obra_atual]})}),e.jsxs("div",{className:"space-y-1 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Série:"})," ",a.numero_serie]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Próxima manutenção:"})," ",o(a.proximo_manutencao)]})]})]}),B=()=>{switch(s){case"obras":return e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(l,{children:p.map(a=>e.jsx(E,{obra:a},a.id))})});case"usuarios":return e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(l,{children:j.map(a=>e.jsx(S,{usuario:a},a.id))})});case"equipamentos":return e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(l,{children:v.map(a=>e.jsx(M,{equipamento:a},a.id))})});default:return null}};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsxs("div",{className:"px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Cadastros"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Gerencie obras, usuários e equipamentos"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(A,{}),e.jsxs(y,{to:`/cadastros/${s}/new`,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors shadow-lg",children:[e.jsx(P,{className:"w-5 h-5"}),"Novo ",s==="obras"?"Obra":s==="usuarios"?"Usuário":"Equipamento"]})]})]}),e.jsx("div",{className:"flex space-x-1 bg-gray-100 dark:bg-gray-700 p-1 rounded-xl mb-6 overflow-x-auto scrollbar-hide",children:_.map(a=>{const c=a.icon;return e.jsxs("button",{onClick:()=>k(a.id),className:`flex-1 min-w-[140px] flex items-center justify-center gap-2 px-4 py-3 rounded-lg font-medium transition-all duration-200 whitespace-nowrap ${s===a.id?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-400 shadow-sm":"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white"}`,children:[e.jsx(c,{className:"w-5 h-5 shrink-0"}),a.label,e.jsx("span",{className:`px-2 py-1 rounded-full text-xs shrink-0 ${s===a.id?"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"bg-gray-200 dark:bg-gray-600 text-gray-600 dark:text-gray-300"}`,children:a.count})]},a.id)})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"}),e.jsx("input",{type:"text",placeholder:`Buscar ${s}...`,value:f,onChange:a=>N(a.target.value),className:"w-full pl-10 pr-4 py-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all"})]}),e.jsxs("button",{onClick:()=>w(!h),className:`flex items-center gap-2 px-4 py-3 rounded-xl border transition-colors ${h?"bg-blue-100 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300":"bg-white/50 dark:bg-gray-700/50 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600"}`,children:[e.jsx(U,{className:"w-5 h-5"}),"Filtros"]})]})]})}),e.jsx("div",{className:"px-6 py-6",children:B()})]})}export{Y as default}; diff --git a/dist/assets/js/Configuracoes-LYuviA0-.js b/dist/assets/js/Configuracoes-LYuviA0-.js new file mode 100644 index 0000000..4d4d257 --- /dev/null +++ b/dist/assets/js/Configuracoes-LYuviA0-.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as o,L as ce}from"./router-vendor-D4by-_6Z.js";import{T as xe}from"./ThemeToggle-Cryh6OOS.js";import{u as me,a as ge,c as ue,b as he,d as be,e as pe,f as ye}from"./configStore-DS-p50om.js";import{W as T,S as L,P as w,A as S,m as N,y as I,h as D,X as A,w as E,q as U,z as O,D as re,G as te,I as se,T as M,Z as q,J as le,b as P,U as F,K as oe,N as de,O as G,x as B,f as _,Q as z,V as $,Y as ie,_ as ne,$ as R,R as fe,c as H,M as K,a0 as je,a1 as ve,a2 as Ne,o as ke,a3 as we,a4 as Ce,a5 as Se}from"./ui-vendor-CyRvbSfR.js";import{u as Ee}from"./useInviteCode-BxOSdQOT.js";import{useCurrentUser as Ie}from"./useUserStore-VOdYc7Zm.js";import"./react-vendor-CqRd3GwO.js";import"./index-doec96Hx.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";function De({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState({}),g=t=>{t.preventDefault();const x={};if(r.trim()||(x.nome="Nome é obrigatório"),Object.keys(x).length>0){u(x);return}j({nome:r.trim(),descricao:f.trim()||void 0}),m(),y(""),n(""),u({})},h=()=>{m(),y(""),n(""),u({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Novo"," Tipo de Atividade"]}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:g,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:t=>y(t.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${d.nome?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Escavação, Fundação, Concretagem..."}),d.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),d.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:t=>n(t.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional da atividade..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:h,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function Te(){const{items:s,add:m,update:c,delete:j}=me(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir este tipo de atividade?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(T,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Tipos de Atividades"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure os tipos de atividades disponíveis para seleção nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar tipos de atividades...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Atividade"]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Nome"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id))})})]})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(T,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhuma atividade cadastrada"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando um novo tipo de atividade"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Atividade"]})]})]})]}),e.jsx(De,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const Oe=[{value:"sun",label:"Sol",icon:se},{value:"cloud",label:"Nuvem",icon:O},{value:"rain",label:"Chuva",icon:te},{value:"snow",label:"Neve",icon:re}];function Me({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState(c?.icone||"cloud"),[g,h]=o.useState({}),t=i=>{i.preventDefault();const a={};if(r.trim()||(a.nome="Nome é obrigatório"),Object.keys(a).length>0){h(a);return}j({nome:r.trim(),descricao:f.trim()||void 0,icone:d}),m(),y(""),n(""),u("cloud"),h({})},x=()=>{m(),y(""),n(""),u("cloud"),h({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Nova"," Condição Climática"]}),e.jsx("button",{onClick:x,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:t,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:i=>y(i.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${g.nome?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Ensolarado, Nublado, Chuva..."}),g.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),g.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Ícone"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Oe.map(i=>{const a=i.icon;return e.jsxs("button",{type:"button",onClick:()=>u(i.value),className:`p-3 rounded-xl border-2 transition-colors flex flex-col items-center gap-1 ${d===i.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(a,{className:`w-5 h-5 ${d===i.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`}),e.jsx("span",{className:`text-xs ${d===i.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`,children:i.label})]},i.value)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:i=>n(i.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional da condição climática..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:x,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function X(s){return{sun:se,cloud:O,rain:te,snow:re}[s]||O}function $e(){const{items:s,add:m,update:c,delete:j}=ge(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir esta condição climática?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(O,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Condições Climáticas"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure as condições climáticas disponíveis para seleção nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar condições climáticas...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Condição"]})]}),e.jsx("div",{className:"hidden md:block bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Condição"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>{const l=X(a.icone||"cloud");return e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id)})})})]})})}),e.jsxs("div",{className:"block md:hidden space-y-4",children:[e.jsx(S,{children:g.map(a=>{const l=X(a.icone||"cloud");return e.jsxs(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(l,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:"text-base font-medium text-gray-900 dark:text-white",children:a.nome})})]}),a.descricao&&e.jsx("div",{className:"mb-4",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:a.descricao})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>t(a),className:"flex items-center gap-2 px-3 py-2 text-sm text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{onClick:()=>x(a.id),className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),"Excluir"]})]})]},a.id)})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhuma condição cadastrada"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando uma nova condição climática"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Condição"]})]})]})]}),e.jsx(Me,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const Le=[{value:"baixa",label:"Baixa",color:"text-green-600",bgColor:"bg-green-100"},{value:"media",label:"Média",color:"text-yellow-600",bgColor:"bg-yellow-100"},{value:"alta",label:"Alta",color:"text-orange-600",bgColor:"bg-orange-100"},{value:"critica",label:"Crítica",color:"text-red-600",bgColor:"bg-red-100"}],Ae=[{value:"alert-triangle",label:"Alerta",icon:M},{value:"clock",label:"Tempo",icon:P},{value:"shield",label:"Segurança",icon:le},{value:"zap",label:"Urgente",icon:q}];function Ue({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState(c?.severidade||"media"),[g,h]=o.useState(c?.cor||"alert-triangle"),[t,x]=o.useState({}),i=l=>{l.preventDefault();const v={};if(r.trim()||(v.nome="Nome é obrigatório"),Object.keys(v).length>0){x(v);return}j({nome:r.trim(),descricao:f.trim()||void 0,severidade:d,cor:g}),m(),y(""),n(""),u("media"),h("alert-triangle"),x({})},a=()=>{m(),y(""),n(""),u("media"),h("alert-triangle"),x({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Novo"," Tipo de Ocorrência"]}),e.jsx("button",{onClick:a,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:i,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:l=>y(l.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${t.nome?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Acidente, Atraso, Problema técnico..."}),t.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),t.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Severidade"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Le.map(l=>e.jsxs("button",{type:"button",onClick:()=>u(l.value),className:`p-3 rounded-xl border-2 transition-colors flex items-center justify-center gap-2 ${d===l.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${l.bgColor}`}),e.jsx("span",{className:`text-sm font-medium ${d===l.value?"text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300"}`,children:l.label})]},l.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Ícone"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Ae.map(l=>{const v=l.icon;return e.jsxs("button",{type:"button",onClick:()=>h(l.value),className:`p-3 rounded-xl border-2 transition-colors flex flex-col items-center gap-1 ${g===l.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(v,{className:`w-5 h-5 ${g===l.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`}),e.jsx("span",{className:`text-xs ${g===l.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`,children:l.label})]},l.value)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:l=>n(l.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional do tipo de ocorrência..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:a,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function Z(s){return{"alert-triangle":M,clock:P,shield:le,zap:q}[s]||M}function J(s){const m={baixa:{label:"Baixa",color:"text-green-700",bgColor:"bg-green-100"},media:{label:"Média",color:"text-yellow-700",bgColor:"bg-yellow-100"},alta:{label:"Alta",color:"text-orange-700",bgColor:"bg-orange-100"},critica:{label:"Crítica",color:"text-red-700",bgColor:"bg-red-100"}};return m[s]||m.media}function qe(){const{items:s,add:m,update:c,delete:j}=ue(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir este tipo de ocorrência?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(M,{className:"w-6 h-6 text-orange-600 dark:text-orange-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Tipos de Ocorrências"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure os tipos de ocorrências e incidentes disponíveis para registro nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar tipos de ocorrências...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Ocorrência"]})]}),e.jsx("div",{className:"hidden md:block bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ocorrência"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Severidade"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>{const l=Z(a.cor||"alert-triangle"),v=J(a.severidade||"media");return e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${v.bgColor} ${v.color}`,children:v.label})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id)})})})]})})}),e.jsxs("div",{className:"block md:hidden space-y-4",children:[e.jsx(S,{children:g.map(a=>{const l=Z(a.cor||"alert-triangle"),v=J(a.severidade||"media");return e.jsxs(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(l,{className:"w-6 h-6 text-orange-600 dark:text-orange-400"}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:"text-base font-medium text-gray-900 dark:text-white",children:a.nome})}),e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${v.bgColor} ${v.color}`,children:v.label})]}),a.descricao&&e.jsx("div",{className:"mb-4",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:a.descricao})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>t(a),className:"flex items-center gap-2 px-3 py-2 text-sm text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(I,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{onClick:()=>x(a.id),className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),"Excluir"]})]})]},a.id)})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(M,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhuma ocorrência cadastrada"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando um novo tipo de ocorrência"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Ocorrência"]})]})]})]}),e.jsx(Ue,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const Be=[{value:"operacional",label:"Operacional",icon:G},{value:"tecnico",label:"Técnico",icon:T},{value:"administrativo",label:"Administrativo",icon:de},{value:"gerencial",label:"Gerencial",icon:oe}];function ze({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState(c?.categoria||"operacional"),[g,h]=o.useState(c?.salarioBase?.toString()||""),[t,x]=o.useState({}),i=l=>{l.preventDefault();const v={};if(r.trim()||(v.nome="Nome é obrigatório"),g&&(isNaN(Number(g))||Number(g)<0)&&(v.salarioBase="Salário deve ser um número válido"),Object.keys(v).length>0){x(v);return}j({nome:r.trim(),descricao:f.trim()||void 0,categoria:d,salarioBase:g?Number(g):void 0}),m(),y(""),n(""),u("operacional"),h(""),x({})},a=()=>{m(),y(""),n(""),u("operacional"),h(""),x({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Nova"," Função/Cargo"]}),e.jsx("button",{onClick:a,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:i,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:l=>y(l.target.value),className:`w-full px-4 py-3 rounded-xl border ${t.nome?"border-red-300 dark:border-red-600 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Pedreiro, Servente, Encarregado..."}),t.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),t.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Categoria"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Be.map(l=>{const v=l.icon;return e.jsxs("button",{type:"button",onClick:()=>u(l.value),className:`p-3 rounded-xl border-2 transition-colors flex items-center gap-2 ${d===l.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(v,{className:`w-4 h-4 ${d===l.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`}),e.jsx("span",{className:`text-sm font-medium ${d===l.value?"text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300"}`,children:l.label})]},l.value)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Salário Base (R$)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:g,onChange:l=>h(l.target.value),className:`w-full px-4 py-3 rounded-xl border ${t.salarioBase?"border-red-300 dark:border-red-600 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: 1500.00"}),t.salarioBase&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),t.salarioBase]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:l=>n(l.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional da função/cargo..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:a,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function Re(s){return{operacional:G,tecnico:T,administrativo:de,gerencial:oe}[s]||G}function Q(s){return{operacional:"Operacional",tecnico:"Técnico",administrativo:"Administrativo",gerencial:"Gerencial"}[s]||"Operacional"}function Fe(s){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(s)}function _e(){const{items:s,add:m,update:c,delete:j}=he(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())||Q(a.categoria||"").toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir esta função/cargo?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(F,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Funções/Cargos"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure as funções e cargos disponíveis para a equipe nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar funções/cargos...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Função"]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Função/Cargo"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Categoria"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Salário Base"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>{const l=Re(a.categoria||"operacional");return e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/20 dark:text-purple-300",children:Q(a.categoria||"operacional")})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm text-gray-900 dark:text-white font-medium",children:a.salarioBase?Fe(a.salarioBase):"-"})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id)})})})]})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(F,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhuma função cadastrada"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando uma nova função/cargo"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Nova Função"]})]})]})]}),e.jsx(ze,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const He=[{value:"pesado",label:"Pesado",icon:B},{value:"ferramenta",label:"Ferramenta",icon:z},{value:"eletrico",label:"Elétrico",icon:q},{value:"mecanico",label:"Mecânico",icon:T},{value:"outros",label:"Outros",icon:_}];function Ge({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState(c?.categoria||"ferramenta"),[g,h]=o.useState(c?.capacidade||""),[t,x]=o.useState(c?.valorHora?.toString()||""),[i,a]=o.useState({}),l=b=>{b.preventDefault();const k={};if(r.trim()||(k.nome="Nome é obrigatório"),t&&(isNaN(Number(t))||Number(t)<0)&&(k.valorHora="Valor deve ser um número válido"),Object.keys(k).length>0){a(k);return}j({nome:r.trim(),descricao:f.trim()||void 0,categoria:d,capacidade:g.trim()||void 0,valorHora:t?Number(t):void 0}),m(),y(""),n(""),u("ferramenta"),h(""),x(""),a({})},v=()=>{m(),y(""),n(""),u("ferramenta"),h(""),x(""),a({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Novo"," Equipamento"]}),e.jsx("button",{onClick:v,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:l,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:b=>y(b.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${i.nome?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Betoneira 400L, Guindaste 20T..."}),i.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),i.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Categoria"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:He.map(b=>{const k=b.icon;return e.jsxs("button",{type:"button",onClick:()=>u(b.value),className:`p-3 rounded-xl border-2 transition-colors flex items-center gap-2 ${d===b.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(k,{className:`w-4 h-4 ${d===b.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`}),e.jsx("span",{className:`text-sm font-medium ${d===b.value?"text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300"}`,children:b.label})]},b.value)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Capacidade/Especificação"}),e.jsx("input",{type:"text",value:g,onChange:b=>h(b.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none",placeholder:"Ex: 400L, 20T, 220V, 1500W..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Valor por Hora (R$)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:t,onChange:b=>x(b.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${i.valorHora?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: 25.00"}),i.valorHora&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),i.valorHora]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:b=>n(b.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional do equipamento..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:v,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function Pe(s){return{pesado:B,ferramenta:z,eletrico:q,mecanico:T,outros:_}[s]||z}function Y(s){return{pesado:"Pesado",ferramenta:"Ferramenta",eletrico:"Elétrico",mecanico:"Mecânico",outros:"Outros"}[s]||"Ferramenta"}function Ve(s){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(s)}function We(){const{items:s,add:m,update:c,delete:j}=be(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())||Y(a.categoria||"").toLowerCase().includes(r.toLowerCase())||a.capacidade&&a.capacidade.toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir este equipamento?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(B,{className:"w-6 h-6 text-orange-600 dark:text-orange-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Tipos de Equipamentos"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure os equipamentos disponíveis para uso nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar equipamentos...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Novo Equipamento"]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Equipamento"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Categoria"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Capacidade"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Valor/Hora"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>{const l=Pe(a.categoria||"ferramenta");return e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800 dark:bg-orange-900/20 dark:text-orange-300",children:Y(a.categoria||"ferramenta")})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:a.capacidade||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm text-gray-900 dark:text-white font-medium",children:a.valorHora?Ve(a.valorHora):"-"})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id)})})})]})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(B,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhum equipamento cadastrado"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando um novo equipamento"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Novo Equipamento"]})]})]})]}),e.jsx(Ge,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const Ke=[{value:"agregados",label:"Agregados",icon:ne},{value:"cimento",label:"Cimento",icon:$},{value:"liquidos",label:"Líquidos",icon:ie},{value:"eletricos",label:"Elétricos",icon:q},{value:"ferragens",label:"Ferragens",icon:z}],Xe=["kg","m³","m²","m","L","un","cx","sc","t","pç"];function Ze({isOpen:s,onClose:m,item:c,onSave:j}){const[r,y]=o.useState(c?.nome||""),[f,n]=o.useState(c?.descricao||""),[d,u]=o.useState(c?.categoria||"agregados"),[g,h]=o.useState(c?.unidade||"kg"),[t,x]=o.useState(c?.valorUnitario?.toString()||""),[i,a]=o.useState({}),l=b=>{b.preventDefault();const k={};if(r.trim()||(k.nome="Nome é obrigatório"),t&&(isNaN(Number(t))||Number(t)<0)&&(k.valorUnitario="Valor deve ser um número válido"),Object.keys(k).length>0){a(k);return}j({nome:r.trim(),descricao:f.trim()||void 0,categoria:d,unidade:g,valorUnitario:t?Number(t):void 0}),m(),y(""),n(""),u("agregados"),h("kg"),x(""),a({})},v=()=>{m(),y(""),n(""),u("agregados"),h("kg"),x(""),a({})};return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[c?"Editar":"Novo"," Material"]}),e.jsx("button",{onClick:v,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(A,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("form",{onSubmit:l,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome *"}),e.jsx("input",{type:"text",value:r,onChange:b=>y(b.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${i.nome?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"Ex: Cimento Portland, Areia Média, Brita 1..."}),i.nome&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),i.nome]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Categoria"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ke.map(b=>{const k=b.icon;return e.jsxs("button",{type:"button",onClick:()=>u(b.value),className:`p-3 rounded-xl border-2 transition-colors flex items-center gap-2 ${d===b.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(k,{className:`w-4 h-4 ${d===b.value?"text-blue-600 dark:text-blue-400":"text-gray-500"}`}),e.jsx("span",{className:`text-sm font-medium ${d===b.value?"text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300"}`,children:b.label})]},b.value)})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Unidade"}),e.jsx("select",{value:g,onChange:b=>h(b.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-4 focus:outline-none",children:Xe.map(b=>e.jsx("option",{value:b,children:b},b))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Valor Unitário (R$)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:t,onChange:b=>x(b.target.value),className:`w-full px-4 py-3 rounded-xl border transition-colors ${i.valorUnitario?"border-red-300 focus:border-red-500 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20"} bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`,placeholder:"0.00"}),i.valorUnitario&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(E,{className:"w-4 h-4"}),i.valorUnitario]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{value:f,onChange:b=>n(b.target.value),rows:3,className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none resize-none",placeholder:"Descrição opcional do material..."})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:v,className:"flex-1 px-4 py-3 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-xl font-medium transition-colors",children:"Cancelar"}),e.jsxs("button",{type:"submit",className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center justify-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Salvar"]})]})]})]})}):null}function Je(s){return{agregados:ne,cimento:$,liquidos:ie,eletricos:q,ferragens:z}[s]||$}function ee(s){return{agregados:"Agregados",cimento:"Cimento",liquidos:"Líquidos",eletricos:"Elétricos",ferragens:"Ferragens"}[s]||"Agregados"}function Qe(s){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(s)}function Ye(){const{items:s,add:m,update:c,delete:j}=pe(),[r,y]=o.useState(""),[f,n]=o.useState(!1),[d,u]=o.useState(null),g=s.filter(a=>a.nome.toLowerCase().includes(r.toLowerCase())||ee(a.categoria||"").toLowerCase().includes(r.toLowerCase())||a.unidade&&a.unidade.toLowerCase().includes(r.toLowerCase())),h=()=>{u(null),n(!0)},t=a=>{u(a),n(!0)},x=a=>{confirm("Tem certeza que deseja excluir este material?")&&j(a)},i=a=>{d?c(d.id,a):m(a)};return e.jsxs("div",{className:"p-6 h-full",children:[e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx($,{className:"w-6 h-6 text-green-600 dark:text-green-400"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Materiais"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Configure os materiais disponíveis para uso nos RDOs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(L,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar materiais...",value:r,onChange:a=>y(a.target.value),className:"w-full pl-12 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-4 focus:ring-blue-500/20 focus:border-blue-500 focus:outline-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors flex items-center gap-2 whitespace-nowrap",children:[e.jsx(w,{className:"w-5 h-5"}),"Novo Material"]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Material"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Categoria"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Unidade"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Valor Unitário"}),e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Descrição"}),e.jsx("th",{className:"px-6 py-4 text-right text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.jsx(S,{children:g.map(a=>{const l=Je(a.categoria||"agregados");return e.jsxs(N.tr,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.nome})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-300",children:ee(a.categoria||"agregados")})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm text-gray-900 dark:text-white font-medium",children:a.unidade||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm text-gray-900 dark:text-white font-medium",children:a.valorUnitario?Qe(a.valorUnitario):"-"})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a.descricao||"-"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(a),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:"Editar",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(a.id),className:"p-2 text-gray-400 dark:text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:"Excluir",children:e.jsx(D,{className:"w-4 h-4"})})]})})]},a.id)})})})]})}),g.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx($,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:r?"Nenhum resultado encontrado":"Nenhum material cadastrado"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:r?"Tente ajustar os termos da busca":"Comece adicionando um novo material"}),!r&&e.jsxs("button",{onClick:h,className:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors inline-flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Novo Material"]})]})]})]}),e.jsx(Ze,{isOpen:f,onClose:()=>n(!1),item:d,onSave:i})]})}const ea=()=>{const s=Ie(),{loading:m,gerarConvite:c,listarConvites:j}=Ee(),[r,y]=o.useState([]),[f,n]=o.useState(!1),[d,u]=o.useState(null),[g,h]=o.useState(""),[t,x]=o.useState({emailConvidado:"",role:"usuario",maxUsos:1,expiraEmDias:7}),i=o.useCallback(async()=>{if(!s?.organizacao_id)return;const p=await j(s.organizacao_id);y(p)},[s?.organizacao_id,j]);o.useEffect(()=>{i()},[i]);const a=async()=>{if(!s?.organizacao_id)return;const p=await c(s.organizacao_id,{emailConvidado:t.emailConvidado||void 0,role:t.role,maxUsos:t.maxUsos,expiraEmDias:t.expiraEmDias});p.success&&(h(`Código gerado: ${p.codigo}`),n(!1),x({emailConvidado:"",role:"usuario",maxUsos:1,expiraEmDias:7}),i(),setTimeout(()=>h(""),5e3))},l=p=>{navigator.clipboard.writeText(p),u(p),setTimeout(()=>u(null),2e3)},v=p=>({admin:"Administrador",engenheiro:"Engenheiro",mestre_obra:"Mestre de Obra",usuario:"Usuário"})[p]||p,b=p=>new Date(p).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),k=p=>p?new Date(p)n(!f),className:"flex items-center gap-2 bg-blue-600 text-white px-4 py-2 rounded-xl hover:bg-blue-700 transition-colors shadow-lg",children:[e.jsx(w,{className:"w-5 h-5"}),"Novo Convite"]})]})]}),g&&e.jsxs("div",{className:"flex items-center gap-2 p-4 bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800 rounded-xl",children:[e.jsx(H,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-green-800 dark:text-green-200 font-medium",children:g})]}),f&&e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50 p-6 shadow-lg",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Gerar Novo Código de Convite"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e.jsx(K,{className:"w-4 h-4 inline mr-1"}),"Email do Convidado (opcional)"]}),e.jsx("input",{type:"email",value:t.emailConvidado,onChange:p=>x(C=>({...C,emailConvidado:p.target.value})),placeholder:"Deixe vazio para qualquer email",className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e.jsx(F,{className:"w-4 h-4 inline mr-1"}),"Cargo"]}),e.jsxs("select",{value:t.role,onChange:p=>x(C=>({...C,role:p.target.value})),title:"Cargo do convidado",className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"usuario",children:"Usuário"}),e.jsx("option",{value:"engenheiro",children:"Engenheiro"}),e.jsx("option",{value:"mestre_obra",children:"Mestre de Obra"}),e.jsx("option",{value:"admin",children:"Administrador"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Máximo de Usos"}),e.jsx("input",{type:"number",value:t.maxUsos,onChange:p=>x(C=>({...C,maxUsos:parseInt(p.target.value)||1})),min:1,max:100,title:"Máximo de usos",placeholder:"1",className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e.jsx(P,{className:"w-4 h-4 inline mr-1"}),"Expira em (dias)"]}),e.jsx("input",{type:"number",value:t.expiraEmDias,onChange:p=>x(C=>({...C,expiraEmDias:parseInt(p.target.value)||7})),min:1,max:365,title:"Dias para expiração",placeholder:"7",className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white transition-colors",children:"Cancelar"}),e.jsxs("button",{onClick:a,disabled:m,className:"flex items-center gap-2 bg-gradient-to-r from-blue-500 to-purple-600 text-white px-6 py-2 rounded-xl hover:from-blue-600 hover:to-purple-700 transition-all shadow-lg font-semibold disabled:opacity-50",children:[m?e.jsx(je,{className:"w-5 h-5 animate-spin"}):e.jsx(R,{className:"w-5 h-5"}),"Gerar Código"]})]})]}),e.jsx("div",{className:"space-y-3",children:r.length===0?e.jsxs("div",{className:"text-center py-12 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsx(R,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-lg",children:"Nenhum convite gerado ainda."}),e.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm mt-1",children:'Clique em "Novo Convite" para gerar um código.'})]}):r.map(p=>{const C=k(p.expira_em),V=p.max_usos>0&&p.usos_atuais>=p.max_usos,W=!p.ativo||C||V;return e.jsxs("div",{className:`p-4 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border transition-all duration-200 ${W?"border-gray-300/50 dark:border-gray-700/50 opacity-60":"border-blue-200/50 dark:border-blue-700/50 hover:shadow-lg"}`,children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("code",{className:"text-xl font-mono font-bold text-gray-900 dark:text-white tracking-wider bg-gray-100 dark:bg-gray-700 px-4 py-2 rounded-xl",children:p.codigo}),e.jsx("button",{onClick:()=>l(p.codigo),className:"p-2 text-gray-500 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:"Copiar código",children:d===p.codigo?e.jsx(H,{className:"w-5 h-5 text-green-500"}):e.jsx(ve,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex items-center gap-2",children:W?e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 rounded-full text-sm font-medium",children:[e.jsx(Ne,{className:"w-4 h-4"}),C?"Expirado":V?"Esgotado":"Inativo"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 rounded-full text-sm font-medium",children:[e.jsx(H,{className:"w-4 h-4"}),"Ativo"]})})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Cargo:"})," ",v(p.role)]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Usos:"})," ",p.usos_atuais,"/",p.max_usos===0?"∞":p.max_usos]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Criado:"})," ",b(p.created_at)]}),p.expira_em&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Expira:"})," ",b(p.expira_em)]})]}),p.email_convidado&&e.jsxs("div",{className:"mt-2 text-sm text-blue-600 dark:text-blue-400",children:[e.jsx(K,{className:"w-4 h-4 inline mr-1"}),"Restrito a: ",p.email_convidado]})]},p.id)})})]})},ae=[{id:"atividades",label:"Tipos de Atividades",icon:T,description:"Configure os tipos de atividades disponíveis para os RDOs",component:Te},{id:"clima",label:"Condições Climáticas",icon:O,description:"Gerencie as opções de condições climáticas",component:$e},{id:"ocorrencias",label:"Tipos de Ocorrências",icon:M,description:"Configure os tipos de ocorrências e incidentes",component:qe},{id:"funcoes",label:"Funções/Cargos",icon:F,description:"Gerencie as funções e cargos da equipe",component:_e},{id:"equipamentos",label:"Tipos de Equipamentos",icon:B,description:"Configure os tipos de equipamentos disponíveis",component:We},{id:"materiais",label:"Materiais",icon:$,description:"Gerencie os tipos de materiais utilizados",component:Ye},{id:"convites",label:"Convites",icon:R,description:"Gerencie convites para novos membros da organização",component:ea}];function ma(){const[s,m]=o.useState("atividades"),[c,j]=o.useState(!1),{exportConfig:r,importConfig:y,resetToDefaults:f}=ye(),n=()=>{const t=r(),x=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(x),a=document.createElement("a");a.href=i,a.download=`rdo-configuracoes-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},d=t=>{const x=t.target.files?.[0];if(x){const i=new FileReader;i.onload=a=>{const l=a.target?.result;y(l),alert("Configurações importadas com sucesso!")},i.readAsText(x)}},u=()=>{confirm("Tem certeza que deseja restaurar todas as configurações para os valores padrão? Esta ação não pode ser desfeita.")&&(f(),alert("Configurações restauradas para os valores padrão!"))},h=ae.find(t=>t.id===s)?.component;return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 w-full overflow-x-hidden",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 w-full",children:e.jsx("div",{className:"px-3 sm:px-4 lg:px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 lg:gap-4 min-w-0 flex-1",children:[e.jsx(ce,{to:"/",className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors flex-shrink-0",children:e.jsx(ke,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex-shrink-0",children:e.jsx(_,{className:"w-5 h-5 sm:w-6 sm:h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold text-gray-900 dark:text-white truncate",children:"Configurações"}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300 hidden sm:block",children:"Gerencie as listas de seleção do sistema"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>j(!c),className:"flex items-center gap-1 sm:gap-2 px-3 sm:px-4 py-2.5 sm:py-2 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl border border-gray-200/50 dark:border-gray-700/50 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-sm font-medium text-gray-700 dark:text-gray-300 min-h-[44px] sm:min-h-0",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Gerenciar"})]}),e.jsx(S,{children:c&&e.jsxs(N.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute right-0 top-full mt-2 w-56 sm:w-48 bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 py-2 z-50",children:[e.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-3 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors min-h-[44px]",children:[e.jsx(we,{className:"w-4 h-4"}),"Exportar Configurações"]}),e.jsxs("label",{className:"w-full flex items-center gap-3 px-4 py-3 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer min-h-[44px]",children:[e.jsx(Ce,{className:"w-4 h-4"}),"Importar Configurações",e.jsx("input",{type:"file",accept:".json",onChange:d,className:"hidden"})]}),e.jsx("hr",{className:"my-2 border-gray-200 dark:border-gray-700"}),e.jsxs("button",{onClick:u,className:"w-full flex items-center gap-3 px-4 py-3 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors min-h-[44px]",children:[e.jsx(Se,{className:"w-4 h-4"}),"Restaurar Padrões"]})]})})]}),e.jsx(xe,{})]})]})})}),e.jsx("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsx("div",{className:"p-3 sm:p-4 lg:p-6",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2 sm:gap-3 lg:gap-4",children:ae.map(t=>{const x=t.icon;return e.jsxs("button",{onClick:()=>m(t.id),className:`flex flex-col items-center justify-center gap-1.5 sm:gap-2 p-3 sm:p-4 rounded-xl transition-all duration-200 min-h-[72px] sm:min-h-[80px] lg:min-h-[88px] touch-manipulation ${s===t.id?"bg-blue-600 text-white shadow-lg scale-105":"bg-white/50 dark:bg-gray-700/50 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:scale-102"}`,children:[e.jsx(x,{className:`w-5 h-5 sm:w-6 sm:h-6 flex-shrink-0 ${s===t.id?"text-white":"text-gray-500 dark:text-gray-400"}`}),e.jsx("span",{className:`font-medium text-xs sm:text-sm text-center leading-tight ${s===t.id?"text-white":"text-gray-900 dark:text-white"}`,children:t.label.replace("Tipos de ","").replace("Condições ","")})]},t.id)})})})}),e.jsx("div",{className:"flex-1 overflow-auto h-[calc(100vh-200px)]",children:e.jsx(S,{mode:"wait",children:e.jsx(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"h-full",children:h&&e.jsx(h,{})},s)})})]})}export{ma as default}; diff --git a/dist/assets/js/CreateObra-BwwQt_hK.js b/dist/assets/js/CreateObra-BwwQt_hK.js new file mode 100644 index 0000000..0069ebe --- /dev/null +++ b/dist/assets/js/CreateObra-BwwQt_hK.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{u as p,o as u,s}from"./form-vendor-vQotxSmE.js";import{a as y}from"./zod-7IfHMaWP.js";import{o as h,m as i,B as f,j,l as k,k as v,a0 as N,q as w,t as l}from"./ui-vendor-CyRvbSfR.js";import{T as _}from"./ThemeToggle-Cryh6OOS.js";import{u as S,s as z}from"./index-doec96Hx.js";import{useCurrentUser as E}from"./useUserStore-VOdYc7Zm.js";import{d as O,L as m}from"./router-vendor-D4by-_6Z.js";import"./react-vendor-CqRd3GwO.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const C=u({nome:s().min(3,"Nome deve ter pelo menos 3 caracteres"),descricao:s().optional(),endereco:s().optional(),cidade:s().optional(),estado:s().optional(),data_inicio:s().optional(),data_prevista_fim:s().optional(),responsavel_id:s().optional()});function V(){const g=O(),{user:T}=S(),d=E(),{register:r,handleSubmit:b,formState:{errors:n,isSubmitting:c}}=p({resolver:y(C),defaultValues:{data_inicio:new Date().toISOString().split("T")[0]}}),x=async a=>{try{if(!d?.organizacao_id){l.error("Erro: Organização não identificada. Tente fazer login novamente.");return}const t={nome:a.nome,descricao:a.descricao,endereco:a.endereco,cidade:a.cidade,estado:a.estado,data_inicio:a.data_inicio||null,data_prevista_fim:a.data_prevista_fim||null,status:"ativa",progresso_geral:0,configuracoes:{},responsavel_id:a.responsavel_id||d.id,organizacao_id:d.organizacao_id},{error:o}=await z.from("obras").insert(t);if(o)throw o;l.success("Obra criada com sucesso!"),g("/cadastros")}catch(t){const o=t instanceof Error?t.message:"Erro desconhecido";l.error(`Erro ao criar obra: ${o}`)}};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 sticky top-0 z-10",children:e.jsxs("div",{className:"px-4 sm:px-6 py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(m,{to:"/cadastros",className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl",children:e.jsx(h,{className:"w-5 h-5 text-gray-600 dark:text-gray-300"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Nova Obra"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Cadastre um novo empreendimento"})]})]}),e.jsx(_,{})]})}),e.jsx("div",{className:"max-w-4xl mx-auto p-4 sm:p-8",children:e.jsxs("form",{onSubmit:b(x),className:"space-y-6",children:[e.jsxs(i.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-4 border-b border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(f,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"Dados Principais"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Nome da Obra *"}),e.jsx("input",{type:"text",...r("nome"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all",placeholder:"Ex: Edifício Residencial Aurora"}),n.nome&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:n.nome.message})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{...r("descricao"),rows:3,className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all",placeholder:"Breve descrição do projeto..."})]})]})]}),e.jsxs(i.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-4 border-b border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(j,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"Localização"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Endereço"}),e.jsx("input",{type:"text",...r("endereco"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all",placeholder:"Rua, número, bairro..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Cidade"}),e.jsx("input",{type:"text",...r("cidade"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Estado"}),e.jsx("input",{type:"text",...r("estado"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all",placeholder:"UF",maxLength:2})]})]})]}),e.jsxs(i.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-4 border-b border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(k,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"Prazos e Responsáveis"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Data de Início"}),e.jsx("input",{type:"date",...r("data_inicio"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Previsão de Término"}),e.jsx("input",{type:"date",...r("data_prevista_fim"),className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"ID do Responsável (Opcional)"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{type:"text",...r("responsavel_id"),className:"w-full pl-10 p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 transition-all",placeholder:"UUID do usuário responsável"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Se vazio, será atribuído ao seu usuário."})]})]})]}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx(m,{to:"/cadastros",className:"flex-1 py-3 px-4 rounded-xl border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center gap-2 font-medium transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",disabled:c,className:"flex-1 py-3 px-4 rounded-xl bg-blue-600 text-white hover:bg-blue-700 flex items-center justify-center gap-2 font-medium shadow-lg shadow-blue-500/30 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:c?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-5 h-5 animate-spin"}),"Salvando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"w-5 h-5"}),"Salvar Obra"]})})]})]})})]})}export{V as default}; diff --git a/dist/assets/js/CreateRDO-Bhe5_7xI.js b/dist/assets/js/CreateRDO-Bhe5_7xI.js new file mode 100644 index 0000000..3f59b45 --- /dev/null +++ b/dist/assets/js/CreateRDO-Bhe5_7xI.js @@ -0,0 +1 @@ +var Y=Object.defineProperty;var K=(p,t,a)=>t in p?Y(p,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):p[t]=a;var T=(p,t,a)=>K(p,typeof t!="symbol"?t+"":t,a);import{j as e}from"./query-vendor-BLVqILA6.js";import{r as h,c as X,d as Z,L as ee}from"./router-vendor-D4by-_6Z.js";import{u as te,o as ae,s as B}from"./form-vendor-vQotxSmE.js";import{a as re}from"./zod-7IfHMaWP.js";import{t as A,n as G,X as se,j as oe,R as ie,o as ne,F as de,A as q,m as I,W as le,h as P,P as V,p as ce,U as ue,q as ge,r as me,s as he,u as pe}from"./ui-vendor-CyRvbSfR.js";import{T as xe}from"./ThemeToggle-Cryh6OOS.js";import{u as be,a as ye,b as fe}from"./configStore-DS-p50om.js";import{s as w}from"./index-doec96Hx.js";import{D as we}from"./state-vendor-DHadhBU5.js";import"./react-vendor-CqRd3GwO.js";import"./supabase-vendor-CnnNSQLo.js";const ve=({onCapture:p,onClose:t})=>{const a=h.useRef(null),s=h.useRef(null),[r,n]=h.useState(null),[u,f]=h.useState(null),[l,c]=h.useState(!0),[O,R]=h.useState("environment"),D=h.useCallback(async()=>{try{r&&r.getTracks().forEach(g=>g.stop()),c(!0);const d=await navigator.mediaDevices.getUserMedia({video:{facingMode:O}});n(d),a.current&&(a.current.srcObject=d),c(!1)}catch{A.error("Não foi possível acessar a câmera. Verifique as permissões."),c(!1)}},[O]);h.useEffect(()=>(D(),"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(d=>{f({lat:d.coords.latitude,lng:d.coords.longitude})},d=>{A.warning("Localização não permitida. A foto ficará sem coordenadas.")}),()=>{r&&r.getTracks().forEach(d=>d.stop())}),[D]);const k=()=>{R(d=>d==="user"?"environment":"user")},N=()=>{if(!a.current||!s.current)return;const d=a.current,g=s.current,m=g.getContext("2d");if(!m)return;g.width=d.videoWidth,g.height=d.videoHeight,m.drawImage(d,0,0,g.width,g.height);const b=20,v=Math.max(16,g.width/25),C=v*1.5*3+b*2;m.fillStyle="rgba(0, 0, 0, 0.6)",m.fillRect(0,g.height-C,g.width,C),m.fillStyle="#ffffff",m.font=`${v}px sans-serif`,m.textBaseline="bottom";const $=new Date().toLocaleString("pt-BR");if(m.fillText($,b,g.height-C+b+v),u){const _=`Lat: ${u.lat.toFixed(5)} | Lng: ${u.lng.toFixed(5)}`;m.fillText(_,b,g.height-C+b+(v+10)*2)}else m.fillText("Localização não disponível",b,g.height-C+b+(v+10)*2);m.font=`bold ${v*.8}px sans-serif`,m.fillStyle="#dddddd",m.fillText("RDO App - Registro Fotográfico",b,g.height-b),g.toBlob(_=>{if(_){const U=new File([_],`foto_rdo_${Date.now()}.jpg`,{type:"image/jpeg"});p(U)}},"image/jpeg",.85)};return e.jsxs("div",{className:"fixed inset-0 z-50 bg-black flex flex-col",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 bg-black/50 absolute top-0 w-full z-10",children:[e.jsxs("h3",{className:"text-white font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"w-5 h-5"})," Nova Foto"]}),e.jsx("button",{onClick:t,className:"p-2 bg-gray-800 rounded-full text-white",title:"Fechar câmera","aria-label":"Fechar câmera",children:e.jsx(se,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"flex-1 relative flex items-center justify-center bg-black overflow-hidden",children:[l&&e.jsx("p",{className:"text-white absolute",children:"Iniciando câmera..."}),e.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,className:"w-full h-full object-cover"}),e.jsx("canvas",{ref:s,className:"hidden"}),e.jsxs("div",{className:"absolute bottom-24 left-4 right-4 text-white text-xs opacity-70 bg-black/40 p-2 rounded pointer-events-none",children:[e.jsx("p",{children:new Date().toLocaleTimeString()}),u&&e.jsxs("p",{className:"flex items-center gap-1 mt-1",children:[e.jsx(oe,{className:"w-3 h-3"}),u.lat.toFixed(4),", ",u.lng.toFixed(4)]})]})]}),e.jsxs("div",{className:"p-6 bg-black flex justify-around items-center",children:[e.jsx("button",{onClick:k,className:"p-3 bg-gray-800 rounded-full text-white hover:bg-gray-700 transition",title:"Trocar câmera","aria-label":"Trocar câmera",children:e.jsx(ie,{className:"w-6 h-6"})}),e.jsx("button",{onClick:N,className:"w-16 h-16 bg-white rounded-full border-4 border-gray-300 hover:scale-105 transition shadow-lg",title:"Tirar foto","aria-label":"Tirar foto"}),e.jsx("div",{className:"w-12"})," "]})]})},je=()=>{const[p,t]=h.useState(!1),[a,s]=h.useState(null),r=async()=>{try{const{data:l,error:c}=await w.from("tipos_atividade").select("*").eq("ativo",!0).order("nome");if(c)throw c;return l||[]}catch(l){throw l}},n=async()=>{try{const{data:l,error:c}=await w.from("condicoes_climaticas").select("*").eq("ativo",!0).order("nome");if(c)throw c;return l||[]}catch(l){throw l}},u=async()=>{try{const{data:l,error:c}=await w.from("funcionarios").select("*").eq("ativo",!0).order("nome");if(c)throw c;return l||[]}catch(l){throw l}},f=async()=>{try{t(!0),s(null),await Promise.all([r(),n(),u()])}catch(l){const c=l instanceof Error?l.message:"Erro desconhecido";s(c)}finally{t(!1)}};return h.useEffect(()=>{f()},[]),{loading:p,error:a,loadAllData:f,loadTiposAtividade:r,loadCondicoesClimaticas:n,loadFuncionarios:u}};class ke extends we{constructor(){super("RDO_Offline_DB");T(this,"pendingRDOs");T(this,"syncQueue");T(this,"cache");this.version(1).stores({pendingRDOs:"++id, uuid, status, createdAt",syncQueue:"++id, table, type, timestamp",cache:"key"})}}const j=new ke;class W{static detectConflict(t,a){if(!t.updated_at||!a.updated_at)return!1;const s=new Date(t.updated_at).getTime(),r=new Date(a.updated_at).getTime();return Math.abs(s-r)>1e3}static resolveLastWriteWins(t){return{resolved:!0,data:t.localTimestamp>t.remoteTimestamp?t.localVersion:t.remoteVersion,strategy:"last-write-wins",requiresManualReview:!1}}static resolveMerge(t){const a={...t.remoteVersion},s=[];for(const r in t.localVersion){const n=t.localVersion[r],u=t.remoteVersion[r];JSON.stringify(n)!==JSON.stringify(u)&&(t.localTimestamp>t.remoteTimestamp&&(a[r]=n),s.push(r))}return{resolved:!0,data:a,strategy:"merge",requiresManualReview:s.length>3}}static requireManualResolution(t){return{resolved:!1,data:t.localVersion,strategy:"manual",requiresManualReview:!0}}static resolve(t){switch(t.strategy){case"last-write-wins":return this.resolveLastWriteWins(t);case"merge":return this.resolveMerge(t);case"manual":return this.requireManualResolution(t);default:return this.resolveLastWriteWins(t)}}static createConflict(t,a,s,r="last-write-wins"){return{id:a.id,table:t,localVersion:a,remoteVersion:s,localTimestamp:a.updated_at?new Date(a.updated_at).getTime():Date.now(),remoteTimestamp:s.updated_at?new Date(s.updated_at).getTime():Date.now(),strategy:r}}}class H{static saveUnresolvedConflict(t){const a=this.getUnresolvedConflicts();a.push({...t,savedAt:Date.now()}),localStorage.setItem(this.STORAGE_KEY,JSON.stringify(a))}static getUnresolvedConflicts(){const t=localStorage.getItem(this.STORAGE_KEY);return t?JSON.parse(t):[]}static removeConflict(t){const s=this.getUnresolvedConflicts().filter(r=>r.id!==t);localStorage.setItem(this.STORAGE_KEY,JSON.stringify(s))}static clearAll(){localStorage.removeItem(this.STORAGE_KEY)}static count(){return this.getUnresolvedConflicts().length}}T(H,"STORAGE_KEY","rdo_unresolved_conflicts");const S={maxRetries:5,initialDelay:1e3,maxDelay:3e4,backoffMultiplier:2};class Ne{constructor(){T(this,"isSyncing",!1);T(this,"syncListeners",[]);window.addEventListener("online",()=>this.processQueue())}onSyncStatusChange(t){return this.syncListeners.push(t),()=>{this.syncListeners=this.syncListeners.filter(a=>a!==t)}}notifyListeners(t){this.syncListeners.forEach(a=>a(t))}get isOnline(){return navigator.onLine}async processQueue(){if(!(!this.isOnline||this.isSyncing))try{this.isSyncing=!0,this.notifyListeners({status:"syncing",message:"Sincronizando dados...",progress:0}),await this.processSyncQueue(),await this.processPendingRDOs(),this.notifyListeners({status:"success",message:"Sincronização concluída",progress:100})}catch(t){this.notifyListeners({status:"error",message:`Erro: ${t instanceof Error?t.message:"Desconhecido"}`,progress:0})}finally{this.isSyncing=!1}}async processSyncQueue(){const t=await j.syncQueue.orderBy("timestamp").toArray();if(t.length!==0)for(const[a,s]of t.entries()){const r=(a+1)/t.length*50;this.notifyListeners({status:"syncing",message:`Sincronizando operação ${a+1}/${t.length}`,progress:r}),await this.syncOperation(s)}}async syncOperation(t){let a=0,s=S.initialDelay;for(;a<=S.maxRetries;)try{await this.executeSyncOperation(t),await j.syncQueue.delete(t.id);return}catch(r){if(a++,a>S.maxRetries)throw await j.syncQueue.update(t.id,{retryCount:a}),r;await this.sleep(Math.min(s,S.maxDelay)),s*=S.backoffMultiplier}}async executeSyncOperation(t){const{type:a,table:s,data:r}=t;switch(a){case"INSERT":{const{error:n}=await w.from(s).insert(r);if(n)throw n;break}case"UPDATE":{r.id&&await this.checkAndResolveConflict(s,r);const{error:n}=await w.from(s).update(r).eq("id",r.id);if(n)throw n;break}case"DELETE":{const{error:n}=await w.from(s).delete().eq("id",r.id);if(n)throw n;break}}}async checkAndResolveConflict(t,a){const{data:s,error:r}=await w.from(t).select("*").eq("id",a.id).single();if(!(r||!s)&&W.detectConflict(a,s)){const n=W.createConflict(t,a,s,"last-write-wins"),u=W.resolve(n);u.requiresManualReview?H.saveUnresolvedConflict(n):Object.assign(a,u.data)}}async processPendingRDOs(){const t=await j.pendingRDOs.where("status").equals("pending").toArray();if(t.length!==0)for(const[a,s]of t.entries()){const r=50+(a+1)/t.length*50;this.notifyListeners({status:"syncing",message:`Sincronizando RDO ${a+1}/${t.length}`,progress:r}),await this.syncRDO(s)}}async syncRDO(t){let a=0,s=S.initialDelay;for(;a<=S.maxRetries;)try{await j.pendingRDOs.update(t.id,{status:"syncing"}),this.validateRDOPayload(t.payload);const{payload:r}=t,n={...r.rdo};delete n.atividades,delete n.mao_obra,delete n.equipamentos,delete n.ocorrencias,delete n.fotos;const{data:u,error:f}=await w.from("rdos").upsert(n).select().single();if(f)throw f;if(!u)throw new Error("Não foi possível recuperar o RDO inserido");const l=u.id,c=[],O=r.atividades;if(Array.isArray(O)&&O.length){const k=O.map(N=>({...N,rdo_id:l}));c.push(w.from("rdo_atividades").upsert(k))}const R=r.mao_obra;if(Array.isArray(R)&&R.length){const k=R.map(N=>({...N,rdo_id:l}));c.push(w.from("rdo_mao_obra").upsert(k))}const D=r.fotos;if(Array.isArray(D)&&D.length){const k=D.map(async d=>{const g=`${Date.now()}_${d.name.replace(/[^a-zA-Z0-9.]/g,"_")}`,m=`${l}/${g}`,{error:b}=await w.storage.from("rdo-photos").upload(m,d);if(b)throw b;const{data:{publicUrl:v}}=w.storage.from("rdo-photos").getPublicUrl(m);return{rdo_id:l,nome_arquivo:d.name,tipo_arquivo:d.type,tamanho_bytes:d.size,url_storage:v}}),N=await Promise.all(k);c.push(w.from("rdo_anexos").upsert(N))}await Promise.all(c),await j.pendingRDOs.delete(t.id);return}catch(r){if(a++,a>S.maxRetries)throw await j.pendingRDOs.update(t.id,{status:"failed"}),r;await this.sleep(Math.min(s,S.maxDelay)),s*=S.backoffMultiplier}}validateRDOPayload(t){if(!t.rdo)throw new Error('Payload inválido: campo "rdo" ausente');const a=t.rdo;if(!a.obra_id)throw new Error('Payload inválido: "obra_id" ausente');if(!a.data_relatorio)throw new Error('Payload inválido: "data_relatorio" ausente')}sleep(t){return new Promise(a=>setTimeout(a,t))}async forceSync(){await this.processQueue()}async getSyncStats(){const t=await j.pendingRDOs.count(),a=await j.syncQueue.count(),s=H.count();return{pendingRDOs:t,pendingOperations:a,unresolvedConflicts:s,isOnline:this.isOnline,isSyncing:this.isSyncing}}}const Se=new Ne,Oe=ae({data_relatorio:B().min(1,"Data é obrigatória"),condicoes_climaticas:B().min(1,"Condições climáticas são obrigatórias"),observacoes_gerais:B().optional()});function Fe(){const{id:p}=X(),t=Z(),{items:a}=be(),{items:s}=ye(),{items:r}=fe(),{loading:n,error:u}=je(),[f,l]=h.useState({basicas:!0,atividades:!0,maoObra:!0,equipamentos:!1,inspecaoQualidade:!0,ocorrencias:!1,anexos:!1}),[c,O]=h.useState([]),[R,D]=h.useState([]),[k,N]=h.useState([]),[d,g]=h.useState([]),[m,b]=h.useState(!1),[v,z]=h.useState([]),{register:C,handleSubmit:$,formState:{errors:_}}=te({resolver:re(Oe),defaultValues:{data_relatorio:new Date().toISOString().split("T")[0]}}),U=o=>{l(i=>({...i,[o]:!i[o]}))},M=(o,i)=>{o(y=>[...y,i])},F=(o,i)=>{o(y=>y.filter(L=>L.id!==i))},J=async o=>{const i=A.loading("Processando RDO..."),y={rdo:{...o,obra_id:p,status:"pendente"},atividades:c.map(x=>({tipo_atividade:x.tipo,descricao:x.descricao,localizacao:x.localizacao})),mao_obra:R.map(x=>({funcao:x.funcao,quantidade:x.quantidade,horas_trabalhadas:x.horas})),fotos:v};try{if(navigator.onLine){const x=crypto.randomUUID(),L=await j.pendingRDOs.add({uuid:x,payload:y,createdAt:new Date().toISOString(),status:"pending",updatedAt:new Date().toISOString()});await Se.processQueue();const Q=await j.pendingRDOs.get(L);if(Q&&Q.status==="failed")throw new Error("Falha na sincronização");Q?A.success("RDO salvo e sincronizando em segundo plano.",{id:i}):A.success("RDO sincronizado com sucesso!",{id:i})}else throw new Error("Offline")}catch(x){x.message==="Offline"?(await j.pendingRDOs.add({uuid:crypto.randomUUID(),payload:y,createdAt:new Date().toISOString(),status:"pending",updatedAt:new Date().toISOString()}),A.info("Sem internet. RDO salvo no dispositivo.",{id:i,duration:5e3})):A.warning("RDO salvo localmente, mas houve erro na sincronização. Tentaremos novamente depois.",{id:i,duration:5e3})}t(`/obra/${p}`)},E=({title:o,icon:i,section:y,count:x})=>e.jsxs("button",{type:"button",onClick:()=>U(y),className:"w-full flex items-center justify-between p-4 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(i,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white",children:[o," ",x!==void 0&&`(${x})`]})]}),f[y]?e.jsx(he,{className:"w-5 h-5 text-gray-400"}):e.jsx(pe,{className:"w-5 h-5 text-gray-400"})]});return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsxs("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 sticky top-0 z-10",children:[e.jsxs("div",{className:"px-4 sm:px-6 py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ee,{to:`/obra/${p}`,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl",title:"Voltar para a obra",children:e.jsx(ne,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Criar RDO"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Obra: Edifício Aurora"})]})]}),e.jsx(xe,{})]}),n&&e.jsx("div",{className:"mx-4 mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:e.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"🔄 Carregando dados do Supabase..."})}),u&&e.jsx("div",{className:"mx-4 mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:e.jsxs("p",{className:"text-red-700 dark:text-red-300 text-sm",children:["❌ Erro ao carregar dados: ",u]})})]}),e.jsxs("form",{onSubmit:$(J),className:"p-4 sm:p-6 space-y-4",children:[e.jsx(E,{title:"Informações Básicas",icon:de,section:"basicas"}),e.jsx(q,{children:f.basicas&&e.jsxs(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-white mb-2",children:"Data"}),e.jsx("input",{type:"date",...C("data_relatorio"),defaultValue:new Date().toISOString().split("T")[0],className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl"}),_.data_relatorio&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:_.data_relatorio.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-white mb-2",children:"Clima"}),e.jsx("select",{...C("condicoes_climaticas"),"aria-label":"Condições Climáticas",title:"Selecione as condições climáticas",className:"w-full p-3 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white",children:s.map(o=>e.jsx("option",{value:o.nome,className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:o.nome},o.id))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-white mb-2",children:"Observações Gerais"}),e.jsx("textarea",{...C("observacoes_gerais"),rows:3,className:"w-full p-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl"})]})]})}),e.jsx(E,{title:"Atividades Executadas",icon:le,section:"atividades",count:c.length}),e.jsx(q,{children:f.atividades&&e.jsxs(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-4",children:[c.map((o,i)=>e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"font-medium text-sm",children:["Atividade ",i+1]}),e.jsx("button",{type:"button",onClick:()=>F(O,o.id),title:"Remover atividade",children:e.jsx(P,{className:"w-4 h-4 text-red-500"})})]}),e.jsxs("select",{className:"w-full p-2 border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-300 dark:border-gray-600",defaultValue:"","aria-label":"Tipo de Atividade",title:"Selecione o tipo de atividade",children:[e.jsx("option",{value:"",disabled:!0,className:"text-gray-500 dark:text-gray-400",children:"Selecione o tipo"}),a.map(y=>e.jsx("option",{value:y.nome,className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:y.nome},y.id))]}),e.jsx("input",{type:"text",placeholder:"Localização (Ex: Eixo A, 1º Pavimento)",className:"w-full p-2 border rounded"}),e.jsx("textarea",{placeholder:"Descrição detalhada da atividade",rows:2,className:"w-full p-2 border rounded"})]},o.id)),e.jsxs("button",{type:"button",onClick:()=>{alert("Botão Adicionar Atividade clicado!");const o={id:Date.now().toString(),tipo:"",descricao:"",localizacao:""};M(O,o)},className:"w-full flex items-center justify-center gap-2 py-2 px-4 bg-blue-100 text-blue-700 rounded-xl",children:[e.jsx(V,{className:"w-5 h-5"})," Adicionar Atividade"]})]})}),e.jsx(E,{title:"Inspeção de Qualidade",icon:ce,section:"inspecaoQualidade",count:k.length+d.length}),e.jsx(q,{children:f.inspecaoQualidade&&e.jsxs(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-4",children:[e.jsx("h4",{className:"font-semibold",children:"Inspeção de Solda"}),k.map((o,i)=>e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg grid grid-cols-3 gap-2 items-center",children:[e.jsx("input",{type:"text",placeholder:`Junta #${i+1}`,className:"col-span-1 p-2 border rounded"}),e.jsxs("select",{className:"col-span-1 p-2 border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-300 dark:border-gray-600","aria-label":"Status da Solda",title:"Selecione o status da solda",children:[e.jsx("option",{className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:"Aprovado"}),e.jsx("option",{className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:"Reprovado"}),e.jsx("option",{className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:"Pendente"})]}),e.jsx("button",{type:"button",onClick:()=>F(N,o.id),className:"justify-self-end",title:"Remover inspeção de solda",children:e.jsx(P,{className:"w-4 h-4 text-red-500"})})]},o.id)),e.jsxs("button",{type:"button",onClick:()=>{alert("Botão Adicionar Inspeção de Solda clicado!");const o={id:Date.now().toString(),junta:"",status:"pendente"};M(N,o)},className:"w-full text-sm flex items-center justify-center gap-2 py-2 px-4 bg-gray-100 text-gray-700 rounded-xl",children:[e.jsx(V,{className:"w-4 h-4"})," Adicionar Inspeção de Solda"]}),e.jsx("h4",{className:"font-semibold mt-4",children:"Verificação de Torque de Parafusos"}),d.map((o,i)=>e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg grid grid-cols-3 gap-2 items-center",children:[e.jsx("input",{type:"text",placeholder:`Parafuso/Lote #${i+1}`,className:"col-span-1 p-2 border rounded"}),e.jsxs("select",{className:"col-span-1 p-2 border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-300 dark:border-gray-600","aria-label":"Status do Torque",title:"Selecione o status do torque",children:[e.jsx("option",{className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:"Conforme"}),e.jsx("option",{className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:"Não Conforme"})]}),e.jsx("button",{type:"button",onClick:()=>F(g,o.id),className:"justify-self-end",title:"Remover verificação de torque",children:e.jsx(P,{className:"w-4 h-4 text-red-500"})})]},o.id)),e.jsxs("button",{type:"button",onClick:()=>{alert("Botão Adicionar Verificação de Torque clicado!");const o={id:Date.now().toString(),parafuso:"",torque_aplicado:0,status:"conforme"};M(g,o)},className:"w-full text-sm flex items-center justify-center gap-2 py-2 px-4 bg-gray-100 text-gray-700 rounded-xl",children:[e.jsx(V,{className:"w-4 h-4"})," Adicionar Verificação de Torque"]})]})}),e.jsx(E,{title:"Mão de Obra",icon:ue,section:"maoObra",count:R.length}),e.jsx(q,{children:f.maoObra&&e.jsxs(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-4",children:[R.map(o=>e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg grid grid-cols-4 gap-2 items-center",children:[e.jsxs("select",{className:"col-span-2 p-2 border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white border-gray-300 dark:border-gray-600","aria-label":"Função da Mão de Obra",title:"Selecione a função",children:[e.jsx("option",{value:"",disabled:!0,className:"text-gray-500 dark:text-gray-400",children:"Selecione a função"}),r.map(i=>e.jsx("option",{value:i.nome,className:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:i.nome},i.id))]}),e.jsx("input",{type:"number",placeholder:"Qtd",className:"p-2 border rounded"}),e.jsx("button",{type:"button",onClick:()=>F(D,o.id),className:"justify-self-end",title:"Remover mão de obra",children:e.jsx(P,{className:"w-4 h-4 text-red-500"})})]},o.id)),e.jsxs("button",{type:"button",onClick:()=>M(D,{id:Date.now().toString(),funcao:"",quantidade:1,horas:8}),className:"w-full flex items-center justify-center gap-2 py-2 px-4 bg-blue-100 text-blue-700 rounded-xl",children:[e.jsx(V,{className:"w-5 h-5"})," Adicionar Mão de Obra"]})]})}),e.jsx(E,{title:"Registros Fotográficos",icon:G,section:"anexos",count:v.length}),e.jsx(q,{children:f.anexos&&e.jsx(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[v.map((o,i)=>e.jsxs("div",{className:"relative group aspect-square rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700",children:[e.jsx("img",{src:URL.createObjectURL(o),alt:`Foto ${i+1}`,className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>z(y=>y.filter((x,L)=>L!==i)),className:"absolute top-1 right-1 p-1 bg-red-500 rounded-full text-white opacity-0 group-hover:opacity-100 transition-opacity",title:"Remover foto","aria-label":"Remover foto",children:e.jsx(P,{className:"w-4 h-4"})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-1 truncate",children:o.name})]},i)),e.jsxs("button",{type:"button",onClick:()=>b(!0),className:"flex flex-col items-center justify-center gap-2 aspect-square rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600 hover:border-blue-500 dark:hover:border-blue-400 text-gray-500 hover:text-blue-500 transition-colors bg-gray-50 dark:bg-gray-800/50",children:[e.jsx(G,{className:"w-8 h-8"}),e.jsx("span",{className:"text-sm font-medium",children:"Tirar Foto"})]})]})})}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsxs("button",{type:"button",className:"flex-1 py-3 px-4 rounded-xl bg-gray-600 text-white hover:bg-gray-700 flex items-center justify-center gap-2",children:[e.jsx(ge,{className:"w-5 h-5"})," Salvar Rascunho"]}),e.jsxs("button",{type:"submit",className:"flex-1 py-3 px-4 rounded-xl bg-blue-600 text-white hover:bg-blue-700 flex items-center justify-center gap-2",children:[e.jsx(me,{className:"w-5 h-5"})," Enviar RDO"]})]})]}),m&&e.jsx(ve,{onCapture:o=>{z(i=>[...i,o]),b(!1)},onClose:()=>b(!1)})]})}export{Fe as default}; diff --git a/dist/assets/js/CreateTask-BlEDuvPM.js b/dist/assets/js/CreateTask-BlEDuvPM.js new file mode 100644 index 0000000..e20ffaa --- /dev/null +++ b/dist/assets/js/CreateTask-BlEDuvPM.js @@ -0,0 +1 @@ +import{j as a}from"./query-vendor-BLVqILA6.js";import{c as f,d as v,r as c,L as j}from"./router-vendor-D4by-_6Z.js";import{T as w}from"./ThemeToggle-Cryh6OOS.js";import{o as N,m as z,F as _,w as i,k as C,l as b,ab as $,j as D,X as T,q as S}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";function u(d){const s=d.replace(/\D/g,"");return s.length<=2?s:s.length<=4?`${s.slice(0,2)}/${s.slice(2)}`:s.length<=8?`${s.slice(0,2)}/${s.slice(2,4)}/${s.slice(4,8)}`:`${s.slice(0,2)}/${s.slice(2,4)}/${s.slice(4,8)}`}const P=[{value:"baixa",label:"Baixa",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},{value:"media",label:"Média",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},{value:"alta",label:"Alta",color:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300"},{value:"critica",label:"Crítica",color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300"}],I=["Estrutura","Elétrica","Hidráulica","Acabamento","Impermeabilização","Pintura","Alvenaria","Cobertura","Fundação","Outros"];function R(){const{id:d}=f(),s=v(),[g,x]=c.useState(!1),[r,m]=c.useState({}),[t,p]=c.useState({titulo:"",descricao:"",responsavel:"",prioridade:"media",data_inicio:"",data_prazo:"",categoria:"",localizacao:""}),o=(e,l)=>{p(n=>({...n,[e]:l})),r[e]&&m(n=>({...n,[e]:void 0}))},h=()=>{const e={};if(t.titulo.trim()||(e.titulo="Título é obrigatório"),t.descricao.trim()||(e.descricao="Descrição é obrigatória"),t.responsavel.trim()||(e.responsavel="Responsável é obrigatório"),t.data_inicio||(e.data_inicio="Data de início é obrigatória"),t.data_prazo||(e.data_prazo="Data prazo é obrigatória"),t.categoria||(e.categoria="Categoria é obrigatória"),t.data_inicio&&t.data_prazo){const l=new Date(t.data_inicio);new Date(t.data_prazo)<=l&&(e.data_prazo="Data prazo deve ser posterior à data de início")}return m(e),Object.keys(e).length===0},y=async e=>{if(e.preventDefault(),!!h()){x(!0);try{await new Promise(l=>setTimeout(l,1e3)),s(`/obra/${d}/tarefas`)}catch{}finally{x(!1)}}},k=()=>{s(`/obra/${d}/tarefas`)};return a.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[a.jsx("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 sticky top-0 z-10",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex items-center justify-between h-16",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(j,{to:`/obra/${d}/tarefas`,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a.jsx(N,{className:"w-5 h-5 text-gray-600 dark:text-gray-300"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Nova Tarefa"}),a.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Obra #",d]})]})]}),a.jsx(w,{})]})})}),a.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:a.jsx(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-8 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:a.jsxs("form",{onSubmit:y,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx(_,{className:"w-4 h-4 inline mr-2"}),"Título *"]}),a.jsx("input",{type:"text",value:t.titulo,onChange:e=>o("titulo",e.target.value),className:`w-full px-4 py-3 rounded-xl border ${r.titulo?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400`,placeholder:"Digite o título da tarefa"}),r.titulo&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.titulo]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição *"}),a.jsx("textarea",{value:t.descricao,onChange:e=>o("descricao",e.target.value),rows:4,className:`w-full px-4 py-3 rounded-xl border ${r.descricao?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all resize-none text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400`,placeholder:"Descreva detalhadamente a tarefa a ser executada"}),r.descricao&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.descricao]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx(C,{className:"w-4 h-4 inline mr-2"}),"Responsável *"]}),a.jsx("input",{type:"text",value:t.responsavel,onChange:e=>o("responsavel",e.target.value),className:`w-full px-4 py-3 rounded-xl border ${r.responsavel?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400`,placeholder:"Nome do responsável"}),r.responsavel&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.responsavel]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Prioridade"}),a.jsx("select",{value:t.prioridade,onChange:e=>o("prioridade",e.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white",children:P.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx(b,{className:"w-4 h-4 inline mr-2"}),"Data de Início *"]}),a.jsx("input",{type:"text",value:t.data_inicio,onChange:e=>o("data_inicio",e.target.value),className:`w-full px-4 py-3 rounded-xl border ${r.data_inicio?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400`,placeholder:"dd/mm/aaaa",maxLength:10,onInput:e=>{const l=u(e.currentTarget.value);e.currentTarget.value=l,o("data_inicio",l)}}),r.data_inicio&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.data_inicio]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx(b,{className:"w-4 h-4 inline mr-2"}),"Data Prazo *"]}),a.jsx("input",{type:"text",value:t.data_prazo,onChange:e=>o("data_prazo",e.target.value),className:`w-full px-4 py-3 rounded-xl border ${r.data_prazo?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400`,placeholder:"dd/mm/aaaa",maxLength:10,onInput:e=>{const l=u(e.currentTarget.value);e.currentTarget.value=l,o("data_prazo",l)}}),r.data_prazo&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.data_prazo]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx($,{className:"w-4 h-4 inline mr-2"}),"Categoria *"]}),a.jsxs("select",{value:t.categoria,onChange:e=>o("categoria",e.target.value),className:`w-full px-4 py-3 rounded-xl border ${r.categoria?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white`,children:[a.jsx("option",{value:"",children:"Selecione uma categoria"}),I.map(e=>a.jsx("option",{value:e,children:e},e))]}),r.categoria&&a.jsxs("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(i,{className:"w-4 h-4"}),r.categoria]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a.jsx(D,{className:"w-4 h-4 inline mr-2"}),"Localização"]}),a.jsx("input",{type:"text",value:t.localizacao,onChange:e=>o("localizacao",e.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-white/50 dark:bg-gray-700/50 backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400",placeholder:"Ex: 2º Pavimento, Sala 201"})]})]}),a.jsxs("div",{className:"flex gap-4 pt-6",children:[a.jsxs("button",{type:"button",onClick:k,className:"flex-1 flex items-center justify-center gap-2 py-3 px-6 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[a.jsx(T,{className:"w-5 h-5"}),"Cancelar"]}),a.jsxs("button",{type:"submit",disabled:g,className:"flex-1 flex items-center justify-center gap-2 py-3 px-6 bg-blue-600 text-white rounded-xl hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[a.jsx(S,{className:"w-5 h-5"}),g?"Salvando...":"Salvar Tarefa"]})]})]})})})]})}export{R as default}; diff --git a/dist/assets/js/Dashboard-BPPxBqO4.js b/dist/assets/js/Dashboard-BPPxBqO4.js new file mode 100644 index 0000000..8ef6def --- /dev/null +++ b/dist/assets/js/Dashboard-BPPxBqO4.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{T as t}from"./ThemeToggle-Cryh6OOS.js";import{a as l,m as r,F as i,B as d,L as o,W as n,T as c,b as x,c as m}from"./ui-vendor-CyRvbSfR.js";import{L as a}from"./router-vendor-D4by-_6Z.js";import"./react-vendor-CqRd3GwO.js";const g=[{id:"1",nome:"Edifício Residencial Aurora",progresso:75,status:"ativa"},{id:"2",nome:"Shopping Center Plaza",progresso:45,status:"ativa"},{id:"3",nome:"Condomínio Jardim Verde",progresso:90,status:"pausada"}],b=[{id:"1",titulo:"Verificar torque dos parafusos - Setor A",obra:"Ed. Aurora",prazo:"Hoje"},{id:"2",titulo:"Aprovar RDO 15/01",obra:"Shopping Plaza",prazo:"Amanhã"}],h=s=>s>=80?"bg-green-500":s>=50?"bg-yellow-500":"bg-red-500";function N(){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md sticky top-0 z-10",children:e.jsxs("div",{className:"px-4 sm:px-6 py-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:"Dashboard"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Bem-vindo, Engenheiro!"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{to:"/manual",className:"flex items-center gap-2 px-3 py-2 bg-blue-100 dark:bg-blue-900/30 rounded-xl text-blue-700 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-900/50 transition-colors",title:"Manual de Instruções",children:[e.jsx(l,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline text-sm font-medium",children:"Manual"})]}),e.jsx(t,{})]})]})}),e.jsxs("div",{className:"p-4 sm:p-6 space-y-6",children:[e.jsxs(r.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3",children:"Acesso Rápido"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs(a,{to:"/rdo/novo",className:"flex flex-col items-center justify-center p-4 bg-blue-100 dark:bg-blue-900/30 rounded-2xl text-blue-700 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-900/50 transition-colors",children:[e.jsx(i,{className:"w-8 h-8 mb-2"}),e.jsx("span",{className:"text-sm font-semibold text-center",children:"Novo RDO"})]}),e.jsxs(a,{to:"/cadastros/obras",className:"flex flex-col items-center justify-center p-4 bg-purple-100 dark:bg-purple-900/30 rounded-2xl text-purple-700 dark:text-purple-300 hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[e.jsx(d,{className:"w-8 h-8 mb-2"}),e.jsx("span",{className:"text-sm font-semibold text-center",children:"Nova Obra"})]}),e.jsxs(a,{to:"/obra/1/tarefas",className:"flex flex-col items-center justify-center p-4 bg-green-100 dark:bg-green-900/30 rounded-2xl text-green-700 dark:text-green-300 hover:bg-green-200 dark:hover:bg-green-900/50 transition-colors",children:[e.jsx(o,{className:"w-8 h-8 mb-2"}),e.jsx("span",{className:"text-sm font-semibold text-center",children:"Apontar Tarefa"})]}),e.jsxs(a,{to:"/configuracoes",className:"flex flex-col items-center justify-center p-4 bg-gray-100 dark:bg-gray-700 rounded-2xl text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[e.jsx(n,{className:"w-8 h-8 mb-2"}),e.jsx("span",{className:"text-sm font-semibold text-center",children:"Configurar"})]})]})]}),e.jsxs(r.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{delay:.1},children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3",children:"Avisos Importantes"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center p-4 bg-red-100 dark:bg-red-900/30 rounded-2xl text-red-800 dark:text-red-200",children:[e.jsx(c,{className:"w-6 h-6 mr-3"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold",children:"Segurança"}),e.jsx("p",{className:"text-sm",children:"EPIs da equipe de montagem precisam de inspeção."})]})]}),e.jsxs("div",{className:"flex items-center p-4 bg-yellow-100 dark:bg-yellow-900/30 rounded-2xl text-yellow-800 dark:text-yellow-200",children:[e.jsx(x,{className:"w-6 h-6 mr-3"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold",children:"Prazo Apertado"}),e.jsx("p",{className:"text-sm",children:"Entrega da estrutura do Setor B vence em 3 dias."})]})]})]})]}),e.jsxs(r.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{delay:.2},children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3",children:"Minhas Tarefas Pendentes"}),e.jsx("div",{className:"space-y-3",children:b.map(s=>e.jsxs("div",{className:"flex items-center p-4 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsx(m,{className:"w-6 h-6 mr-4 text-gray-400"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s.titulo}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s.obra," - ",e.jsx("span",{className:"font-semibold",children:s.prazo})]})]}),e.jsx(a,{to:"/obra/1/tarefas",className:"text-blue-600 dark:text-blue-400 font-semibold text-sm",children:"Ver"})]},s.id))})]}),e.jsxs(r.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{delay:.3},children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200",children:"Obras em Andamento"}),e.jsx(a,{to:"/cadastros/obras",className:"text-blue-600 dark:text-blue-400 font-semibold text-sm",children:"Ver todas"})]}),e.jsx("div",{className:"space-y-3",children:g.filter(s=>s.status==="ativa").map(s=>e.jsxs(a,{to:`/obra/${s.id}`,className:"block p-4 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:s.nome}),e.jsxs("p",{className:"font-bold text-gray-800 dark:text-gray-200",children:[s.progresso,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2 mt-2",children:e.jsx("div",{className:`h-2 rounded-full ${h(s.progresso)}`,style:{width:`${s.progresso}%`}})})]},s.id))})]})]})]})}export{N as default}; diff --git a/dist/assets/js/DatabaseTest-BA9LjsoE.js b/dist/assets/js/DatabaseTest-BA9LjsoE.js new file mode 100644 index 0000000..3328ace --- /dev/null +++ b/dist/assets/js/DatabaseTest-BA9LjsoE.js @@ -0,0 +1 @@ +import{j as t}from"./query-vendor-BLVqILA6.js";import{r as i}from"./router-vendor-D4by-_6Z.js";import{s as a}from"./index-doec96Hx.js";import"./react-vendor-CqRd3GwO.js";import"./ui-vendor-CyRvbSfR.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const U=()=>{const[m,d]=i.useState([{name:"Conexão com Supabase",status:"pending"},{name:"Leitura da tabela usuarios",status:"pending"},{name:"Leitura da tabela obras",status:"pending"},{name:"Leitura da tabela rdos",status:"pending"},{name:"Inserção de dados de teste",status:"pending"},{name:"Teste de autenticação",status:"pending"},{name:"Teste de políticas RLS",status:"pending"}]),[r,u]=i.useState(!1),[g,n]=i.useState(-1),o=(e,s)=>{d(f=>f.map((l,y)=>y===e?{...l,...s}:l))},c=[{name:"Conexão com Supabase",icon:"🗄️",test:async()=>{try{const{data:e,error:s}=await a.from("usuarios").select("count",{count:"exact",head:!0});if(s)throw s;return{success:!0,message:"Conexão estabelecida com sucesso",data:"Tabela usuarios acessível"}}catch(e){return{success:!1,message:e.message}}}},{name:"Leitura da tabela usuarios",icon:"👥",test:async()=>{try{const{data:e,error:s}=await a.from("usuarios").select("*").limit(5);if(s)throw s;return{success:!0,message:`${e?.length||0} registros encontrados`,data:e}}catch(e){return{success:!1,message:e.message}}}},{name:"Leitura da tabela obras",icon:"🏗️",test:async()=>{try{const{data:e,error:s}=await a.from("obras").select("*").limit(5);if(s)throw s;return{success:!0,message:`${e?.length||0} registros encontrados`,data:e}}catch(e){return{success:!1,message:e.message}}}},{name:"Leitura da tabela rdos",icon:"📄",test:async()=>{try{const{data:e,error:s}=await a.from("rdos").select("*").limit(5);if(s)throw s;return{success:!0,message:`${e?.length||0} registros encontrados`,data:e}}catch(e){return{success:!1,message:e.message}}}},{name:"Inserção de dados de teste",icon:"➕",test:async()=>{try{const{data:e,error:s}=await a.from("usuarios").select("id").limit(1);if(s)throw s;return{success:!0,message:"Permissões de leitura funcionando",data:"Teste de inserção simulado"}}catch(e){return{success:!1,message:e.message}}}},{name:"Teste de autenticação",icon:"🔐",test:async()=>{try{const{data:{user:e}}=await a.auth.getUser();return{success:!0,message:e?`Usuário autenticado: ${e.email}`:"Usuário não autenticado (modo anônimo)",data:e?{id:e.id,email:e.email}:null}}catch(e){return{success:!1,message:e.message}}}},{name:"Teste de políticas RLS",icon:"🛡️",test:async()=>{try{const{data:e,error:s}=await a.from("usuarios").select("*").limit(1);if(s&&s.code==="PGRST116")return{success:!0,message:"RLS ativo - acesso negado conforme esperado",data:"Políticas funcionando"};if(s)throw s;return{success:!0,message:"RLS configurado - dados acessíveis",data:`${e?.length||0} registros`}}catch(e){return{success:!1,message:e.message}}}}],x=async()=>{u(!0);for(let e=0;esetTimeout(s,500))}n(-1),u(!1)},p=()=>{d(e=>e.map(s=>({...s,status:"pending",message:void 0,data:void 0}))),n(-1)},h=e=>{switch(e){case"running":return t.jsx("span",{className:"inline-block w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"});case"success":return t.jsx("span",{className:"text-green-500 text-xl",children:"✓"});case"error":return t.jsx("span",{className:"text-red-500 text-xl",children:"✗"});default:return t.jsx("span",{className:"inline-block w-4 h-4 border-2 border-gray-300 rounded-full"})}},b=e=>{const s="px-2 py-1 rounded text-sm font-medium";switch(e){case"running":return t.jsx("span",{className:`${s} bg-blue-100 text-blue-800`,children:"Executando"});case"success":return t.jsx("span",{className:`${s} bg-green-100 text-green-800`,children:"Sucesso"});case"error":return t.jsx("span",{className:`${s} bg-red-100 text-red-800`,children:"Erro"});default:return t.jsx("span",{className:`${s} bg-gray-100 text-gray-800`,children:"Pendente"})}};return t.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Teste de Conexão do Banco de Dados"}),t.jsx("p",{className:"text-gray-600",children:"Verificação completa da integração com Supabase"})]}),t.jsxs("div",{className:"flex justify-center space-x-4",children:[t.jsxs("button",{onClick:x,disabled:r,className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[r?t.jsx("span",{className:"inline-block w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):t.jsx("span",{children:"🗄️"}),t.jsx("span",{children:r?"Executando Testes...":"Executar Todos os Testes"})]}),t.jsx("button",{onClick:p,disabled:r,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Resetar Testes"})]}),t.jsx("div",{className:"grid gap-4",children:m.map((e,s)=>t.jsxs("div",{className:`border border-gray-200 rounded-lg p-6 transition-all duration-200 hover:shadow-md bg-white ${g===s?"ring-2 ring-blue-500 shadow-lg":""}`,children:[t.jsx("div",{className:"pb-3",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[h(e.status),t.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[t.jsx("span",{children:c[s]?.icon}),e.name]})]}),b(e.status)]})}),(e.message||e.data!==void 0)&&t.jsxs("div",{className:"pt-0",children:[e.message&&t.jsx("p",{className:`text-sm ${e.status==="error"?"text-red-600":"text-gray-600"}`,children:e.message}),e.data!==void 0&&t.jsx("div",{className:"mt-3 p-3 bg-gray-50 rounded-md",children:t.jsx("pre",{className:"text-xs text-gray-700 whitespace-pre-wrap",children:JSON.stringify(e.data,null,2)})})]})]},s))})]})};export{U as default}; diff --git a/dist/assets/js/ManualInstrucoes-G3xr1xLl.js b/dist/assets/js/ManualInstrucoes-G3xr1xLl.js new file mode 100644 index 0000000..d62b14d --- /dev/null +++ b/dist/assets/js/ManualInstrucoes-G3xr1xLl.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as h,L as E}from"./router-vendor-D4by-_6Z.js";import{T as M}from"./ThemeToggle-Cryh6OOS.js";import{X as L,ac as V,a as y,o as v,A as B,m as w,S as I,ad as O,c,b as C,C as x,P as d,F as l,f as s,H as j,U as N,J as D,T as A,ae as Q,af as U,x as q,ag as R,a3 as z,ah as G,ai as S,aj as H,R as k,ak as $,h as J,al as P,n as W,am as X,an as _}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const r=[{id:"introducao",titulo:"Bem-vindo ao App RDO da TrackSteel",icone:e.jsx(y,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-900/20 dark:to-purple-900/20 rounded-2xl p-6 border border-blue-200/50 dark:border-blue-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-blue-900 dark:text-blue-100 mb-3",children:"🎉 Parabéns por escolher o App RDO!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Seu assistente completo para gerenciamento de obras e relatórios diários de obra (RDO). O App RDO é como ter um assistente pessoal que nunca esquece de nada e está sempre pronto para ajudar!"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-4 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-2 flex items-center gap-2",children:[e.jsx(c,{className:"w-4 h-4 text-green-500"}),"O que você vai aprender"]}),e.jsxs("ul",{className:"text-sm text-gray-600 dark:text-gray-400 space-y-1",children:[e.jsx("li",{children:"• Como navegar pelo aplicativo"}),e.jsx("li",{children:"• Criar e gerenciar suas obras"}),e.jsx("li",{children:"• Fazer RDOs completos e profissionais"}),e.jsx("li",{children:"• Acompanhar progresso e métricas"}),e.jsx("li",{children:"• Trabalhar offline e sincronizar"})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-4 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-2 flex items-center gap-2",children:[e.jsx(C,{className:"w-4 h-4 text-blue-500"}),"Tempo de leitura"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Este manual foi feito para ser lido como um livro. Reserve cerca de 15-20 minutos para uma leitura completa, ou navegue pelos capítulos conforme sua necessidade."})]})]})]})},{id:"primeiros-passos",titulo:"Primeiros Passos",icone:e.jsx(j,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-green-50 to-blue-50 dark:from-green-900/20 dark:to-blue-900/20 rounded-2xl p-6 border border-green-200/50 dark:border-green-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-green-900 dark:text-green-100 mb-3",children:"🚀 Vamos começar sua jornada!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Pense no App RDO como sua nova casa digital para gerenciar obras. Assim como quando você chega em uma casa nova, vamos fazer um tour pelos cômodos principais para você se sentir em casa!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(x,{className:"w-5 h-5 text-blue-500"}),"1. O Dashboard - Sua Central de Comando"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"O Dashboard é como a sala de estar da sua casa - é onde você vê tudo que está acontecendo de uma só vez. Aqui você encontra:"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"📊 Resumo das Obras"}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Quantas obras ativas, pausadas e concluídas"})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-green-900 dark:text-green-100",children:"📋 RDOs do Dia"}),e.jsx("p",{className:"text-xs text-green-700 dark:text-green-300",children:"Quantos relatórios foram feitos hoje"})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/30 rounded-lg p-3",children:[e.jsx("h5",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"🚀 Botões de Ação Rápida:"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1 text-blue-700 dark:text-blue-300",children:[e.jsx(d,{className:"w-3 h-3"}),e.jsx("span",{children:"Novo RDO"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-purple-700 dark:text-purple-300",children:[e.jsx(d,{className:"w-3 h-3"}),e.jsx("span",{children:"Nova Obra"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-green-700 dark:text-green-300",children:[e.jsx(l,{className:"w-3 h-3"}),e.jsx("span",{children:"Apontar Tarefa"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-gray-700 dark:text-gray-300",children:[e.jsx(s,{className:"w-3 h-3"}),e.jsx("span",{children:"Configurações"})]})]})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(s,{className:"w-5 h-5 text-purple-500"}),"2. Botões Importantes no Topo"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"No canto superior direito, você encontra três botões essenciais:"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx(y,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Manual"}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"- Este botão que você clicou para chegar aqui!"})]}),e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx(s,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Configurações"}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"- Para personalizar listas e opções"})]})]})]})]})]})},{id:"criando-obra",titulo:"Criando sua Primeira Obra",icone:e.jsx(d,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-900/20 dark:to-pink-900/20 rounded-2xl p-6 border border-purple-200/50 dark:border-purple-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-purple-900 dark:text-purple-100 mb-3",children:"🏗️ Hora de criar sua primeira obra!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Criar uma obra no app é como plantar uma semente em um jardim. Você vai dar todas as informações necessárias para que ela cresça e seja bem cuidada durante todo o processo."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"1"}),'Encontre o Botão "Nova Obra"']}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:'No Dashboard, procure pelo botão azul "Nova Obra" no canto superior direito da seção "Suas Obras". É como um botão mágico que abre as portas para sua nova construção!'}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3",children:e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200 flex items-center gap-2",children:[e.jsx(d,{className:"w-4 h-4"}),e.jsx("strong",{children:"Dica:"}),' O botão tem um ícone de "+" e é bem visível!']})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"2"}),"Preencha as Informações"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"Quando clicar no botão, uma janela vai aparecer pedindo algumas informações básicas. É como preencher uma ficha de identificação da sua obra:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"📝 Nome da Obra"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:'Ex: "Edifício Residencial Aurora"'})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"📍 Endereço"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Onde a obra está localizada"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"👤 Cliente"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Quem contratou a obra"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"📅 Datas"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Início e fim previsto"})]})]})]})]})]})]})},{id:"fazendo-rdo",titulo:"Fazendo seu Primeiro RDO",icone:e.jsx(l,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 rounded-2xl p-6 border border-orange-200/50 dark:border-orange-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-orange-900 dark:text-orange-100 mb-3",children:"📋 Seu primeiro Relatório Diário de Obra!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"O RDO é como um diário da sua obra. Imagine que você está contando para um amigo tudo que aconteceu no canteiro hoje - quem trabalhou, que atividades foram feitas, se choveu, se houve algum problema..."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"bg-orange-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"1"}),"Acesse a Obra"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"No Dashboard, você verá todas as suas obras em cartões. Cada cartão tem dois botões importantes:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 flex items-center gap-3",children:[e.jsx(d,{className:"w-5 h-5 text-blue-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"Criar RDO"}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Para fazer um novo relatório"})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3 flex items-center gap-3",children:[e.jsx(l,{className:"w-5 h-5 text-gray-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Ver Detalhes"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Para ver todos os RDOs"})]})]})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"bg-orange-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"2"}),"Preencha o Relatório"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"O RDO é organizado em seções expansíveis para facilitar o preenchimento:"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-green-900 dark:text-green-100 mb-1 flex items-center gap-2",children:[e.jsx(l,{className:"w-4 h-4"}),"Informações Básicas"]}),e.jsx("p",{className:"text-xs text-green-700 dark:text-green-300",children:"Data, condições climáticas e observações gerais"})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-1 flex items-center gap-2",children:[e.jsx(s,{className:"w-4 h-4"}),"Atividades Executadas"]}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Tipo, localização e descrição das atividades"})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-purple-900 dark:text-purple-100 mb-1 flex items-center gap-2",children:[e.jsx(N,{className:"w-4 h-4"}),"Mão de Obra & Equipamentos"]}),e.jsx("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:"Equipe, funções, horas e equipamentos utilizados"})]}),e.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-orange-900 dark:text-orange-100 mb-1 flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),"Inspeção de Qualidade"]}),e.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-300",children:"Controle de soldas, torque e qualidade"})]}),e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-red-900 dark:text-red-100 mb-1 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"Ocorrências & Anexos"]}),e.jsx("p",{className:"text-xs text-red-700 dark:text-red-300",children:"Incidentes, fotos e documentos"})]})]})]})]})]})},{id:"acompanhando-progresso",titulo:"Acompanhando o Progresso",icone:e.jsx(x,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-teal-50 to-cyan-50 dark:from-teal-900/20 dark:to-cyan-900/20 rounded-2xl p-6 border border-teal-200/50 dark:border-teal-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-teal-900 dark:text-teal-100 mb-3",children:"📈 Vendo sua obra crescer!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Acompanhar o progresso da obra é como assistir uma planta crescer. A cada dia, você pode ver o quanto avançou e o que ainda falta para chegar ao final. O app te mostra isso de forma visual e fácil!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(x,{className:"w-5 h-5 text-teal-500"}),"Sistema de Relatórios Avançado"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"Acesse relatórios detalhados com filtros personalizáveis e exportação em múltiplos formatos:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-blue-900 dark:text-blue-300 mb-2 flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Relatório de Produtividade"]}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Análise de rendimento por equipe, atividade e período com gráficos interativos."})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-green-900 dark:text-green-300 mb-2 flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Relatório Financeiro"]}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Controle de custos, orçamento vs realizado e projeções financeiras."})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-purple-900 dark:text-purple-300 mb-2 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Relatório de Equipamentos"]}),e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200",children:"Utilização, manutenção e custos operacionais dos equipamentos."})]}),e.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-orange-900 dark:text-orange-300 mb-2 flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Relatório de Obras"]}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"Progresso geral, marcos e cronograma de cada obra."})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-gray-900 dark:text-gray-300 mb-2 flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Exportação Flexível"]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-400 mb-2",children:"Exporte seus relatórios em diferentes formatos:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 text-xs rounded",children:"PDF"}),e.jsx("span",{className:"px-2 py-1 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 text-xs rounded",children:"Excel"}),e.jsx("span",{className:"px-2 py-1 bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300 text-xs rounded",children:"CSV"}),e.jsx("span",{className:"px-2 py-1 bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300 text-xs rounded",children:"JSON"})]})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(N,{className:"w-5 h-5 text-blue-500"}),"Status das Obras"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"Cada obra tem um status que te conta rapidamente como ela está:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-green-900 dark:text-green-100",children:"Ativa"}),e.jsx("p",{className:"text-xs text-green-700 dark:text-green-300",children:"Trabalhando normalmente"})]}),e.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Pausada"}),e.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:"Temporariamente parada"})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-full mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"Concluída"}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Obra finalizada"})]})]})]})]})]})},{id:"configuracoes",titulo:"Personalizando o App",icone:e.jsx(s,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-blue-50 dark:from-indigo-900/20 dark:to-blue-900/20 rounded-2xl p-6 border border-indigo-200/50 dark:border-indigo-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-indigo-900 dark:text-indigo-100 mb-3",children:"⚙️ Deixando o app com a sua cara!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"As configurações são como o armário de ferramentas do app. Aqui você pode personalizar listas, adicionar novos tipos de atividades e deixar tudo do jeito que funciona melhor para você!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(s,{className:"w-5 h-5 text-indigo-500"}),"Acessando as Configurações"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:'Clique no botão "Configurações" no canto superior direito do Dashboard. É como abrir a gaveta de ferramentas para ajustar o que precisar!'}),e.jsx("div",{className:"bg-indigo-50 dark:bg-indigo-900/20 rounded-lg p-3",children:e.jsxs("p",{className:"text-sm text-indigo-800 dark:text-indigo-200 flex items-center gap-2",children:[e.jsx(s,{className:"w-4 h-4"}),e.jsx("strong",{children:"Lembre-se:"})," Só administradores podem acessar as configurações!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(s,{className:"w-5 h-5 text-purple-500"}),"Centro de Configurações"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-3",children:"Personalize completamente o sistema com configurações organizadas por categoria:"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-purple-900 dark:text-purple-100 flex items-center gap-2",children:[e.jsx(l,{className:"w-4 h-4"}),"Tipos de Atividade"]}),e.jsx("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:"Soldas, montagem, pintura, estruturas"})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4"}),"Condições Climáticas"]}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Sol, chuva, vento, nublado, garoa"})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-green-900 dark:text-green-100 flex items-center gap-2",children:[e.jsx(N,{className:"w-4 h-4"}),"Funções da Equipe"]}),e.jsx("p",{className:"text-xs text-green-700 dark:text-green-300",children:"Soldador, montador, operador, técnico"})]}),e.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Equipamentos"]}),e.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-300",children:"Guindastes, soldas, compressores"})]}),e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-red-900 dark:text-red-100 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"Tipos de Ocorrência"]}),e.jsx("p",{className:"text-xs text-red-700 dark:text-red-300",children:"Incidentes, não conformidades, paradas"})]}),e.jsxs("div",{className:"bg-teal-50 dark:bg-teal-900/20 rounded-lg p-3",children:[e.jsxs("p",{className:"text-sm font-medium text-teal-900 dark:text-teal-100 flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Localizações"]}),e.jsx("p",{className:"text-xs text-teal-700 dark:text-teal-300",children:"Eixos, pavimentos, setores da obra"})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 p-4 rounded-lg",children:[e.jsxs("h5",{className:"font-semibold text-gray-900 dark:text-gray-300 mb-2 flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Backup e Restauração"]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-400 mb-2",children:"Gerencie suas configurações:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 text-xs rounded",children:"Exportar Configurações"}),e.jsx("span",{className:"px-2 py-1 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 text-xs rounded",children:"Importar Configurações"}),e.jsx("span",{className:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300 text-xs rounded",children:"Restaurar Padrões"})]})]})]})]})]})},{id:"offline",titulo:"Modo Offline",icone:e.jsx(P,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 rounded-2xl p-6 border border-orange-200/50 dark:border-orange-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-orange-900 dark:text-orange-100 mb-3",children:"📱 Trabalhe sem internet!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"O App RDO funciona completamente offline. Crie RDOs, gerencie obras e configure o sistema mesmo sem conexão com a internet. Quando a conexão voltar, tudo será sincronizado automaticamente!"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md p-6 rounded-xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(S,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),"Armazenamento Local"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg border-l-4 border-blue-400",children:[e.jsxs("h5",{className:"font-semibold text-blue-900 dark:text-blue-300 mb-2 flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4"}),"Dados Seguros"]}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Todos os seus dados ficam salvos no dispositivo. RDOs, obras, configurações - tudo fica disponível offline."})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg border-l-4 border-green-400",children:[e.jsxs("h5",{className:"font-semibold text-green-900 dark:text-green-300 mb-2 flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),"Sem Perda de Dados"]}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Mesmo que a internet caia no meio do trabalho, seus dados estão protegidos e salvos localmente."})]})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md p-6 rounded-xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(k,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),"Sincronização Inteligente"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg border-l-4 border-orange-400",children:[e.jsxs("h5",{className:"font-semibold text-orange-900 dark:text-orange-300 mb-2 flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4"}),"Status Visível"]}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"Veja o indicador de conexão no canto da tela. Ele mostra quantas operações estão aguardando sincronização."})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg border-l-4 border-purple-400",children:[e.jsxs("h5",{className:"font-semibold text-purple-900 dark:text-purple-300 mb-2 flex items-center gap-2",children:[e.jsx(k,{className:"w-4 h-4"}),"Sync Automático"]}),e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200",children:"Quando a internet voltar, o sistema sincroniza automaticamente todos os dados pendentes em segundo plano."})]})]})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md p-6 rounded-xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(s,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"}),"Gerenciamento Offline"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-100 dark:bg-blue-800/50 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(S,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsx("h5",{className:"font-semibold text-blue-900 dark:text-blue-300 mb-2",children:"Cache Local"}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Visualize o tamanho do cache e dados armazenados localmente"})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-green-100 dark:bg-green-800/50 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(k,{className:"w-6 h-6 text-green-600 dark:text-green-400"})}),e.jsx("h5",{className:"font-semibold text-green-900 dark:text-green-300 mb-2",children:"Sync Manual"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Force a sincronização quando necessário através do painel de status"})]}),e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-red-100 dark:bg-red-800/50 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(J,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),e.jsx("h5",{className:"font-semibold text-red-900 dark:text-red-300 mb-2",children:"Limpar Cache"}),e.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:"Limpe o cache local quando necessário para liberar espaço"})]})]})]})]})},{id:"dicas",titulo:"Dicas e Truques",icone:e.jsx(_,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-emerald-50 to-teal-50 dark:from-emerald-900/20 dark:to-teal-900/20 rounded-2xl p-6 border border-emerald-200/50 dark:border-emerald-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-emerald-900 dark:text-emerald-100 mb-3",children:"💡 Segredos para usar o app como um profissional!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Aqui estão algumas dicas especiais que vão fazer você usar o App RDO como um verdadeiro expert. São pequenos truques que fazem uma grande diferença no dia a dia!"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(C,{className:"w-5 h-5 text-blue-500"}),"⏰ RDOs Diários"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Use as seções expansíveis para organizar melhor as informações. Preencha sempre no final do expediente!"}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-blue-800 dark:text-blue-200",children:[e.jsx("strong",{children:"Dica:"})," Clique nas setas para expandir/recolher seções!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5 text-green-500"}),"📱 Modo Offline"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Trabalhe sem internet! O app sincroniza automaticamente quando a conexão voltar."}),e.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-green-800 dark:text-green-200",children:[e.jsx("strong",{children:"Status:"})," Monitore o indicador no canto da tela!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(W,{className:"w-5 h-5 text-purple-500"}),"📸 Fotos & Anexos"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Anexe fotos aos RDOs para documentar o progresso. Especialmente útil para inspeções!"}),e.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-purple-800 dark:text-purple-200",children:[e.jsx("strong",{children:"Tip:"})," Fotos antes/depois são muito valiosas!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(s,{className:"w-5 h-5 text-orange-500"}),"⚙️ Personalize Tudo"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Configure tipos de atividades, condições climáticas e outros parâmetros nas configurações."}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-orange-800 dark:text-orange-200",children:[e.jsx("strong",{children:"Estratégia:"})," Adapte às necessidades da sua obra!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(x,{className:"w-5 h-5 text-red-500"}),"📊 Relatórios Avançados"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Explore diferentes tipos de relatórios e formatos de exportação (PDF, Excel, CSV, JSON)."}),e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-red-800 dark:text-red-200",children:[e.jsx("strong",{children:"Filtros:"})," Use filtros para relatórios específicos!"]})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(X,{className:"w-5 h-5 text-indigo-500"}),"🌙 Modo Escuro"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Alterne entre temas claro e escuro para trabalhar confortavelmente em qualquer ambiente."}),e.jsx("div",{className:"bg-indigo-50 dark:bg-indigo-900/20 rounded-lg p-2",children:e.jsxs("p",{className:"text-xs text-indigo-800 dark:text-indigo-200",children:[e.jsx("strong",{children:"Conforto:"})," Reduz cansaço visual durante uso prolongado!"]})})]})]}),e.jsxs("div",{className:"bg-gradient-to-r from-yellow-50 to-orange-50 dark:from-yellow-900/20 dark:to-orange-900/20 rounded-xl p-5 border border-yellow-200/50 dark:border-yellow-700/50",children:[e.jsxs("h4",{className:"font-semibold text-yellow-900 dark:text-yellow-100 mb-3 flex items-center gap-2",children:[e.jsx(c,{className:"w-5 h-5"}),"🎯 Dica de Ouro"]}),e.jsxs("p",{className:"text-yellow-800 dark:text-yellow-200 text-sm",children:[e.jsx("strong",{children:"O segredo do sucesso:"})," Use o app todos os dias, mesmo que seja só para dar uma olhada rápida. Assim você sempre sabe como suas obras estão andando e pode tomar decisões mais inteligentes!"]})]})]})},{id:"conclusao",titulo:"Parabéns! Você chegou ao fim",icone:e.jsx(c,{className:"w-5 h-5"}),conteudo:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-2xl p-6 border border-green-200/50 dark:border-green-700/50",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-green-900 dark:text-green-100 mb-3",children:"🎉 Parabéns, você é agora um usuário expert do App RDO!"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:"Você chegou ao final deste manual e agora tem todas as ferramentas necessárias para usar o App RDO como um verdadeiro profissional. É hora de colocar a mão na massa!"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(c,{className:"w-5 h-5 text-green-500"}),"✅ O que você aprendeu"]}),e.jsxs("ul",{className:"text-sm text-gray-600 dark:text-gray-400 space-y-1",children:[e.jsx("li",{children:"• Como navegar pelo Dashboard"}),e.jsx("li",{children:"• Criar e gerenciar obras"}),e.jsx("li",{children:"• Fazer RDOs completos"}),e.jsx("li",{children:"• Acompanhar o progresso"}),e.jsx("li",{children:"• Personalizar configurações"}),e.jsx("li",{children:"• Dicas de uso profissional"})]})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl p-5 border border-gray-200/50 dark:border-gray-700/50",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[e.jsx(j,{className:"w-5 h-5 text-blue-500"}),"🚀 Próximos passos"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Agora é hora de praticar! Comece criando sua primeira obra e fazendo seu primeiro RDO. Lembre-se: a prática leva à perfeição!"}),e.jsxs(E,{to:"/",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium",children:[e.jsx(j,{className:"w-4 h-4"}),"Voltar ao Dashboard"]})]})]}),e.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-xl p-5 border border-blue-200/50 dark:border-blue-700/50 text-center",children:[e.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💙 Obrigado por usar o App RDO!"}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:'Este manual sempre estará aqui quando você precisar. Clique no botão "Manual" no Dashboard sempre que quiser revisar algum conceito ou descobrir algo novo!'})]})]})}];function se(){const[t,m]=h.useState("introducao"),[o,g]=h.useState(!1),[f,T]=h.useState(""),F=r.filter(a=>a.titulo.toLowerCase().includes(f.toLowerCase())),b=r.find(a=>a.id===t)||r[0],i=r.findIndex(a=>a.id===t),p=r[i+1],u=r[i-1];return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 w-full overflow-x-hidden",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 sticky top-0 z-40",children:e.jsxs("div",{className:"px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 min-w-0",children:[e.jsx("button",{onClick:()=>g(!o),className:"lg:hidden p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors",children:o?e.jsx(L,{className:"w-4 h-4 sm:w-5 sm:h-5"}):e.jsx(V,{className:"w-4 h-4 sm:w-5 sm:h-5"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2 min-w-0",children:[e.jsx(y,{className:"w-5 h-5 sm:w-6 sm:h-6 text-blue-600"}),e.jsx("span",{className:"hidden xs:inline",children:"Manual do App RDO"}),e.jsx("span",{className:"xs:hidden",children:"Manual"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-300 hidden sm:block",children:"Guia completo para usar o aplicativo"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs(E,{to:"/",className:"flex items-center gap-1 sm:gap-2 px-2 sm:px-3 lg:px-4 py-2 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl border border-gray-200/50 dark:border-gray-700/50 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",title:"Voltar ao Dashboard",children:[e.jsx(v,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),e.jsx(M,{})]})]})}),e.jsxs("div",{className:"flex",children:[e.jsx(B,{children:(o||window.innerWidth>=1024)&&e.jsx(w.div,{initial:{x:-300,opacity:0},animate:{x:0,opacity:1},exit:{x:-300,opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:"fixed lg:sticky top-[65px] sm:top-[73px] left-0 h-[calc(100vh-65px)] sm:h-[calc(100vh-73px)] w-full sm:w-80 lg:w-80 bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-r border-gray-200/50 dark:border-gray-700/50 z-30 lg:z-auto overflow-y-auto",children:e.jsxs("div",{className:"p-3 sm:p-4 space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(I,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-3 h-3 sm:w-4 sm:h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Buscar no manual...",value:f,onChange:a=>T(a.target.value),className:"w-full pl-8 sm:pl-10 pr-3 sm:pr-4 py-2 bg-white/70 dark:bg-gray-700/70 backdrop-blur-md rounded-xl border border-gray-200/50 dark:border-gray-600/50 focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-xs sm:text-sm"})]}),e.jsx("nav",{className:"space-y-1",children:F.map((a,n)=>e.jsxs("button",{onClick:()=>{m(a.id),g(!1)},className:`w-full flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-2 sm:py-3 rounded-xl text-left transition-all duration-200 ${t===a.id?"bg-blue-100 dark:bg-blue-900/30 text-blue-900 dark:text-blue-100 shadow-sm":"hover:bg-gray-100 dark:hover:bg-gray-700/50 text-gray-700 dark:text-gray-300"}`,children:[e.jsx("div",{className:`p-1.5 sm:p-2 rounded-lg ${t===a.id?"bg-blue-200 dark:bg-blue-800/50 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}`,children:e.jsx("div",{className:"w-3 h-3 sm:w-4 sm:h-4",children:a.icone})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:`text-xs font-medium px-1.5 sm:px-2 py-0.5 sm:py-1 rounded-full ${t===a.id?"bg-blue-200 dark:bg-blue-800/50 text-blue-700 dark:text-blue-300":"bg-gray-200 dark:bg-gray-600 text-gray-600 dark:text-gray-400"}`,children:n+1})}),e.jsx("p",{className:"text-xs sm:text-sm font-medium truncate mt-1",children:a.titulo})]}),t===a.id&&e.jsx(O,{className:"w-3 h-3 sm:w-4 sm:h-4 text-blue-600 dark:text-blue-400"})]},a.id))})]})})}),o&&e.jsx("div",{className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-20 lg:hidden",onClick:()=>g(!1)}),e.jsx("div",{className:"flex-1 lg:ml-0",children:e.jsx("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-4 sm:py-6 lg:py-8",children:e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"space-y-4 sm:space-y-6 lg:space-y-8",children:[e.jsxs("div",{className:"text-center space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 sm:gap-3 px-3 sm:px-4 py-2 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl border border-gray-200/50 dark:border-gray-700/50",children:[e.jsx("div",{className:"p-1.5 sm:p-2 bg-blue-100 dark:bg-blue-900/30 rounded-xl text-blue-600 dark:text-blue-400",children:e.jsx("div",{className:"w-4 h-4 sm:w-5 sm:h-5",children:b.icone})}),e.jsxs("span",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400",children:["Capítulo ",i+1," de ",r.length]})]}),e.jsx("h2",{className:"text-xl sm:text-2xl lg:text-3xl xl:text-4xl font-bold text-gray-900 dark:text-white px-4",children:b.titulo})]}),e.jsx("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-4 sm:p-6 lg:p-8 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:b.conteudo}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center gap-4 pt-4 sm:pt-6 lg:pt-8",children:[e.jsx("div",{className:"w-full sm:w-auto",children:u&&e.jsxs("button",{onClick:()=>m(u.id),className:"flex items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl border border-gray-200/50 dark:border-gray-700/50 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 w-full sm:w-auto",children:[e.jsx(v,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Anterior"}),e.jsx("p",{className:"truncate max-w-24 sm:max-w-32",children:u.titulo})]})]})}),e.jsx("div",{className:"text-center order-first sm:order-none",children:e.jsx("div",{className:"flex gap-1",children:r.map((a,n)=>e.jsx("div",{className:`w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full transition-colors ${n===i?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`},n))})}),e.jsx("div",{className:"w-full sm:w-auto",children:p&&e.jsxs("button",{onClick:()=>m(p.id),className:"flex items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-xl border border-gray-200/50 dark:border-gray-700/50 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 w-full sm:w-auto justify-end sm:justify-start",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Próximo"}),e.jsx("p",{className:"truncate max-w-24 sm:max-w-32",children:p.titulo})]}),e.jsx(O,{className:"w-3 h-3 sm:w-4 sm:h-4"})]})})]})]},t)})})]})]})}export{se as default}; diff --git a/dist/assets/js/NeuralNetworkBackground-CER-dIFD.js b/dist/assets/js/NeuralNetworkBackground-CER-dIFD.js new file mode 100644 index 0000000..f40826b --- /dev/null +++ b/dist/assets/js/NeuralNetworkBackground-CER-dIFD.js @@ -0,0 +1 @@ +import{j as M}from"./query-vendor-BLVqILA6.js";import{r as c}from"./router-vendor-D4by-_6Z.js";const E=()=>{const l=c.useRef(null),h=c.useRef(),n=c.useRef([]);return c.useEffect(()=>{const e=l.current;if(!e)return;const r=e.getContext("2d");if(!r)return;const f=()=>{e.width=window.innerWidth,e.height=window.innerHeight},u=()=>{const t=Math.floor(e.width*e.height/15e3);n.current=[];for(let a=0;a{r.beginPath(),r.arc(t.x,t.y,2,0,Math.PI*2),r.fillStyle="rgba(147, 197, 253, 0.8)",r.fill()},y=(t,a,i,o)=>{const s=1-i/o;r.beginPath(),r.moveTo(t.x,t.y),r.lineTo(a.x,a.y),r.strokeStyle=`rgba(147, 197, 253, ${s*.3})`,r.lineWidth=1,r.stroke()},v=()=>{n.current.forEach(t=>{t.x+=t.vx,t.y+=t.vy,(t.x<0||t.x>e.width)&&(t.vx*=-1),(t.y<0||t.y>e.height)&&(t.vy*=-1),t.x=Math.max(0,Math.min(e.width,t.x)),t.y=Math.max(0,Math.min(e.height,t.y))})},x=()=>{r.clearRect(0,0,e.width,e.height);const t=r.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,"#0f172a"),t.addColorStop(.5,"#1e1b4b"),t.addColorStop(1,"#581c87"),r.fillStyle=t,r.fillRect(0,0,e.width,e.height),v();const a=120;for(let i=0;i{f(),u()};return window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m),h.current&&cancelAnimationFrame(h.current)}},[]),M.jsx("canvas",{ref:l,className:"fixed inset-0 w-full h-full -z-10",style:{background:"linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #581c87 100%)"}})};export{E as N}; diff --git a/dist/assets/js/ObraDetails-S1VcIvXW.js b/dist/assets/js/ObraDetails-S1VcIvXW.js new file mode 100644 index 0000000..be88b3b --- /dev/null +++ b/dist/assets/js/ObraDetails-S1VcIvXW.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{c as j,r as m,L as i}from"./router-vendor-D4by-_6Z.js";import{T as f}from"./ThemeToggle-Cryh6OOS.js";import{o as w,j as k,F as h,n as p,c as x,m as l,X as N,q as _,v as C,U as D,l as u,P as b,w as R,b as T}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const S=[{id:"1",data:"2024-01-15",status:"aprovado",responsavel:"João Silva",atividades:5,ocorrencias:0},{id:"2",data:"2024-01-14",status:"aprovado",responsavel:"Maria Santos",atividades:3,ocorrencias:1},{id:"3",data:"2024-01-13",status:"enviado",responsavel:"Pedro Costa",atividades:4,ocorrencias:0},{id:"4",data:"2024-01-12",status:"rascunho",responsavel:"Ana Costa",atividades:2,ocorrencias:0},{id:"5",data:"2024-01-11",status:"aprovado",responsavel:"Carlos Lima",atividades:6,ocorrencias:2}],F=[{id:"1",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20concrete%20foundation%20work%20modern%20building&image_size=landscape_4_3",data:"2024-01-15",descricao:"Fundação do edifício"},{id:"2",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20workers%20steel%20structure%20building%20site&image_size=landscape_4_3",data:"2024-01-14",descricao:"Estrutura metálica"},{id:"3",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20concrete%20pouring%20workers%20safety%20equipment&image_size=landscape_4_3",data:"2024-01-13",descricao:"Concretagem da laje"},{id:"4",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20electrical%20installation%20modern%20building&image_size=landscape_4_3",data:"2024-01-12",descricao:"Instalações elétricas"},{id:"5",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20plumbing%20installation%20modern%20building&image_size=landscape_4_3",data:"2024-01-11",descricao:"Instalações hidráulicas"}],P=d=>{switch(d){case"aprovado":return e.jsx(x,{className:"w-4 h-4 text-green-500"});case"enviado":return e.jsx(T,{className:"w-4 h-4 text-yellow-500"});case"rascunho":return e.jsx(R,{className:"w-4 h-4 text-gray-500"});default:return null}},I=d=>{switch(d){case"aprovado":return"text-green-600 bg-green-100 dark:bg-green-900/30 dark:text-green-400";case"enviado":return"text-yellow-600 bg-yellow-100 dark:bg-yellow-900/30 dark:text-yellow-400";case"rascunho":return"text-gray-600 bg-gray-100 dark:bg-gray-700 dark:text-gray-400";default:return"text-gray-600 bg-gray-100"}};function z(){const{id:d}=j(),[o,y]=m.useState("info"),r={id:d||"1",nome:"Edifício Residencial Aurora",endereco:"Rua das Flores, 123 - Centro",descricao:"Edifício residencial de 15 andares com 120 apartamentos",dataInicio:"2023-06-01",dataPrevistaFim:"2024-12-31",progresso:75,status:"ativa",responsavel:"Eng. Carlos Mendes"},[c,g]=m.useState(!1),[t,n]=m.useState(r);return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsxs("div",{className:"px-6 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(i,{to:"/",className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors",children:e.jsx(w,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:r.nome}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300 flex items-center gap-1",children:[e.jsx(k,{className:"w-4 h-4"}),r.endereco]})]})]}),e.jsx(f,{})]}),e.jsx("div",{className:"flex gap-1 bg-gray-100 dark:bg-gray-700 rounded-xl p-1 overflow-x-auto scrollbar-hide",children:[{key:"info",label:"Informações",icon:h},{key:"rdos",label:"RDOs",icon:h},{key:"fotos",label:"Fotos",icon:p},{key:"tarefas",label:"Tarefas",icon:x}].map(({key:a,label:s,icon:v})=>e.jsxs("button",{onClick:()=>y(a),className:`flex-1 min-w-fit flex items-center justify-center gap-2 py-2 px-4 rounded-lg text-sm font-medium transition-all whitespace-nowrap ${o===a?"bg-white dark:bg-gray-600 text-blue-600 dark:text-blue-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:[e.jsx(v,{className:"w-4 h-4"}),s]},a))})]})}),e.jsxs("div",{className:"px-6 py-6",children:[o==="info"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Detalhes da Obra"}),e.jsx("div",{className:"flex items-center gap-2",children:c?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{g(!1),n(r)},className:"flex items-center gap-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:[e.jsx(N,{className:"w-4 h-4"}),"Cancelar"]}),e.jsxs("button",{onClick:()=>{Object.assign(r,t),g(!1)},className:"flex items-center gap-2 px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(_,{className:"w-4 h-4"}),"Salvar"]})]}):e.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-2 px-3 py-2 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(C,{className:"w-4 h-4"}),"Editar"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Descrição"}),c?e.jsx("textarea",{value:t.descricao,onChange:a=>n({...t,descricao:a.target.value}),"aria-label":"Descrição da obra",className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",rows:3}):e.jsx("p",{className:"text-gray-900 dark:text-white",children:r.descricao})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Responsável"}),c?e.jsx("input",{type:"text",value:t.responsavel,onChange:a=>n({...t,responsavel:a.target.value}),"aria-label":"Responsável pela obra",className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent"}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),r.responsavel]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Data de Início"}),c?e.jsx("input",{type:"text",value:t.dataInicio,onChange:a=>n({...t,dataInicio:a.target.value}),className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let s=a.currentTarget.value.replace(/\D/g,"");s.length>=2&&(s=s.slice(0,2)+"/"+s.slice(2)),s.length>=5&&(s=s.slice(0,5)+"/"+s.slice(5,7)),a.currentTarget.value=s}}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),new Date(r.dataInicio).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Previsão de Término"}),c?e.jsx("input",{type:"text",value:t.dataPrevistaFim,onChange:a=>n({...t,dataPrevistaFim:a.target.value}),className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let s=a.currentTarget.value.replace(/\D/g,"");s.length>=2&&(s=s.slice(0,2)+"/"+s.slice(2)),s.length>=5&&(s=s.slice(0,5)+"/"+s.slice(5,7)),a.currentTarget.value=s}}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),new Date(r.dataPrevistaFim).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Progresso"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 h-3 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${r.progresso}%`}})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r.progresso,"%"]})]})]})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(i,{to:`/obra/${r.id}/rdo/novo`,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(b,{className:"w-5 h-5"}),"Criar RDO"]}),e.jsxs(i,{to:`/obra/${r.id}/tarefas`,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 bg-gray-600 text-white rounded-xl hover:bg-gray-700 transition-colors",children:[e.jsx(x,{className:"w-5 h-5"}),"Ver Tarefas"]})]})]}),o==="rdos"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Histórico de RDOs"}),e.jsxs(i,{to:`/obra/${r.id}/rdo/novo`,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),"Novo RDO"]})]}),S.map((a,s)=>e.jsx(l.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:s*.1},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-4 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:e.jsxs(i,{to:`/obra/${r.id}/rdo/${a.id}`,className:"block",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(h,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white",children:["RDO - ",new Date(a.data).toLocaleDateString("pt-BR")]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Por ",a.responsavel]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[P(a.status),e.jsx("span",{className:`px-2 py-1 rounded-lg text-xs font-medium ${I(a.status)}`,children:a.status.charAt(0).toUpperCase()+a.status.slice(1)})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:[a.atividades," atividades"]}),e.jsxs("span",{children:[a.ocorrencias," ocorrências"]})]})]})},a.id))]}),o==="fotos"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Galeria de Fotos"}),e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(p,{className:"w-4 h-4"}),"Adicionar Foto"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:F.map((a,s)=>e.jsxs(l.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:s*.1},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl overflow-hidden border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsx("div",{className:"aspect-square overflow-hidden",children:e.jsx("img",{src:a.url,alt:a.descricao,className:"w-full h-full object-cover hover:scale-110 transition-transform duration-300"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white mb-1",children:a.descricao}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:new Date(a.data).toLocaleDateString("pt-BR")})]})]},a.id))})]}),o==="tarefas"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Tarefas da Obra"}),e.jsx(i,{to:`/obra/${r.id}/tarefas`,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:"Ver Todas"})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg text-center",children:[e.jsx(x,{className:"w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Acesse a página de tarefas para ver o controle completo"})]})]})]})]})}export{z as default}; diff --git a/dist/assets/js/ObraTasks-Cy-rxhIo.js b/dist/assets/js/ObraTasks-Cy-rxhIo.js new file mode 100644 index 0000000..19c0d56 --- /dev/null +++ b/dist/assets/js/ObraTasks-Cy-rxhIo.js @@ -0,0 +1 @@ +var xe=Object.defineProperty;var ge=(n,t,s)=>t in n?xe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var z=(n,t,s)=>ge(n,typeof t!="symbol"?t+"":t,s);import{j as e}from"./query-vendor-BLVqILA6.js";import{r as d,c as me,L as H}from"./router-vendor-D4by-_6Z.js";import{T as ue}from"./ThemeToggle-Cryh6OOS.js";import{A as w,m as h,X as he,b as Q,k as Z,l as ee,w as ae,a5 as be,g as R,a6 as P,a7 as V,a8 as L,o as pe,P as ye,S as G,d as fe,h as K,a9 as je,aa as ke,E as ve,F as Ne,j as we}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const Te={inicio:"Tarefa Iniciada",pausa:"Tarefa Pausada",retomada:"Tarefa Retomada",conclusao:"Tarefa Concluída",revisao:"Tarefa Revisada",edicao:"Tarefa Editada",cancelamento:"Tarefa Cancelada"},Ce={inicio:"text-blue-600 bg-blue-100 dark:bg-blue-900/30",pausa:"text-yellow-600 bg-yellow-100 dark:bg-yellow-900/30",retomada:"text-blue-600 bg-blue-100 dark:bg-blue-900/30",conclusao:"text-green-600 bg-green-100 dark:bg-green-900/30",revisao:"text-purple-600 bg-purple-100 dark:bg-purple-900/30",edicao:"text-orange-600 bg-orange-100 dark:bg-orange-900/30",cancelamento:"text-red-600 bg-red-100 dark:bg-red-900/30"},W="task_logs",k=class k{constructor(){z(this,"logs",{});this.loadFromStorage()}static getInstance(){return k.instance||(k.instance=new k),k.instance}loadFromStorage(){try{const t=localStorage.getItem(W);t&&(this.logs=JSON.parse(t))}catch{this.logs={}}}saveToStorage(){try{localStorage.setItem(W,JSON.stringify(this.logs))}catch{}}addEvent(t,s,o="Usuário Atual",l,i){const x=new Date().toISOString();this.logs[t]||(this.logs[t]={taskId:t,eventos:[],criadoEm:x,atualizadoEm:x});const p={id:`${t}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,taskId:t,type:s,timestamp:x,usuario:o,...l!==void 0&&{descricao:l},...i!==void 0&&{detalhes:i}};this.logs[t].eventos.push(p),this.logs[t].atualizadoEm=x,this.saveToStorage()}getTaskLog(t){return this.logs[t]||null}getTaskEvents(t){const s=this.getTaskLog(t);return s?s.eventos.sort((o,l)=>new Date(l.timestamp).getTime()-new Date(o.timestamp).getTime()):[]}getAllLogs(){return{...this.logs}}clearTaskLog(t){delete this.logs[t],this.saveToStorage()}clearAllLogs(){this.logs={},this.saveToStorage()}logTaskStart(t,s){this.addEvent(t,"inicio",s,"Tarefa iniciada")}logTaskPause(t,s){this.addEvent(t,"pausa",s,"Tarefa pausada")}logTaskResume(t,s){this.addEvent(t,"retomada",s,"Tarefa retomada")}logTaskComplete(t,s){this.addEvent(t,"conclusao",s,"Tarefa concluída")}logTaskEdit(t,s,o,l){const i={camposAlterados:s,...l!==void 0&&{observacoes:l}};this.addEvent(t,"edicao",o,`Tarefa editada: ${s.join(", ")}`,i)}logTaskCancel(t,s,o){const l=o!==void 0?{observacoes:o}:void 0;this.addEvent(t,"cancelamento",s,"Tarefa cancelada",l)}logStatusChange(t,s,o,l){let i,x;switch(o){case"em_andamento":i=s==="pausada"?"retomada":"inicio",x=s==="pausada"?"Tarefa retomada":"Tarefa iniciada";break;case"pausada":i="pausa",x="Tarefa pausada";break;case"concluida":i="conclusao",x="Tarefa concluída";break;case"cancelada":i="cancelamento",x="Tarefa cancelada";break;default:i="edicao",x=`Status alterado de ${s} para ${o}`}this.addEvent(t,i,l,x,{statusAnterior:s,statusNovo:o})}};z(k,"instance");let I=k;const te=I.getInstance(),E=(n,t,s,o)=>{let l;switch(t){case"start":l="inicio";break;case"resume":l="retomada";break;case"pause":l="pausa";break;case"complete":l="conclusao";break;case"edit":l="edicao";break;case"cancel":l="cancelamento";break;default:l="edicao"}te.addEvent(n,l,o,s)},Ee={Play:L,Pause:V,CheckCircle2:P,Edit3:R,RotateCcw:be,X:ae},Se=({isOpen:n,onClose:t,taskId:s,taskTitle:o})=>{const[l,i]=d.useState([]),[x,p]=d.useState(!0);d.useEffect(()=>{n&&s&&D()},[n,s]);const D=()=>{p(!0);try{const r=te.getTaskEvents(s);i(r)}catch{i([])}finally{p(!1)}},v=r=>{const u=new Date(r);return{date:u.toLocaleDateString("pt-BR"),time:u.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}},A=r=>Ee[r==="inicio"||r==="retomada"?"Play":r==="pausa"?"Pause":r==="conclusao"?"CheckCircle2":r==="edicao"?"Edit3":r==="revisao"?"RotateCcw":"X"],S=r=>{const u=new Date,N=new Date(r),y=Math.floor((u.getTime()-N.getTime())/(1e3*60));if(y<1)return"Agora mesmo";if(y<60)return`${y} min atrás`;const b=Math.floor(y/60);if(b<24)return`${b}h atrás`;const f=Math.floor(b/24);return f<7?`${f} dia${f>1?"s":""} atrás`:v(r).date};return n?e.jsx(w,{children:e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs(h.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-2xl max-h-[80vh] overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 px-6 py-4 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold mb-1",children:"Histórico da Tarefa"}),e.jsx("p",{className:"text-blue-100 text-sm truncate",children:o})]}),e.jsx("button",{onClick:t,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:e.jsx(he,{className:"w-5 h-5"})})]})}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:x?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-300",children:"Carregando histórico..."})]}):l.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Q,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Nenhum evento registrado"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Esta tarefa ainda não possui histórico de atividades."})]}):e.jsx("div",{className:"space-y-4",children:l.map((r,u)=>{const N=A(r.type),{date:y,time:b}=v(r.timestamp),f=u===0,T=u===l.length-1;return e.jsxs(h.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:u*.05},className:"relative",children:[!T&&e.jsx("div",{className:"absolute left-6 top-12 w-0.5 h-full bg-gray-200 dark:bg-gray-700 -z-10"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:`flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center ${Ce[r.type]} ${f?"ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-gray-800":""}`,children:e.jsx(N,{className:"w-5 h-5"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-gray-900 dark:text-white",children:Te[r.type]}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:S(r.timestamp)})]}),r.descricao&&e.jsx("p",{className:"text-gray-700 dark:text-gray-300 text-sm mb-3",children:r.descricao}),r.detalhes&&e.jsxs("div",{className:"space-y-2 text-sm",children:[r.detalhes.statusAnterior&&r.detalhes.statusNovo&&e.jsxs("div",{className:"flex items-center gap-2 text-gray-600 dark:text-gray-400",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"font-medium",children:r.detalhes.statusAnterior}),e.jsx("span",{children:"→"}),e.jsx("span",{className:"font-medium",children:r.detalhes.statusNovo})]}),r.detalhes.camposAlterados&&r.detalhes.camposAlterados.length>0&&e.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:[e.jsx("span",{children:"Campos alterados: "}),e.jsx("span",{className:"font-medium",children:r.detalhes.camposAlterados.join(", ")})]}),r.detalhes.observacoes&&e.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:[e.jsx("span",{children:"Observações: "}),e.jsx("span",{className:"font-medium",children:r.detalhes.observacoes})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-3 pt-3 border-t border-gray-200 dark:border-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[e.jsx(Z,{className:"w-3 h-3"}),e.jsx("span",{children:r.usuario})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-3 h-3"}),e.jsxs("span",{children:[y," às ",b]})]})]})]})})]})]},r.id)})})})]})})}):null},_e=[{id:"1",titulo:"Concretagem da Laje do 2º Pavimento",descricao:"Executar a concretagem da laje do segundo pavimento conforme projeto estrutural",obra_id:"1",obra_nome:"Edifício Residencial Aurora",responsavel:"João Silva",prioridade:"alta",status:"em_andamento",data_inicio:"2024-01-15",data_prazo:"2024-01-18",progresso:65,tempo_estimado:16,tempo_trabalhado:10.5,categoria:"Estrutura",localizacao:"2º Pavimento",anexos:3,comentarios:2},{id:"2",titulo:"Instalação Elétrica - Sala 201",descricao:"Instalação completa do sistema elétrico da sala 201",obra_id:"1",obra_nome:"Edifício Residencial Aurora",responsavel:"Carlos Santos",prioridade:"media",status:"pendente",data_inicio:"2024-01-20",data_prazo:"2024-01-25",progresso:0,tempo_estimado:12,tempo_trabalhado:0,categoria:"Elétrica",localizacao:"2º Pavimento - Sala 201",anexos:1,comentarios:0},{id:"3",titulo:"Impermeabilização da Cobertura",descricao:"Aplicação de manta asfáltica na cobertura do edifício",obra_id:"1",obra_nome:"Edifício Residencial Aurora",responsavel:"Pedro Costa",prioridade:"critica",status:"pausada",data_inicio:"2024-01-12",data_prazo:"2024-01-16",progresso:30,tempo_estimado:24,tempo_trabalhado:7,categoria:"Impermeabilização",localizacao:"Cobertura",anexos:2,comentarios:4},{id:"4",titulo:"Pintura Externa - Fachada Norte",descricao:"Aplicação de tinta acrílica na fachada norte do edifício",obra_id:"1",obra_nome:"Edifício Residencial Aurora",responsavel:"Ana Costa",prioridade:"baixa",status:"pendente",data_inicio:"2024-01-25",data_prazo:"2024-02-05",progresso:0,tempo_estimado:32,tempo_trabalhado:0,categoria:"Acabamento",localizacao:"Fachada Norte",anexos:0,comentarios:1}],F={pendente:{label:"Pendente",color:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",icon:ke},em_andamento:{label:"Em Andamento",color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",icon:L},pausada:{label:"Pausada",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300",icon:V},concluida:{label:"Concluída",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",icon:P},cancelada:{label:"Cancelada",color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",icon:je}},Y={baixa:{label:"Baixa",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},media:{label:"Média",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},alta:{label:"Alta",color:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300"},critica:{label:"Crítica",color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300"}};function ze(){const{id:n}=me(),[t,s]=d.useState([]),[o,l]=d.useState(""),[i,x]=d.useState("todos"),[p,D]=d.useState("todas"),[v,A]=d.useState(!1),[S,r]=d.useState(null),[u,N]=d.useState(null),[y,b]=d.useState(!1),[f,T]=d.useState(null),[re,C]=d.useState(!1),[j,O]=d.useState(null),[B,U]=d.useState(!1),[$,q]=d.useState(null);d.useEffect(()=>{const a=_e.filter(c=>c.obra_id===n);s(a),a.length>0&&N({nome:a[0].obra_nome})},[n]);const J=t.filter(a=>{const c=a.titulo.toLowerCase().includes(o.toLowerCase())||a.descricao.toLowerCase().includes(o.toLowerCase())||a.responsavel.toLowerCase().includes(o.toLowerCase()),m=i==="todos"||a.status===i,g=p==="todas"||a.prioridade===p;return c&&m&&g}),_=(a,c)=>{const m=t.find(g=>g.id===a);m&&(c==="em_andamento"&&m.status==="pendente"?E(a,"start","Tarefa iniciada"):c==="em_andamento"&&m.status==="pausada"?E(a,"resume","Tarefa retomada"):c==="pausada"?E(a,"pause","Tarefa pausada"):c==="concluida"&&E(a,"complete","Tarefa concluída")),s(t.map(g=>g.id===a?{...g,status:c}:g))},se=a=>{q(a),U(!0),r(null)},le=a=>{E(a.id,"edit","Tarefa editada"),O(a),C(!0),r(null)},oe=a=>{T(a),b(!0),r(null)},ie=()=>{f&&(s(t.filter(a=>a.id!==f)),T(null),b(!1))},X=()=>{T(null),b(!1)},de=a=>{const c=new Date,g=new Date(a).getTime()-c.getTime();return Math.ceil(g/(1e3*60*60*24))},ne=(a,c)=>c==="concluida"?"bg-green-500":c==="cancelada"?"bg-red-500":a>=80?"bg-green-500":a>=50?"bg-yellow-500":"bg-blue-500",ce=({task:a})=>{const c=F[a.status].icon,m=de(a.data_prazo),g=m<0,M=m<=2&&m>=0;return e.jsxs(h.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg",children:a.titulo}),(g||M)&&e.jsx(ae,{className:`w-5 h-5 ${g?"text-red-500":"text-yellow-500"}`})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300 text-sm mb-3",children:a.descricao})]}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>r(S===a.id?null:a.id),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(ve,{className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),e.jsx(w,{children:S===a.id&&e.jsx(h.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute right-0 top-full mt-2 w-48 bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{onClick:()=>se(a.id),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(Ne,{className:"w-4 h-4"}),"Ver Log"]}),e.jsxs("button",{onClick:()=>le(a),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.jsx(R,{className:"w-4 h-4"}),"Editar"]}),e.jsxs("button",{onClick:()=>oe(a.id),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[e.jsx(K,{className:"w-4 h-4"}),"Excluir"]})]})})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsxs("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${F[a.status].color}`,children:[e.jsx(c,{className:"w-3 h-3 inline mr-1"}),F[a.status].label]}),e.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${Y[a.prioridade].color}`,children:Y[a.prioridade].label}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-xs font-medium",children:a.categoria})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Progresso"}),e.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[a.progresso,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:e.jsx(h.div,{initial:{width:0},animate:{width:`${a.progresso}%`},transition:{duration:.5,ease:"easeOut"},className:`h-2 rounded-full ${ne(a.progresso,a.status)}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.responsavel})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.localizacao||"Não especificado"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),e.jsx("span",{className:`text-sm ${g?"text-red-600 dark:text-red-400 font-medium":M?"text-yellow-600 dark:text-yellow-400 font-medium":"text-gray-600 dark:text-gray-300"}`,children:g?`${Math.abs(m)} dias atrasado`:m===0?"Vence hoje":`${m} dias restantes`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[a.tempo_trabalhado,"h / ",a.tempo_estimado,"h"]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[a.status==="pendente"&&e.jsxs("button",{onClick:()=>_(a.id,"em_andamento"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-4 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(L,{className:"w-4 h-4"}),"Iniciar"]}),a.status==="em_andamento"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>_(a.id,"pausada"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-4 bg-yellow-600 text-white rounded-xl hover:bg-yellow-700 transition-colors",children:[e.jsx(V,{className:"w-4 h-4"}),"Pausar"]}),e.jsxs("button",{onClick:()=>_(a.id,"concluida"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-4 bg-green-600 text-white rounded-xl hover:bg-green-700 transition-colors",children:[e.jsx(P,{className:"w-4 h-4"}),"Concluir"]})]}),a.status==="pausada"&&e.jsxs("button",{onClick:()=>_(a.id,"em_andamento"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-4 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(L,{className:"w-4 h-4"}),"Retomar"]}),a.status==="concluida"&&e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 py-2 px-4 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 rounded-xl",children:[e.jsx(P,{className:"w-4 h-4"}),"Concluída"]})]})]})};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsxs("div",{className:"px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(H,{to:`/obra/${n}`,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx(pe,{className:"w-5 h-5 text-gray-600 dark:text-gray-300"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Tarefas da Obra"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:u?.nome||"Carregando..."})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ue,{}),e.jsxs(H,{to:`/obra/${n}/tarefa/nova`,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors shadow-lg",children:[e.jsx(ye,{className:"w-5 h-5"}),"Nova Tarefa"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(G,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 dark:text-gray-500"}),e.jsx("input",{type:"text",placeholder:"Buscar tarefas...",value:o,onChange:a=>l(a.target.value),className:"w-full pl-10 pr-4 py-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("button",{onClick:()=>A(!v),className:`flex items-center gap-2 px-4 py-3 rounded-xl border transition-colors ${v?"bg-blue-100 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300":"bg-white/50 dark:bg-gray-700/50 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600"}`,children:[e.jsx(fe,{className:"w-5 h-5"}),"Filtros"]})]}),e.jsx(w,{children:v&&e.jsxs(h.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 bg-white/50 dark:bg-gray-700/50 rounded-xl border border-gray-200 dark:border-gray-600",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Status"}),e.jsxs("select",{value:i,onChange:a=>x(a.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white",children:[e.jsx("option",{value:"todos",children:"Todos os Status"}),e.jsx("option",{value:"pendente",children:"Pendente"}),e.jsx("option",{value:"em_andamento",children:"Em Andamento"}),e.jsx("option",{value:"pausada",children:"Pausada"}),e.jsx("option",{value:"concluida",children:"Concluída"}),e.jsx("option",{value:"cancelada",children:"Cancelada"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Prioridade"}),e.jsxs("select",{value:p,onChange:a=>D(a.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white",children:[e.jsx("option",{value:"todas",children:"Todas as Prioridades"}),e.jsx("option",{value:"baixa",children:"Baixa"}),e.jsx("option",{value:"media",children:"Média"}),e.jsx("option",{value:"alta",children:"Alta"}),e.jsx("option",{value:"critica",children:"Crítica"})]})]})]})})]})]})}),e.jsx("div",{className:"px-6 py-6",children:J.length===0?e.jsx(h.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-12",children:e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-8 border border-gray-200/50 dark:border-gray-700/50 shadow-lg max-w-md mx-auto",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(G,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Nenhuma tarefa encontrada"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:t.length===0?"Esta obra ainda não possui tarefas cadastradas":"Tente ajustar os filtros ou criar uma nova tarefa"})]})}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(w,{children:J.map(a=>e.jsx(ce,{task:a},a.id))})})}),e.jsx(w,{children:y&&e.jsx(h.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:X,children:e.jsxs(h.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl p-6 max-w-md w-full shadow-xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center",children:e.jsx(K,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Excluir Tarefa"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Esta ação não pode ser desfeita"})]})]}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-6",children:"Tem certeza que deseja excluir esta tarefa? Todos os dados relacionados serão perdidos permanentemente."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:X,className:"flex-1 px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-xl hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancelar"}),e.jsx("button",{onClick:ie,className:"flex-1 px-4 py-2 bg-red-600 text-white rounded-xl hover:bg-red-700 transition-colors",children:"Excluir"})]})]})})}),e.jsxs(w,{children:[re&&j&&e.jsx(h.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>C(!1),children:e.jsxs(h.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white dark:bg-gray-800 rounded-2xl p-6 max-w-2xl w-full shadow-xl max-h-[90vh] overflow-y-auto",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Editar Tarefa"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Modifique os dados da tarefa"})]})]}),e.jsx("button",{onClick:()=>C(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Título"}),e.jsx("input",{type:"text",defaultValue:j.titulo,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Descrição"}),e.jsx("textarea",{rows:3,defaultValue:j.descricao,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Status"}),e.jsxs("select",{defaultValue:j.status,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white",children:[e.jsx("option",{value:"pendente",children:"Pendente"}),e.jsx("option",{value:"em_andamento",children:"Em Andamento"}),e.jsx("option",{value:"pausada",children:"Pausada"}),e.jsx("option",{value:"concluida",children:"Concluída"}),e.jsx("option",{value:"cancelada",children:"Cancelada"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Prioridade"}),e.jsxs("select",{defaultValue:j.prioridade,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white",children:[e.jsx("option",{value:"baixa",children:"Baixa"}),e.jsx("option",{value:"media",children:"Média"}),e.jsx("option",{value:"alta",children:"Alta"}),e.jsx("option",{value:"critica",children:"Crítica"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Responsável"}),e.jsx("input",{type:"text",defaultValue:j.responsavel,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Progresso (%)"}),e.jsx("input",{type:"number",min:"0",max:"100",defaultValue:j.progresso,className:"w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400"})]})]})]}),e.jsxs("div",{className:"flex gap-3 mt-6",children:[e.jsx("button",{onClick:()=>C(!1),className:"flex-1 px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded-xl hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:"Cancelar"}),e.jsx("button",{onClick:()=>{C(!1),O(null)},className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:"Salvar Alterações"})]})]})})," "]}),B&&$&&e.jsx(Se,{taskId:$,taskTitle:t.find(a=>a.id===$)?.titulo||"Tarefa",isOpen:B,onClose:()=>{U(!1),q(null)}})]})}export{ze as default}; diff --git a/dist/assets/js/RDODetails-tkR9ftO-.js b/dist/assets/js/RDODetails-tkR9ftO-.js new file mode 100644 index 0000000..a65cfae --- /dev/null +++ b/dist/assets/js/RDODetails-tkR9ftO-.js @@ -0,0 +1,5 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as n,c as R,d as O}from"./router-vendor-D4by-_6Z.js";import{T}from"./ThemeToggle-Cryh6OOS.js";import{s as l}from"./index-doec96Hx.js";import{T as y,R as S,o as E,F as k,W as p,U as j,n as u,m as i,l as L,k as $,j as A,x as P,c as v,b as U,v as z}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const B=s=>{const[b,x]=n.useState(null),[d,g]=n.useState(!0),[r,m]=n.useState(null),o=n.useCallback(async()=>{if(s)try{g(!0),m(null);const{data:c,error:h}=await l.from("rdos").select(` + *, + obra:obras(*), + criador:usuarios!rdos_criado_por_fkey(*) + `).eq("id",s).single();if(h)throw h;if(!c)throw new Error("RDO não encontrado");const[{data:a},{data:t},{data:w},{data:f},{data:_},{data:C},{data:q}]=await Promise.all([l.from("rdo_atividades").select("*").eq("rdo_id",s).order("ordem"),l.from("rdo_mao_obra").select("*").eq("rdo_id",s),l.from("rdo_equipamentos").select("*").eq("rdo_id",s),l.from("rdo_ocorrencias").select("*").eq("rdo_id",s),l.from("rdo_anexos").select("*").eq("rdo_id",s),l.from("rdo_inspecoes_solda").select("*").eq("rdo_id",s),l.from("rdo_verificacoes_torque").select("*").eq("rdo_id",s)]),D={...c,atividades:a||[],mao_obra:t||[],equipamentos:w||[],ocorrencias:f||[],anexos:_||[],inspecoes_solda:C||[],verificacoes_torque:q||[]};x(D)}catch(c){m(c.message||"Erro ao carregar RDO")}finally{g(!1)}},[s]);return n.useEffect(()=>{o()},[o]),{rdo:b,loading:d,error:r,refetch:o}},F=s=>{switch(s){case"rascunho":return"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300";case"enviado":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300";case"aprovado":return"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300";case"rejeitado":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}},G=s=>{switch(s){case"rascunho":return e.jsx(z,{className:"w-4 h-4"});case"enviado":return e.jsx(U,{className:"w-4 h-4"});case"aprovado":return e.jsx(v,{className:"w-4 h-4"});default:return e.jsx(k,{className:"w-4 h-4"})}},N=s=>s.toLowerCase().includes("crítica")||s.toLowerCase().includes("grave")?"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300":s.toLowerCase().includes("atenção")||s.toLowerCase().includes("alerta")?"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300":"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300";function Y(){const{obraId:s,rdoId:b}=R(),x=O(),[d,g]=n.useState("geral"),{rdo:r,loading:m,error:o,refetch:c}=B(b),h=[{id:"geral",label:"Geral",icon:k},{id:"atividades",label:"Atividades",icon:p},{id:"recursos",label:"Recursos",icon:j},{id:"ocorrencias",label:"Ocorrências",icon:y},{id:"fotos",label:"Fotos",icon:u}];return m?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Carregando detalhes do RDO..."})]})}):o||!r?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl shadow-lg border border-red-200 dark:border-red-900/30 max-w-md w-full text-center",children:[e.jsx(y,{className:"w-12 h-12 text-red-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:"Erro ao carregar RDO"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:o||"RDO não encontrado."}),e.jsxs("div",{className:"flex gap-3 justify-center",children:[e.jsx("button",{onClick:()=>x(-1),className:"px-4 py-2 bg-gray-200 dark:bg-gray-700 rounded-lg text-gray-800 dark:text-white hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors",children:"Voltar"}),e.jsxs("button",{onClick:c,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4"})," Tentar Novamente"]})]})]})}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50 sticky top-0 z-10 transition-all",children:e.jsx("div",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(`/obra/${s}`),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors",title:"Voltar para a obra",children:e.jsx(E,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:["RDO - ",new Date(r.data_relatorio).toLocaleDateString("pt-BR")]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:r.obra?.nome||"Obra não identificada"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:`flex items-center gap-2 px-3 py-1 rounded-lg text-sm font-medium ${F(r.status)}`,children:[G(r.status),r.status.charAt(0).toUpperCase()+r.status.slice(1)]}),e.jsx(T,{})]})]})})}),e.jsx("div",{className:"px-6 py-4 overflow-x-auto",children:e.jsx("div",{className:"flex gap-2 min-w-max",children:h.map(a=>{const t=a.icon;return e.jsxs("button",{onClick:()=>g(a.id),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-medium transition-colors whitespace-nowrap ${d===a.id?"bg-blue-600 text-white shadow-md":"bg-white/70 dark:bg-gray-800/70 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[e.jsx(t,{className:"w-4 h-4"}),a.label]},a.id)})})}),e.jsxs("div",{className:"px-6 pb-8 max-w-7xl mx-auto",children:[d==="geral"&&e.jsxs(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Informações Básicas"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Data"}),e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(L,{className:"w-4 h-4"}),new Date(r.data_relatorio).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Responsável"}),e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4"}),r.criador?.nome||"Carregando..."]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Clima"}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:r.condicoes_climaticas})]})]})]}),r.observacoes_gerais&&e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Observações Gerais"}),e.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:r.observacoes_gerais})]})]}),d==="atividades"&&e.jsx(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-4",children:r.atividades&&r.atividades.length>0?r.atividades.map((a,t)=>e.jsx(i.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.05},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:border-blue-200/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-lg text-xs font-medium",children:a.tipo_atividade})}),e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:a.descricao}),a.localizacao&&e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(A,{className:"w-3 h-3"}),a.localizacao]})]}),a.percentual_concluido!=null&&e.jsxs("div",{className:"text-right min-w-[80px]",children:[e.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-1",children:[a.percentual_concluido,"%"]}),e.jsx("div",{className:"w-full h-2 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${a.percentual_concluido}%`},role:"progressbar","aria-label":"Progresso da atividade"})})]})]})},a.id)):e.jsxs("div",{className:"text-center p-8 bg-white/50 dark:bg-gray-800/50 rounded-2xl",children:[e.jsx(p,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500",children:"Nenhuma atividade registrada."})]})}),d==="recursos"&&e.jsxs(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(j,{className:"w-5 h-5"}),"Mão de Obra"]}),e.jsx("div",{className:"space-y-3",children:r.mao_obra&&r.mao_obra.length>0?r.mao_obra.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700/50 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:a.funcao}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Qtd: ",a.quantidade]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[a.horas_trabalhadas,"h"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"trabalhadas"})]})]},a.id)):e.jsx("p",{className:"text-gray-500 italic text-sm",children:"Nenhuma mão de obra registrada."})})]}),e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5"}),"Equipamentos"]}),e.jsx("div",{className:"space-y-3",children:r.equipamentos&&r.equipamentos.length>0?r.equipamentos.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700/50 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:a.nome_equipamento}),a.tipo&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a.tipo})]}),e.jsx("div",{className:"text-right",children:e.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[a.horas_utilizadas,"h uso"]})})]},a.id)):e.jsx("p",{className:"text-gray-500 italic text-sm",children:"Nenhum equipamento registrado."})})]})]}),d==="ocorrencias"&&e.jsx(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-4",children:r.ocorrencias&&r.ocorrencias.length>0?r.ocorrencias.map((a,t)=>e.jsx(i.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.05},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-4 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${N(a.gravidade||"normal")}`,children:e.jsx(y,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-1 rounded-lg text-xs font-medium ${N(a.gravidade||"normal")}`,children:(a.gravidade||"Geral").toUpperCase()}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:a.tipo_ocorrencia})]}),e.jsx("p",{className:"text-gray-900 dark:text-white mt-2",children:a.descricao}),a.acao_tomada&&e.jsxs("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400 border-l-2 border-gray-300 pl-3",children:[e.jsx("span",{className:"font-semibold",children:"Ação tomada:"})," ",a.acao_tomada]})]})]})},a.id)):e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-8 border border-gray-200/50 dark:border-gray-700/50 shadow-lg text-center",children:[e.jsx(v,{className:"w-12 h-12 text-green-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Nenhuma ocorrência registrada neste dia"})]})}),d==="fotos"&&e.jsx(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"space-y-4",children:r.anexos&&r.anexos.filter(a=>a.tipo_arquivo?.startsWith("image/")||!0).length>0?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:r.anexos.map((a,t)=>e.jsxs(i.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:t*.05},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl overflow-hidden border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300 group relative",children:[e.jsx("div",{className:"aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:a.url_storage?e.jsx("img",{src:a.url_storage,alt:a.descricao||`Foto ${t+1}`,className:"w-full h-full object-cover hover:scale-110 transition-transform duration-500"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-400",children:e.jsx(u,{className:"w-8 h-8"})})}),a.descricao&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 p-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("p",{className:"text-white text-xs truncate",children:a.descricao})})]},t))}):e.jsxs("div",{className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-8 border border-gray-200/50 dark:border-gray-700/50 shadow-lg text-center",children:[e.jsx(u,{className:"w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Nenhuma foto encontrada neste RDO"})]})})]})]})}export{Y as default}; diff --git a/dist/assets/js/Reports-BmqmPZPj.js b/dist/assets/js/Reports-BmqmPZPj.js new file mode 100644 index 0000000..375f912 --- /dev/null +++ b/dist/assets/js/Reports-BmqmPZPj.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{r as d}from"./router-vendor-D4by-_6Z.js";import{T as S}from"./ThemeToggle-Cryh6OOS.js";import{S as G,d as p,A as x,m as l,l as j,B as D,F as g,W as E,ae as z,C as k,U,b as I,T as B,c as P,e as M,f as q,a3 as v,ao as L,M as O,ap as $}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const V=[{id:"1",title:"Relatório de Obras",description:"Status geral das obras em andamento",type:"obras",icon:D,data:{total:15,em_andamento:8,concluidas:5,pausadas:2,progresso_medio:67},lastGenerated:"2024-01-15T10:30:00",status:"updated"},{id:"2",title:"Relatório de RDOs",description:"Análise dos relatórios diários de obra",type:"rdos",icon:g,data:{total_mes:124,pendentes:8,aprovados:110,rejeitados:6,media_diaria:4.1},lastGenerated:"2024-01-15T09:15:00",status:"updated"},{id:"3",title:"Relatório de Equipamentos",description:"Status e utilização dos equipamentos",type:"equipamentos",icon:E,data:{total:45,em_uso:32,disponivel:8,manutencao:3,inativo:2,taxa_utilizacao:71},lastGenerated:"2024-01-15T08:45:00",status:"updated"},{id:"4",title:"Relatório de Produtividade",description:"Análise de produtividade por obra e equipe",type:"produtividade",icon:z,data:{eficiencia_media:85,horas_trabalhadas:1240,atividades_concluidas:89,atrasos:12,meta_mensal:95},lastGenerated:"2024-01-15T07:20:00",status:"outdated"},{id:"5",title:"Relatório Financeiro",description:"Custos e orçamentos das obras",type:"financeiro",icon:k,data:{orcamento_total:125e5,gasto_atual:875e4,economia:125e3,obras_no_orcamento:12,obras_acima_orcamento:3},lastGenerated:"2024-01-14T16:30:00",status:"outdated"},{id:"6",title:"Relatório de Usuários",description:"Atividade e engajamento dos usuários",type:"usuarios",icon:U,data:{total_usuarios:28,ativos_mes:24,novos_cadastros:3,ultimo_acesso_medio:2,rdos_por_usuario:4.4},lastGenerated:"2024-01-15T11:00:00",status:"updated"}],i={updated:{label:"Atualizado",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",icon:P},outdated:{label:"Desatualizado",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300",icon:B},generating:{label:"Gerando...",color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",icon:I}},W=[{id:"pdf",label:"PDF",icon:g},{id:"excel",label:"Excel",icon:k},{id:"csv",label:"CSV",icon:g}];function Y(){const[u,N]=d.useState(null),[n,f]=d.useState(!1),[m,w]=d.useState("pdf"),[b,y]=d.useState({dateRange:{start:"2024-01-01",end:"2024-01-31"},obras:[],status:[],usuarios:[]}),[_,h]=d.useState([]),o=a=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(a),R=a=>new Date(a).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),T=async a=>{h(t=>[...t,a]),setTimeout(()=>{h(t=>t.filter(c=>c!==a))},3e3)},C=(a,t)=>{},F=({report:a})=>{const t=a.icon,c=i[a.status].icon,r=_.includes(a.id);return e.jsxs(l.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center",children:e.jsx(t,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg",children:a.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.description})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${r?i.generating.color:i[a.status].color}`,children:[e.jsx(c,{className:"w-3 h-3"}),r?"Gerando...":i[a.status].label]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[a.type==="obras"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.em_andamento}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Em Andamento"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:[a.data.progresso_medio,"%"]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Progresso Médio"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600 dark:text-orange-400",children:a.data.concluidas}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Concluídas"})]})]}),a.type==="rdos"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total_mes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total do Mês"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.aprovados}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Aprovados"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.data.pendentes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Pendentes"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:a.data.media_diaria}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Média Diária"})]})]}),a.type==="equipamentos"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.em_uso}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Em Uso"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:[a.data.taxa_utilizacao,"%"]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Taxa Utilização"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.data.manutencao}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Manutenção"})]})]}),a.type==="financeiro"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"col-span-2 text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:o(a.data.orcamento_total)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Orçamento Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:o(a.data.gasto_atual)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Gasto Atual"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:o(a.data.economia)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Economia"})]})]}),(a.type==="produtividade"||a.type==="usuarios")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.type==="produtividade"?`${a.data.eficiencia_media}%`:a.data.total_usuarios}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Eficiência":"Total Usuários"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.type==="produtividade"?a.data.atividades_concluidas:a.data.ativos_mes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Atividades":"Ativos"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.type==="produtividade"?a.data.horas_trabalhadas:a.data.novos_cadastros}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Horas":"Novos"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:a.type==="produtividade"?a.data.atrasos:a.data.rdos_por_usuario}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Atrasos":"RDOs/Usuário"})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Última atualização: ",R(a.lastGenerated)]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>N(u===a.id?null:a.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-900/50 transition-colors",children:[e.jsx(M,{className:"w-4 h-4"}),"Visualizar"]}),e.jsxs("button",{onClick:()=>T(a.id),disabled:r,className:"flex items-center justify-center gap-2 px-4 py-2 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 rounded-lg hover:bg-green-200 dark:hover:bg-green-900/50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[r?e.jsx(l.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:e.jsx(q,{className:"w-4 h-4"})}):e.jsx(v,{className:"w-4 h-4"}),r?"Gerando...":"Gerar"]})]}),e.jsx(x,{children:u===a.id&&e.jsxs(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Exportar Relatório"}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-3",children:W.map(s=>{const A=s.icon;return e.jsxs("button",{onClick:()=>w(s.id),className:`flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${m===s.id?"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-300 dark:border-blue-600":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[e.jsx(A,{className:"w-4 h-4"}),s.label]},s.id)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>C(a.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(v,{className:"w-4 h-4"}),"Exportar ",m.toUpperCase()]}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx(L,{className:"w-4 h-4"})}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx($,{className:"w-4 h-4"})})]})]})})]})};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsxs("div",{className:"px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Relatórios"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Análises e relatórios consolidados do sistema"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(G,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar relatórios...",className:"pl-12 pr-4 py-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent w-64"})]}),e.jsx(S,{}),e.jsxs("button",{onClick:()=>f(!n),className:`flex items-center gap-2 px-6 py-3 rounded-xl border transition-colors ${n?"bg-blue-100 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300":"bg-white/50 dark:bg-gray-700/50 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600"}`,children:[e.jsx(p,{className:"w-5 h-5"}),"Filtros Avançados"]})]})]}),e.jsx(x,{children:n&&e.jsxs(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/50 dark:bg-gray-700/50 rounded-xl p-4 mb-6 border border-gray-200 dark:border-gray-600",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(j,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Data Início"]}),e.jsx("input",{type:"text",value:b.dateRange.start,onChange:a=>y(t=>({...t,dateRange:{...t.dateRange,start:a.target.value}})),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let t=a.currentTarget.value.replace(/\D/g,"");t.length>=2&&(t=t.slice(0,2)+"/"+t.slice(2)),t.length>=5&&(t=t.slice(0,5)+"/"+t.slice(5,7)),a.currentTarget.value=t}})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(j,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Data Fim"]}),e.jsx("input",{type:"text",value:b.dateRange.end,onChange:a=>y(t=>({...t,dateRange:{...t.dateRange,end:a.target.value}})),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let t=a.currentTarget.value.replace(/\D/g,"");t.length>=2&&(t=t.slice(0,2)+"/"+t.slice(2)),t.length>=5&&(t=t.slice(0,5)+"/"+t.slice(5,7)),a.currentTarget.value=t}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Obras"}),e.jsxs("select",{className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Todas as obras"}),e.jsx("option",{value:"1",children:"Edifício Residencial Aurora"}),e.jsx("option",{value:"2",children:"Centro Comercial Plaza"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(p,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Status"]}),e.jsxs("select",{className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Todos os status"}),e.jsx("option",{value:"updated",children:"Atualizado"}),e.jsx("option",{value:"outdated",children:"Desatualizado"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{className:"px-4 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:"Limpar Filtros"}),e.jsx("button",{className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Aplicar Filtros"})]})]})})]})}),e.jsx("div",{className:"px-6 py-6",children:e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(x,{children:V.map(a=>e.jsx(F,{report:a},a.id))})})})]})}export{Y as default}; diff --git a/dist/assets/js/SelectOrganization-Cb4zDKko.js b/dist/assets/js/SelectOrganization-Cb4zDKko.js new file mode 100644 index 0000000..f89668c --- /dev/null +++ b/dist/assets/js/SelectOrganization-Cb4zDKko.js @@ -0,0 +1 @@ +import{j as e}from"./query-vendor-BLVqILA6.js";import{d as I,r as a}from"./router-vendor-D4by-_6Z.js";import{s as m}from"./index-doec96Hx.js";import{u as U}from"./useInviteCode-BxOSdQOT.js";import{N as B}from"./NeuralNetworkBackground-CER-dIFD.js";import{B as O,$ as D,a2 as f,a0 as b,aq as V,p as F,c as j,ar as L}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";import"./supabase-vendor-CnnNSQLo.js";import"./state-vendor-DHadhBU5.js";const $=()=>{const i=I(),{loading:o,validarConvite:w,usarConvite:N}=U(),[r,v]=a.useState(""),[l,c]=a.useState("input"),[d,u]=a.useState(null),[x,n]=a.useState(""),[y,C]=a.useState(""),[k,z]=a.useState("");a.useEffect(()=>{(async()=>{const{data:{user:t}}=await m.auth.getUser();if(!t){i("/login");return}z(t.id),C(t.user_metadata?.full_name||t.user_metadata?.nome||t.email?.split("@")[0]||"Usuário");const{data:p}=await m.from("usuarios").select("organizacao_id").eq("id",t.id).single();p&&p.organizacao_id&&i("/dashboard")})()},[i]);const h=async()=>{if(!r.trim()){n("Digite o código de convite.");return}n("");const s=await w(r);s.success?(u({organizacao_nome:s.organizacao_nome||"Organização",organizacao_id:s.organizacao_id||"",role:s.role||"usuario"}),c("confirm")):n(s.error||"Código inválido.")},S=async()=>{const s=await N(r,k);s.success?(c("success"),setTimeout(()=>{i("/dashboard"),window.location.reload()},2e3)):(n(s.error||"Erro ao ingressar na organização."),c("error"))},_=async()=>{await m.auth.signOut(),i("/login")},g=()=>{c("input"),u(null),n("")},E=s=>({admin:"Administrador",engenheiro:"Engenheiro",mestre_obra:"Mestre de Obra",usuario:"Usuário"})[s]||s;return e.jsxs("div",{className:"min-h-screen relative flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8 overflow-hidden",children:[e.jsx(B,{}),e.jsxs("div",{className:"relative z-10 max-w-lg w-full space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl shadow-lg border border-white/20 p-6 inline-block mb-4",children:e.jsx(O,{className:"w-16 h-16 text-blue-300 mx-auto"})}),e.jsxs("h1",{className:"text-3xl font-bold text-white mb-2",children:["Bem-vindo, ",y,"!"]}),e.jsx("p",{className:"text-blue-200 text-lg",children:"Para acessar o sistema, informe o código de convite da sua organização."})]}),e.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl shadow-2xl border border-white/20 p-8 transition-all duration-300",children:[l==="input"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(D,{className:"w-6 h-6 text-yellow-300"}),e.jsx("h2",{className:"text-xl font-semibold text-white",children:"Código de Convite"})]}),e.jsx("p",{className:"text-blue-200 text-sm",children:"Solicite o código de convite ao administrador da sua organização. O código é composto por 8 caracteres alfanuméricos."}),x&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-500/20 border border-red-400/30 rounded-xl",children:[e.jsx(f,{className:"w-5 h-5 text-red-300 flex-shrink-0"}),e.jsx("p",{className:"text-red-200 text-sm",children:x})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Digite o código"}),e.jsx("input",{type:"text",value:r,onChange:s=>v(s.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,8)),placeholder:"Ex: A1B2C3D4",maxLength:8,className:"w-full px-4 py-4 bg-white/10 border border-white/20 rounded-xl text-white text-center text-2xl font-mono tracking-[0.3em] placeholder-blue-200/50 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 uppercase",onKeyDown:s=>s.key==="Enter"&&h(),autoFocus:!0})]}),e.jsx("button",{onClick:h,disabled:o||r.length<4,className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-blue-500 to-purple-600 text-white py-3 px-6 rounded-xl hover:from-blue-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-lg hover:shadow-xl font-semibold",children:o?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-5 h-5 animate-spin"}),"Verificando..."]}):e.jsxs(e.Fragment,{children:["Verificar Código",e.jsx(V,{className:"w-5 h-5"})]})})]}),l==="confirm"&&d&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(F,{className:"w-6 h-6 text-green-300"}),e.jsx("h2",{className:"text-xl font-semibold text-white",children:"Confirmar Ingresso"})]}),e.jsxs("div",{className:"p-4 bg-green-500/10 border border-green-400/30 rounded-xl space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-green-200 text-sm",children:"Organização:"}),e.jsx("span",{className:"text-white font-semibold text-lg",children:d.organizacao_nome})]}),e.jsx("div",{className:"h-px bg-green-400/20"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-green-200 text-sm",children:"Seu cargo será:"}),e.jsx("span",{className:"text-white font-medium",children:E(d.role)})]}),e.jsx("div",{className:"h-px bg-green-400/20"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-green-200 text-sm",children:"Código:"}),e.jsx("span",{className:"text-white font-mono",children:r})]})]}),e.jsx("p",{className:"text-blue-200 text-sm text-center",children:"Deseja ingressar nesta organização?"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:g,disabled:o,className:"flex-1 py-3 px-4 bg-white/10 border border-white/20 text-white rounded-xl hover:bg-white/20 transition-all duration-200 font-medium",children:"Voltar"}),e.jsx("button",{onClick:S,disabled:o,className:"flex-1 flex items-center justify-center gap-2 bg-gradient-to-r from-green-500 to-emerald-600 text-white py-3 px-4 rounded-xl hover:from-green-600 hover:to-emerald-700 transition-all duration-200 font-semibold shadow-lg",children:o?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-5 h-5 animate-spin"}),"Ingressando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-5 h-5"}),"Confirmar"]})})]})]}),l==="success"&&e.jsxs("div",{className:"text-center space-y-4 py-4",children:[e.jsx(j,{className:"w-20 h-20 text-green-400 mx-auto animate-bounce"}),e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Bem-vindo à equipe!"}),e.jsxs("p",{className:"text-green-200",children:["Você ingressou na organização ",e.jsx("strong",{children:d?.organizacao_nome})," com sucesso!"]}),e.jsx("p",{className:"text-blue-200 text-sm",children:"Redirecionando para o painel..."}),e.jsx("div",{className:"w-full bg-white/10 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-green-400 h-2 rounded-full animate-pulse w-2/3"})})]}),l==="error"&&e.jsxs("div",{className:"text-center space-y-4 py-4",children:[e.jsx(f,{className:"w-20 h-20 text-red-400 mx-auto"}),e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Erro ao Ingressar"}),e.jsx("p",{className:"text-red-200",children:x}),e.jsx("button",{onClick:g,className:"mt-4 py-3 px-6 bg-white/10 border border-white/20 text-white rounded-xl hover:bg-white/20 transition-all duration-200 font-medium",children:"Tentar Novamente"})]})]}),e.jsx("div",{className:"text-center",children:e.jsxs("button",{onClick:_,className:"inline-flex items-center gap-2 text-blue-200 hover:text-white transition-colors duration-200 text-sm",children:[e.jsx(L,{className:"w-4 h-4"}),"Sair e usar outra conta"]})}),e.jsx("div",{className:"text-center text-sm text-gray-300",children:e.jsx("p",{className:"italic",children:"Desenvolvido por TrackSteel"})})]})]})};export{$ as default}; diff --git a/dist/assets/js/ThemeToggle-Cryh6OOS.js b/dist/assets/js/ThemeToggle-Cryh6OOS.js new file mode 100644 index 0000000..788e427 --- /dev/null +++ b/dist/assets/js/ThemeToggle-Cryh6OOS.js @@ -0,0 +1 @@ +import{j as a}from"./query-vendor-BLVqILA6.js";import{r as o}from"./router-vendor-D4by-_6Z.js";import{m as s,I as l,am as i}from"./ui-vendor-CyRvbSfR.js";function n(){const[t,e]=o.useState(()=>{const r=localStorage.getItem("theme");return r||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});return o.useEffect(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(t),localStorage.setItem("theme",t)},[t]),{theme:t,toggleTheme:()=>{e(r=>r==="light"?"dark":"light")},isDark:t==="dark"}}function h(){const{toggleTheme:t,isDark:e}=n();return a.jsx(s.button,{onClick:t,className:"relative p-2 rounded-xl bg-white/70 dark:bg-gray-800/70 backdrop-blur-md border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300 group",whileHover:{scale:1.05},whileTap:{scale:.95},title:e?"Alternar para modo claro":"Alternar para modo escuro",children:a.jsxs("div",{className:"relative w-6 h-6",children:[a.jsx(s.div,{initial:!1,animate:{scale:e?0:1,rotate:e?180:0,opacity:e?0:1},transition:{duration:.3,ease:"easeInOut"},className:"absolute inset-0 flex items-center justify-center",children:a.jsx(l,{className:"w-5 h-5 text-yellow-500 group-hover:text-yellow-600"})}),a.jsx(s.div,{initial:!1,animate:{scale:e?1:0,rotate:e?0:-180,opacity:e?1:0},transition:{duration:.3,ease:"easeInOut"},className:"absolute inset-0 flex items-center justify-center",children:a.jsx(i,{className:"w-5 h-5 text-blue-400 group-hover:text-blue-300"})})]})})}export{h as T}; diff --git a/dist/assets/js/configStore-DS-p50om.js b/dist/assets/js/configStore-DS-p50om.js new file mode 100644 index 0000000..7dea429 --- /dev/null +++ b/dist/assets/js/configStore-DS-p50om.js @@ -0,0 +1 @@ +import{p as v}from"./index-doec96Hx.js";import{c as C}from"./state-vendor-DHadhBU5.js";const s=[{id:"1",nome:"Escavação",ativo:!0,ordem:1},{id:"2",nome:"Fundação",ativo:!0,ordem:2},{id:"3",nome:"Concretagem",ativo:!0,ordem:3},{id:"4",nome:"Alvenaria",ativo:!0,ordem:4},{id:"5",nome:"Instalação Elétrica",ativo:!0,ordem:5},{id:"6",nome:"Instalação Hidráulica",ativo:!0,ordem:6},{id:"7",nome:"Revestimento",ativo:!0,ordem:7},{id:"8",nome:"Pintura",ativo:!0,ordem:8}],c=[{id:"1",nome:"Ensolarado",valor:"ensolarado",ativo:!0,ordem:1,icone:"Sun"},{id:"2",nome:"Parcialmente Nublado",valor:"parcialmente_nublado",ativo:!0,ordem:2,icone:"Cloud"},{id:"3",nome:"Nublado",valor:"nublado",ativo:!0,ordem:3,icone:"Cloud"},{id:"4",nome:"Chuvisco",valor:"chuvisco",ativo:!0,ordem:4,icone:"CloudRain"},{id:"5",nome:"Chuva Leve",valor:"chuva_leve",ativo:!0,ordem:5,icone:"CloudRain"},{id:"6",nome:"Chuva Forte",valor:"chuva_forte",ativo:!0,ordem:6,icone:"CloudRain"}],m=[{id:"1",nome:"Acidente de Trabalho",ativo:!0,ordem:1,cor:"#ef4444"},{id:"2",nome:"Atraso na Entrega",ativo:!0,ordem:2,cor:"#f59e0b"},{id:"3",nome:"Problema de Qualidade",ativo:!0,ordem:3,cor:"#f59e0b"},{id:"4",nome:"Falta de Material",ativo:!0,ordem:4,cor:"#f59e0b"},{id:"5",nome:"Problema Climático",ativo:!0,ordem:5,cor:"#6b7280"},{id:"6",nome:"Equipamento Quebrado",ativo:!0,ordem:6,cor:"#ef4444"},{id:"7",nome:"Outros",ativo:!0,ordem:7,cor:"#6b7280"}],u=[{id:"1",nome:"Pedreiro",ativo:!0,ordem:1},{id:"2",nome:"Servente",ativo:!0,ordem:2},{id:"3",nome:"Armador",ativo:!0,ordem:3},{id:"4",nome:"Encarregado",ativo:!0,ordem:4},{id:"5",nome:"Mestre de Obras",ativo:!0,ordem:5},{id:"6",nome:"Engenheiro Civil",ativo:!0,ordem:6},{id:"7",nome:"Arquiteto",ativo:!0,ordem:7},{id:"8",nome:"Eletricista",ativo:!0,ordem:8},{id:"9",nome:"Encanador",ativo:!0,ordem:9},{id:"10",nome:"Pintor",ativo:!0,ordem:10}],p=[{id:"1",nome:"Betoneira",ativo:!0,ordem:1},{id:"2",nome:"Guindaste",ativo:!0,ordem:2},{id:"3",nome:"Escavadeira",ativo:!0,ordem:3},{id:"4",nome:"Guincho de Coluna",ativo:!0,ordem:4},{id:"5",nome:"Compactador",ativo:!0,ordem:5},{id:"6",nome:"Furadeira",ativo:!0,ordem:6},{id:"7",nome:"Serra Circular",ativo:!0,ordem:7},{id:"8",nome:"Andaime",ativo:!0,ordem:8}],l=[{id:"1",nome:"Cimento",ativo:!0,ordem:1},{id:"2",nome:"Areia",ativo:!0,ordem:2},{id:"3",nome:"Brita",ativo:!0,ordem:3},{id:"4",nome:"Ferro/Aço",ativo:!0,ordem:4},{id:"5",nome:"Tijolo",ativo:!0,ordem:5},{id:"6",nome:"Bloco de Concreto",ativo:!0,ordem:6},{id:"7",nome:"Madeira",ativo:!0,ordem:7},{id:"8",nome:"Tinta",ativo:!0,ordem:8},{id:"9",nome:"Argamassa",ativo:!0,ordem:9},{id:"10",nome:"Cerâmica",ativo:!0,ordem:10}],n=()=>Date.now().toString()+Math.random().toString(36).substr(2,9),d=C()(v((r,t)=>({tiposAtividade:s,condicoesClimaticas:c,tiposOcorrencia:m,funcoesCargos:u,tiposEquipamento:p,materiais:l,addTipoAtividade:o=>r(e=>({tiposAtividade:[...e.tiposAtividade,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateTipoAtividade:(o,e)=>r(i=>({tiposAtividade:i.tiposAtividade.map(a=>a.id===o?{...a,...e}:a)})),deleteTipoAtividade:o=>r(e=>({tiposAtividade:e.tiposAtividade.filter(i=>i.id!==o)})),reorderTiposAtividade:o=>r(()=>({tiposAtividade:o})),addCondicaoClimatica:o=>r(e=>({condicoesClimaticas:[...e.condicoesClimaticas,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateCondicaoClimatica:(o,e)=>r(i=>({condicoesClimaticas:i.condicoesClimaticas.map(a=>a.id===o?{...a,...e}:a)})),deleteCondicaoClimatica:o=>r(e=>({condicoesClimaticas:e.condicoesClimaticas.filter(i=>i.id!==o)})),reorderCondicoesClimaticas:o=>r(()=>({condicoesClimaticas:o})),addTipoOcorrencia:o=>r(e=>({tiposOcorrencia:[...e.tiposOcorrencia,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateTipoOcorrencia:(o,e)=>r(i=>({tiposOcorrencia:i.tiposOcorrencia.map(a=>a.id===o?{...a,...e}:a)})),deleteTipoOcorrencia:o=>r(e=>({tiposOcorrencia:e.tiposOcorrencia.filter(i=>i.id!==o)})),reorderTiposOcorrencia:o=>r(()=>({tiposOcorrencia:o})),addFuncaoCargo:o=>r(e=>({funcoesCargos:[...e.funcoesCargos,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateFuncaoCargo:(o,e)=>r(i=>({funcoesCargos:i.funcoesCargos.map(a=>a.id===o?{...a,...e}:a)})),deleteFuncaoCargo:o=>r(e=>({funcoesCargos:e.funcoesCargos.filter(i=>i.id!==o)})),reorderFuncoesCargos:o=>r(()=>({funcoesCargos:o})),addTipoEquipamento:o=>r(e=>({tiposEquipamento:[...e.tiposEquipamento,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateTipoEquipamento:(o,e)=>r(i=>({tiposEquipamento:i.tiposEquipamento.map(a=>a.id===o?{...a,...e}:a)})),deleteTipoEquipamento:o=>r(e=>({tiposEquipamento:e.tiposEquipamento.filter(i=>i.id!==o)})),reorderTiposEquipamento:o=>r(()=>({tiposEquipamento:o})),addMaterial:o=>r(e=>({materiais:[...e.materiais,{...o,id:n()}].sort((i,a)=>i.ordem-a.ordem)})),updateMaterial:(o,e)=>r(i=>({materiais:i.materiais.map(a=>a.id===o?{...a,...e}:a)})),deleteMaterial:o=>r(e=>({materiais:e.materiais.filter(i=>i.id!==o)})),reorderMateriais:o=>r(()=>({materiais:o})),resetToDefaults:()=>r(()=>({tiposAtividade:s,condicoesClimaticas:c,tiposOcorrencia:m,funcoesCargos:u,tiposEquipamento:p,materiais:l})),exportConfig:()=>{const o=d.getState();return JSON.stringify({tiposAtividade:o.tiposAtividade,condicoesClimaticas:o.condicoesClimaticas,tiposOcorrencia:o.tiposOcorrencia,funcoesCargos:o.funcoesCargos,tiposEquipamento:o.tiposEquipamento,materiais:o.materiais},null,2)},importConfig:o=>{try{const e=JSON.parse(o);r(()=>({tiposAtividade:e.tiposAtividade||s,condicoesClimaticas:e.condicoesClimaticas||c,tiposOcorrencia:e.tiposOcorrencia||m,funcoesCargos:e.funcoesCargos||u,tiposEquipamento:e.tiposEquipamento||p,materiais:e.materiais||l}))}catch{}}}),{name:"rdo-config-storage",version:1})),E=()=>{const{tiposAtividade:r,addTipoAtividade:t,updateTipoAtividade:o,deleteTipoAtividade:e,reorderTiposAtividade:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}},T=()=>{const{condicoesClimaticas:r,addCondicaoClimatica:t,updateCondicaoClimatica:o,deleteCondicaoClimatica:e,reorderCondicoesClimaticas:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}},A=()=>{const{tiposOcorrencia:r,addTipoOcorrencia:t,updateTipoOcorrencia:o,deleteTipoOcorrencia:e,reorderTiposOcorrencia:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}},O=()=>{const{funcoesCargos:r,addFuncaoCargo:t,updateFuncaoCargo:o,deleteFuncaoCargo:e,reorderFuncoesCargos:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}},q=()=>{const{tiposEquipamento:r,addTipoEquipamento:t,updateTipoEquipamento:o,deleteTipoEquipamento:e,reorderTiposEquipamento:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}},b=()=>{const{materiais:r,addMaterial:t,updateMaterial:o,deleteMaterial:e,reorderMateriais:i}=d();return{items:r.filter(a=>a.ativo),allItems:r,add:t,update:o,delete:e,reorder:i}};export{T as a,O as b,A as c,q as d,b as e,d as f,E as u}; diff --git a/dist/assets/js/form-vendor-vQotxSmE.js b/dist/assets/js/form-vendor-vQotxSmE.js new file mode 100644 index 0000000..d0bbff6 --- /dev/null +++ b/dist/assets/js/form-vendor-vQotxSmE.js @@ -0,0 +1 @@ +import{R as J}from"./router-vendor-D4by-_6Z.js";var $e=t=>t.type==="checkbox",ke=t=>t instanceof Date,W=t=>t==null;const nr=t=>typeof t=="object";var $=t=>!W(t)&&!Array.isArray(t)&&nr(t)&&!ke(t),Cr=t=>$(t)&&t.target?$e(t.target)?t.target.checked:t.target.value:t,Tr=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Or=(t,e)=>t.has(Tr(e)),Vr=t=>{const e=t.constructor&&t.constructor.prototype;return $(e)&&e.hasOwnProperty("isPrototypeOf")},mt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function B(t){let e;const r=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(mt&&(t instanceof Blob||s))&&(r||$(t)))if(e=r?[]:Object.create(Object.getPrototypeOf(t)),!r&&!Vr(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=B(t[a]));else return t;return e}var Qe=t=>/^\w*$/.test(t),M=t=>t===void 0,yt=t=>Array.isArray(t)?t.filter(Boolean):[],pt=t=>yt(t.replace(/["|']|\]/g,"").split(/\.|\[/)),_=(t,e,r)=>{if(!e||!$(t))return r;const s=(Qe(e)?[e]:pt(e)).reduce((a,i)=>W(a)?a:a[i],t);return M(s)||s===t?M(t[e])?r:t[e]:s},ie=t=>typeof t=="boolean",F=(t,e,r)=>{let s=-1;const a=Qe(e)?[e]:pt(e),i=a.length,o=i-1;for(;++s{const a={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(a,i,{get:()=>{const o=i;return e._proxyFormState[o]!==ee.all&&(e._proxyFormState[o]=!s||ee.all),t[o]}});return a};const Rr=typeof window<"u"?J.useLayoutEffect:J.useEffect;var Y=t=>typeof t=="string",Fr=(t,e,r,s,a)=>Y(t)?(s&&e.watch.add(t),_(r,t,a)):Array.isArray(t)?t.map(i=>(s&&e.watch.add(i),_(r,i))):(s&&(e.watchAll=!0),r),ot=t=>W(t)||!nr(t);function ye(t,e,r=new WeakSet){if(ot(t)||ot(e))return t===e;if(ke(t)&&ke(e))return t.getTime()===e.getTime();const s=Object.keys(t),a=Object.keys(e);if(s.length!==a.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const i of s){const o=t[i];if(!a.includes(i))return!1;if(i!=="ref"){const d=e[i];if(ke(o)&&ke(d)||$(o)&&$(d)||Array.isArray(o)&&Array.isArray(d)?!ye(o,d,r):o!==d)return!1}}return!0}var Ir=(t,e,r,s,a)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:a||!0}}:{},Ze=t=>Array.isArray(t)?t:[t],Nt=()=>{let t=[];return{get observers(){return t},next:a=>{for(const i of t)i.next&&i.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(i=>i!==a)}}),unsubscribe:()=>{t=[]}}};function or(t,e){const r={};for(const s in t)if(t.hasOwnProperty(s)){const a=t[s],i=e[s];if(a&&$(a)&&i){const o=or(a,i);$(o)&&(r[s]=o)}else t[s]&&(r[s]=i)}return r}var H=t=>$(t)&&!Object.keys(t).length,gt=t=>t.type==="file",te=t=>typeof t=="function",ze=t=>{if(!mt)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},dr=t=>t.type==="select-multiple",_t=t=>t.type==="radio",Zr=t=>_t(t)||$e(t),it=t=>ze(t)&&t.isConnected;function Dr(t,e){const r=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(te(t[e]))return!0;return!1};function ur(t){return Array.isArray(t)||$(t)&&!Lr(t)}function dt(t,e={}){for(const r in t)ur(t[r])?(e[r]=Array.isArray(t[r])?[]:{},dt(t[r],e[r])):W(t[r])||(e[r]=!0);return e}function Se(t,e,r){r||(r=dt(e));for(const s in t)ur(t[s])?M(e)||ot(r[s])?r[s]=dt(t[s],Array.isArray(t[s])?[]:{}):Se(t[s],W(e)?{}:e[s],r[s]):r[s]=!ye(t[s],e[s]);return r}const Rt={value:!1,isValid:!1},Ft={value:!0,isValid:!0};var lr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!M(t[0].attributes.value)?M(t[0].value)||t[0].value===""?Ft:{value:t[0].value,isValid:!0}:Ft:Rt}return Rt},cr=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>M(t)?t:e?t===""?NaN:t&&+t:r&&Y(t)?new Date(t):s?s(t):t;const It={isValid:!1,value:null};var fr=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,It):It;function Zt(t){const e=t.ref;return gt(e)?e.files:_t(e)?fr(t.refs).value:dr(e)?[...e.selectedOptions].map(({value:r})=>r):$e(e)?lr(t.refs).value:cr(M(e.value)?t.ref.value:e.value,t)}var Mr=(t,e,r,s)=>{const a={};for(const i of t){const o=_(e,i);o&&F(a,i,o._f)}return{criteriaMode:r,names:[...t],fields:a,shouldUseNativeValidation:s}},We=t=>t instanceof RegExp,Fe=t=>M(t)?t:We(t)?t.source:$(t)?We(t.value)?t.value.source:t.value:t,Dt=t=>({isOnSubmit:!t||t===ee.onSubmit,isOnBlur:t===ee.onBlur,isOnChange:t===ee.onChange,isOnAll:t===ee.all,isOnTouch:t===ee.onTouched});const jt="AsyncFunction";var $r=t=>!!t&&!!t.validate&&!!(te(t.validate)&&t.validate.constructor.name===jt||$(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===jt)),Pr=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Lt=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const De=(t,e,r,s)=>{for(const a of r||Object.keys(t)){const i=_(t,a);if(i){const{_f:o,...d}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],a)&&!s)return!0;if(o.ref&&e(o.ref,o.name)&&!s)return!0;if(De(d,e))break}else if($(d)&&De(d,e))break}}};function Mt(t,e,r){const s=_(t,r);if(s||Qe(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const i=a.join("."),o=_(e,i),d=_(t,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(d&&d.type)return{name:i,error:d};if(d&&d.root&&d.root.type)return{name:`${i}.root`,error:d.root};a.pop()}return{name:r}}var Ur=(t,e,r,s)=>{r(t);const{name:a,...i}=t;return H(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===(!s||ee.all))},Br=(t,e,r)=>!t||!e||t===e||Ze(t).some(s=>s&&(r?s===e:s.startsWith(e)||e.startsWith(s))),zr=(t,e,r,s,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(e||t):(r?s.isOnBlur:a.isOnBlur)?!t:(r?s.isOnChange:a.isOnChange)?t:!0,Wr=(t,e)=>!yt(_(t,e)).length&&j(t,e),qr=(t,e,r)=>{const s=Ze(_(t,r));return F(s,"root",e[r]),F(t,r,s),t};function $t(t,e,r="validate"){if(Y(t)||Array.isArray(t)&&t.every(Y)||ie(t)&&!t)return{type:r,message:Y(t)?t:"",ref:e}}var Ae=t=>$(t)&&!We(t)?t:{value:t,message:""},Pt=async(t,e,r,s,a,i)=>{const{ref:o,refs:d,required:y,maxLength:g,minLength:k,min:I,max:C,pattern:Ne,validate:le,name:P,valueAsNumber:ce,mount:Xe}=t._f,E=_(r,P);if(!Xe||e.has(P))return{};const oe=d?d[0]:o,re=O=>{a&&oe.reportValidity&&(oe.setCustomValidity(ie(O)?"":O||""),oe.reportValidity())},U={},Pe=_t(o),fe=$e(o),Ke=Pe||fe,K=(ce||gt(o))&&M(o.value)&&M(E)||ze(o)&&o.value===""||E===""||Array.isArray(E)&&!E.length,xe=Ir.bind(null,P,s,U),se=(O,R,D,z=de.maxLength,q=de.minLength)=>{const ae=O?R:D;U[P]={type:O?z:q,message:ae,ref:o,...xe(O?z:q,ae)}};if(i?!Array.isArray(E)||!E.length:y&&(!Ke&&(K||W(E))||ie(E)&&!E||fe&&!lr(d).isValid||Pe&&!fr(d).isValid)){const{value:O,message:R}=Y(y)?{value:!!y,message:y}:Ae(y);if(O&&(U[P]={type:de.required,message:R,ref:oe,...xe(de.required,R)},!s))return re(R),U}if(!K&&(!W(I)||!W(C))){let O,R;const D=Ae(C),z=Ae(I);if(!W(E)&&!isNaN(E)){const q=o.valueAsNumber||E&&+E;W(D.value)||(O=q>D.value),W(z.value)||(R=qnew Date(new Date().toDateString()+" "+Ue),Re=o.type=="time",we=o.type=="week";Y(D.value)&&E&&(O=Re?ae(E)>ae(D.value):we?E>D.value:q>new Date(D.value)),Y(z.value)&&E&&(R=Re?ae(E)+O.value,z=!W(R.value)&&E.length<+R.value;if((D||z)&&(se(D,O.message,R.message),!s))return re(U[P].message),U}if(Ne&&!K&&Y(E)){const{value:O,message:R}=Ae(Ne);if(We(O)&&!E.match(O)&&(U[P]={type:de.pattern,message:R,ref:o,...xe(de.pattern,R)},!s))return re(R),U}if(le){if(te(le)){const O=await le(E,r),R=$t(O,oe);if(R&&(U[P]={...R,...xe(de.validate,R.message)},!s))return re(R.message),U}else if($(le)){let O={};for(const R in le){if(!H(O)&&!s)break;const D=$t(await le[R](E,r),oe,R);D&&(O={...D,...xe(R,D.message)},re(D.message),s&&(U[P]=O))}if(!H(O)&&(U[P]={ref:oe,...O},!s))return U}}return re(!0),U};const Hr={mode:ee.onSubmit,reValidateMode:ee.onChange,shouldFocusError:!0};function Jr(t={}){let e={...Hr,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=$(e.defaultValues)||$(e.values)?B(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:B(a),o={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},y,g=0;const k={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let I={...k};const C={array:Nt(),state:Nt()},Ne=e.criteriaMode===ee.all,le=n=>u=>{clearTimeout(g),g=setTimeout(n,u)},P=async n=>{if(!e.disabled&&(k.isValid||I.isValid||n)){const u=e.resolver?H((await fe()).errors):await K(s,!0);u!==r.isValid&&C.state.next({isValid:u})}},ce=(n,u)=>{!e.disabled&&(k.isValidating||k.validatingFields||I.isValidating||I.validatingFields)&&((n||Array.from(d.mount)).forEach(l=>{l&&(u?F(r.validatingFields,l,u):j(r.validatingFields,l))}),C.state.next({validatingFields:r.validatingFields,isValidating:!H(r.validatingFields)}))},Xe=(n,u=[],l,p,h=!0,f=!0)=>{if(p&&l&&!e.disabled){if(o.action=!0,f&&Array.isArray(_(s,n))){const b=l(_(s,n),p.argA,p.argB);h&&F(s,n,b)}if(f&&Array.isArray(_(r.errors,n))){const b=l(_(r.errors,n),p.argA,p.argB);h&&F(r.errors,n,b),Wr(r.errors,n)}if((k.touchedFields||I.touchedFields)&&f&&Array.isArray(_(r.touchedFields,n))){const b=l(_(r.touchedFields,n),p.argA,p.argB);h&&F(r.touchedFields,n,b)}(k.dirtyFields||I.dirtyFields)&&(r.dirtyFields=Se(a,i)),C.state.next({name:n,isDirty:se(n,u),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else F(i,n,u)},E=(n,u)=>{F(r.errors,n,u),C.state.next({errors:r.errors})},oe=n=>{r.errors=n,C.state.next({errors:r.errors,isValid:!1})},re=(n,u,l,p)=>{const h=_(s,n);if(h){const f=_(i,n,M(l)?_(a,n):l);M(f)||p&&p.defaultChecked||u?F(i,n,u?f:Zt(h._f)):D(n,f),o.mount&&P()}},U=(n,u,l,p,h)=>{let f=!1,b=!1;const N={name:n};if(!e.disabled){if(!l||p){(k.isDirty||I.isDirty)&&(b=r.isDirty,r.isDirty=N.isDirty=se(),f=b!==N.isDirty);const Z=ye(_(a,n),u);b=!!_(r.dirtyFields,n),Z?j(r.dirtyFields,n):F(r.dirtyFields,n,!0),N.dirtyFields=r.dirtyFields,f=f||(k.dirtyFields||I.dirtyFields)&&b!==!Z}if(l){const Z=_(r.touchedFields,n);Z||(F(r.touchedFields,n,l),N.touchedFields=r.touchedFields,f=f||(k.touchedFields||I.touchedFields)&&Z!==l)}f&&h&&C.state.next(N)}return f?N:{}},Pe=(n,u,l,p)=>{const h=_(r.errors,n),f=(k.isValid||I.isValid)&&ie(u)&&r.isValid!==u;if(e.delayError&&l?(y=le(()=>E(n,l)),y(e.delayError)):(clearTimeout(g),y=null,l?F(r.errors,n,l):j(r.errors,n)),(l?!ye(h,l):h)||!H(p)||f){const b={...p,...f&&ie(u)?{isValid:u}:{},errors:r.errors,name:n};r={...r,...b},C.state.next(b)}},fe=async n=>{ce(n,!0);const u=await e.resolver(i,e.context,Mr(n||d.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return ce(n),u},Ke=async n=>{const{errors:u}=await fe(n);if(n)for(const l of n){const p=_(u,l);p?F(r.errors,l,p):j(r.errors,l)}else r.errors=u;return u},K=async(n,u,l={valid:!0})=>{for(const p in n){const h=n[p];if(h){const{_f:f,...b}=h;if(f){const N=d.array.has(f.name),Z=h._f&&$r(h._f);Z&&k.validatingFields&&ce([f.name],!0);const Q=await Pt(h,d.disabled,i,Ne,e.shouldUseNativeValidation&&!u,N);if(Z&&k.validatingFields&&ce([f.name]),Q[f.name]&&(l.valid=!1,u))break;!u&&(_(Q,f.name)?N?qr(r.errors,Q,f.name):F(r.errors,f.name,Q[f.name]):j(r.errors,f.name))}!H(b)&&await K(b,u,l)}}return l.valid},xe=()=>{for(const n of d.unMount){const u=_(s,n);u&&(u._f.refs?u._f.refs.every(l=>!it(l)):!it(u._f.ref))&&et(n)}d.unMount=new Set},se=(n,u)=>!e.disabled&&(n&&u&&F(i,n,u),!ye(Ue(),a)),O=(n,u,l)=>Fr(n,d,{...o.mount?i:M(u)?a:Y(n)?{[n]:u}:u},l,u),R=n=>yt(_(o.mount?i:a,n,e.shouldUnregister?_(a,n,[]):[])),D=(n,u,l={})=>{const p=_(s,n);let h=u;if(p){const f=p._f;f&&(!f.disabled&&F(i,n,cr(u,f)),h=ze(f.ref)&&W(u)?"":u,dr(f.ref)?[...f.ref.options].forEach(b=>b.selected=h.includes(b.value)):f.refs?$e(f.ref)?f.refs.forEach(b=>{(!b.defaultChecked||!b.disabled)&&(Array.isArray(h)?b.checked=!!h.find(N=>N===b.value):b.checked=h===b.value||!!h)}):f.refs.forEach(b=>b.checked=b.value===h):gt(f.ref)?f.ref.value="":(f.ref.value=h,f.ref.type||C.state.next({name:n,values:B(i)})))}(l.shouldDirty||l.shouldTouch)&&U(n,h,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&we(n)},z=(n,u,l)=>{for(const p in u){if(!u.hasOwnProperty(p))return;const h=u[p],f=n+"."+p,b=_(s,f);(d.array.has(n)||$(h)||b&&!b._f)&&!ke(h)?z(f,h,l):D(f,h,l)}},q=(n,u,l={})=>{const p=_(s,n),h=d.array.has(n),f=B(u);F(i,n,f),h?(C.array.next({name:n,values:B(i)}),(k.isDirty||k.dirtyFields||I.isDirty||I.dirtyFields)&&l.shouldDirty&&C.state.next({name:n,dirtyFields:Se(a,i),isDirty:se(n,f)})):p&&!p._f&&!W(f)?z(n,f,l):D(n,f,l),Lt(n,d)&&C.state.next({...r,name:n}),C.state.next({name:o.mount?n:void 0,values:B(i)})},ae=async n=>{o.mount=!0;const u=n.target;let l=u.name,p=!0;const h=_(s,l),f=Z=>{p=Number.isNaN(Z)||ke(Z)&&isNaN(Z.getTime())||ye(Z,_(i,l,Z))},b=Dt(e.mode),N=Dt(e.reValidateMode);if(h){let Z,Q;const Be=u.type?Zt(h._f):Cr(n),he=n.type===Et.BLUR||n.type===Et.FOCUS_OUT,wr=!Pr(h._f)&&!e.resolver&&!_(r.errors,l)&&!h._f.deps||zr(he,_(r.touchedFields,l),r.isSubmitted,N,b),st=Lt(l,d,he);F(i,l,Be),he?(!u||!u.readOnly)&&(h._f.onBlur&&h._f.onBlur(n),y&&y(0)):h._f.onChange&&h._f.onChange(n);const at=U(l,Be,he),Ar=!H(at)||st;if(!he&&C.state.next({name:l,type:n.type,values:B(i)}),wr)return(k.isValid||I.isValid)&&(e.mode==="onBlur"?he&&P():he||P()),Ar&&C.state.next({name:l,...st?{}:at});if(!he&&st&&C.state.next({...r}),e.resolver){const{errors:Ot}=await fe([l]);if(f(Be),p){const Sr=Mt(r.errors,s,l),Vt=Mt(Ot,s,Sr.name||l);Z=Vt.error,l=Vt.name,Q=H(Ot)}}else ce([l],!0),Z=(await Pt(h,d.disabled,i,Ne,e.shouldUseNativeValidation))[l],ce([l]),f(Be),p&&(Z?Q=!1:(k.isValid||I.isValid)&&(Q=await K(s,!0)));p&&(h._f.deps&&(!Array.isArray(h._f.deps)||h._f.deps.length>0)&&we(h._f.deps),Pe(l,Q,Z,at))}},Re=(n,u)=>{if(_(r.errors,u)&&n.focus)return n.focus(),1},we=async(n,u={})=>{let l,p;const h=Ze(n);if(e.resolver){const f=await Ke(M(n)?n:h);l=H(f),p=n?!h.some(b=>_(f,b)):l}else n?(p=(await Promise.all(h.map(async f=>{const b=_(s,f);return await K(b&&b._f?{[f]:b}:b)}))).every(Boolean),!(!p&&!r.isValid)&&P()):p=l=await K(s);return C.state.next({...!Y(n)||(k.isValid||I.isValid)&&l!==r.isValid?{}:{name:n},...e.resolver||!n?{isValid:l}:{},errors:r.errors}),u.shouldFocus&&!p&&De(s,Re,n?h:d.mount),p},Ue=(n,u)=>{let l={...o.mount?i:a};return u&&(l=or(u.dirtyFields?r.dirtyFields:r.touchedFields,l)),M(n)?l:Y(n)?_(l,n):n.map(p=>_(l,p))},xt=(n,u)=>({invalid:!!_((u||r).errors,n),isDirty:!!_((u||r).dirtyFields,n),error:_((u||r).errors,n),isValidating:!!_(r.validatingFields,n),isTouched:!!_((u||r).touchedFields,n)}),pr=n=>{n&&Ze(n).forEach(u=>j(r.errors,u)),C.state.next({errors:n?r.errors:{}})},kt=(n,u,l)=>{const p=(_(s,n,{_f:{}})._f||{}).ref,h=_(r.errors,n)||{},{ref:f,message:b,type:N,...Z}=h;F(r.errors,n,{...Z,...u,ref:p}),C.state.next({name:n,errors:r.errors,isValid:!1}),l&&l.shouldFocus&&p&&p.focus&&p.focus()},gr=(n,u)=>te(n)?C.state.subscribe({next:l=>"values"in l&&n(O(void 0,u),l)}):O(n,u,!0),bt=n=>C.state.subscribe({next:u=>{Br(n.name,u.name,n.exact)&&Ur(u,n.formState||k,br,n.reRenderRoot)&&n.callback({values:{...i},...r,...u,defaultValues:a})}}).unsubscribe,_r=n=>(o.mount=!0,I={...I,...n.formState},bt({...n,formState:I})),et=(n,u={})=>{for(const l of n?Ze(n):d.mount)d.mount.delete(l),d.array.delete(l),u.keepValue||(j(s,l),j(i,l)),!u.keepError&&j(r.errors,l),!u.keepDirty&&j(r.dirtyFields,l),!u.keepTouched&&j(r.touchedFields,l),!u.keepIsValidating&&j(r.validatingFields,l),!e.shouldUnregister&&!u.keepDefaultValue&&j(a,l);C.state.next({values:B(i)}),C.state.next({...r,...u.keepDirty?{isDirty:se()}:{}}),!u.keepIsValid&&P()},wt=({disabled:n,name:u})=>{(ie(n)&&o.mount||n||d.disabled.has(u))&&(n?d.disabled.add(u):d.disabled.delete(u))},tt=(n,u={})=>{let l=_(s,n);const p=ie(u.disabled)||ie(e.disabled);return F(s,n,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:n}},name:n,mount:!0,...u}}),d.mount.add(n),l?wt({disabled:ie(u.disabled)?u.disabled:e.disabled,name:n}):re(n,!0,u.value),{...p?{disabled:u.disabled||e.disabled}:{},...e.progressive?{required:!!u.required,min:Fe(u.min),max:Fe(u.max),minLength:Fe(u.minLength),maxLength:Fe(u.maxLength),pattern:Fe(u.pattern)}:{},name:n,onChange:ae,onBlur:ae,ref:h=>{if(h){tt(n,u),l=_(s,n);const f=M(h.value)&&h.querySelectorAll&&h.querySelectorAll("input,select,textarea")[0]||h,b=Zr(f),N=l._f.refs||[];if(b?N.find(Z=>Z===f):f===l._f.ref)return;F(s,n,{_f:{...l._f,...b?{refs:[...N.filter(it),f,...Array.isArray(_(a,n))?[{}]:[]],ref:{type:f.type,name:n}}:{ref:f}}}),re(n,!1,void 0,f)}else l=_(s,n,{}),l._f&&(l._f.mount=!1),(e.shouldUnregister||u.shouldUnregister)&&!(Or(d.array,n)&&o.action)&&d.unMount.add(n)}}},rt=()=>e.shouldFocusError&&De(s,Re,d.mount),vr=n=>{ie(n)&&(C.state.next({disabled:n}),De(s,(u,l)=>{const p=_(s,l);p&&(u.disabled=p._f.disabled||n,Array.isArray(p._f.refs)&&p._f.refs.forEach(h=>{h.disabled=p._f.disabled||n}))},0,!1))},At=(n,u)=>async l=>{let p;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let h=B(i);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:f,values:b}=await fe();r.errors=f,h=B(b)}else await K(s);if(d.disabled.size)for(const f of d.disabled)j(h,f);if(j(r.errors,"root"),H(r.errors)){C.state.next({errors:{}});try{await n(h,l)}catch(f){p=f}}else u&&await u({...r.errors},l),rt(),setTimeout(rt);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(r.errors)&&!p,submitCount:r.submitCount+1,errors:r.errors}),p)throw p},xr=(n,u={})=>{_(s,n)&&(M(u.defaultValue)?q(n,B(_(a,n))):(q(n,u.defaultValue),F(a,n,B(u.defaultValue))),u.keepTouched||j(r.touchedFields,n),u.keepDirty||(j(r.dirtyFields,n),r.isDirty=u.defaultValue?se(n,B(_(a,n))):se()),u.keepError||(j(r.errors,n),k.isValid&&P()),C.state.next({...r}))},St=(n,u={})=>{const l=n?B(n):a,p=B(l),h=H(n),f=h?a:p;if(u.keepDefaultValues||(a=l),!u.keepValues){if(u.keepDirtyValues){const b=new Set([...d.mount,...Object.keys(Se(a,i))]);for(const N of Array.from(b))_(r.dirtyFields,N)?F(f,N,_(i,N)):q(N,_(f,N))}else{if(mt&&M(n))for(const b of d.mount){const N=_(s,b);if(N&&N._f){const Z=Array.isArray(N._f.refs)?N._f.refs[0]:N._f.ref;if(ze(Z)){const Q=Z.closest("form");if(Q){Q.reset();break}}}}if(u.keepFieldsRef)for(const b of d.mount)q(b,_(f,b));else s={}}i=e.shouldUnregister?u.keepDefaultValues?B(a):{}:B(f),C.array.next({values:{...f}}),C.state.next({values:{...f}})}d={mount:u.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!k.isValid||!!u.keepIsValid||!!u.keepDirtyValues,o.watch=!!e.shouldUnregister,C.state.next({submitCount:u.keepSubmitCount?r.submitCount:0,isDirty:h?!1:u.keepDirty?r.isDirty:!!(u.keepDefaultValues&&!ye(n,a)),isSubmitted:u.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:h?{}:u.keepDirtyValues?u.keepDefaultValues&&i?Se(a,i):r.dirtyFields:u.keepDefaultValues&&n?Se(a,n):u.keepDirty?r.dirtyFields:{},touchedFields:u.keepTouched?r.touchedFields:{},errors:u.keepErrors?r.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Ct=(n,u)=>St(te(n)?n(i):n,u),kr=(n,u={})=>{const l=_(s,n),p=l&&l._f;if(p){const h=p.refs?p.refs[0]:p.ref;h.focus&&(h.focus(),u.shouldSelect&&te(h.select)&&h.select())}},br=n=>{r={...r,...n}},Tt={control:{register:tt,unregister:et,getFieldState:xt,handleSubmit:At,setError:kt,_subscribe:bt,_runSchema:fe,_focusError:rt,_getWatch:O,_getDirty:se,_setValid:P,_setFieldArray:Xe,_setDisabledField:wt,_setErrors:oe,_getFieldArray:R,_reset:St,_resetDefaultValues:()=>te(e.defaultValues)&&e.defaultValues().then(n=>{Ct(n,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:xe,_disableForm:vr,_subjects:C,_proxyFormState:k,get _fields(){return s},get _formValues(){return i},get _state(){return o},set _state(n){o=n},get _defaultValues(){return a},get _names(){return d},set _names(n){d=n},get _formState(){return r},get _options(){return e},set _options(n){e={...e,...n}}},subscribe:_r,trigger:we,register:tt,handleSubmit:At,watch:gr,setValue:q,getValues:Ue,reset:Ct,resetField:xr,clearErrors:pr,unregister:et,setError:kt,setFocus:kr,getFieldState:xt};return{...Tt,formControl:Tt}}function Ss(t={}){const e=J.useRef(void 0),r=J.useRef(void 0),[s,a]=J.useState({isDirty:!1,isValidating:!1,isLoading:te(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:te(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!te(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...d}=Jr(t);e.current={...d,formState:s}}const i=e.current.control;return i._options=t,Rr(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}),reRenderRoot:!0});return a(d=>({...d,isReady:!0})),i._formState.isReady=!0,o},[i]),J.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),J.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),J.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),J.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),J.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==s.isDirty&&i._subjects.state.next({isDirty:o})}},[i,s.isDirty]),J.useEffect(()=>{t.values&&!ye(t.values,r.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),r.current=t.values,a(o=>({...o}))):i._resetDefaultValues()},[i,t.values]),J.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=Nr(s,i),e.current}const Ut=(t,e,r)=>{if(t&&"reportValidity"in t){const s=_(r,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},Yr=(t,e)=>{for(const r in e.fields){const s=e.fields[r];s&&s.ref&&"reportValidity"in s.ref?Ut(s.ref,r,t):s&&s.refs&&s.refs.forEach(a=>Ut(a,r,t))}},Cs=(t,e)=>{e.shouldUseNativeValidation&&Yr(t,e);const r={};for(const s in t){const a=_(e.fields,s),i=Object.assign(t[s]||{},{ref:a&&a.ref});if(Gr(e.names||Object.keys(t),s)){const o=Object.assign({},_(r,s));F(o,"root",i),F(r,s,o)}else F(r,s,i)}return r},Gr=(t,e)=>{const r=Bt(e);return t.some(s=>Bt(s).match(`^${r}\\.\\d+`))};function Bt(t){return t.replace(/\]|\[/g,"")}var V;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),o={};for(const d of i)o[d]=a[d];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(const o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(V||(V={}));var zt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(zt||(zt={}));const v=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),me=t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map<"u"&&t instanceof Map?v.map:typeof Set<"u"&&t instanceof Set?v.set:typeof Date<"u"&&t instanceof Date?v.date:v.object;default:return v.unknown}},c=V.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},s={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let d=s,y=0;for(;yr.message){const r={},s=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}ue.create=t=>new ue(t);const ut=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===v.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,V.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${V.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${V.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${V.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:V.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,V.assertNever(t)}return{message:r}};let Qr=ut;function Xr(){return Qr}const Kr=t=>{const{data:e,path:r,errorMaps:s,issueData:a}=t,i=[...r,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let d="";const y=s.filter(g=>!!g).slice().reverse();for(const g of y)d=g(o,{data:e,defaultError:d}).message;return{...a,path:i,message:d}};function m(t,e){const r=Xr(),s=Kr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ut?void 0:ut].filter(a=>!!a)});t.common.issues.push(s)}class G{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const a of r){if(a.status==="aborted")return w;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const a of r){const i=await a.key,o=await a.value;s.push({key:i,value:o})}return G.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const a of r){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return w;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}}const w=Object.freeze({status:"aborted"}),Ie=t=>({status:"dirty",value:t}),X=t=>({status:"valid",value:t}),Wt=t=>t.status==="aborted",qt=t=>t.status==="dirty",Te=t=>t.status==="valid",qe=t=>typeof Promise<"u"&&t instanceof Promise;var x;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(x||(x={}));class _e{constructor(e,r,s,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ht=(t,e)=>{if(Te(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new ue(t.common.issues);return this._error=r,this._error}}};function S(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,d)=>{const{message:y}=t;return o.code==="invalid_enum_value"?{message:y??d.defaultError}:typeof d.data>"u"?{message:y??s??d.defaultError}:o.code!=="invalid_type"?{message:d.defaultError}:{message:y??r??d.defaultError}},description:a}}class T{get description(){return this._def.description}_getType(e){return me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(qe(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ht(s,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:r});return Te(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>Te(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},a=this._parse({data:e,path:s.path,parent:s}),i=await(qe(a)?a:Promise.resolve(a));return Ht(s,i)}refine(e,r){const s=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const o=e(a),d=()=>i.addIssue({code:c.custom,...s(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(y=>y?!0:(d(),!1)):o?!0:(d(),!1)})}refinement(e,r){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof r=="function"?r(s,a):r),!1))}_refinement(e){return new Ve({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ge.create(this,this._def)}nullable(){return Ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ne.create(this)}promise(){return Ge.create(this,this._def)}or(e){return Je.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new Ve({...S(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ct({...S(this._def),innerType:this,defaultValue:r,typeName:A.ZodDefault})}brand(){return new bs({typeName:A.ZodBranded,type:this,...S(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ft({...S(this._def),innerType:this,catchValue:r,typeName:A.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return vt.create(this,e)}readonly(){return ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const es=/^c[^\s-]{8,}$/i,ts=/^[0-9a-z]+$/,rs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ss=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,as=/^[a-z0-9_-]{21}$/i,is=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ns=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,os=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ds="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let nt;const us=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ls=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,fs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ms=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ys=new RegExp(`^${hr}$`);function mr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ps(t){return new RegExp(`^${mr(t)}$`)}function gs(t){let e=`${hr}T${mr(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function _s(t,e){return!!((e==="v4"||!e)&&us.test(t)||(e==="v6"||!e)&&cs.test(t))}function vs(t,e){if(!is.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function xs(t,e){return!!((e==="v4"||!e)&&ls.test(t)||(e==="v6"||!e)&&fs.test(t))}class pe extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const i=this._getOrReturnCtx(e);return m(i,{code:c.invalid_type,expected:v.string,received:i.parsedType}),w}const s=new G;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,d=e.data.lengthe.test(a),{validation:r,code:c.invalid_string,...x.errToObj(s)})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...x.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...x.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...x.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...x.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...x.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...x.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...x.errToObj(r)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new pe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew pe({checks:[],typeName:A.ZodString,coerce:t?.coerce??!1,...S(t)});function ks(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=r>s?r:s,i=Number.parseInt(t.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}class je extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const i=this._getOrReturnCtx(e);return m(i,{code:c.invalid_type,expected:v.number,received:i.parsedType}),w}let s;const a=new G;for(const i of this._def.checks)i.kind==="int"?V.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?ks(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.not_finite,message:i.message}),a.dirty()):V.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,x.toString(r))}gt(e,r){return this.setLimit("min",e,!1,x.toString(r))}lte(e,r){return this.setLimit("max",e,!0,x.toString(r))}lt(e,r){return this.setLimit("max",e,!1,x.toString(r))}setLimit(e,r,s,a){return new je({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:x.toString(a)}]})}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&V.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.valuenew je({checks:[],typeName:A.ZodNumber,coerce:t?.coerce||!1,...S(t)});class Le extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let s;const a=new G;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):V.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return m(r,{code:c.invalid_type,expected:v.bigint,received:r.parsedType}),w}gte(e,r){return this.setLimit("min",e,!0,x.toString(r))}gt(e,r){return this.setLimit("min",e,!1,x.toString(r))}lte(e,r){return this.setLimit("max",e,!0,x.toString(r))}lt(e,r){return this.setLimit("max",e,!1,x.toString(r))}setLimit(e,r,s,a){return new Le({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:x.toString(a)}]})}_addCheck(e){return new Le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Le({checks:[],typeName:A.ZodBigInt,coerce:t?.coerce??!1,...S(t)});class Jt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.boolean,received:s.parsedType}),w}return X(e.data)}}Jt.create=t=>new Jt({typeName:A.ZodBoolean,coerce:t?.coerce||!1,...S(t)});class He extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const i=this._getOrReturnCtx(e);return m(i,{code:c.invalid_type,expected:v.date,received:i.parsedType}),w}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:c.invalid_date}),w}const s=new G;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:c.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):V.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew He({checks:[],coerce:t?.coerce||!1,typeName:A.ZodDate,...S(t)});class Yt extends T{_parse(e){if(this._getType(e)!==v.symbol){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.symbol,received:s.parsedType}),w}return X(e.data)}}Yt.create=t=>new Yt({typeName:A.ZodSymbol,...S(t)});class Gt extends T{_parse(e){if(this._getType(e)!==v.undefined){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.undefined,received:s.parsedType}),w}return X(e.data)}}Gt.create=t=>new Gt({typeName:A.ZodUndefined,...S(t)});class Qt extends T{_parse(e){if(this._getType(e)!==v.null){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.null,received:s.parsedType}),w}return X(e.data)}}Qt.create=t=>new Qt({typeName:A.ZodNull,...S(t)});class Xt extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return X(e.data)}}Xt.create=t=>new Xt({typeName:A.ZodAny,...S(t)});class Kt extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return X(e.data)}}Kt.create=t=>new Kt({typeName:A.ZodUnknown,...S(t)});class ve extends T{_parse(e){const r=this._getOrReturnCtx(e);return m(r,{code:c.invalid_type,expected:v.never,received:r.parsedType}),w}}ve.create=t=>new ve({typeName:A.ZodNever,...S(t)});class er extends T{_parse(e){if(this._getType(e)!==v.undefined){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.void,received:s.parsedType}),w}return X(e.data)}}er.create=t=>new er({typeName:A.ZodVoid,...S(t)});class ne extends T{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),a=this._def;if(r.parsedType!==v.array)return m(r,{code:c.invalid_type,expected:v.array,received:r.parsedType}),w;if(a.exactLength!==null){const o=r.data.length>a.exactLength.value,d=r.data.lengtha.maxLength.value&&(m(r,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,d)=>a.type._parseAsync(new _e(r,o,r.path,d)))).then(o=>G.mergeArray(s,o));const i=[...r.data].map((o,d)=>a.type._parseSync(new _e(r,o,r.path,d)));return G.mergeArray(s,i)}get element(){return this._def.type}min(e,r){return new ne({...this._def,minLength:{value:e,message:x.toString(r)}})}max(e,r){return new ne({...this._def,maxLength:{value:e,message:x.toString(r)}})}length(e,r){return new ne({...this._def,exactLength:{value:e,message:x.toString(r)}})}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({type:t,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...S(e)});function Ce(t){if(t instanceof L){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=ge.create(Ce(s))}return new L({...t._def,shape:()=>e})}else return t instanceof ne?new ne({...t._def,type:Ce(t.element)}):t instanceof ge?ge.create(Ce(t.unwrap())):t instanceof Ee?Ee.create(Ce(t.unwrap())):t instanceof be?be.create(t.items.map(e=>Ce(e))):t}class L extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=V.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==v.object){const g=this._getOrReturnCtx(e);return m(g,{code:c.invalid_type,expected:v.object,received:g.parsedType}),w}const{status:s,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),d=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const g in a.data)o.includes(g)||d.push(g);const y=[];for(const g of o){const k=i[g],I=a.data[g];y.push({key:{status:"valid",value:g},value:k._parse(new _e(a,I,a.path,g)),alwaysSet:g in a.data})}if(this._def.catchall instanceof ve){const g=this._def.unknownKeys;if(g==="passthrough")for(const k of d)y.push({key:{status:"valid",value:k},value:{status:"valid",value:a.data[k]}});else if(g==="strict")d.length>0&&(m(a,{code:c.unrecognized_keys,keys:d}),s.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const k of d){const I=a.data[k];y.push({key:{status:"valid",value:k},value:g._parse(new _e(a,I,a.path,k)),alwaysSet:k in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const g=[];for(const k of y){const I=await k.key,C=await k.value;g.push({key:I,value:C,alwaysSet:k.alwaysSet})}return g}).then(g=>G.mergeObjectSync(s,g)):G.mergeObjectSync(s,y)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new L({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{const a=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:x.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new L({...this._def,unknownKeys:"strip"})}passthrough(){return new L({...this._def,unknownKeys:"passthrough"})}extend(e){return new L({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new L({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new L({...this._def,catchall:e})}pick(e){const r={};for(const s of V.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new L({...this._def,shape:()=>r})}omit(e){const r={};for(const s of V.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new L({...this._def,shape:()=>r})}deepPartial(){return Ce(this)}partial(e){const r={};for(const s of V.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?r[s]=a:r[s]=a.optional()}return new L({...this._def,shape:()=>r})}required(e){const r={};for(const s of V.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof ge;)i=i._def.innerType;r[s]=i}return new L({...this._def,shape:()=>r})}keyof(){return yr(V.objectKeys(this.shape))}}L.create=(t,e)=>new L({shape:()=>t,unknownKeys:"strip",catchall:ve.create(),typeName:A.ZodObject,...S(e)});L.strictCreate=(t,e)=>new L({shape:()=>t,unknownKeys:"strict",catchall:ve.create(),typeName:A.ZodObject,...S(e)});L.lazycreate=(t,e)=>new L({shape:t,unknownKeys:"strip",catchall:ve.create(),typeName:A.ZodObject,...S(e)});class Je extends T{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function a(i){for(const d of i)if(d.result.status==="valid")return d.result;for(const d of i)if(d.result.status==="dirty")return r.common.issues.push(...d.ctx.common.issues),d.result;const o=i.map(d=>new ue(d.ctx.common.issues));return m(r,{code:c.invalid_union,unionErrors:o}),w}if(r.common.async)return Promise.all(s.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const y of s){const g={...r,common:{...r.common,issues:[]},parent:null},k=y._parseSync({data:r.data,path:r.path,parent:g});if(k.status==="valid")return k;k.status==="dirty"&&!i&&(i={result:k,ctx:g}),g.common.issues.length&&o.push(g.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const d=o.map(y=>new ue(y));return m(r,{code:c.invalid_union,unionErrors:d}),w}}get options(){return this._def.options}}Je.create=(t,e)=>new Je({options:t,typeName:A.ZodUnion,...S(e)});function lt(t,e){const r=me(t),s=me(e);if(t===e)return{valid:!0,data:t};if(r===v.object&&s===v.object){const a=V.objectKeys(e),i=V.objectKeys(t).filter(d=>a.indexOf(d)!==-1),o={...t,...e};for(const d of i){const y=lt(t[d],e[d]);if(!y.valid)return{valid:!1};o[d]=y.data}return{valid:!0,data:o}}else if(r===v.array&&s===v.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i{if(Wt(i)||Wt(o))return w;const d=lt(i.value,o.value);return d.valid?((qt(i)||qt(o))&&r.dirty(),{status:r.value,value:d.data}):(m(s,{code:c.invalid_intersection_types}),w)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Ye.create=(t,e,r)=>new Ye({left:t,right:e,typeName:A.ZodIntersection,...S(r)});class be extends T{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.array)return m(s,{code:c.invalid_type,expected:v.array,received:s.parsedType}),w;if(s.data.lengththis._def.items.length&&(m(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...s.data].map((o,d)=>{const y=this._def.items[d]||this._def.rest;return y?y._parse(new _e(s,o,s.path,d)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>G.mergeArray(r,o)):G.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:t,typeName:A.ZodTuple,rest:null,...S(e)})};class tr extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.map)return m(s,{code:c.invalid_type,expected:v.map,received:s.parsedType}),w;const a=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([d,y],g)=>({key:a._parse(new _e(s,d,s.path,[g,"key"])),value:i._parse(new _e(s,y,s.path,[g,"value"]))}));if(s.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const y of o){const g=await y.key,k=await y.value;if(g.status==="aborted"||k.status==="aborted")return w;(g.status==="dirty"||k.status==="dirty")&&r.dirty(),d.set(g.value,k.value)}return{status:r.value,value:d}})}else{const d=new Map;for(const y of o){const g=y.key,k=y.value;if(g.status==="aborted"||k.status==="aborted")return w;(g.status==="dirty"||k.status==="dirty")&&r.dirty(),d.set(g.value,k.value)}return{status:r.value,value:d}}}}tr.create=(t,e,r)=>new tr({valueType:e,keyType:t,typeName:A.ZodMap,...S(r)});class Me extends T{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.set)return m(s,{code:c.invalid_type,expected:v.set,received:s.parsedType}),w;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(m(s,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function o(y){const g=new Set;for(const k of y){if(k.status==="aborted")return w;k.status==="dirty"&&r.dirty(),g.add(k.value)}return{status:r.value,value:g}}const d=[...s.data.values()].map((y,g)=>i._parse(new _e(s,y,s.path,g)));return s.common.async?Promise.all(d).then(y=>o(y)):o(d)}min(e,r){return new Me({...this._def,minSize:{value:e,message:x.toString(r)}})}max(e,r){return new Me({...this._def,maxSize:{value:e,message:x.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Me.create=(t,e)=>new Me({valueType:t,minSize:null,maxSize:null,typeName:A.ZodSet,...S(e)});class rr extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}rr.create=(t,e)=>new rr({getter:t,typeName:A.ZodLazy,...S(e)});class sr extends T{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return m(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}sr.create=(t,e)=>new sr({value:t,typeName:A.ZodLiteral,...S(e)});function yr(t,e){return new Oe({values:t,typeName:A.ZodEnum,...S(e)})}class Oe extends T{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return m(r,{expected:V.joinValues(s),received:r.parsedType,code:c.invalid_type}),w}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return m(r,{received:r.data,code:c.invalid_enum_value,options:s}),w}return X(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Oe.create(e,{...this._def,...r})}exclude(e,r=this._def){return Oe.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}Oe.create=yr;class ar extends T{_parse(e){const r=V.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==v.string&&s.parsedType!==v.number){const a=V.objectValues(r);return m(s,{expected:V.joinValues(a),received:s.parsedType,code:c.invalid_type}),w}if(this._cache||(this._cache=new Set(V.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=V.objectValues(r);return m(s,{received:s.data,code:c.invalid_enum_value,options:a}),w}return X(e.data)}get enum(){return this._def.values}}ar.create=(t,e)=>new ar({values:t,typeName:A.ZodNativeEnum,...S(e)});class Ge extends T{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.promise&&r.common.async===!1)return m(r,{code:c.invalid_type,expected:v.promise,received:r.parsedType}),w;const s=r.parsedType===v.promise?r.data:Promise.resolve(r.data);return X(s.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ge.create=(t,e)=>new Ge({type:t,typeName:A.ZodPromise,...S(e)});class Ve extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{m(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async d=>{if(r.value==="aborted")return w;const y=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return y.status==="aborted"?w:y.status==="dirty"||r.value==="dirty"?Ie(y.value):y});{if(r.value==="aborted")return w;const d=this._def.schema._parseSync({data:o,path:s.path,parent:s});return d.status==="aborted"?w:d.status==="dirty"||r.value==="dirty"?Ie(d.value):d}}if(a.type==="refinement"){const o=d=>{const y=a.refinement(d,i);if(s.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?w:(d.status==="dirty"&&r.dirty(),o(d.value),{status:r.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?w:(d.status==="dirty"&&r.dirty(),o(d.value).then(()=>({status:r.value,value:d.value}))))}if(a.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Te(o))return w;const d=a.transform(o.value,i);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Te(o)?Promise.resolve(a.transform(o.value,i)).then(d=>({status:r.value,value:d})):w);V.assertNever(a)}}Ve.create=(t,e,r)=>new Ve({schema:t,typeName:A.ZodEffects,effect:e,...S(r)});Ve.createWithPreprocess=(t,e,r)=>new Ve({schema:e,effect:{type:"preprocess",transform:t},typeName:A.ZodEffects,...S(r)});class ge extends T{_parse(e){return this._getType(e)===v.undefined?X(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ge.create=(t,e)=>new ge({innerType:t,typeName:A.ZodOptional,...S(e)});class Ee extends T{_parse(e){return this._getType(e)===v.null?X(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ee.create=(t,e)=>new Ee({innerType:t,typeName:A.ZodNullable,...S(e)});class ct extends T{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===v.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ct.create=(t,e)=>new ct({innerType:t,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});class ft extends T{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return qe(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ue(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ue(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ft.create=(t,e)=>new ft({innerType:t,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});class ir extends T{_parse(e){if(this._getType(e)!==v.nan){const s=this._getOrReturnCtx(e);return m(s,{code:c.invalid_type,expected:v.nan,received:s.parsedType}),w}return{status:"valid",value:e.data}}}ir.create=t=>new ir({typeName:A.ZodNaN,...S(t)});class bs extends T{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class vt extends T{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?w:i.status==="dirty"?(r.dirty(),Ie(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?w:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,r){return new vt({in:e,out:r,typeName:A.ZodPipeline})}}class ht extends T{_parse(e){const r=this._def.innerType._parse(e),s=a=>(Te(a)&&(a.value=Object.freeze(a.value)),a);return qe(r)?r.then(a=>s(a)):s(r)}unwrap(){return this._def.innerType}}ht.create=(t,e)=>new ht({innerType:t,typeName:A.ZodReadonly,...S(e)});var A;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(A||(A={}));const Ts=pe.create;ve.create;ne.create;const Os=L.create;Je.create;Ye.create;be.create;Oe.create;Ge.create;ge.create;Ee.create;export{Yr as a,Cs as b,Ir as c,Os as o,Ts as s,Ss as u}; diff --git a/dist/assets/js/index-doec96Hx.js b/dist/assets/js/index-doec96Hx.js new file mode 100644 index 0000000..6251ac6 --- /dev/null +++ b/dist/assets/js/index-doec96Hx.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/js/useUserStore-VOdYc7Zm.js","assets/js/state-vendor-DHadhBU5.js","assets/js/react-vendor-CqRd3GwO.js","assets/js/router-vendor-D4by-_6Z.js","assets/js/query-vendor-BLVqILA6.js","assets/js/ui-vendor-CyRvbSfR.js","assets/js/supabase-vendor-CnnNSQLo.js","assets/js/Dashboard-BPPxBqO4.js","assets/js/ThemeToggle-Cryh6OOS.js","assets/js/Cadastros-QZZ_REjv.js","assets/js/CreateRDO-Bhe5_7xI.js","assets/js/form-vendor-vQotxSmE.js","assets/js/zod-7IfHMaWP.js","assets/js/configStore-DS-p50om.js","assets/js/ObraDetails-S1VcIvXW.js","assets/js/RDODetails-tkR9ftO-.js","assets/js/Configuracoes-LYuviA0-.js","assets/js/useInviteCode-BxOSdQOT.js","assets/js/ObraTasks-Cy-rxhIo.js","assets/js/CreateTask-BlEDuvPM.js","assets/js/ManualInstrucoes-G3xr1xLl.js","assets/js/Reports-BmqmPZPj.js","assets/js/DatabaseTest-BA9LjsoE.js","assets/js/Auth-KZISTjMo.js","assets/js/NeuralNetworkBackground-CER-dIFD.js","assets/js/CreateObra-BwwQt_hK.js","assets/js/AuthCallback-DlZVcD4W.js","assets/js/SelectOrganization-Cb4zDKko.js"])))=>i.map(i=>d[i]); +var dt=Object.defineProperty;var ut=(e,r,t)=>r in e?dt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var F=(e,r,t)=>ut(e,typeof r!="symbol"?r+"":r,t);import{j as i,_ as I,Q as mt,a as ft,u as pt}from"./query-vendor-BLVqILA6.js";import{u as We,L as De,r as k,N as Te,B as gt,a as ht,b as bt}from"./router-vendor-D4by-_6Z.js";import{a as yt}from"./react-vendor-CqRd3GwO.js";import{H as Ke,B as wt,P as vt,L as xt,C as kt,m as Me,T as St,R as _t}from"./ui-vendor-CyRvbSfR.js";import{c as Ct}from"./supabase-vendor-CnnNSQLo.js";import{D as Ot,c as At}from"./state-vendor-DHadhBU5.js";var le={},qe;function Et(){if(qe)return le;qe=1;var e=yt();return le.createRoot=e.createRoot,le.hydrateRoot=e.hydrateRoot,le}var It=Et();function Ze(e){var r,t,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(r=0;r{const r=Nt(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const h=u.split(Ae);return h[0]===""&&h.length!==1&&h.shift(),$e(h,r)||Pt(u)},getConflictingClassGroupIds:(u,h)=>{const g=t[u]||[];return h&&o[u]?[...g,...o[u]]:g}}},$e=(e,r)=>{if(e.length===0)return r.classGroupId;const t=e[0],o=r.nextPart.get(t),s=o?$e(e.slice(1),o):void 0;if(s)return s;if(r.validators.length===0)return;const a=e.join(Ae);return r.validators.find(({validator:u})=>u(a))?.classGroupId},Ve=/^\[(.+)\]$/,Pt=e=>{if(Ve.test(e)){const r=Ve.exec(e)[1],t=r?.substring(0,r.indexOf(":"));if(t)return"arbitrary.."+t}},Nt=e=>{const{theme:r,classGroups:t}=e,o={nextPart:new Map,validators:[]};for(const s in t)ve(t[s],o,s,r);return o},ve=(e,r,t,o)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?r:Ue(r,s);a.classGroupId=t;return}if(typeof s=="function"){if(zt(s)){ve(s(o),r,t,o);return}r.validators.push({validator:s,classGroupId:t});return}Object.entries(s).forEach(([a,u])=>{ve(u,Ue(r,a),t,o)})})},Ue=(e,r)=>{let t=e;return r.split(Ae).forEach(o=>{t.nextPart.has(o)||t.nextPart.set(o,{nextPart:new Map,validators:[]}),t=t.nextPart.get(o)}),t},zt=e=>e.isThemeGetter,Lt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,t=new Map,o=new Map;const s=(a,u)=>{t.set(a,u),r++,r>e&&(r=0,o=t,t=new Map)};return{get(a){let u=t.get(a);if(u!==void 0)return u;if((u=o.get(a))!==void 0)return s(a,u),u},set(a,u){t.has(a)?t.set(a,u):s(a,u)}}},xe="!",ke=":",Dt=ke.length,Tt=e=>{const{prefix:r,experimentalParseClassName:t}=e;let o=s=>{const a=[];let u=0,h=0,g=0,v;for(let y=0;yg?v-g:void 0;return{modifiers:a,hasImportantModifier:n,baseClassName:l,maybePostfixModifierPosition:c}};if(r){const s=r+ke,a=o;o=u=>u.startsWith(s)?a(u.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:u,maybePostfixModifierPosition:void 0}}if(t){const s=o;o=a=>t({className:a,parseClassName:s})}return o},Mt=e=>e.endsWith(xe)?e.substring(0,e.length-1):e.startsWith(xe)?e.substring(1):e,qt=e=>{const r=Object.fromEntries(e.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const s=[];let a=[];return o.forEach(u=>{u[0]==="["||r[u]?(s.push(...a.sort(),u),a=[]):a.push(u)}),s.push(...a.sort()),s}},Vt=e=>({cache:Lt(e.cacheSize),parseClassName:Tt(e),sortModifiers:qt(e),...Rt(e)}),Ut=/\s+/,Ft=(e,r)=>{const{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:s,sortModifiers:a}=r,u=[],h=e.trim().split(Ut);let g="";for(let v=h.length-1;v>=0;v-=1){const d=h[v],{isExternal:l,modifiers:n,hasImportantModifier:c,baseClassName:y,maybePostfixModifierPosition:p}=t(d);if(l){g=d+(g.length>0?" "+g:g);continue}let O=!!p,S=o(O?y.substring(0,p):y);if(!S){if(!O){g=d+(g.length>0?" "+g:g);continue}if(S=o(y),!S){g=d+(g.length>0?" "+g:g);continue}O=!1}const _=a(n).join(":"),j=c?_+xe:_,D=j+S;if(u.includes(D))continue;u.push(D);const U=s(S,O);for(let J=0;J0?" "+g:g)}return g};function Gt(){let e=0,r,t,o="";for(;e{if(typeof e=="string")return e;let r,t="";for(let o=0;ol(d),e());return t=Vt(v),o=t.cache.get,s=t.cache.set,a=h,h(g)}function h(g){const v=o(g);if(v)return v;const d=Ft(g,t);return s(g,d),d}return function(){return a(Gt.apply(null,arguments))}}const R=e=>{const r=t=>t[e]||[];return r.isThemeGetter=!0,r},Xe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,et=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Jt=/^\d+\/\d+$/,Qt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ht=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Kt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,K=e=>Jt.test(e),x=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),he=e=>e.endsWith("%")&&x(e.slice(0,-1)),q=e=>Qt.test(e),$t=()=>!0,Yt=e=>Ht.test(e)&&!Wt.test(e),tt=()=>!1,Xt=e=>Kt.test(e),er=e=>Zt.test(e),tr=e=>!m(e)&&!f(e),rr=e=>$(e,st,tt),m=e=>Xe.test(e),H=e=>$(e,at,Yt),be=e=>$(e,ir,x),Fe=e=>$(e,rt,tt),or=e=>$(e,ot,er),ce=e=>$(e,nt,Xt),f=e=>et.test(e),ee=e=>Y(e,at),sr=e=>Y(e,lr),Ge=e=>Y(e,rt),ar=e=>Y(e,st),nr=e=>Y(e,ot),de=e=>Y(e,nt,!0),$=(e,r,t)=>{const o=Xe.exec(e);return o?o[1]?r(o[1]):t(o[2]):!1},Y=(e,r,t=!1)=>{const o=et.exec(e);return o?o[1]?r(o[1]):t:!1},rt=e=>e==="position"||e==="percentage",ot=e=>e==="image"||e==="url",st=e=>e==="length"||e==="size"||e==="bg-size",at=e=>e==="length",ir=e=>e==="number",lr=e=>e==="family-name",nt=e=>e==="shadow",cr=()=>{const e=R("color"),r=R("font"),t=R("text"),o=R("font-weight"),s=R("tracking"),a=R("leading"),u=R("breakpoint"),h=R("container"),g=R("spacing"),v=R("radius"),d=R("shadow"),l=R("inset-shadow"),n=R("text-shadow"),c=R("drop-shadow"),y=R("blur"),p=R("perspective"),O=R("aspect"),S=R("ease"),_=R("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[...D(),f,m],J=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto","contain","none"],w=()=>[f,m,g],T=()=>[K,"full","auto",...w()],Ee=()=>[G,"none","subgrid",f,m],Ie=()=>["auto",{span:["full",G,f,m]},G,f,m],oe=()=>[G,"auto",f,m],je=()=>["auto","min","max","fr",f,m],fe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...w()],Q=()=>[K,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],b=()=>[e,f,m],Re=()=>[...D(),Ge,Fe,{position:[f,m]}],Pe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ne=()=>["auto","cover","contain",ar,rr,{size:[f,m]}],pe=()=>[he,ee,H],N=()=>["","none","full",v,f,m],z=()=>["",x,ee,H],se=()=>["solid","dashed","dotted","double"],ze=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>[x,he,Ge,Fe],Le=()=>["","none",y,f,m],ae=()=>["none",x,f,m],ne=()=>["none",x,f,m],ge=()=>[x,f,m],ie=()=>[K,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[$t],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[tr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",x],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",K,m,f,O]}],container:["container"],columns:[{columns:[x,m,f,h]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:U()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[G,"auto",f,m]}],basis:[{basis:[K,"full","auto",h,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[x,K,"auto","initial","none",m]}],grow:[{grow:["",x,f,m]}],shrink:[{shrink:["",x,f,m]}],order:[{order:[G,"first","last","none",f,m]}],"grid-cols":[{"grid-cols":Ee()}],"col-start-end":[{col:Ie()}],"col-start":[{"col-start":oe()}],"col-end":[{"col-end":oe()}],"grid-rows":[{"grid-rows":Ee()}],"row-start-end":[{row:Ie()}],"row-start":[{"row-start":oe()}],"row-end":[{"row-end":oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...fe(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...fe()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":fe()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[h,"screen",...Q()]}],"min-w":[{"min-w":[h,"screen","none",...Q()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",t,ee,H]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,f,be]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",he,m]}],"font-family":[{font:[sr,m,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,f,m]}],"line-clamp":[{"line-clamp":[x,"none",f,be]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":["none",f,m]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",f,m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:b()}],"text-color":[{text:b()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[x,"from-font","auto",f,H]}],"text-decoration-color":[{decoration:b()}],"underline-offset":[{"underline-offset":[x,"auto",f,m]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",f,m]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",f,m]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Re()}],"bg-repeat":[{bg:Pe()}],"bg-size":[{bg:Ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},G,f,m],radial:["",f,m],conic:[G,f,m]},nr,or]}],"bg-color":[{bg:b()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:b()}],"gradient-via":[{via:b()}],"gradient-to":[{to:b()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:b()}],"border-color-x":[{"border-x":b()}],"border-color-y":[{"border-y":b()}],"border-color-s":[{"border-s":b()}],"border-color-e":[{"border-e":b()}],"border-color-t":[{"border-t":b()}],"border-color-r":[{"border-r":b()}],"border-color-b":[{"border-b":b()}],"border-color-l":[{"border-l":b()}],"divide-color":[{divide:b()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[x,f,m]}],"outline-w":[{outline:["",x,ee,H]}],"outline-color":[{outline:b()}],shadow:[{shadow:["","none",d,de,ce]}],"shadow-color":[{shadow:b()}],"inset-shadow":[{"inset-shadow":["none",l,de,ce]}],"inset-shadow-color":[{"inset-shadow":b()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:b()}],"ring-offset-w":[{"ring-offset":[x,H]}],"ring-offset-color":[{"ring-offset":b()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":b()}],"text-shadow":[{"text-shadow":["none",n,de,ce]}],"text-shadow-color":[{"text-shadow":b()}],opacity:[{opacity:[x,f,m]}],"mix-blend":[{"mix-blend":[...ze(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ze()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[x]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":b()}],"mask-image-linear-to-color":[{"mask-linear-to":b()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":b()}],"mask-image-t-to-color":[{"mask-t-to":b()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":b()}],"mask-image-r-to-color":[{"mask-r-to":b()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":b()}],"mask-image-b-to-color":[{"mask-b-to":b()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":b()}],"mask-image-l-to-color":[{"mask-l-to":b()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":b()}],"mask-image-x-to-color":[{"mask-x-to":b()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":b()}],"mask-image-y-to-color":[{"mask-y-to":b()}],"mask-image-radial":[{"mask-radial":[f,m]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":b()}],"mask-image-radial-to-color":[{"mask-radial-to":b()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":D()}],"mask-image-conic-pos":[{"mask-conic":[x]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":b()}],"mask-image-conic-to-color":[{"mask-conic-to":b()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Re()}],"mask-repeat":[{mask:Pe()}],"mask-size":[{mask:Ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",f,m]}],filter:[{filter:["","none",f,m]}],blur:[{blur:Le()}],brightness:[{brightness:[x,f,m]}],contrast:[{contrast:[x,f,m]}],"drop-shadow":[{"drop-shadow":["","none",c,de,ce]}],"drop-shadow-color":[{"drop-shadow":b()}],grayscale:[{grayscale:["",x,f,m]}],"hue-rotate":[{"hue-rotate":[x,f,m]}],invert:[{invert:["",x,f,m]}],saturate:[{saturate:[x,f,m]}],sepia:[{sepia:["",x,f,m]}],"backdrop-filter":[{"backdrop-filter":["","none",f,m]}],"backdrop-blur":[{"backdrop-blur":Le()}],"backdrop-brightness":[{"backdrop-brightness":[x,f,m]}],"backdrop-contrast":[{"backdrop-contrast":[x,f,m]}],"backdrop-grayscale":[{"backdrop-grayscale":["",x,f,m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x,f,m]}],"backdrop-invert":[{"backdrop-invert":["",x,f,m]}],"backdrop-opacity":[{"backdrop-opacity":[x,f,m]}],"backdrop-saturate":[{"backdrop-saturate":[x,f,m]}],"backdrop-sepia":[{"backdrop-sepia":["",x,f,m]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",f,m]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[x,"initial",f,m]}],ease:[{ease:["linear","initial",S,f,m]}],delay:[{delay:[x,f,m]}],animate:[{animate:["none",_,f,m]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,f,m]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[f,m,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":["translate-none"],accent:[{accent:b()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:b()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",f,m]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",f,m]}],fill:[{fill:["none",...b()]}],"stroke-w":[{stroke:[x,ee,H,be]}],stroke:[{stroke:["none",...b()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dr=Bt(cr);function Be(...e){return dr(jt(e))}const ur=[{path:"/",label:"Início",icon:Ke},{path:"/cadastros/obras",label:"Obras",icon:wt},{path:"/rdo/novo",label:"Adicionar",icon:vt,isCentral:!0},{path:"/obra/1/tarefas",label:"Tarefas",icon:xt},{path:"/reports",label:"Relatórios",icon:kt}];function mr(){const e=We();return i.jsx("div",{className:"fixed bottom-0 left-0 right-0 h-20 bg-white/80 dark:bg-gray-900/80 backdrop-blur-lg border-t border-gray-200/80 dark:border-gray-700/80 z-50",children:i.jsx("div",{className:"flex justify-around items-center h-full max-w-lg mx-auto",children:ur.map(r=>{const t=e.pathname===r.path,o=r.icon;return r.isCentral?i.jsx(De,{to:r.path,className:"-mt-8",children:i.jsx(Me.div,{whileHover:{scale:1.1},whileTap:{scale:.9},className:"w-16 h-16 bg-blue-600 rounded-full flex items-center justify-center text-white shadow-lg shadow-blue-500/50",children:i.jsx(o,{className:"w-8 h-8"})})},r.path):i.jsxs(De,{to:r.path,className:"flex flex-col items-center justify-center w-16 h-16",children:[i.jsxs("div",{className:"relative",children:[i.jsx(o,{className:Be("w-6 h-6 transition-colors",t?"text-blue-600 dark:text-blue-400":"text-gray-500 dark:text-gray-400")}),t&&i.jsx(Me.div,{layoutId:"active-indicator",className:"absolute -bottom-2 left-1/2 -translate-x-1/2 w-1 h-1 bg-blue-600 rounded-full"})]}),i.jsx("span",{className:Be("text-xs mt-1 transition-colors",t?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400"),children:r.label})]},r.path)})})})}function fr({children:e}){return i.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 w-full overflow-x-hidden",children:[i.jsx("main",{className:"pb-24",children:e}),i.jsx(mr,{})]})}const pr="https://ympbgdymeesivfajmgat.supabase.co",gr="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InltcGJnZHltZWVzaXZmYWptZ2F0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjUwNjA3MDYsImV4cCI6MjA4MDYzNjcwNn0.TOU2ol_Y2wtipSflHTwHU5QmKriDRF3JeqAzA5gqc9c",E=Ct(pr,gr,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce"},realtime:{params:{eventsPerSecond:10}},global:{headers:{"X-Client-Info":"rdo-mobile-app"}}}),hr=()=>{const[e,r]=k.useState({user:null,session:null,loading:!0,error:null});k.useEffect(()=>{(async()=>{try{const{data:{session:c},error:y}=await E.auth.getSession();if(y)throw y;r({user:c?.user??null,session:c,loading:!1,error:null})}catch(c){r({user:null,session:null,loading:!1,error:c.message})}})();const{data:{subscription:n}}=E.auth.onAuthStateChange(async(c,y)=>{r({user:y?.user??null,session:y,loading:!1,error:null}),c==="SIGNED_IN"&&y?.user&&await t(y.user)});return()=>n.unsubscribe()},[]);const t=async l=>{try{const{data:n,error:c}=await E.from("usuarios").select("*").eq("email",l.email).single();if(c&&c.code!=="PGRST116")return;if(!n){const{error:y}=await E.from("usuarios").insert({id:l.id,email:l.email,nome:l.user_metadata?.full_name||l.user_metadata?.nome||l.email?.split("@")[0]||"Usuário",ativo:!0})}}catch{}},o=async l=>{try{r(y=>({...y,loading:!0,error:null}));const{data:n,error:c}=await E.auth.signInWithPassword({email:l.email,password:l.password});if(c)throw c;if(n.user){const{useUserStore:y}=await I(async()=>{const{useUserStore:p}=await import("./useUserStore-VOdYc7Zm.js");return{useUserStore:p}},__vite__mapDeps([0,1,2,3,4,5,6]));await y.getState().fetchCurrentUser(n.user.id)}return{success:!0,data:n}}catch(n){const c=Z(n);return r(y=>({...y,loading:!1,error:c})),{success:!1,error:c}}},s=async l=>{try{r(y=>({...y,loading:!0,error:null}));const{data:n,error:c}=await E.auth.signUp({email:l.email,password:l.password,options:{data:{nome:l.nome,cpf:l.cpf,telefone:l.telefone}}});if(c)throw c;return{success:!0,data:n}}catch(n){const c=Z(n);return r(y=>({...y,loading:!1,error:c})),{success:!1,error:c}}},a=async()=>{try{r(n=>({...n,loading:!0,error:null}));const{error:l}=await E.auth.signOut();if(l)throw l;return{success:!0}}catch(l){const n=Z(l);return r(c=>({...c,loading:!1,error:n})),{success:!1,error:n}}},u=async l=>{try{const{error:n}=await E.auth.resetPasswordForEmail(l,{redirectTo:`${window.location.origin}/reset-password`});if(n)throw n;return{success:!0}}catch(n){return{success:!1,error:Z(n)}}},h=async l=>{try{const{error:n}=await E.auth.updateUser({password:l});if(n)throw n;return{success:!0}}catch(n){return{success:!1,error:Z(n)}}},g=async l=>{try{if(!e.user)throw new Error("Usuário não autenticado");const{error:n}=await E.auth.updateUser({data:l});if(n)throw n;const{error:c}=await E.from("usuarios").update(l).eq("id",e.user.id);if(c)throw c;return{success:!0}}catch(n){return{success:!1,error:Z(n)}}},v=()=>{r(l=>({...l,error:null}))},d=async()=>{try{r(c=>({...c,loading:!0,error:null}));const l={id:"bypass-user-"+Date.now(),email:"bypass@desenvolvimento.com",user_metadata:{nome:"Usuário Bypass"},aud:"authenticated",role:"authenticated"},n={access_token:"mock-token",refresh_token:"mock-refresh",expires_in:3600,token_type:"bearer",user:l};return r({user:l,session:n,loading:!1,error:null}),{success:!0,data:{user:l,session:n}}}catch{return r(n=>({...n,loading:!1,error:"Erro no bypass"})),{success:!1,error:"Erro no bypass"}}};return{user:e.user,session:e.session,loading:e.loading,error:e.error,isAuthenticated:!!e.user,login:o,register:s,logout:a,resetPassword:u,updatePassword:h,updateProfile:g,clearError:v,bypassLogin:d}},Z=e=>{if("message"in e)switch(e.message){case"Invalid login credentials":return"Credenciais de login inválidas";case"Email not confirmed":return"Email não confirmado. Verifique sua caixa de entrada";case"User already registered":return"Usuário já cadastrado com este email";case"Password should be at least 6 characters":return"A senha deve ter pelo menos 6 caracteres";case"Unable to validate email address: invalid format":return"Formato de email inválido";case"Email rate limit exceeded":return"Limite de emails excedido. Tente novamente mais tarde";default:return e.message}return"Erro desconhecido"},it=k.createContext(void 0),br=({children:e})=>{const r=hr();return i.jsx(it.Provider,{value:r,children:e})},yr=()=>{const e=k.useContext(it);if(e===void 0)throw new Error("useAuthContext deve ser usado dentro de um AuthProvider");return e},wr=({children:e,requireAuth:r=!0,redirectTo:t="/login"})=>{const{isAuthenticated:o,loading:s}=yr(),a=We();if(s)return i.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-600",children:"Verificando autenticação..."})]})});if(r&&!o)return i.jsx(Te,{to:t,state:{from:a},replace:!0});const h=["/auth/callback","/selecionar-organizacao"].includes(a.pathname);if(!r&&o&&!h){const g=a.state?.from?.pathname||"/dashboard";return i.jsx(Te,{to:g,replace:!0})}return i.jsx(i.Fragment,{children:e})},vr={queries:{staleTime:600*1e3,gcTime:900*1e3,retry:(e,r)=>r?.status===401||r?.status===403?!1:e<3,retryDelay:e=>Math.min(1e3*2**e,3e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchOnMount:!1,networkMode:"offlineFirst"},mutations:{retry:1,retryDelay:1e3,networkMode:"online"}},xr=()=>new mt({defaultOptions:vr}),L=xr(),A={users:{all:["users"],lists:()=>[...A.users.all,"list"],list:e=>[...A.users.lists(),{filters:e}],details:()=>[...A.users.all,"detail"],detail:e=>[...A.users.details(),e],profile:()=>[...A.users.all,"profile"]},obras:{all:["obras"],lists:()=>[...A.obras.all,"list"],list:e=>[...A.obras.lists(),{filters:e}],details:()=>[...A.obras.all,"detail"],detail:e=>[...A.obras.details(),e],byUser:e=>[...A.obras.all,"byUser",e]},rdos:{all:["rdos"],lists:()=>[...A.rdos.all,"list"],list:e=>[...A.rdos.lists(),{filters:e}],details:()=>[...A.rdos.all,"detail"],detail:e=>[...A.rdos.details(),e],byObra:e=>[...A.rdos.all,"byObra",e],byUser:e=>[...A.rdos.all,"byUser",e]},reports:{all:["reports"]}},kr={users:()=>L.invalidateQueries({queryKey:A.users.all}),user:e=>L.invalidateQueries({queryKey:A.users.detail(e)}),obras:()=>L.invalidateQueries({queryKey:A.obras.all}),obra:e=>L.invalidateQueries({queryKey:A.obras.detail(e)}),rdos:()=>L.invalidateQueries({queryKey:A.rdos.all}),rdo:e=>L.invalidateQueries({queryKey:A.rdos.detail(e)}),rdosByObra:e=>L.invalidateQueries({queryKey:A.rdos.byObra(e)}),reports:()=>L.invalidateQueries({queryKey:A.reports.all}),all:()=>L.invalidateQueries()};function Sr(){return k.useEffect(()=>{const e=L.getQueryCache().subscribe(t=>{}),r=L.getMutationCache().subscribe(t=>{});return()=>{e(),r()}},[]),null}const _r=({children:e})=>i.jsxs(ft,{client:L,children:[i.jsx(Sr,{}),e]});class Cr extends Ot{constructor(){super("RDOOfflineDB");F(this,"usuarios");F(this,"obras");F(this,"rdos");F(this,"pendingOperations");F(this,"offlineConfig");this.version(1).stores({usuarios:"++id, email, nome, tipo, ativo, created_at, updated_at, _lastSync, _pendingSync, _deleted",obras:"++id, nome, descricao, endereco, status, usuario_responsavel_id, created_at, updated_at, _lastSync, _pendingSync, _deleted",rdos:"++id, obra_id, usuario_id, data, turno, atividades, observacoes, status, created_at, updated_at, _lastSync, _pendingSync, _deleted",pendingOperations:"++id, table, operation, timestamp, retryCount",offlineConfig:"++id, key, updatedAt"})}}const C=new Cr;class V{static isOffline(){return!navigator.onLine}static async cacheData(r,t){try{const o=Date.now(),s=t.map(a=>({...a,_lastSync:o,_pendingSync:!1,_deleted:!1}));await C[r].clear(),await C[r].clear(),await C[r].bulkAdd(s)}catch{}}static async getCachedData(r,t){try{const s=await C[r].where("_deleted").notEqual(1).toArray();return t?s.filter(t):s}catch{return[]}}static async addPendingOperation(r,t,o){try{await C.pendingOperations.add({table:r,operation:t,data:o,timestamp:Date.now(),retryCount:0})}catch{}}static async getPendingOperations(){try{return await C.pendingOperations.orderBy("timestamp").toArray()}catch{return[]}}static async removePendingOperation(r){try{await C.pendingOperations.delete(r)}catch{}}static async markOperationError(r,t){try{await C.pendingOperations.update(r,{error:t,retryCount:await C.pendingOperations.get(r).then(o=>(o?.retryCount||0)+1)})}catch{}}static async setConfig(r,t){try{const o=await C.offlineConfig.where("key").equals(r).first();o?await C.offlineConfig.update(o.id,{value:t,updatedAt:Date.now()}):await C.offlineConfig.add({key:r,value:t,updatedAt:Date.now()})}catch(o){throw o}}static async getConfig(r){try{return(await C.offlineConfig.where("key").equals(r).first())?.value}catch{return null}}static async cleanOldData(){try{const r=Date.now()-2592e6;await C.pendingOperations.where("retryCount").above(5).delete(),await C.offlineConfig.where("updatedAt").below(r).delete()}catch{}}static async getCacheStats(){try{const[r,t,o,s,a]=await Promise.all([C.usuarios.count(),C.obras.count(),C.rdos.count(),C.pendingOperations.count(),this.getConfig("lastFullSync")]);return{usuarios:r,obras:t,rdos:o,pendingOperations:s,lastSync:a}}catch{return{usuarios:0,obras:0,rdos:0,pendingOperations:0}}}static async clearCache(){try{await Promise.all([C.usuarios.clear(),C.obras.clear(),C.rdos.clear(),C.pendingOperations.clear(),C.offlineConfig.clear()])}catch{}}}C.open().catch(e=>{});const Or=()=>{const[e,r]=k.useState(navigator.onLine),[t,o]=k.useState(!1),[s,a]=k.useState([]);pt(),k.useEffect(()=>{const d=()=>{r(!0),h()},l=()=>{r(!1)};return window.addEventListener("online",d),window.addEventListener("offline",l),()=>{window.removeEventListener("online",d),window.removeEventListener("offline",l)}},[]);const u=k.useCallback(async()=>{const d=await V.getPendingOperations();a(d)},[]),h=k.useCallback(async()=>{if(!(!e||t)){o(!0);try{const d=await V.getPendingOperations();for(const l of d)try{await g(l),await V.removePendingOperation(l.id)}catch(n){await V.markOperationError(l.id,n instanceof Error?n.message:"Unknown error")}await u(),kr.all()}catch{}finally{o(!1)}}},[e,t]),g=async d=>{const{table:l,operation:n,data:c}=d;switch(l){case"usuarios":if(n==="create")await E.from("usuarios").insert(c);else if(n==="update"){const{id:y,...p}=c;await E.from("usuarios").update(p).eq("id",y)}else n==="delete"&&await E.from("usuarios").delete().eq("id",c.id);break;case"obras":if(n==="create")await E.from("obras").insert(c);else if(n==="update"){const{id:y,...p}=c;await E.from("obras").update(p).eq("id",y)}else n==="delete"&&await E.from("obras").delete().eq("id",c.id);break;case"rdos":if(n==="create")await E.from("rdos").insert(c);else if(n==="update"){const{id:y,...p}=c;await E.from("rdos").update(p).eq("id",y)}else n==="delete"&&await E.from("rdos").delete().eq("id",c.id);break}},v=k.useCallback(async()=>{if(e)try{const{data:d}=await E.from("usuarios").select("*").eq("ativo",!0);d&&await V.cacheData("usuarios",d);const{data:l}=await E.from("obras").select("*");l&&await V.cacheData("obras",l);const n=new Date;n.setDate(n.getDate()-30);const{data:c}=await E.from("rdos").select("*").gte("created_at",n.toISOString());c&&await V.cacheData("rdos",c),await V.setConfig("lastFullSync",Date.now())}catch{}},[e]);return k.useEffect(()=>{u(),e&&v()},[u,v,e]),{isOnline:e,isSyncing:t,pendingOperations:s,syncPendingOperations:h,cacheDataForOffline:v,loadPendingOperations:u}},Ar=k.createContext(void 0),Er=({children:e,showNotifications:r=!0})=>{const{isOnline:t,isSyncing:o,pendingOperations:s,syncPendingOperations:a,cacheDataForOffline:u}=Or(),[h,g]=k.useState(!1),[v,d]=k.useState(!1);k.useEffect(()=>{!t&&!v?(d(!0),g(!0)):t&&v&&s.length>0&&g(!0)},[t,v,s.length]),k.useEffect(()=>{const c=setInterval(async()=>{await V.cleanOldData()},864e5);return()=>clearInterval(c)},[]),k.useEffect(()=>{if(t&&s.length>0&&!o){const c=setTimeout(()=>{a()},2e3);return()=>clearTimeout(c)}},[t,s.length,o,a]);const l=()=>{g(!1)},n={isOnline:t,isSyncing:o,pendingOperationsCount:s.length,syncPendingOperations:a,cacheDataForOffline:u,showOfflineNotification:h,dismissOfflineNotification:l};return i.jsxs(Ar.Provider,{value:n,children:[e,r&&i.jsxs(i.Fragment,{children:[h&&i.jsx("div",{className:"fixed top-4 right-4 z-50 max-w-sm",children:i.jsx("div",{className:"bg-white rounded-lg shadow-lg border border-gray-200 p-4",children:i.jsx("div",{className:"flex items-start justify-between",children:i.jsx("div",{className:"flex-1",children:t?s.length>0?i.jsx(ye,{type:"sync",pendingCount:s.length,isSyncing:o,onSync:a,onDismiss:l}):i.jsx(ye,{type:"synced",onDismiss:l}):i.jsx(ye,{type:"offline",onDismiss:l})})})})}),!t&&i.jsx("div",{className:"fixed top-0 left-0 right-0 z-40 bg-orange-500 text-white px-4 py-2",children:i.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm",children:[i.jsx("div",{className:"w-2 h-2 bg-white rounded-full animate-pulse"}),i.jsx("span",{children:"Modo offline ativo - Suas alterações serão sincronizadas quando a conexão for restaurada"})]})})]})]})},ye=({type:e,pendingCount:r=0,isSyncing:t=!1,onSync:o,onDismiss:s})=>{k.useEffect(()=>{if(e==="synced"){const n=setTimeout(s,3e3);return()=>clearTimeout(n)}},[e,s]);const a=()=>{switch(e){case"offline":return{title:"Modo Offline",message:"Você está trabalhando offline. Suas alterações serão salvas localmente.",color:"orange",showDismiss:!0};case"sync":return{title:"Sincronização Pendente",message:`${r} operação(ões) aguardando sincronização.`,color:"blue",showDismiss:!0,showSyncButton:!0};case"synced":return{title:"Sincronizado",message:"Todas as alterações foram sincronizadas com sucesso.",color:"green",showDismiss:!1};default:return{title:"",message:"",color:"gray",showDismiss:!0}}},{title:u,message:h,color:g,showDismiss:v,showSyncButton:d}=a(),l={orange:"text-orange-800 bg-orange-50 border-orange-200",blue:"text-blue-800 bg-blue-50 border-blue-200",green:"text-green-800 bg-green-50 border-green-200",gray:"text-gray-800 bg-gray-50 border-gray-200"};return i.jsx("div",{className:`p-3 rounded-lg border ${l[g]}`,children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("h4",{className:"font-medium text-sm",children:u}),i.jsx("p",{className:"text-xs mt-1 opacity-90",children:h}),d&&i.jsx("div",{className:"mt-2 flex gap-2",children:i.jsx("button",{onClick:o,disabled:t,className:"px-3 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed",children:t?"Sincronizando...":"Sincronizar Agora"})})]}),v&&i.jsx("button",{onClick:s,className:"ml-2 text-gray-400 hover:text-gray-600",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})},Se=k.lazy(()=>I(()=>import("./Dashboard-BPPxBqO4.js"),__vite__mapDeps([7,4,3,2,8,5]))),Je=k.lazy(()=>I(()=>import("./Cadastros-QZZ_REjv.js"),__vite__mapDeps([9,4,3,2,8,5]))),_e=k.lazy(()=>I(()=>import("./CreateRDO-Bhe5_7xI.js"),__vite__mapDeps([10,4,3,2,11,12,5,8,13,1,6]))),lt=k.lazy(()=>I(()=>import("./ObraDetails-S1VcIvXW.js"),__vite__mapDeps([14,4,3,2,8,5]))),Ir=k.lazy(()=>I(()=>import("./RDODetails-tkR9ftO-.js"),__vite__mapDeps([15,4,3,2,8,5,6,1]))),jr=k.lazy(()=>I(()=>import("./Configuracoes-LYuviA0-.js"),__vite__mapDeps([16,4,3,2,8,5,13,1,17,0,6]))),Rr=k.lazy(()=>I(()=>import("./ObraTasks-Cy-rxhIo.js"),__vite__mapDeps([18,4,3,2,8,5]))),Pr=k.lazy(()=>I(()=>import("./CreateTask-BlEDuvPM.js"),__vite__mapDeps([19,4,3,2,8,5]))),Nr=k.lazy(()=>I(()=>import("./ManualInstrucoes-G3xr1xLl.js"),__vite__mapDeps([20,4,3,2,8,5]))),zr=k.lazy(()=>I(()=>import("./Reports-BmqmPZPj.js"),__vite__mapDeps([21,4,3,2,8,5]))),Lr=k.lazy(()=>I(()=>import("./DatabaseTest-BA9LjsoE.js"),__vite__mapDeps([22,4,3,2,5,6,1]))),me=k.lazy(()=>I(()=>import("./Auth-KZISTjMo.js"),__vite__mapDeps([23,4,3,2,24,5,6,1]))),Dr=k.lazy(()=>I(()=>import("./CreateObra-BwwQt_hK.js"),__vite__mapDeps([25,4,3,2,11,12,5,8,0,1,6]))),Tr=k.lazy(()=>I(()=>import("./AuthCallback-DlZVcD4W.js"),__vite__mapDeps([26,4,3,2,5,6,1])).then(e=>({default:e.AuthCallback}))),Mr=k.lazy(()=>I(()=>import("./SelectOrganization-Cb4zDKko.js"),__vite__mapDeps([27,4,3,2,17,24,5,6,1]))),B=[{path:"/login",component:me,requireAuth:!1,useLayout:!1,title:"Login",description:"Página de login do sistema RDO",preload:!0,category:"auth"},{path:"/register",component:me,requireAuth:!1,useLayout:!1,title:"Cadastro",description:"Página de cadastro de usuário",preload:!1,category:"auth"},{path:"/cadastro",component:me,requireAuth:!1,useLayout:!1,title:"Cadastro",description:"Página de cadastro de usuário",preload:!1,category:"auth"},{path:"/auth/callback",component:Tr,requireAuth:!1,useLayout:!1,title:"Callback OAuth",description:"Processamento de retorno OAuth",preload:!1,category:"auth"},{path:"/selecionar-organizacao",component:Mr,requireAuth:!1,useLayout:!1,title:"Selecionar Organização",description:"Seleção de organização via código de convite",preload:!1,category:"auth"},{path:"/",component:Se,requireAuth:!0,useLayout:!0,title:"Dashboard",description:"Painel principal do sistema RDO",preload:!0,category:"main"},{path:"/dashboard",component:Se,requireAuth:!0,useLayout:!0,title:"Dashboard",description:"Painel principal do sistema RDO",preload:!0,category:"main"},{path:"/cadastros",component:Je,requireAuth:!0,useLayout:!0,title:"Cadastros",description:"Gerenciamento de cadastros",preload:!1,category:"admin"},{path:"/cadastros/obras",component:Je,requireAuth:!0,useLayout:!0,title:"Cadastro de Obras",description:"Gerenciamento de obras",preload:!1,category:"admin"},{path:"/cadastros/obras/new",component:Dr,requireAuth:!0,useLayout:!1,title:"Nova Obra",description:"Cadastro de nova obra",preload:!1,category:"admin"},{path:"/reports",component:zr,requireAuth:!0,useLayout:!0,title:"Relatórios",description:"Relatórios e análises do sistema",preload:!1,category:"admin"},{path:"/database-test",component:Lr,requireAuth:!0,useLayout:!0,title:"Teste de Banco",description:"Página de teste do banco de dados",preload:!1,category:"admin"},{path:"/obra/:id",component:lt,requireAuth:!0,useLayout:!1,title:"Detalhes da Obra",description:"Visualização detalhada da obra",preload:!0,category:"obra"},{path:"/obra/:id/tarefas",component:Rr,requireAuth:!0,useLayout:!1,title:"Tarefas da Obra",description:"Gerenciamento de tarefas da obra",preload:!1,category:"obra"},{path:"/obra/:id/tarefa/nova",component:Pr,requireAuth:!0,useLayout:!1,title:"Nova Tarefa",description:"Criação de nova tarefa",preload:!1,category:"obra"},{path:"/obra/:id/rdo/novo",component:_e,requireAuth:!0,useLayout:!1,title:"Novo RDO",description:"Criação de novo RDO",preload:!0,category:"obra"},{path:"/obra/:obraId/rdo/:rdoId",component:Ir,requireAuth:!0,useLayout:!1,title:"Detalhes do RDO",description:"Visualização detalhada do RDO",preload:!1,category:"obra"},{path:"/rdo/novo",component:_e,requireAuth:!0,useLayout:!1,title:"Novo RDO",description:"Criação de novo RDO",preload:!0,category:"obra"},{path:"/configuracoes",component:jr,requireAuth:!0,useLayout:!1,title:"Configurações",description:"Configurações do sistema",preload:!1,category:"admin"},{path:"/manual",component:Nr,requireAuth:!0,useLayout:!1,title:"Manual de Instruções",description:"Manual de uso do sistema",preload:!1,category:"admin"}],Ce={findRoute:e=>B.find(r=>r.path===e),getPublicRoutes:()=>B.filter(e=>!e.requireAuth),getProtectedRoutes:()=>B.filter(e=>e.requireAuth),getLayoutRoutes:()=>B.filter(e=>e.useLayout),getFullScreenRoutes:()=>B.filter(e=>e.requireAuth&&!e.useLayout),getPreloadRoutes:()=>B.filter(e=>e.preload),getRoutesByCategory:e=>B.filter(r=>r.category===e),preloadRoutes:async()=>{const r=Ce.getPreloadRoutes().map(t=>t.component===Se?I(()=>import("./Dashboard-BPPxBqO4.js"),__vite__mapDeps([7,4,3,2,8,5])):t.component===_e?I(()=>import("./CreateRDO-Bhe5_7xI.js"),__vite__mapDeps([10,4,3,2,11,12,5,8,13,1,6])):t.component===lt?I(()=>import("./ObraDetails-S1VcIvXW.js"),__vite__mapDeps([14,4,3,2,8,5])):t.component===me?I(()=>import("./Auth-KZISTjMo.js"),__vite__mapDeps([23,4,3,2,24,5,6,1])):Promise.resolve());await Promise.allSettled(r)},generateBreadcrumbs:e=>{const r=Ce.findRoute(e);if(!r)return[];const t=[{label:"Home",path:"/"}];return r.category==="obra"?t.push({label:"Obras",path:"/obras"}):r.category==="admin"&&t.push({label:"Administração",path:"/cadastros"}),t.push({label:r.title||"Página",path:e}),t}},Qe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InltcGJnZHltZWVzaXZmYWptZ2F0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjUwNjA3MDYsImV4cCI6MjA4MDYzNjcwNn0.TOU2ol_Y2wtipSflHTwHU5QmKriDRF3JeqAzA5gqc9c",VITE_SUPABASE_URL:"https://ympbgdymeesivfajmgat.supabase.co"},re=new Map,ue=e=>{const r=re.get(e);return r?Object.fromEntries(Object.entries(r.stores).map(([t,o])=>[t,o.getState()])):{}},qr=(e,r,t)=>{if(e===void 0)return{type:"untracked",connection:r.connect(t)};const o=re.get(t.name);if(o)return{type:"tracked",store:e,...o};const s={connection:r.connect(t),stores:{}};return re.set(t.name,s),{type:"tracked",store:e,...s}},Vr=(e,r)=>{if(r===void 0)return;const t=re.get(e);t&&(delete t.stores[r],Object.keys(t.stores).length===0&&re.delete(e))},Ur=e=>{var r,t;if(!e)return;const o=e.split(` +`),s=o.findIndex(u=>u.includes("api.setState"));if(s<0)return;const a=((r=o[s+1])==null?void 0:r.trim())||"";return(t=/.+ (.+) .+/.exec(a))==null?void 0:t[1]},Fr=(e,r={})=>(t,o,s)=>{const{enabled:a,anonymousActionType:u,store:h,...g}=r;let v;try{v=(a??(Qe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!v)return e(t,o,s);const{connection:d,...l}=qr(h,v,g);let n=!0;s.setState=((p,O,S)=>{const _=t(p,O);if(!n)return _;const j=S===void 0?{type:u||Ur(new Error().stack)||"anonymous"}:typeof S=="string"?{type:S}:S;return h===void 0?(d?.send(j,o()),_):(d?.send({...j,type:`${h}/${j.type}`},{...ue(g.name),[h]:s.getState()}),_)}),s.devtools={cleanup:()=>{d&&typeof d.unsubscribe=="function"&&d.unsubscribe(),Vr(g.name,h)}};const c=(...p)=>{const O=n;n=!1,t(...p),n=O},y=e(s.setState,o,s);if(l.type==="untracked"?d?.init(y):(l.stores[l.store]=s,d?.init(Object.fromEntries(Object.entries(l.stores).map(([p,O])=>[p,p===l.store?y:O.getState()])))),s.dispatchFromDevtools&&typeof s.dispatch=="function"){let p=!1;const O=s.dispatch;s.dispatch=(...S)=>{(Qe?"production":void 0)!=="production"&&S[0].type==="__setState"&&!p&&(p=!0),O(...S)}}return d.subscribe(p=>{var O;switch(p.type){case"ACTION":return typeof p.payload!="string"?void 0:we(p.payload,S=>{if(S.type==="__setState"){if(h===void 0){c(S.state);return}Object.keys(S.state).length;const _=S.state[h];if(_==null)return;JSON.stringify(s.getState())!==JSON.stringify(_)&&c(_);return}s.dispatchFromDevtools&&typeof s.dispatch=="function"&&s.dispatch(S)});case"DISPATCH":switch(p.payload.type){case"RESET":return c(y),h===void 0?d?.init(s.getState()):d?.init(ue(g.name));case"COMMIT":if(h===void 0){d?.init(s.getState());return}return d?.init(ue(g.name));case"ROLLBACK":return we(p.state,S=>{if(h===void 0){c(S),d?.init(s.getState());return}c(S[h]),d?.init(ue(g.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return we(p.state,S=>{if(h===void 0){c(S);return}JSON.stringify(s.getState())!==JSON.stringify(S[h])&&c(S[h])});case"IMPORT_STATE":{const{nextLiftedState:S}=p.payload,_=(O=S.computedStates.slice(-1)[0])==null?void 0:O.state;if(!_)return;c(h===void 0?_:_[h]),d?.send(null,S);return}case"PAUSE_RECORDING":return n=!n}return}}),y},Gr=Fr,we=(e,r)=>{let t;try{t=JSON.parse(e)}catch{}t!==void 0&&r(t)};function Br(e,r){let t;try{t=e()}catch{return}return{getItem:s=>{var a;const u=g=>g===null?null:JSON.parse(g,void 0),h=(a=t.getItem(s))!=null?a:null;return h instanceof Promise?h.then(u):u(h)},setItem:(s,a)=>t.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>t.removeItem(s)}}const Oe=e=>r=>{try{const t=e(r);return t instanceof Promise?t:{then(o){return Oe(o)(t)},catch(o){return this}}}catch(t){return{then(o){return this},catch(o){return Oe(o)(t)}}}},Jr=(e,r)=>(t,o,s)=>{let a={storage:Br(()=>localStorage),partialize:p=>p,version:0,merge:(p,O)=>({...O,...p}),...r},u=!1;const h=new Set,g=new Set;let v=a.storage;if(!v)return e((...p)=>{t(...p)},o,s);const d=()=>{const p=a.partialize({...o()});return v.setItem(a.name,{state:p,version:a.version})},l=s.setState;s.setState=(p,O)=>(l(p,O),d());const n=e((...p)=>(t(...p),d()),o,s);s.getInitialState=()=>n;let c;const y=()=>{var p,O;if(!v)return;u=!1,h.forEach(_=>{var j;return _((j=o())!=null?j:n)});const S=((O=a.onRehydrateStorage)==null?void 0:O.call(a,(p=o())!=null?p:n))||void 0;return Oe(v.getItem.bind(v))(a.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==a.version){if(a.migrate){const j=a.migrate(_.state,_.version);return j instanceof Promise?j.then(D=>[!0,D]):[!0,j]}}else return[!1,_.state];return[!1,void 0]}).then(_=>{var j;const[D,U]=_;if(c=a.merge(U,(j=o())!=null?j:n),t(c,!0),D)return d()}).then(()=>{S?.(c,void 0),c=o(),u=!0,g.forEach(_=>_(c))}).catch(_=>{S?.(void 0,_)})};return s.persist={setOptions:p=>{a={...a,...p},p.storage&&(v=p.storage)},clearStorage:()=>{v?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>y(),hasHydrated:()=>u,onHydrate:p=>(h.add(p),()=>{h.delete(p)}),onFinishHydration:p=>(g.add(p),()=>{g.delete(p)})},a.skipHydration||y(),c||n},Qr=Jr,ct={theme:"system",language:"pt-BR",autoSync:!0,syncInterval:5,offlineMode:!1,notifications:{push:!0,email:!1,sound:!0},display:{density:"comfortable",animations:!0,reducedMotion:!1}},He={isOnline:navigator.onLine,isSyncing:!1,lastSync:null,syncError:null,isLoading:!1,sidebarCollapsed:!1,currentView:"dashboard",notifications:[],settings:ct,filters:{users:{},obras:{},tasks:{},rdos:{}}},te=At()(Gr(Qr((e,r)=>({...He,setOnline:t=>e({isOnline:t},!1,"setOnline"),setConnectivity:t=>e({isOnline:t},!1,"setConnectivity"),setSyncing:t=>e({isSyncing:t},!1,"setSyncing"),setLastSync:t=>e({lastSync:t},!1,"setLastSync"),setSyncError:t=>e({syncError:t},!1,"setSyncError"),setLoading:t=>e({isLoading:t},!1,"setLoading"),setSidebarCollapsed:t=>e({sidebarCollapsed:t},!1,"setSidebarCollapsed"),setCurrentView:t=>e({currentView:t},!1,"setCurrentView"),addNotification:t=>{const o={...t,id:crypto.randomUUID(),timestamp:new Date().toISOString(),read:!1};e(s=>({notifications:[o,...s.notifications].slice(0,50)}),!1,"addNotification")},removeNotification:t=>{e(o=>({notifications:o.notifications.filter(s=>s.id!==t)}),!1,"removeNotification")},markNotificationAsRead:t=>{e(o=>({notifications:o.notifications.map(s=>s.id===t?{...s,read:!0}:s)}),!1,"markNotificationAsRead")},clearNotifications:()=>e({notifications:[]},!1,"clearNotifications"),updateSettings:t=>{e(o=>({settings:{...o.settings,...t}}),!1,"updateSettings")},resetSettings:()=>e({settings:ct},!1,"resetSettings"),setFilter:(t,o)=>{e(s=>({filters:{...s.filters,[t]:o}}),!1,"setFilter")},clearFilters:t=>{t?e(o=>({filters:{...o.filters,[t]:{}}}),!1,"clearFilter"):e({filters:{users:{},obras:{},tasks:{},rdos:{}}},!1,"clearAllFilters")},initializeApp:()=>{e({isOnline:navigator.onLine,isLoading:!1,lastSync:null,syncError:null},!1,"initializeApp")},reset:()=>e(He,!1,"reset")}),{name:"app-state-store",partialize:e=>({settings:e.settings,sidebarCollapsed:e.sidebarCollapsed,filters:e.filters})}),{name:"app-state-store"}));typeof window<"u"&&(window.addEventListener("online",()=>{te.getState().setOnline(!0)}),window.addEventListener("offline",()=>{te.getState().setOnline(!1)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const{settings:r}=te.getState();r.theme==="system"&&te.getState().updateSettings({theme:"system"})}));class Hr extends k.Component{constructor(t){super(t);F(this,"handleRetry",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});F(this,"handleGoHome",()=>{window.location.href="/"});this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t,errorInfo:null}}componentDidCatch(t,o){this.setState({error:t,errorInfo:o}),this.props.onError&&this.props.onError(t,o)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:i.jsx("div",{className:"min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:i.jsx("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:i.jsx("div",{className:"bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10",children:i.jsxs("div",{className:"text-center",children:[i.jsx(St,{className:"mx-auto h-12 w-12 text-red-500 mb-4"}),i.jsx("h2",{className:"text-lg font-medium text-gray-900 mb-2",children:"Ops! Algo deu errado"}),i.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"Ocorreu um erro inesperado. Você pode tentar recarregar a página ou voltar ao início."}),!1,i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[i.jsxs("button",{onClick:this.handleRetry,className:"flex-1 flex justify-center items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[i.jsx(_t,{className:"w-4 h-4 mr-2"}),"Tentar novamente"]}),i.jsxs("button",{onClick:this.handleGoHome,className:"flex-1 flex justify-center items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[i.jsx(Ke,{className:"w-4 h-4 mr-2"}),"Ir para início"]})]})]})})})}):this.props.children}}const Wr=({children:e,fallback:r,onError:t})=>i.jsx(Hr,{fallback:r,onError:t,children:e}),Kr=()=>i.jsx("div",{className:"flex items-center justify-center min-h-screen",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}),Zr=e=>{const r=e.component,t=i.jsx(k.Suspense,{fallback:i.jsx(Kr,{}),children:i.jsx(wr,{requireAuth:e.requireAuth,children:e.useLayout?i.jsx(fr,{children:i.jsx(r,{})}):i.jsx(r,{})})});return i.jsx(bt,{path:e.path,element:t},e.path)};function $r(){const{initializeApp:e,setConnectivity:r}=te();return k.useEffect(()=>{e();const t=setTimeout(()=>{Ce.preloadRoutes().catch(console.warn)},1e3),o=()=>r(!0),s=()=>r(!1);return window.addEventListener("online",o),window.addEventListener("offline",s),()=>{clearTimeout(t),window.removeEventListener("online",o),window.removeEventListener("offline",s)}},[e,r]),i.jsx(ht,{children:B.map(Zr)})}function Yr(){return i.jsx(Wr,{children:i.jsx(gt,{children:i.jsx(_r,{children:i.jsx(Er,{children:i.jsx(br,{children:i.jsx($r,{})})})})})})}It.createRoot(document.getElementById("root")).render(i.jsx(k.StrictMode,{children:i.jsx(Yr,{})}));export{Gr as d,Qr as p,E as s,yr as u}; diff --git a/dist/assets/js/query-vendor-BLVqILA6.js b/dist/assets/js/query-vendor-BLVqILA6.js new file mode 100644 index 0000000..c94a190 --- /dev/null +++ b/dist/assets/js/query-vendor-BLVqILA6.js @@ -0,0 +1,9 @@ +var qt=e=>{throw TypeError(e)};var vt=(e,t,s)=>t.has(e)||qt("Cannot "+s);var i=(e,t,s)=>(vt(e,t,"read from private field"),s?s.call(e):t.get(e)),l=(e,t,s)=>t.has(e)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),h=(e,t,s,r)=>(vt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),w=(e,t,s)=>(vt(e,t,"access private method"),s);var ft=(e,t,s,r)=>({set _(n){h(e,t,n,s)},get _(){return i(e,t,r)}});import{r as Ct}from"./router-vendor-D4by-_6Z.js";import{r as ee}from"./react-vendor-CqRd3GwO.js";var gt={exports:{}},it={};/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Mt;function se(){if(Mt)return it;Mt=1;var e=ee(),t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(o,a,d){var f,p={},y=null,S=null;d!==void 0&&(y=""+d),a.key!==void 0&&(y=""+a.key),a.ref!==void 0&&(S=a.ref);for(f in a)r.call(a,f)&&!u.hasOwnProperty(f)&&(p[f]=a[f]);if(o&&o.defaultProps)for(f in a=o.defaultProps,a)p[f]===void 0&&(p[f]=a[f]);return{$$typeof:t,type:o,key:y,ref:S,props:p,_owner:n.current}}return it.Fragment=s,it.jsx=c,it.jsxs=c,it}var Qt;function re(){return Qt||(Qt=1,gt.exports=se()),gt.exports}var ie=re();const ne=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),ae=function(e){return"/"+e},At={},je=function(t,s,r){let n=Promise.resolve();if(s&&s.length>0){let c=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");n=c(s.map(d=>{if(d=ae(d),d in At)return;At[d]=!0;const f=d.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const y=document.createElement("link");if(y.rel=f?"stylesheet":ne,f||(y.as="script"),y.crossOrigin="",y.href=d,a&&y.setAttribute("nonce",a),document.head.appendChild(y),f)return new Promise((S,b)=>{y.addEventListener("load",S),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=c,window.dispatchEvent(o),!o.defaultPrevented)throw c}return n.then(c=>{for(const o of c||[])o.status==="rejected"&&u(o.reason);return t().catch(u)})};var yt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},oe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},I,St,kt,ue=(kt=class{constructor(){l(this,I,oe);l(this,St,!1)}setTimeoutProvider(e){h(this,I,e)}setTimeout(e,t){return i(this,I).setTimeout(e,t)}clearTimeout(e){i(this,I).clearTimeout(e)}setInterval(e,t){return i(this,I).setInterval(e,t)}clearInterval(e){i(this,I).clearInterval(e)}},I=new WeakMap,St=new WeakMap,kt),bt=new ue;function ce(e){setTimeout(e,0)}var mt=typeof window>"u"||"Deno"in globalThis;function E(){}function he(e,t){return typeof e=="function"?e(t):e}function le(e){return typeof e=="number"&&e>=0&&e!==1/0}function fe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wt(e,t){return typeof e=="function"?e(t):e}function de(e,t){return typeof e=="function"?e(t):e}function Dt(e,t){const{type:s="all",exact:r,fetchStatus:n,predicate:u,queryKey:c,stale:o}=e;if(c){if(r){if(t.queryHash!==Ft(c,t.options))return!1}else if(!at(t.queryKey,c))return!1}if(s!=="all"){const a=t.isActive();if(s==="active"&&!a||s==="inactive"&&a)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||n&&n!==t.state.fetchStatus||u&&!u(t))}function Tt(e,t){const{exact:s,status:r,predicate:n,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(s){if(nt(t.options.mutationKey)!==nt(u))return!1}else if(!at(t.options.mutationKey,u))return!1}return!(r&&t.state.status!==r||n&&!n(t))}function Ft(e,t){return(t?.queryKeyHashFn||nt)(e)}function nt(e){return JSON.stringify(e,(t,s)=>Pt(s)?Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{}):s)}function at(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>at(e[s],t[s])):!1}var pe=Object.prototype.hasOwnProperty;function Wt(e,t){if(e===t)return e;const s=xt(e)&&xt(t);if(!s&&!(Pt(e)&&Pt(t)))return t;const n=(s?e:Object.keys(e)).length,u=s?t:Object.keys(t),c=u.length,o=s?new Array(c):{};let a=0;for(let d=0;d{bt.setTimeout(t,e)})}function me(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Wt(e,t):t}function ve(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function ge(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Et=Symbol();function zt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Et?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var N,U,z,Kt,be=(Kt=class extends yt{constructor(){super();l(this,N);l(this,U);l(this,z);h(this,z,t=>{if(!mt&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,U)||this.setEventListener(i(this,z))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,U))==null||t.call(this),h(this,U,void 0))}setEventListener(t){var s;h(this,z,t),(s=i(this,U))==null||s.call(this),h(this,U,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,N)!==t&&(h(this,N,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){return typeof i(this,N)=="boolean"?i(this,N):globalThis.document?.visibilityState!=="hidden"}},N=new WeakMap,U=new WeakMap,z=new WeakMap,Kt),Vt=new be;function we(){let e,t;const s=new Promise((n,u)=>{e=n,t=u});s.status="pending",s.catch(()=>{});function r(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{r({status:"fulfilled",value:n}),e(n)},s.reject=n=>{r({status:"rejected",reason:n}),t(n)},s}var Pe=ce;function Oe(){let e=[],t=0,s=o=>{o()},r=o=>{o()},n=Pe;const u=o=>{t?e.push(o):n(()=>{s(o)})},c=()=>{const o=e;e=[],o.length&&n(()=>{r(()=>{o.forEach(a=>{s(a)})})})};return{batch:o=>{let a;t++;try{a=o()}finally{t--,t||c()}return a},batchCalls:o=>(...a)=>{u(()=>{o(...a)})},schedule:u,setNotifyFunction:o=>{s=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{n=o}}}var O=Oe(),V,_,Y,Lt,Se=(Lt=class extends yt{constructor(){super();l(this,V,!0);l(this,_);l(this,Y);h(this,Y,t=>{if(!mt&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,_)||this.setEventListener(i(this,Y))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,_))==null||t.call(this),h(this,_,void 0))}setEventListener(t){var s;h(this,Y,t),(s=i(this,_))==null||s.call(this),h(this,_,t(this.setOnline.bind(this)))}setOnline(t){i(this,V)!==t&&(h(this,V,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,V)}},V=new WeakMap,_=new WeakMap,Y=new WeakMap,Lt),pt=new Se;function Ce(e){return Math.min(1e3*2**e,3e4)}function Yt(e){return(e??"online")==="online"?pt.isOnline():!0}var Ot=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Zt(e){let t=!1,s=0,r;const n=we(),u=()=>n.status!=="pending",c=v=>{if(!u()){const C=new Ot(v);y(C),e.onCancel?.(C)}},o=()=>{t=!0},a=()=>{t=!1},d=()=>Vt.isFocused()&&(e.networkMode==="always"||pt.isOnline())&&e.canRun(),f=()=>Yt(e.networkMode)&&e.canRun(),p=v=>{u()||(r?.(),n.resolve(v))},y=v=>{u()||(r?.(),n.reject(v))},S=()=>new Promise(v=>{r=C=>{(u()||d())&&v(C)},e.onPause?.()}).then(()=>{r=void 0,u()||e.onContinue?.()}),b=()=>{if(u())return;let v;const C=s===0?e.initialPromise:void 0;try{v=C??e.fn()}catch(M){v=Promise.reject(M)}Promise.resolve(v).then(p).catch(M=>{if(u())return;const H=e.retry??(mt?0:3),rt=e.retryDelay??Ce,ht=typeof rt=="function"?rt(s,M):rt,lt=H===!0||typeof H=="number"&&sd()?void 0:S()).then(()=>{t?y(M):b()})})};return{promise:n,status:()=>n.status,cancel:c,continue:()=>(r?.(),n),cancelRetry:o,continueRetry:a,canStart:f,start:()=>(f()?b():S().then(b),n)}}var G,Ht,Xt=(Ht=class{constructor(){l(this,G)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),le(this.gcTime)&&h(this,G,bt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(mt?1/0:300*1e3))}clearGcTimeout(){i(this,G)&&(bt.clearTimeout(i(this,G)),h(this,G,void 0))}},G=new WeakMap,Ht),B,Z,F,$,g,ot,J,R,T,Nt,Fe=(Nt=class extends Xt{constructor(t){super();l(this,R);l(this,B);l(this,Z);l(this,F);l(this,$);l(this,g);l(this,ot);l(this,J);h(this,J,!1),h(this,ot,t.defaultOptions),this.setOptions(t.options),this.observers=[],h(this,$,t.client),h(this,F,i(this,$).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,h(this,B,It(this.options)),this.state=t.state??i(this,B),this.scheduleGc()}get meta(){return this.options.meta}get promise(){return i(this,g)?.promise}setOptions(t){if(this.options={...i(this,ot),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=It(this.options);s.data!==void 0&&(this.setData(s.data,{updatedAt:s.dataUpdatedAt,manual:!0}),h(this,B,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,F).remove(this)}setData(t,s){const r=me(this.state.data,t,this.options);return w(this,R,T).call(this,{data:r,type:"success",dataUpdatedAt:s?.updatedAt,manual:s?.manual}),r}setState(t,s){w(this,R,T).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){const s=i(this,g)?.promise;return i(this,g)?.cancel(t),s?s.then(E).catch(E):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,B))}isActive(){return this.observers.some(t=>de(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Et||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!fe(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(s=>s.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),i(this,g)?.continue()}onOnline(){this.observers.find(s=>s.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),i(this,g)?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,F).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(i(this,g)&&(i(this,J)?i(this,g).cancel({revert:!0}):i(this,g).cancelRetry()),this.scheduleGc()),i(this,F).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||w(this,R,T).call(this,{type:"invalidate"})}async fetch(t,s){if(this.state.fetchStatus!=="idle"&&i(this,g)?.status()!=="rejected"){if(this.state.data!==void 0&&s?.cancelRefetch)this.cancel({silent:!0});else if(i(this,g))return i(this,g).continueRetry(),i(this,g).promise}if(t&&this.setOptions(t),!this.options.queryFn){const a=this.observers.find(d=>d.options.queryFn);a&&this.setOptions(a.options)}const r=new AbortController,n=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(h(this,J,!0),r.signal)})},u=()=>{const a=zt(this.options,s),f=(()=>{const p={client:i(this,$),queryKey:this.queryKey,meta:this.meta};return n(p),p})();return h(this,J,!1),this.options.persister?this.options.persister(a,f,this):a(f)},o=(()=>{const a={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:i(this,$),state:this.state,fetchFn:u};return n(a),a})();this.options.behavior?.onFetch(o,this),h(this,Z,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&w(this,R,T).call(this,{type:"fetch",meta:o.fetchOptions?.meta}),h(this,g,Zt({initialPromise:s?.initialPromise,fn:o.fetchFn,onCancel:a=>{a instanceof Ot&&a.revert&&this.setState({...i(this,Z),fetchStatus:"idle"}),r.abort()},onFail:(a,d)=>{w(this,R,T).call(this,{type:"failed",failureCount:a,error:d})},onPause:()=>{w(this,R,T).call(this,{type:"pause"})},onContinue:()=>{w(this,R,T).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const a=await i(this,g).start();if(a===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(a),i(this,F).config.onSuccess?.(a,this),i(this,F).config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof Ot){if(a.silent)return i(this,g).promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw w(this,R,T).call(this,{type:"error",error:a}),i(this,F).config.onError?.(a,this),i(this,F).config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}},B=new WeakMap,Z=new WeakMap,F=new WeakMap,$=new WeakMap,g=new WeakMap,ot=new WeakMap,J=new WeakMap,R=new WeakSet,T=function(t){const s=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Ee(r.data,this.options),fetchMeta:t.meta??null};case"success":const n={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return h(this,Z,t.manual?n:void 0),n;case"error":const u=t.error;return{...r,error:u,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),O.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,F).notify({query:this,type:"updated",action:t})})},Nt);function Ee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Yt(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function It(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function Ut(e){return{onFetch:(t,s)=>{const r=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,u=t.state.data?.pages||[],c=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},a=0;const d=async()=>{let f=!1;const p=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},y=zt(t.options,t.fetchOptions),S=async(b,v,C)=>{if(f)return Promise.reject();if(v==null&&b.pages.length)return Promise.resolve(b);const H=(()=>{const Rt={client:t.client,queryKey:t.queryKey,pageParam:v,direction:C?"backward":"forward",meta:t.options.meta};return p(Rt),Rt})(),rt=await y(H),{maxPages:ht}=t.options,lt=C?ge:ve;return{pages:lt(b.pages,rt,ht),pageParams:lt(b.pageParams,v,ht)}};if(n&&u.length){const b=n==="backward",v=b?Re:_t,C={pages:u,pageParams:c},M=v(r,C);o=await S(C,M,b)}else{const b=e??u.length;do{const v=a===0?c[0]??r.initialPageParam:_t(r,o);if(a>0&&v==null)break;o=await S(o,v),a++}while(at.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s):t.fetchFn=d}}}function _t(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function Re(e,{pages:t,pageParams:s}){return t.length>0?e.getPreviousPageParam?.(t[0],t,s[0],s):void 0}var ut,Q,P,W,A,j,Gt,qe=(Gt=class extends Xt{constructor(t){super();l(this,A);l(this,ut);l(this,Q);l(this,P);l(this,W);h(this,ut,t.client),this.mutationId=t.mutationId,h(this,P,t.mutationCache),h(this,Q,[]),this.state=t.state||Me(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){i(this,Q).includes(t)||(i(this,Q).push(t),this.clearGcTimeout(),i(this,P).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){h(this,Q,i(this,Q).filter(s=>s!==t)),this.scheduleGc(),i(this,P).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,Q).length||(this.state.status==="pending"?this.scheduleGc():i(this,P).remove(this))}continue(){return i(this,W)?.continue()??this.execute(this.state.variables)}async execute(t){const s=()=>{w(this,A,j).call(this,{type:"continue"})},r={client:i(this,ut),meta:this.options.meta,mutationKey:this.options.mutationKey};h(this,W,Zt({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(c,o)=>{w(this,A,j).call(this,{type:"failed",failureCount:c,error:o})},onPause:()=>{w(this,A,j).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,P).canRun(this)}));const n=this.state.status==="pending",u=!i(this,W).canStart();try{if(n)s();else{w(this,A,j).call(this,{type:"pending",variables:t,isPaused:u}),await i(this,P).config.onMutate?.(t,this,r);const o=await this.options.onMutate?.(t,r);o!==this.state.context&&w(this,A,j).call(this,{type:"pending",context:o,variables:t,isPaused:u})}const c=await i(this,W).start();return await i(this,P).config.onSuccess?.(c,t,this.state.context,this,r),await this.options.onSuccess?.(c,t,this.state.context,r),await i(this,P).config.onSettled?.(c,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(c,null,t,this.state.context,r),w(this,A,j).call(this,{type:"success",data:c}),c}catch(c){try{throw await i(this,P).config.onError?.(c,t,this.state.context,this,r),await this.options.onError?.(c,t,this.state.context,r),await i(this,P).config.onSettled?.(void 0,c,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,c,t,this.state.context,r),c}finally{w(this,A,j).call(this,{type:"error",error:c})}}finally{i(this,P).runNext(this)}}},ut=new WeakMap,Q=new WeakMap,P=new WeakMap,W=new WeakMap,A=new WeakSet,j=function(t){const s=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),O.batch(()=>{i(this,Q).forEach(r=>{r.onMutationUpdate(t)}),i(this,P).notify({mutation:this,type:"updated",action:t})})},Gt);function Me(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var x,q,ct,Bt,Qe=(Bt=class extends yt{constructor(t={}){super();l(this,x);l(this,q);l(this,ct);this.config=t,h(this,x,new Set),h(this,q,new Map),h(this,ct,0)}build(t,s,r){const n=new qe({client:t,mutationCache:this,mutationId:++ft(this,ct)._,options:t.defaultMutationOptions(s),state:r});return this.add(n),n}add(t){i(this,x).add(t);const s=dt(t);if(typeof s=="string"){const r=i(this,q).get(s);r?r.push(t):i(this,q).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(i(this,x).delete(t)){const s=dt(t);if(typeof s=="string"){const r=i(this,q).get(s);if(r)if(r.length>1){const n=r.indexOf(t);n!==-1&&r.splice(n,1)}else r[0]===t&&i(this,q).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=dt(t);if(typeof s=="string"){const n=i(this,q).get(s)?.find(u=>u.state.status==="pending");return!n||n===t}else return!0}runNext(t){const s=dt(t);return typeof s=="string"?i(this,q).get(s)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){O.batch(()=>{i(this,x).forEach(t=>{this.notify({type:"removed",mutation:t})}),i(this,x).clear(),i(this,q).clear()})}getAll(){return Array.from(i(this,x))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>Tt(s,r))}findAll(t={}){return this.getAll().filter(s=>Tt(t,s))}notify(t){O.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return O.batch(()=>Promise.all(t.map(s=>s.continue().catch(E))))}},x=new WeakMap,q=new WeakMap,ct=new WeakMap,Bt);function dt(e){return e.options.scope?.id}var D,$t,Ae=($t=class extends yt{constructor(t={}){super();l(this,D);this.config=t,h(this,D,new Map)}build(t,s,r){const n=s.queryKey,u=s.queryHash??Ft(n,s);let c=this.get(u);return c||(c=new Fe({client:t,queryKey:n,queryHash:u,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(c)),c}add(t){i(this,D).has(t.queryHash)||(i(this,D).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,D).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,D).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,D).get(t)}getAll(){return[...i(this,D).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>Dt(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>Dt(t,r)):s}notify(t){O.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},D=new WeakMap,$t),m,k,K,X,tt,L,et,st,Jt,Ie=(Jt=class{constructor(e={}){l(this,m);l(this,k);l(this,K);l(this,X);l(this,tt);l(this,L);l(this,et);l(this,st);h(this,m,e.queryCache||new Ae),h(this,k,e.mutationCache||new Qe),h(this,K,e.defaultOptions||{}),h(this,X,new Map),h(this,tt,new Map),h(this,L,0)}mount(){ft(this,L)._++,i(this,L)===1&&(h(this,et,Vt.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,m).onFocus())})),h(this,st,pt.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,m).onOnline())})))}unmount(){var e,t;ft(this,L)._--,i(this,L)===0&&((e=i(this,et))==null||e.call(this),h(this,et,void 0),(t=i(this,st))==null||t.call(this),h(this,st,void 0))}isFetching(e){return i(this,m).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,k).findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return i(this,m).get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,m).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(wt(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,m).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),u=i(this,m).get(r.queryHash)?.state.data,c=he(t,u);if(c!==void 0)return i(this,m).build(this,r).setData(c,{...s,manual:!0})}setQueriesData(e,t,s){return O.batch(()=>i(this,m).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return i(this,m).get(t.queryHash)?.state}removeQueries(e){const t=i(this,m);O.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,m);return O.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=O.batch(()=>i(this,m).findAll(e).map(n=>n.cancel(s)));return Promise.all(r).then(E).catch(E)}invalidateQueries(e,t={}){return O.batch(()=>(i(this,m).findAll(e).forEach(s=>{s.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},r=O.batch(()=>i(this,m).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let u=n.fetch(void 0,s);return s.throwOnError||(u=u.catch(E)),n.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(E)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,m).build(this,t);return s.isStaleByTime(wt(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(E).catch(E)}fetchInfiniteQuery(e){return e.behavior=Ut(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(E).catch(E)}ensureInfiniteQueryData(e){return e.behavior=Ut(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pt.isOnline()?i(this,k).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,m)}getMutationCache(){return i(this,k)}getDefaultOptions(){return i(this,K)}setDefaultOptions(e){h(this,K,e)}setQueryDefaults(e,t){i(this,X).set(nt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,X).values()],s={};return t.forEach(r=>{at(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,tt).set(nt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,tt).values()],s={};return t.forEach(r=>{at(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,K).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ft(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Et&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...i(this,K).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,m).clear(),i(this,k).clear()}},m=new WeakMap,k=new WeakMap,K=new WeakMap,X=new WeakMap,tt=new WeakMap,L=new WeakMap,et=new WeakMap,st=new WeakMap,Jt),te=Ct.createContext(void 0),Ue=e=>{const t=Ct.useContext(te);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_e=({client:e,children:t})=>(Ct.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),ie.jsx(te.Provider,{value:e,children:t}));export{Ie as Q,je as _,_e as a,ie as j,Ue as u}; diff --git a/dist/assets/js/react-vendor-CqRd3GwO.js b/dist/assets/js/react-vendor-CqRd3GwO.js new file mode 100644 index 0000000..87e0831 --- /dev/null +++ b/dist/assets/js/react-vendor-CqRd3GwO.js @@ -0,0 +1,32 @@ +var Pc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nc(T){return T&&T.__esModule&&Object.prototype.hasOwnProperty.call(T,"default")?T.default:T}function zc(T){if(Object.prototype.hasOwnProperty.call(T,"__esModule"))return T;var $=T.default;if(typeof $=="function"){var m=function ge(){return this instanceof ge?Reflect.construct($,arguments,this.constructor):$.apply(this,arguments)};m.prototype=$.prototype}else m={};return Object.defineProperty(m,"__esModule",{value:!0}),Object.keys(T).forEach(function(ge){var we=Object.getOwnPropertyDescriptor(T,ge);Object.defineProperty(m,ge,we.get?we:{enumerable:!0,get:function(){return T[ge]}})}),m}var wo={exports:{}},M={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ya;function Sc(){if(ya)return M;ya=1;var T=Symbol.for("react.element"),$=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),ge=Symbol.for("react.strict_mode"),we=Symbol.for("react.profiler"),Ye=Symbol.for("react.provider"),Xe=Symbol.for("react.context"),Re=Symbol.for("react.forward_ref"),de=Symbol.for("react.suspense"),Ue=Symbol.for("react.memo"),ln=Symbol.for("react.lazy"),oe=Symbol.iterator;function ne(f){return f===null||typeof f!="object"?null:(f=oe&&f[oe]||f["@@iterator"],typeof f=="function"?f:null)}var pt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ve=Object.assign,Y={};function B(f,h,O){this.props=f,this.context=h,this.refs=Y,this.updater=O||pt}B.prototype.isReactComponent={},B.prototype.setState=function(f,h){if(typeof f!="object"&&typeof f!="function"&&f!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,f,h,"setState")},B.prototype.forceUpdate=function(f){this.updater.enqueueForceUpdate(this,f,"forceUpdate")};function mt(){}mt.prototype=B.prototype;function ut(f,h,O){this.props=f,this.context=h,this.refs=Y,this.updater=O||pt}var Ge=ut.prototype=new mt;Ge.constructor=ut,Ve(Ge,B.prototype),Ge.isPureReactComponent=!0;var pe=Array.isArray,Ze=Object.prototype.hasOwnProperty,Se={current:null},_e={key:!0,ref:!0,__self:!0,__source:!0};function Ae(f,h,O){var D,F={},j=null,H=null;if(h!=null)for(D in h.ref!==void 0&&(H=h.ref),h.key!==void 0&&(j=""+h.key),h)Ze.call(h,D)&&!_e.hasOwnProperty(D)&&(F[D]=h[D]);var V=arguments.length-2;if(V===1)F.children=O;else if(1>>1,h=S[f];if(0>>1;fwe(F,_))jwe(H,F)?(S[f]=H,S[j]=_,f=j):(S[f]=F,S[D]=_,f=D);else if(jwe(H,_))S[f]=H,S[j]=_,f=j;else break e}}return L}function we(S,L){var _=S.sortIndex-L.sortIndex;return _!==0?_:S.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var Ye=performance;T.unstable_now=function(){return Ye.now()}}else{var Xe=Date,Re=Xe.now();T.unstable_now=function(){return Xe.now()-Re}}var de=[],Ue=[],ln=1,oe=null,ne=3,pt=!1,Ve=!1,Y=!1,B=typeof setTimeout=="function"?setTimeout:null,mt=typeof clearTimeout=="function"?clearTimeout:null,ut=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Ge(S){for(var L=m(Ue);L!==null;){if(L.callback===null)ge(Ue);else if(L.startTime<=S)ge(Ue),L.sortIndex=L.expirationTime,$(de,L);else break;L=m(Ue)}}function pe(S){if(Y=!1,Ge(S),!Ve)if(m(de)!==null)Ve=!0,Ce(Ze);else{var L=m(Ue);L!==null&&q(pe,L.startTime-S)}}function Ze(S,L){Ve=!1,Y&&(Y=!1,mt(Ae),Ae=-1),pt=!0;var _=ne;try{for(Ge(L),oe=m(de);oe!==null&&(!(oe.expirationTime>L)||S&&!$t());){var f=oe.callback;if(typeof f=="function"){oe.callback=null,ne=oe.priorityLevel;var h=f(oe.expirationTime<=L);L=T.unstable_now(),typeof h=="function"?oe.callback=h:oe===m(de)&&ge(de),Ge(L)}else ge(de);oe=m(de)}if(oe!==null)var O=!0;else{var D=m(Ue);D!==null&&q(pe,D.startTime-L),O=!1}return O}finally{oe=null,ne=_,pt=!1}}var Se=!1,_e=null,Ae=-1,Ct=5,vt=-1;function $t(){return!(T.unstable_now()-vtS||125f?(S.sortIndex=_,$(Ue,S),m(de)===null&&S===m(Ue)&&(Y?(mt(Ae),Ae=-1):Y=!0,q(pe,_-f))):(S.sortIndex=h,$(de,S),Ve||pt||(Ve=!0,Ce(Ze))),S},T.unstable_shouldYield=$t,T.unstable_wrapCallback=function(S){var L=ne;return function(){var _=ne;ne=L;try{return S.apply(this,arguments)}finally{ne=_}}}})(Eo)),Eo}var Sa;function _c(){return Sa||(Sa=1,ko.exports=Ec()),ko.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ka;function Cc(){if(ka)return Le;ka=1;var T=kc(),$=_c();function m(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),de=Object.prototype.hasOwnProperty,Ue=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ln={},oe={};function ne(e){return de.call(oe,e)?!0:de.call(ln,e)?!1:Ue.test(e)?oe[e]=!0:(ln[e]=!0,!1)}function pt(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ve(e,t,n,r){if(t===null||typeof t>"u"||pt(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Y(e,t,n,r,l,u,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=o}var B={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){B[e]=new Y(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];B[t]=new Y(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){B[e]=new Y(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){B[e]=new Y(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){B[e]=new Y(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){B[e]=new Y(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){B[e]=new Y(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){B[e]=new Y(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){B[e]=new Y(e,5,!1,e.toLowerCase(),null,!1,!1)});var mt=/[\-:]([a-z])/g;function ut(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(mt,ut);B[t]=new Y(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(mt,ut);B[t]=new Y(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(mt,ut);B[t]=new Y(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){B[e]=new Y(e,1,!1,e.toLowerCase(),null,!1,!1)}),B.xlinkHref=new Y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){B[e]=new Y(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ge(e,t,n,r){var l=B.hasOwnProperty(t)?B[t]:null;(l!==null?l.type!==0:r||!(2i||l[o]!==u[i]){var s=` +`+l[o].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=o&&0<=i);break}}}finally{O=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?h(e):""}function F(e){switch(e.tag){case 5:return h(e.type);case 16:return h("Lazy");case 13:return h("Suspense");case 19:return h("SuspenseList");case 0:case 2:case 15:return e=D(e.type,!1),e;case 11:return e=D(e.type.render,!1),e;case 1:return e=D(e.type,!0),e;default:return""}}function j(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _e:return"Fragment";case Se:return"Portal";case Ct:return"Profiler";case Ae:return"StrictMode";case Oe:return"Suspense";case Je:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case $t:return(e.displayName||"Context")+".Consumer";case vt:return(e._context.displayName||"Context")+".Provider";case ot:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case it:return t=e.displayName||null,t!==null?t:j(e.type)||"Memo";case Ce:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}function H(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return j(t);case 8:return t===Ae?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function V(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function X(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Me(e){var t=X(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,u=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,u.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function hr(e){e._valueTracker||(e._valueTracker=Me(e))}function _o(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=X(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function yr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Pl(e,t){var n=t.checked;return _({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Co(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=V(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function xo(e,t){t=t.checked,t!=null&&Ge(e,"checked",t,!1)}function Nl(e,t){xo(e,t);var n=V(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zl(e,t.type,n):t.hasOwnProperty("defaultValue")&&zl(e,t.type,V(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Po(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function zl(e,t,n){(t!=="number"||yr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rn=Array.isArray;function un(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=gr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function On(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_a=["Webkit","ms","Moz","O"];Object.keys(Mn).forEach(function(e){_a.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mn[t]=Mn[e]})});function Oo(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mn.hasOwnProperty(e)&&Mn[e]?(""+t).trim():t+"px"}function Mo(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Oo(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ca=_({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Rl(e,t){if(t){if(Ca[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(m(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(m(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(m(61))}if(t.style!=null&&typeof t.style!="object")throw Error(m(62))}}function Ol(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ml=null;function Dl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Il=null,on=null,sn=null;function Do(e){if(e=tr(e)){if(typeof Il!="function")throw Error(m(280));var t=e.stateNode;t&&(t=Br(t),Il(e.stateNode,e.type,t))}}function Io(e){on?sn?sn.push(e):sn=[e]:on=e}function Fo(){if(on){var e=on,t=sn;if(sn=on=null,Do(e),t)for(e=0;e>>=0,e===0?32:31-(Ia(e)/Fa|0)|0}var _r=64,Cr=4194304;function jn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function xr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,u=e.pingedLanes,o=n&268435455;if(o!==0){var i=o&~l;i!==0?r=jn(i):(u&=o,u!==0&&(r=jn(u)))}else o=n&~l,o!==0?r=jn(o):u!==0&&(r=jn(u));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,u=t&-t,l>=u||l===16&&(u&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Un(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-qe(t),e[t]=n}function Aa(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Kn),fi=" ",ci=!1;function di(e,t){switch(e){case"keyup":return vf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pi(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cn=!1;function yf(e,t){switch(e){case"compositionend":return pi(t);case"keypress":return t.which!==32?null:(ci=!0,fi);case"textInput":return e=t.data,e===fi&&ci?null:e;default:return null}}function gf(e,t){if(cn)return e==="compositionend"||!bl&&di(e,t)?(e=li(),Lr=Yl=Tt=null,cn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Si(n)}}function Ei(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ei(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _i(){for(var e=window,t=yr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=yr(e.document)}return t}function nu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Nf(e){var t=_i(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ei(n.ownerDocument.documentElement,n)){if(r!==null&&nu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,u=Math.min(r.start,l);r=r.end===void 0?u:Math.min(r.end,l),!e.extend&&u>r&&(l=r,r=u,u=l),l=ki(n,u);var o=ki(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),u>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,dn=null,ru=null,Zn=null,lu=!1;function Ci(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lu||dn==null||dn!==yr(r)||(r=dn,"selectionStart"in r&&nu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Zn&&Gn(Zn,r)||(Zn=r,r=Ur(ru,"onSelect"),0yn||(e.current=hu[yn],hu[yn]=null,yn--)}function W(e,t){yn++,hu[yn]=e.current,e.current=t}var Mt={},me=Ot(Mt),xe=Ot(!1),Yt=Mt;function gn(e,t){var n=e.type.contextTypes;if(!n)return Mt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},u;for(u in n)l[u]=t[u];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Pe(e){return e=e.childContextTypes,e!=null}function Hr(){K(xe),K(me)}function Vi(e,t,n){if(me.current!==Mt)throw Error(m(168));W(me,t),W(xe,n)}function Ai(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(m(108,H(e)||"Unknown",l));return _({},n,r)}function Wr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Mt,Yt=me.current,W(me,e),W(xe,xe.current),!0}function Bi(e,t,n){var r=e.stateNode;if(!r)throw Error(m(169));n?(e=Ai(e,t,Yt),r.__reactInternalMemoizedMergedChildContext=e,K(xe),K(me),W(me,e)):K(xe),W(xe,n)}var yt=null,$r=!1,yu=!1;function Hi(e){yt===null?yt=[e]:yt.push(e)}function Vf(e){$r=!0,Hi(e)}function Dt(){if(!yu&&yt!==null){yu=!0;var e=0,t=A;try{var n=yt;for(A=1;e>=o,l-=o,gt=1<<32-qe(t)+l|n<R?(ae=z,z=null):ae=z.sibling;var U=v(c,z,d[R],w);if(U===null){z===null&&(z=ae);break}e&&z&&U.alternate===null&&t(c,z),a=u(U,a,R),N===null?P=U:N.sibling=U,N=U,z=ae}if(R===d.length)return n(c,z),G&&Gt(c,R),P;if(z===null){for(;RR?(ae=z,z=null):ae=z.sibling;var Wt=v(c,z,U.value,w);if(Wt===null){z===null&&(z=ae);break}e&&z&&Wt.alternate===null&&t(c,z),a=u(Wt,a,R),N===null?P=Wt:N.sibling=Wt,N=Wt,z=ae}if(U.done)return n(c,z),G&&Gt(c,R),P;if(z===null){for(;!U.done;R++,U=d.next())U=g(c,U.value,w),U!==null&&(a=u(U,a,R),N===null?P=U:N.sibling=U,N=U);return G&&Gt(c,R),P}for(z=r(c,z);!U.done;R++,U=d.next())U=k(z,c,R,U.value,w),U!==null&&(e&&U.alternate!==null&&z.delete(U.key===null?R:U.key),a=u(U,a,R),N===null?P=U:N.sibling=U,N=U);return e&&z.forEach(function(wc){return t(c,wc)}),G&&Gt(c,R),P}function te(c,a,d,w){if(typeof d=="object"&&d!==null&&d.type===_e&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case Ze:e:{for(var P=d.key,N=a;N!==null;){if(N.key===P){if(P=d.type,P===_e){if(N.tag===7){n(c,N.sibling),a=l(N,d.props.children),a.return=c,c=a;break e}}else if(N.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Ce&&Xi(P)===N.type){n(c,N.sibling),a=l(N,d.props),a.ref=nr(c,N,d),a.return=c,c=a;break e}n(c,N);break}else t(c,N);N=N.sibling}d.type===_e?(a=rn(d.props.children,c.mode,w,d.key),a.return=c,c=a):(w=gl(d.type,d.key,d.props,null,c.mode,w),w.ref=nr(c,a,d),w.return=c,c=w)}return o(c);case Se:e:{for(N=d.key;a!==null;){if(a.key===N)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){n(c,a.sibling),a=l(a,d.children||[]),a.return=c,c=a;break e}else{n(c,a);break}else t(c,a);a=a.sibling}a=mo(d,c.mode,w),a.return=c,c=a}return o(c);case Ce:return N=d._init,te(c,a,N(d._payload),w)}if(Rn(d))return C(c,a,d,w);if(L(d))return x(c,a,d,w);Xr(c,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(n(c,a.sibling),a=l(a,d),a.return=c,c=a):(n(c,a),a=po(d,c.mode,w),a.return=c,c=a),o(c)):n(c,a)}return te}var En=Gi(!0),Zi=Gi(!1),Gr=Ot(null),Zr=null,_n=null,_u=null;function Cu(){_u=_n=Zr=null}function xu(e){var t=Gr.current;K(Gr),e._currentValue=t}function Pu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Cn(e,t){Zr=e,_u=_n=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ne=!0),e.firstContext=null)}function We(e){var t=e._currentValue;if(_u!==e)if(e={context:e,memoizedValue:t,next:null},_n===null){if(Zr===null)throw Error(m(308));_n=e,Zr.dependencies={lanes:0,firstContext:e}}else _n=_n.next=e;return t}var Zt=null;function Nu(e){Zt===null?Zt=[e]:Zt.push(e)}function Ji(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Nu(t)):(n.next=l.next,l.next=n),t.interleaved=n,St(e,r)}function St(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var It=!1;function zu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function kt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ft(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(I&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,St(e,n)}return l=r.interleaved,l===null?(t.next=t,Nu(r)):(t.next=l.next,l.next=t),r.interleaved=t,St(e,n)}function Jr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hl(e,n)}}function bi(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};u===null?l=u=o:u=u.next=o,n=n.next}while(n!==null);u===null?l=u=t:u=u.next=t}else l=u=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:u,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function qr(e,t,n,r){var l=e.updateQueue;It=!1;var u=l.firstBaseUpdate,o=l.lastBaseUpdate,i=l.shared.pending;if(i!==null){l.shared.pending=null;var s=i,p=s.next;s.next=null,o===null?u=p:o.next=p,o=s;var y=e.alternate;y!==null&&(y=y.updateQueue,i=y.lastBaseUpdate,i!==o&&(i===null?y.firstBaseUpdate=p:i.next=p,y.lastBaseUpdate=s))}if(u!==null){var g=l.baseState;o=0,y=p=s=null,i=u;do{var v=i.lane,k=i.eventTime;if((r&v)===v){y!==null&&(y=y.next={eventTime:k,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var C=e,x=i;switch(v=t,k=n,x.tag){case 1:if(C=x.payload,typeof C=="function"){g=C.call(k,g,v);break e}g=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=x.payload,v=typeof C=="function"?C.call(k,g,v):C,v==null)break e;g=_({},g,v);break e;case 2:It=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[i]:v.push(i))}else k={eventTime:k,lane:v,tag:i.tag,payload:i.payload,callback:i.callback,next:null},y===null?(p=y=k,s=g):y=y.next=k,o|=v;if(i=i.next,i===null){if(i=l.shared.pending,i===null)break;v=i,i=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(y===null&&(s=g),l.baseState=s,l.firstBaseUpdate=p,l.lastBaseUpdate=y,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else u===null&&(l.shared.lanes=0);bt|=o,e.lanes=o,e.memoizedState=g}}function es(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Mu.transition;Mu.transition={};try{e(!1),t()}finally{A=n,Mu.transition=r}}function ws(){return $e().memoizedState}function Wf(e,t,n){var r=At(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ss(e))ks(t,n);else if(n=Ji(e,t,n,r),n!==null){var l=Ee();lt(n,e,r,l),Es(n,t,r)}}function $f(e,t,n){var r=At(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ss(e))ks(t,l);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var o=t.lastRenderedState,i=u(o,n);if(l.hasEagerState=!0,l.eagerState=i,be(i,o)){var s=t.interleaved;s===null?(l.next=l,Nu(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=Ji(e,t,l,r),n!==null&&(l=Ee(),lt(n,e,r,l),Es(n,t,r))}}function Ss(e){var t=e.alternate;return e===J||t!==null&&t===J}function ks(e,t){or=tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Es(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hl(e,n)}}var ll={readContext:We,useCallback:ve,useContext:ve,useEffect:ve,useImperativeHandle:ve,useInsertionEffect:ve,useLayoutEffect:ve,useMemo:ve,useReducer:ve,useRef:ve,useState:ve,useDebugValue:ve,useDeferredValue:ve,useTransition:ve,useMutableSource:ve,useSyncExternalStore:ve,useId:ve,unstable_isNewReconciler:!1},Qf={readContext:We,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:We,useEffect:cs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,nl(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nl(4194308,4,e,t)},useInsertionEffect:function(e,t){return nl(4,2,e,t)},useMemo:function(e,t){var n=ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ct();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Wf.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:as,useDebugValue:Au,useDeferredValue:function(e){return ct().memoizedState=e},useTransition:function(){var e=as(!1),t=e[0];return e=Hf.bind(null,e[1]),ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=J,l=ct();if(G){if(n===void 0)throw Error(m(407));n=n()}else{if(n=t(),se===null)throw Error(m(349));(qt&30)!==0||ls(r,t,n)}l.memoizedState=n;var u={value:n,getSnapshot:t};return l.queue=u,cs(os.bind(null,r,u,e),[e]),r.flags|=2048,ar(9,us.bind(null,r,u,n,t),void 0,null),n},useId:function(){var e=ct(),t=se.identifierPrefix;if(G){var n=wt,r=gt;n=(r&~(1<<32-qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[at]=t,e[er]=r,Hs(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ol(n,r),n){case"dialog":Q("cancel",e),Q("close",e),l=r;break;case"iframe":case"object":case"embed":Q("load",e),l=r;break;case"video":case"audio":for(l=0;lTn&&(t.flags|=128,r=!0,fr(u,!1),t.lanes=4194304)}else{if(!r)if(e=br(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fr(u,!0),u.tail===null&&u.tailMode==="hidden"&&!o.alternate&&!G)return he(t),null}else 2*ee()-u.renderingStartTime>Tn&&n!==1073741824&&(t.flags|=128,r=!0,fr(u,!1),t.lanes=4194304);u.isBackwards?(o.sibling=t.child,t.child=o):(n=u.last,n!==null?n.sibling=o:t.child=o,u.last=o)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ee(),t.sibling=null,n=Z.current,W(Z,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return ao(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(je&1073741824)!==0&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(m(156,t.tag))}function bf(e,t){switch(wu(t),t.tag){case 1:return Pe(t.type)&&Hr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xn(),K(xe),K(me),Ou(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Lu(t),null;case 13:if(K(Z),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(m(340));kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(Z),null;case 4:return xn(),null;case 10:return xu(t.type._context),null;case 22:case 23:return ao(),null;case 24:return null;default:return null}}var sl=!1,ye=!1,ec=typeof WeakSet=="function"?WeakSet:Set,E=null;function Nn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){b(e,t,r)}else n.current=null}function Ju(e,t,n){try{n()}catch(r){b(e,t,r)}}var Qs=!1;function tc(e,t){if(fu=zr,e=_i(),nu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,u=r.focusNode;r=r.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var o=0,i=-1,s=-1,p=0,y=0,g=e,v=null;t:for(;;){for(var k;g!==n||l!==0&&g.nodeType!==3||(i=o+l),g!==u||r!==0&&g.nodeType!==3||(s=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(k=g.firstChild)!==null;)v=g,g=k;for(;;){if(g===e)break t;if(v===n&&++p===l&&(i=o),v===u&&++y===r&&(s=o),(k=g.nextSibling)!==null)break;g=v,v=g.parentNode}g=k}n=i===-1||s===-1?null:{start:i,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(cu={focusedElem:e,selectionRange:n},zr=!1,E=t;E!==null;)if(t=E,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,E=e;else for(;E!==null;){t=E;try{var C=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var x=C.memoizedProps,te=C.memoizedState,c=t.stateNode,a=c.getSnapshotBeforeUpdate(t.elementType===t.type?x:tt(t.type,x),te);c.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(m(163))}}catch(w){b(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,E=e;break}E=t.return}return C=Qs,Qs=!1,C}function cr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var u=l.destroy;l.destroy=void 0,u!==void 0&&Ju(t,n,u)}l=l.next}while(l!==r)}}function al(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ks(e){var t=e.alternate;t!==null&&(e.alternate=null,Ks(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[at],delete t[er],delete t[vu],delete t[jf],delete t[Uf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ys(e){return e.tag===5||e.tag===3||e.tag===4}function Xs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ys(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ar));else if(r!==4&&(e=e.child,e!==null))for(bu(e,t,n),e=e.sibling;e!==null;)bu(e,t,n),e=e.sibling}function eo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(eo(e,t,n),e=e.sibling;e!==null;)eo(e,t,n),e=e.sibling}var fe=null,nt=!1;function jt(e,t,n){for(n=n.child;n!==null;)Gs(e,t,n),n=n.sibling}function Gs(e,t,n){if(st&&typeof st.onCommitFiberUnmount=="function")try{st.onCommitFiberUnmount(Er,n)}catch{}switch(n.tag){case 5:ye||Nn(n,t);case 6:var r=fe,l=nt;fe=null,jt(e,t,n),fe=r,nt=l,fe!==null&&(nt?(e=fe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):fe.removeChild(n.stateNode));break;case 18:fe!==null&&(nt?(e=fe,n=n.stateNode,e.nodeType===8?mu(e.parentNode,n):e.nodeType===1&&mu(e,n),Wn(e)):mu(fe,n.stateNode));break;case 4:r=fe,l=nt,fe=n.stateNode.containerInfo,nt=!0,jt(e,t,n),fe=r,nt=l;break;case 0:case 11:case 14:case 15:if(!ye&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var u=l,o=u.destroy;u=u.tag,o!==void 0&&((u&2)!==0||(u&4)!==0)&&Ju(n,t,o),l=l.next}while(l!==r)}jt(e,t,n);break;case 1:if(!ye&&(Nn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(i){b(n,t,i)}jt(e,t,n);break;case 21:jt(e,t,n);break;case 22:n.mode&1?(ye=(r=ye)||n.memoizedState!==null,jt(e,t,n),ye=r):jt(e,t,n);break;default:jt(e,t,n)}}function Zs(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ec),t.forEach(function(r){var l=fc.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function rt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~u}if(r=l,r=ee()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rc(r/1960))-r,10e?16:e,Vt===null)var r=!1;else{if(e=Vt,Vt=null,ml=0,(I&6)!==0)throw Error(m(331));var l=I;for(I|=4,E=e.current;E!==null;){var u=E,o=u.child;if((E.flags&16)!==0){var i=u.deletions;if(i!==null){for(var s=0;see()-ro?tn(e,0):no|=n),Te(e,t)}function aa(e,t){t===0&&((e.mode&1)===0?t=1:(t=Cr,Cr<<=1,(Cr&130023424)===0&&(Cr=4194304)));var n=Ee();e=St(e,t),e!==null&&(Un(e,t,n),Te(e,n))}function ac(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aa(e,n)}function fc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(m(314))}r!==null&&r.delete(t),aa(e,n)}var fa;fa=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xe.current)Ne=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Ne=!1,Jf(e,t,n);Ne=(e.flags&131072)!==0}else Ne=!1,G&&(t.flags&1048576)!==0&&Wi(t,Kr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;il(e,t),e=t.pendingProps;var l=gn(t,me.current);Cn(t,n),l=Iu(null,t,r,e,l,n);var u=Fu();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pe(r)?(u=!0,Wr(t)):u=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,zu(t),l.updater=ul,t.stateNode=l,l._reactInternals=t,Hu(t,r,e,n),t=Qu(null,t,r,!0,u,n)):(t.tag=0,G&&u&&gu(t),ke(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(il(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=dc(r),e=tt(r,e),l){case 0:t=$u(null,t,r,e,n);break e;case 1:t=Fs(null,t,r,e,n);break e;case 11:t=Rs(null,t,r,e,n);break e;case 14:t=Os(null,t,r,tt(r.type,e),n);break e}throw Error(m(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:tt(r,l),$u(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:tt(r,l),Fs(e,t,r,l,n);case 3:e:{if(js(t),e===null)throw Error(m(387));r=t.pendingProps,u=t.memoizedState,l=u.element,qi(e,t),qr(t,r,null,n);var o=t.memoizedState;if(r=o.element,u.isDehydrated)if(u={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){l=Pn(Error(m(423)),t),t=Us(e,t,r,n,l);break e}else if(r!==l){l=Pn(Error(m(424)),t),t=Us(e,t,r,n,l);break e}else for(Fe=Rt(t.stateNode.containerInfo.firstChild),Ie=t,G=!0,et=null,n=Zi(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kn(),r===l){t=Et(e,t,n);break e}ke(e,t,r,n)}t=t.child}return t;case 5:return ts(t),e===null&&ku(t),r=t.type,l=t.pendingProps,u=e!==null?e.memoizedProps:null,o=l.children,du(r,l)?o=null:u!==null&&du(r,u)&&(t.flags|=32),Is(e,t),ke(e,t,o,n),t.child;case 6:return e===null&&ku(t),null;case 13:return Vs(e,t,n);case 4:return Tu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=En(t,null,r,n):ke(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:tt(r,l),Rs(e,t,r,l,n);case 7:return ke(e,t,t.pendingProps,n),t.child;case 8:return ke(e,t,t.pendingProps.children,n),t.child;case 12:return ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,u=t.memoizedProps,o=l.value,W(Gr,r._currentValue),r._currentValue=o,u!==null)if(be(u.value,o)){if(u.children===l.children&&!xe.current){t=Et(e,t,n);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var i=u.dependencies;if(i!==null){o=u.child;for(var s=i.firstContext;s!==null;){if(s.context===r){if(u.tag===1){s=kt(-1,n&-n),s.tag=2;var p=u.updateQueue;if(p!==null){p=p.shared;var y=p.pending;y===null?s.next=s:(s.next=y.next,y.next=s),p.pending=s}}u.lanes|=n,s=u.alternate,s!==null&&(s.lanes|=n),Pu(u.return,n,t),i.lanes|=n;break}s=s.next}}else if(u.tag===10)o=u.type===t.type?null:u.child;else if(u.tag===18){if(o=u.return,o===null)throw Error(m(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),Pu(o,n,t),o=u.sibling}else o=u.child;if(o!==null)o.return=u;else for(o=u;o!==null;){if(o===t){o=null;break}if(u=o.sibling,u!==null){u.return=o.return,o=u;break}o=o.return}u=o}ke(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Cn(t,n),l=We(l),r=r(l),t.flags|=1,ke(e,t,r,n),t.child;case 14:return r=t.type,l=tt(r,t.pendingProps),l=tt(r.type,l),Os(e,t,r,l,n);case 15:return Ms(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:tt(r,l),il(e,t),t.tag=1,Pe(r)?(e=!0,Wr(t)):e=!1,Cn(t,n),Cs(t,r,l),Hu(t,r,l,n),Qu(null,t,r,!0,e,n);case 19:return Bs(e,t,n);case 22:return Ds(e,t,n)}throw Error(m(156,t.tag))};function ca(e,t){return $o(e,t)}function cc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ke(e,t,n,r){return new cc(e,t,n,r)}function co(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dc(e){if(typeof e=="function")return co(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ot)return 11;if(e===it)return 14}return 2}function Ht(e,t){var n=e.alternate;return n===null?(n=Ke(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function gl(e,t,n,r,l,u){var o=2;if(r=e,typeof e=="function")co(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case _e:return rn(n.children,l,u,t);case Ae:o=8,l|=8;break;case Ct:return e=Ke(12,n,t,l|2),e.elementType=Ct,e.lanes=u,e;case Oe:return e=Ke(13,n,t,l),e.elementType=Oe,e.lanes=u,e;case Je:return e=Ke(19,n,t,l),e.elementType=Je,e.lanes=u,e;case q:return wl(n,l,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vt:o=10;break e;case $t:o=9;break e;case ot:o=11;break e;case it:o=14;break e;case Ce:o=16,r=null;break e}throw Error(m(130,e==null?e:typeof e,""))}return t=Ke(o,n,t,l),t.elementType=e,t.type=r,t.lanes=u,t}function rn(e,t,n,r){return e=Ke(7,e,r,t),e.lanes=n,e}function wl(e,t,n,r){return e=Ke(22,e,r,t),e.elementType=q,e.lanes=n,e.stateNode={isHidden:!1},e}function po(e,t,n){return e=Ke(6,e,null,t),e.lanes=n,e}function mo(e,t,n){return t=Ke(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pc(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bl(0),this.expirationTimes=Bl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function vo(e,t,n,r,l,u,o,i,s){return e=new pc(e,t,n,i,s),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Ke(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zu(u),e}function mc(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T)}catch{}}return T(),So.exports=Cc(),So.exports}export{Tc as a,zc as b,Pc as c,Nc as g,kc as r}; diff --git a/dist/assets/js/router-vendor-D4by-_6Z.js b/dist/assets/js/router-vendor-D4by-_6Z.js new file mode 100644 index 0000000..a583834 --- /dev/null +++ b/dist/assets/js/router-vendor-D4by-_6Z.js @@ -0,0 +1,12 @@ +import{r as Le,g as ke,a as $e}from"./react-vendor-CqRd3GwO.js";var i=Le();const Qt=ke(i);/** + * react-router v7.9.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var le="popstate";function Fe(e={}){function t(n,a){let{pathname:o,search:l,hash:s}=n.location;return G("",{pathname:o,search:l,hash:s},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:O(a)}return De(t,r,null,e)}function x(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function P(e,t){if(!e)try{throw new Error(t)}catch{}}function Ne(){return Math.random().toString(36).substring(2,10)}function ie(e,t){return{usr:e.state,key:e.key,idx:t}}function G(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?D(t):t,state:r,key:t&&t.key||n||Ne()}}function O({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function D(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function De(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:o=!1}=n,l=a.history,s="POP",u=null,c=f();c==null&&(c=0,l.replaceState({...l.state,idx:c},""));function f(){return(l.state||{idx:null}).idx}function d(){s="POP";let p=f(),m=p==null?null:p-c;c=p,u&&u({action:s,location:w.location,delta:m})}function y(p,m){s="PUSH";let h=G(w.location,p,m);c=f()+1;let R=ie(h,c),E=w.createHref(h);try{l.pushState(R,"",E)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(E)}o&&u&&u({action:s,location:w.location,delta:1})}function g(p,m){s="REPLACE";let h=G(w.location,p,m);c=f();let R=ie(h,c),E=w.createHref(h);l.replaceState(R,"",E),o&&u&&u({action:s,location:w.location,delta:0})}function v(p){return Ie(p)}let w={get action(){return s},get location(){return e(a,l)},listen(p){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(le,d),u=p,()=>{a.removeEventListener(le,d),u=null}},createHref(p){return t(a,p)},createURL:v,encodeLocation(p){let m=v(p);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:y,replace:g,go(p){return l.go(p)}};return w}function Ie(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),x(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:O(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function fe(e,t,r="/"){return Te(e,t,r,!1)}function Te(e,t,r,n){let a=typeof t=="string"?D(t):t,o=$(a.pathname||"/",r);if(o==null)return null;let l=de(e);Be(l);let s=null;for(let u=0;s==null&&u{let f={relativePath:c===void 0?l.path||"":c,caseSensitive:l.caseSensitive===!0,childrenIndex:s,route:l};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(n)&&u)return;x(f.relativePath.startsWith(n),`Absolute route path "${f.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(n.length)}let d=k([n,f.relativePath]),y=r.concat(f);l.children&&l.children.length>0&&(x(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),de(l.children,t,y,d,u)),!(l.path==null&&!l.index)&&t.push({path:d,score:_e(d,l.index),routesMeta:y})};return e.forEach((l,s)=>{if(l.path===""||!l.path?.includes("?"))o(l,s);else for(let u of he(l.path))o(l,s,!0,u)}),t}function he(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let l=he(n.join("/")),s=[];return s.push(...l.map(u=>u===""?o:[o,u].join("/"))),a&&s.push(...l),s.map(u=>e.startsWith("/")&&u===""?"/":u)}function Be(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ve(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var Me=/^:[\w-]+$/,Oe=3,Ae=2,We=1,Ue=10,He=-2,ue=e=>e==="*";function _e(e,t){let r=e.split("/"),n=r.length;return r.some(ue)&&(n+=He),t&&(n+=Ae),r.filter(a=>!ue(a)).reduce((a,o)=>a+(Me.test(o)?Oe:o===""?We:Ue),n)}function Ve(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function ze(e,t,r=!1){let{routesMeta:n}=e,a={},o="/",l=[];for(let s=0;s{if(f==="*"){let v=s[y]||"";l=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const g=s[y];return d&&!g?c[f]=void 0:c[f]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:l,pattern:e}}function je(e,t=!1,r=!0){P(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,s,u)=>(n.push({paramName:s,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Je(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return P(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function Ke(e,t="/"){let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?D(e):e;return{pathname:r?r.startsWith("/")?r:Ye(r,t):t,search:Xe(n),hash:Qe(a)}}function Ye(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Y(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function qe(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Q(e){let t=qe(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function Z(e,t,r,n=!1){let a;typeof e=="string"?a=D(e):(a={...e},x(!a.pathname||!a.pathname.includes("?"),Y("?","pathname","search",a)),x(!a.pathname||!a.pathname.includes("#"),Y("#","pathname","hash",a)),x(!a.search||!a.search.includes("#"),Y("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,s;if(l==null)s=r;else{let d=t.length-1;if(!n&&l.startsWith("..")){let y=l.split("/");for(;y[0]==="..";)y.shift(),d-=1;a.pathname=y.join("/")}s=d>=0?t[d]:"/"}let u=Ke(a,s),c=l&&l!=="/"&&l.endsWith("/"),f=(o||l===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||f)&&(u.pathname+="/"),u}var k=e=>e.join("/").replace(/\/\/+/g,"/"),Ge=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Xe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Qe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Ze(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var pe=["POST","PUT","PATCH","DELETE"];new Set(pe);var et=["GET",...pe];new Set(et);var I=i.createContext(null);I.displayName="DataRouter";var J=i.createContext(null);J.displayName="DataRouterState";i.createContext(!1);var me=i.createContext({isTransitioning:!1});me.displayName="ViewTransition";var tt=i.createContext(new Map);tt.displayName="Fetchers";var rt=i.createContext(null);rt.displayName="Await";var S=i.createContext(null);S.displayName="Navigation";var A=i.createContext(null);A.displayName="Location";var L=i.createContext({outlet:null,matches:[],isDataRoute:!1});L.displayName="Route";var ee=i.createContext(null);ee.displayName="RouteError";function nt(e,{relative:t}={}){x(T(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:n}=i.useContext(S),{hash:a,pathname:o,search:l}=W(e,{relative:t}),s=o;return r!=="/"&&(s=o==="/"?r:k([r,o])),n.createHref({pathname:s,search:l,hash:a})}function T(){return i.useContext(A)!=null}function F(){return x(T(),"useLocation() may be used only in the context of a component."),i.useContext(A).location}var ye="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ge(e){i.useContext(S).static||i.useLayoutEffect(e)}function ve(){let{isDataRoute:e}=i.useContext(L);return e?yt():at()}function at(){x(T(),"useNavigate() may be used only in the context of a component.");let e=i.useContext(I),{basename:t,navigator:r}=i.useContext(S),{matches:n}=i.useContext(L),{pathname:a}=F(),o=JSON.stringify(Q(n)),l=i.useRef(!1);return ge(()=>{l.current=!0}),i.useCallback((u,c={})=>{if(P(l.current,ye),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Z(u,JSON.parse(o),a,c.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:k([t,f.pathname])),(c.replace?r.replace:r.push)(f,c.state,c)},[t,r,o,a,e])}i.createContext(null);function Zt(){let{matches:e}=i.useContext(L),t=e[e.length-1];return t?t.params:{}}function W(e,{relative:t}={}){let{matches:r}=i.useContext(L),{pathname:n}=F(),a=JSON.stringify(Q(r));return i.useMemo(()=>Z(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function ot(e,t){return we(e,t)}function we(e,t,r,n,a){x(T(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=i.useContext(S),{matches:l}=i.useContext(L),s=l[l.length-1],u=s?s.params:{},c=s?s.pathname:"/",f=s?s.pathnameBase:"/",d=s&&s.route;{let h=d&&d.path||"";Re(c,!d||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${c}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let y=F(),g;if(t){let h=typeof t=="string"?D(t):t;x(f==="/"||h.pathname?.startsWith(f),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${h.pathname}" was given in the \`location\` prop.`),g=h}else g=y;let v=g.pathname||"/",w=v;if(f!=="/"){let h=f.replace(/^\//,"").split("/");w="/"+v.replace(/^\//,"").split("/").slice(h.length).join("/")}let p=fe(e,{pathname:w});P(d||p!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),P(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let m=ct(p&&p.map(h=>Object.assign({},h,{params:Object.assign({},u,h.params),pathname:k([f,o.encodeLocation?o.encodeLocation(h.pathname).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?f:k([f,o.encodeLocation?o.encodeLocation(h.pathnameBase).pathname:h.pathnameBase])})),l,r,n,a);return t&&m?i.createElement(A.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},m):m}function lt(){let e=mt(),t=Ze(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},l=null;return l=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:o},"ErrorBoundary")," or"," ",i.createElement("code",{style:o},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),r?i.createElement("pre",{style:a},r):null,l)}var it=i.createElement(lt,null),ut=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError&&this.props.unstable_onError(e,t)}render(){return this.state.error!==void 0?i.createElement(L.Provider,{value:this.props.routeContext},i.createElement(ee.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function st({routeContext:e,match:t,children:r}){let n=i.useContext(I);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(L.Provider,{value:e},r)}function ct(e,t=[],r=null,n=null,a=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=r?.errors;if(l!=null){let c=o.findIndex(f=>f.route.id&&l?.[f.route.id]!==void 0);x(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,u=-1;if(r)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,f,d)=>{let y,g=!1,v=null,w=null;r&&(y=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||it,s&&(u<0&&d===0?(Re("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,w=null):u===d&&(g=!0,w=f.route.hydrateFallbackElement||null)));let p=t.concat(o.slice(0,d+1)),m=()=>{let h;return y?h=v:g?h=w:f.route.Component?h=i.createElement(f.route.Component,null):f.route.element?h=f.route.element:h=c,i.createElement(st,{match:f,routeContext:{outlet:c,matches:p,isDataRoute:r!=null},children:h})};return r&&(f.route.ErrorBoundary||f.route.errorElement||d===0)?i.createElement(ut,{location:r.location,revalidation:r.revalidation,component:v,error:y,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0},unstable_onError:n}):m()},null)}function te(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ft(e){let t=i.useContext(I);return x(t,te(e)),t}function dt(e){let t=i.useContext(J);return x(t,te(e)),t}function ht(e){let t=i.useContext(L);return x(t,te(e)),t}function re(e){let t=ht(e),r=t.matches[t.matches.length-1];return x(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function pt(){return re("useRouteId")}function mt(){let e=i.useContext(ee),t=dt("useRouteError"),r=re("useRouteError");return e!==void 0?e:t.errors?.[r]}function yt(){let{router:e}=ft("useNavigate"),t=re("useNavigate"),r=i.useRef(!1);return ge(()=>{r.current=!0}),i.useCallback(async(a,o={})=>{P(r.current,ye),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var se={};function Re(e,t,r){!t&&!se[e]&&(se[e]=!0,P(!1,r))}i.memo(gt);function gt({routes:e,future:t,state:r,unstable_onError:n}){return we(e,void 0,r,n,t)}function er({to:e,replace:t,state:r,relative:n}){x(T()," may be used only in the context of a component.");let{static:a}=i.useContext(S);P(!a," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:o}=i.useContext(L),{pathname:l}=F(),s=ve(),u=Z(e,Q(o),l,n==="path"),c=JSON.stringify(u);return i.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:n})},[s,c,n,t,r]),null}function vt(e){x(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function wt({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:a,static:o=!1}){x(!T(),"You cannot render a inside another . You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=i.useMemo(()=>({basename:l,navigator:a,static:o,future:{}}),[l,a,o]);typeof r=="string"&&(r=D(r));let{pathname:u="/",search:c="",hash:f="",state:d=null,key:y="default"}=r,g=i.useMemo(()=>{let v=$(u,l);return v==null?null:{location:{pathname:v,search:c,hash:f,state:d,key:y},navigationType:n}},[l,u,c,f,d,y,n]);return P(g!=null,` is not able to match the URL "${u}${c}${f}" because it does not start with the basename, so the won't render anything.`),g==null?null:i.createElement(S.Provider,{value:s},i.createElement(A.Provider,{children:t,value:g}))}function tr({children:e,location:t}){return ot(X(e),t)}function X(e,t=[]){let r=[];return i.Children.forEach(e,(n,a)=>{if(!i.isValidElement(n))return;let o=[...t,a];if(n.type===i.Fragment){r.push.apply(r,X(n.props.children,o));return}x(n.type===vt,`[${typeof n.type=="string"?n.type:n.type.name}] is not a component. All component children of must be a or `),x(!n.props.index||!n.props.children,"An index route cannot have child routes.");let l={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(l.children=X(n.props.children,o)),r.push(l)}),r}var V="get",z="application/x-www-form-urlencoded";function K(e){return e!=null&&typeof e.tagName=="string"}function Rt(e){return K(e)&&e.tagName.toLowerCase()==="button"}function xt(e){return K(e)&&e.tagName.toLowerCase()==="form"}function Et(e){return K(e)&&e.tagName.toLowerCase()==="input"}function Ct(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function bt(e,t){return e.button===0&&(!t||t==="_self")&&!Ct(e)}var _=null;function Pt(){if(_===null)try{new FormData(document.createElement("form"),0),_=!1}catch{_=!0}return _}var St=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function q(e){return e!=null&&!St.has(e)?(P(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${z}"`),null):e}function Lt(e,t){let r,n,a,o,l;if(xt(e)){let s=e.getAttribute("action");n=s?$(s,t):null,r=e.getAttribute("method")||V,a=q(e.getAttribute("enctype"))||z,o=new FormData(e)}else if(Rt(e)||Et(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a + + +
+ {loading &&

Iniciando câmera...

} +
+ +
+ + +
+ ); +}; diff --git a/src/components/Empty.tsx b/src/components/Empty.tsx new file mode 100644 index 0000000..87d69a9 --- /dev/null +++ b/src/components/Empty.tsx @@ -0,0 +1,8 @@ +import { cn } from "@/lib/utils"; + +// Empty component +export default function Empty() { + return ( +
Empty
+ ); +} \ No newline at end of file diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..a20eb69 --- /dev/null +++ b/src/components/ErrorBoundary.tsx @@ -0,0 +1,210 @@ +import React, { Component, ErrorInfo, ReactNode } from 'react'; +import { AlertTriangle, RefreshCw, Home } from 'lucide-react'; +import { useAppStateStore } from '../stores/useAppStateStore'; + +interface Props { + children: ReactNode; + fallback?: ReactNode; + onError?: (error: Error, errorInfo: ErrorInfo) => void; +} + +interface State { + hasError: boolean; + error: Error | null; + errorInfo: ErrorInfo | null; +} + +class ErrorBoundaryClass extends Component { + constructor(props: Props) { + super(props); + this.state = { + hasError: false, + error: null, + errorInfo: null, + }; + } + + static getDerivedStateFromError(error: Error): State { + return { + hasError: true, + error, + errorInfo: null, + }; + } + + componentDidCatch(error: Error, errorInfo: ErrorInfo) { + this.setState({ + error, + errorInfo, + }); + + // Log do erro para monitoramento + console.error('ErrorBoundary caught an error:', error, errorInfo); + + // Callback personalizado para tratamento de erro + if (this.props.onError) { + this.props.onError(error, errorInfo); + } + + // Log adicional para desenvolvimento + if (import.meta.env.DEV) { + console.group('🚨 Error Boundary Details'); + console.error('Error:', error); + console.error('Error Info:', errorInfo); + console.groupEnd(); + } + } + + handleRetry = () => { + this.setState({ + hasError: false, + error: null, + errorInfo: null, + }); + }; + + handleGoHome = () => { + window.location.href = '/'; + }; + + render() { + if (this.state.hasError) { + // Fallback customizado se fornecido + if (this.props.fallback) { + return this.props.fallback; + } + + // UI padrão de erro + return ( +
+
+
+
+ +

+ Ops! Algo deu errado +

+

+ Ocorreu um erro inesperado. Você pode tentar recarregar a página ou voltar ao início. +

+ + {/* Detalhes do erro em desenvolvimento */} + {import.meta.env.DEV && this.state.error && ( +
+ + Detalhes do erro (desenvolvimento) + +
+                      {this.state.error.message}
+                      {this.state.error.stack && (
+                        <>
+                          {'\n\nStack trace:\n'}
+                          {this.state.error.stack}
+                        
+                      )}
+                      {this.state.errorInfo?.componentStack && (
+                        <>
+                          {'\n\nComponent stack:'}
+                          {this.state.errorInfo.componentStack}
+                        
+                      )}
+                    
+
+ )} + +
+ + +
+
+
+
+
+ ); + } + + return this.props.children; + } +} + +// Hook wrapper para usar com componentes funcionais +interface ErrorBoundaryProps { + children: ReactNode; + fallback?: ReactNode; + onError?: (error: Error, errorInfo: ErrorInfo) => void; +} + +const ErrorBoundary: React.FC = ({ children, fallback, onError }) => { + return ( + + {children} + + ); +}; + +export default ErrorBoundary; + +// Error Boundary específico para rotas +export const RouteErrorBoundary: React.FC<{ children: ReactNode }> = ({ children }) => { + return ( + +
+ +

+ Erro na página +

+

+ Não foi possível carregar esta página. +

+ +
+ + } + > + {children} +
+ ); +}; + +// Error Boundary para componentes específicos +export const ComponentErrorBoundary: React.FC<{ children: ReactNode; componentName?: string }> = ({ + children, + componentName = 'Componente' +}) => { + return ( + +
+ +

+ Erro ao carregar {componentName.toLowerCase()} +

+
+ + } + > + {children} +
+ ); +}; \ No newline at end of file diff --git a/src/components/ManageInvites.tsx b/src/components/ManageInvites.tsx new file mode 100644 index 0000000..4c88460 --- /dev/null +++ b/src/components/ManageInvites.tsx @@ -0,0 +1,754 @@ +import React, { useState, useEffect, useCallback } from 'react'; +import { useInviteCode } from '../hooks/useInviteCode'; +import { useCurrentUser, useUserStore } from '../stores/useUserStore'; +import { useAuth } from '../hooks/useAuth'; +import { supabase } from '../lib/supabase'; +import { + Plus, Copy, Users, Clock, CheckCircle, + XCircle, RefreshCw, KeyRound, Loader2, Mail, Building2 +} from 'lucide-react'; + +interface Convite { + id: string; + codigo: string; + organizacao_id: string; + criado_por: string | null; + email_convidado: string | null; + role: string; + max_usos: number; + usos_atuais: number; + ativo: boolean; + expira_em: string | null; + created_at: string; + updated_at: string; +} + +const ManageInvites: React.FC = () => { + const currentUser = useCurrentUser(); + const fetchCurrentUser = useUserStore((state) => state.fetchCurrentUser); + const { user: authUser, loading: authLoading } = useAuth(); // PEGAR EMAIL DIRETO DO AUTH + const { loading: hookInviteLoading, gerarConvite } = useInviteCode(); + const [localInviteLoading, setLocalInviteLoading] = useState(false); + const inviteLoading = hookInviteLoading || localInviteLoading; + + const [convites, setConvites] = useState([]); + const [organizacoes, setOrganizacoes] = useState<{ id: string, nome: string }[]>([]); + const [selectedOrgId, setSelectedOrgId] = useState(''); + const [showForm, setShowForm] = useState(false); + const [showOrgForm, setShowOrgForm] = useState(false); // Novo form de org + const [copiedCode, setCopiedCode] = useState(null); + const [successMessage, setSuccessMessage] = useState(''); + const [errorMessage, setErrorMessage] = useState(''); + const [isRecovering, setIsRecovering] = useState(false); + + // Estado para nova organização + const [novaOrgNome, setNovaOrgNome] = useState(''); + + // Opções do formulário de novo convite + const [novoConvite, setNovoConvite] = useState({ + emailConvidado: '', + role: 'usuario', + maxUsos: 1, + expiraEmDias: 7, + }); + + // BYPASS DE EMERGÊNCIA: Usar email direto do Auth (não depende do store) + const authEmail = authUser?.email || null; + const isSuperAdmin = authEmail === 'admtracksteel@gmail.com'; + const isDev = (currentUser?.role as string) === 'dev' || isSuperAdmin; + + // BYPASS ADICIONAL: Verificar sessão diretamente do Supabase + const [directAuthEmail, setDirectAuthEmail] = useState(null); + const [directAuthLoading, setDirectAuthLoading] = useState(true); + + // Super Admin pode ser detectado por qualquer um dos métodos + const isSuperAdminDirect = directAuthEmail === 'admtracksteel@gmail.com'; + const isDevFinal = isDev || isSuperAdminDirect || isSuperAdmin; + + // Debug dos estados de loading e renderização - ÚTIL PARA DIAGNÓSTICO + console.log('🔍 ManageInvites Render:', { + authLoading, + directAuthLoading, + isRecovering, + isSuperAdminDirect, + directAuthEmail, + isDevFinal, + selectedOrgId, + orgsCount: organizacoes.length + }); + + // 1. Helper for safe token retrieval - Priorities: Session -> LocalStorage + // 1. Helper for safe token retrieval - Priorities: Session -> LocalStorage + const getToken = useCallback(async () => { + try { + // Tenta pegar da sessão ativa primeiro (mas não espera para sempre) + const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject('Timeout'), 1500)); + const sessionPromise = supabase.auth.getSession(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { data } = await Promise.race([sessionPromise, timeoutPromise]) as any; + + if (data?.session?.access_token) { + return data.session.access_token; + } + } catch { + // Se der timeout ou erro, silencia e vai pro fallback + } + + try { + // Fallback: varredura no localStorage + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key?.startsWith('sb-') && key?.endsWith('-auth-token')) { + const val = localStorage.getItem(key); + if (val) { + const parsed = JSON.parse(val); + return parsed.access_token; + } + } + } + } catch (e) { + console.error('Erro no fallback de token:', e); + } + return null; + }, []); + + // 2. Helper for Raw Fetch + const rawFetch = useCallback(async (table: string, query: string = '') => { + const baseUrl = import.meta.env.VITE_SUPABASE_URL; + const anonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; + const token = await getToken() || anonKey; + + // Debug simples para ver se estamos enviando token + // console.log(`Fetch ${table}: usando token ${token ? 'Bearer ...' : 'Anon'}`); + + const url = `${baseUrl}/rest/v1/${table}${query}`; + const res = await fetch(url, { + headers: { + 'apikey': anonKey, + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + } + }); + + if (!res.ok) { + const text = await res.text(); + throw new Error(`${res.status} ${res.statusText}: ${text}`); + } + return await res.json(); + }, [getToken]); + + useEffect(() => { + const checkDirectAuth = async () => { + setDirectAuthLoading(true); + try { + console.log('🕵️‍♂️ Iniciando verificação direta de Auth...'); + const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject('Timeout'), 2000)); + const sessionPromise = supabase.auth.getSession(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { data } = await Promise.race([sessionPromise, timeoutPromise]) as any; + + if (data?.session?.access_token) { + console.log('✅ Sessão ativa encontrada (Supabase Auth).'); + } + + if (data?.session?.user?.email) { + console.log('✅ Email identificado na sessão:', data.session.user.email); + setDirectAuthEmail(data.session.user.email); + } else { + console.warn('⚠️ Nenhuma sessão ativa retornada pelo Supabase. Verificando LocalStorage...'); + + // Fallback manual ao LocalStorage para debug + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key?.startsWith('sb-') && key?.endsWith('-auth-token')) { + const val = localStorage.getItem(key); + if (val) { + const parsed = JSON.parse(val); + if (parsed.user?.email) { + console.log('✅ Email recuperado do LocalStorage (Fallback):', parsed.user.email); + setDirectAuthEmail(parsed.user.email); + } + } + } + } + } + } catch (e) { + console.error('❌ Erro no checkDirectAuth:', e); + } finally { + setDirectAuthLoading(false); + } + }; + checkDirectAuth(); + }, []); + + // Super Admin declarations MOVED UP + + // Recuperação de Sessão (se necessário) + useEffect(() => { + let mounted = true; + + const checkSession = async () => { + // Se não tem currentUser, tenta recuperar + if (!currentUser) { + setIsRecovering(true); + + // Timeout de segurança: desiste após 3 segundos + const timeoutId = setTimeout(() => { + if (mounted) setIsRecovering(false); + }, 3000); + + try { + const { data } = await supabase.auth.getUser(); + if (data.user && mounted) { + // console.log('🔄 Tentando recuperar usuário do store:', data.user.email); + await fetchCurrentUser(data.user.id); + } + } catch (error) { + console.error("❌ Erro na recuperação do store:", error); + } finally { + clearTimeout(timeoutId); + if (mounted) setIsRecovering(false); + } + } + }; + checkSession(); + + return () => { mounted = false; }; + }, [currentUser, fetchCurrentUser]); + + // Se for Dev, carrega todas as organizações + // Se não, usa a do usuário + const carregarDadosIniciais = useCallback(async () => { + console.log('🔄 carregarDadosIniciais disparado.', { isDevFinal, directAuthLoading, currentUserOrg: currentUser?.organizacao_id }); + + // Se ainda está determinando auth crítico, espera (mas não trava se for só loading de UI) + if (directAuthLoading) return; + + if (isDevFinal) { + console.log('👑 Modo Admin detectado. Buscando TODAS as organizações...'); + try { + const data = await rawFetch('organizacoes', '?select=id,nome&order=nome.asc'); + console.log(`✅ ${data.length} organizações encontradas.`); + setOrganizacoes(data); + if (data.length > 0 && !selectedOrgId) { + setSelectedOrgId(data[0].id); + } + } catch (err) { + console.error('❌ Erro RAW Orgs:', err); + setErrorMessage('Erro ao carregar organizações. Tente recarregar a página.'); + } + } else if (currentUser?.organizacao_id) { + console.log('👤 Modo Usuário detectado. Buscando organização do perfil...'); + setSelectedOrgId(currentUser.organizacao_id); + try { + const data = await rawFetch('organizacoes', `?id=eq.${currentUser.organizacao_id}&select=id,nome`); + if (data && data.length > 0) setOrganizacoes(data); + } catch (e) { + console.error(e); + setErrorMessage('Erro ao carregar sua organização.'); + } + } else { + console.warn('⚠️ Nem Admin nem Usuário com Org detectado. Nada a fazer.'); + } + }, [isDevFinal, currentUser?.organizacao_id, selectedOrgId, directAuthLoading, rawFetch]); + + const carregarConvites = useCallback(async () => { + if (!selectedOrgId) return; + setLocalInviteLoading(true); + try { + console.log(`📨 Buscando convites para org: ${selectedOrgId}`); + const data = await rawFetch('convites', `?organizacao_id=eq.${selectedOrgId}&select=*&order=created_at.desc`); + console.log(`✅ ${data?.length || 0} convites carregados.`); + setConvites(data || []); + } catch (e) { + console.error('Erro RAW Convites:', e); + setErrorMessage('Erro ao carregar convites.'); + } finally { + setLocalInviteLoading(false); + } + }, [selectedOrgId, rawFetch]); + + useEffect(() => { + // Dispara o carregamento assim que os estados de Auth se estabilizarem + // Ou se isDevFinal mudar (ex: Auth carregou tardiamente) + if (!directAuthLoading) { + carregarDadosIniciais(); + } + }, [carregarDadosIniciais, authLoading, directAuthLoading, isDevFinal]); + + useEffect(() => { + if (selectedOrgId) { + carregarConvites(); + } + }, [selectedOrgId, carregarConvites]); + + // Debug dos estados de loading + // Old log removed + + // Renderiza Loader enquanto verifica autenticação + // SE for Super Admin confirmado direto pelo Supabase, ignoramos o carregamento do store (isRecovering) + // IGNORA authLoading do hook pois ele trava + if ((directAuthLoading || isRecovering) && !isSuperAdminDirect) { + return ( +
+ +

Verificando permissões...

+ + {authLoading ? 'Auth ' : ''} + {directAuthLoading ? 'Direct ' : ''} + {isRecovering ? 'Recover ' : ''} + +
+ ); + } + + // ... Rest of the file handling restricted access and main render ... + + const handleCriarOrganizacao = async () => { + if (!novaOrgNome.trim()) return; + + try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { data, error } = await (supabase as any) + .from('organizacoes') + .insert([{ nome: novaOrgNome, ativo: true }]) + .select() + .single(); + + if (error) throw error; + + setSuccessMessage(`Organização "${data.nome}" criada!`); + setNovaOrgNome(''); + setShowOrgForm(false); + carregarDadosIniciais(); // Recarrega lista + setSelectedOrgId(data.id); // Seleciona a nova + } catch (error) { + console.error('Erro ao criar org:', error); + alert('Erro ao criar organização. Verifique o console.'); + } + }; + + // Ensure the original return structure is maintained below this block in the file + + + const handleGerarConvite = async () => { + if (!selectedOrgId) return; + + setErrorMessage(''); + setSuccessMessage(''); + + const result = await gerarConvite(selectedOrgId, { + emailConvidado: novoConvite.emailConvidado || undefined, + role: novoConvite.role, + maxUsos: novoConvite.maxUsos, + expiraEmDias: novoConvite.expiraEmDias, + criadoPor: currentUser?.id || authUser?.id, // Passa ID explícito para evitar hang do Auth + }); + + if (result.success) { + setSuccessMessage(`Código gerado: ${result.codigo}`); + setShowForm(false); + setNovoConvite({ + emailConvidado: '', + role: 'usuario', + maxUsos: 1, + expiraEmDias: 7, + }); + carregarConvites(); + setTimeout(() => setSuccessMessage(''), 5000); + } else { + setErrorMessage(result.error || 'Erro ao gerar convite. Verifique o console.'); + setTimeout(() => setErrorMessage(''), 5000); + } + }; + + const copiarCodigo = (codigo: string) => { + navigator.clipboard.writeText(codigo); + setCopiedCode(codigo); + setTimeout(() => setCopiedCode(null), 2000); + }; + + const getRoleLabel = (role: string) => { + const roles: Record = { + admin: 'Administrador', + engenheiro: 'Engenheiro', + mestre_obra: 'Mestre de Obra', + usuario: 'Usuário', + }; + return roles[role] || role; + }; + + const formatDate = (date: string) => { + return new Date(date).toLocaleDateString('pt-BR', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + }); + }; + + const isExpired = (expiraEm: string | null) => { + if (!expiraEm) return false; + return new Date(expiraEm) < new Date(); + }; + + if (isRecovering) { + return ( +
+ +

Sincronizando permissões...

+
+ ); + } + + // Se não for dev e não tiver org, exibe tela de erro com opção de refresh + if (!isDevFinal && !currentUser?.organizacao_id) { + return ( +
+
+ +

Acesso Restrito

+

Você não tem permissão para gerenciar convites.

+
+ +
+

Diagnóstico de Acesso:

+
    +
  • ID: {currentUser?.id || 'Não identificado no Store'}
  • +
  • Email (Store): {currentUser?.email || 'Verificando...'}
  • +
  • Email (Auth): {authEmail || 'Verificando...'}
  • +
  • Cargo Local: {currentUser?.role || 'Nenhum'}
  • +
  • Org ID Local: {currentUser?.organizacao_id || 'Nenhuma'}
  • +
  • Bypass Super Admin: {isSuperAdmin ? 'ATIVO ✓' : 'Inativo'}
  • +
+ +
+

+ Ações de Recuperação (Admin): +

+ +
+
+
+ ); + } + + return ( +
+ {/* Header */} +
+
+ +
+

+ Convites da Organização +

+ {isDev && ( +

+ MODO SUPER ADMIN +

+ )} +
+
+ +
+ {/* Seletor de Organização (Apenas DEV) */} + {isDev && ( + <> + + + + + )} + + + +
+
+ + {/* Mensagem de sucesso */} + {successMessage && ( +
+ +

{successMessage}

+
+ )} + + {errorMessage && ( +
+ +

{errorMessage}

+
+ )} + + {/* Modal/Form de Nova Organização */} + {showOrgForm && ( +
+

+ + Criar Nova Organização +

+
+ setNovaOrgNome(e.target.value)} + placeholder="Nome da Empresa (ex: Construtora Silva)" + className="flex-1 px-4 py-2 rounded-xl border border-purple-300 focus:outline-none focus:ring-2 focus:ring-purple-500" + autoFocus + /> + + +
+
+ )} + + {/* Formulário de novo convite */} + {showForm && ( +
+
+

+ Gerar Novo Código de Convite +

+

+ Organização Alvo: + {organizacoes.find(o => o.id === selectedOrgId)?.nome || 'Atual'} + +

+
+ +
+
+ + setNovoConvite(prev => ({ ...prev, emailConvidado: e.target.value }))} + placeholder="Deixe vazio para qualquer email" + className="w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent" + /> +
+ +
+ + +
+ +
+ + setNovoConvite(prev => ({ ...prev, maxUsos: parseInt(e.target.value) || 1 }))} + min={1} + max={100} + title="Máximo de usos" + placeholder="1" + className="w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent" + /> +
+ +
+ + setNovoConvite(prev => ({ ...prev, expiraEmDias: parseInt(e.target.value) || 7 }))} + min={1} + max={365} + title="Dias para expiração" + placeholder="7" + className="w-full px-3 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-xl text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent" + /> +
+
+ +
+ + +
+
+ )} + + {/* Lista de Convites */} +
+ {convites.length === 0 ? ( +
+ +

+ {selectedOrgId ? 'Nenhum convite gerado para esta organização ainda.' : 'Selecione uma organização para gerenciar.'} +

+
+ ) : ( + convites.map((convite) => { + const expired = isExpired(convite.expira_em); + const used = convite.max_usos > 0 && convite.usos_atuais >= convite.max_usos; + const inactive = !convite.ativo || expired || used; + + return ( +
+
+ {/* Código */} +
+ + {convite.codigo} + + +
+ + {/* Status badge */} +
+ {inactive ? ( + + + {expired ? 'Expirado' : used ? 'Esgotado' : 'Inativo'} + + ) : ( + + + Ativo + + )} +
+
+ + {/* Detalhes */} +
+
+ Cargo:{' '} + {getRoleLabel(convite.role)} +
+
+ Usos:{' '} + {convite.usos_atuais}/{convite.max_usos === 0 ? '∞' : convite.max_usos} +
+
+ Criado:{' '} + {formatDate(convite.created_at)} +
+ {convite.expira_em && ( +
+ Expira:{' '} + {formatDate(convite.expira_em)} +
+ )} +
+ + {convite.email_convidado && ( +
+ + Restrito a: {convite.email_convidado} +
+ )} +
+ ); + }) + )} +
+
+ ); +}; + +export default ManageInvites; diff --git a/src/components/NeuralNetworkBackground.tsx b/src/components/NeuralNetworkBackground.tsx new file mode 100644 index 0000000..527b4bd --- /dev/null +++ b/src/components/NeuralNetworkBackground.tsx @@ -0,0 +1,134 @@ +import React, { useEffect, useRef } from 'react'; + +interface Point { + x: number; + y: number; + vx: number; + vy: number; +} + +const NeuralNetworkBackground: React.FC = () => { + const canvasRef = useRef(null); + const animationRef = useRef(); + const pointsRef = useRef([]); + + useEffect(() => { + const canvas = canvasRef.current; + if (!canvas) return; + + const ctx = canvas.getContext('2d'); + if (!ctx) return; + + const resizeCanvas = () => { + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + }; + + const initPoints = () => { + const numPoints = Math.floor((canvas.width * canvas.height) / 15000); + pointsRef.current = []; + + for (let i = 0; i < numPoints; i++) { + pointsRef.current.push({ + x: Math.random() * canvas.width, + y: Math.random() * canvas.height, + vx: (Math.random() - 0.5) * 0.5, + vy: (Math.random() - 0.5) * 0.5, + }); + } + }; + + const drawPoint = (point: Point) => { + ctx.beginPath(); + ctx.arc(point.x, point.y, 2, 0, Math.PI * 2); + ctx.fillStyle = 'rgba(147, 197, 253, 0.8)'; + ctx.fill(); + }; + + const drawLine = (point1: Point, point2: Point, distance: number, maxDistance: number) => { + const opacity = 1 - (distance / maxDistance); + ctx.beginPath(); + ctx.moveTo(point1.x, point1.y); + ctx.lineTo(point2.x, point2.y); + ctx.strokeStyle = `rgba(147, 197, 253, ${opacity * 0.3})`; + ctx.lineWidth = 1; + ctx.stroke(); + }; + + const updatePoints = () => { + pointsRef.current.forEach(point => { + point.x += point.vx; + point.y += point.vy; + + if (point.x < 0 || point.x > canvas.width) point.vx *= -1; + if (point.y < 0 || point.y > canvas.height) point.vy *= -1; + + point.x = Math.max(0, Math.min(canvas.width, point.x)); + point.y = Math.max(0, Math.min(canvas.height, point.y)); + }); + }; + + const animate = () => { + ctx.clearRect(0, 0, canvas.width, canvas.height); + + // Gradient background + const gradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height); + gradient.addColorStop(0, '#0f172a'); + gradient.addColorStop(0.5, '#1e1b4b'); + gradient.addColorStop(1, '#581c87'); + ctx.fillStyle = gradient; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + updatePoints(); + + // Draw connections + const maxDistance = 120; + for (let i = 0; i < pointsRef.current.length; i++) { + for (let j = i + 1; j < pointsRef.current.length; j++) { + const point1 = pointsRef.current[i]; + const point2 = pointsRef.current[j]; + const distance = Math.sqrt( + Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2) + ); + + if (distance < maxDistance) { + drawLine(point1, point2, distance, maxDistance); + } + } + } + + // Draw points + pointsRef.current.forEach(drawPoint); + + animationRef.current = requestAnimationFrame(animate); + }; + + resizeCanvas(); + initPoints(); + animate(); + + const handleResize = () => { + resizeCanvas(); + initPoints(); + }; + + window.addEventListener('resize', handleResize); + + return () => { + window.removeEventListener('resize', handleResize); + if (animationRef.current) { + cancelAnimationFrame(animationRef.current); + } + }; + }, []); + + return ( + + ); +}; + +export default NeuralNetworkBackground; \ No newline at end of file diff --git a/src/components/OfflineIndicator.tsx b/src/components/OfflineIndicator.tsx new file mode 100644 index 0000000..8cef29e --- /dev/null +++ b/src/components/OfflineIndicator.tsx @@ -0,0 +1,219 @@ +/** + * Indicador de Status Offline + * + * Componente sempre visível que mostra: + * - Status online/offline + * - Operações pendentes + * - Progresso de sincronização + */ + +import React, { useEffect, useState } from 'react'; +import { Wifi, WifiOff, RefreshCw, AlertCircle, CheckCircle } from 'lucide-react'; +import { syncService, type SyncStatus, type SyncStats } from '../services/syncService'; + +export const OfflineIndicator: React.FC = () => { + const [isOnline, setIsOnline] = useState(navigator.onLine); + const [syncStatus, setSyncStatus] = useState({ + status: 'idle', + message: '', + progress: 0 + }); + const [stats, setStats] = useState({ + pendingRDOs: 0, + pendingOperations: 0, + unresolvedConflicts: 0, + isOnline: true, + isSyncing: false + }); + const [isExpanded, setIsExpanded] = useState(false); + + useEffect(() => { + // Atualizar status online/offline + const handleOnline = () => setIsOnline(true); + const handleOffline = () => setIsOnline(false); + + window.addEventListener('online', handleOnline); + window.addEventListener('offline', handleOffline); + + // Escutar mudanças de sincronização + const unsubscribe = syncService.onSyncStatusChange((status) => { + setSyncStatus(status); + }); + + // Atualizar estatísticas a cada 5 segundos + const interval = setInterval(async () => { + const newStats = await syncService.getSyncStats(); + setStats(newStats); + }, 5000); + + // Carregar estatísticas iniciais + syncService.getSyncStats().then(setStats); + + return () => { + window.removeEventListener('online', handleOnline); + window.removeEventListener('offline', handleOffline); + unsubscribe(); + clearInterval(interval); + }; + }, []); + + const handleSync = async () => { + await syncService.forceSync(); + }; + + const hasPendingData = stats.pendingRDOs > 0 || stats.pendingOperations > 0; + const hasConflicts = stats.unresolvedConflicts > 0; + + return ( +
+ {/* Indicador compacto */} + + + {/* Painel expandido */} + {isExpanded && ( +
+ {/* Header */} +
+
+
+ {isOnline ? ( + + ) : ( + + )} + + {isOnline ? 'Online' : 'Offline'} + +
+ +
+
+ + {/* Conteúdo */} +
+ {/* Status de sincronização */} + {stats.isSyncing && ( +
+
+ + {syncStatus.message} +
+
+
+
+
+ )} + + {/* Estatísticas */} +
+ {stats.pendingRDOs > 0 && ( +
+ RDOs pendentes + + {stats.pendingRDOs} + +
+ )} + + {stats.pendingOperations > 0 && ( +
+ Operações pendentes + + {stats.pendingOperations} + +
+ )} + + {hasConflicts && ( +
+ + + Conflitos não resolvidos + + + {stats.unresolvedConflicts} + +
+ )} + + {!hasPendingData && !hasConflicts && isOnline && ( +
+ + Tudo sincronizado +
+ )} +
+ + {/* Botão de sincronização manual */} + {isOnline && hasPendingData && !stats.isSyncing && ( + + )} + + {/* Mensagem offline */} + {!isOnline && ( +
+

Modo Offline

+

+ Seus dados serão sincronizados automaticamente quando a conexão for restabelecida. +

+
+ )} + + {/* Link para logs */} + {hasConflicts && ( + + Ver detalhes dos conflitos + + )} +
+
+ )} +
+ ); +}; diff --git a/src/components/OfflineStatus.tsx b/src/components/OfflineStatus.tsx new file mode 100644 index 0000000..3c40914 --- /dev/null +++ b/src/components/OfflineStatus.tsx @@ -0,0 +1,222 @@ +import React from 'react'; +import { Wifi, WifiOff, RefreshCw, Database, Clock, AlertCircle } from 'lucide-react'; +import { useOffline, useOfflineStats } from '../hooks/useOffline'; +import { OfflineManager } from '../lib/offlineDb'; + +interface OfflineStatusProps { + showDetails?: boolean; + className?: string; +} + +export const OfflineStatus: React.FC = ({ + showDetails = false, + className = '' +}) => { + const { + isOnline, + isSyncing, + pendingOperations, + syncPendingOperations, + cacheDataForOffline + } = useOffline(); + + const { stats } = useOfflineStats(); + + const handleSync = async () => { + if (isOnline) { + await syncPendingOperations(); + await cacheDataForOffline(); + } + }; + + const handleClearCache = async () => { + if (confirm('Tem certeza que deseja limpar todo o cache offline? Isso removerá todos os dados salvos localmente.')) { + await OfflineManager.clearCache(); + window.location.reload(); + } + }; + + const formatLastSync = (timestamp?: number) => { + if (!timestamp) return 'Nunca'; + + const date = new Date(timestamp); + const now = new Date(); + const diffMs = now.getTime() - date.getTime(); + const diffMins = Math.floor(diffMs / (1000 * 60)); + const diffHours = Math.floor(diffMins / 60); + const diffDays = Math.floor(diffHours / 24); + + if (diffMins < 1) return 'Agora mesmo'; + if (diffMins < 60) return `${diffMins} min atrás`; + if (diffHours < 24) return `${diffHours}h atrás`; + return `${diffDays} dias atrás`; + }; + + if (!showDetails) { + // Versão compacta - apenas ícone de status + return ( +
+ {isOnline ? ( +
+ + Online +
+ ) : ( +
+ + Offline +
+ )} + + {pendingOperations.length > 0 && ( +
+ + {pendingOperations.length} +
+ )} + + {isSyncing && ( + + )} +
+ ); + } + + // Versão detalhada - painel completo + return ( +
+
+

Status de Conectividade

+ +
+ {isOnline ? ( +
+ + Online +
+ ) : ( +
+ + Offline +
+ )} +
+
+ + {/* Estatísticas do cache */} +
+
+
+ + Usuários +
+ {(stats as any).usuarios} +
+ +
+
+ + Obras +
+ {(stats as any).obras} +
+ +
+
+ + RDOs +
+ {(stats as any).rdos} +
+ +
+
+ + Pendentes +
+ {(stats as any).pendingOperations} +
+
+ + {/* Informações de sincronização */} +
+
+ Última sincronização: + {formatLastSync((stats as any).lastSync)} +
+ + {pendingOperations.length > 0 && ( +
+ + + {pendingOperations.length} operação(ões) aguardando sincronização + +
+ )} +
+ + {/* Ações */} +
+ + + +
+ + {/* Lista de operações pendentes */} + {pendingOperations.length > 0 && ( +
+

Operações Pendentes:

+
+ {pendingOperations.slice(0, 5).map((operation, index) => ( +
+ + {operation.operation.toUpperCase()} em {operation.table} + + + {formatLastSync(operation.timestamp)} + + {operation.error && ( +
+ +
+ )} +
+ ))} + {pendingOperations.length > 5 && ( +
+ +{pendingOperations.length - 5} mais operações... +
+ )} +
+
+ )} + + {/* Modo offline */} + {!isOnline && ( +
+
+ + Modo Offline Ativo +
+

+ Você está trabalhando offline. Suas alterações serão sincronizadas quando a conexão for restaurada. +

+
+ )} +
+ ); +}; + +export default OfflineStatus; \ No newline at end of file diff --git a/src/components/TaskLogModal.tsx b/src/components/TaskLogModal.tsx new file mode 100644 index 0000000..8495953 --- /dev/null +++ b/src/components/TaskLogModal.tsx @@ -0,0 +1,248 @@ +import React, { useEffect, useState } from 'react'; +import { motion, AnimatePresence } from 'framer-motion'; +import { + X, + Clock, + User, + Play, + Pause, + CheckCircle2, + Edit3, + RotateCcw, + AlertCircle, + Calendar +} from 'lucide-react'; +import { TaskLogEvent, eventTypeLabels, eventTypeColors } from '../types/taskLog'; +import { taskLogManager } from '../utils/taskLogManager'; + +interface TaskLogModalProps { + isOpen: boolean; + onClose: () => void; + taskId: string; + taskTitle: string; +} + +const iconMap = { + Play, + Pause, + CheckCircle2, + Edit3, + RotateCcw, + X: AlertCircle +}; + +const TaskLogModal: React.FC = ({ + isOpen, + onClose, + taskId, + taskTitle +}) => { + const [events, setEvents] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + if (isOpen && taskId) { + loadEvents(); + } + }, [isOpen, taskId]); + + const loadEvents = () => { + setLoading(true); + try { + const taskEvents = taskLogManager.getTaskEvents(taskId); + setEvents(taskEvents); + } catch (error) { + console.error('Erro ao carregar eventos da tarefa:', error); + setEvents([]); + } finally { + setLoading(false); + } + }; + + const formatDateTime = (timestamp: string) => { + const date = new Date(timestamp); + return { + date: date.toLocaleDateString('pt-BR'), + time: date.toLocaleTimeString('pt-BR', { + hour: '2-digit', + minute: '2-digit' + }) + }; + }; + + const getEventIcon = (type: string) => { + const iconName = type === 'inicio' || type === 'retomada' ? 'Play' : + type === 'pausa' ? 'Pause' : + type === 'conclusao' ? 'CheckCircle2' : + type === 'edicao' ? 'Edit3' : + type === 'revisao' ? 'RotateCcw' : 'X'; + + const IconComponent = iconMap[iconName as keyof typeof iconMap]; + return IconComponent; + }; + + const getRelativeTime = (timestamp: string) => { + const now = new Date(); + const eventTime = new Date(timestamp); + const diffInMinutes = Math.floor((now.getTime() - eventTime.getTime()) / (1000 * 60)); + + if (diffInMinutes < 1) return 'Agora mesmo'; + if (diffInMinutes < 60) return `${diffInMinutes} min atrás`; + + const diffInHours = Math.floor(diffInMinutes / 60); + if (diffInHours < 24) return `${diffInHours}h atrás`; + + const diffInDays = Math.floor(diffInHours / 24); + if (diffInDays < 7) return `${diffInDays} dia${diffInDays > 1 ? 's' : ''} atrás`; + + return formatDateTime(timestamp).date; + }; + + if (!isOpen) return null; + + return ( + +
+ + {/* Header */} +
+
+
+

Histórico da Tarefa

+

{taskTitle}

+
+ +
+
+ + {/* Content */} +
+ {loading ? ( +
+
+ Carregando histórico... +
+ ) : events.length === 0 ? ( +
+
+ +
+

+ Nenhum evento registrado +

+

+ Esta tarefa ainda não possui histórico de atividades. +

+
+ ) : ( +
+ {events.map((event, index) => { + const IconComponent = getEventIcon(event.type); + const { date, time } = formatDateTime(event.timestamp); + const isFirst = index === 0; + const isLast = index === events.length - 1; + + return ( + + {/* Timeline line */} + {!isLast && ( +
+ )} + +
+ {/* Icon */} +
+ +
+ + {/* Content */} +
+
+
+

+ {eventTypeLabels[event.type as keyof typeof eventTypeLabels]} +

+ + {getRelativeTime(event.timestamp)} + +
+ + {event.descricao && ( +

+ {event.descricao} +

+ )} + + {/* Details */} + {event.detalhes && ( +
+ {event.detalhes.statusAnterior && event.detalhes.statusNovo && ( +
+ Status: + {event.detalhes.statusAnterior} + + {event.detalhes.statusNovo} +
+ )} + + {event.detalhes.camposAlterados && event.detalhes.camposAlterados.length > 0 && ( +
+ Campos alterados: + + {event.detalhes.camposAlterados.join(', ')} + +
+ )} + + {event.detalhes.observacoes && ( +
+ Observações: + {event.detalhes.observacoes} +
+ )} +
+ )} + + {/* Footer */} +
+
+ + {event.usuario} +
+
+ + {date} às {time} +
+
+
+
+
+ + ); + })} +
+ )} +
+ +
+ + ); +}; + +export default TaskLogModal; \ No newline at end of file diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx new file mode 100644 index 0000000..343d68f --- /dev/null +++ b/src/components/ThemeToggle.tsx @@ -0,0 +1,45 @@ +import { Sun, Moon } from 'lucide-react'; +import { useTheme } from '@/hooks/useTheme'; +import { motion } from 'framer-motion'; + +export function ThemeToggle() { + const { theme, toggleTheme, isDark } = useTheme(); + + return ( + +
+ + + + + + + +
+
+ ); +} \ No newline at end of file diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx new file mode 100644 index 0000000..5d99bfc --- /dev/null +++ b/src/components/auth/LoginForm.tsx @@ -0,0 +1,159 @@ +import React, { useState } from 'react'; +import { useAuthContext } from '../../contexts/AuthContext'; +import { SocialLoginButtons } from './SocialLoginButtons'; + +interface LoginFormProps { + onSuccess?: () => void; + onSwitchToRegister?: () => void; +} + +const LoginForm: React.FC = ({ onSuccess, onSwitchToRegister }) => { + const { login, loading, error, clearError } = useAuthContext(); + const [formData, setFormData] = useState({ + email: '', + password: '' + }); + const [showPassword, setShowPassword] = useState(false); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + clearError(); + + console.log('🔍 LoginForm: handleSubmit chamado'); + console.log('📧 Email:', formData.email); + console.log('🔒 Password length:', formData.password.length); + + if (!formData.email || !formData.password) { + console.log('❌ LoginForm: Email ou senha vazios'); + return; + } + + console.log('🚀 LoginForm: Chamando função login...'); + const result = await login(formData); + console.log('📊 LoginForm: Resultado do login:', result); + + if (result.success && onSuccess) { + console.log('✅ LoginForm: Login bem-sucedido, chamando onSuccess'); + onSuccess(); + } else { + console.log('❌ LoginForm: Login falhou ou onSuccess não definido'); + } + }; + + const handleChange = (e: React.ChangeEvent) => { + const { name, value } = e.target; + setFormData(prev => ({ ...prev, [name]: value })); + }; + + return ( +
+
+
+

Entrar

+

Acesse sua conta

+
+ + {error && ( +
+

{error}

+
+ )} + + {/* Social Login Buttons */} + console.error('Social login error:', err)} + /> + + +
+ + +
+ +
+ +
+ + +
+
+ + + + +
+ +
+ + {onSwitchToRegister && ( +
+

+ Não tem uma conta?{' '} + +

+
+ )} +
+
+ ); +}; + +export default LoginForm; \ No newline at end of file diff --git a/src/components/auth/MFASetup.tsx b/src/components/auth/MFASetup.tsx new file mode 100644 index 0000000..76634a5 --- /dev/null +++ b/src/components/auth/MFASetup.tsx @@ -0,0 +1,209 @@ +/** + * Componente de Setup MFA + * + * Exibe QR Code e permite configuração do MFA + */ + +import React, { useState, useEffect } from 'react'; +import { QRCodeSVG } from 'qrcode.react'; +import { useMFA } from '../../hooks/useMFA'; +import { Shield, Copy, Check, AlertCircle, Download } from 'lucide-react'; + +interface MFASetupProps { + onComplete?: () => void; + onCancel?: () => void; +} + +export const MFASetup: React.FC = ({ onComplete, onCancel }) => { + const { enrollment, backupCodes, startEnrollment, verifyEnrollment, loading, error } = useMFA(); + const [verificationCode, setVerificationCode] = useState(''); + const [step, setStep] = useState<'setup' | 'verify' | 'backup'>('setup'); + const [copied, setCopied] = useState(false); + + useEffect(() => { + // Iniciar enrollment automaticamente + if (!enrollment) { + startEnrollment('Authenticator App'); + } + }, [enrollment, startEnrollment]); + + const handleCopySecret = () => { + if (enrollment) { + navigator.clipboard.writeText(enrollment.secret); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } + }; + + const handleVerify = async () => { + const result = await verifyEnrollment(verificationCode); + + if (result.success) { + setStep('backup'); + } + }; + + const handleDownloadBackupCodes = () => { + const text = backupCodes.map(c => c.code).join('\n'); + const blob = new Blob([text], { type: 'text/plain' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = 'mfa-backup-codes.txt'; + a.click(); + URL.revokeObjectURL(url); + }; + + const handleComplete = () => { + onComplete?.(); + }; + + if (loading && !enrollment) { + return ( +
+
+
+ ); + } + + return ( +
+ {/* Header */} +
+
+ +
+

+ Autenticação de Dois Fatores +

+

+ Adicione uma camada extra de segurança à sua conta +

+
+ + {error && ( +
+ +

{error}

+
+ )} + + {/* Step 1: Setup */} + {step === 'setup' && enrollment && ( +
+
+

+ 1. Escaneie o QR Code +

+ +
+
+ +
+
+ +

+ Use um aplicativo autenticador como Google Authenticator, Authy ou Microsoft Authenticator +

+ +
+

Ou insira manualmente:

+
+ + {enrollment.secret} + + +
+
+
+ +
+

+ 2. Digite o código de verificação +

+ + setVerificationCode(e.target.value.replace(/\D/g, '').slice(0, 6))} + placeholder="000000" + className="w-full text-center text-2xl font-mono tracking-widest px-4 py-3 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" + maxLength={6} + /> + +

+ Digite o código de 6 dígitos do seu aplicativo autenticador +

+
+ +
+ {onCancel && ( + + )} + +
+
+ )} + + {/* Step 2: Backup Codes */} + {step === 'backup' && backupCodes.length > 0 && ( +
+
+

+ + Códigos de Backup +

+

+ Guarde estes códigos em um local seguro. Você pode usá-los para acessar sua conta se perder acesso ao seu aplicativo autenticador. +

+ +
+ {backupCodes.map((backup, index) => ( + + {backup.code} + + ))} +
+
+ +
+ + +
+
+ )} +
+ ); +}; diff --git a/src/components/auth/MFAVerification.tsx b/src/components/auth/MFAVerification.tsx new file mode 100644 index 0000000..2c53523 --- /dev/null +++ b/src/components/auth/MFAVerification.tsx @@ -0,0 +1,117 @@ +/** + * Componente de Verificação MFA + * + * Usado durante o login para verificar código TOTP + */ + +import React, { useState } from 'react'; +import { Shield, AlertCircle } from 'lucide-react'; +import { useMFA } from '../../hooks/useMFA'; + +interface MFAVerificationProps { + factorId: string; + onSuccess?: () => void; + onCancel?: () => void; +} + +export const MFAVerification: React.FC = ({ + factorId, + onSuccess, + onCancel, +}) => { + const { verifyCode, loading, error } = useMFA(); + const [code, setCode] = useState(''); + + const handleVerify = async () => { + const result = await verifyCode(factorId, code); + + if (result.success) { + onSuccess?.(); + } + }; + + const handleKeyPress = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && code.length === 6) { + handleVerify(); + } + }; + + return ( +
+
+
+ +
+

+ Verificação em Duas Etapas +

+

+ Digite o código do seu aplicativo autenticador +

+
+ + {error && ( +
+ +
+

Código inválido

+

{error}

+
+
+ )} + +
+
+ + setCode(e.target.value.replace(/\D/g, '').slice(0, 6))} + onKeyPress={handleKeyPress} + placeholder="000000" + autoFocus + className="w-full text-center text-3xl font-mono tracking-widest px-4 py-4 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" + maxLength={6} + /> +

+ Digite o código de 6 dígitos +

+
+ +
+ {onCancel && ( + + )} + +
+ +
+ +
+
+
+ ); +}; diff --git a/src/components/auth/ProtectedRoute.tsx b/src/components/auth/ProtectedRoute.tsx new file mode 100644 index 0000000..1844d9f --- /dev/null +++ b/src/components/auth/ProtectedRoute.tsx @@ -0,0 +1,69 @@ +import React from 'react'; +import { Navigate, useLocation } from 'react-router-dom'; +import { useAuthContext } from '../../contexts/AuthContext'; +import { useCurrentUser } from '../../stores/useUserStore'; + +interface ProtectedRouteProps { + children: React.ReactNode; + requireAuth?: boolean; + redirectTo?: string; +} + +const ProtectedRoute: React.FC = ({ + children, + requireAuth = true, + redirectTo = '/login' +}) => { + const { isAuthenticated, loading } = useAuthContext(); + const currentUser = useCurrentUser(); + const location = useLocation(); + + // Mostrar loading enquanto verifica autenticação + if (loading) { + return ( +
+
+
+

Verificando autenticação...

+
+
+ ); + } + + // Se requer autenticação mas não está autenticado + if (requireAuth && !isAuthenticated) { + return ( + + ); + } + + // Definição de rotas isentas de redirecionamento automático + const authExemptPaths = ['/auth/callback', '/selecionar-organizacao']; + const isExemptPath = authExemptPaths.includes(location.pathname); + + // Se não requer autenticação mas está autenticado (ex: página de login) + if (!requireAuth && isAuthenticated && !isExemptPath) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const from = (location.state as any)?.from?.pathname || '/dashboard'; + return ; + } + + // Verificação de Organização + // Se estiver autenticado e em rota protegida, verificar se possui organização + if (requireAuth && isAuthenticated && !isExemptPath) { + // Se o usuário não foi carregado corretamente (null) ou não tem organização, + // Redireciona para a tela de seleção/ingresse com código + if (!currentUser || !currentUser.organizacao_id) { + console.log('🔒 ProtectedRoute: Usuário sem organização/perfil. Redirecionando...'); + return ; + } + } + + return <>{children}; +}; + +export default ProtectedRoute; \ No newline at end of file diff --git a/src/components/auth/RegisterForm.tsx b/src/components/auth/RegisterForm.tsx new file mode 100644 index 0000000..1633c37 --- /dev/null +++ b/src/components/auth/RegisterForm.tsx @@ -0,0 +1,302 @@ +import React, { useState } from 'react'; +import { useAuthContext } from '../../contexts/AuthContext'; + +interface RegisterFormProps { + onSuccess?: () => void; + onSwitchToLogin?: () => void; +} + +const RegisterForm: React.FC = ({ onSuccess, onSwitchToLogin }) => { + const { register, loading, error, clearError } = useAuthContext(); + const [formData, setFormData] = useState({ + nome: '', + email: '', + password: '', + confirmPassword: '', + cpf: '', + telefone: '' + }); + const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); + const [formErrors, setFormErrors] = useState>({}); + + const validateForm = () => { + const errors: Record = {}; + + if (!formData.nome.trim()) { + errors.nome = 'Nome é obrigatório'; + } + + if (!formData.email.trim()) { + errors.email = 'Email é obrigatório'; + } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) { + errors.email = 'Email inválido'; + } + + if (!formData.password) { + errors.password = 'Senha é obrigatória'; + } else if (formData.password.length < 6) { + errors.password = 'Senha deve ter pelo menos 6 caracteres'; + } + + if (formData.password !== formData.confirmPassword) { + errors.confirmPassword = 'Senhas não coincidem'; + } + + if (formData.cpf && !/^\d{11}$/.test(formData.cpf.replace(/\D/g, ''))) { + errors.cpf = 'CPF deve ter 11 dígitos'; + } + + if (formData.telefone && !/^\d{10,11}$/.test(formData.telefone.replace(/\D/g, ''))) { + errors.telefone = 'Telefone deve ter 10 ou 11 dígitos'; + } + + setFormErrors(errors); + return Object.keys(errors).length === 0; + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + clearError(); + setFormErrors({}); + + if (!validateForm()) { + return; + } + + const result = await register({ + nome: formData.nome, + email: formData.email, + password: formData.password, + cpf: formData.cpf || undefined, + telefone: formData.telefone || undefined + }); + + if (result.success) { + alert('Cadastro realizado com sucesso! Verifique seu email para confirmar a conta.'); + if (onSuccess) { + onSuccess(); + } + } + }; + + const handleChange = (e: React.ChangeEvent) => { + const { name, value } = e.target; + setFormData(prev => ({ ...prev, [name]: value })); + + // Limpar erro do campo quando o usuário começar a digitar + if (formErrors[name]) { + setFormErrors(prev => ({ ...prev, [name]: '' })); + } + }; + + const formatCPF = (value: string) => { + const numbers = value.replace(/\D/g, ''); + return numbers.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4'); + }; + + const formatPhone = (value: string) => { + const numbers = value.replace(/\D/g, ''); + if (numbers.length <= 10) { + return numbers.replace(/(\d{2})(\d{4})(\d{4})/, '($1) $2-$3'); + } + return numbers.replace(/(\d{2})(\d{5})(\d{4})/, '($1) $2-$3'); + }; + + return ( +
+
+
+

Cadastrar

+

Crie sua conta

+
+ + {error && ( +
+

{error}

+
+ )} + +
+
+ + + {formErrors.nome && ( +

{formErrors.nome}

+ )} +
+ +
+ + + {formErrors.email && ( +

{formErrors.email}

+ )} +
+ +
+
+ + handleChange({ ...e, target: { ...e.target, value: e.target.value.replace(/\D/g, '') } })} + maxLength={14} + className={`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${ + formErrors.cpf ? 'border-red-400/50' : 'border-white/20' + }`} + placeholder="000.000.000-00" + /> + {formErrors.cpf && ( +

{formErrors.cpf}

+ )} +
+ +
+ + handleChange({ ...e, target: { ...e.target, value: e.target.value.replace(/\D/g, '') } })} + maxLength={15} + className={`w-full px-4 py-3 bg-white/10 border rounded-xl text-white placeholder-blue-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent backdrop-blur-sm transition-all duration-200 ${ + formErrors.telefone ? 'border-red-400/50' : 'border-white/20' + }`} + placeholder="(11) 99999-9999" + /> + {formErrors.telefone && ( +

{formErrors.telefone}

+ )} +
+
+ +
+ +
+ + +
+ {formErrors.password && ( +

{formErrors.password}

+ )} +
+ +
+ +
+ + +
+ {formErrors.confirmPassword && ( +

{formErrors.confirmPassword}

+ )} +
+ + +
+ + {onSwitchToLogin && ( +
+

+ Já tem uma conta?{' '} + +

+
+ )} +
+
+ ); +}; + +export default RegisterForm; \ No newline at end of file diff --git a/src/components/auth/SocialLoginButtons.tsx b/src/components/auth/SocialLoginButtons.tsx new file mode 100644 index 0000000..9f9a075 --- /dev/null +++ b/src/components/auth/SocialLoginButtons.tsx @@ -0,0 +1,110 @@ +/** + * Componente de Botões de Social Login + * + * Exibe botões estilizados para login com Google e Microsoft + */ + +import React from 'react'; +import { useSocialAuth } from '../../hooks/useSocialAuth'; + +interface SocialLoginButtonsProps { + mode?: 'login' | 'link'; + onSuccess?: () => void; + onError?: (error: string) => void; +} + +export const SocialLoginButtons: React.FC = ({ + mode = 'login', + onSuccess, + onError, +}) => { + const { loading, signInWithGoogle, signInWithMicrosoft, linkProvider } = useSocialAuth(); + + const handleGoogleClick = async () => { + const { error } = mode === 'login' + ? await signInWithGoogle() + : await linkProvider('google'); + + if (error) { + onError?.(error); + } else { + onSuccess?.(); + } + }; + + const handleMicrosoftClick = async () => { + const { error } = mode === 'login' + ? await signInWithMicrosoft() + : await linkProvider('azure'); + + if (error) { + onError?.(error); + } else { + onSuccess?.(); + } + }; + + const buttonText = mode === 'login' ? 'Entrar com' : 'Vincular'; + + return ( +
+ {/* Google Button */} + + + {/* Microsoft Button */} + + + {mode === 'login' && ( +
+
+
+
+
+ ou +
+
+ )} +
+ ); +}; diff --git a/src/components/config/CondicoesClimaticasConfig.tsx b/src/components/config/CondicoesClimaticasConfig.tsx new file mode 100644 index 0000000..b2d4bc3 --- /dev/null +++ b/src/components/config/CondicoesClimaticasConfig.tsx @@ -0,0 +1,421 @@ +import { useState } from 'react'; +import { motion, AnimatePresence } from 'framer-motion'; +import { + Plus, + Edit2, + Trash2, + Search, + X, + Save, + AlertCircle, + Cloud, + Sun, + CloudRain, + CloudSnow +} from 'lucide-react'; +import { useCondicoesClimaticas } from '../../stores/configStore'; + +interface ModalProps { + isOpen: boolean; + onClose: () => void; + item?: { id: string; nome: string; descricao?: string; icone?: string }; + onSave: (data: { nome: string; descricao?: string; icone?: string }) => void; +} + +const iconOptions = [ + { value: 'sun', label: 'Sol', icon: Sun }, + { value: 'cloud', label: 'Nuvem', icon: Cloud }, + { value: 'rain', label: 'Chuva', icon: CloudRain }, + { value: 'snow', label: 'Neve', icon: CloudSnow } +]; + +function Modal({ isOpen, onClose, item, onSave }: ModalProps) { + const [nome, setNome] = useState(item?.nome || ''); + const [descricao, setDescricao] = useState(item?.descricao || ''); + const [icone, setIcone] = useState(item?.icone || 'cloud'); + const [errors, setErrors] = useState<{ nome?: string }>({}); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + const newErrors: { nome?: string } = {}; + if (!nome.trim()) { + newErrors.nome = 'Nome é obrigatório'; + } + + if (Object.keys(newErrors).length > 0) { + setErrors(newErrors); + return; + } + + onSave({ + nome: nome.trim(), + descricao: descricao.trim() || undefined, + icone + }); + onClose(); + setNome(''); + setDescricao(''); + setIcone('cloud'); + setErrors({}); + }; + + const handleClose = () => { + onClose(); + setNome(''); + setDescricao(''); + setIcone('cloud'); + setErrors({}); + }; + + if (!isOpen) return null; + + return ( +
+ +
+

+ {item ? 'Editar' : 'Nova'} Condição Climática +

+ +
+ +
+
+ + setNome(e.target.value)} + className={`w-full px-4 py-3 rounded-xl border transition-colors ${ + errors.nome + ? 'border-red-300 focus:border-red-500 focus:ring-red-500/20' + : 'border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500/20' + } bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-4 focus:outline-none`} + placeholder="Ex: Ensolarado, Nublado, Chuva..." + /> + {errors.nome && ( +

+ + {errors.nome} +

+ )} +
+ +
+ +
+ {iconOptions.map((option) => { + const IconComponent = option.icon; + return ( + + ); + })} +
+
+ +
+ +