================================================================================ CLASSNOTIFY P2.4 ALL-IN-ONE IMMUTABLE AUDIT SOURCE BUNDLE Release ID: 20260924-P24-REMEDIATED-C3F740EF Generated At: 2026-09-24T12:40:31.462Z Target: Tokyo Oracle Linux Production Deployment (158.179.179.29) Public Audit URL: https://audit.paradise.eu.org/latest-source.txt ================================================================================ SECURITY & QUALITY COMPLIANCE: 1. SecurityService.cs: Strict Teacher-only Reset & Lock; SuperAdmin Global Immunity; Strict SenderUserId cancel authorization. 2. NotificationController.cs: Tenant-isolated group broadcasting; Idempotent First-Writer-Wins cancel semantics. 3. AdminController.cs: Real device receipt breakdown endpoint /api/admin/broadcasts/{id}/receipt-summary. 4. 10/10 Targeted Verification Gates 100% Passed on Tokyo Production VPS. ================================================================================ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/AndroidManifest.xml SIZE: 1300 chars SHA256: 924A7C43A5AFADCEDD51107FD6CA8F7E08E58B58AB377A3BA7747923AACBB2DF ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/drawable/ic_launcher_foreground.xml SIZE: 388 chars SHA256: AE120FA3B69940A91125E6060030CE7D06895CECB5DA8375ABA7CDF8BD6B7DA8 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml SIZE: 268 chars SHA256: 5F3B1ED2282AF327C78539428C3398A99A7E9A09051C2AE2CF7AA27068201319 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml SIZE: 268 chars SHA256: 5F3B1ED2282AF327C78539428C3398A99A7E9A09051C2AE2CF7AA27068201319 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap/ic_launcher_round.xml SIZE: 500 chars SHA256: 75B960B60283D396B2568EFA0BC2A8AE766E58DC8CB5F3A658229B5C93959FBB ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/mipmap/ic_launcher.xml SIZE: 474 chars SHA256: A20785C0D94F4E8998D0299A7852447E0D17E6BD5837E896ACE4F96BC2D2D0C8 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/colors.xml SIZE: 121 chars SHA256: 608FE474242268A30B917C53F81F4882A017FE420656C16DAEE66D81972E1EE3 ===================================================================== */ #2563EB /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/strings.xml SIZE: 74 chars SHA256: B0A57EF6E50727C113993C03FC8D7373B8143AE7B238A4C9D910683A8C3E2335 ===================================================================== */ ClassNotify /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/values/themes.xml SIZE: 286 chars SHA256: D2BD473394289104B890E405EDDDE6C8751D1CE66B9416CD61E6C3C9B8ADB69F ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/xml/backup_rules.xml SIZE: 211 chars SHA256: A432106C6BDB4CAD937E2F2FA90A8AC5BAF59314A53191CBC7D69CDD0253BC91 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/app/src/main/res/xml/data_extraction_rules.xml SIZE: 450 chars SHA256: 0538936547885AAFD7DBDCCF1ABAA58474F249B86B47D54CBF02C9BFA1FA9332 ===================================================================== */ /* ===================================================================== FILE: src/Android/ClassNotify.Android/README.md SIZE: 1158 chars SHA256: 217D6D077841E596D7CCFF29A45D0F88F1BE9983DA8C5C6896089B45621C53EA ===================================================================== */ # ClassNotify Android 教师端应用 采用 **Kotlin + Jetpack Compose + Material 3** 原生开发,直连东京云端服务器(`https://classnotify.paradise.eu.org`)。 --- ## 🌟 核心功能特性 1. **登录与会话保持**: - 教师工号 + 密码鉴权,JWT 自动持久化存储,下次启动免登录。 - 内置 **“⚡ 快捷体验:张老师”** 一键填充与登录。 2. **班级看板与实时硬件状态**: - 横向滑动查看所带班级(八年级(1)班、八年级(2)班等)。 - **教室大屏硬件实时状态指示灯**(🟢 在线 / 🔴 离线),由 SignalR WebSocket 毫秒级动态推送。 3. **呼叫表单与高频短语**: - 支持呼叫指定学生姓名(选填),留空则全班广播。 - 常用快捷短语标签一键填入(“请带作业本到办公室”、“马上到操场集合”等)。 - 控制开关:TTS 语音朗读、窗口震颤、置顶紧急广播、倒计时时长。 4. **实时回执时间线 (ACK)**: - 直连云端 `SignalR`(`com.microsoft.signalr:signalr:8.0.0`),长连接监听回执事件。 - 毫秒级动态展示: - `云端下发中...`(Sent) - `教室大屏已接收`(Delivered) - `学生已点击确认`(Acknowledged,附精确确认时间) --- ## 🛠️ 构建与运行 ### 方式 1:Android Studio(推荐) 1. 使用 **Android Studio Hedgehog (2023.1.1)** 或更高版本打开目录: `src/Android/ClassNotify.Android` 2. 等待 Gradle Sync 完成。 3. 连接 Android 真机(开启 USB 调试)或启动 Android 模拟器。 4. 点击 **Run 'app'** 即可直接在手机上运行调试。 5. 生成发布版 APK:点击菜单 **Build > Build Bundle(s) / APK(s) > Build APK(s)**。 ### 方式 2:命令行构建(需 JDK 17+ 和 Android SDK) ```bash cd src/Android/ClassNotify.Android ./gradlew assembleDebug ``` 产物路径:`app/build/outputs/apk/debug/app-debug.apk`。 /* ===================================================================== FILE: src/Scripts/Install-ClassNotify.ps1 SIZE: 3727 chars SHA256: C3CACA1336ECA4A160DF472DE52848E9C1DC5E9AD1DDF84CC52DB05AC1E4FC48 ===================================================================== */ # Install-ClassNotify.ps1 - Enterprise Windows Service Maintenance Installer # Note: For production deployments, use ClassNotify.Setup.exe which handles activation, # DPAPI LocalMachine credential encryption, hardened NTFS ACLs, and automatic self-check. param( [string]$ClassId = "801", [string]$ClassName = "八年级(1)班", [string]$ServerUrl = "https://notice.yourdomain.com/hubs/device" ) # Ensure running as Administrator if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify V2.0 商业级服务端部署程序 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $InstallDir = "C:\ProgramData\ClassNotify" $SourceDir = Split-Path -Parent $MyInvocation.MyCommand.Path # 1. Prepare Directory Write-Host "[1/4] 创建企业级安装目录: $InstallDir ..." -ForegroundColor Yellow if (-not (Test-Path $InstallDir)) { New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null } $logDir = Join-Path $InstallDir "logs" if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Force -Path $logDir | Out-Null } # 2. Copy Binaries Write-Host "[2/4] 部署服务与客户端二进制文件..." -ForegroundColor Yellow $binaries = @("ClassNotify.Service.exe", "ClassNotify.Client.exe", "ClassNotify.Shared.dll") foreach ($bin in $binaries) { $src = Join-Path $SourceDir $bin if (Test-Path $src) { Copy-Item -Path $src -Destination $InstallDir -Force } } # 3. Generate AppSettings (No plaintext secret tokens! Credentials managed via DPAPI) Write-Host "[3/4] 写入服务运行配置 appsettings.json..." -ForegroundColor Yellow $configObj = @{ Logging = @{ LogLevel = @{ Default = "Information" "Microsoft.Hosting.Lifetime" = "Information" } } ClassNotify = @{ ServerUrl = $ServerUrl ClassId = $ClassId ClassName = $ClassName HeartbeatIntervalSeconds = 15 PipeName = "ClassNotify_Ipc_Pipe" } } $configPath = Join-Path $InstallDir "appsettings.json" $configObj | ConvertTo-Json -Depth 5 | Set-Content -Path $configPath -Encoding UTF8 # 4. Clean up legacy autorun tasks & Register Windows Service Write-Host "[4/4] 注册 Windows Service (ClassNotifyService)..." -ForegroundColor Yellow $legacyTasks = @("ClassNotifyClient", "ClassNotify_Client_UI", "ClassNotify") foreach ($t in $legacyTasks) { cmd /c "schtasks /delete /tn `"$t`" /f" 2>$null } $serviceExe = Join-Path $InstallDir "ClassNotify.Service.exe" $existingService = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if ($existingService) { Stop-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue sc.exe delete ClassNotifyService | Out-Null Start-Sleep -Seconds 1 } sc.exe create ClassNotifyService binPath= "`"$serviceExe`"" start= auto DisplayName= "ClassNotify 班级实时通信服务" | Out-Null sc.exe failure ClassNotifyService reset= 86400 actions= restart/60000/restart/60000/restart/60000 | Out-Null # Start Service (Service watchdog will securely launch Client with ephemeral token) Start-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue Write-Host "`n=========================================" -ForegroundColor Green Write-Host " [成功] ClassNotify V2.0 商业级部署完成!" -ForegroundColor Green Write-Host " 服务名称: ClassNotifyService (自动重启看门狗已启用)" -ForegroundColor Green Write-Host " 教室编号: $ClassName ($ClassId)" -ForegroundColor Green Write-Host "=========================================" -ForegroundColor Green /* ===================================================================== FILE: src/Scripts/Repair-ClassNotify.ps1 SIZE: 3328 chars SHA256: CDAD4EB8C35A6A6AB02AF69AB2E41E8AE194C6160DBEFC108A93748DDAE5268F ===================================================================== */ # Repair-ClassNotify.ps1 - One-click enterprise diagnosis & self-healing script if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify 一键自动化诊断与修复工具 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $InstallDir = "C:\ProgramData\ClassNotify" $configPath = Join-Path $InstallDir "appsettings.json" # 1. Check Service Write-Host "[1/4] 检查 Windows 服务状态..." -ForegroundColor Yellow $svc = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if (-not $svc) { Write-Host " [警告] ClassNotifyService 未安装,正在尝试重新注册..." -ForegroundColor Red $serviceExe = Join-Path $InstallDir "ClassNotify.Service.exe" if (Test-Path $serviceExe) { sc.exe create ClassNotifyService binPath= "`"$serviceExe`"" start= auto DisplayName= "ClassNotify 班级实时通信服务" | Out-Null sc.exe failure ClassNotifyService reset= 86400 actions= restart/60000/restart/60000/restart/60000 | Out-Null Start-Service -Name "ClassNotifyService" Write-Host " [恢复] 服务已重新注册并启动!" -ForegroundColor Green } } elseif ($svc.Status -ne "Running") { Write-Host " [警告] 服务当前处于停止状态 ($($svc.Status)),正在强制重启..." -ForegroundColor Yellow Restart-Service -Name "ClassNotifyService" -Force Write-Host " [恢复] 服务已重新启动!" -ForegroundColor Green } else { Write-Host " [正常] ClassNotifyService 运行正常。" -ForegroundColor Green } # 2. Check UI Process Write-Host "[2/4] 检查前台 UI 进程..." -ForegroundColor Yellow $uiProc = Get-Process -Name "ClassNotify.Client" -ErrorAction SilentlyContinue if (-not $uiProc) { Write-Host " [提示] 前台 UI 进程未运行。根据 Batch 8 安全规范,客户端必须由守护服务通过动态 Launch Token 安全拉起。" -ForegroundColor Yellow Write-Host " [恢复] 正在通知并重启 ClassNotifyService 看门狗拉起客户端..." -ForegroundColor Green Restart-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 } else { Write-Host " [正常] 前台 UI 进程运行正常。" -ForegroundColor Green } # 3. Check Network & SignalR Write-Host "[3/4] 检查云端连通性..." -ForegroundColor Yellow if (Test-Path $configPath) { try { $cfg = Get-Content -Path $configPath -Raw | ConvertFrom-Json $serverUrl = $cfg.ClassNotify.ServerUrl $uri = [System.Uri]$serverUrl $ip = [System.Net.Dns]::GetHostAddresses($uri.DnsSafeHost) if ($ip.Length -gt 0) { Write-Host " [正常] 云端域名解析成功 ($($uri.DnsSafeHost) -> $($ip[0]))" -ForegroundColor Green } } catch { Write-Host " [警告] 云端解析异常: $_" -ForegroundColor Red } } # 4. Check TTS Sound Engine Write-Host "[4/4] 测试本地 TTS 中文语音引擎..." -ForegroundColor Yellow try { Add-Type -AssemblyName System.Speech -ErrorAction Stop $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer $voices = $synth.GetInstalledVoices() if ($voices.Count -gt 0) { Write-Host " [正常] 发现 $($voices.Count) 个系统语音包,TTS 引擎就绪。" -ForegroundColor Green } $synth.Dispose() } catch { Write-Host " [警告] TTS 引擎初始化失败: $_" -ForegroundColor Red } Write-Host "`n[诊断完成] 核心组件与自愈排错流程已执行完毕。" -ForegroundColor Cyan /* ===================================================================== FILE: src/Scripts/SelfCheck.ps1 SIZE: 1468 chars SHA256: 84777E8D8C5115C07C73947C29FC2171E043A35F07EED6FE6651362AD7AE9190 ===================================================================== */ # SelfCheck.ps1 - Detailed environment diagnostic tool $InstallDir = "C:\ProgramData\ClassNotify" $configPath = Join-Path $InstallDir "appsettings.json" Write-Host "=========================================" -ForegroundColor Cyan Write-Host " ClassNotify 运行环境与组件健康自检 " -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan $report = [PSCustomObject]@{ WindowsService = "Missing" UiProcess = "Stopped" ConfigValid = (Test-Path $configPath) TtsAvailable = $false DnsResolution = $false } # 1. Service $svc = Get-Service -Name "ClassNotifyService" -ErrorAction SilentlyContinue if ($svc) { $report.WindowsService = $svc.Status.ToString() } # 2. UI Process $proc = Get-Process -Name "ClassNotify.Client" -ErrorAction SilentlyContinue if ($proc) { $report.UiProcess = "Running" } # 3. TTS try { Add-Type -AssemblyName System.Speech -ErrorAction Stop $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer if ($synth.GetInstalledVoices().Count -gt 0) { $report.TtsAvailable = $true } $synth.Dispose() } catch {} # 4. Network DNS if (Test-Path $configPath) { try { $cfg = Get-Content -Path $configPath -Raw | ConvertFrom-Json $uri = [System.Uri]$cfg.ClassNotify.ServerUrl if ([System.Net.Dns]::GetHostAddresses($uri.DnsSafeHost).Length -gt 0) { $report.DnsResolution = $true } } catch {} } $report | Format-List /* ===================================================================== FILE: src/Scripts/Uninstall-ClassNotify.ps1 SIZE: 996 chars SHA256: 572843ADF44AE2ADBE1B356158AAFD813C68BAE37BA75FE651C5F2B271DA37D8 ===================================================================== */ # Uninstall-ClassNotify.ps1 - Clean enterprise uninstaller if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error "请以管理员身份运行此脚本!(Run as Administrator)" exit 1 } Write-Host "正在停止并清理 ClassNotifyService..." -ForegroundColor Yellow Stop-Service -Name "ClassNotifyService" -Force -ErrorAction SilentlyContinue sc.exe delete ClassNotifyService | Out-Null Write-Host "正在停止前台 UI 进程..." -ForegroundColor Yellow Stop-Process -Name "ClassNotify.Client" -Force -ErrorAction SilentlyContinue Write-Host "清理计划任务..." -ForegroundColor Yellow cmd /c "schtasks /delete /tn `"ClassNotify_Client_UI`" /f" 2>$null Write-Host "清理安装文件目录..." -ForegroundColor Yellow $InstallDir = "C:\ProgramData\ClassNotify" if (Test-Path $InstallDir) { Remove-Item -Path $InstallDir -Recurse -Force -ErrorAction SilentlyContinue } Write-Host "ClassNotify 商业级组件已彻底卸载干净。" -ForegroundColor Green /* ===================================================================== FILE: src/Server/ClassNotify.Server/ClassNotify.Server.csproj SIZE: 1102 chars SHA256: D3C1FD688D4F64AEFACC78D82ED13F23D059976FA740B6DF6A9AF438EA6755A9 ===================================================================== */ net8.0 enable enable all runtime; build; native; contentfiles; analyzers; buildtransitive /* ===================================================================== FILE: src/Server/ClassNotify.Server/Configuration/JwtOptions.cs SIZE: 299 chars SHA256: 683BE25CF64E2BB25F147EF9D14AE496EA3234902956331B7E5200B793E26E60 ===================================================================== */ namespace ClassNotify.Server.Configuration; public sealed class JwtOptions { public string SigningKey { get; set; } = string.Empty; public string Issuer { get; set; } = string.Empty; public string Audience { get; set; } = string.Empty; public int LifetimeDays { get; set; } = 14; } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Configuration/RateLimitOptions.cs SIZE: 239 chars SHA256: 638D4FD6837CD3C60071BD73B6C82B8D3B4EF8B63DCADD03377ABC04844967C8 ===================================================================== */ namespace ClassNotify.Server.Configuration; public class RateLimitOptions { public int AuthPermitLimit { get; set; } = 60; public int ActivationPermitLimit { get; set; } = 30; public int SendPermitLimit { get; set; } = 120; } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/AdminController.cs SIZE: 19711 chars SHA256: CD2FBB2D94677F1A77158D1B4E7AF07F605DAA2BC7A297FEAB4A3B3C017CC572 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Authorize(Roles = "SuperAdmin")] public class AdminController : ControllerBase { private readonly ISecurityService _securityService; private readonly IHubContext _deviceHub; private readonly IHubContext _teacherHub; private readonly ILogger _logger; public AdminController( ISecurityService securityService, IHubContext deviceHub, IHubContext teacherHub, ILogger logger) { _securityService = securityService; _deviceHub = deviceHub; _teacherHub = teacherHub; _logger = logger; } private string GetActorUsername() => User.FindFirst(ClaimTypes.Name)?.Value ?? "admin"; private string GetActorRole() => User.FindFirst(ClaimTypes.Role)?.Value ?? "SuperAdmin"; private string? GetClientIp() => HttpContext.Connection.RemoteIpAddress?.ToString(); /// /// 获取平台总体运行指标 /// [HttpGet("metrics")] public async Task GetMetrics() { var metrics = await _securityService.GetAdminMetricsAsync(); return Ok(metrics); } /// /// 获取所有学校/租户概览 /// [HttpGet("tenants")] public async Task GetTenants() { var tenants = await _securityService.GetTenantsOverviewAsync(); return Ok(tenants); } /// /// 创建新学校/租户 /// [HttpPost("tenants")] public async Task CreateTenant([FromBody] CreateTenantRequest req) { if (string.IsNullOrWhiteSpace(req.Id) || string.IsNullOrWhiteSpace(req.Name)) { return BadRequest(new { success = false, message = "学校代码与名称不能为空" }); } try { var tenant = await _securityService.CreateTenantAsync(req.Id.Trim(), req.Name.Trim(), GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(tenant); } catch (InvalidOperationException ex) { return Conflict(new { success = false, message = ex.Message }); } } /// /// 更新学校信息或停用/启用学校 /// [HttpPatch("tenants/{tenantId}")] public async Task UpdateTenant(string tenantId, [FromBody] UpdateTenantRequest req) { if (string.IsNullOrWhiteSpace(req.Name)) { return BadRequest(new { success = false, message = "学校名称不能为空" }); } var updated = await _securityService.UpdateTenantAsync(tenantId, req.Name.Trim(), req.IsActive, GetActorUsername(), GetActorRole(), GetClientIp()); if (updated == null) { return NotFound(new { success = false, message = "未找到指定学校" }); } return Ok(updated); } /// /// 获取平台用户列表 (支持按租户和角色筛选) /// [HttpGet("users")] public async Task GetUsers([FromQuery] string? tenantId, [FromQuery] string? role) { var users = await _securityService.GetAllUsersAdminAsync(tenantId, role); return Ok(users); } /// /// 创建新用户 (严格执行角色白名单校验: 仅限 SchoolAdmin 或 Teacher) /// [HttpPost("users")] public async Task CreateUser([FromBody] CreateUserAdminRequest req) { if (string.IsNullOrWhiteSpace(req.Username) || string.IsNullOrWhiteSpace(req.Password)) { return BadRequest(new { success = false, message = "用户名与密码不能为空" }); } if (req.Password.Length < 8) { return BadRequest(new { success = false, message = "用户密码长度不得小于 8 个字符" }); } if (string.IsNullOrWhiteSpace(req.TenantId)) { return BadRequest(new { success = false, message = "必须指定归属学校" }); } if (req.Role != "SchoolAdmin" && req.Role != "Teacher") { return BadRequest(new { success = false, message = "只允许创建校区管理员 (SchoolAdmin) 或教师账号 (Teacher)" }); } try { var user = await _securityService.CreateUserAdminAsync(req, GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(user); } catch (InvalidOperationException ex) { return Conflict(new { success = false, message = ex.Message }); } } /// /// 管理员重置指定用户密码 /// [HttpPost("users/{userId}/reset-password")] public async Task ResetPassword(string userId, [FromBody] ResetPasswordRequest req) { if (string.IsNullOrWhiteSpace(req.NewPassword)) { return BadRequest(new { success = false, message = "新密码不能为空" }); } if (req.NewPassword.Length < 8) { return BadRequest(new { success = false, message = "新密码长度不得小于 8 个字符" }); } var ok = await _securityService.ResetPasswordAsync(userId, req.NewPassword, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在" }); } return Ok(new { success = true, message = "密码已成功重置" }); } /// /// 锁定或解锁用户账号 /// [HttpPost("users/{userId}/lock")] public async Task SetUserLock(string userId, [FromBody] LockUserRequest req) { var ok = await _securityService.SetUserLockAsync(userId, req.IsLocked, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在" }); } var detail = req.IsLocked ? "锁定账号 (禁止登录)" : "解锁账号 (恢复登录)"; return Ok(new { success = true, isLocked = req.IsLocked, message = detail }); } /// /// 删除指定用户 /// [HttpDelete("users/{userId}")] public async Task DeleteUser(string userId) { var ok = await _securityService.DeleteUserAsync(userId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "用户不存在或无法删除" }); } return Ok(new { success = true, message = "用户已删除" }); } /// /// 获取全网所有设备及其在线状态、心跳、版本 /// [HttpGet("devices")] public async Task GetDevices() { var devices = await _securityService.GetAllDevicesAsync(); return Ok(devices); } /// /// 更新设备信息 (主机名/重命名、绑定班级) /// [HttpPatch("devices/{deviceId}")] public async Task UpdateDevice(string deviceId, [FromBody] UpdateDeviceRequest req) { try { var ok = await _securityService.UpdateDeviceAsync(deviceId, req.Hostname, req.ClassroomId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "设备不存在" }); } return Ok(new { success = true, message = "设备信息已更新" }); } catch (InvalidOperationException ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 清退并注销指定设备 /// [HttpPost("devices/{deviceId}/decommission")] public async Task DecommissionDevice(string deviceId) { var ok = await _securityService.DecommissionDeviceAsync(deviceId, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "设备不存在" }); } return Ok(new { success = true, message = "设备已注销并清退" }); } /// /// 向指定设备下发远程维护指令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// [HttpPost("devices/{deviceId}/command")] public async Task SendDeviceCommand(string deviceId, [FromBody] RemoteCommandRequestDto req) { if (string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(req.Command)) { return BadRequest(new { success = false, message = "设备编号与指令内容不可为空" }); } try { var adminUser = GetActorUsername(); var cmdType = req.Command; if (cmdType.Equals("ping", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.SelfCheck; else if (cmdType.Equals("restart_client", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.RestartClient; else if (cmdType.Equals("refresh_config", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.RefreshConfig; else if (cmdType.Equals("reconnect", StringComparison.OrdinalIgnoreCase)) cmdType = DeviceCommandTypes.Reconnect; if (!DeviceCommandTypes.IsSupported(cmdType)) { return BadRequest(new { success = false, message = $"不支持的指令类型: '{req.Command}'。允许指令: {string.Join(", ", DeviceCommandTypes.AllSupported)}" }); } var cmdDto = await _securityService.CreateDeviceCommandAsync(null, deviceId, cmdType, req.Parameters, adminUser, GetActorRole(), GetClientIp()); var connId = _securityService.GetDeviceConnectionId(deviceId); if (!string.IsNullOrEmpty(connId)) { await _deviceHub.Clients.Client(connId).ReceiveRemoteCommand(cmdDto); await _securityService.MarkCommandDispatchedAsync(cmdDto.CommandId); cmdDto.Status = DeviceCommandStatuses.Dispatched; _logger.LogInformation("Admin dispatched remote command {CommandId} ('{Command}') to device {DeviceId} ({ConnId})", cmdDto.CommandId, cmdDto.CommandType, deviceId, connId); await _securityService.LogAdminAuditAsync( adminUser, GetActorRole(), "REMOTE_COMMAND_DISPATCHED", "Device", deviceId, $"指令已实时通过 SignalR 下发: {cmdDto.CommandType} (CommandId: {cmdDto.CommandId})", GetClientIp()); } else { _logger.LogInformation("Device {DeviceId} is offline. Remote command {CommandId} queued as Pending (expires at {ExpiresAt})", deviceId, cmdDto.CommandId, cmdDto.ExpiresAt); await _securityService.LogAdminAuditAsync( adminUser, GetActorRole(), "REMOTE_COMMAND_QUEUED", "Device", deviceId, $"设备离线,指令已入队待补发: {cmdDto.CommandType} (CommandId: {cmdDto.CommandId})", GetClientIp()); } return Ok(new { success = true, commandId = cmdDto.CommandId, deviceId, command = cmdDto.CommandType, status = cmdDto.Status, expiresAt = cmdDto.ExpiresAt, message = string.IsNullOrEmpty(connId) ? $"设备当前离线,指令 [{cmdDto.CommandType}] 已入队,将在设备上线时自动补发 (有效期至 {cmdDto.ExpiresAt:u})" : $"远程指令 [{cmdDto.CommandType}] 已通过 SignalR 实时下发至设备" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (InvalidOperationException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 获取指定学校的所有班级列表 (供管理端激活码生成等下拉选择) /// [HttpGet("classes")] public async Task GetClasses([FromQuery] string tenantId) { if (string.IsNullOrWhiteSpace(tenantId)) { return BadRequest(new { success = false, message = "租户代码不可为空" }); } var classes = await _securityService.GetClassroomsAsync(tenantId.Trim()); return Ok(classes); } /// /// 获取全网激活码列表 /// [HttpGet("activation-codes")] public async Task GetActivationCodes() { var codes = await _securityService.GetActivationCodesAsync(null); return Ok(codes); } /// /// 超级管理员直接生成指定学校指定班级的激活码 /// [HttpPost("activation-codes")] public async Task GenerateActivationCode([FromQuery] string tenantId, [FromQuery] string classId) { if (string.IsNullOrWhiteSpace(tenantId) || string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "租户与班级不可为空" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId, GetActorUsername(), GetActorRole(), GetClientIp()); return Ok(new { success = true, code, tenantId, classId, message = "激活码生成成功" }); } catch (InvalidOperationException ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 作废或删除激活码 /// [HttpDelete("activation-codes/{code}")] public async Task DeleteActivationCode(string code) { var ok = await _securityService.DeleteActivationCodeAsync(code, GetActorUsername(), GetActorRole(), GetClientIp()); if (!ok) { return NotFound(new { success = false, message = "激活码不存在" }); } return Ok(new { success = true, message = "激活码已成功作废" }); } /// /// 获取全平台最新通知历史记录与 ACK /// [HttpGet("notifications")] public async Task GetNotifications([FromQuery] int limit = 50) { var list = await _securityService.GetNotificationsAsync(null, null, limit); return Ok(list); } /// /// 超级管理员跨租户/全网紧急广播下发 /// [HttpPost("broadcasts")] public async Task EmergencyBroadcast([FromBody] EmergencyBroadcastRequest req) { if (string.IsNullOrWhiteSpace(req.Message)) { return BadRequest(new { success = false, message = "广播内容不能为空" }); } if (req.Message.Length > 2000) { return BadRequest(new { success = false, message = "广播内容长度不能超过 2000 字符" }); } if (!string.IsNullOrWhiteSpace(req.Title) && req.Title.Length > 100) { return BadRequest(new { success = false, message = "广播标题长度不能超过 100 字符" }); } if (req.DurationSeconds < 5 || req.DurationSeconds > 600) { return BadRequest(new { success = false, message = "广播显示时长必须在 5 至 600 秒之间" }); } var actor = GetActorUsername(); var targetTenants = new List(); if (string.IsNullOrWhiteSpace(req.TenantId) || req.TenantId == "*") { var all = await _securityService.GetTenantsOverviewAsync(); targetTenants = all.Where(t => t.IsActive).ToList(); } else { var all = await _securityService.GetTenantsOverviewAsync(); var found = all.FirstOrDefault(t => t.Id == req.TenantId); if (found != null) { if (!found.IsActive) { return BadRequest(new { success = false, message = $"目标学校 '{found.Name}' 当前已被停用,无法接收应急广播" }); } targetTenants.Add(found); } else return NotFound(new { success = false, message = $"未找到指定学校: {req.TenantId}" }); } // P0-FailClosed Audit: Persist BROADCAST_REQUESTED audit BEFORE triggering any SignalR broadcast. // If audit write fails (e.g. DB error or trigger block), an exception is thrown and NO broadcast is ever dispatched. await _securityService.LogAdminAuditAsync( actor, GetActorRole(), "EMERGENCY_BROADCAST_REQUESTED", "System", req.TenantId ?? "ALL", $"请求下发紧急广播: {req.Title} (计划覆盖 {targetTenants.Count} 所学校)", GetClientIp()); var broadcastId = $"bcast_{Guid.NewGuid():N}"; int dispatchedCount = 0; var duration = req.DurationSeconds; foreach (var tenant in targetTenants) { var classrooms = await _securityService.GetClassroomsAsync(tenant.Id); foreach (var cls in classrooms) { var notif = new NotificationDto { Id = $"msg_emerg_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}_{Guid.NewGuid().ToString("N")[..4]}", BroadcastId = broadcastId, TenantId = tenant.Id, ClassId = cls.Id, Title = string.IsNullOrWhiteSpace(req.Title) ? "⚠️ 全校紧急通知" : req.Title, Message = req.Message, Type = NotificationType.Urgent, CreatedAt = DateTimeOffset.UtcNow, ExpiresAt = DateTimeOffset.UtcNow.AddSeconds(duration + 120), DurationSeconds = duration, Voice = req.Voice, Shake = req.Shake }; await _securityService.RecordNotificationAsync(notif, null, "系统超级管理员 (应急广播)"); // Dispatch to SignalR classroom group await _deviceHub.Clients.Group($"t:{tenant.Id}:c:{cls.Id}").ReceiveNotification(notif); // Dispatch to Teacher Hub await _teacherHub.Clients.Group($"t:{tenant.Id}:teachers").OnNewNotificationBroadcast(notif); dispatchedCount++; } } await _securityService.LogAdminAuditAsync( actor, GetActorRole(), "EMERGENCY_BROADCAST_COMPLETED", "System", req.TenantId ?? "ALL", $"紧急广播下发完成: {req.Title} - {req.Message} (覆盖 {dispatchedCount} 个班级, BroadcastId: {broadcastId})", GetClientIp()); return Ok(new { success = true, broadcastId, dispatchedCount, targetSchools = targetTenants.Count, message = $"紧急广播已成功下发至 {targetTenants.Count} 所学校共 {dispatchedCount} 个班级,正在等待设备回执" }); } /// /// 获取紧急广播真实设备回执聚合状态 /// [HttpGet("broadcasts/{broadcastId}/receipt-summary")] public async Task GetBroadcastReceiptSummary(string broadcastId, CancellationToken ct) { var summary = await _securityService.GetBroadcastReceiptSummaryAsync(broadcastId, ct); if (summary == null) { return NotFound(new { success = false, message = "未找到该广播记录" }); } return Ok(summary); } /// /// 获取平台真实系统健康状态 (数据库连通性、延迟、内存、运行时间、连接数) /// [HttpGet("system/health")] public async Task GetSystemHealth() { var health = await _securityService.GetSystemHealthAsync(); return Ok(health); } /// /// 获取超级管理员关键操作审计日志 /// [HttpGet("audit-logs")] public async Task GetAuditLogs([FromQuery] int limit = 100) { var logs = await _securityService.GetAdminAuditLogsAsync(limit); return Ok(logs); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/AuthController.cs SIZE: 1460 chars SHA256: 3B11304893E563B8232AE99DAFE5BE4870CFC11A1F4B6D09EECC02A4B5085C1A ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [EnableRateLimiting("AuthLimiter")] public class AuthController : ControllerBase { private readonly ISecurityService _securityService; public AuthController(ISecurityService securityService) { _securityService = securityService; } /// /// 统一登录接口 (返回包含 Role / TenantId 的 JWT Token) /// [HttpPost("login")] public async Task Login([FromBody] TeacherLoginDto dto) { var remoteIp = HttpContext.Connection.RemoteIpAddress?.ToString(); var result = await _securityService.LoginTeacherAsync(dto, remoteIp); if (!result.Success) { return Unauthorized(result); } return Ok(result); } /// /// 获取当前登录用户画像与角色 /// [HttpGet("me")] [Authorize] public IActionResult GetMe() { return Ok(new { userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value, name = User.FindFirst(ClaimTypes.Name)?.Value, role = User.FindFirst(ClaimTypes.Role)?.Value, tenantId = User.FindFirst("tenant_id")?.Value }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/DeviceCommandController.cs SIZE: 5204 chars SHA256: 71F0D64FD4979D7EEB4A5B7BC51C659393CB23A6FF48CB09B8F9491E619E45B3 ===================================================================== */ using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; public class SendDeviceCommandRequest { public string DeviceId { get; set; } = string.Empty; public string CommandType { get; set; } = string.Empty; public string? Parameters { get; set; } } [ApiController] [Route("api/device-command")] [Authorize] public class DeviceCommandController : ControllerBase { private readonly ISecurityService _securityService; private readonly IHubContext _deviceHub; private readonly ILogger _logger; public DeviceCommandController( ISecurityService securityService, IHubContext deviceHub, ILogger logger) { _securityService = securityService; _deviceHub = deviceHub; _logger = logger; } /// /// 下发受控远程运维命令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// [HttpPost("send")] [Authorize(Roles = "SuperAdmin,SchoolAdmin,Teacher")] public async Task SendCommand([FromBody] SendDeviceCommandRequest req) { if (req == null || string.IsNullOrWhiteSpace(req.DeviceId) || string.IsNullOrWhiteSpace(req.CommandType)) { return BadRequest(new { success = false, message = "设备编号与指令类型不可为空" }); } var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var callerUser = User.Identity?.Name ?? User.FindFirst("name")?.Value ?? "User"; try { var cmdDto = await _securityService.CreateDeviceCommandAsync( tenantId, req.DeviceId, req.CommandType, req.Parameters, callerUser); var connId = _securityService.GetDeviceConnectionId(req.DeviceId); if (!string.IsNullOrEmpty(connId)) { await _deviceHub.Clients.Client(connId).ReceiveRemoteCommand(cmdDto); await _securityService.MarkCommandDispatchedAsync(cmdDto.CommandId); cmdDto.Status = DeviceCommandStatuses.Dispatched; _logger.LogInformation("Dispatched command {CommandId} ({Type}) to device {DeviceId} via SignalR {ConnId}", cmdDto.CommandId, cmdDto.CommandType, req.DeviceId, connId); } else { _logger.LogInformation("Device {DeviceId} is offline. Command {CommandId} queued as Pending until {ExpiresAt:u}", req.DeviceId, cmdDto.CommandId, cmdDto.ExpiresAt); } return Ok(new { success = true, command = cmdDto, isDispatched = !string.IsNullOrEmpty(connId), message = string.IsNullOrEmpty(connId) ? $"设备当前离线,指令已排队,将在设备上线且未过期时补发 (过期时间: {cmdDto.ExpiresAt:u})" : $"指令已通过 SignalR 实时下发至设备 (过期时间: {cmdDto.ExpiresAt:u})" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(StatusCodes.Status403Forbidden, new { success = false, message = ex.Message }); } catch (InvalidOperationException ex) { return NotFound(new { success = false, message = ex.Message }); } catch (Exception ex) { _logger.LogError(ex, "Unexpected error sending command to device {DeviceId}", req.DeviceId); return StatusCode(500, new { success = false, message = "下发指令内部错误" }); } } /// /// 查询单条命令当前状态与执行结果 /// [HttpGet("{commandId}")] public async Task GetCommand(string commandId) { if (string.IsNullOrWhiteSpace(commandId)) { return BadRequest(new { success = false, message = "CommandId 不可为空" }); } var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var cmd = await _securityService.GetDeviceCommandAsync(commandId, tenantId); if (cmd == null) { return NotFound(new { success = false, message = "命令未找到或无权访问" }); } return Ok(cmd); } /// /// 获取命令审计流水历史记录 /// [HttpGet("history")] public async Task GetHistory( [FromQuery] string? deviceId = null, [FromQuery] string? status = null, [FromQuery] int limit = 50) { var isSuperAdmin = User.IsInRole("SuperAdmin"); var tenantId = isSuperAdmin ? null : User.FindFirst("tenant_id")?.Value; var history = await _securityService.GetDeviceCommandHistoryAsync(tenantId, deviceId, status, limit); return Ok(history); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/DeviceController.cs SIZE: 4164 chars SHA256: 2F5D5BA2DBB53D861406118DB23A21B8680313F8AEA7235C65193B90244E1B78 ===================================================================== */ using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [EnableRateLimiting("ActivationLimiter")] public class DeviceController : ControllerBase { private readonly ISecurityService _securityService; private readonly IVisualReceiptService _visualReceiptService; public DeviceController(ISecurityService securityService, IVisualReceiptService visualReceiptService) { _securityService = securityService; _visualReceiptService = visualReceiptService; } /// /// 教室端初次安装激活接口 (通过一次性激活码换取永久硬件凭据) /// [HttpPost("activate")] public async Task Activate([FromBody] DeviceActivationRequestDto dto) { var result = await _securityService.ActivateDeviceAsync(dto); if (!result.Success) { if (result.ErrorMessage?.Contains("其他设备安装实例") == true) { return Conflict(result); } return BadRequest(result); } return Ok(result); } /// /// 学校教师/管理员在线生成班级一次性设备激活码 /// [HttpPost("generate-code")] [Microsoft.AspNetCore.Authorization.Authorize(Roles = "SuperAdmin,SchoolAdmin")] public async Task GenerateCode([FromQuery] string classId) { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) { return Unauthorized(new { success = false, message = "未发现合法的租户信息" }); } if (string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "班级编号不可为空" }); } var classroom = await _securityService.GetClassroomAsync(tenantId, classId); if (classroom == null) { return NotFound(new { success = false, message = $"班级 {classId} 不存在或不属于当前学校" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId); return Ok(new { success = true, code, tenantId, classId, message = "激活码已生成,有效期 7 天" }); } catch (Exception ex) { return BadRequest(new { success = false, message = ex.Message }); } } /// /// 教室 Windows 客户端上传单帧通知视觉回执 (JPEG 格式, 最大 512KB) /// [HttpPost("notifications/{notificationId}/visual-receipt")] [HttpPost("/api/devices/notifications/{notificationId}/visual-receipt")] [RequestSizeLimit(524288)] // 512 KiB public async Task UploadVisualReceipt(string notificationId) { var deviceId = Request.Headers["X-Device-Id"].FirstOrDefault(); var deviceToken = Request.Headers["X-Device-Token"].FirstOrDefault(); if (string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(deviceToken)) { return Unauthorized(new { success = false, message = "缺少设备鉴权凭据 (X-Device-Id / X-Device-Token)" }); } if (Request.ContentType?.StartsWith("image/jpeg", StringComparison.OrdinalIgnoreCase) != true) { return StatusCode(415, new { success = false, message = "仅支持 image/jpeg 格式内容" }); } using var ms = new MemoryStream(); await Request.Body.CopyToAsync(ms); var bytes = ms.ToArray(); var result = await _visualReceiptService.SaveVisualReceiptAsync(notificationId, deviceId, deviceToken, bytes); if (!result.Success) { return StatusCode(result.StatusCode, new { success = false, message = result.Message }); } return Ok(new { success = true, receiptId = result.ReceiptId, notificationId, visualReceiptState = "Available", capturedAt = result.CapturedAt, expiresAt = result.ExpiresAt, message = result.Message }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/NotificationController.cs SIZE: 9733 chars SHA256: 4776B79CDF8E1B8FF9FA14100C84B71AE4B293727F29C8DD3B087E5940A67D76 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Authorize] [EnableRateLimiting("SendLimiter")] public class NotificationController : ControllerBase { private readonly IHubContext _deviceHubContext; private readonly IHubContext _teacherHubContext; private readonly ISecurityService _securityService; private readonly IVisualReceiptService _visualReceiptService; private readonly ILogger _logger; public NotificationController( IHubContext deviceHubContext, IHubContext teacherHubContext, ISecurityService securityService, IVisualReceiptService visualReceiptService, ILogger logger) { _deviceHubContext = deviceHubContext; _teacherHubContext = teacherHubContext; _securityService = securityService; _visualReceiptService = visualReceiptService; _logger = logger; } /// /// 教师向指定班级下发呼叫通知 (严格校验租户与班级权限) /// [HttpPost("send")] public async Task SendNotification([FromBody] NotificationDto notification) { // 1. Extract and validate tenant from authenticated teacher claims var teacherTenantId = User.FindFirst("tenant_id")?.Value; var teacherName = User.FindFirst(ClaimTypes.Name)?.Value ?? "未知老师"; var teacherId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (string.IsNullOrEmpty(teacherTenantId)) { return Unauthorized(new { success = false, message = "未发现合法的租户信息" }); } if (string.IsNullOrWhiteSpace(notification.ClassId) || string.IsNullOrWhiteSpace(notification.Message)) { return BadRequest(new { success = false, message = "班级编号与通知内容不可为空" }); } // 2. Multi-tenant Scope Validation: Ensure target classroom exists in teacher's tenant! var classroom = await _securityService.GetClassroomAsync(teacherTenantId, notification.ClassId); if (classroom == null) { _logger.LogWarning("Cross-tenant attempt or invalid class: Teacher {TeacherId} (Tenant: {TenantId}) tried to notify Class {ClassId}", teacherId, teacherTenantId, notification.ClassId); return StatusCode(403, new { success = false, message = "无权访问该班级,或班级不属于当前学校" }); } // 3. Stamp metadata & Business TTL Policy notification.Id = $"msg_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}_{Guid.NewGuid().ToString("N")[..4]}"; notification.TenantId = teacherTenantId; notification.CreatedAt = DateTimeOffset.UtcNow; if (notification.ExpiresAt.HasValue) { if (notification.ExpiresAt.Value <= notification.CreatedAt) { return BadRequest(new { success = false, message = "消息过期时间必须在创建时间之后" }); } // Max TTL cap: 7 days var maxExpiresAt = notification.CreatedAt.AddDays(7); if (notification.ExpiresAt.Value > maxExpiresAt) { notification.ExpiresAt = maxExpiresAt; } } else { // Default TTL based on NotificationType urgency notification.ExpiresAt = notification.Type switch { ClassNotify.Shared.Enums.NotificationType.Call => notification.CreatedAt.AddMinutes(10), ClassNotify.Shared.Enums.NotificationType.Notice => notification.CreatedAt.AddMinutes(60), ClassNotify.Shared.Enums.NotificationType.Urgent => notification.CreatedAt.AddHours(24), _ => notification.CreatedAt.AddMinutes(15) }; } await _securityService.RecordNotificationAsync(notification, teacherId, teacherName); _logger.LogInformation("Teacher {TeacherName} ({TenantId}) sending notification to {ClassName} ({ClassId}): {Message}", teacherName, teacherTenantId, classroom.DisplayName, classroom.Id, notification.Message); // 4. Send to tenant-isolated SignalR classroom group var tenantClassGroup = $"t:{teacherTenantId}:c:{notification.ClassId}"; await _deviceHubContext.Clients.Group(tenantClassGroup).ReceiveNotification(notification); // 5. Broadcast only to teachers of THIS tenant var tenantTeacherGroup = $"t:{teacherTenantId}:teachers"; await _teacherHubContext.Clients.Group(tenantTeacherGroup).OnNewNotificationBroadcast(notification); return Ok(new { success = true, messageId = notification.Id, tenantId = teacherTenantId, classId = notification.ClassId, className = classroom.DisplayName, message = "通知已成功下发至教室大屏" }); } /// /// 获取当前教师所在学校的班级列表 /// [HttpGet("classes")] public async Task GetTeacherClasses() { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var classes = await _securityService.GetClassroomsAsync(tenantId); return Ok(classes); } /// /// 获取当前教师所在学校的历史通知记录与回执 /// [HttpGet("history")] public async Task GetNotificationHistory([FromQuery] string? classId, [FromQuery] int limit = 50) { var tenantId = User.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var list = await _securityService.GetNotificationsAsync(tenantId, classId, limit); return Ok(list); } /// /// 查看指定通知在指定教室设备的视觉回执现场画面 (受权限保护的短效 JPEG) /// [HttpGet("{notificationId}/receipts/{deviceId}/visual-receipt")] [HttpGet("/api/notifications/{notificationId}/receipts/{deviceId}/visual-receipt")] public async Task GetVisualReceipt(string notificationId, string deviceId) { var result = await _visualReceiptService.GetVisualReceiptFileAsync(notificationId, deviceId, User); if (!result.Success) { return StatusCode(result.StatusCode, new { success = false, message = result.ErrorMessage }); } Response.Headers["Cache-Control"] = "private, no-store, max-age=0"; Response.Headers["Pragma"] = "no-cache"; Response.Headers["X-Content-Type-Options"] = "nosniff"; return PhysicalFile(result.FilePath!, "image/jpeg"); } /// /// 撤回/提前关闭正在显示的通知 /// [HttpPost("{id}/cancel")] [HttpPost("/api/notifications/{id}/cancel")] public async Task CancelNotification(string id, CancellationToken ct) { var tenantId = User.FindFirst("tenant_id")?.Value; var userName = User.FindFirst(ClaimTypes.Name)?.Value ?? "未知操作者"; var userRole = User.FindFirst(ClaimTypes.Role)?.Value ?? "Teacher"; var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); CancelNotificationResult result; try { result = await _securityService.CancelNotificationAsync( id, userId, userName, userRole, tenantId, ip, ct); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } bool devicePushOk = true; bool teacherPushOk = true; if (!string.IsNullOrEmpty(result.ClassroomId)) { try { var tenantClassGroup = $"t:{result.TenantId}:c:{result.ClassroomId}"; await _deviceHubContext.Clients.Group(tenantClassGroup).CancelNotification(id); } catch (Exception ex) { devicePushOk = false; _logger.LogError(ex, "Failed to broadcast CancelNotification to device group for {NotificationId}", id); } } try { var tenantTeacherGroup = $"t:{result.TenantId}:teachers"; await _teacherHubContext.Clients.Group(tenantTeacherGroup).OnNotificationCancelled(id); } catch (Exception ex) { teacherPushOk = false; _logger.LogError(ex, "Failed to broadcast OnNotificationCancelled to teacher group for {NotificationId}", id); } return Ok(new { success = true, notificationId = id, alreadyCancelled = result.AlreadyCancelled, cancelledAt = result.CancelledAt, realtimeDeviceCloseSent = devicePushOk, realtimeTeacherUpdateSent = teacherPushOk, message = result.AlreadyCancelled ? "通知此前已被撤回" : devicePushOk ? "通知已成功撤回并请求大屏立即关闭" : "通知已撤回;实时关闭信令部分失败,但该通知不会再次补发" }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Controllers/SchoolAdminController.cs SIZE: 9359 chars SHA256: F3CD1C6506E2B00D62D8D81C215565E12AE018A89813BD7D2E01032EF5A52FC9 ===================================================================== */ using System.Security.Claims; using ClassNotify.Server.Services; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace ClassNotify.Server.Controllers; [ApiController] [Route("api/[controller]")] [Route("api/school-admin")] [Authorize(Roles = "SchoolAdmin,SuperAdmin")] public class SchoolAdminController : ControllerBase { private readonly ISecurityService _securityService; private readonly ILogger _logger; public SchoolAdminController(ISecurityService securityService, ILogger logger) { _securityService = securityService; _logger = logger; } private string? GetTenantId() { // If SuperAdmin, can specify tenant_id via query or header, otherwise use claim var claimTenant = User.FindFirst("tenant_id")?.Value; if (claimTenant == "global" && Request.Query.ContainsKey("tenant_id")) { return Request.Query["tenant_id"].ToString(); } return claimTenant; } /// /// 获取本校基础统计 /// [HttpGet("overview")] public async Task GetOverview() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var tenant = await _securityService.GetTenantAsync(tenantId); var classes = await _securityService.GetClassroomsAsync(tenantId); var devices = await _securityService.GetTenantDevicesAsync(tenantId); var teachers = await _securityService.GetUsersAsync(tenantId); return Ok(new { tenantId, tenantName = tenant?.Name ?? tenantId, classCount = classes.Count, deviceCount = devices.Count, onlineCount = devices.Count(d => d.IsOnline), teacherCount = teachers.Count }); } /// /// 获取本校所有班级 /// [HttpGet("classes")] public async Task GetClasses() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var classes = await _securityService.GetClassroomsAsync(tenantId); return Ok(classes); } /// /// 为本校新增班级 /// [HttpPost("classes")] public async Task CreateClass([FromBody] CreateClassroomDto dto) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(dto.Id) || string.IsNullOrWhiteSpace(dto.DisplayName)) { return BadRequest(new { success = false, message = "班级编号与班级名称不可为空" }); } var ok = await _securityService.CreateClassroomAsync(tenantId, dto); if (!ok) { return BadRequest(new { success = false, message = $"班级编号 {dto.Id} 已存在" }); } return Ok(new { success = true, message = "班级创建成功" }); } /// /// 获取本校所有教师与管理员账号 /// [HttpGet("teachers")] public async Task GetTeachers() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var users = await _securityService.GetUsersAsync(tenantId); var result = users.Select(u => new { u.Id, u.Username, u.FullName, u.Role, u.IsLocked, u.CreatedAt, u.LastLoginAt }); return Ok(result); } /// /// 学校管理员为本校教师重置密码 /// [HttpPost("teachers/{userId}/reset-password")] public async Task ResetTeacherPassword(string userId, [FromBody] ResetPasswordRequest req) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(req.NewPassword) || req.NewPassword.Length < 8) { return BadRequest(new { success = false, message = "新密码长度不得小于 8 个字符" }); } var actor = User.FindFirst(ClaimTypes.Name)?.Value ?? "SchoolAdmin"; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); try { await _securityService.ResetSchoolTeacherPasswordAsync(tenantId, userId, req.NewPassword, actor, ip); return Ok(new { success = true, message = "教师密码已成功重置,历史登录会话已失效" }); } catch (ArgumentException ex) { return BadRequest(new { success = false, message = ex.Message }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 学校管理员停用或启用本校教师账号 /// [HttpPost("teachers/{userId}/lock")] public async Task SetTeacherLock(string userId, [FromBody] LockUserRequest req) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var actor = User.FindFirst(ClaimTypes.Name)?.Value ?? "SchoolAdmin"; var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); try { var changed = await _securityService.SetSchoolTeacherLockAsync(tenantId, userId, req.IsLocked, actor, ip); return Ok(new { success = true, changed, isLocked = req.IsLocked, message = changed ? (req.IsLocked ? "教师账号已停用并强制下线" : "教师账号已恢复启用") : "账号已处于目标状态" }); } catch (UnauthorizedAccessException ex) { return StatusCode(403, new { success = false, message = ex.Message }); } catch (KeyNotFoundException ex) { return NotFound(new { success = false, message = ex.Message }); } } /// /// 为本校创建教师账号 /// [HttpPost("teachers")] public async Task CreateTeacher([FromBody] CreateTeacherDto dto) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(dto.Username) || string.IsNullOrWhiteSpace(dto.Password) || string.IsNullOrWhiteSpace(dto.FullName)) { return BadRequest(new { success = false, message = "账号、密码和姓名不可为空" }); } // P0-02: Prevent privilege escalation. // SchoolAdmin can only create Teacher accounts. // SuperAdmin can create SchoolAdmin or Teacher, but never SuperAdmin here. if (!User.IsInRole("SuperAdmin")) { dto.Role = "Teacher"; } else { if (dto.Role == "SuperAdmin") { return BadRequest(new { success = false, message = "禁止通过此接口创建平台超级管理员账号" }); } if (string.IsNullOrWhiteSpace(dto.Role)) { dto.Role = "Teacher"; } } var ok = await _securityService.CreateUserAsync(tenantId, dto); if (!ok) { return BadRequest(new { success = false, message = $"用户名 {dto.Username} 已存在" }); } return Ok(new { success = true, message = "教师账号创建成功" }); } /// /// 获取本校所有设备 /// [HttpGet("devices")] public async Task GetDevices() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var devices = await _securityService.GetTenantDevicesAsync(tenantId); return Ok(devices); } /// /// 获取本校激活码 /// [HttpGet("activation-codes")] public async Task GetActivationCodes() { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); var codes = await _securityService.GetActivationCodesAsync(tenantId); return Ok(codes); } /// /// 本校管理员生成班级激活码 /// [HttpPost("activation-codes")] public async Task GenerateActivationCode([FromQuery] string classId) { var tenantId = GetTenantId(); if (string.IsNullOrEmpty(tenantId)) return Unauthorized(); if (string.IsNullOrWhiteSpace(classId)) { return BadRequest(new { success = false, message = "班级编号不可为空" }); } var classroom = await _securityService.GetClassroomAsync(tenantId, classId); if (classroom == null) { return NotFound(new { success = false, message = $"班级 {classId} 不存在或不属于该学校" }); } try { var code = await _securityService.GenerateActivationCodeAsync(tenantId, classId); return Ok(new { success = true, code, tenantId, classId, message = "激活码生成成功" }); } catch (Exception ex) { return BadRequest(new { success = false, message = ex.Message }); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/ClassNotifyDbContext.cs SIZE: 9036 chars SHA256: D1E4022F664EE439A42AA256751754B1CE1E084A836D6FB6EE3A7DE9FD68823E ===================================================================== */ using ClassNotify.Server.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public class ClassNotifyDbContext : DbContext { public ClassNotifyDbContext(DbContextOptions options) : base(options) { } public DbSet Tenants => Set(); public DbSet Classrooms => Set(); public DbSet Users => Set(); public DbSet Devices => Set(); public DbSet DeviceCredentials => Set(); public DbSet ActivationCodes => Set(); public DbSet Notifications => Set(); public DbSet NotificationReceipts => Set(); public DbSet MigrationMarkers => Set(); public DbSet DeviceCommands => Set(); public DbSet AdminAuditEvents => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // 1. Tenant modelBuilder.Entity(entity => { entity.HasKey(t => t.Id); entity.Property(t => t.Name).IsRequired().HasMaxLength(200); }); // 2. Classroom (Composite key for multi-tenant isolation) modelBuilder.Entity(entity => { entity.HasKey(c => new { c.TenantId, c.Id }); entity.Property(c => c.DisplayName).IsRequired().HasMaxLength(100); entity.Property(c => c.Grade).HasMaxLength(50); entity.Property(c => c.RoomNumber).HasMaxLength(50); entity.HasOne(c => c.Tenant) .WithMany(t => t.Classrooms) .HasForeignKey(c => c.TenantId) .OnDelete(DeleteBehavior.Cascade); entity.HasIndex(c => new { c.TenantId, c.Id }); }); // 3. User modelBuilder.Entity(entity => { entity.HasKey(u => u.Id); entity.Property(u => u.Username).IsRequired().HasMaxLength(100); entity.Property(u => u.PasswordHash).IsRequired(); entity.Property(u => u.FullName).IsRequired().HasMaxLength(100); entity.Property(u => u.Role).IsRequired().HasMaxLength(50); entity.HasIndex(u => u.Username).IsUnique(); entity.HasIndex(u => u.TenantId); entity.HasOne(u => u.Tenant) .WithMany(t => t.Users) .HasForeignKey(u => u.TenantId) .OnDelete(DeleteBehavior.Restrict); }); // 4. Device modelBuilder.Entity(entity => { entity.HasKey(d => d.Id); entity.Property(d => d.DeviceTokenHash).IsRequired(); entity.Property(d => d.InstallationId).HasMaxLength(100); entity.Property(d => d.Hostname).HasMaxLength(200); entity.HasIndex(d => d.Id).IsUnique(); entity.HasIndex(d => d.InstallationId).IsUnique().HasFilter("\"InstallationId\" IS NOT NULL"); entity.HasIndex(d => new { d.TenantId, d.ClassroomId }); entity.HasIndex(d => d.TenantId); entity.HasOne(d => d.Tenant) .WithMany(t => t.Devices) .HasForeignKey(d => d.TenantId) .OnDelete(DeleteBehavior.Restrict); entity.HasOne(d => d.Classroom) .WithMany(c => c.Devices) .HasForeignKey(d => new { d.TenantId, d.ClassroomId }) .OnDelete(DeleteBehavior.Restrict); }); // 5. DeviceCredentialRecord modelBuilder.Entity(entity => { entity.HasKey(c => c.DeviceId); entity.Property(c => c.InstallationId).IsRequired().HasMaxLength(100); entity.Property(c => c.DeviceTokenHash).IsRequired(); entity.Property(c => c.EncryptedRecoverableToken).IsRequired(); entity.HasIndex(c => c.DeviceId).IsUnique(); entity.HasIndex(c => c.InstallationId).IsUnique(); }); // 6. ActivationCode modelBuilder.Entity(entity => { entity.HasKey(a => a.Code); entity.Property(a => a.Code).HasMaxLength(50); entity.Property(a => a.ClassroomId).IsRequired().HasMaxLength(50); entity.Property(a => a.InstallationId).HasMaxLength(100); entity.HasIndex(a => a.Code).IsUnique(); entity.HasIndex(a => a.TenantId); entity.HasIndex(a => a.ClassroomId); entity.HasIndex(a => a.InstallationId); entity.HasOne(a => a.Tenant) .WithMany(t => t.ActivationCodes) .HasForeignKey(a => a.TenantId) .OnDelete(DeleteBehavior.Restrict); }); // 7. Notification modelBuilder.Entity(entity => { entity.HasKey(n => n.Id); entity.Property(n => n.Id).HasMaxLength(100); entity.Property(n => n.ClassroomId).IsRequired().HasMaxLength(50); entity.Property(n => n.SenderName).IsRequired().HasMaxLength(100); entity.Property(n => n.Message).IsRequired(); entity.Property(n => n.Title).IsRequired().HasMaxLength(200); entity.Property(n => n.Priority).IsRequired().HasMaxLength(50); entity.HasIndex(n => new { n.TenantId, n.CreatedAt }).IsDescending(false, true); entity.HasIndex(n => new { n.ClassroomId, n.CreatedAt }).IsDescending(false, true); entity.HasIndex(n => new { n.TenantId, n.ClassroomId, n.ExpiresAt }); entity.HasOne(n => n.Tenant) .WithMany(t => t.Notifications) .HasForeignKey(n => n.TenantId) .OnDelete(DeleteBehavior.Cascade); }); // 8. NotificationReceipt (per-device ACK state isolation) modelBuilder.Entity(entity => { entity.HasKey(r => r.Id); entity.Property(r => r.Id).HasMaxLength(100); entity.Property(r => r.NotificationId).IsRequired().HasMaxLength(100); entity.Property(r => r.DeviceId).IsRequired().HasMaxLength(100); entity.Property(r => r.Status).IsRequired().HasMaxLength(50); entity.Property(r => r.FailureReason).HasMaxLength(500); entity.Property(r => r.VisualReceiptState).IsRequired().HasMaxLength(32).HasDefaultValue("None"); entity.Property(r => r.VisualReceiptPath).HasMaxLength(500); entity.Property(r => r.VisualReceiptSha256).HasMaxLength(64); entity.HasIndex(r => new { r.NotificationId, r.DeviceId }).IsUnique(); entity.HasIndex(r => new { r.DeviceId, r.UpdatedAt }).IsDescending(false, true); entity.HasIndex(r => new { r.DeviceId, r.Status }); entity.HasIndex(r => r.VisualReceiptExpiresAt); entity.HasOne(r => r.Notification) .WithMany(n => n.Receipts) .HasForeignKey(r => r.NotificationId) .OnDelete(DeleteBehavior.Cascade); entity.HasOne(r => r.Device) .WithMany(d => d.Receipts) .HasForeignKey(r => r.DeviceId) .OnDelete(DeleteBehavior.Cascade); }); // 9. MigrationMarker modelBuilder.Entity(entity => { entity.HasKey(m => m.Id); entity.Property(m => m.Id).HasMaxLength(100); }); // 10. DeviceCommand modelBuilder.Entity(entity => { entity.HasKey(c => c.Id); entity.Property(c => c.Id).HasMaxLength(100); entity.Property(c => c.TenantId).IsRequired().HasMaxLength(100); entity.Property(c => c.DeviceId).IsRequired().HasMaxLength(100); entity.Property(c => c.CommandType).IsRequired().HasMaxLength(50); entity.Property(c => c.CreatedBy).IsRequired().HasMaxLength(100); entity.Property(c => c.Status).IsRequired().HasMaxLength(50); entity.Property(c => c.DurationMs); entity.Property(c => c.ResultMessage).HasMaxLength(1000); entity.HasIndex(c => new { c.TenantId, c.DeviceId, c.CreatedAt }).IsDescending(false, false, true); entity.HasIndex(c => new { c.DeviceId, c.Status }); entity.HasIndex(c => new { c.Status, c.ExpiresAt }); entity.HasOne(c => c.Tenant) .WithMany() .HasForeignKey(c => c.TenantId) .OnDelete(DeleteBehavior.Cascade); entity.HasOne(c => c.Device) .WithMany() .HasForeignKey(c => c.DeviceId) .OnDelete(DeleteBehavior.Cascade); }); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/ClassNotifyDbContextFactory.cs SIZE: 874 chars SHA256: 2BE10071544EF5D652C1776174492E92BE79FFDE57B84802F292447B17D7D7E1 ===================================================================== */ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace ClassNotify.Server.Data; public class ClassNotifyDbContextFactory : IDesignTimeDbContextFactory { public ClassNotifyDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder(); // Default local/development connection string for migrations design-time // Note: Real production connection strings are loaded via EnvironmentFile on the VPS var connStr = Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection") ?? "Host=127.0.0.1;Port=5432;Database=classnotify;Username=classnotify;Password=CHANGEME_DEV;"; optionsBuilder.UseNpgsql(connStr); return new ClassNotifyDbContext(optionsBuilder.Options); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/DbInitializer.cs SIZE: 5297 chars SHA256: 3CEB6AA53B59A906CA47669BFF68AB1801F5629CBF34B14466BF6F68F80E2E2D ===================================================================== */ using System.Security.Cryptography; using System.Text; using ClassNotify.Server.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public static class DbInitializer { public static async Task InitializeAsync(ClassNotifyDbContext dbContext, IHostEnvironment env, IConfiguration config, ILogger logger) { // 1. Always ensure 'global' tenant exists for SuperAdmin users if (!await dbContext.Tenants.AnyAsync(t => t.Id == "global")) { dbContext.Tenants.Add(new Tenant { Id = "global", Name = "全局平台管理", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } // 2. HARD PRODUCTION SEED GUARD: // In Production environment, NEVER allow development seeding under any circumstances, // even if SeedDevelopmentData is erroneously set to true in configuration. if (env.IsProduction()) { if (config.GetValue("SeedDevelopmentData")) { logger.LogWarning("SECURITY ALERT: SeedDevelopmentData=true was configured in Production environment! Hard guard engaged: development seeding is strictly prohibited in Production."); } logger.LogInformation("Production environment: Development seeding is strictly prohibited. Skipping."); return; } // Only seed sample schools/classes/devices in non-production development environments bool seedDevData = config.GetValue("SeedDevelopmentData") || env.IsDevelopment(); if (!seedDevData) { logger.LogInformation("Skipping development data seeding."); return; } // If tenants other than 'global' already exist, skip development seed if (await dbContext.Tenants.AnyAsync(t => t.Id != "global")) { return; } logger.LogInformation("Seeding initial development tenants, classrooms, users, and activation codes..."); // Development Tenants var t1 = new Tenant { Id = "t_beijing_no4", Name = "北京四中", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; var t2 = new Tenant { Id = "t_shanghai_high", Name = "上海实验学校", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.AddRange(t1, t2); // Development Classrooms var c1 = new Classroom { Id = "cls_801", TenantId = "t_beijing_no4", DisplayName = "八年级(1)班", Grade = "初二", RoomNumber = "综合楼301" }; var c2 = new Classroom { Id = "cls_802", TenantId = "t_beijing_no4", DisplayName = "八年级(2)班", Grade = "初二", RoomNumber = "综合楼302" }; var c3 = new Classroom { Id = "cls_801", TenantId = "t_shanghai_high", DisplayName = "高一(1)班", Grade = "高一", RoomNumber = "实验楼101" }; dbContext.Classrooms.AddRange(c1, c2, c3); // Development Users var hasher = new Microsoft.AspNetCore.Identity.PasswordHasher(); var uSuper = new User { Id = "usr_super", TenantId = "global", Username = "admin", FullName = "超级管理员", Role = "SuperAdmin" }; uSuper.PasswordHash = hasher.HashPassword(uSuper, "admin888"); var uAdminBj = new User { Id = "usr_admin_bj", TenantId = "t_beijing_no4", Username = "admin_bj4", FullName = "北京四中管理员", Role = "SchoolAdmin" }; uAdminBj.PasswordHash = hasher.HashPassword(uAdminBj, "admin123"); var uAdminSh = new User { Id = "usr_admin_sh", TenantId = "t_shanghai_high", Username = "admin_sh", FullName = "上海实验管理员", Role = "SchoolAdmin" }; uAdminSh.PasswordHash = hasher.HashPassword(uAdminSh, "admin123"); var u101 = new User { Id = "usr_101", TenantId = "t_beijing_no4", Username = "teacher_zhang", FullName = "张老师", Role = "Teacher" }; u101.PasswordHash = hasher.HashPassword(u101, "teacher123"); var u201 = new User { Id = "usr_201", TenantId = "t_shanghai_high", Username = "teacher_li", FullName = "李老师", Role = "Teacher" }; u201.PasswordHash = hasher.HashPassword(u201, "teacher123"); dbContext.Users.AddRange(uSuper, uAdminBj, uAdminSh, u101, u201); // Development Activation Codes dbContext.ActivationCodes.AddRange( new ActivationCode { Code = "TEST-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ81-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ82-2026", TenantId = "t_beijing_no4", ClassroomId = "cls_802", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "BJ81-DEMO", TenantId = "t_beijing_no4", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false }, new ActivationCode { Code = "SH01-2026", TenantId = "t_shanghai_high", ClassroomId = "cls_801", ExpiresAt = DateTimeOffset.UtcNow.AddDays(30), IsUsed = false } ); await dbContext.SaveChangesAsync(); logger.LogInformation("Development seed completed successfully."); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/JsonMigrationService.cs SIZE: 14495 chars SHA256: 5094565BB6FCD1D33B83469E72A8C6627BA7FBE5A391B22A1BBDAD8B2962F0C3 ===================================================================== */ using System.Text.Json; using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Models; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Data; public class JsonMigrationResult { public bool Migrated { get; set; } public string? BackupPath { get; set; } public int TenantsCount { get; set; } public int ClassroomsCount { get; set; } public int UsersCount { get; set; } public int DevicesCount { get; set; } public int CredentialsCount { get; set; } public int ActivationCodesCount { get; set; } public int NotificationsCount { get; set; } } public static class JsonMigrationService { public static async Task MigrateAsync(ClassNotifyDbContext dbContext, string? dataDirectory, ILogger logger) { var result = new JsonMigrationResult(); var marker = await dbContext.MigrationMarkers.FindAsync("JsonMigration_v1"); if (marker != null) { logger.LogInformation("JSON migration marker 'JsonMigration_v1' already exists (migrated at {MigratedAt}). Skipping migration.", marker.MigratedAt); return result; } var dataDir = dataDirectory ?? Path.Combine(AppContext.BaseDirectory, "data"); if (!Directory.Exists(dataDir)) { logger.LogInformation("No 'data' directory found at {DataDir}. Skipping JSON migration.", dataDir); return result; } var tenantsFile = Path.Combine(dataDir, "tenants.json"); var classroomsFile = Path.Combine(dataDir, "classrooms.json"); var usersFile = Path.Combine(dataDir, "users.json"); var devicesFile = Path.Combine(dataDir, "devices.json"); var credsFile = Path.Combine(dataDir, "device_credentials.json"); var codesFile = Path.Combine(dataDir, "activation_codes.json"); var notifsFile = Path.Combine(dataDir, "notifications.json"); if (!File.Exists(tenantsFile) && !File.Exists(classroomsFile) && !File.Exists(usersFile) && !File.Exists(devicesFile) && !File.Exists(credsFile) && !File.Exists(codesFile) && !File.Exists(notifsFile)) { logger.LogInformation("No legacy JSON data files found in {DataDir}. Skipping JSON migration.", dataDir); return result; } logger.LogInformation("Starting one-time legacy JSON to PostgreSQL transactional migration from {DataDir}...", dataDir); using var tx = await dbContext.Database.BeginTransactionAsync(); try { // 1. Tenants var tenantDict = new Dictionary(); if (!await dbContext.Tenants.AnyAsync(t => t.Id == "global")) { var globalTenant = new Tenant { Id = "global", Name = "全局平台管理", IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.Add(globalTenant); tenantDict["global"] = globalTenant; } if (File.Exists(tenantsFile)) { var json = await File.ReadAllTextAsync(tenantsFile); var tenants = JsonSerializer.Deserialize>(json) ?? new(); foreach (var t in tenants) { if (!await dbContext.Tenants.AnyAsync(existing => existing.Id == t.Id) && !tenantDict.ContainsKey(t.Id)) { dbContext.Tenants.Add(t); tenantDict[t.Id] = t; result.TenantsCount++; } } await dbContext.SaveChangesAsync(); } // 2. Classrooms if (File.Exists(classroomsFile)) { var json = await File.ReadAllTextAsync(classroomsFile); var classrooms = JsonSerializer.Deserialize>(json) ?? new(); foreach (var c in classrooms) { if (!await dbContext.Classrooms.AnyAsync(existing => existing.TenantId == c.TenantId && existing.Id == c.Id)) { dbContext.Classrooms.Add(c); result.ClassroomsCount++; } } await dbContext.SaveChangesAsync(); } // 3. Users if (File.Exists(usersFile)) { var json = await File.ReadAllTextAsync(usersFile); var users = JsonSerializer.Deserialize>(json) ?? new(); foreach (var u in users) { if (!await dbContext.Users.AnyAsync(existing => existing.Username == u.Username)) { // Ensure tenant exists if (!string.IsNullOrEmpty(u.TenantId) && !await dbContext.Tenants.AnyAsync(t => t.Id == u.TenantId)) { var newTenant = new Tenant { Id = u.TenantId, Name = u.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; dbContext.Tenants.Add(newTenant); await dbContext.SaveChangesAsync(); } dbContext.Users.Add(u); result.UsersCount++; } } await dbContext.SaveChangesAsync(); } // 4. Devices var migratedDevices = new List(); if (File.Exists(devicesFile)) { var json = await File.ReadAllTextAsync(devicesFile); var devices = JsonSerializer.Deserialize>(json) ?? new(); var usedInstallationIds = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var d in devices) { if (!await dbContext.Devices.AnyAsync(existing => existing.Id == d.Id)) { // Ensure tenant and classroom exist if (!await dbContext.Tenants.AnyAsync(t => t.Id == d.TenantId)) { dbContext.Tenants.Add(new Tenant { Id = d.TenantId, Name = d.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } if (!await dbContext.Classrooms.AnyAsync(c => c.TenantId == d.TenantId && c.Id == d.ClassroomId)) { dbContext.Classrooms.Add(new Classroom { TenantId = d.TenantId, Id = d.ClassroomId, DisplayName = d.ClassroomId }); await dbContext.SaveChangesAsync(); } // Handle legacy duplicate InstallationId gracefully if (!string.IsNullOrEmpty(d.InstallationId)) { if (usedInstallationIds.Contains(d.InstallationId) || await dbContext.Devices.AnyAsync(existing => existing.InstallationId == d.InstallationId)) { logger.LogWarning("Legacy duplicate InstallationId {InstId} detected for Device {DeviceId}. Renaming for unique constraint.", d.InstallationId, d.Id); d.InstallationId = $"{d.InstallationId}_dup_{d.Id}"; } usedInstallationIds.Add(d.InstallationId); } dbContext.Devices.Add(d); migratedDevices.Add(d); result.DevicesCount++; } } await dbContext.SaveChangesAsync(); } // 5. Device Credentials if (File.Exists(credsFile)) { var json = await File.ReadAllTextAsync(credsFile); var creds = JsonSerializer.Deserialize>(json) ?? new(); var usedCredInstIds = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var c in creds) { if (!await dbContext.DeviceCredentials.AnyAsync(existing => existing.DeviceId == c.DeviceId)) { if (!string.IsNullOrEmpty(c.InstallationId)) { if (usedCredInstIds.Contains(c.InstallationId) || await dbContext.DeviceCredentials.AnyAsync(existing => existing.InstallationId == c.InstallationId)) { c.InstallationId = $"{c.InstallationId}_dup_{c.DeviceId}"; } usedCredInstIds.Add(c.InstallationId); } dbContext.DeviceCredentials.Add(c); result.CredentialsCount++; } } await dbContext.SaveChangesAsync(); } // 6. Activation Codes if (File.Exists(codesFile)) { var json = await File.ReadAllTextAsync(codesFile); var codes = JsonSerializer.Deserialize>(json) ?? new(); foreach (var a in codes) { if (!await dbContext.ActivationCodes.AnyAsync(existing => existing.Code == a.Code)) { if (!await dbContext.Tenants.AnyAsync(t => t.Id == a.TenantId)) { dbContext.Tenants.Add(new Tenant { Id = a.TenantId, Name = a.TenantId, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }); await dbContext.SaveChangesAsync(); } dbContext.ActivationCodes.Add(a); result.ActivationCodesCount++; } } await dbContext.SaveChangesAsync(); } // 7. Notifications if (File.Exists(notifsFile)) { var json = await File.ReadAllTextAsync(notifsFile); var notifDtos = JsonSerializer.Deserialize>(json) ?? new(); var allDevices = await dbContext.Devices.ToListAsync(); foreach (var n in notifDtos) { if (!await dbContext.Notifications.AnyAsync(existing => existing.Id == n.Id)) { var notifEntity = new Notification { Id = n.Id, TenantId = n.TenantId, ClassroomId = n.ClassId, SenderName = string.IsNullOrWhiteSpace(n.SenderName) ? "系统" : n.SenderName, Message = n.Message, Title = "🔔 老师呼叫", Priority = string.IsNullOrWhiteSpace(n.Priority) ? "Normal" : n.Priority, CreatedAt = n.CreatedAt }; dbContext.Notifications.Add(notifEntity); result.NotificationsCount++; // Associate receipt if device exists in classroom var targetDev = allDevices.FirstOrDefault(d => d.TenantId == n.TenantId && d.ClassroomId == n.ClassId); if (targetDev != null) { var receipt = new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = n.Id, DeviceId = targetDev.Id, Status = string.IsNullOrWhiteSpace(n.Status) ? "Sent" : n.Status, DeviceReceivedAt = n.CreatedAt, DisplayedAt = n.CreatedAt, AcknowledgedAt = n.ConfirmedAt, UpdatedAt = n.ConfirmedAt ?? n.CreatedAt }; dbContext.NotificationReceipts.Add(receipt); } } } await dbContext.SaveChangesAsync(); } // Write Migration Marker var markerRecord = new MigrationMarker { Id = "JsonMigration_v1", MigratedAt = DateTimeOffset.UtcNow, Details = $"Successfully migrated Tenants={result.TenantsCount}, Classrooms={result.ClassroomsCount}, Users={result.UsersCount}, Devices={result.DevicesCount}, Credentials={result.CredentialsCount}, Codes={result.ActivationCodesCount}, Notifications={result.NotificationsCount}." }; dbContext.MigrationMarkers.Add(markerRecord); await dbContext.SaveChangesAsync(); await tx.CommitAsync(); result.Migrated = true; logger.LogInformation("JSON to PostgreSQL transaction committed successfully: {Details}", markerRecord.Details); // Move legacy JSON files to data/json-backup-YYYYMMDD-HHmmss/ var backupDir = Path.Combine(dataDir, $"json-backup-{DateTime.UtcNow:yyyyMMdd-HHmmss}"); Directory.CreateDirectory(backupDir); result.BackupPath = backupDir; string[] jsonFiles = { tenantsFile, classroomsFile, usersFile, devicesFile, credsFile, codesFile, notifsFile }; foreach (var file in jsonFiles) { if (File.Exists(file)) { var dest = Path.Combine(backupDir, Path.GetFileName(file)); File.Move(file, dest, overwrite: true); } } logger.LogInformation("Legacy JSON files safely moved to backup directory: {BackupDir}", backupDir); return result; } catch (Exception ex) { await tx.RollbackAsync(); logger.LogError(ex, "FATAL: JSON to PostgreSQL migration failed. Transaction rolled back, legacy JSON files preserved."); throw; } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260920225928_InitialPostgreSql.cs SIZE: 16966 chars SHA256: 6B86292AF4D316E6FD6E66D06E07D52AA1845A48759D81E47A69DDA3602CF4A6 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class InitialPostgreSql : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DeviceCredentials", columns: table => new { DeviceId = table.Column(type: "text", nullable: false), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceTokenHash = table.Column(type: "text", nullable: false), EncryptedRecoverableToken = table.Column(type: "text", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), RotatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DeviceCredentials", x => x.DeviceId); }); migrationBuilder.CreateTable( name: "MigrationMarkers", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), MigratedAt = table.Column(type: "timestamp with time zone", nullable: false), Details = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_MigrationMarkers", x => x.Id); }); migrationBuilder.CreateTable( name: "Tenants", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), IsActive = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tenants", x => x.Id); }); migrationBuilder.CreateTable( name: "ActivationCodes", columns: table => new { Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), IsUsed = table.Column(type: "boolean", nullable: false), UsedAt = table.Column(type: "timestamp with time zone", nullable: true), UsedByDeviceId = table.Column(type: "text", nullable: true), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ActivationCodes", x => x.Code); table.ForeignKey( name: "FK_ActivationCodes_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Classrooms", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), DisplayName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Grade = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), RoomNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Classrooms", x => new { x.TenantId, x.Id }); table.ForeignKey( name: "FK_Classrooms_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Notifications", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), SenderUserId = table.Column(type: "text", nullable: true), SenderName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Message = table.Column(type: "text", nullable: false), Title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), Priority = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Notifications", x => x.Id); table.ForeignKey( name: "FK_Notifications_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), Username = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), PasswordHash = table.Column(type: "text", nullable: false), FullName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Role = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); table.ForeignKey( name: "FK_Users_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Devices", columns: table => new { Id = table.Column(type: "text", nullable: false), TenantId = table.Column(type: "text", nullable: false), ClassroomId = table.Column(type: "text", nullable: false), DeviceTokenHash = table.Column(type: "text", nullable: false), RawDeviceToken = table.Column(type: "text", nullable: true), InstallationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), Hostname = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), IsActive = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), LastHeartbeatAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Devices", x => x.Id); table.ForeignKey( name: "FK_Devices_Classrooms_TenantId_ClassroomId", columns: x => new { x.TenantId, x.ClassroomId }, principalTable: "Classrooms", principalColumns: new[] { "TenantId", "Id" }, onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Devices_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "NotificationReceipts", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), NotificationId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), DeviceReceivedAt = table.Column(type: "timestamp with time zone", nullable: true), DisplayedAt = table.Column(type: "timestamp with time zone", nullable: true), AcknowledgedAt = table.Column(type: "timestamp with time zone", nullable: true), FailedAt = table.Column(type: "timestamp with time zone", nullable: true), FailureReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_NotificationReceipts", x => x.Id); table.ForeignKey( name: "FK_NotificationReceipts_Devices_DeviceId", column: x => x.DeviceId, principalTable: "Devices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_NotificationReceipts_Notifications_NotificationId", column: x => x.NotificationId, principalTable: "Notifications", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_ClassroomId", table: "ActivationCodes", column: "ClassroomId"); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_Code", table: "ActivationCodes", column: "Code", unique: true); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_InstallationId", table: "ActivationCodes", column: "InstallationId"); migrationBuilder.CreateIndex( name: "IX_ActivationCodes_TenantId", table: "ActivationCodes", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Classrooms_TenantId_Id", table: "Classrooms", columns: new[] { "TenantId", "Id" }); migrationBuilder.CreateIndex( name: "IX_DeviceCredentials_DeviceId", table: "DeviceCredentials", column: "DeviceId", unique: true); migrationBuilder.CreateIndex( name: "IX_DeviceCredentials_InstallationId", table: "DeviceCredentials", column: "InstallationId", unique: true); migrationBuilder.CreateIndex( name: "IX_Devices_Id", table: "Devices", column: "Id", unique: true); migrationBuilder.CreateIndex( name: "IX_Devices_InstallationId", table: "Devices", column: "InstallationId", unique: true, filter: "\"InstallationId\" IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_Devices_TenantId", table: "Devices", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Devices_TenantId_ClassroomId", table: "Devices", columns: new[] { "TenantId", "ClassroomId" }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_DeviceId_UpdatedAt", table: "NotificationReceipts", columns: new[] { "DeviceId", "UpdatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_NotificationId_DeviceId", table: "NotificationReceipts", columns: new[] { "NotificationId", "DeviceId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Notifications_ClassroomId_CreatedAt", table: "Notifications", columns: new[] { "ClassroomId", "CreatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_Notifications_TenantId_CreatedAt", table: "Notifications", columns: new[] { "TenantId", "CreatedAt" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_Users_TenantId", table: "Users", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Users_Username", table: "Users", column: "Username", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ActivationCodes"); migrationBuilder.DropTable( name: "DeviceCredentials"); migrationBuilder.DropTable( name: "MigrationMarkers"); migrationBuilder.DropTable( name: "NotificationReceipts"); migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Devices"); migrationBuilder.DropTable( name: "Notifications"); migrationBuilder.DropTable( name: "Classrooms"); migrationBuilder.DropTable( name: "Tenants"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260920225928_InitialPostgreSql.Designer.cs SIZE: 18154 chars SHA256: 5F471E0B59753E2DC1EA0658AA66928AEDB93E00C29B5534DDF13219B261A9AD ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260920225928_InitialPostgreSql")] partial class InitialPostgreSql { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("Id") .IsUnique(); b.HasIndex("InstallationId") .IsUnique() .HasFilter("\"InstallationId\" IS NOT NULL"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredentialRecord", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("DeviceId") .IsUnique(); b.HasIndex("InstallationId") .IsUnique(); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922000000_AddNotificationExpiresAtAndPendingIndex.cs SIZE: 2830 chars SHA256: 6E8631EC9A2EB772CA38EF8729A30337BB2E6D4DB64E1E4C7AE241796FA13AA2 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddNotificationExpiresAtAndPendingIndex : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ExpiresAt", table: "Notifications", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "Voice", table: "Notifications", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "Shake", table: "Notifications", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "DurationSeconds", table: "Notifications", type: "integer", nullable: false, defaultValue: 15); migrationBuilder.CreateIndex( name: "IX_Notifications_TenantId_ClassroomId_ExpiresAt", table: "Notifications", columns: new[] { "TenantId", "ClassroomId", "ExpiresAt" }); migrationBuilder.CreateIndex( name: "IX_NotificationReceipts_DeviceId_Status", table: "NotificationReceipts", columns: new[] { "DeviceId", "Status" }); // P1 Batch 9: Backfill legacy notifications where ExpiresAt IS NULL to CreatedAt (marking them expired) migrationBuilder.Sql("UPDATE \"Notifications\" SET \"ExpiresAt\" = \"CreatedAt\" WHERE \"ExpiresAt\" IS NULL;"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_NotificationReceipts_DeviceId_Status", table: "NotificationReceipts"); migrationBuilder.DropIndex( name: "IX_Notifications_TenantId_ClassroomId_ExpiresAt", table: "Notifications"); migrationBuilder.DropColumn( name: "DurationSeconds", table: "Notifications"); migrationBuilder.DropColumn( name: "Shake", table: "Notifications"); migrationBuilder.DropColumn( name: "Voice", table: "Notifications"); migrationBuilder.DropColumn( name: "ExpiresAt", table: "Notifications"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922000000_AddNotificationExpiresAtAndPendingIndex.Designer.cs SIZE: 18273 chars SHA256: 5E983634C9ABC1D5BBBD8573EC78B2DD2735AE942CFA641CCF5CC4E3D3C0BAB4 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922000000_AddNotificationExpiresAtAndPendingIndex")] partial class AddNotificationExpiresAtAndPendingIndex { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("Id") .IsUnique(); b.HasIndex("InstallationId") .IsUnique() .HasFilter("\"InstallationId\" IS NOT NULL"); b.HasIndex("TenantId"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredentialRecord", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("DeviceId") .IsUnique(); b.HasIndex("InstallationId") .IsUnique(); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922120000_AddDeviceCommandsTable.cs SIZE: 3612 chars SHA256: 9CBA69DCB618D010A536ABDE04CF5F7A57A4E78D92650ECB1CF5E72A32A80569 ===================================================================== */ using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddDeviceCommandsTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DeviceCommands", columns: table => new { Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), TenantId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DeviceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), CommandType = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Parameters = table.Column(type: "text", nullable: true), CreatedBy = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: true), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), ResultCode = table.Column(type: "integer", nullable: true), ResultMessage = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_DeviceCommands", x => x.Id); table.ForeignKey( name: "FK_DeviceCommands_Devices_DeviceId", column: x => x.DeviceId, principalTable: "Devices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DeviceCommands_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_DeviceId_Status", table: "DeviceCommands", columns: new[] { "DeviceId", "Status" }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_Status_ExpiresAt", table: "DeviceCommands", columns: new[] { "Status", "ExpiresAt" }); migrationBuilder.CreateIndex( name: "IX_DeviceCommands_TenantId_DeviceId_CreatedAt", table: "DeviceCommands", columns: new[] { "TenantId", "DeviceId", "CreatedAt" }, descending: new[] { false, false, true }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DeviceCommands"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922120000_AddDeviceCommandsTable.Designer.cs SIZE: 21209 chars SHA256: 2C2A7E2F82D8CEDFC2A527AF88D17B3602252C0787786E0E64BB0C9B3D6EFCA6 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922120000_AddDeviceCommandsTable")] partial class AddDeviceCommandsTable { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("InstallationId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.cs SIZE: 760 chars SHA256: C99935F743ACF18D16B28ED88687FE9D339693F50BE553EC7BF4B11C0DBF67FC ===================================================================== */ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClassNotify.Server.Data.Migrations { /// public partial class AddDeviceCommandDurationMs : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "DurationMs", table: "DeviceCommands", type: "bigint", nullable: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "DurationMs", table: "DeviceCommands"); } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.Designer.cs SIZE: 22590 chars SHA256: 118F61890CE5578A02B9E83E07930ED96FB030B4C4705C093D1776CA5C5CABBB ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] [Migration("20260922130000_AddDeviceCommandDurationMs")] partial class AddDeviceCommandDurationMs { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("Id") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("TenantId"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CurrentIp") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("DeviceTokenHash") .IsRequired() .HasMaxLength(128) .HasColumnType("character varying(128)"); b.Property("Hostname") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("LastHeartbeat") .HasColumnType("timestamp with time zone"); b.Property("OnlineState") .IsRequired() .HasMaxLength(20) .HasColumnType("character varying(20)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("ClassroomId"); b.HasIndex("DeviceTokenHash") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DurationMs") .HasColumnType("bigint"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("EncryptedToken") .IsRequired() .HasColumnType("text"); b.Property("LastRotatedAt") .HasColumnType("timestamp with time zone"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("DeviceId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("character varying(100)"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.RateLimitAuditLog", b => { b.Property("Id") .HasColumnType("text"); b.Property("Action") .IsRequired() .HasColumnType("text"); b.Property("ClientIp") .IsRequired() .HasColumnType("text"); b.Property("Endpoint") .IsRequired() .HasColumnType("text"); b.Property("Reason") .IsRequired() .HasColumnType("text"); b.Property("TenantId") .HasColumnType("text"); b.Property("Timestamp") .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("text"); b.HasKey("Id"); b.ToTable("RateLimitAuditLogs"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Plan") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("FullName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("PasswordHash") .IsRequired() .HasMaxLength(256) .HasColumnType("character varying(256)"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Username") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("Id"); b.HasIndex("TenantId", "Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", null) .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("ClassroomId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Data/Migrations/ClassNotifyDbContextModelSnapshot.cs SIZE: 21208 chars SHA256: 4E911D269F138304C86D4CE0BFDF19582D2A7560482684F50AF5CEE8756027E3 ===================================================================== */ // using System; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ClassNotify.Server.Data.Migrations { [DbContext(typeof(ClassNotifyDbContext))] public partial class ClassNotifyDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.Property("Code") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.Property("UsedByDeviceId") .HasColumnType("text"); b.HasKey("Code"); b.HasIndex("ClassroomId"); b.HasIndex("Code") .IsUnique(); b.HasIndex("InstallationId"); b.HasIndex("TenantId"); b.ToTable("ActivationCodes"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Property("TenantId") .HasColumnType("text"); b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Grade") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("RoomNumber") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.HasKey("TenantId", "Id"); b.HasIndex("TenantId", "Id"); b.ToTable("Classrooms"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Property("Id") .HasColumnType("text"); b.Property("ClassroomId") .IsRequired() .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("Hostname") .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("InstallationId") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("LastHeartbeatAt") .HasColumnType("timestamp with time zone"); b.Property("RawDeviceToken") .HasColumnType("text"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("TenantId", "ClassroomId"); b.ToTable("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CommandType") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DurationMs") .HasColumnType("bigint"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Parameters") .HasColumnType("text"); b.Property("ResultCode") .HasColumnType("integer"); b.Property("ResultMessage") .HasMaxLength(1000) .HasColumnType("character varying(1000)"); b.Property("StartedAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("DeviceId", "Status"); b.HasIndex("Status", "ExpiresAt"); b.HasIndex("TenantId", "DeviceId", "CreatedAt") .IsDescending(false, false, true); b.ToTable("DeviceCommands"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b => { b.Property("DeviceId") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceTokenHash") .IsRequired() .HasColumnType("text"); b.Property("EncryptedRecoverableToken") .IsRequired() .HasColumnType("text"); b.Property("InstallationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("RotatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("DeviceId"); b.HasIndex("InstallationId"); b.ToTable("DeviceCredentials"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Details") .HasColumnType("text"); b.Property("MigratedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.ToTable("MigrationMarkers"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("ClassroomId") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DurationSeconds") .HasColumnType("integer"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("Message") .IsRequired() .HasColumnType("text"); b.Property("Priority") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("SenderName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("SenderUserId") .HasColumnType("text"); b.Property("Shake") .HasColumnType("boolean"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.Property("Voice") .HasColumnType("boolean"); b.HasKey("Id"); b.HasIndex("ClassroomId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "CreatedAt") .IsDescending(false, true); b.HasIndex("TenantId", "ClassroomId", "ExpiresAt"); b.ToTable("Notifications"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("AcknowledgedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("DeviceReceivedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayedAt") .HasColumnType("timestamp with time zone"); b.Property("FailedAt") .HasColumnType("timestamp with time zone"); b.Property("FailureReason") .HasMaxLength(500) .HasColumnType("character varying(500)"); b.Property("NotificationId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("Status") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId", "UpdatedAt") .IsDescending(false, true); b.HasIndex("DeviceId", "Status"); b.HasIndex("NotificationId", "DeviceId") .IsUnique(); b.ToTable("NotificationReceipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Property("Id") .HasColumnType("text"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); b.HasKey("Id"); b.ToTable("Tenants"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.Property("Id") .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); b.Property("Role") .IsRequired() .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("TenantId") .IsRequired() .HasColumnType("text"); b.Property("Username") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)"); b.HasKey("Id"); b.HasIndex("Username") .IsUnique(); b.ToTable("Users"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("ActivationCodes") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Classrooms") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Devices") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom") .WithMany("Devices") .HasForeignKey("TenantId", "ClassroomId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Classroom"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Notifications") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device") .WithMany("Receipts") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification") .WithMany("Receipts") .HasForeignKey("NotificationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("Notification"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b => { b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant") .WithMany("Users") .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Tenant"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b => { b.Navigation("Devices"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b => { b.Navigation("Receipts"); }); modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b => { b.Navigation("ActivationCodes"); b.Navigation("Classrooms"); b.Navigation("Devices"); b.Navigation("Notifications"); b.Navigation("Users"); }); #pragma warning restore 612, 618 } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Domain/Entities/Entities.cs SIZE: 10654 chars SHA256: 7F7CD512D1D21494F0BD9BB3A5059011E5D783504706C259FA9781844939DAD3 ===================================================================== */ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace ClassNotify.Server.Domain.Entities; /// /// 学校/机构租户实体 /// public class Tenant { [Key] public string Id { get; set; } = string.Empty; // e.g. "t_beijing_no4" public string Name { get; set; } = string.Empty; // e.g. "北京四中" public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public ICollection Classrooms { get; set; } = new List(); public ICollection Users { get; set; } = new List(); public ICollection Devices { get; set; } = new List(); public ICollection ActivationCodes { get; set; } = new List(); public ICollection Notifications { get; set; } = new List(); } /// /// 教师/管理员用户实体 /// public class User { [Key] public string Id { get; set; } = string.Empty; // e.g. "usr_1001" public string TenantId { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string PasswordHash { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; [NotMapped] public string DisplayName => FullName; public string Role { get; set; } = "Teacher"; // Teacher, SchoolAdmin, SuperAdmin public bool IsLocked { get; set; } = false; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? LastLoginAt { get; set; } public int TokenVersion { get; set; } = 1; public Tenant? Tenant { get; set; } } /// /// 班级实体 /// public class Classroom { public string Id { get; set; } = string.Empty; // e.g. "cls_801" public string TenantId { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; // e.g. "八年级(1)班" public string? Grade { get; set; } public string? RoomNumber { get; set; } public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public Tenant? Tenant { get; set; } public ICollection Devices { get; set; } = new List(); } /// /// 教室硬件多媒体设备实体 /// public class Device { [Key] public string Id { get; set; } = string.Empty; // e.g. "dev_52f0" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string DeviceTokenHash { get; set; } = string.Empty; public string? RawDeviceToken { get; set; } // Kept only for legacy migration public string? InstallationId { get; set; } // Unique installation instance identifier public string? Hostname { get; set; } public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? LastHeartbeatAt { get; set; } public Tenant? Tenant { get; set; } public Classroom? Classroom { get; set; } public ICollection Receipts { get; set; } = new List(); } /// /// 设备加密凭据恢复记录 (仅用于 InstallationId 幂等恢复,不直接在业务代码暴露明文) /// public class DeviceCredentialRecord { [Key] public string DeviceId { get; set; } = string.Empty; public string InstallationId { get; set; } = string.Empty; public string DeviceTokenHash { get; set; } = string.Empty; public string EncryptedRecoverableToken { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? RotatedAt { get; set; } } /// /// 一次性设备激活码实体 /// public class ActivationCode { [Key] public string Code { get; set; } = string.Empty; // e.g. "H8K4-29DP" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } = DateTimeOffset.UtcNow.AddDays(7); public bool IsUsed { get; set; } public DateTimeOffset? UsedAt { get; set; } public string? UsedByDeviceId { get; set; } public string? InstallationId { get; set; } // Bound to first installation instance public Tenant? Tenant { get; set; } } /// /// 教师/系统下发通知主表 (不存储单一设备 ACK 状态) /// public class Notification { [Key] public string Id { get; set; } = string.Empty; // e.g. "msg_1789944446934_0471" public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string? SenderUserId { get; set; } public string SenderName { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public string Title { get; set; } = "🔔 老师呼叫"; public string Priority { get; set; } = "Normal"; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset? ExpiresAt { get; set; } public bool Voice { get; set; } = true; public bool Shake { get; set; } = true; public int DurationSeconds { get; set; } = 15; public bool IsCancelled { get; set; } = false; public DateTimeOffset? CancelledAt { get; set; } public string? CancelledBy { get; set; } public string? BroadcastId { get; set; } public Tenant? Tenant { get; set; } public ICollection Receipts { get; set; } = new List(); } /// /// 设备通知回执明细表 (按设备独立记录状态与时间线,防止单点覆盖) /// public class NotificationReceipt { [Key] public string Id { get; set; } = string.Empty; // e.g. "rcpt_..." public string NotificationId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; /// /// 回执阶段状态: Sent, DeviceReceived, Displayed, Acknowledged, Failed, Timeout /// public string Status { get; set; } = "Sent"; public DateTimeOffset? DeviceReceivedAt { get; set; } public DateTimeOffset? DisplayedAt { get; set; } public DateTimeOffset? AcknowledgedAt { get; set; } public DateTimeOffset? FailedAt { get; set; } public string? FailureReason { get; set; } /// /// 视觉回执状态: None, Available, Expired /// public string VisualReceiptState { get; set; } = "None"; public string? VisualReceiptPath { get; set; } public DateTimeOffset? VisualReceiptCapturedAt { get; set; } public DateTimeOffset? VisualReceiptExpiresAt { get; set; } public long? VisualReceiptSizeBytes { get; set; } public string? VisualReceiptSha256 { get; set; } public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow; public Notification? Notification { get; set; } public Device? Device { get; set; } } /// /// JSON 数据一次性迁移记录标记 /// public class MigrationMarker { [Key] public string Id { get; set; } = string.Empty; // e.g. "JsonMigration_v1" public DateTimeOffset MigratedAt { get; set; } = DateTimeOffset.UtcNow; public string? Details { get; set; } } /// /// 教室终端受控远程运维命令实体 /// 全链路统一 CommandId (cmd_xxxxx),从创建到最终上报不可篡改 /// public class DeviceCommand { [Key] public string Id { get; set; } = string.Empty; // e.g. "cmd_..." [Required] public string TenantId { get; set; } = string.Empty; [Required] public string DeviceId { get; set; } = string.Empty; [Required] public string CommandType { get; set; } = string.Empty; // "SelfCheck", "RestartClient", "Reconnect", "RefreshConfig" public string? Parameters { get; set; } [Required] public string CreatedBy { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset ExpiresAt { get; set; } public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? CompletedAt { get; set; } [Required] public string Status { get; set; } = "Pending"; // "Pending", "Dispatched", "Succeeded", "Failed", "TimedOut", "Expired" public int? ResultCode { get; set; } public long? DurationMs { get; set; } public string? ResultMessage { get; set; } public Tenant? Tenant { get; set; } public Device? Device { get; set; } } /// /// 全局唯一远程命令超期与超时状态终态化规则 /// 彻底消除各查询路径与后台 Worker 之间的状态竞态 /// public static class DeviceCommandNormalizer { public static bool NormalizeExpiredOrTimedOut(DeviceCommand cmd, DateTimeOffset now) { if (ClassNotify.Shared.Models.DeviceCommandStatuses.IsTerminal(cmd.Status)) { return false; } if (cmd.Status == ClassNotify.Shared.Models.DeviceCommandStatuses.Pending) { if (cmd.ExpiresAt <= now) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.Expired; cmd.CompletedAt = now; cmd.ResultCode = -2; cmd.ResultMessage = "Command pending expired before dispatch or device reconnect."; return true; } } else if (cmd.Status == ClassNotify.Shared.Models.DeviceCommandStatuses.Dispatched) { var dispatchedAt = cmd.StartedAt ?? cmd.CreatedAt; if (cmd.ExpiresAt <= now) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.TimedOut; cmd.CompletedAt = now; cmd.ResultCode = -4; cmd.ResultMessage = "Command expired after dispatch without device result."; return true; } else if (now - dispatchedAt >= TimeSpan.FromMinutes(2)) { cmd.Status = ClassNotify.Shared.Models.DeviceCommandStatuses.TimedOut; cmd.CompletedAt = now; cmd.ResultCode = -4; cmd.ResultMessage = "Command timed out (device did not report execution result within 2 minutes)."; return true; } } return false; } } /// /// 管理员操作审计事件实体 /// public class AdminAuditEvent { [Key] public string Id { get; set; } = string.Empty; public DateTimeOffset OccurredAt { get; set; } = DateTimeOffset.UtcNow; public string ActorUsername { get; set; } = string.Empty; public string ActorRole { get; set; } = string.Empty; public string Action { get; set; } = string.Empty; public string TargetType { get; set; } = string.Empty; public string TargetId { get; set; } = string.Empty; public string? Details { get; set; } public string? IpAddress { get; set; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Hubs/DeviceHub.cs SIZE: 13008 chars SHA256: BA46DBD2277935E6AE92651FB34294D07A4CF64D066D4A38D60A9FE489DC1B6F ===================================================================== */ using ClassNotify.Server.Services; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Hubs; public class DeviceHub : Hub { private readonly ILogger _logger; private readonly IHubContext _teacherHub; private readonly ISecurityService _securityService; // Track active connection -> { TenantId, ClassroomId, DeviceId } private static readonly Dictionary _connectionTenantMap = new(); public DeviceHub( ILogger logger, IHubContext teacherHub, ISecurityService securityService) { _logger = logger; _teacherHub = teacherHub; _securityService = securityService; } public override async Task OnConnectedAsync() { var httpContext = Context.GetHttpContext(); var deviceId = httpContext?.Request.Headers["X-Device-Id"].FirstOrDefault() ?? httpContext?.Request.Query["device_id"].FirstOrDefault(); var deviceToken = httpContext?.Request.Headers["X-Device-Token"].FirstOrDefault() ?? httpContext?.Request.Query["device_token"].FirstOrDefault(); var clientVersion = httpContext?.Request.Headers["X-Client-Version"].FirstOrDefault() ?? "2.1.0"; var remoteIp = httpContext?.Connection.RemoteIpAddress?.ToString() ?? "127.0.0.1"; if (string.IsNullOrEmpty(deviceId) || string.IsNullOrEmpty(deviceToken)) { _logger.LogWarning("Rejecting unauthorized device connection {ConnId}: Missing device credentials.", Context.ConnectionId); Context.Abort(); return; } var device = await _securityService.ValidateDeviceAsync(deviceId, deviceToken); if (device == null) { _logger.LogWarning("Rejecting unauthorized device connection {ConnId}: Invalid device ID or token ({DeviceId}).", Context.ConnectionId, deviceId); Context.Abort(); return; } // Add to Tenant-Isolated Group var tenantClassGroup = $"t:{device.TenantId}:c:{device.ClassroomId}"; await Groups.AddToGroupAsync(Context.ConnectionId, tenantClassGroup); lock (_connectionTenantMap) { _connectionTenantMap[Context.ConnectionId] = (device.TenantId, device.ClassroomId, device.Id); } // Register in SecurityService Live Registry var regResult = await _securityService.RegisterDeviceConnectionAsync( Context.ConnectionId, device.Id, device.TenantId, device.ClassroomId, device.Hostname, remoteIp, clientVersion); if (!string.IsNullOrEmpty(regResult.ReplacedConnectionId) && regResult.ReplacedConnectionId != Context.ConnectionId) { await Groups.RemoveFromGroupAsync(regResult.ReplacedConnectionId, tenantClassGroup); _logger.LogInformation("Removed replaced connection {OldConnId} from class group {Group}; current connection is {NewConnId}", regResult.ReplacedConnectionId, tenantClassGroup, Context.ConnectionId); } _logger.LogInformation("Device {DeviceId} authenticated successfully. Joined group {Group} at {ConnId}", device.Id, tenantClassGroup, Context.ConnectionId); // Notify teachers of THIS tenant var classroom = await _securityService.GetClassroomAsync(device.TenantId, device.ClassroomId); var status = new DeviceStatusDto { DeviceId = device.Id, ClassId = device.ClassroomId, ClassName = classroom?.DisplayName ?? device.ClassroomId, Hostname = device.Hostname ?? "Classroom-PC", State = DeviceOnlineState.Online, LastHeartbeat = DateTimeOffset.UtcNow, AgentVersion = clientVersion }; await _teacherHub.Clients.Group($"t:{device.TenantId}:teachers").OnDeviceStatusChanged(status); await base.OnConnectedAsync(); // P1 Batch 9: Catch-up pending notifications for this reconnected device (Caller unicast only) try { var pendingNotifications = await _securityService.GetPendingNotificationsForDeviceAsync(device.Id); if (pendingNotifications.Count > 0) { _logger.LogInformation("Device {DeviceId} connected with {Count} pending notification(s) to catch up.", device.Id, pendingNotifications.Count); foreach (var pending in pendingNotifications) { await Clients.Caller.ReceiveNotification(pending); } } } catch (Exception ex) { _logger.LogError(ex, "Error catching up pending notifications for Device {DeviceId}", device.Id); } // P1 Batch 10: Catch-up pending commands for this reconnected device (Caller unicast only) try { var pendingCommands = await _securityService.GetPendingCommandsForDeviceAsync(device.Id); if (pendingCommands.Count > 0) { _logger.LogInformation("Device {DeviceId} connected with {Count} pending command(s) to catch up.", device.Id, pendingCommands.Count); foreach (var pendingCmd in pendingCommands) { await Clients.Caller.ReceiveRemoteCommand(pendingCmd); await _securityService.MarkCommandDispatchedAsync(pendingCmd.CommandId); } } } catch (Exception ex) { _logger.LogError(ex, "Error catching up pending commands for Device {DeviceId}", device.Id); } } public async Task SendAckReceipt(AckReceiptDto ack) { string? tenantId = null; string? classroomId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; classroomId = info.ClassroomId; deviceId = info.DeviceId; } } if (tenantId == null || classroomId == null || deviceId == null) { _logger.LogWarning("Rejecting ACK from unauthenticated connection {ConnId}", Context.ConnectionId); return; } // Must be current connection for this device if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale ACK from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // P0-11: Enforce device ACK attribution validation. // Force ClassId to match the connection's authenticated classroom (never trust client-supplied ClassId). ack.ClassId = classroomId; // Verify that this notification was actually sent to this tenant and classroom if (!await _securityService.ValidateNotificationTargetAsync(ack.MessageId, tenantId, classroomId)) { _logger.LogWarning("Spoofed or unknown ACK rejected: Message {MsgId} does not match Tenant {TenantId}, Class {ClassId} (Device {DeviceId})", ack.MessageId, tenantId, classroomId, deviceId); return; } _logger.LogInformation("ACK validated from Tenant {TenantId}, Class {ClassId} (Device {DeviceId}): Message {MsgId} -> {Status}", tenantId, classroomId, deviceId, ack.MessageId, ack.Status); // Record ACK in history (NotificationReceipt per device) await _securityService.RecordAckAsync(ack.MessageId, deviceId, ack); // Relay ONLY to teachers belonging to THIS tenant! await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnAckReceiptReceived(ack); } public async Task ReportCommandResult(DeviceCommandResultDto result) { string? tenantId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; deviceId = info.DeviceId; } } if (tenantId == null || deviceId == null) { _logger.LogWarning("Rejecting command result from unauthenticated connection {ConnId}", Context.ConnectionId); return; } if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale command result from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // Security enforcement: force DeviceId from authenticated connection! result.DeviceId = deviceId; var recorded = await _securityService.RecordCommandResultAsync(result, deviceId, tenantId); if (recorded != null) { // Relay to teachers and administrators of THIS tenant! await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnDeviceCommandStatusChanged(recorded); } } public async Task SendHealthReport(DeviceHealthReportDto report) { string? tenantId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; deviceId = info.DeviceId; } } if (tenantId == null || deviceId == null) return; if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale health report from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } // Security requirement: Force DeviceId from authenticated connection! report.DeviceId = deviceId; await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnHealthReportReceived(report); } public async Task SendHeartbeat(string classId) { string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { deviceId = info.DeviceId; } } if (deviceId == null) { _logger.LogWarning("Rejecting heartbeat from unauthenticated connection {ConnId}", Context.ConnectionId); return; } if (!_securityService.IsCurrentDeviceConnection(deviceId, Context.ConnectionId)) { _logger.LogWarning("Ignored stale heartbeat from {ConnId} for Device {DeviceId}", Context.ConnectionId, deviceId); return; } await _securityService.UpdateDeviceHeartbeatAsync(Context.ConnectionId); _logger.LogDebug("Received heartbeat from Device {DeviceId} ({ConnId})", deviceId, Context.ConnectionId); } public override async Task OnDisconnectedAsync(Exception? exception) { string? tenantId = null; string? classId = null; string? deviceId = null; lock (_connectionTenantMap) { if (_connectionTenantMap.TryGetValue(Context.ConnectionId, out var info)) { tenantId = info.TenantId; classId = info.ClassroomId; deviceId = info.DeviceId; _connectionTenantMap.Remove(Context.ConnectionId); } } var isCurrentDisconnected = await _securityService.UnregisterDeviceConnectionAsync(Context.ConnectionId); if (tenantId != null && classId != null && deviceId != null) { if (isCurrentDisconnected) { _logger.LogInformation("Device {DeviceId} disconnected for Tenant {TenantId}, Class {ClassId}", deviceId, tenantId, classId); var status = new DeviceStatusDto { DeviceId = deviceId, ClassId = classId, State = DeviceOnlineState.Offline, LastHeartbeat = DateTimeOffset.UtcNow }; await _teacherHub.Clients.Group($"t:{tenantId}:teachers").OnDeviceStatusChanged(status); } else { _logger.LogInformation("Stale connection {ConnId} disconnected for Device {DeviceId} (Tenant {TenantId}, Class {ClassId}); device is still active on newer connection. Skipping Offline status broadcast.", Context.ConnectionId, deviceId, tenantId, classId); } } await base.OnDisconnectedAsync(exception); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Hubs/TeacherHub.cs SIZE: 1332 chars SHA256: F45E2F8C1F620B9FEF0487E3CBBE7FAE7569D4C9F99EBF23EF95D61B587A4AC7 ===================================================================== */ using System.Security.Claims; using ClassNotify.Shared.Contracts; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; namespace ClassNotify.Server.Hubs; /// /// 教师端 SignalR Hub (强制 JWT 认证,基于 TenantId 强隔离事件流) /// [Authorize] public class TeacherHub : Hub { private readonly ILogger _logger; public TeacherHub(ILogger logger) { _logger = logger; } public override async Task OnConnectedAsync() { var tenantId = Context.User?.FindFirst("tenant_id")?.Value; var teacherName = Context.User?.FindFirst(ClaimTypes.Name)?.Value ?? "教师"; if (string.IsNullOrEmpty(tenantId)) { _logger.LogWarning("Rejecting teacher connection {ConnId}: Missing tenant_id claim.", Context.ConnectionId); Context.Abort(); return; } // Join tenant-specific teacher event channel var tenantTeacherGroup = $"t:{tenantId}:teachers"; await Groups.AddToGroupAsync(Context.ConnectionId, tenantTeacherGroup); _logger.LogInformation("Teacher {TeacherName} connected to SignalR Hub. Joined group {Group} at {ConnId}", teacherName, tenantTeacherGroup, Context.ConnectionId); await base.OnConnectedAsync(); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Program.cs SIZE: 14398 chars SHA256: 047B98E937390B13E8381BAF6FD9CFC2F4C0605C2DB2984A57C1CFCA8AAE7A63 ===================================================================== */ using System.Net; using System.Security.Claims; using System.Text; using System.Threading.RateLimiting; using ClassNotify.Server.Configuration; using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Server.Hubs; using ClassNotify.Server.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.RateLimiting; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using Microsoft.Extensions.Options; using Serilog; Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Console() .CreateLogger(); try { var builder = WebApplication.CreateBuilder(args); builder.Host.UseSerilog(); builder.Services.AddControllers(); builder.Services.AddSignalR(); // 1. PostgreSQL EF Core DbContext var defaultConn = builder.Configuration.GetConnectionString("DefaultConnection") ?? Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection") ?? "Host=127.0.0.1;Port=5432;Database=classnotify;Username=classnotify;Password=CHANGEME_DEV;"; builder.Services.AddDbContext(options => { options.UseNpgsql(defaultConn); }); // 2. Data Protection for Encrypted Recoverable Device Tokens var keysPath = OperatingSystem.IsLinux() ? "/var/lib/classnotify/keys" : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ClassNotify", "keys"); if (!Directory.Exists(keysPath)) { Directory.CreateDirectory(keysPath); } builder.Services.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(keysPath)) .SetApplicationName("ClassNotify"); // 3. ASP.NET Core PasswordHasher builder.Services.AddSingleton, PasswordHasher>(); // 4. JWT Options Binding & Strict Production Guard builder.Services.Configure(builder.Configuration.GetSection("Jwt")); var jwtOptions = builder.Configuration.GetSection("Jwt").Get() ?? new JwtOptions(); if (builder.Environment.IsProduction()) { if (string.IsNullOrWhiteSpace(jwtOptions.SigningKey) || Encoding.UTF8.GetByteCount(jwtOptions.SigningKey) < 64) { throw new InvalidOperationException("Production Guard: Jwt__SigningKey is missing or has insufficient length (minimum 64 bytes required in Production). Refusing to start."); } if (string.IsNullOrWhiteSpace(jwtOptions.Issuer)) { throw new InvalidOperationException("Production Guard: Jwt__Issuer is missing. Refusing to start."); } if (string.IsNullOrWhiteSpace(jwtOptions.Audience)) { throw new InvalidOperationException("Production Guard: Jwt__Audience is missing. Refusing to start."); } } else { // Non-production fallback for design-time / local dev if unconfigured if (string.IsNullOrWhiteSpace(jwtOptions.SigningKey) || Encoding.UTF8.GetByteCount(jwtOptions.SigningKey) < 32) { jwtOptions.SigningKey = "DEV_ONLY_INSECURE_SIGNING_KEY_FOR_LOCAL_TESTING_PURPOSES_ONLY_MIN_64_BYTES_LONG_!"; } if (string.IsNullOrWhiteSpace(jwtOptions.Issuer)) jwtOptions.Issuer = "ClassNotify.Server"; if (string.IsNullOrWhiteSpace(jwtOptions.Audience)) jwtOptions.Audience = "ClassNotify.Clients"; } builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddHostedService(); builder.Services.AddHostedService(); // 5. JWT Authentication with Strict Validation builder.Services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { // Support SignalR query string token for WebSocket connections options.Events = new JwtBearerEvents { OnMessageReceived = context => { var accessToken = context.Request.Query["access_token"]; var path = context.HttpContext.Request.Path; if (!string.IsNullOrEmpty(accessToken) && (path.StartsWithSegments("/hubs/teacher") || path.StartsWithSegments("/hubs/device"))) { context.Token = accessToken; } return Task.CompletedTask; }, OnTokenValidated = async context => { var userId = context.Principal?.FindFirst(ClaimTypes.NameIdentifier)?.Value; var tenantId = context.Principal?.FindFirst("tenant_id")?.Value; if (string.IsNullOrEmpty(userId)) { context.Fail("Invalid token claims: missing NameIdentifier."); return; } var dbContext = context.HttpContext.RequestServices.GetRequiredService(); var user = await dbContext.Users.AsNoTracking().FirstOrDefaultAsync(u => u.Id == userId); if (user == null || user.IsLocked) { context.Fail("User account has been locked or deactivated."); return; } var tokenVersionClaim = context.Principal?.FindFirst("token_version")?.Value; if (string.IsNullOrWhiteSpace(tokenVersionClaim) || !int.TryParse(tokenVersionClaim, out var tokenVersion)) { context.Fail("Invalid token claims: missing or invalid token_version (fail-closed against legacy tokens)."); return; } if (user.TokenVersion != tokenVersion) { context.Fail("Token has been revoked due to security event or password reset."); return; } if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { var tenant = await dbContext.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { context.Fail("Tenant is inactive or suspended."); return; } } } }; }); builder.Services.AddOptions(JwtBearerDefaults.AuthenticationScheme) .Configure>((options, jwtOptAccessor) => { var currentJwt = jwtOptAccessor.Value; var keyStr = currentJwt.SigningKey; if (string.IsNullOrWhiteSpace(keyStr) || Encoding.UTF8.GetByteCount(keyStr) < 32) { keyStr = "DEV_ONLY_INSECURE_SIGNING_KEY_FOR_LOCAL_TESTING_PURPOSES_ONLY_MIN_64_BYTES_LONG_!"; } var iss = !string.IsNullOrWhiteSpace(currentJwt.Issuer) ? currentJwt.Issuer : "ClassNotify.Server"; var aud = !string.IsNullOrWhiteSpace(currentJwt.Audience) ? currentJwt.Audience : "ClassNotify.Clients"; options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = iss, ValidAudience = aud, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(keyStr)), ClockSkew = TimeSpan.FromMinutes(1) }; }); builder.Services.AddAuthorization(); // 6. Partitioned Rate Limiting (按来源分区,避免全局限流瓶颈) builder.Services.Configure(builder.Configuration.GetSection("RateLimit")); builder.Services.AddRateLimiter(options => { options.RejectionStatusCode = StatusCodes.Status429TooManyRequests; // AuthLimiter: requests / minute / IP options.AddPolicy("AuthLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var remoteIp = httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"; return RateLimitPartition.GetFixedWindowLimiter(remoteIp, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.AuthPermitLimit > 0 ? rateOpts.AuthPermitLimit : 60, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); // ActivationLimiter: requests / minute / IP options.AddPolicy("ActivationLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var remoteIp = httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"; return RateLimitPartition.GetFixedWindowLimiter(remoteIp, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.ActivationPermitLimit > 0 ? rateOpts.ActivationPermitLimit : 30, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); // SendLimiter: notifications / minute / user (fallback to IP) options.AddPolicy("SendLimiter", httpContext => { var rateOpts = httpContext.RequestServices.GetRequiredService>().Value; var userId = httpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var partitionKey = !string.IsNullOrEmpty(userId) ? $"user_{userId}" : $"ip_{httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown_ip"}"; return RateLimitPartition.GetFixedWindowLimiter(partitionKey, _ => new FixedWindowRateLimiterOptions { PermitLimit = rateOpts.SendPermitLimit > 0 ? rateOpts.SendPermitLimit : 120, Window = TimeSpan.FromMinutes(1), QueueLimit = 0 }); }); }); // 7. CORS Hardening (Production strictly allows official domain only) builder.Services.AddCors(options => { options.AddPolicy("CorsPolicy", policy => { if (builder.Environment.IsDevelopment()) { policy.WithOrigins("http://localhost:5173", "http://127.0.0.1:5173") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } else { policy.WithOrigins("https://classnotify.paradise.eu.org") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } }); }); // 6. Forwarded Headers for Linux reverse proxy (Caddy / Nginx) // Only trust loopback reverse proxy (Caddy on same host) with ForwardLimit = 1 builder.Services.Configure(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; options.KnownNetworks.Clear(); options.KnownProxies.Clear(); options.KnownProxies.Add(IPAddress.Loopback); options.KnownProxies.Add(IPAddress.IPv6Loopback); options.ForwardLimit = 1; }); var app = builder.Build(); app.UseForwardedHeaders(); // Database Initialization & One-Time JSON Migration using (var scope = app.Services.CreateScope()) { var db = scope.ServiceProvider.GetRequiredService(); try { if (db.Database.IsRelational()) { await db.Database.MigrateAsync(); } await DbInitializer.InitializeAsync(db, app.Environment, app.Configuration, app.Logger); await JsonMigrationService.MigrateAsync(db, null, app.Logger); } catch (Exception ex) { app.Logger.LogError(ex, "Error during database initialization or JSON migration."); throw; } } // Serve React SPA static files from wwwroot app.UseDefaultFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.UseRateLimiter(); app.MapControllers(); app.MapHub("/hubs/device"); app.MapHub("/hubs/teacher"); // Dedicated Real PostgreSQL Health Check Endpoint app.MapGet("/api/health", async (ClassNotifyDbContext dbContext) => { bool dbOk = false; string? dbError = null; try { using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3)); dbOk = await dbContext.Database.CanConnectAsync(cts.Token); if (dbOk) { await dbContext.Database.ExecuteSqlRawAsync("SELECT 1", cts.Token); } } catch (Exception ex) { dbError = ex.Message; } var status = dbOk ? "Healthy" : "Degraded"; var result = new { service = "ClassNotify Commercial Server (ASP.NET Core on Linux)", version = "2.1.0", status = status, database = dbOk ? "Connected" : "Disconnected", databaseError = dbError, hubs = new[] { "/hubs/device", "/hubs/teacher" } }; return dbOk ? Results.Ok(result) : Results.Json(result, statusCode: 503); }); // Fallback to index.html for React SPA client-side routing app.MapFallbackToFile("index.html"); app.Run(); } catch (Exception ex) { Log.Fatal(ex, "ClassNotify Server terminated unexpectedly."); } finally { Log.CloseAndFlush(); } namespace ClassNotify.Server { public partial class Program { } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/ClassNotify.Server.deps.json SIZE: 40299 chars SHA256: F5267BB0E4D1BFEFE0D0216896698D4CF762C69B5155222FE8AAFB0B8C619A26 ===================================================================== */ { "runtimeTarget": { "name": ".NETCoreApp,Version=v8.0", "signature": "" }, "compilationOptions": {}, "targets": { ".NETCoreApp,Version=v8.0": { "ClassNotify.Server/1.0.0": { "dependencies": { "ClassNotify.Shared": "1.0.0", "Microsoft.AspNetCore.Authentication.JwtBearer": "8.0.0", "Microsoft.AspNetCore.SignalR.Common": "8.0.0", "Microsoft.EntityFrameworkCore.Design": "8.0.0", "Npgsql.EntityFrameworkCore.PostgreSQL": "8.0.0", "Serilog.AspNetCore": "8.0.0", "Serilog.Sinks.Console": "5.0.0", "Serilog.Sinks.File": "5.0.0" }, "runtime": { "ClassNotify.Server.dll": {} } }, "Humanizer.Core/2.14.1": {}, "Microsoft.AspNetCore.Authentication.JwtBearer/8.0.0": { "dependencies": { "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53112" } } }, "Microsoft.AspNetCore.Connections.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Features": "8.0.0", "System.IO.Pipelines": "8.0.0" } }, "Microsoft.AspNetCore.SignalR.Common/8.0.0": { "dependencies": { "Microsoft.AspNetCore.Connections.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0" } }, "Microsoft.Bcl.AsyncInterfaces/6.0.0": {}, "Microsoft.CodeAnalysis.Analyzers/3.3.3": {}, "Microsoft.CodeAnalysis.Common/4.5.0": { "dependencies": { "Microsoft.CodeAnalysis.Analyzers": "3.3.3", "System.Collections.Immutable": "6.0.0", "System.Reflection.Metadata": "6.0.1", "System.Runtime.CompilerServices.Unsafe": "6.0.0", "System.Text.Encoding.CodePages": "6.0.0" } }, "Microsoft.CodeAnalysis.CSharp/4.5.0": { "dependencies": { "Microsoft.CodeAnalysis.Common": "4.5.0" } }, "Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.CodeAnalysis.CSharp": "4.5.0", "Microsoft.CodeAnalysis.Common": "4.5.0", "Microsoft.CodeAnalysis.Workspaces.Common": "4.5.0" } }, "Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.Bcl.AsyncInterfaces": "6.0.0", "Microsoft.CodeAnalysis.Common": "4.5.0", "System.Composition": "6.0.0", "System.IO.Pipelines": "8.0.0", "System.Threading.Channels": "6.0.0" } }, "Microsoft.EntityFrameworkCore/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore.Abstractions": "8.0.0", "Microsoft.EntityFrameworkCore.Analyzers": "8.0.0", "Microsoft.Extensions.Caching.Memory": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.EntityFrameworkCore.Abstractions/8.0.0": { "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.Abstractions.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.EntityFrameworkCore.Analyzers/8.0.0": {}, "Microsoft.EntityFrameworkCore.Design/8.0.0": { "dependencies": { "Humanizer.Core": "2.14.1", "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.5.0", "Microsoft.EntityFrameworkCore.Relational": "8.0.0", "Microsoft.Extensions.DependencyModel": "8.0.0", "Mono.TextTemplating": "2.2.1" } }, "Microsoft.EntityFrameworkCore.Relational/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.0", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.Relational.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.Extensions.Caching.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Caching.Memory/8.0.0": { "dependencies": { "Microsoft.Extensions.Caching.Abstractions": "8.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0", "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Configuration.Binder/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" } }, "Microsoft.Extensions.DependencyInjection/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": {}, "Microsoft.Extensions.DependencyModel/8.0.0": { "dependencies": { "System.Text.Encodings.Web": "8.0.0", "System.Text.Json": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.Extensions.DependencyModel.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.23.53103" } } }, "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0", "System.Diagnostics.DiagnosticSource": "8.0.0" } }, "Microsoft.Extensions.Features/8.0.0": {}, "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0" } }, "Microsoft.Extensions.Logging/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Microsoft.Extensions.Options": "8.0.0" } }, "Microsoft.Extensions.Logging.Abstractions/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, "Microsoft.Extensions.Options/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Primitives/8.0.0": {}, "Microsoft.IdentityModel.Abstractions/7.0.3": { "runtime": { "lib/net8.0/Microsoft.IdentityModel.Abstractions.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.JsonWebTokens/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Logging/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Abstractions": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Logging.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Protocols/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Logging": "7.0.3", "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Protocols.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Protocols.OpenIdConnect/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Protocols": "7.0.3", "System.IdentityModel.Tokens.Jwt": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Microsoft.IdentityModel.Tokens/7.0.3": { "dependencies": { "Microsoft.IdentityModel.Logging": "7.0.3" }, "runtime": { "lib/net8.0/Microsoft.IdentityModel.Tokens.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "Mono.TextTemplating/2.2.1": { "dependencies": { "System.CodeDom": "4.4.0" } }, "Npgsql/8.0.0": { "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "8.0.0" }, "runtime": { "lib/net8.0/Npgsql.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Npgsql.EntityFrameworkCore.PostgreSQL/8.0.0": { "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.0", "Microsoft.EntityFrameworkCore.Abstractions": "8.0.0", "Microsoft.EntityFrameworkCore.Relational": "8.0.0", "Npgsql": "8.0.0" }, "runtime": { "lib/net8.0/Npgsql.EntityFrameworkCore.PostgreSQL.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog/3.1.1": { "runtime": { "lib/net7.0/Serilog.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "3.1.1.0" } } }, "Serilog.AspNetCore/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection": "8.0.0", "Microsoft.Extensions.Logging": "8.0.0", "Serilog": "3.1.1", "Serilog.Extensions.Hosting": "8.0.0", "Serilog.Extensions.Logging": "8.0.0", "Serilog.Formatting.Compact": "2.0.0", "Serilog.Settings.Configuration": "8.0.0", "Serilog.Sinks.Console": "5.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0" }, "runtime": { "lib/net8.0/Serilog.AspNetCore.dll": { "assemblyVersion": "0.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Extensions.Hosting/8.0.0": { "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", "Microsoft.Extensions.Hosting.Abstractions": "8.0.0", "Microsoft.Extensions.Logging.Abstractions": "8.0.0", "Serilog": "3.1.1", "Serilog.Extensions.Logging": "8.0.0" }, "runtime": { "lib/net8.0/Serilog.Extensions.Hosting.dll": { "assemblyVersion": "7.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Extensions.Logging/8.0.0": { "dependencies": { "Microsoft.Extensions.Logging": "8.0.0", "Serilog": "3.1.1" }, "runtime": { "lib/net8.0/Serilog.Extensions.Logging.dll": { "assemblyVersion": "7.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Formatting.Compact/2.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net7.0/Serilog.Formatting.Compact.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "2.0.0.0" } } }, "Serilog.Settings.Configuration/8.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Binder": "8.0.0", "Microsoft.Extensions.DependencyModel": "8.0.0", "Serilog": "3.1.1" }, "runtime": { "lib/net8.0/Serilog.Settings.Configuration.dll": { "assemblyVersion": "8.0.0.0", "fileVersion": "8.0.0.0" } } }, "Serilog.Sinks.Console/5.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net7.0/Serilog.Sinks.Console.dll": { "assemblyVersion": "5.0.0.0", "fileVersion": "5.0.0.0" } } }, "Serilog.Sinks.Debug/2.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/netstandard2.1/Serilog.Sinks.Debug.dll": { "assemblyVersion": "2.0.0.0", "fileVersion": "2.0.0.0" } } }, "Serilog.Sinks.File/5.0.0": { "dependencies": { "Serilog": "3.1.1" }, "runtime": { "lib/net5.0/Serilog.Sinks.File.dll": { "assemblyVersion": "5.0.0.0", "fileVersion": "5.0.0.0" } } }, "System.CodeDom/4.4.0": {}, "System.Collections.Immutable/6.0.0": { "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Composition/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0", "System.Composition.Convention": "6.0.0", "System.Composition.Hosting": "6.0.0", "System.Composition.Runtime": "6.0.0", "System.Composition.TypedParts": "6.0.0" } }, "System.Composition.AttributedModel/6.0.0": {}, "System.Composition.Convention/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0" } }, "System.Composition.Hosting/6.0.0": { "dependencies": { "System.Composition.Runtime": "6.0.0" } }, "System.Composition.Runtime/6.0.0": {}, "System.Composition.TypedParts/6.0.0": { "dependencies": { "System.Composition.AttributedModel": "6.0.0", "System.Composition.Hosting": "6.0.0", "System.Composition.Runtime": "6.0.0" } }, "System.Diagnostics.DiagnosticSource/8.0.0": {}, "System.IdentityModel.Tokens.Jwt/7.0.3": { "dependencies": { "Microsoft.IdentityModel.JsonWebTokens": "7.0.3", "Microsoft.IdentityModel.Tokens": "7.0.3" }, "runtime": { "lib/net8.0/System.IdentityModel.Tokens.Jwt.dll": { "assemblyVersion": "7.0.3.0", "fileVersion": "7.0.3.41017" } } }, "System.IO.Pipelines/8.0.0": {}, "System.Reflection.Metadata/6.0.1": { "dependencies": { "System.Collections.Immutable": "6.0.0" } }, "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, "System.Text.Encoding.CodePages/6.0.0": { "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Text.Encodings.Web/8.0.0": {}, "System.Text.Json/8.0.0": { "dependencies": { "System.Text.Encodings.Web": "8.0.0" } }, "System.Threading.Channels/6.0.0": {}, "ClassNotify.Shared/1.0.0": { "runtime": { "ClassNotify.Shared.dll": { "assemblyVersion": "1.0.0", "fileVersion": "1.0.0.0" } } } } }, "libraries": { "ClassNotify.Server/1.0.0": { "type": "project", "serviceable": false, "sha512": "" }, "Humanizer.Core/2.14.1": { "type": "package", "serviceable": true, "sha512": "sha512-lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==", "path": "humanizer.core/2.14.1", "hashPath": "humanizer.core.2.14.1.nupkg.sha512" }, "Microsoft.AspNetCore.Authentication.JwtBearer/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-rwxaZYHips5M9vqxRkGfJthTx+Ws4O4yCuefn17J371jL3ouC5Ker43h2hXb5yd9BMnImE9rznT75KJHm6bMgg==", "path": "microsoft.aspnetcore.authentication.jwtbearer/8.0.0", "hashPath": "microsoft.aspnetcore.authentication.jwtbearer.8.0.0.nupkg.sha512" }, "Microsoft.AspNetCore.Connections.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-WgJE2+VyA0RW4yl+hgfrB7r4CSGcLzAvcVo31swukjXHZvBAjMilyG/pRJ8kroOO1h7sGf4r91Wii2L9gCMNfA==", "path": "microsoft.aspnetcore.connections.abstractions/8.0.0", "hashPath": "microsoft.aspnetcore.connections.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.AspNetCore.SignalR.Common/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-HOy32Kb4z69sCep+pVUTL11L49pk8Ze18HuqCYllaRMdDlfcSrBE0stb8fJL+ogPKTB7XZAxpj1UT/IJQIfS6g==", "path": "microsoft.aspnetcore.signalr.common/8.0.0", "hashPath": "microsoft.aspnetcore.signalr.common.8.0.0.nupkg.sha512" }, "Microsoft.Bcl.AsyncInterfaces/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==", "path": "microsoft.bcl.asyncinterfaces/6.0.0", "hashPath": "microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.Analyzers/3.3.3": { "type": "package", "serviceable": true, "sha512": "sha512-j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==", "path": "microsoft.codeanalysis.analyzers/3.3.3", "hashPath": "microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512" }, "Microsoft.CodeAnalysis.Common/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-lwAbIZNdnY0SUNoDmZHkVUwLO8UyNnyyh1t/4XsbFxi4Ounb3xszIYZaWhyj5ZjyfcwqwmtMbE7fUTVCqQEIdQ==", "path": "microsoft.codeanalysis.common/4.5.0", "hashPath": "microsoft.codeanalysis.common.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.CSharp/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-cM59oMKAOxvdv76bdmaKPy5hfj+oR+zxikWoueEB7CwTko7mt9sVKZI8Qxlov0C/LuKEG+WQwifepqL3vuTiBQ==", "path": "microsoft.codeanalysis.csharp/4.5.0", "hashPath": "microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-h74wTpmGOp4yS4hj+EvNzEiPgg/KVs2wmSfTZ81upJZOtPkJsVkgfsgtxxqmAeapjT/vLKfmYV0bS8n5MNVP+g==", "path": "microsoft.codeanalysis.csharp.workspaces/4.5.0", "hashPath": "microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512" }, "Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": { "type": "package", "serviceable": true, "sha512": "sha512-l4dDRmGELXG72XZaonnOeORyD/T5RpEu5LGHOUIhnv+MmUWDY/m1kWXGwtcgQ5CJ5ynkFiRnIYzTKXYjUs7rbw==", "path": "microsoft.codeanalysis.workspaces.common/4.5.0", "hashPath": "microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-SoODat83pGQUpWB9xULdMX6tuKpq/RTXDuJ2WeC1ldUKcKzLkaFJD1n+I0nOLY58odez/e7z8b6zdp235G/kyg==", "path": "microsoft.entityframeworkcore/8.0.0", "hashPath": "microsoft.entityframeworkcore.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-VR22s3+zoqlVI7xauFKn1znSIFHO8xuILT+noSwS8bZCKcHz0ydkTDQMuaxSa5WBaQrZmwtTz9rmRvJ7X8mSPQ==", "path": "microsoft.entityframeworkcore.abstractions/8.0.0", "hashPath": "microsoft.entityframeworkcore.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Analyzers/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZXxEeLs2zoZ1TA+QoMMcw4f3Tirf8PzgdDax8RoWo0dxI2KmqiEGWYjhm2B/XyWfglc6+mNRyB8rZiQSmxCpeg==", "path": "microsoft.entityframeworkcore.analyzers/8.0.0", "hashPath": "microsoft.entityframeworkcore.analyzers.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Design/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-94reKYu63jg4O75UI3LMJHwOSi8tQ6IfubiZhdnSsWcgtmAuF8OyLfjK/MIxuvaQRJZAF6E747FIuxjOtb8/og==", "path": "microsoft.entityframeworkcore.design/8.0.0", "hashPath": "microsoft.entityframeworkcore.design.8.0.0.nupkg.sha512" }, "Microsoft.EntityFrameworkCore.Relational/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-fFKkr24cYc7Zw5T6DC4tEyOEPgPbq23BBmym1r9kn4ET9F3HKaetpOeQtV2RryYyUxEeNkJuxgfiZHTisqZc+A==", "path": "microsoft.entityframeworkcore.relational/8.0.0", "hashPath": "microsoft.entityframeworkcore.relational.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Caching.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-3KuSxeHoNYdxVYfg2IRZCThcrlJ1XJqIXkAWikCsbm5C/bCjv7G0WoKDyuR98Q+T607QT2Zl5GsbGRkENcV2yQ==", "path": "microsoft.extensions.caching.abstractions/8.0.0", "hashPath": "microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Caching.Memory/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-7pqivmrZDzo1ADPkRwjy+8jtRKWRCPag9qPI+p7sgu7Q4QreWhcvbiWXsbhP+yY8XSiDvZpu2/LWdBv7PnmOpQ==", "path": "microsoft.extensions.caching.memory/8.0.0", "hashPath": "microsoft.extensions.caching.memory.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==", "path": "microsoft.extensions.configuration.abstractions/8.0.0", "hashPath": "microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Configuration.Binder/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==", "path": "microsoft.extensions.configuration.binder/8.0.0", "hashPath": "microsoft.extensions.configuration.binder.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyInjection/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", "path": "microsoft.extensions.dependencyinjection/8.0.0", "hashPath": "microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==", "path": "microsoft.extensions.dependencyinjection.abstractions/8.0.0", "hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.DependencyModel/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-NSmDw3K0ozNDgShSIpsZcbFIzBX4w28nDag+TfaQujkXGazBm+lid5onlWoCBy4VsLxqnnKjEBbGSJVWJMf43g==", "path": "microsoft.extensions.dependencymodel/8.0.0", "hashPath": "microsoft.extensions.dependencymodel.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==", "path": "microsoft.extensions.diagnostics.abstractions/8.0.0", "hashPath": "microsoft.extensions.diagnostics.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Features/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-fxj+P9aIbTLtguFwiNqBtGNl4ZU/2Aggwj4/Ruf3qFaiBk7r1t8KnyJ+bEIK5emMyGSszTndwnP/g+gBEP9zLA==", "path": "microsoft.extensions.features/8.0.0", "hashPath": "microsoft.extensions.features.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==", "path": "microsoft.extensions.fileproviders.abstractions/8.0.0", "hashPath": "microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-AG7HWwVRdCHlaA++1oKDxLsXIBxmDpMPb3VoyOoAghEWnkUvEAdYQUwnV4jJbAaa/nMYNiEh5ByoLauZBEiovg==", "path": "microsoft.extensions.hosting.abstractions/8.0.0", "hashPath": "microsoft.extensions.hosting.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Logging/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", "path": "microsoft.extensions.logging/8.0.0", "hashPath": "microsoft.extensions.logging.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Logging.Abstractions/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", "path": "microsoft.extensions.logging.abstractions/8.0.0", "hashPath": "microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Options/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==", "path": "microsoft.extensions.options/8.0.0", "hashPath": "microsoft.extensions.options.8.0.0.nupkg.sha512" }, "Microsoft.Extensions.Primitives/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==", "path": "microsoft.extensions.primitives/8.0.0", "hashPath": "microsoft.extensions.primitives.8.0.0.nupkg.sha512" }, "Microsoft.IdentityModel.Abstractions/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-cfPUWdjigLIRIJSKz3uaZxShgf86RVDXHC1VEEchj1gnY25akwPYpbrfSoIGDCqA9UmOMdlctq411+2pAViFow==", "path": "microsoft.identitymodel.abstractions/7.0.3", "hashPath": "microsoft.identitymodel.abstractions.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.JsonWebTokens/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-vxjHVZbMKD3rVdbvKhzAW+7UiFrYToUVm3AGmYfKSOAwyhdLl/ELX1KZr+FaLyyS5VReIzWRWJfbOuHM9i6ywg==", "path": "microsoft.identitymodel.jsonwebtokens/7.0.3", "hashPath": "microsoft.identitymodel.jsonwebtokens.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Logging/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-b6GbGO+2LOTBEccHhqoJsOsmemG4A/MY+8H0wK/ewRhiG+DCYwEnucog1cSArPIY55zcn+XdZl0YEiUHkpDISQ==", "path": "microsoft.identitymodel.logging/7.0.3", "hashPath": "microsoft.identitymodel.logging.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Protocols/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-BtwR+tctBYhPNygyZmt1Rnw74GFrJteW+1zcdIgyvBCjkek6cNwPPqRfdhzCv61i+lwyNomRi8+iI4QKd4YCKA==", "path": "microsoft.identitymodel.protocols/7.0.3", "hashPath": "microsoft.identitymodel.protocols.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Protocols.OpenIdConnect/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-W97TraHApDNArLwpPcXfD+FZH7njJsfEwZE9y9BoofeXMS8H0LBBobz0VOmYmMK4mLdOKxzN7SFT3Ekg0FWI3Q==", "path": "microsoft.identitymodel.protocols.openidconnect/7.0.3", "hashPath": "microsoft.identitymodel.protocols.openidconnect.7.0.3.nupkg.sha512" }, "Microsoft.IdentityModel.Tokens/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-wB+LlbDjhnJ98DULjmFepqf9eEMh/sDs6S6hFh68iNRHmwollwhxk+nbSSfpA5+j+FbRyNskoaY4JsY1iCOKCg==", "path": "microsoft.identitymodel.tokens/7.0.3", "hashPath": "microsoft.identitymodel.tokens.7.0.3.nupkg.sha512" }, "Mono.TextTemplating/2.2.1": { "type": "package", "serviceable": true, "sha512": "sha512-KZYeKBET/2Z0gY1WlTAK7+RHTl7GSbtvTLDXEZZojUdAPqpQNDL6tHv7VUpqfX5VEOh+uRGKaZXkuD253nEOBQ==", "path": "mono.texttemplating/2.2.1", "hashPath": "mono.texttemplating.2.2.1.nupkg.sha512" }, "Npgsql/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-Qiz74U+O7Mv4knrsXgKVYGJjgwoziK+aMFZqz7PtKR3vyGIhZA0tnW6HoUnL3X+YqtmVuhmoKkN8LDWEHMxPbw==", "path": "npgsql/8.0.0", "hashPath": "npgsql.8.0.0.nupkg.sha512" }, "Npgsql.EntityFrameworkCore.PostgreSQL/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-GDXiMS9peEdjSCU/rfgyHruio7q6tYuywGaktqEi6UPQ6ILechp3fVVX+dHXkIXt4nklCBzYVWkzFrSL9ubKUA==", "path": "npgsql.entityframeworkcore.postgresql/8.0.0", "hashPath": "npgsql.entityframeworkcore.postgresql.8.0.0.nupkg.sha512" }, "Serilog/3.1.1": { "type": "package", "serviceable": true, "sha512": "sha512-P6G4/4Kt9bT635bhuwdXlJ2SCqqn2nhh4gqFqQueCOr9bK/e7W9ll/IoX1Ter948cV2Z/5+5v8pAfJYUISY03A==", "path": "serilog/3.1.1", "hashPath": "serilog.3.1.1.nupkg.sha512" }, "Serilog.AspNetCore/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-FAjtKPZ4IzqFQBqZKPv6evcXK/F0ls7RoXI/62Pnx2igkDZ6nZ/jn/C/FxVATqQbEQvtqP+KViWYIe4NZIHa2w==", "path": "serilog.aspnetcore/8.0.0", "hashPath": "serilog.aspnetcore.8.0.0.nupkg.sha512" }, "Serilog.Extensions.Hosting/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-db0OcbWeSCvYQkHWu6n0v40N4kKaTAXNjlM3BKvcbwvNzYphQFcBR+36eQ/7hMMwOkJvAyLC2a9/jNdUL5NjtQ==", "path": "serilog.extensions.hosting/8.0.0", "hashPath": "serilog.extensions.hosting.8.0.0.nupkg.sha512" }, "Serilog.Extensions.Logging/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-YEAMWu1UnWgf1c1KP85l1SgXGfiVo0Rz6x08pCiPOIBt2Qe18tcZLvdBUuV5o1QHvrs8FAry9wTIhgBRtjIlEg==", "path": "serilog.extensions.logging/8.0.0", "hashPath": "serilog.extensions.logging.8.0.0.nupkg.sha512" }, "Serilog.Formatting.Compact/2.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ob6z3ikzFM3D1xalhFuBIK1IOWf+XrQq+H4KeH4VqBcPpNcmUgZlRQ2h3Q7wvthpdZBBoY86qZOI2LCXNaLlNA==", "path": "serilog.formatting.compact/2.0.0", "hashPath": "serilog.formatting.compact.2.0.0.nupkg.sha512" }, "Serilog.Settings.Configuration/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-nR0iL5HwKj5v6ULo3/zpP8NMcq9E2pxYA6XKTSWCbugVs4YqPyvaqaKOY+OMpPivKp7zMEpax2UKHnDodbRB0Q==", "path": "serilog.settings.configuration/8.0.0", "hashPath": "serilog.settings.configuration.8.0.0.nupkg.sha512" }, "Serilog.Sinks.Console/5.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-IZ6bn79k+3SRXOBpwSOClUHikSkp2toGPCZ0teUkscv4dpDg9E2R2xVsNkLmwddE4OpNVO3N0xiYsAH556vN8Q==", "path": "serilog.sinks.console/5.0.0", "hashPath": "serilog.sinks.console.5.0.0.nupkg.sha512" }, "Serilog.Sinks.Debug/2.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-Y6g3OBJ4JzTyyw16fDqtFcQ41qQAydnEvEqmXjhwhgjsnG/FaJ8GUqF5ldsC/bVkK8KYmqrPhDO+tm4dF6xx4A==", "path": "serilog.sinks.debug/2.0.0", "hashPath": "serilog.sinks.debug.2.0.0.nupkg.sha512" }, "Serilog.Sinks.File/5.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", "path": "serilog.sinks.file/5.0.0", "hashPath": "serilog.sinks.file.5.0.0.nupkg.sha512" }, "System.CodeDom/4.4.0": { "type": "package", "serviceable": true, "sha512": "sha512-2sCCb7doXEwtYAbqzbF/8UAeDRMNmPaQbU2q50Psg1J9KzumyVVCgKQY8s53WIPTufNT0DpSe9QRvVjOzfDWBA==", "path": "system.codedom/4.4.0", "hashPath": "system.codedom.4.4.0.nupkg.sha512" }, "System.Collections.Immutable/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", "path": "system.collections.immutable/6.0.0", "hashPath": "system.collections.immutable.6.0.0.nupkg.sha512" }, "System.Composition/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-d7wMuKQtfsxUa7S13tITC8n1cQzewuhD5iDjZtK2prwFfKVzdYtgrTHgjaV03Zq7feGQ5gkP85tJJntXwInsJA==", "path": "system.composition/6.0.0", "hashPath": "system.composition.6.0.0.nupkg.sha512" }, "System.Composition.AttributedModel/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-WK1nSDLByK/4VoC7fkNiFuTVEiperuCN/Hyn+VN30R+W2ijO1d0Z2Qm0ScEl9xkSn1G2MyapJi8xpf4R8WRa/w==", "path": "system.composition.attributedmodel/6.0.0", "hashPath": "system.composition.attributedmodel.6.0.0.nupkg.sha512" }, "System.Composition.Convention/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-XYi4lPRdu5bM4JVJ3/UIHAiG6V6lWWUlkhB9ab4IOq0FrRsp0F4wTyV4Dj+Ds+efoXJ3qbLqlvaUozDO7OLeXA==", "path": "system.composition.convention/6.0.0", "hashPath": "system.composition.convention.6.0.0.nupkg.sha512" }, "System.Composition.Hosting/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-w/wXjj7kvxuHPLdzZ0PAUt++qJl03t7lENmb2Oev0n3zbxyNULbWBlnd5J5WUMMv15kg5o+/TCZFb6lSwfaUUQ==", "path": "system.composition.hosting/6.0.0", "hashPath": "system.composition.hosting.6.0.0.nupkg.sha512" }, "System.Composition.Runtime/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-qkRH/YBaMPTnzxrS5RDk1juvqed4A6HOD/CwRcDGyPpYps1J27waBddiiq1y93jk2ZZ9wuA/kynM+NO0kb3PKg==", "path": "system.composition.runtime/6.0.0", "hashPath": "system.composition.runtime.6.0.0.nupkg.sha512" }, "System.Composition.TypedParts/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-iUR1eHrL8Cwd82neQCJ00MpwNIBs4NZgXzrPqx8NJf/k4+mwBO0XCRmHYJT4OLSwDDqh5nBLJWkz5cROnrGhRA==", "path": "system.composition.typedparts/6.0.0", "hashPath": "system.composition.typedparts.6.0.0.nupkg.sha512" }, "System.Diagnostics.DiagnosticSource/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ==", "path": "system.diagnostics.diagnosticsource/8.0.0", "hashPath": "system.diagnostics.diagnosticsource.8.0.0.nupkg.sha512" }, "System.IdentityModel.Tokens.Jwt/7.0.3": { "type": "package", "serviceable": true, "sha512": "sha512-caEe+OpQNYNiyZb+DJpUVROXoVySWBahko2ooNfUcllxa9ZQUM8CgM/mDjP6AoFn6cQU9xMmG+jivXWub8cbGg==", "path": "system.identitymodel.tokens.jwt/7.0.3", "hashPath": "system.identitymodel.tokens.jwt.7.0.3.nupkg.sha512" }, "System.IO.Pipelines/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-FHNOatmUq0sqJOkTx+UF/9YK1f180cnW5FVqnQMvYUN0elp6wFzbtPSiqbo1/ru8ICp43JM1i7kKkk6GsNGHlA==", "path": "system.io.pipelines/8.0.0", "hashPath": "system.io.pipelines.8.0.0.nupkg.sha512" }, "System.Reflection.Metadata/6.0.1": { "type": "package", "serviceable": true, "sha512": "sha512-III/lNMSn0ZRBuM9m5Cgbiho5j81u0FAEagFX5ta2DKbljZ3T0IpD8j+BIiHQPeKqJppWS9bGEp6JnKnWKze0g==", "path": "system.reflection.metadata/6.0.1", "hashPath": "system.reflection.metadata.6.0.1.nupkg.sha512" }, "System.Runtime.CompilerServices.Unsafe/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", "path": "system.runtime.compilerservices.unsafe/6.0.0", "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" }, "System.Text.Encoding.CodePages/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==", "path": "system.text.encoding.codepages/6.0.0", "hashPath": "system.text.encoding.codepages.6.0.0.nupkg.sha512" }, "System.Text.Encodings.Web/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==", "path": "system.text.encodings.web/8.0.0", "hashPath": "system.text.encodings.web.8.0.0.nupkg.sha512" }, "System.Text.Json/8.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-OdrZO2WjkiEG6ajEFRABTRCi/wuXQPxeV6g8xvUJqdxMvvuCCEk86zPla8UiIQJz3durtUEbNyY/3lIhS0yZvQ==", "path": "system.text.json/8.0.0", "hashPath": "system.text.json.8.0.0.nupkg.sha512" }, "System.Threading.Channels/6.0.0": { "type": "package", "serviceable": true, "sha512": "sha512-TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==", "path": "system.threading.channels/6.0.0", "hashPath": "system.threading.channels.6.0.0.nupkg.sha512" }, "ClassNotify.Shared/1.0.0": { "type": "project", "serviceable": false, "sha512": "" } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/ClassNotify.Server.runtimeconfig.json SIZE: 557 chars SHA256: BFCD9777228F00CE830A77B9EE3D2D735AFEC5E998DEF17C549C6B004DD354CF ===================================================================== */ { "runtimeOptions": { "tfm": "net8.0", "frameworks": [ { "name": "Microsoft.NETCore.App", "version": "8.0.0" }, { "name": "Microsoft.AspNetCore.App", "version": "8.0.0" } ], "configProperties": { "System.GC.Server": true, "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, "System.Reflection.NullabilityInfoContext.IsSupported": true, "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false } } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/assets/index-Cw4C71zT.js SIZE: 397525 chars SHA256: F98F2D21737D8238804615BBCA7F886AAC4814F8A845A72930FED3D40345D24A ===================================================================== */ var Jf=Object.defineProperty;var Xf=(a,l,o)=>l in a?Jf(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;var xt=(a,l,o)=>Xf(a,typeof l!="symbol"?l+"":l,o);function Gf(a,l){for(var o=0;ou[d]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();function Td(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Oo={exports:{}},pr={},Uo={exports:{}},me={};/** * @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 rd;function Yf(){if(rd)return me;rd=1;var a=Symbol.for("react.element"),l=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),S=Symbol.iterator;function $(N){return N===null||typeof N!="object"?null:(N=S&&N[S]||N["@@iterator"],typeof N=="function"?N:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,F={};function I(N,L,ie){this.props=N,this.context=L,this.refs=F,this.updater=ie||D}I.prototype.isReactComponent={},I.prototype.setState=function(N,L){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,L,"setState")},I.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=I.prototype;function G(N,L,ie){this.props=N,this.context=L,this.refs=F,this.updater=ie||D}var Z=G.prototype=new q;Z.constructor=G,H(Z,I.prototype),Z.isPureReactComponent=!0;var te=Array.isArray,O=Object.prototype.hasOwnProperty,K={current:null},fe={key:!0,ref:!0,__self:!0,__source:!0};function pe(N,L,ie){var ce,he={},ve=null,ke=null;if(L!=null)for(ce in L.ref!==void 0&&(ke=L.ref),L.key!==void 0&&(ve=""+L.key),L)O.call(L,ce)&&!fe.hasOwnProperty(ce)&&(he[ce]=L[ce]);var Ne=arguments.length-2;if(Ne===1)he.children=ie;else if(1>>1,L=k[N];if(0>>1;Nd(he,T))ved(ke,he)?(k[N]=ke,k[ve]=T,N=ve):(k[N]=he,k[ce]=T,N=ce);else if(ved(ke,T))k[N]=ke,k[ve]=T,N=ve;else break e}}return W}function d(k,W){var T=k.sortIndex-W.sortIndex;return T!==0?T:k.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,y=m.now();a.unstable_now=function(){return m.now()-y}}var p=[],j=[],C=1,S=null,$=3,D=!1,H=!1,F=!1,I=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(k){for(var W=o(j);W!==null;){if(W.callback===null)u(j);else if(W.startTime<=k)u(j),W.sortIndex=W.expirationTime,l(p,W);else break;W=o(j)}}function te(k){if(F=!1,Z(k),!H)if(o(p)!==null)H=!0,Te(O);else{var W=o(j);W!==null&&V(te,W.startTime-k)}}function O(k,W){H=!1,F&&(F=!1,q(pe),pe=-1),D=!0;var T=$;try{for(Z(W),S=o(p);S!==null&&(!(S.expirationTime>W)||k&&!Ee());){var N=S.callback;if(typeof N=="function"){S.callback=null,$=S.priorityLevel;var L=N(S.expirationTime<=W);W=a.unstable_now(),typeof L=="function"?S.callback=L:S===o(p)&&u(p),Z(W)}else u(p);S=o(p)}if(S!==null)var ie=!0;else{var ce=o(j);ce!==null&&V(te,ce.startTime-W),ie=!1}return ie}finally{S=null,$=T,D=!1}}var K=!1,fe=null,pe=-1,b=5,ne=-1;function Ee(){return!(a.unstable_now()-nek||125N?(k.sortIndex=T,l(j,k),o(p)===null&&k===o(j)&&(F?(q(pe),pe=-1):F=!0,V(te,T-N))):(k.sortIndex=L,l(p,k),H||D||(H=!0,Te(O))),k},a.unstable_shouldYield=Ee,a.unstable_wrapCallback=function(k){var W=$;return function(){var T=$;$=W;try{return k.apply(this,arguments)}finally{$=T}}}})(Ho)),Ho}var cd;function sm(){return cd||(cd=1,Bo.exports=nm()),Bo.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 ud;function rm(){if(ud)return gt;ud=1;var a=ta(),l=sm();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,j=/^[: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]*$/,C={},S={};function $(e){return p.call(S,e)?!0:p.call(C,e)?!1:j.test(e)?S[e]=!0:(C[e]=!0,!1)}function D(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function H(e,t,s,r){if(t===null||typeof t>"u"||D(e,t,s,r))return!0;if(r)return!1;if(s!==null)switch(s.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 F(e,t,s,r,i,c,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=h}var I={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){I[e]=new F(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];I[t]=new F(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){I[e]=new F(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){I[e]=new F(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){I[e]=new F(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){I[e]=new F(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){I[e]=new F(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){I[e]=new F(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){I[e]=new F(e,5,!1,e.toLowerCase(),null,!1,!1)});var q=/[\-:]([a-z])/g;function G(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(q,G);I[t]=new F(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(q,G);I[t]=new F(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(q,G);I[t]=new F(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){I[e]=new F(e,1,!1,e.toLowerCase(),null,!1,!1)}),I.xlinkHref=new F("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){I[e]=new F(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,s,r){var i=I.hasOwnProperty(t)?I[t]:null;(i!==null?i.type!==0:r||!(2x||i[h]!==c[x]){var v=` `+i[h].replace(" at new "," at ");return e.displayName&&v.includes("")&&(v=v.replace("",e.displayName)),v}while(1<=h&&0<=x);break}}}finally{ie=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?L(e):""}function he(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ce(e.type,!1),e;case 11:return e=ce(e.type.render,!1),e;case 1:return e=ce(e.type,!0),e;default:return""}}function ve(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 fe:return"Fragment";case K:return"Portal";case b:return"Profiler";case pe:return"StrictMode";case _e:return"Suspense";case Ue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ee:return(e.displayName||"Context")+".Consumer";case ne:return(e._context.displayName||"Context")+".Provider";case je:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $e:return t=e.displayName||null,t!==null?t:ve(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return ve(e(t))}catch{}}return null}function ke(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 ve(t);case 8:return t===pe?"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 Ne(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function de(e){var t=U(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var i=s.get,c=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(h){r=""+h,c.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(h){r=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ot(e){e._valueTracker||(e._valueTracker=de(e))}function be(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=U(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function We(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 Le(e,t){var s=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Jn(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=Ne(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function nn(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Ql(e,t){nn(e,t);var s=Ne(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ql(e,t.type,s):t.hasOwnProperty("defaultValue")&&ql(e,t.type,Ne(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fa(e,t,s){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,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function ql(e,t,s){(t!=="number"||We(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ps=Array.isArray;function Xn(e,t,s,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Is(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Rs={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},Yd=["Webkit","ms","Moz","O"];Object.keys(Rs).forEach(function(e){Yd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rs[t]=Rs[e]})});function ya(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Rs.hasOwnProperty(e)&&Rs[e]?(""+t).trim():t+"px"}function wa(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,i=ya(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,i):e[s]=i}}var Zd=T({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 Xl(e,t){if(t){if(Zd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function Gl(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 Yl=null;function Zl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ei=null,Gn=null,Yn=null;function ja(e){if(e=er(e)){if(typeof ei!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Gr(t),ei(e.stateNode,e.type,t))}}function Na(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function ba(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,ja(e),t)for(e=0;e>>=0,e===0?32:31-(uh(e)/dh|0)|0}var Lr=64,Dr=4194304;function Ms(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 $r(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,c=e.pingedLanes,h=s&268435455;if(h!==0){var x=h&~i;x!==0?r=Ms(x):(c&=h,c!==0&&(r=Ms(c)))}else h=s&~i,h!==0?r=Ms(h):c!==0&&(r=Ms(c));if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,c=t&-t,i>=c||i===16&&(c&4194240)!==0))return t;if((r&4)!==0&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0s;s++)t.push(e);return t}function As(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=s}function ph(e,t){var s=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=Vs),Ga=" ",Ya=!1;function Za(e,t){switch(e){case"keyup":return Hh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function Vh(e,t){switch(e){case"compositionend":return ec(t);case"keypress":return t.which!==32?null:(Ya=!0,Ga);case"textInput":return e=t.data,e===Ga&&Ya?null:e;default:return null}}function Qh(e,t){if(ts)return e==="compositionend"||!vi&&Za(e,t)?(e=Va(),Ur=hi=an=null,ts=!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:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=oc(s)}}function cc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function uc(){for(var e=window,t=We();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=We(e.document)}return t}function ji(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 tf(e){var t=uc(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&cc(s.ownerDocument.documentElement,s)){if(r!==null&&ji(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=s.textContent.length,c=Math.min(r.start,i);r=r.end===void 0?c:Math.min(r.end,i),!e.extend&&c>r&&(i=r,r=c,c=i),i=ac(s,c);var h=ac(s,r);i&&h&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),c>r?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ns=null,Ni=null,Js=null,bi=!1;function dc(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bi||ns==null||ns!==We(r)||(r=ns,"selectionStart"in r&&ji(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}),Js&&Ks(Js,r)||(Js=r,r=Kr(Ni,"onSelect"),0os||(e.current=$i[os],$i[os]=null,os--)}function Pe(e,t){os++,$i[os]=e.current,e.current=t}var hn={},nt=dn(hn),dt=dn(!1),Pn=hn;function as(e,t){var s=e.type.contextTypes;if(!s)return hn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},c;for(c in s)i[c]=t[c];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ht(e){return e=e.childContextTypes,e!=null}function Yr(){Re(dt),Re(nt)}function Sc(e,t,s){if(nt.current!==hn)throw Error(o(168));Pe(nt,t),Pe(dt,s)}function Cc(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(o(108,ke(e)||"Unknown",i));return T({},s,r)}function Zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hn,Pn=nt.current,Pe(nt,e),Pe(dt,dt.current),!0}function Ec(e,t,s){var r=e.stateNode;if(!r)throw Error(o(169));s?(e=Cc(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,Re(dt),Re(nt),Pe(nt,e)):Re(dt),Pe(dt,s)}var Kt=null,el=!1,Mi=!1;function Tc(e){Kt===null?Kt=[e]:Kt.push(e)}function mf(e){el=!0,Tc(e)}function fn(){if(!Mi&&Kt!==null){Mi=!0;var e=0,t=Se;try{var s=Kt;for(Se=1;e>=h,i-=h,Jt=1<<32-It(t)+i|s<le?(Ze=re,re=null):Ze=re.sibling;var we=M(_,re,E[le],B);if(we===null){re===null&&(re=Ze);break}e&&re&&we.alternate===null&&t(_,re),w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we,re=Ze}if(le===E.length)return s(_,re),De&&Rn(_,le),ee;if(re===null){for(;lele?(Ze=re,re=null):Ze=re.sibling;var Nn=M(_,re,we.value,B);if(Nn===null){re===null&&(re=Ze);break}e&&re&&Nn.alternate===null&&t(_,re),w=c(Nn,w,le),se===null?ee=Nn:se.sibling=Nn,se=Nn,re=Ze}if(we.done)return s(_,re),De&&Rn(_,le),ee;if(re===null){for(;!we.done;le++,we=E.next())we=z(_,we.value,B),we!==null&&(w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we);return De&&Rn(_,le),ee}for(re=r(_,re);!we.done;le++,we=E.next())we=Q(re,_,le,we.value,B),we!==null&&(e&&we.alternate!==null&&re.delete(we.key===null?le:we.key),w=c(we,w,le),se===null?ee=we:se.sibling=we,se=we);return e&&re.forEach(function(Kf){return t(_,Kf)}),De&&Rn(_,le),ee}function Be(_,w,E,B){if(typeof E=="object"&&E!==null&&E.type===fe&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case O:e:{for(var ee=E.key,se=w;se!==null;){if(se.key===ee){if(ee=E.type,ee===fe){if(se.tag===7){s(_,se.sibling),w=i(se,E.props.children),w.return=_,_=w;break e}}else if(se.elementType===ee||typeof ee=="object"&&ee!==null&&ee.$$typeof===Te&&$c(ee)===se.type){s(_,se.sibling),w=i(se,E.props),w.ref=tr(_,se,E),w.return=_,_=w;break e}s(_,se);break}else t(_,se);se=se.sibling}E.type===fe?(w=Un(E.props.children,_.mode,B,E.key),w.return=_,_=w):(B=El(E.type,E.key,E.props,null,_.mode,B),B.ref=tr(_,w,E),B.return=_,_=B)}return h(_);case K:e:{for(se=E.key;w!==null;){if(w.key===se)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){s(_,w.sibling),w=i(w,E.children||[]),w.return=_,_=w;break e}else{s(_,w);break}else t(_,w);w=w.sibling}w=Do(E,_.mode,B),w.return=_,_=w}return h(_);case Te:return se=E._init,Be(_,w,se(E._payload),B)}if(Ps(E))return X(_,w,E,B);if(W(E))return Y(_,w,E,B);rl(_,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,w!==null&&w.tag===6?(s(_,w.sibling),w=i(w,E),w.return=_,_=w):(s(_,w),w=Lo(E,_.mode,B),w.return=_,_=w),h(_)):s(_,w)}return Be}var hs=Mc(!0),Ac=Mc(!1),ll=dn(null),il=null,fs=null,Bi=null;function Hi(){Bi=fs=il=null}function Wi(e){var t=ll.current;Re(ll),e._currentValue=t}function Vi(e,t,s){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===s)break;e=e.return}}function ms(e,t){il=e,Bi=fs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ft=!0),e.firstContext=null)}function St(e){var t=e._currentValue;if(Bi!==e)if(e={context:e,memoizedValue:t,next:null},fs===null){if(il===null)throw Error(o(308));fs=e,il.dependencies={lanes:0,firstContext:e}}else fs=fs.next=e;return t}var Ln=null;function Qi(e){Ln===null?Ln=[e]:Ln.push(e)}function zc(e,t,s,r){var i=t.interleaved;return i===null?(s.next=s,Qi(t)):(s.next=i.next,i.next=s),t.interleaved=s,Gt(e,r)}function Gt(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var mn=!1;function qi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oc(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 Yt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ye&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Gt(e,s)}return i=r.interleaved,i===null?(t.next=t,Qi(r)):(t.next=i.next,i.next=t),r.interleaved=t,Gt(e,s)}function ol(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}function Uc(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var i=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};c===null?i=c=h:c=c.next=h,s=s.next}while(s!==null);c===null?i=c=t:c=c.next=t}else i=c=t;s={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:c,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function al(e,t,s,r){var i=e.updateQueue;mn=!1;var c=i.firstBaseUpdate,h=i.lastBaseUpdate,x=i.shared.pending;if(x!==null){i.shared.pending=null;var v=x,P=v.next;v.next=null,h===null?c=P:h.next=P,h=v;var A=e.alternate;A!==null&&(A=A.updateQueue,x=A.lastBaseUpdate,x!==h&&(x===null?A.firstBaseUpdate=P:x.next=P,A.lastBaseUpdate=v))}if(c!==null){var z=i.baseState;h=0,A=P=v=null,x=c;do{var M=x.lane,Q=x.eventTime;if((r&M)===M){A!==null&&(A=A.next={eventTime:Q,lane:0,tag:x.tag,payload:x.payload,callback:x.callback,next:null});e:{var X=e,Y=x;switch(M=t,Q=s,Y.tag){case 1:if(X=Y.payload,typeof X=="function"){z=X.call(Q,z,M);break e}z=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=Y.payload,M=typeof X=="function"?X.call(Q,z,M):X,M==null)break e;z=T({},z,M);break e;case 2:mn=!0}}x.callback!==null&&x.lane!==0&&(e.flags|=64,M=i.effects,M===null?i.effects=[x]:M.push(x))}else Q={eventTime:Q,lane:M,tag:x.tag,payload:x.payload,callback:x.callback,next:null},A===null?(P=A=Q,v=z):A=A.next=Q,h|=M;if(x=x.next,x===null){if(x=i.shared.pending,x===null)break;M=x,x=M.next,M.next=null,i.lastBaseUpdate=M,i.shared.pending=null}}while(!0);if(A===null&&(v=z),i.baseState=v,i.firstBaseUpdate=P,i.lastBaseUpdate=A,t=i.shared.interleaved,t!==null){i=t;do h|=i.lane,i=i.next;while(i!==t)}else c===null&&(i.shared.lanes=0);Mn|=h,e.lanes=h,e.memoizedState=z}}function Fc(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;ts?s:4,e(!0);var r=Yi.transition;Yi.transition={};try{e(!1),t()}finally{Se=s,Yi.transition=r}}function iu(){return Ct().memoizedState}function vf(e,t,s){var r=yn(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},ou(e))au(t,s);else if(s=zc(e,t,s,r),s!==null){var i=ct();At(s,e,r,i),cu(s,t,r)}}function yf(e,t,s){var r=yn(e),i={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(ou(e))au(t,i);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,x=c(h,s);if(i.hasEagerState=!0,i.eagerState=x,Rt(x,h)){var v=t.interleaved;v===null?(i.next=i,Qi(t)):(i.next=v.next,v.next=i),t.interleaved=i;return}}catch{}finally{}s=zc(e,t,i,r),s!==null&&(i=ct(),At(s,e,r,i),cu(s,t,r))}}function ou(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function au(e,t){lr=dl=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function cu(e,t,s){if((s&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}var ml={readContext:St,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useInsertionEffect:st,useLayoutEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useMutableSource:st,useSyncExternalStore:st,useId:st,unstable_isNewReconciler:!1},wf={readContext:St,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Yc,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,hl(4194308,4,tu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return hl(4,2,e,t)},useMemo:function(e,t){var s=Ht();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=Ht();return t=s!==void 0?s(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=vf.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:Xc,useDebugValue:lo,useDeferredValue:function(e){return Ht().memoizedState=e},useTransition:function(){var e=Xc(!1),t=e[0];return e=gf.bind(null,e[1]),Ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=Ae,i=Ht();if(De){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),Ye===null)throw Error(o(349));($n&30)!==0||Vc(r,t,s)}i.memoizedState=s;var c={value:s,getSnapshot:t};return i.queue=c,Yc(qc.bind(null,r,c,e),[e]),r.flags|=2048,ar(9,Qc.bind(null,r,c,s,t),void 0,null),s},useId:function(){var e=Ht(),t=Ye.identifierPrefix;if(De){var s=Xt,r=Jt;s=(r&~(1<<32-It(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=h.createElement(s,{is:r.is}):(e=h.createElement(s),s==="select"&&(h=e,r.multiple?h.multiple=!0:r.size&&(h.size=r.size))):e=h.createElementNS(e,s),e[Ft]=t,e[Zs]=r,Tu(e,t,!1,!1),t.stateNode=e;e:{switch(h=Gl(s,r),s){case"dialog":Ie("cancel",e),Ie("close",e),i=r;break;case"iframe":case"object":case"embed":Ie("load",e),i=r;break;case"video":case"audio":for(i=0;iys&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304)}else{if(!r)if(e=cl(h),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),cr(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!De)return rt(t),null}else 2*Fe()-c.renderingStartTime>ys&&s!==1073741824&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304);c.isBackwards?(h.sibling=t.child,t.child=h):(s=c.last,s!==null?s.sibling=h:t.child=h,c.last=h)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Fe(),t.sibling=null,s=Me.current,Pe(Me,r?s&1|2:s&1),t):(rt(t),null);case 22:case 23:return Po(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(jt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Ef(e,t){switch(zi(t),t.tag){case 1:return ht(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ps(),Re(dt),Re(nt),Gi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(Re(Me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ds()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Me),null;case 4:return ps(),null;case 10:return Wi(t.type._context),null;case 22:case 23:return Po(),null;case 24:return null;default:return null}}var vl=!1,lt=!1,Tf=typeof WeakSet=="function"?WeakSet:Set,J=null;function gs(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Oe(e,t,r)}else s.current=null}function vo(e,t,s){try{s()}catch(r){Oe(e,t,r)}}var Ru=!1;function Pf(e,t){if(Ti=zr,e=uc(),ji(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var i=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{s.nodeType,c.nodeType}catch{s=null;break e}var h=0,x=-1,v=-1,P=0,A=0,z=e,M=null;t:for(;;){for(var Q;z!==s||i!==0&&z.nodeType!==3||(x=h+i),z!==c||r!==0&&z.nodeType!==3||(v=h+r),z.nodeType===3&&(h+=z.nodeValue.length),(Q=z.firstChild)!==null;)M=z,z=Q;for(;;){if(z===e)break t;if(M===s&&++P===i&&(x=h),M===c&&++A===r&&(v=h),(Q=z.nextSibling)!==null)break;z=M,M=z.parentNode}z=Q}s=x===-1||v===-1?null:{start:x,end:v}}else s=null}s=s||{start:0,end:0}}else s=null;for(Pi={focusedElem:e,selectionRange:s},zr=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var X=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(X!==null){var Y=X.memoizedProps,Be=X.memoizedState,_=t.stateNode,w=_.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Dt(t.type,Y),Be);_.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=t.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(B){Oe(t,t.return,B)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return X=Ru,Ru=!1,X}function ur(e,t,s){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var c=i.destroy;i.destroy=void 0,c!==void 0&&vo(t,s,c)}i=i.next}while(i!==r)}}function yl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function yo(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function Lu(e){var t=e.alternate;t!==null&&(e.alternate=null,Lu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ft],delete t[Zs],delete t[Di],delete t[hf],delete t[ff])),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 Du(e){return e.tag===5||e.tag===3||e.tag===4}function $u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Du(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 wo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Xr));else if(r!==4&&(e=e.child,e!==null))for(wo(e,t,s),e=e.sibling;e!==null;)wo(e,t,s),e=e.sibling}function jo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(jo(e,t,s),e=e.sibling;e!==null;)jo(e,t,s),e=e.sibling}var et=null,$t=!1;function xn(e,t,s){for(s=s.child;s!==null;)Mu(e,t,s),s=s.sibling}function Mu(e,t,s){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Rr,s)}catch{}switch(s.tag){case 5:lt||gs(s,t);case 6:var r=et,i=$t;et=null,xn(e,t,s),et=r,$t=i,et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):et.removeChild(s.stateNode));break;case 18:et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?Li(e.parentNode,s):e.nodeType===1&&Li(e,s),Bs(e)):Li(et,s.stateNode));break;case 4:r=et,i=$t,et=s.stateNode.containerInfo,$t=!0,xn(e,t,s),et=r,$t=i;break;case 0:case 11:case 14:case 15:if(!lt&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var c=i,h=c.destroy;c=c.tag,h!==void 0&&((c&2)!==0||(c&4)!==0)&&vo(s,t,h),i=i.next}while(i!==r)}xn(e,t,s);break;case 1:if(!lt&&(gs(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(x){Oe(s,t,x)}xn(e,t,s);break;case 21:xn(e,t,s);break;case 22:s.mode&1?(lt=(r=lt)||s.memoizedState!==null,xn(e,t,s),lt=r):xn(e,t,s);break;default:xn(e,t,s)}}function Au(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Tf),t.forEach(function(r){var i=Of.bind(null,e,r);s.has(r)||(s.add(r),r.then(i,i))})}}function Mt(e,t){var s=t.deletions;if(s!==null)for(var r=0;ri&&(i=h),r&=~c}if(r=i,r=Fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Rf(r/1960))-r,10e?16:e,vn===null)var r=!1;else{if(e=vn,vn=null,_l=0,(ye&6)!==0)throw Error(o(331));var i=ye;for(ye|=4,J=e.current;J!==null;){var c=J,h=c.child;if((J.flags&16)!==0){var x=c.deletions;if(x!==null){for(var v=0;vFe()-_o?zn(e,0):bo|=s),pt(e,t)}function Xu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Dr,Dr<<=1,(Dr&130023424)===0&&(Dr=4194304)));var s=ct();e=Gt(e,t),e!==null&&(As(e,t,s),pt(e,s))}function zf(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Xu(e,s)}function Of(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(s=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}r!==null&&r.delete(t),Xu(e,s)}var Gu;Gu=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||dt.current)ft=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return ft=!1,Sf(e,t,s);ft=(e.flags&131072)!==0}else ft=!1,De&&(t.flags&1048576)!==0&&Pc(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gl(e,t),e=t.pendingProps;var i=as(t,nt.current);ms(t,s),i=eo(null,t,r,e,i,s);var c=to();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(r)?(c=!0,Zr(t)):c=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,qi(t),i.updater=pl,t.stateNode=i,i._reactInternals=t,oo(t,r,e,s),t=ho(null,t,r,!0,c,s)):(t.tag=0,De&&c&&Ai(t),at(null,t,i,s),t=t.child),t;case 16:r=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Ff(r),e=Dt(r,e),i){case 0:t=uo(null,t,r,e,s);break e;case 1:t=bu(null,t,r,e,s);break e;case 11:t=vu(null,t,r,e,s);break e;case 14:t=yu(null,t,r,Dt(r.type,e),s);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),uo(e,t,r,i,s);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),bu(e,t,r,i,s);case 3:e:{if(_u(t),e===null)throw Error(o(387));r=t.pendingProps,c=t.memoizedState,i=c.element,Oc(e,t),al(t,r,null,s);var h=t.memoizedState;if(r=h.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){i=xs(Error(o(423)),t),t=ku(e,t,r,s,i);break e}else if(r!==i){i=xs(Error(o(424)),t),t=ku(e,t,r,s,i);break e}else for(wt=un(t.stateNode.containerInfo.firstChild),yt=t,De=!0,Lt=null,s=Ac(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ds(),r===i){t=Zt(e,t,s);break e}at(e,t,r,s)}t=t.child}return t;case 5:return Bc(t),e===null&&Ui(t),r=t.type,i=t.pendingProps,c=e!==null?e.memoizedProps:null,h=i.children,Ii(r,i)?h=null:c!==null&&Ii(r,c)&&(t.flags|=32),Nu(e,t),at(e,t,h,s),t.child;case 6:return e===null&&Ui(t),null;case 13:return Su(e,t,s);case 4:return Ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hs(t,null,r,s):at(e,t,r,s),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),vu(e,t,r,i,s);case 7:return at(e,t,t.pendingProps,s),t.child;case 8:return at(e,t,t.pendingProps.children,s),t.child;case 12:return at(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,c=t.memoizedProps,h=i.value,Pe(ll,r._currentValue),r._currentValue=h,c!==null)if(Rt(c.value,h)){if(c.children===i.children&&!dt.current){t=Zt(e,t,s);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var x=c.dependencies;if(x!==null){h=c.child;for(var v=x.firstContext;v!==null;){if(v.context===r){if(c.tag===1){v=Yt(-1,s&-s),v.tag=2;var P=c.updateQueue;if(P!==null){P=P.shared;var A=P.pending;A===null?v.next=v:(v.next=A.next,A.next=v),P.pending=v}}c.lanes|=s,v=c.alternate,v!==null&&(v.lanes|=s),Vi(c.return,s,t),x.lanes|=s;break}v=v.next}}else if(c.tag===10)h=c.type===t.type?null:c.child;else if(c.tag===18){if(h=c.return,h===null)throw Error(o(341));h.lanes|=s,x=h.alternate,x!==null&&(x.lanes|=s),Vi(h,s,t),h=c.sibling}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===t){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}at(e,t,i.children,s),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ms(t,s),i=St(i),r=r(i),t.flags|=1,at(e,t,r,s),t.child;case 14:return r=t.type,i=Dt(r,t.pendingProps),i=Dt(r.type,i),yu(e,t,r,i,s);case 15:return wu(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),gl(e,t),t.tag=1,ht(r)?(e=!0,Zr(t)):e=!1,ms(t,s),du(t,r,i),oo(t,r,i,s),ho(null,t,r,!0,e,s);case 19:return Eu(e,t,s);case 22:return ju(e,t,s)}throw Error(o(156,t.tag))};function Yu(e,t){return Ia(e,t)}function Uf(e,t,s,r){this.tag=e,this.key=s,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 Tt(e,t,s,r){return new Uf(e,t,s,r)}function Ro(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ff(e){if(typeof e=="function")return Ro(e)?1:0;if(e!=null){if(e=e.$$typeof,e===je)return 11;if(e===$e)return 14}return 2}function jn(e,t){var s=e.alternate;return s===null?(s=Tt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function El(e,t,s,r,i,c){var h=2;if(r=e,typeof e=="function")Ro(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case fe:return Un(s.children,i,c,t);case pe:h=8,i|=8;break;case b:return e=Tt(12,s,t,i|2),e.elementType=b,e.lanes=c,e;case _e:return e=Tt(13,s,t,i),e.elementType=_e,e.lanes=c,e;case Ue:return e=Tt(19,s,t,i),e.elementType=Ue,e.lanes=c,e;case V:return Tl(s,i,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ne:h=10;break e;case Ee:h=9;break e;case je:h=11;break e;case $e:h=14;break e;case Te:h=16,r=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Tt(h,s,t,i),t.elementType=e,t.type=r,t.lanes=c,t}function Un(e,t,s,r){return e=Tt(7,e,r,t),e.lanes=s,e}function Tl(e,t,s,r){return e=Tt(22,e,r,t),e.elementType=V,e.lanes=s,e.stateNode={isHidden:!1},e}function Lo(e,t,s){return e=Tt(6,e,null,t),e.lanes=s,e}function Do(e,t,s){return t=Tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bf(e,t,s,r,i){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=ii(0),this.expirationTimes=ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ii(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $o(e,t,s,r,i,c,h,x,v){return e=new Bf(e,t,s,x,v),t===1?(t=1,c===!0&&(t|=8)):t=0,c=Tt(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qi(c),e}function Hf(e,t,s){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Fo.exports=rm(),Fo.exports}var hd;function lm(){if(hd)return Ml;hd=1;var a=Pd();return Ml.createRoot=a.createRoot,Ml.hydrateRoot=a.hydrateRoot,Ml}var im=lm();const om=Td(im);Pd();/** * @remix-run/router v1.23.4 * * 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 */function vr(){return vr=Object.assign?Object.assign.bind():function(a){for(var l=1;l"u")throw new Error(l)}function Id(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function cm(){return Math.random().toString(36).substr(2,8)}function md(a,l){return{usr:a.state,key:a.key,idx:l}}function qo(a,l,o,u){return o===void 0&&(o=null),vr({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof l=="string"?Es(l):l,{state:o,key:l&&l.key||u||cm()})}function zl(a){let{pathname:l="/",search:o="",hash:u=""}=a;return o&&o!=="?"&&(l+=o.charAt(0)==="?"?o:"?"+o),u&&u!=="#"&&(l+=u.charAt(0)==="#"?u:"#"+u),l}function Es(a){let l={};if(a){let o=a.indexOf("#");o>=0&&(l.hash=a.substr(o),a=a.substr(0,o));let u=a.indexOf("?");u>=0&&(l.search=a.substr(u),a=a.substr(0,u)),a&&(l.pathname=a)}return l}function um(a,l,o,u){u===void 0&&(u={});let{window:d=document.defaultView,v5Compat:f=!1}=u,m=d.history,y=bn.Pop,p=null,j=C();j==null&&(j=0,m.replaceState(vr({},m.state,{idx:j}),""));function C(){return(m.state||{idx:null}).idx}function S(){y=bn.Pop;let I=C(),q=I==null?null:I-j;j=I,p&&p({action:y,location:F.location,delta:q})}function $(I,q){y=bn.Push;let G=qo(F.location,I,q);j=C()+1;let Z=md(G,j),te=F.createHref(G);try{m.pushState(Z,"",te)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;d.location.assign(te)}f&&p&&p({action:y,location:F.location,delta:1})}function D(I,q){y=bn.Replace;let G=qo(F.location,I,q);j=C();let Z=md(G,j),te=F.createHref(G);m.replaceState(Z,"",te),f&&p&&p({action:y,location:F.location,delta:0})}function H(I){let q=d.location.origin!=="null"?d.location.origin:d.location.href,G=typeof I=="string"?I:zl(I);return G=G.replace(/ $/,"%20"),He(q,"No window.location.(origin|href) available to create URL for href: "+G),new URL(G,q)}let F={get action(){return y},get location(){return a(d,m)},listen(I){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(fd,S),p=I,()=>{d.removeEventListener(fd,S),p=null}},createHref(I){return l(d,I)},createURL:H,encodeLocation(I){let q=H(I);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:$,replace:D,go(I){return m.go(I)}};return F}var pd;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(pd||(pd={}));function dm(a,l,o){return o===void 0&&(o="/"),hm(a,l,o)}function hm(a,l,o,u){let d=typeof l=="string"?Es(l):l,f=sa(d.pathname||"/",o);if(f==null)return null;let m=Rd(a);fm(m);let y=null,p=km(f);for(let j=0;y==null&&j{let p={relativePath:y===void 0?f.path||"":y,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};p.relativePath.startsWith("/")&&(He(p.relativePath.startsWith(u),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(u.length));let j=_n([u,p.relativePath]),C=o.concat(p);f.children&&f.children.length>0&&(He(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+j+'".')),Rd(f.children,l,C,j)),!(f.path==null&&!f.index)&&l.push({path:j,score:wm(j,f.index),routesMeta:C})};return a.forEach((f,m)=>{var y;if(f.path===""||!((y=f.path)!=null&&y.includes("?")))d(f,m);else for(let p of Ld(f.path))d(f,m,p)}),l}function Ld(a){let l=a.split("/");if(l.length===0)return[];let[o,...u]=l,d=o.endsWith("?"),f=o.replace(/\?$/,"");if(u.length===0)return d?[f,""]:[f];let m=Ld(u.join("/")),y=[];return y.push(...m.map(p=>p===""?f:[f,p].join("/"))),d&&y.push(...m),y.map(p=>a.startsWith("/")&&p===""?"/":p)}function fm(a){a.sort((l,o)=>l.score!==o.score?o.score-l.score:jm(l.routesMeta.map(u=>u.childrenIndex),o.routesMeta.map(u=>u.childrenIndex)))}const mm=/^:[\w-]+$/,pm=3,xm=2,gm=1,vm=10,ym=-2,xd=a=>a==="*";function wm(a,l){let o=a.split("/"),u=o.length;return o.some(xd)&&(u+=ym),l&&(u+=xm),o.filter(d=>!xd(d)).reduce((d,f)=>d+(mm.test(f)?pm:f===""?gm:vm),u)}function jm(a,l){return a.length===l.length&&a.slice(0,-1).every((u,d)=>u===l[d])?a[a.length-1]-l[l.length-1]:0}function Nm(a,l,o){let{routesMeta:u}=a,d={},f="/",m=[];for(let y=0;y{let{paramName:$,isOptional:D}=C;if($==="*"){let F=y[S]||"";m=f.slice(0,f.length-F.length).replace(/(.)\/+$/,"$1")}const H=y[S];return D&&!H?j[$]=void 0:j[$]=(H||"").replace(/%2F/g,"/"),j},{}),pathname:f,pathnameBase:m,pattern:a}}function _m(a,l,o){l===void 0&&(l=!1),o===void 0&&(o=!0),Id(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let u=[],d="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,y,p)=>(u.push({paramName:y,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(u.push({paramName:"*"}),d+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?d+="\\/*$":a!==""&&a!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,l?void 0:"i"),u]}function km(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Id(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+l+").")),a}}function sa(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,u=a.charAt(o);return u&&u!=="/"?null:a.slice(o)||"/"}function Sm(a,l){l===void 0&&(l="/");let{pathname:o,search:u="",hash:d=""}=typeof a=="string"?Es(a):a,f;return o?(o=Dd(o),o.startsWith("/")?f=gd(o.substring(1),"/"):f=gd(o,l)):f=l,{pathname:f,search:Tm(u),hash:Pm(d)}}function gd(a,l){let o=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(d=>{d===".."?o.length>1&&o.pop():d!=="."&&o.push(d)}),o.length>1?o.join("/"):"/"}function Wo(a,l,o,u){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+o+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Cm(a){return a.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function ra(a,l){let o=Cm(a);return l?o.map((u,d)=>d===o.length-1?u.pathname:u.pathnameBase):o.map(u=>u.pathnameBase)}function la(a,l,o,u){u===void 0&&(u=!1);let d;typeof a=="string"?d=Es(a):(d=vr({},a),He(!d.pathname||!d.pathname.includes("?"),Wo("?","pathname","search",d)),He(!d.pathname||!d.pathname.includes("#"),Wo("#","pathname","hash",d)),He(!d.search||!d.search.includes("#"),Wo("#","search","hash",d)));let f=a===""||d.pathname==="",m=f?"/":d.pathname,y;if(m==null)y=o;else{let S=l.length-1;if(!u&&m.startsWith("..")){let $=m.split("/");for(;$[0]==="..";)$.shift(),S-=1;d.pathname=$.join("/")}y=S>=0?l[S]:"/"}let p=Sm(d,y),j=m&&m!=="/"&&m.endsWith("/"),C=(f||m===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(j||C)&&(p.pathname+="/"),p}const Dd=a=>a.replace(/\/\/+/g,"/"),_n=a=>Dd(a.join("/")),Em=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Tm=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Pm=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Im(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const $d=["post","put","patch","delete"];new Set($d);const Rm=["get",...$d];new Set(Rm);/** * React Router v6.30.6 * * 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 */function yr(){return yr=Object.assign?Object.assign.bind():function(a){for(var l=1;l{y.current=!0}),g.useCallback(function(j,C){if(C===void 0&&(C={}),!y.current)return;if(typeof j=="number"){u.go(j);return}let S=la(j,JSON.parse(m),f,C.relative==="path");a==null&&l!=="/"&&(S.pathname=S.pathname==="/"?l:_n([l,S.pathname])),(C.replace?u.replace:u.push)(S,C.state,C)},[l,u,m,f,a])}const Mm=g.createContext(null);function Am(a){let l=g.useContext(tn).outlet;return l&&g.createElement(Mm.Provider,{value:a},l)}function zd(a,l){let{relative:o}=l===void 0?{}:l,{future:u}=g.useContext(Cn),{matches:d}=g.useContext(tn),{pathname:f}=qn(),m=JSON.stringify(ra(d,u.v7_relativeSplatPath));return g.useMemo(()=>la(a,JSON.parse(m),f,o==="path"),[a,m,f,o])}function zm(a,l){return Om(a,l)}function Om(a,l,o,u){Ts()||He(!1);let{navigator:d}=g.useContext(Cn),{matches:f}=g.useContext(tn),m=f[f.length-1],y=m?m.params:{};m&&m.pathname;let p=m?m.pathnameBase:"/";m&&m.route;let j=qn(),C;if(l){var S;let I=typeof l=="string"?Es(l):l;p==="/"||(S=I.pathname)!=null&&S.startsWith(p)||He(!1),C=I}else C=j;let $=C.pathname||"/",D=$;if(p!=="/"){let I=p.replace(/^\//,"").split("/");D="/"+$.replace(/^\//,"").split("/").slice(I.length).join("/")}let H=dm(a,{pathname:D}),F=Wm(H&&H.map(I=>Object.assign({},I,{params:Object.assign({},y,I.params),pathname:_n([p,d.encodeLocation?d.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?p:_n([p,d.encodeLocation?d.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),f,o,u);return l&&F?g.createElement(Hl.Provider,{value:{location:yr({pathname:"/",search:"",hash:"",state:null,key:"default"},C),navigationType:bn.Pop}},F):F}function Um(){let a=Km(),l=Im(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),o=a instanceof Error?a.stack:null,d={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},l),o?g.createElement("pre",{style:d},o):null,null)}const Fm=g.createElement(Um,null);class Bm extends g.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,o){return o.location!==l.location||o.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:o.error,location:o.location,revalidation:l.revalidation||o.revalidation}}componentDidCatch(l,o){console.error("React Router caught the following error during render",l,o)}render(){return this.state.error!==void 0?g.createElement(tn.Provider,{value:this.props.routeContext},g.createElement(Md.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Hm(a){let{routeContext:l,match:o,children:u}=a,d=g.useContext(ia);return d&&d.static&&d.staticContext&&(o.route.errorElement||o.route.ErrorBoundary)&&(d.staticContext._deepestRenderedBoundaryId=o.route.id),g.createElement(tn.Provider,{value:l},u)}function Wm(a,l,o,u){var d;if(l===void 0&&(l=[]),o===void 0&&(o=null),u===void 0&&(u=null),a==null){var f;if(!o)return null;if(o.errors)a=o.matches;else if((f=u)!=null&&f.v7_partialHydration&&l.length===0&&!o.initialized&&o.matches.length>0)a=o.matches;else return null}let m=a,y=(d=o)==null?void 0:d.errors;if(y!=null){let C=m.findIndex(S=>S.route.id&&(y==null?void 0:y[S.route.id])!==void 0);C>=0||He(!1),m=m.slice(0,Math.min(m.length,C+1))}let p=!1,j=-1;if(o&&u&&u.v7_partialHydration)for(let C=0;C=0?m=m.slice(0,j+1):m=[m[0]];break}}}return m.reduceRight((C,S,$)=>{let D,H=!1,F=null,I=null;o&&(D=y&&S.route.id?y[S.route.id]:void 0,F=S.route.errorElement||Fm,p&&(j<0&&$===0?(Xm("route-fallback"),H=!0,I=null):j===$&&(H=!0,I=S.route.hydrateFallbackElement||null)));let q=l.concat(m.slice(0,$+1)),G=()=>{let Z;return D?Z=F:H?Z=I:S.route.Component?Z=g.createElement(S.route.Component,null):S.route.element?Z=S.route.element:Z=C,g.createElement(Hm,{match:S,routeContext:{outlet:C,matches:q,isDataRoute:o!=null},children:Z})};return o&&(S.route.ErrorBoundary||S.route.errorElement||$===0)?g.createElement(Bm,{location:o.location,revalidation:o.revalidation,component:F,error:D,children:G(),routeContext:{outlet:null,matches:q,isDataRoute:!0}}):G()},null)}var Od=(function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a})(Od||{}),Ud=(function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a})(Ud||{});function Vm(a){let l=g.useContext(ia);return l||He(!1),l}function Qm(a){let l=g.useContext(Lm);return l||He(!1),l}function qm(a){let l=g.useContext(tn);return l||He(!1),l}function Fd(a){let l=qm(),o=l.matches[l.matches.length-1];return o.route.id||He(!1),o.route.id}function Km(){var a;let l=g.useContext(Md),o=Qm(),u=Fd();return l!==void 0?l:(a=o.errors)==null?void 0:a[u]}function Jm(){let{router:a}=Vm(Od.UseNavigateStable),l=Fd(Ud.UseNavigateStable),o=g.useRef(!1);return Ad(()=>{o.current=!0}),g.useCallback(function(d,f){f===void 0&&(f={}),o.current&&(typeof d=="number"?a.navigate(d):a.navigate(d,yr({fromRouteId:l},f)))},[a,l])}const vd={};function Xm(a,l,o){vd[a]||(vd[a]=!0)}function Gm(a,l){a==null||a.v7_startTransition,a==null||a.v7_relativeSplatPath}function Vt(a){let{to:l,replace:o,state:u,relative:d}=a;Ts()||He(!1);let{future:f,static:m}=g.useContext(Cn),{matches:y}=g.useContext(tn),{pathname:p}=qn(),j=Wl(),C=la(l,ra(y,f.v7_relativeSplatPath),p,d==="path"),S=JSON.stringify(C);return g.useEffect(()=>j(JSON.parse(S),{replace:o,state:u,relative:d}),[j,S,d,o,u]),null}function Bd(a){return Am(a.context)}function Qe(a){He(!1)}function Ym(a){let{basename:l="/",children:o=null,location:u,navigationType:d=bn.Pop,navigator:f,static:m=!1,future:y}=a;Ts()&&He(!1);let p=l.replace(/^\/*/,"/"),j=g.useMemo(()=>({basename:p,navigator:f,static:m,future:yr({v7_relativeSplatPath:!1},y)}),[p,y,f,m]);typeof u=="string"&&(u=Es(u));let{pathname:C="/",search:S="",hash:$="",state:D=null,key:H="default"}=u,F=g.useMemo(()=>{let I=sa(C,p);return I==null?null:{location:{pathname:I,search:S,hash:$,state:D,key:H},navigationType:d}},[p,C,S,$,D,H,d]);return F==null?null:g.createElement(Cn.Provider,{value:j},g.createElement(Hl.Provider,{children:o,value:F}))}function Zm(a){let{children:l,location:o}=a;return zm(Ko(l),o)}new Promise(()=>{});function Ko(a,l){l===void 0&&(l=[]);let o=[];return g.Children.forEach(a,(u,d)=>{if(!g.isValidElement(u))return;let f=[...l,d];if(u.type===g.Fragment){o.push.apply(o,Ko(u.props.children,f));return}u.type!==Qe&&He(!1),!u.props.index||!u.props.children||He(!1);let m={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(m.children=Ko(u.props.children,f)),o.push(m)}),o}/** * React Router DOM v6.30.6 * * 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 */function Jo(){return Jo=Object.assign?Object.assign.bind():function(a){for(var l=1;l{let u=a[o];return l.concat(Array.isArray(u)?u.map(d=>[o,d]):[[o,u]])},[]))}function sp(a,l){let o=Xo(a);return l&&l.forEach((u,d)=>{o.has(d)||l.getAll(d).forEach(f=>{o.append(d,f)})}),o}const rp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],lp="6";try{window.__reactRouterVersion=lp}catch{}const ip="startTransition",yd=tm[ip];function op(a){let{basename:l,children:o,future:u,window:d}=a,f=g.useRef();f.current==null&&(f.current=am({window:d,v5Compat:!0}));let m=f.current,[y,p]=g.useState({action:m.action,location:m.location}),{v7_startTransition:j}=u||{},C=g.useCallback(S=>{j&&yd?yd(()=>p(S)):p(S)},[p,j]);return g.useLayoutEffect(()=>m.listen(C),[m,C]),g.useEffect(()=>Gm(u),[u]),g.createElement(Ym,{basename:l,children:o,location:y.location,navigationType:y.action,navigator:m,future:u})}const ap=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ge=g.forwardRef(function(l,o){let{onClick:u,relative:d,reloadDocument:f,replace:m,state:y,target:p,to:j,preventScrollReset:C,viewTransition:S}=l,$=ep(l,rp),{basename:D}=g.useContext(Cn),H,F=!1;if(typeof j=="string"&&cp.test(j)&&(H=j,ap))try{let Z=new URL(window.location.href),te=j.startsWith("//")?new URL(Z.protocol+j):new URL(j),O=sa(te.pathname,D);te.origin===Z.origin&&O!=null?j=O+te.search+te.hash:F=!0}catch{}let I=Dm(j,{relative:d}),q=up(j,{replace:m,state:y,target:p,preventScrollReset:C,relative:d,viewTransition:S});function G(Z){u&&u(Z),Z.defaultPrevented||q(Z)}return g.createElement("a",Jo({},$,{href:H||I,onClick:F||f?u:G,ref:o,target:p}))});var wd;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(wd||(wd={}));var jd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(jd||(jd={}));function up(a,l){let{target:o,replace:u,state:d,preventScrollReset:f,relative:m,viewTransition:y}=l===void 0?{}:l,p=Wl(),j=qn(),C=zd(a,{relative:m});return g.useCallback(S=>{if(np(S,o)){S.preventDefault();let $=u!==void 0?u:zl(j)===zl(C);p(a,{replace:$,state:d,preventScrollReset:f,relative:m,viewTransition:y})}},[j,p,C,u,d,o,a,f,m,y])}function dp(a){let l=g.useRef(Xo(a)),o=g.useRef(!1),u=qn(),d=g.useMemo(()=>sp(u.search,o.current?null:l.current),[u.search]),f=Wl(),m=g.useCallback((y,p)=>{const j=Xo(typeof y=="function"?y(d):y);o.current=!0,f("?"+j,p)},[f,d]);return[d,m]}class hp{constructor(){xt(this,"listeners",new Set);xt(this,"isTerminated",!1)}subscribe(l){return this.listeners.add(l),()=>this.listeners.delete(l)}notifySessionExpired(l="登录已过期,请重新登录"){this.isTerminated||(this.isTerminated=!0,this.listeners.forEach(o=>{try{o(l)}catch(u){console.error("Error in session expired listener",u)}}))}reset(){this.isTerminated=!1}}const Ns=new hp,Hd="/api";function Ss(){return localStorage.getItem("classnotify_token")}function fp(a){localStorage.setItem("classnotify_token",a)}function xr(){localStorage.removeItem("classnotify_token"),localStorage.removeItem("classnotify_user")}async function xe(a,l={}){const o=Ss(),u={"Content-Type":"application/json",...l.headers};o&&(u.Authorization=`Bearer ${o}`);const d=await fetch(`${Hd}${a}`,{...l,headers:u});if(d.status===401)throw xr(),Ns.notifySessionExpired("未授权或登录已过期,请重新登录"),new Error("未授权或登录已过期,请重新登录");if(!d.ok){let f=`请求失败 (${d.status})`;try{const m=await d.json();f=m.message||m.errorMessage||f}catch{}throw new Error(f)}return d.json()}const oe={login:(a,l)=>xe("/auth/login",{method:"POST",body:JSON.stringify({username:a,password:l})}),getMe:()=>xe("/auth/me"),getAdminMetrics:()=>xe("/admin/metrics"),getTenants:()=>xe("/admin/tenants"),getAllDevices:()=>xe("/admin/devices"),sendDeviceCommand:(a,l,o)=>xe(`/admin/devices/${a}/command`,{method:"POST",body:JSON.stringify({command:l,parameters:o})}),getAdminActivationCodes:()=>xe("/admin/activation-codes"),getAdminClasses:a=>xe(`/admin/classes?tenantId=${encodeURIComponent(a)}`),generateAdminCode:(a,l)=>xe(`/admin/activation-codes?tenantId=${encodeURIComponent(a)}&classId=${encodeURIComponent(l)}`,{method:"POST"}),getAdminNotifications:(a=50)=>xe(`/admin/notifications?limit=${a}`),createTenant:a=>xe("/admin/tenants",{method:"POST",body:JSON.stringify(a)}),updateTenant:(a,l)=>xe(`/admin/tenants/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),getUsers:(a,l)=>{const o=new URLSearchParams;a&&o.append("tenantId",a),l&&o.append("role",l);const u=o.toString();return xe(`/admin/users${u?`?${u}`:""}`)},createUser:a=>xe("/admin/users",{method:"POST",body:JSON.stringify(a)}),resetPassword:(a,l)=>xe(`/admin/users/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setUserLock:(a,l)=>xe(`/admin/users/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),deleteUser:a=>xe(`/admin/users/${encodeURIComponent(a)}`,{method:"DELETE"}),updateDevice:(a,l)=>xe(`/admin/devices/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),decommissionDevice:a=>xe(`/admin/devices/${encodeURIComponent(a)}/decommission`,{method:"POST"}),deleteActivationCode:a=>xe(`/admin/activation-codes/${encodeURIComponent(a)}`,{method:"DELETE"}),sendEmergencyBroadcast:a=>xe("/admin/broadcasts",{method:"POST",body:JSON.stringify(a)}),getSystemHealth:()=>xe("/admin/system/health"),getAuditLogs:(a=100)=>xe(`/admin/audit-logs?limit=${a}`),getSchoolOverview:()=>xe("/school-admin/overview"),getSchoolClasses:()=>xe("/school-admin/classes"),createSchoolClass:a=>xe("/school-admin/classes",{method:"POST",body:JSON.stringify(a)}),getSchoolTeachers:()=>xe("/school-admin/teachers"),createSchoolTeacher:a=>xe("/school-admin/teachers",{method:"POST",body:JSON.stringify(a)}),resetSchoolTeacherPassword:(a,l)=>xe(`/school-admin/teachers/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setSchoolTeacherLock:(a,l)=>xe(`/school-admin/teachers/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),getSchoolDevices:()=>xe("/school-admin/devices"),getSchoolCodes:()=>xe("/school-admin/activation-codes"),generateSchoolCode:a=>xe(`/school-admin/activation-codes?classId=${encodeURIComponent(a)}`,{method:"POST"}),getTeacherClasses:()=>xe("/notification/classes"),sendNotification:a=>xe("/notification/send",{method:"POST",body:JSON.stringify(a)}),cancelNotification:a=>xe(`/notifications/${encodeURIComponent(a)}/cancel`,{method:"POST"}),getTeacherHistory:(a,l=50)=>xe(`/notification/history?${a?`classId=${encodeURIComponent(a)}&`:""}limit=${l}`),getVisualReceiptBlob:async(a,l)=>{const o=Ss(),u=await fetch(`${Hd}/notifications/${encodeURIComponent(a)}/receipts/${encodeURIComponent(l)}/visual-receipt`,{headers:o?{Authorization:`Bearer ${o}`}:{}});if(u.status===410)throw new Error("视觉回执已按24小时保存策略自动销毁");if(u.status===404)throw new Error("未找到该通知的视觉回执");if(!u.ok)throw new Error(`获取视觉回执失败 (${u.status})`);return u.blob()}};class Fn extends Error{constructor(l,o){const u=new.target.prototype;super(`${l}: Status code '${o}'`),this.statusCode=o,this.__proto__=u}}class oa extends Error{constructor(l="A timeout occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class zt extends Error{constructor(l="An abort occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class mp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="UnsupportedTransportError",this.__proto__=u}}class pp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="DisabledTransportError",this.__proto__=u}}class xp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="FailedToStartTransportError",this.__proto__=u}}class Nd extends Error{constructor(l){const o=new.target.prototype;super(l),this.errorType="FailedToNegotiateWithServerError",this.__proto__=o}}class gp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.innerErrors=o,this.__proto__=u}}class Wd{constructor(l,o,u){this.statusCode=l,this.statusText=o,this.content=u}}class Vl{get(l,o){return this.send({...o,method:"GET",url:l})}post(l,o){return this.send({...o,method:"POST",url:l})}delete(l,o){return this.send({...o,method:"DELETE",url:l})}getCookieString(l){return""}}var R;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(R||(R={}));class wr{constructor(){}log(l,o){}}wr.instance=new wr;const vp="8.0.29";class qe{static isRequired(l,o){if(l==null)throw new Error(`The '${o}' argument is required.`)}static isNotEmpty(l,o){if(!l||l.match(/^\s*$/))throw new Error(`The '${o}' argument should not be empty.`)}static isIn(l,o,u){if(!(l in o))throw new Error(`Unknown ${u} value: ${l}.`)}}class ze{static get isBrowser(){return!ze.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!ze.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!ze.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function jr(a,l){let o="";return Wn(a)?(o=`Binary data of length ${a.byteLength}`,l&&(o+=`. Content: '${yp(a)}'`)):typeof a=="string"&&(o=`String data of length ${a.length}`,l&&(o+=`. Content: '${a}'`)),o}function yp(a){const l=new Uint8Array(a);let o="";return l.forEach(u=>{const d=u<16?"0":"";o+=`0x${d}${u.toString(16)} `}),o.substr(0,o.length-1)}function Wn(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function Vd(a,l,o,u,d,f){const m={},[y,p]=Cs();m[y]=p,a.log(R.Trace,`(${l} transport) sending data. ${jr(d,f.logMessageContent)}.`);const j=Wn(d)?"arraybuffer":"text",C=await o.post(u,{content:d,headers:{...m,...f.headers},responseType:j,timeout:f.timeout,withCredentials:f.withCredentials});a.log(R.Trace,`(${l} transport) request complete. Response status: ${C.statusCode}.`)}function wp(a){return a===void 0?new Ol(R.Information):a===null?wr.instance:a.log!==void 0?a:new Ol(a)}class jp{constructor(l,o){this._subject=l,this._observer=o}dispose(){const l=this._subject.observers.indexOf(this._observer);l>-1&&this._subject.observers.splice(l,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(o=>{})}}class Ol{constructor(l){this._minLevel=l,this.out=console}log(l,o){if(l>=this._minLevel){const u=`[${new Date().toISOString()}] ${R[l]}: ${o}`;switch(l){case R.Critical:case R.Error:this.out.error(u);break;case R.Warning:this.out.warn(u);break;case R.Information:this.out.info(u);break;default:this.out.log(u);break}}}}function Cs(){let a="X-SignalR-User-Agent";return ze.isNode&&(a="User-Agent"),[a,Np(vp,bp(),kp(),_p())]}function Np(a,l,o,u){let d="Microsoft SignalR/";const f=a.split(".");return d+=`${f[0]}.${f[1]}`,d+=` (${a}; `,l&&l!==""?d+=`${l}; `:d+="Unknown OS; ",d+=`${o}`,u?d+=`; ${u}`:d+="; Unknown Runtime Version",d+=")",d}function bp(){if(ze.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function _p(){if(ze.isNode)return process.versions.node}function kp(){return ze.isNode?"NodeJS":"Browser"}function Vo(a){return a.stack?a.stack:a.message?a.message:`${a}`}function Sp(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Cp extends Vl{constructor(l){if(super(),this._logger=l,typeof fetch>"u"||ze.isNode){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(o("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=o("node-fetch"):this._fetchType=fetch,this._fetchType=o("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Sp());if(typeof AbortController>"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=o("abort-controller")}else this._abortControllerType=AbortController}async send(l){if(l.abortSignal&&l.abortSignal.aborted)throw new zt;if(!l.method)throw new Error("No method defined.");if(!l.url)throw new Error("No url defined.");const o=new this._abortControllerType;let u;l.abortSignal&&(l.abortSignal.onabort=()=>{o.abort(),u=new zt});let d=null;if(l.timeout){const p=l.timeout;d=setTimeout(()=>{o.abort(),this._logger.log(R.Warning,"Timeout from HTTP request."),u=new oa},p)}l.content===""&&(l.content=void 0),l.content&&(l.headers=l.headers||{},Wn(l.content)?l.headers["Content-Type"]="application/octet-stream":l.headers["Content-Type"]="text/plain;charset=UTF-8");let f;try{f=await this._fetchType(l.url,{body:l.content,cache:"no-cache",credentials:l.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...l.headers},method:l.method,mode:"cors",redirect:"follow",signal:o.signal})}catch(p){throw u||(this._logger.log(R.Warning,`Error from HTTP request. ${p}.`),p)}finally{d&&clearTimeout(d),l.abortSignal&&(l.abortSignal.onabort=null)}if(!f.ok){const p=await bd(f,"text");throw new Fn(p||f.statusText,f.status)}const y=await bd(f,l.responseType);return new Wd(f.status,f.statusText,y)}getCookieString(l){let o="";return ze.isNode&&this._jar&&this._jar.getCookies(l,(u,d)=>o=d.join("; ")),o}}function bd(a,l){let o;switch(l){case"arraybuffer":o=a.arrayBuffer();break;case"text":o=a.text();break;case"blob":case"document":case"json":throw new Error(`${l} is not supported.`);default:o=a.text();break}return o}class Ep extends Vl{constructor(l){super(),this._logger=l}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?new Promise((o,u)=>{const d=new XMLHttpRequest;d.open(l.method,l.url,!0),d.withCredentials=l.withCredentials===void 0?!0:l.withCredentials,d.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.content===""&&(l.content=void 0),l.content&&(Wn(l.content)?d.setRequestHeader("Content-Type","application/octet-stream"):d.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const f=l.headers;f&&Object.keys(f).forEach(m=>{d.setRequestHeader(m,f[m])}),l.responseType&&(d.responseType=l.responseType),l.abortSignal&&(l.abortSignal.onabort=()=>{d.abort(),u(new zt)}),l.timeout&&(d.timeout=l.timeout),d.onload=()=>{l.abortSignal&&(l.abortSignal.onabort=null),d.status>=200&&d.status<300?o(new Wd(d.status,d.statusText,d.response||d.responseText)):u(new Fn(d.response||d.responseText||d.statusText,d.status))},d.onerror=()=>{this._logger.log(R.Warning,`Error from HTTP request. ${d.status}: ${d.statusText}.`),u(new Fn(d.statusText,d.status))},d.ontimeout=()=>{this._logger.log(R.Warning,"Timeout from HTTP request."),u(new oa)},d.send(l.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Tp extends Vl{constructor(l){if(super(),typeof fetch<"u"||ze.isNode)this._httpClient=new Cp(l);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ep(l);else throw new Error("No usable HttpClient found.")}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?this._httpClient.send(l):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(l){return this._httpClient.getCookieString(l)}}class Nt{static write(l){return`${l}${Nt.RecordSeparator}`}static parse(l){if(l[l.length-1]!==Nt.RecordSeparator)throw new Error("Message is incomplete.");const o=l.split(Nt.RecordSeparator);return o.pop(),o}}Nt.RecordSeparatorCode=30;Nt.RecordSeparator=String.fromCharCode(Nt.RecordSeparatorCode);class Pp{writeHandshakeRequest(l){return Nt.write(JSON.stringify(l))}parseHandshakeResponse(l){let o,u;if(Wn(l)){const y=new Uint8Array(l),p=y.indexOf(Nt.RecordSeparatorCode);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=String.fromCharCode.apply(null,Array.prototype.slice.call(y.slice(0,j))),u=y.byteLength>j?y.slice(j).buffer:null}else{const y=l,p=y.indexOf(Nt.RecordSeparator);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=y.substring(0,j),u=y.length>j?y.substring(j):null}const d=Nt.parse(o),f=JSON.parse(d[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[u,f]}}var ue;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close",a[a.Ack=8]="Ack",a[a.Sequence=9]="Sequence"})(ue||(ue={}));class Ip{constructor(){this.observers=[]}next(l){for(const o of this.observers)o.next(l)}error(l){for(const o of this.observers)o.error&&o.error(l)}complete(){for(const l of this.observers)l.complete&&l.complete()}subscribe(l){return this.observers.push(l),new jp(this,l)}}class Rp{constructor(l,o,u){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=l,this._connection=o,this._bufferSize=u}async _send(l){const o=this._protocol.writeMessage(l);let u=Promise.resolve();if(this._isInvocationMessage(l)){this._totalMessageCount++;let d=()=>{},f=()=>{};Wn(o)?this._bufferedByteCount+=o.byteLength:this._bufferedByteCount+=o.length,this._bufferedByteCount>=this._bufferSize&&(u=new Promise((m,y)=>{d=m,f=y})),this._messages.push(new Lp(o,this._totalMessageCount,d,f))}try{this._reconnectInProgress||await this._connection.send(o)}catch{this._disconnected()}await u}_ack(l){let o=-1;for(let u=0;uthis._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=l.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const l=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:ue.Sequence,sequenceId:l}));const o=this._messages;for(const u of o)await this._connection.send(u._message);this._reconnectInProgress=!1}_dispose(l){l??(l=new Error("Unable to reconnect to server."));for(const o of this._messages)o._rejector(l)}_isInvocationMessage(l){switch(l.type){case ue.Invocation:case ue.StreamItem:case ue.Completion:case ue.StreamInvocation:case ue.CancelInvocation:return!0;case ue.Close:case ue.Sequence:case ue.Ping:case ue.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:ue.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Lp{constructor(l,o,u,d){this._message=l,this._id=o,this._resolver=u,this._rejector=d}}const Dp=30*1e3,$p=15*1e3,Mp=1e5;var Ce;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(Ce||(Ce={}));class aa{static create(l,o,u,d,f,m,y){return new aa(l,o,u,d,f,m,y)}constructor(l,o,u,d,f,m,y){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(R.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},qe.isRequired(l,"connection"),qe.isRequired(o,"logger"),qe.isRequired(u,"protocol"),this.serverTimeoutInMilliseconds=f??Dp,this.keepAliveIntervalInMilliseconds=m??$p,this._statefulReconnectBufferSize=y??Mp,this._logger=o,this._protocol=u,this.connection=l,this._reconnectPolicy=d,this._handshakeProtocol=new Pp,this.connection.onreceive=p=>this._processIncomingData(p),this.connection.onclose=p=>this._connectionClosed(p),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ce.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:ue.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(l){if(this._connectionState!==Ce.Disconnected&&this._connectionState!==Ce.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!l)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=l}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ce.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ce.Connecting,this._logger.log(R.Debug,"Starting HubConnection.");try{await this._startInternal(),ze.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ce.Connected,this._connectionStarted=!0,this._logger.log(R.Debug,"HubConnection connected successfully.")}catch(l){return this._connectionState=Ce.Disconnected,this._logger.log(R.Debug,`HubConnection failed to start successfully because of error '${l}'.`),Promise.reject(l)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const l=new Promise((o,u)=>{this._handshakeResolver=o,this._handshakeRejecter=u});await this.connection.start(this._protocol.transferFormat);try{let o=this._protocol.version;this.connection.features.reconnect||(o=1);const u={protocol:this._protocol.name,version:o};if(this._logger.log(R.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(u)),this._logger.log(R.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await l,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Rp(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(o){throw this._logger.log(R.Debug,`Hub handshake failed with error '${o}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(o),o}}async stop(){const l=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await l}catch{}}_stopInternal(l){if(this._connectionState===Ce.Disconnected)return this._logger.log(R.Debug,`Call to HubConnection.stop(${l}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ce.Disconnecting)return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const o=this._connectionState;return this._connectionState=Ce.Disconnecting,this._logger.log(R.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(R.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(o===Ce.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=l||new zt("The connection was stopped before the hub handshake could complete."),this.connection.stop(l))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createStreamInvocation(l,o,d);let m;const y=new Ip;return y.cancelCallback=()=>{const p=this._createCancelInvocation(f.invocationId);return delete this._callbacks[f.invocationId],m.then(()=>this._sendWithProtocol(p))},this._callbacks[f.invocationId]=(p,j)=>{if(j){y.error(j);return}else p&&(p.type===ue.Completion?p.error?y.error(new Error(p.error)):y.complete():y.next(p.item))},m=this._sendWithProtocol(f).catch(p=>{y.error(p),delete this._callbacks[f.invocationId]}),this._launchStreams(u,m),y}_sendMessage(l){return this._resetKeepAliveInterval(),this.connection.send(l)}_sendWithProtocol(l){return this._messageBuffer?this._messageBuffer._send(l):this._sendMessage(this._protocol.writeMessage(l))}send(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._sendWithProtocol(this._createInvocation(l,o,!0,d));return this._launchStreams(u,f),f}invoke(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createInvocation(l,o,!1,d);return new Promise((y,p)=>{this._callbacks[f.invocationId]=(C,S)=>{if(S){p(S);return}else C&&(C.type===ue.Completion?C.error?p(new Error(C.error)):y(C.result):p(new Error(`Unexpected message type: ${C.type}`)))};const j=this._sendWithProtocol(f).catch(C=>{p(C),delete this._callbacks[f.invocationId]});this._launchStreams(u,j)})}on(l,o){!l||!o||(l=l.toLowerCase(),this._methods[l]||(this._methods[l]=[]),this._methods[l].indexOf(o)===-1&&this._methods[l].push(o))}off(l,o){if(!l)return;l=l.toLowerCase();const u=this._methods[l];if(u)if(o){const d=u.indexOf(o);d!==-1&&(u.splice(d,1),u.length===0&&delete this._methods[l])}else delete this._methods[l]}onclose(l){l&&this._closedCallbacks.push(l)}onreconnecting(l){l&&this._reconnectingCallbacks.push(l)}onreconnected(l){l&&this._reconnectedCallbacks.push(l)}_processIncomingData(l){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(l=this._processHandshakeResponse(l),this._receivedHandshakeResponse=!0),l){const o=this._protocol.parseMessages(l,this._logger);for(const u of o)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(u)))switch(u.type){case ue.Invocation:this._invokeClientMethod(u).catch(d=>{this._logger.log(R.Error,`Invoke client method threw error: ${Vo(d)}`)});break;case ue.StreamItem:case ue.Completion:{const d=this._callbacks[u.invocationId];if(d){u.type===ue.Completion&&delete this._callbacks[u.invocationId];try{d(u)}catch(f){this._logger.log(R.Error,`Stream callback threw error: ${Vo(f)}`)}}break}case ue.Ping:break;case ue.Close:{this._logger.log(R.Information,"Close message received from server.");const d=u.error?new Error("Server returned an error on close: "+u.error):void 0;u.allowReconnect===!0?this.connection.stop(d):this._stopPromise=this._stopInternal(d);break}case ue.Ack:this._messageBuffer&&this._messageBuffer._ack(u);break;case ue.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(u);break;default:this._logger.log(R.Warning,`Invalid message type: ${u.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(l){let o,u;try{[u,o]=this._handshakeProtocol.parseHandshakeResponse(l)}catch(d){const f="Error parsing handshake response: "+d;this._logger.log(R.Error,f);const m=new Error(f);throw this._handshakeRejecter(m),m}if(o.error){const d="Server returned handshake error: "+o.error;this._logger.log(R.Error,d);const f=new Error(d);throw this._handshakeRejecter(f),f}else this._logger.log(R.Debug,"Server handshake complete.");return this._handshakeResolver(),u}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let l=this._nextKeepAlive-new Date().getTime();l<0&&(l=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===Ce.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},l)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(l){const o=l.target.toLowerCase(),u=this._methods[o];if(!u){this._logger.log(R.Warning,`No client method with the name '${o}' found.`),l.invocationId&&(this._logger.log(R.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)));return}const d=u.slice(),f=!!l.invocationId;let m,y,p;for(const j of d)try{const C=m;m=await j.apply(this,l.arguments),f&&m&&C&&(this._logger.log(R.Error,`Multiple results provided for '${o}'. Sending error to server.`),p=this._createCompletionMessage(l.invocationId,"Client provided multiple results.",null)),y=void 0}catch(C){y=C,this._logger.log(R.Error,`A callback for the method '${o}' threw error '${C}'.`)}p?await this._sendWithProtocol(p):f?(y?p=this._createCompletionMessage(l.invocationId,`${y}`,null):m!==void 0?p=this._createCompletionMessage(l.invocationId,null,m):(this._logger.log(R.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),p=this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(p)):m&&this._logger.log(R.Error,`Result given for '${o}' method but server is not expecting a result.`)}_connectionClosed(l){this._logger.log(R.Debug,`HubConnection.connectionClosed(${l}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||l||new zt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(l||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ce.Disconnecting?this._completeClose(l):this._connectionState===Ce.Connected&&this._reconnectPolicy?this._reconnect(l):this._connectionState===Ce.Connected&&this._completeClose(l)}_completeClose(l){if(this._connectionStarted){this._connectionState=Ce.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(l??new Error("Connection closed.")),this._messageBuffer=void 0),ze.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(o=>o.apply(this,[l]))}catch(o){this._logger.log(R.Error,`An onclose callback called with error '${l}' threw error '${o}'.`)}}}async _reconnect(l){const o=Date.now();let u=0,d=l!==void 0?l:new Error("Attempting to reconnect due to a unknown error."),f=this._getNextRetryDelay(u++,0,d);if(f===null){this._logger.log(R.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(l);return}if(this._connectionState=Ce.Reconnecting,l?this._logger.log(R.Information,`Connection reconnecting because of error '${l}'.`):this._logger.log(R.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(m=>m.apply(this,[l]))}catch(m){this._logger.log(R.Error,`An onreconnecting callback called with error '${l}' threw error '${m}'.`)}if(this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;f!==null;){if(this._logger.log(R.Information,`Reconnect attempt number ${u} will start in ${f} ms.`),await new Promise(m=>{this._reconnectDelayHandle=setTimeout(m,f)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ce.Connected,this._logger.log(R.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(m=>m.apply(this,[this.connection.connectionId]))}catch(m){this._logger.log(R.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${m}'.`)}return}catch(m){if(this._logger.log(R.Information,`Reconnect attempt failed because of error '${m}'.`),this._connectionState!==Ce.Reconnecting){this._logger.log(R.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ce.Disconnecting&&this._completeClose();return}d=m instanceof Error?m:new Error(m.toString()),f=this._getNextRetryDelay(u++,Date.now()-o,d)}}this._logger.log(R.Information,`Reconnect retries have been exhausted after ${Date.now()-o} ms and ${u} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(l,o,u){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:o,previousRetryCount:l,retryReason:u})}catch(d){return this._logger.log(R.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${l}, ${o}) threw error '${d}'.`),null}}_cancelCallbacksWithError(l){const o=this._callbacks;this._callbacks={},Object.keys(o).forEach(u=>{const d=o[u];try{d(null,l)}catch(f){this._logger.log(R.Error,`Stream 'error' callback called with '${l}' threw error: ${Vo(f)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(l,o,u,d){if(u)return d.length!==0?{arguments:o,streamIds:d,target:l,type:ue.Invocation}:{arguments:o,target:l,type:ue.Invocation};{const f=this._invocationId;return this._invocationId++,d.length!==0?{arguments:o,invocationId:f.toString(),streamIds:d,target:l,type:ue.Invocation}:{arguments:o,invocationId:f.toString(),target:l,type:ue.Invocation}}}_launchStreams(l,o){if(l.length!==0){o||(o=Promise.resolve());for(const u in l)l[u].subscribe({complete:()=>{o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u)))},error:d=>{let f;d instanceof Error?f=d.message:d&&d.toString?f=d.toString():f="Unknown error",o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u,f)))},next:d=>{o=o.then(()=>this._sendWithProtocol(this._createStreamItemMessage(u,d)))}})}}_replaceStreamingParams(l){const o=[],u=[];for(let d=0;d0)&&(o=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(l);const u=await this._innerClient.send(l);return o&&u.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(l),await this._innerClient.send(l)):u}_setAuthorizationHeader(l){l.headers||(l.headers={}),this._accessToken?l.headers[Bn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&l.headers[Bn.Authorization]&&delete l.headers[Bn.Authorization]}getCookieString(l){return this._innerClient.getCookieString(l)}}var Xe;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(Xe||(Xe={}));var it;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(it||(it={}));let Op=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class kd{get pollAborted(){return this._pollAbort.aborted}constructor(l,o,u){this._httpClient=l,this._logger=o,this._pollAbort=new Op,this._options=u,this._running=!1,this.onreceive=null,this.onclose=null}async connect(l,o){if(qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._url=l,this._logger.log(R.Trace,"(LongPolling transport) Connecting."),o===it.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[u,d]=Cs(),f={[u]:d,...this._options.headers},m={abortSignal:this._pollAbort.signal,headers:f,timeout:1e5,withCredentials:this._options.withCredentials};o===it.Binary&&(m.responseType="arraybuffer");const y=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${y}.`);const p=await this._httpClient.get(y,m);p.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${p.statusCode}.`),this._closeError=new Fn(p.statusText||"",p.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,m)}async _poll(l,o){try{for(;this._running;)try{const u=`${l}&_=${Date.now()}`;this._logger.log(R.Trace,`(LongPolling transport) polling: ${u}.`);const d=await this._httpClient.get(u,o);d.statusCode===204?(this._logger.log(R.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):d.statusCode!==200?(this._logger.log(R.Error,`(LongPolling transport) Unexpected response code: ${d.statusCode}.`),this._closeError=new Fn(d.statusText||"",d.statusCode),this._running=!1):d.content?(this._logger.log(R.Trace,`(LongPolling transport) data received. ${jr(d.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(d.content)):this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(u){this._running?u instanceof oa?this._logger.log(R.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=u,this._running=!1):this._logger.log(R.Trace,`(LongPolling transport) Poll errored after shutdown: ${u.message}`)}}finally{this._logger.log(R.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(l){return this._running?Vd(this._logger,"LongPolling",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(R.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(R.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const l={},[o,u]=Cs();l[o]=u;const d={headers:{...l,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let f;try{await this._httpClient.delete(this._url,d)}catch(m){f=m}f?f instanceof Fn&&(f.statusCode===404?this._logger.log(R.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(R.Trace,`(LongPolling transport) Error sending a DELETE request: ${f}`)):this._logger.log(R.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(R.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let l="(LongPolling transport) Firing onclose event.";this._closeError&&(l+=" Error: "+this._closeError),this._logger.log(R.Trace,l),this.onclose(this._closeError)}}}class Up{constructor(l,o,u,d){this._httpClient=l,this._accessToken=o,this._logger=u,this._options=d,this.onreceive=null,this.onclose=null}async connect(l,o){return qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(R.Trace,"(SSE transport) Connecting."),this._url=l,this._accessToken&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((u,d)=>{let f=!1;if(o!==it.Text){d(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let m;if(ze.isBrowser||ze.isWebWorker)m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials});else{const y=this._httpClient.getCookieString(l),p={};p.Cookie=y;const[j,C]=Cs();p[j]=C,m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials,headers:{...p,...this._options.headers}})}try{m.onmessage=y=>{if(this.onreceive)try{this._logger.log(R.Trace,`(SSE transport) data received. ${jr(y.data,this._options.logMessageContent)}.`),this.onreceive(y.data)}catch(p){this._close(p);return}},m.onerror=y=>{f?this._close():d(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},m.onopen=()=>{this._logger.log(R.Information,`SSE connected to ${this._url}`),this._eventSource=m,f=!0,u()}}catch(y){d(y);return}})}async send(l){return this._eventSource?Vd(this._logger,"SSE",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(l){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(l))}}class Fp{constructor(l,o,u,d,f,m){this._logger=u,this._accessTokenFactory=o,this._logMessageContent=d,this._webSocketConstructor=f,this._httpClient=l,this.onreceive=null,this.onclose=null,this._headers=m}async connect(l,o){qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(R.Trace,"(WebSockets transport) Connecting.");let u;return this._accessTokenFactory&&(u=await this._accessTokenFactory()),new Promise((d,f)=>{l=l.replace(/^http/,"ws");let m;const y=this._httpClient.getCookieString(l);let p=!1;if(ze.isNode||ze.isReactNative){const j={},[C,S]=Cs();j[C]=S,u&&(j[Bn.Authorization]=`Bearer ${u}`),y&&(j[Bn.Cookie]=y),m=new this._webSocketConstructor(l,void 0,{headers:{...j,...this._headers}})}else u&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(u)}`);m||(m=new this._webSocketConstructor(l)),o===it.Binary&&(m.binaryType="arraybuffer"),m.onopen=j=>{this._logger.log(R.Information,`WebSocket connected to ${l}.`),this._webSocket=m,p=!0,d()},m.onerror=j=>{let C=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?C=j.error:C="There was an error with the transport",this._logger.log(R.Information,`(WebSockets transport) ${C}.`)},m.onmessage=j=>{if(this._logger.log(R.Trace,`(WebSockets transport) data received. ${jr(j.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(j.data)}catch(C){this._close(C);return}},m.onclose=j=>{if(p)this._close(j);else{let C=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?C=j.error:C="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",f(new Error(C))}}})}send(l){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(R.Trace,`(WebSockets transport) sending data. ${jr(l,this._logMessageContent)}.`),this._webSocket.send(l),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(l){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(R.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(l)&&(l.wasClean===!1||l.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${l.code} (${l.reason||"no reason given"}).`)):l instanceof Error?this.onclose(l):this.onclose())}_isCloseEvent(l){return l&&typeof l.wasClean=="boolean"&&typeof l.code=="number"}}const Sd=100;class Bp{constructor(l,o={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,qe.isRequired(l,"url"),this._logger=wp(o.logger),this.baseUrl=this._resolveUrl(l),o=o||{},o.logMessageContent=o.logMessageContent===void 0?!1:o.logMessageContent,typeof o.withCredentials=="boolean"||o.withCredentials===void 0)o.withCredentials=o.withCredentials===void 0?!0:o.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");o.timeout=o.timeout===void 0?100*1e3:o.timeout;let u=null,d=null;if(ze.isNode&&typeof require<"u"){const f=typeof __webpack_require__=="function"?__non_webpack_require__:require;u=f("ws"),d=f("eventsource")}!ze.isNode&&typeof WebSocket<"u"&&!o.WebSocket?o.WebSocket=WebSocket:ze.isNode&&!o.WebSocket&&u&&(o.WebSocket=u),!ze.isNode&&typeof EventSource<"u"&&!o.EventSource?o.EventSource=EventSource:ze.isNode&&!o.EventSource&&typeof d<"u"&&(o.EventSource=d),this._httpClient=new zp(o.httpClient||new Tp(this._logger),o.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=o,this.onreceive=null,this.onclose=null}async start(l){if(l=l||it.Binary,qe.isIn(l,it,"transferFormat"),this._logger.log(R.Debug,`Starting connection with transfer format '${it[l]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(l),await this._startInternalPromise,this._connectionState==="Disconnecting"){const o="Failed to start the HttpConnection before stop() was called.";return this._logger.log(R.Error,o),await this._stopPromise,Promise.reject(new zt(o))}else if(this._connectionState!=="Connected"){const o="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(R.Error,o),Promise.reject(new zt(o))}this._connectionStarted=!0}send(l){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ca(this.transport)),this._sendQueue.send(l))}async stop(l){if(this._connectionState==="Disconnected")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(R.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(o=>{this._stopPromiseResolver=o}),await this._stopInternal(l),await this._stopPromise}async _stopInternal(l){this._stopError=l;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(o){this._logger.log(R.Error,`HttpConnection.transport.stop() threw error '${o}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(R.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(l){let o=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Xe.WebSockets)this.transport=this._constructTransport(Xe.WebSockets),await this._startTransport(o,l);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let u=null,d=0;do{if(u=await this._getNegotiationResponse(o),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new zt("The connection was stopped during negotiation.");if(u.error)throw new Error(u.error);if(u.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(u.url&&(o=u.url),u.accessToken){const f=u.accessToken;this._accessTokenFactory=()=>f,this._httpClient._accessToken=f,this._httpClient._accessTokenFactory=void 0}d++}while(u.url&&d0?Promise.reject(new gp(`Unable to connect to the server with any of the available transports. ${m.join(" ")}`,m)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(l){switch(l){case Xe.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Fp(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Xe.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Up(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Xe.LongPolling:return new kd(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${l}.`)}}_startTransport(l,o){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async u=>{let d=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(l,o),await this.features.resend()}catch{d=!0}else{this._stopConnection(u);return}d&&this._stopConnection(u)}:this.transport.onclose=u=>this._stopConnection(u),this.transport.connect(l,o)}_resolveTransportOrError(l,o,u,d){const f=Xe[l.transport];if(f==null)return this._logger.log(R.Debug,`Skipping transport '${l.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${l.transport}' because it is not supported by this client.`);if(Hp(o,f))if(l.transferFormats.map(y=>it[y]).indexOf(u)>=0){if(f===Xe.WebSockets&&!this._options.WebSocket||f===Xe.ServerSentEvents&&!this._options.EventSource)return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it is not supported in your environment.'`),new mp(`'${Xe[f]}' is not supported in your environment.`,f);this._logger.log(R.Debug,`Selecting transport '${Xe[f]}'.`);try{return this.features.reconnect=f===Xe.WebSockets?d:void 0,this._constructTransport(f)}catch(y){return y}}else return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it does not support the requested transfer format '${it[u]}'.`),new Error(`'${Xe[f]}' does not support ${it[u]}.`);else return this._logger.log(R.Debug,`Skipping transport '${Xe[f]}' because it was disabled by the client.`),new pp(`'${Xe[f]}' is disabled by the client.`,f)}_isITransport(l){return l&&typeof l=="object"&&"connect"in l}_stopConnection(l){if(this._logger.log(R.Debug,`HttpConnection.stopConnection(${l}) called while in state ${this._connectionState}.`),this.transport=void 0,l=this._stopError||l,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(R.Debug,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(R.Warning,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${l}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),l?this._logger.log(R.Error,`Connection disconnected with error '${l}'.`):this._logger.log(R.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(o=>{this._logger.log(R.Error,`TransportSendQueue.stop() threw error '${o}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(l)}catch(o){this._logger.log(R.Error,`HttpConnection.onclose(${l}) threw error '${o}'.`)}}}_resolveUrl(l){if(l.lastIndexOf("https://",0)===0||l.lastIndexOf("http://",0)===0)return l;if(!ze.isBrowser)throw new Error(`Cannot resolve '${l}'.`);const o=window.document.createElement("a");return o.href=l,this._logger.log(R.Information,`Normalizing '${l}' to '${o.href}'.`),o.href}_resolveNegotiateUrl(l){const o=new URL(l);o.pathname.endsWith("/")?o.pathname+="negotiate":o.pathname+="/negotiate";const u=new URLSearchParams(o.searchParams);return u.has("negotiateVersion")||u.append("negotiateVersion",this._negotiateVersion.toString()),u.has("useStatefulReconnect")?u.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&u.append("useStatefulReconnect","true"),o.search=u.toString(),o.toString()}}function Hp(a,l){return!a||(l&a)!==0}class ca{constructor(l){this._transport=l,this._buffer=[],this._executing=!0,this._sendBufferedData=new Al,this._transportResult=new Al,this._sendLoopPromise=this._sendLoop()}send(l){return this._bufferData(l),this._transportResult||(this._transportResult=new Al),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(l){if(this._buffer.length&&typeof this._buffer[0]!=typeof l)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof l}`);this._buffer.push(l),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Al;const l=this._transportResult;this._transportResult=void 0;const o=typeof this._buffer[0]=="string"?this._buffer.join(""):ca._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(o),l.resolve()}catch(u){l.reject(u)}}}static _concatBuffers(l){const o=l.map(f=>f.byteLength).reduce((f,m)=>f+m),u=new Uint8Array(o);let d=0;for(const f of l)u.set(new Uint8Array(f),d),d+=f.byteLength;return u.buffer}}class Al{constructor(){this.promise=new Promise((l,o)=>[this._resolver,this._rejecter]=[l,o])}resolve(){this._resolver()}reject(l){this._rejecter(l)}}const Wp="json";class Vp{constructor(){this.name=Wp,this.version=2,this.transferFormat=it.Text}parseMessages(l,o){if(typeof l!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!l)return[];o===null&&(o=wr.instance);const u=Nt.parse(l),d=[];for(const f of u){const m=JSON.parse(f);if(typeof m.type!="number")throw new Error("Invalid payload.");switch(m.type){case ue.Invocation:this._isInvocationMessage(m);break;case ue.StreamItem:this._isStreamItemMessage(m);break;case ue.Completion:this._isCompletionMessage(m);break;case ue.Ping:break;case ue.Close:break;case ue.Ack:this._isAckMessage(m);break;case ue.Sequence:this._isSequenceMessage(m);break;default:o.log(R.Information,"Unknown message type '"+m.type+"' ignored.");continue}d.push(m)}return d}writeMessage(l){return Nt.write(JSON.stringify(l))}_isInvocationMessage(l){this._assertNotEmptyString(l.target,"Invalid payload for Invocation message."),l.invocationId!==void 0&&this._assertNotEmptyString(l.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(l){if(this._assertNotEmptyString(l.invocationId,"Invalid payload for StreamItem message."),l.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(l){if(l.result&&l.error)throw new Error("Invalid payload for Completion message.");!l.result&&l.error&&this._assertNotEmptyString(l.error,"Invalid payload for Completion message."),this._assertNotEmptyString(l.invocationId,"Invalid payload for Completion message.")}_isAckMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(l,o){if(typeof l!="string"||l==="")throw new Error(o)}}const Qp={trace:R.Trace,debug:R.Debug,info:R.Information,information:R.Information,warn:R.Warning,warning:R.Warning,error:R.Error,critical:R.Critical,none:R.None};function qp(a){const l=Qp[a.toLowerCase()];if(typeof l<"u")return l;throw new Error(`Unknown log level: ${a}`)}class Kp{configureLogging(l){if(qe.isRequired(l,"logging"),Jp(l))this.logger=l;else if(typeof l=="string"){const o=qp(l);this.logger=new Ol(o)}else this.logger=new Ol(l);return this}withUrl(l,o){return qe.isRequired(l,"url"),qe.isNotEmpty(l,"url"),this.url=l,typeof o=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...o}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:o},this}withHubProtocol(l){return qe.isRequired(l,"protocol"),this.protocol=l,this}withAutomaticReconnect(l){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return l?Array.isArray(l)?this.reconnectPolicy=new _d(l):this.reconnectPolicy=l:this.reconnectPolicy=new _d,this}withServerTimeout(l){return qe.isRequired(l,"milliseconds"),this._serverTimeoutInMilliseconds=l,this}withKeepAliveInterval(l){return qe.isRequired(l,"milliseconds"),this._keepAliveIntervalInMilliseconds=l,this}withStatefulReconnect(l){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=l==null?void 0:l.bufferSize,this}build(){const l=this.httpConnectionOptions||{};if(l.logger===void 0&&(l.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const o=new Bp(this.url,l);return aa.create(o,this.logger||wr.instance,this.protocol||new Vp,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Jp(a){return a.log!==void 0}class Xp{constructor(){xt(this,"connection",null);xt(this,"state","Disconnected");xt(this,"startPromise",null);xt(this,"permanentRetryTimer",null);xt(this,"isAuthenticated",!1);xt(this,"stateListeners",new Set);xt(this,"ackListeners",new Set);xt(this,"deviceStatusListeners",new Set);xt(this,"healthReportListeners",new Set);xt(this,"notificationListeners",new Set);xt(this,"cancelledListeners",new Set);Ns.subscribe(()=>{this.stop()})}getState(){return this.state}setState(l){this.state!==l&&(this.state=l,this.stateListeners.forEach(o=>o(l)))}onStateChange(l){return this.stateListeners.add(l),l(this.state),()=>this.stateListeners.delete(l)}onAckReceiptReceived(l){return this.ackListeners.add(l),()=>this.ackListeners.delete(l)}onDeviceStatusChanged(l){return this.deviceStatusListeners.add(l),()=>this.deviceStatusListeners.delete(l)}onHealthReportReceived(l){return this.healthReportListeners.add(l),()=>this.healthReportListeners.delete(l)}onNewNotificationBroadcast(l){return this.notificationListeners.add(l),()=>this.notificationListeners.delete(l)}onNotificationCancelled(l){return this.cancelledListeners.add(l),()=>this.cancelledListeners.delete(l)}async start(){var o,u;if(!Ss()){this.setState("Disconnected");return}if(this.isAuthenticated=!0,((o=this.connection)==null?void 0:o.state)===Ce.Connected){this.setState("Connected");return}return this.startPromise?this.startPromise:(this.connection||this.buildConnection(),this.setState(((u=this.connection)==null?void 0:u.state)===Ce.Reconnecting?"Reconnecting":"Connecting"),this.startPromise=(async()=>{try{this.connection&&this.connection.state===Ce.Disconnected&&(await this.connection.start(),this.setState("Connected"),this.clearPermanentRetryTimer())}catch(d){console.warn("SignalR start failed:",d),this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}finally{this.startPromise=null}})(),this.startPromise)}async stop(){if(this.isAuthenticated=!1,this.clearPermanentRetryTimer(),this.setState("Disconnected"),this.startPromise){try{await this.startPromise}catch{}this.startPromise=null}if(this.connection)try{await this.connection.stop()}catch(l){console.warn("Error stopping SignalR connection:",l)}finally{this.connection=null}}buildConnection(){this.connection=new Kp().withUrl("/hubs/teacher",{accessTokenFactory:()=>Ss()||""}).withAutomaticReconnect([0,2e3,5e3,1e4,3e4]).configureLogging(R.Warning).build(),this.connection.onreconnecting(()=>{this.setState("Reconnecting")}),this.connection.onreconnected(()=>{this.setState("Connected"),this.clearPermanentRetryTimer()}),this.connection.onclose(()=>{this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}),this.connection.on("OnAckReceiptReceived",l=>{this.ackListeners.forEach(o=>o(l))}),this.connection.on("OnDeviceStatusChanged",l=>{this.deviceStatusListeners.forEach(o=>o(l))}),this.connection.on("OnHealthReportReceived",l=>{this.healthReportListeners.forEach(o=>o(l))}),this.connection.on("OnNewNotificationBroadcast",l=>{this.notificationListeners.forEach(o=>o(l))}),this.connection.on("OnNotificationCancelled",l=>{this.cancelledListeners.forEach(o=>o(l))})}schedulePermanentRetry(){this.permanentRetryTimer||!this.isAuthenticated||(this.permanentRetryTimer=setInterval(()=>{var l;if(!this.isAuthenticated){this.clearPermanentRetryTimer();return}((l=this.connection)==null?void 0:l.state)===Ce.Disconnected&&this.start()},3e4))}clearPermanentRetryTimer(){this.permanentRetryTimer&&(clearInterval(this.permanentRetryTimer),this.permanentRetryTimer=null)}}const Ot=new Xp,Qd=g.createContext(void 0),Gp=({children:a})=>{const[l,o]=g.useState(()=>{try{const j=localStorage.getItem("classnotify_user");return j?JSON.parse(j):null}catch{return null}}),[u,d]=g.useState(Ss()),[f,m]=g.useState(!0);g.useEffect(()=>{const j=Ns.subscribe(()=>{Ot.stop(),xr(),d(null),o(null)});return()=>j()},[]),g.useEffect(()=>{(async()=>{var S,$;if(Ss())try{const D=await oe.getMe();o(D),localStorage.setItem("classnotify_user",JSON.stringify(D)),Ns.reset(),Ot.start()}catch(D){((S=D==null?void 0:D.message)!=null&&S.includes("未授权")||($=D==null?void 0:D.message)!=null&&$.includes("401"))&&(xr(),d(null),o(null))}else xr(),o(null),d(null);m(!1)})()},[]);const y=async(j,C)=>{const S=await oe.login(j,C);if(!S.success||!S.token||!S.role)throw new Error(S.errorMessage||"登录失败");fp(S.token),d(S.token);const $={userId:S.userId||"",name:S.fullName||j,role:S.role,tenantId:S.tenantId||""};return o($),localStorage.setItem("classnotify_user",JSON.stringify($)),Ns.reset(),Ot.start(),S.role},p=()=>{Ot.stop(),xr(),d(null),o(null),Ns.reset()};return n.jsx(Qd.Provider,{value:{user:l,token:u,login:y,logout:p,isLoading:f},children:a})},Sr=()=>{const a=g.useContext(Qd);if(!a)throw new Error("useAuth must be used within an AuthProvider");return a};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yp=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qd=(...a)=>a.filter((l,o,u)=>!!l&&l.trim()!==""&&u.indexOf(l)===o).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Zp={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e0=g.forwardRef(({color:a="currentColor",size:l=24,strokeWidth:o=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...y},p)=>g.createElement("svg",{ref:p,...Zp,width:l,height:l,stroke:a,strokeWidth:u?Number(o)*24/Number(l):o,className:qd("lucide",d),...y},[...m.map(([j,C])=>g.createElement(j,C)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ae=(a,l)=>{const o=g.forwardRef(({className:u,...d},f)=>g.createElement(e0,{ref:f,iconNode:l,className:qd(`lucide-${Yp(a)}`,u),...d}));return o.displayName=`${a}`,o};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ua=ae("Activity",t0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],js=ae("ArrowRight",n0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s0=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ul=ae("Bell",s0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r0=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Qt=ae("Building2",r0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fl=ae("Check",l0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sn=ae("CircleAlert",i0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pt=ae("CircleCheck",o0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Go=ae("CircleX",a0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Kn=ae("Clock",c0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u0=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]],d0=ae("CloudRain",u0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Yo=ae("Copy",h0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],m0=ae("Eye",f0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],x0=ae("Flame",p0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Nr=ae("GraduationCap",g0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Zo=ae("History",v0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y0=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ut=ae("KeyRound",y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w0=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],gr=ae("Layers",w0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kn=ae("LoaderCircle",j0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ea=ae("LockOpen",N0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bs=ae("Lock",b0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _0=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],k0=ae("LogOut",_0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S0=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],C0=ae("Megaphone",S0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E0=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],T0=ae("Menu",E0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vn=ae("Monitor",P0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I0=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],Kd=ae("PenLine",I0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qn=ae("Plus",R0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L0=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],br=ae("Radio",L0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],bt=ae("RefreshCw",D0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],M0=ae("RotateCcw",$0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A0=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Cd=ae("School",A0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Cr=ae("Search",z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],_r=ae("Send",O0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Bl=ae("ShieldAlert",U0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_s=ae("ShieldCheck",F0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],H0=ae("Shield",B0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Jd=ae("Sparkles",W0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],da=ae("Trash2",V0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ks=ae("TriangleAlert",Q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Xd=ae("User",q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Hn=ae("Users",K0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J0=[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]],X0=ae("Vibrate",J0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Gd=ae("Volume2",G0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kr=ae("X",Y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ex=ae("ZoomIn",Z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tx=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],nx=ae("ZoomOut",tx),ha=()=>{const[a,l]=g.useState(Ot.getState());return g.useEffect(()=>Ot.onStateChange(l),[]),a==="Connected"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"云端已连接"]}):a==="Reconnecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),"正在重连"]}):a==="Connecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400 animate-pulse"}),"正在连接..."]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),"连接断开"]})},sx=()=>{const{user:a,logout:l}=Sr(),o=qn(),[u,d]=g.useState(!1);if(g.useEffect(()=>{d(!1)},[o.pathname]),!a)return null;const f=m=>o.pathname===m;return n.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"flex items-center justify-between h-16",children:[n.jsxs("div",{className:"flex items-center space-x-4",children:[n.jsxs(ge,{to:"/",className:"flex items-center space-x-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:n.jsx(Ul,{className:"w-5 h-5 text-white"})}),n.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),n.jsxs("span",{className:"text-xs px-2.5 py-1 rounded-full font-medium flex items-center gap-1.5 border bg-slate-900 border-slate-800 text-slate-300",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-amber-400"}),n.jsx("span",{className:"text-amber-400 font-semibold",children:"超级运维后台"})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(Cd,{className:"w-3.5 h-3.5 text-sky-400"}),n.jsx("span",{className:"text-sky-400 font-semibold",children:"学校管理后台"})]}),a.role==="Teacher"&&n.jsxs(n.Fragment,{children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]})]}),n.jsx("div",{className:"hidden sm:block",children:n.jsx(ha,{})})]}),n.jsxs("nav",{className:"hidden md:flex items-center space-x-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ge,{to:"/admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"总览"]}),n.jsxs(ge,{to:"/admin/tenants",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Qt,{className:"w-4 h-4"}),"学校租户"]}),n.jsxs(ge,{to:"/admin/users",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"用户中枢"]}),n.jsxs(ge,{to:"/admin/devices",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Vn,{className:"w-4 h-4"}),"设备集控"]}),n.jsxs(ge,{to:"/admin/broadcast",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400 border border-rose-500/30":"text-slate-400 hover:text-rose-300 hover:bg-slate-900"}`,children:[n.jsx(br,{className:"w-4 h-4"}),"应急广播"]}),n.jsxs(ge,{to:"/admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"激活码"]}),n.jsxs(ge,{to:"/admin/history",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Zo,{className:"w-4 h-4"}),"审计"]})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ge,{to:"/school-admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Cd,{className:"w-4 h-4"}),"学校概览"]}),n.jsxs(ge,{to:"/school-admin/classes",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"班级管理"]}),n.jsxs(ge,{to:"/school-admin/teachers",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"教师账号"]}),n.jsxs(ge,{to:"/school-admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/school-admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"本校激活码"]})]}),a.role==="Teacher"&&n.jsxs(ge,{to:"/teacher",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/teacher")?"bg-emerald-600/20 text-emerald-400 border border-emerald-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Ul,{className:"w-4 h-4"}),"呼叫与回执"]})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsxs("div",{className:"hidden sm:flex flex-col text-right",children:[n.jsx("span",{className:"text-sm font-medium text-slate-200",children:a.name}),n.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":a.tenantId})]}),n.jsx("button",{onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 transition-colors",title:"退出登录",children:n.jsx(k0,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>d(!u),className:"md:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-900 border border-slate-800 transition-colors","aria-label":"展开菜单",children:u?n.jsx(kr,{className:"w-5 h-5"}):n.jsx(T0,{className:"w-5 h-5"})})]})]}),u&&n.jsxs("div",{className:"md:hidden py-3 px-2 border-t border-slate-800/80 bg-slate-950/95 space-y-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ge,{to:"/admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gr,{className:"w-4 h-4 text-indigo-400"}),"总览大盘"]})}),n.jsx(ge,{to:"/admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/30":"text-amber-400 bg-amber-500/10 hover:bg-amber-500/20"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"设备激活码生成与管理"]}),n.jsx("span",{className:"text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded border border-amber-500/30 font-bold",children:"重点"})]})}),n.jsx(ge,{to:"/admin/tenants",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"学校租户"]})}),n.jsx(ge,{to:"/admin/users",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hn,{className:"w-4 h-4 text-indigo-400"}),"用户中枢"]})}),n.jsx(ge,{to:"/admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"}),"设备集控"]})}),n.jsx(ge,{to:"/admin/broadcast",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})}),n.jsx(ge,{to:"/admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"审计历史"]})})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ge,{to:"/school-admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"学校概览"}),n.jsx(ge,{to:"/school-admin/classes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"班级管理"}),n.jsx(ge,{to:"/school-admin/teachers",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"教师账号"}),n.jsx(ge,{to:"/school-admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/codes")?"bg-sky-600/20 text-sky-400":"text-amber-400 font-semibold"}`,children:"本校激活码"})]}),a.role==="Teacher"&&n.jsx(ge,{to:"/teacher",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/teacher")?"bg-emerald-600/20 text-emerald-400":"text-slate-300 hover:bg-slate-900"}`,children:"呼叫与回执"})]})]})})},Qo=({allowedRoles:a,children:l})=>{const{user:o,isLoading:u}=Sr();return u?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户权限..."}):o?a.includes(o.role)?l?n.jsx(n.Fragment,{children:l}):n.jsx(Bd,{}):o.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):o.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},rx=()=>{const[a,l]=g.useState(""),[o,u]=g.useState(""),[d,f]=g.useState(null),[m,y]=g.useState(!1),{login:p}=Sr(),j=Wl(),C=async(S=a,$=o)=>{f(null),y(!0);try{const D=await p(S,$);j(D==="SuperAdmin"?"/admin":D==="SchoolAdmin"?"/school-admin":"/teacher")}catch(D){f(D.message||"登录失败,请检查账号密码")}finally{y(!1)}};return n.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/40 relative overflow-hidden",children:[n.jsx("div",{className:"absolute w-96 h-96 bg-indigo-500/10 rounded-full blur-3xl -top-20 -left-20 pointer-events-none"}),n.jsx("div",{className:"absolute w-96 h-96 bg-violet-500/10 rounded-full blur-3xl -bottom-20 -right-20 pointer-events-none"}),n.jsx("div",{className:"w-full max-w-md relative z-10",children:n.jsxs("div",{className:"glass-panel p-8 border-slate-800",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center mx-auto mb-4 shadow-xl shadow-indigo-500/25",children:n.jsx(Ul,{className:"w-8 h-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white",children:"ClassNotify 控制台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1.5",children:"智慧教室通知与设备集控一体化系统"})]}),d&&n.jsxs("div",{className:"mb-6 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-sm flex items-center gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),d]}),n.jsxs("form",{onSubmit:S=>{S.preventDefault(),C()},className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsxs("div",{className:"relative",children:[n.jsx(Xd,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"text",value:a,onChange:S=>l(S.target.value),placeholder:"请输入账号",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录密码"}),n.jsxs("div",{className:"relative",children:[n.jsx(bs,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"password",value:o,onChange:S=>u(S.target.value),placeholder:"请输入密码",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:m?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在验证身份..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"登 录"}),n.jsx(js,{className:"w-4 h-4"})]})})]})]})})]})},lx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState([]),[m,y]=g.useState(null),[p,j]=g.useState([]),[C,S]=g.useState(!0),$=async()=>{try{const[D,H,F,I,q]=await Promise.all([oe.getAdminMetrics(),oe.getTenants(),oe.getAdminNotifications(6),oe.getSystemHealth().catch(()=>null),oe.getAuditLogs(6).catch(()=>[])]);l(D),u(H),f(F),I&&y(I),q&&j(q)}catch(D){console.error("Failed to load admin dashboard data",D)}finally{S(!1)}};return g.useEffect(()=>{$();const D=setInterval($,1e4);return()=>clearInterval(D)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域云控超管总览"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时管控多校区实体、网格化终端生命周期、底层微内核与紧急调度通道"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 self-start sm:self-auto",children:[n.jsxs(ge,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold shadow-md shadow-amber-500/20 active:scale-95 transition-all",children:[n.jsx(ut,{className:"w-4 h-4"}),"生成设备激活码"]}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 rounded-xl bg-slate-900/80 border border-slate-800 text-xs",children:[m!=null&&m.databaseConnected?n.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),n.jsxs("span",{className:"font-medium",children:["PostgreSQL 正常 (",m.databaseLatencyMs.toFixed(1),"ms)"]})]}):n.jsxs("div",{className:"flex items-center gap-2 text-rose-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-500"}),n.jsx("span",{className:"font-medium",children:"数据库异常断开"})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsxs("div",{className:"text-slate-400",children:[n.jsx("span",{children:"在线屏: "}),n.jsx("span",{className:"text-white font-mono",children:(m==null?void 0:m.onlineDevices)??(a==null?void 0:a.onlineDevices)??0})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsx("div",{className:"text-slate-400 font-mono text-[11px]",children:n.jsxs("span",{children:["运行: ",(m==null?void 0:m.uptime)||"99.98%"]})})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"入驻学校 / 租户"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.totalTenants)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"所校区"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"总设备数量"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.totalDevices)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台教室终端"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800 relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"在线设备 (实时连通)"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(ua,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),C?"-":(a==null?void 0:a.onlineDevices)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 离线 ",C?"-":(a==null?void 0:a.offlineDevices)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"今日呼叫通知"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 text-amber-400 flex items-center justify-center",children:n.jsx(Ul,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:C?"-":(a==null?void 0:a.todayNotifications)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"次下发"})]})]})]}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"核心管控中枢入口"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4",children:[n.jsxs(ge,{to:"/admin/tenants",className:"glass-panel p-4 border-slate-800 hover:border-indigo-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-indigo-400",children:"学校租户"}),n.jsx("div",{className:"text-xs text-slate-400",children:"入驻、变更与冻结"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-indigo-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/users",className:"glass-panel p-4 border-slate-800 hover:border-sky-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Hn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-sky-400",children:"用户中枢"}),n.jsx("div",{className:"text-xs text-slate-400",children:"跨校开户、改密与封禁"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-sky-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/devices",className:"glass-panel p-4 border-slate-800 hover:border-emerald-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-emerald-400",children:"设备集控"}),n.jsx("div",{className:"text-xs text-slate-400",children:"心跳、远程指令与清退"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-emerald-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/codes",className:"glass-panel p-4 border-slate-800 hover:border-amber-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-sm font-semibold text-white group-hover:text-amber-400 flex items-center gap-1.5",children:["激活码大盘",n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-300 font-normal",children:"快速生成"})]}),n.jsx("div",{className:"text-xs text-slate-400",children:"生成、绑定与废除"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-amber-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ge,{to:"/admin/broadcast",className:"glass-panel p-4 border-slate-800 hover:border-rose-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 text-rose-400 flex items-center justify-center",children:n.jsx(br,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-rose-400",children:"应急广播"}),n.jsx("div",{className:"text-xs text-slate-400",children:"全域群发与强置顶"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-rose-400 transition-transform group-hover:translate-x-1"})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[n.jsxs("div",{className:"lg:col-span-2 glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"各校区终端在线统计"]}),n.jsx(ge,{to:"/admin/tenants",className:"text-xs text-indigo-400 hover:underline",children:"管理学校 →"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"pb-3 font-medium",children:"学校名称"}),n.jsx("th",{className:"pb-3 font-medium",children:"班级数"}),n.jsx("th",{className:"pb-3 font-medium",children:"设备数"}),n.jsx("th",{className:"pb-3 font-medium",children:"在线状态"}),n.jsx("th",{className:"pb-3 font-medium text-right",children:"在线率"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o.map(D=>{const H=D.deviceCount>0?Math.round(D.onlineCount/D.deviceCount*100):0;return n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsxs("td",{className:"py-3 font-medium text-white flex items-center gap-2",children:[n.jsx("span",{children:D.name}),n.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:["(",D.id,")"]})]}),n.jsx("td",{className:"py-3 text-slate-300",children:D.classroomCount}),n.jsx("td",{className:"py-3 text-slate-300",children:D.deviceCount}),n.jsx("td",{className:"py-3",children:n.jsxs("span",{className:"text-xs text-slate-300",children:[D.onlineCount," / ",D.deviceCount," 在线"]})}),n.jsx("td",{className:"py-3 text-right",children:n.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${H>=80?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":H>0?"bg-amber-500/10 text-amber-400 border border-amber-500/30":"bg-slate-800 text-slate-400"}`,children:[H,"%"]})})]},D.id)})})]})})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(_s,{className:"w-4 h-4 text-amber-400"}),"管理员关键操作审计"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"不可篡改"})]}),n.jsx("div",{className:"space-y-3",children:p.length===0?n.jsx("div",{className:"text-center py-8 text-xs text-slate-500",children:"暂无审计记录"}):p.map(D=>n.jsxs("div",{className:"glass-card p-3 text-xs space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-indigo-300 font-mono",children:D.action}),n.jsx("span",{className:"text-[10px] text-slate-500",children:new Date(D.occurredAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-slate-300 text-[11px] line-clamp-1",children:D.details||D.targetId}),n.jsxs("div",{className:"flex items-center justify-between text-slate-500 text-[10px]",children:[n.jsxs("span",{children:["操作者: ",D.actorUsername]}),n.jsx("span",{className:"font-mono",children:D.targetType})]})]},D.id))})]})]})]})},ix=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(null),[C,S]=g.useState(null),[$,D]=g.useState(""),[H,F]=g.useState(""),[I,q]=g.useState(!1),G=async()=>{try{const b=await oe.getAllDevices();l(b)}catch(b){console.error("Failed to load devices",b)}finally{u(!1)}};g.useEffect(()=>{G();const b=setInterval(G,5e3);return()=>clearInterval(b)},[]);const Z=async(b,ne,Ee)=>{j(`${b}_${ne}`),y(null);try{const je=await oe.sendDeviceCommand(b,ne,Ee);y({deviceId:b,message:je.message,success:!0}),G()}catch(je){y({deviceId:b,message:je.message||"远程指令下发失败",success:!1})}finally{j(null)}},te=b=>{S(b),D(b.hostname||""),F(b.classroomId||"")},O=async b=>{if(b.preventDefault(),!!C){q(!0);try{await oe.updateDevice(C.deviceId,{hostname:$.trim()||void 0,classroomId:H.trim()||void 0}),y({deviceId:C.deviceId,message:"设备信息更新成功",success:!0}),S(null),G()}catch(ne){y({deviceId:C.deviceId,message:ne.message||"更新设备失败",success:!1})}finally{q(!1)}}},K=async b=>{if(window.confirm(`高危操作确认:确定要注销并清退设备 [${b.deviceId} (${b.hostname||b.classroomName})] 吗? 清退后该设备将无法接入,需重新生成激活码绑定!`)){j(`decommission_${b.deviceId}`);try{await oe.decommissionDevice(b.deviceId),y({deviceId:b.deviceId,message:"设备已成功清退并注销",success:!0}),G()}catch(ne){y({deviceId:b.deviceId,message:ne.message||"清退设备失败",success:!1})}finally{j(null)}}},fe=b=>{if(!b)return"从无心跳";const ne=Math.floor((Date.now()-new Date(b).getTime())/1e3);return ne<10?"刚刚 (几秒前)":ne<60?`${ne} 秒前`:ne<3600?`${Math.floor(ne/60)} 分钟前`:`${Math.floor(ne/3600)} 小时前`},pe=a.filter(b=>b.tenantName.toLowerCase().includes(d.toLowerCase())||b.classroomName.toLowerCase().includes(d.toLowerCase())||b.deviceId.toLowerCase().includes(d.toLowerCase())||b.hostname&&b.hostname.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备集控中心"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时监控教室终端健康心跳与服务状态,支持在线秒级下发或离线指令入队补发、元数据变更与清退"})]}),n.jsxs("div",{className:"flex items-center gap-2 self-start sm:self-auto",children:[n.jsxs("button",{onClick:()=>{u(!0),G()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新状态"]}),n.jsxs(ge,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-600/25 transition-all",children:[n.jsx(ut,{className:"w-3.5 h-3.5 text-amber-300"}),"生成新设备激活码"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between transition-all ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsxs("span",{children:["[设备 ",m.deviceId,"] ",m.message]})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:b=>f(b.target.value),placeholder:"按学校、班级、设备编号或计算机名过滤...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"设备编号 / 主机名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"运行状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"心跳与 IP"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"版本"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"运维指令与管理"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:pe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在同步设备状态...":"暂无匹配的设备"})}):pe.map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:b.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:b.tenantName})]}),n.jsxs("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:[n.jsx("div",{children:b.deviceId}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-sans mt-0.5 flex items-center gap-1",children:[n.jsx(Vn,{className:"w-3 h-3 text-slate-500"}),n.jsx("span",{children:b.hostname||"Classroom-PC"})]})]}),n.jsx("td",{className:"py-4 px-4",children:b.isOnline?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),n.jsx("span",{children:"在线 (实时连通)"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-400",title:"指令将入队,上线时自动补发",children:[n.jsx(Kn,{className:"w-3 h-3 text-amber-500"}),n.jsx("span",{children:"离线 (支持离线入队)"})]})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:fe(b.lastHeartbeat)}),n.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5 font-mono",children:b.remoteIp||"127.0.0.1"})]}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-300 font-mono",children:["v",b.clientVersion||"2.1.0"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>Z(b.deviceId,"self_check"),disabled:p===`${b.deviceId}_self_check`,className:"px-2 py-1 rounded-lg bg-indigo-600/10 hover:bg-indigo-600/20 border border-indigo-500/30 text-indigo-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发远程自检指令 (若离线将入队补发)",children:[n.jsx(ua,{className:"w-3 h-3"}),"自检"]}),n.jsxs("button",{onClick:()=>Z(b.deviceId,"restart_client"),disabled:p===`${b.deviceId}_restart_client`,className:"px-2 py-1 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"远程重启前台 WPF Client 弹窗进程",children:[n.jsx(M0,{className:"w-3 h-3"}),"重启"]}),n.jsxs("button",{onClick:()=>Z(b.deviceId,"refresh_config"),disabled:p===`${b.deviceId}_refresh_config`,className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发配置刷新指令",children:[n.jsx(bt,{className:"w-3 h-3"}),"刷新"]}),n.jsx("button",{onClick:()=>te(b),className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 transition-colors",title:"重命名或调整班级绑定",children:n.jsx(Kd,{className:"w-3.5 h-3.5"})}),n.jsx("button",{onClick:()=>K(b),disabled:p===`decommission_${b.deviceId}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"清退并注销设备",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},b.deviceId))})]})})}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"调整设备元数据"}),n.jsxs("p",{className:"text-xs text-slate-400",children:["设备唯一识别码: ",n.jsx("span",{className:"font-mono text-indigo-400",children:C.deviceId})]}),n.jsxs("form",{onSubmit:O,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"计算机名 / 主机标识 (Hostname)"}),n.jsx("input",{type:"text",value:$,onChange:b=>D(b.target.value),placeholder:"例如: LAB-BUILDING-201-PC",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"所属班级编号 (Classroom ID)"}),n.jsx("input",{type:"text",value:H,onChange:b=>F(b.target.value),placeholder:"例如: cls_801",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>S(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:I,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:I?"保存中...":"确认保存"})]})]})]})})]})},ox=()=>{const[a]=dp(),[l,o]=g.useState([]),[u,d]=g.useState([]),[f,m]=g.useState(!0),[y,p]=g.useState(null),[j,C]=g.useState(""),[S,$]=g.useState(""),[D,H]=g.useState(!1),[F,I]=g.useState(""),[q,G]=g.useState([]),[Z,te]=g.useState(!1),[O,K]=g.useState(""),[fe,pe]=g.useState(!1),[b,ne]=g.useState(""),[Ee,je]=g.useState(!1),[_e,Ue]=g.useState(null),$e=async()=>{try{const[T,N]=await Promise.all([oe.getAdminActivationCodes(),oe.getTenants()]);o(T),d(N),N.length>0&&!F&&I(N[0].id)}catch(T){console.error("Failed to load activation codes",T)}finally{m(!1)}};g.useEffect(()=>{$e()},[]),g.useEffect(()=>{const T=a.get("tenantId"),N=a.get("openGenerate")==="true";T&&($(T),I(T),N&&H(!0))},[a]),g.useEffect(()=>{F&&(te(!0),oe.getAdminClasses(F).then(T=>{G(T),T.length>0?(K(T[0].id),pe(!1)):(K(""),pe(!0))}).catch(T=>{console.warn("Could not load classes for tenant:",F,T),G([]),pe(!0)}).finally(()=>te(!1)))},[F]);const Te=T=>{navigator.clipboard.writeText(T),p(T),setTimeout(()=>p(null),2e3)},V=async T=>{T.preventDefault();const N=fe?b.trim():O.trim();if(!F||!N){alert("请选择学校及目标班级");return}je(!0);try{const L=await oe.generateAdminCode(F,N),ie=u.find(he=>he.id===F),ce=q.find(he=>he.id===N);Ue({code:L.code,schoolName:(ie==null?void 0:ie.name)||F,className:(ce==null?void 0:ce.displayName)||N}),H(!1),ne(""),$e()}catch(L){alert(L.message||"生成激活码失败")}finally{je(!1)}},k=async T=>{if(window.confirm(`确定要废弃/删除激活码 [${T}] 吗?废弃后将无法用于设备初始化绑定。`))try{await oe.deleteActivationCode(T),$e()}catch(N){alert(N.message||"删除激活码失败")}},W=l.filter(T=>{const N=!S||T.tenantId===S,L=T.code.toLowerCase().includes(j.toLowerCase())||T.classroomName.toLowerCase().includes(j.toLowerCase())||T.tenantName.toLowerCase().includes(j.toLowerCase());return N&&L});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-4 h-4"})}),n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备激活码大盘"})]}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m(!0),$e()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${f?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{Ue(null),H(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold transition-all shadow-lg shadow-amber-500/20 active:scale-95",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]})]}),_e&&n.jsxs("div",{className:"glass-panel p-5 border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:n.jsx(Jd,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-emerald-300",children:"激活码生成成功!"}),n.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["归属:",n.jsx("span",{className:"font-medium text-white",children:_e.schoolName})," / ",n.jsx("span",{className:"font-medium text-white",children:_e.className}),"(有效期 7 天,一次性硬件绑定)"]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"px-4 py-1.5 rounded-xl bg-slate-900 border border-emerald-500/50 font-mono text-xl font-bold text-emerald-400 tracking-wider",children:_e.code}),n.jsx("button",{onClick:()=>Te(_e.code),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors",children:y===_e.code?n.jsxs(n.Fragment,{children:[n.jsx(Fl,{className:"w-3.5 h-3.5"}),"已复制"]}):n.jsxs(n.Fragment,{children:[n.jsx(Yo,{className:"w-3.5 h-3.5"}),"一键复制"]})})]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:T=>C(T.target.value),placeholder:"搜索激活码、班级或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:S,onChange:T=>$(T.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsxs("option",{value:"",children:["全部学校 (",u.length,")"]}),u.map(T=>n.jsxs("option",{value:T.id,children:[T.name," (",T.id,")"]},T.id))]})]}),n.jsxs("div",{className:"ml-auto text-xs text-slate-400",children:["共 ",n.jsx("span",{className:"text-white font-medium",children:W.length})," 个激活码"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:W.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-400",children:n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[n.jsx(ut,{className:"w-8 h-8 text-slate-600"}),n.jsx("div",{className:"text-sm font-medium",children:f?"正在读取激活码...":"暂无匹配的激活码"}),n.jsx("div",{className:"text-xs text-slate-500",children:"点击右上角“生成新激活码”即可为任意学校教室开通绑定码"}),n.jsxs("button",{onClick:()=>H(!0),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium",children:[n.jsx(Qn,{className:"w-3.5 h-3.5"}),"立即生成激活码"]})]})})}):W.map(T=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-mono font-bold text-indigo-400 text-base",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.code}),n.jsx("button",{onClick:()=>Te(T.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:y===T.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]})}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:T.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:T.tenantName})]}),n.jsx("td",{className:"py-4 px-4",children:T.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx(Pt,{className:"w-3 h-3"}),"已激活绑定"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx(Kn,{className:"w-3 h-3"}),"等待激活"]})}),n.jsx("td",{className:"py-4 px-4 text-xs font-mono text-slate-300",children:T.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:T.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-400",children:[new Date(T.expiresAt).toLocaleDateString()," ",new Date(T.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:()=>Te(T.code),className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:y===T.code?"已复制":"复制"}),n.jsx("button",{onClick:()=>k(T.code),className:"p-1 rounded text-slate-500 hover:text-rose-400 transition-colors",title:"废弃/删除此激活码",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},T.code))})]})})}),D&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl rounded-2xl animate-in zoom-in-95 duration-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-amber-400"}),"生成班级设备激活码"]}),n.jsxs("form",{onSubmit:V,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属学校 / 租户"}),n.jsx("select",{value:F,onChange:T=>I(T.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:u.map(T=>n.jsxs("option",{value:T.id,children:[T.name," (",T.id,") ",T.isActive?"":"[已冻结]"]},T.id))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-slate-300",children:"目标班级"}),n.jsx("button",{type:"button",onClick:()=>pe(!fe),className:"text-[11px] text-amber-400 hover:underline",children:fe?"从班级列表选择":"手动输入班级ID"})]}),Z?n.jsxs("div",{className:"text-xs text-slate-400 py-2.5 px-3 bg-slate-900 rounded-xl border border-slate-800 flex items-center gap-2",children:[n.jsx(bt,{className:"w-3.5 h-3.5 animate-spin"}),"正在读取该校班级列表..."]}):fe?n.jsx("input",{type:"text",value:b,onChange:T=>ne(T.target.value),placeholder:"输入班级编号,如 cls_801",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}):q.length>0?n.jsx("select",{value:O,onChange:T=>K(T.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:q.map(T=>n.jsxs("option",{value:T.id,children:[T.displayName," (",T.id,")"]},T.id))}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-xs text-amber-400/90 flex items-center gap-1.5",children:[n.jsx(Sn,{className:"w-3.5 h-3.5 shrink-0"}),"该校暂无预设班级,请手动输入班级代码:"]}),n.jsx("input",{type:"text",value:b,onChange:T=>ne(T.target.value),placeholder:"如 cls_801 或 cls_new",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]})]}),n.jsxs("div",{className:"p-3 bg-slate-900/60 rounded-xl border border-slate-800 text-xs text-slate-400 space-y-1",children:[n.jsx("div",{className:"text-slate-300 font-medium",children:"💡 使用说明:"}),n.jsx("div",{children:"1. 激活码生成后有效期为 7 天;"}),n.jsx("div",{children:"2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>H(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Ee,className:"px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold disabled:opacity-50 transition-all shadow-md shadow-amber-500/20",children:Ee?"生成中...":"立即生成激活码"})]})]})]})})]})},ax=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),m=async()=>{try{const p=await oe.getAdminNotifications(100);l(p)}catch(p){console.error("Failed to load notifications",p)}finally{u(!1)}};g.useEffect(()=>{m();const p=setInterval(m,8e3);return()=>clearInterval(p)},[]);const y=a.filter(p=>p.className.toLowerCase().includes(d.toLowerCase())||p.senderName.toLowerCase().includes(d.toLowerCase())||p.message.toLowerCase().includes(d.toLowerCase())||p.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网呼叫历史与回执审计"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"追踪全网每条通知从下发、教室大屏接收、到学生点击确认的全流程时间戳与 ACK 回执"})]}),n.jsxs("button",{onClick:()=>{u(!0),m()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700 self-start sm:self-auto",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新审计"]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:p=>f(p.target.value),placeholder:"搜索消息内容、班级或教师姓名...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"目标班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"通知正文"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"发起老师"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"下发时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"回执状态 (ACK)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"确认时间"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:y.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在加载审计数据...":"暂无呼叫历史记录"})}):y.map(p=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:p.className}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:p.classId})]}),n.jsxs("td",{className:"py-4 px-4 text-slate-200 max-w-md",children:[n.jsx("div",{className:"font-medium text-sm",children:p.message}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500 mt-0.5",children:p.id})]}),n.jsx("td",{className:"py-4 px-4 text-slate-300 text-xs",children:p.senderName}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(p.createdAt).toLocaleTimeString()}),n.jsxs("td",{className:"py-4 px-4",children:[p.status==="Acknowledged"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),"学生已点击确认"]}),p.status==="Delivered"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/30",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),"已送达教室大屏"]}),p.status==="Sent"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),"云端下发中"]}),p.status==="Timeout"&&n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"超时自动关闭"})]}),n.jsx("td",{className:"py-4 px-4 text-right text-xs text-slate-400",children:p.confirmedAt?n.jsx("span",{className:"text-emerald-400 font-mono",children:new Date(p.confirmedAt).toLocaleTimeString()}):n.jsx("span",{className:"text-slate-600",children:"-"})})]},p.id))})]})})})]})},cx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(!1),[C,S]=g.useState({id:"",name:""}),[$,D]=g.useState(!1),[H,F]=g.useState(null),[I,q]=g.useState({name:"",isActive:!0}),[G,Z]=g.useState(!1),te=async()=>{try{const b=await oe.getTenants();l(b)}catch(b){console.error("Failed to load tenants",b)}finally{u(!1)}};g.useEffect(()=>{te()},[]);const O=async b=>{if(b.preventDefault(),!(!C.id.trim()||!C.name.trim())){D(!0);try{await oe.createTenant({id:C.id.trim(),name:C.name.trim()}),y({text:`学校 [${C.name}] 创建成功!`,success:!0}),j(!1),S({id:"",name:""}),te()}catch(ne){y({text:ne.message||"创建学校失败",success:!1})}finally{D(!1)}}},K=b=>{F(b),q({name:b.name,isActive:b.isActive})},fe=async b=>{if(b.preventDefault(),!(!H||!I.name.trim())){Z(!0);try{await oe.updateTenant(H.id,{name:I.name.trim(),isActive:I.isActive}),y({text:`学校 [${I.name}] 配置已更新`,success:!0}),F(null),te()}catch(ne){y({text:ne.message||"更新学校配置失败",success:!1})}finally{Z(!1)}}},pe=a.filter(b=>b.name.toLowerCase().includes(d.toLowerCase())||b.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"学校租户生命周期管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"统筹多校区租户实体,支持新校区入驻配置、基础信息变更与服务启停冻结"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{u(!0),te()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建学校"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:m.text})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:b=>f(b.target.value),placeholder:"按学校标识代码 (ID) 或名称搜索...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校名称 / 标识码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级总数"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"终端大屏 (在线/总计)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"服务状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"接入时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"管理操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:pe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在读取租户列表...":"暂无匹配的学校租户"})}):pe.map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 font-bold",children:n.jsx(Qt,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-white",children:b.name}),n.jsx("div",{className:"text-xs text-slate-500 font-mono mt-0.5",children:b.id})]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700",children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-indigo-400"}),n.jsxs("span",{children:[b.classroomCount," 个班级"]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"font-semibold text-emerald-400",children:[b.onlineCount," 在线"]}),n.jsx("span",{className:"text-slate-500",children:"/"}),n.jsxs("span",{className:"text-slate-400",children:[b.deviceCount," 总屏"]})]})}),n.jsx("td",{className:"py-4 px-4",children:b.isActive?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"正常运营"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"已停用冻结"})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(b.createdAt).toLocaleDateString()}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsxs(ge,{to:`/admin/codes?tenantId=${b.id}&openGenerate=true`,className:"px-2.5 py-1.5 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"为此学校生成班级设备激活码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成激活码"]}),n.jsxs("button",{onClick:()=>K(b),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",children:[n.jsx(Kd,{className:"w-3 h-3"}),"编辑配置"]})]})})]},b.id))})]})})}),p&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"接入新学校租户"}),n.jsxs("form",{onSubmit:O,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校唯一标识代码 (Tenant ID)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: t_beijing_no8 或 bj_highschool",value:C.id,onChange:b=>S({...C,id:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"只能包含小写字母、数字和下划线,作为多租户隔离主键不可篡改"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称 (Display Name)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 北京市第四中学",value:C.name,onChange:b=>S({...C,name:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:$,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:$?"正在创建...":"确认接入"})]})]})]})}),H&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["编辑学校配置: ",H.id]}),n.jsxs("form",{onSubmit:fe,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称"}),n.jsx("input",{type:"text",required:!0,value:I.name,onChange:b=>q({...I,name:b.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"运营状态"}),n.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!0,onChange:()=>q({...I,isActive:!0}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-emerald-400",children:"正常运营"})]}),n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:I.isActive===!1,onChange:()=>q({...I,isActive:!1}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-rose-400",children:"停用冻结 (拒绝该校任何指令)"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>F(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:G,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:G?"保存中...":"保存更改"})]})]})]})})]})},ux=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState(null),[H,F]=g.useState(!1),[I,q]=g.useState({tenantId:"",username:"",password:"",fullName:"",role:"Teacher"}),[G,Z]=g.useState(!1),[te,O]=g.useState(null),[K,fe]=g.useState(""),[pe,b]=g.useState(!1),[ne,Ee]=g.useState(null),je=async()=>{try{const[k,W]=await Promise.all([oe.getUsers(p||void 0,C||void 0),oe.getTenants()]);l(k),u(W)}catch(k){console.error("Failed to load user management data",k)}finally{f(!1)}};g.useEffect(()=>{je()},[p,C]);const _e=async k=>{var W;if(k.preventDefault(),!I.tenantId||!I.username||!I.password||!I.fullName){D({text:"请填写所有必填字段",success:!1});return}Z(!0);try{await oe.createUser(I),D({text:`用户 [${I.username}] 创建成功!`,success:!0}),F(!1),q({tenantId:((W=o[0])==null?void 0:W.id)||"",username:"",password:"",fullName:"",role:"Teacher"}),je()}catch(T){D({text:T.message||"创建用户失败",success:!1})}finally{Z(!1)}},Ue=async k=>{if(k.preventDefault(),!(!te||!K.trim())){b(!0);try{await oe.resetPassword(te.id,K.trim()),D({text:`用户 [${te.username}] 的密码已重置成功`,success:!0}),O(null),fe("")}catch(W){D({text:W.message||"重置密码失败",success:!1})}finally{b(!1)}}},$e=async k=>{const W=!k.isLocked,T=W?`确定要锁定账号 [${k.username}] 吗?锁定后该用户将无法登录系统。`:`确定要解锁账号 [${k.username}] 吗?`;if(window.confirm(T)){Ee(`lock_${k.id}`);try{await oe.setUserLock(k.id,W),D({text:`用户 [${k.username}] 已成功${W?"锁定":"解锁"}`,success:!0}),je()}catch(N){D({text:N.message||"操作失败",success:!1})}finally{Ee(null)}}},Te=async k=>{if(k.role==="SuperAdmin"){alert("超级管理员账号不可删除");return}if(window.confirm(`警告:确定要永久删除用户 [${k.username} (${k.fullName})] 吗?此操作不可逆!`)){Ee(`delete_${k.id}`);try{await oe.deleteUser(k.id),D({text:`用户 [${k.username}] 已被删除`,success:!0}),je()}catch(W){D({text:W.message||"删除用户失败",success:!1})}finally{Ee(null)}}},V=a.filter(k=>k.username.toLowerCase().includes(m.toLowerCase())||k.fullName.toLowerCase().includes(m.toLowerCase())||k.tenantName.toLowerCase().includes(m.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"多租户统一用户中枢"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"全网教职工与校级管理员统一管控,支持跨校账号开户、密码强行重置、异常封禁与权限审计"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{f(!0),je()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{o.length>0&&!I.tenantId&&q(k=>({...k,tenantId:o[0].id})),F(!0)},className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建用户"]})]})]}),$&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${$.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[$.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:$.text})]}),n.jsx("button",{onClick:()=>D(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:m,onChange:k=>y(k.target.value),placeholder:"搜索用户名、姓名或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:p,onChange:k=>j(k.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部学校 (全网)"}),o.map(k=>n.jsxs("option",{value:k.id,children:[k.name," (",k.id,")"]},k.id))]})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Nr,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:C,onChange:k=>S(k.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部角色"}),n.jsx("option",{value:"SuperAdmin",children:"平台超级管理员"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员"}),n.jsx("option",{value:"Teacher",children:"普通授课教师"})]})]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"用户姓名 / 登录名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"归属学校"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"角色身份"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"生命周期操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:V.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:d?"正在同步用户中枢...":"暂无匹配的用户"})}):V.map(k=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:k.fullName}),n.jsx("div",{className:"text-xs text-slate-400 font-mono mt-0.5",children:k.username})]}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:k.tenantName}),n.jsx("div",{className:"text-[11px] text-slate-500 font-mono",children:k.tenantId})]}),n.jsx("td",{className:"py-4 px-4",children:k.role==="SuperAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Bl,{className:"w-3 h-3"}),"超级管理员"]}):k.role==="SchoolAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-indigo-500/10 border border-indigo-500/30 text-indigo-400",children:[n.jsx(Qt,{className:"w-3 h-3"}),"校区管理员"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-300",children:[n.jsx(Nr,{className:"w-3 h-3"}),"授课老师"]})}),n.jsx("td",{className:"py-4 px-4",children:k.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-rose-500/15 text-rose-400 border border-rose-500/30",children:[n.jsx(bs,{className:"w-3 h-3"}),"已锁定封禁"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:k.lastLoginAt?new Date(k.lastLoginAt).toLocaleString():"尚未登录"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>O(k),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"强制重置登录密码",children:[n.jsx(ut,{className:"w-3 h-3 text-amber-400"}),"重置密码"]}),k.role!=="SuperAdmin"&&n.jsxs("button",{onClick:()=>$e(k),disabled:ne===`lock_${k.id}`,className:`px-2 py-1 rounded-lg border text-xs font-medium transition-colors inline-flex items-center gap-1 ${k.isLocked?"bg-emerald-600/15 border-emerald-500/30 text-emerald-300 hover:bg-emerald-600/25":"bg-rose-600/15 border-rose-500/30 text-rose-300 hover:bg-rose-600/25"}`,title:k.isLocked?"解除账号锁定":"锁定账号",children:[k.isLocked?n.jsx(ea,{className:"w-3 h-3"}):n.jsx(bs,{className:"w-3 h-3"}),k.isLocked?"解锁":"锁定"]}),k.role!=="SuperAdmin"&&n.jsx("button",{onClick:()=>Te(k),disabled:ne===`delete_${k.id}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"删除用户",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},k.id))})]})})}),H&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"开通新用户账号"}),n.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"归属学校"}),n.jsxs("select",{required:!0,value:I.tenantId,onChange:k=>q({...I,tenantId:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"-- 请选择学校 --"}),o.map(k=>n.jsxs("option",{value:k.id,children:[k.name," (",k.id,")"]},k.id))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户角色"}),n.jsxs("select",{value:I.role,onChange:k=>q({...I,role:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"Teacher",children:"普通授课老师 (Teacher)"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"})]}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"平台超级管理员只可通过系统底层配置文件委任,禁止通过控制台赋予。"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: teacher_li 或 admin_no4",value:I.username,onChange:k=>q({...I,username:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户真实姓名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 李老师",value:I.fullName,onChange:k=>q({...I,fullName:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始登录密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"设置 6 位以上密码",value:I.password,onChange:k=>q({...I,password:k.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>F(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:G,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:G?"正在创建...":"确认开户"})]})]})]})}),te&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["重置用户密码: ",te.username]}),n.jsxs("p",{className:"text-xs text-slate-400",children:["为归属于 [",te.tenantName,"] 的 [",te.fullName,"] 强行设置新密码。"]}),n.jsxs("form",{onSubmit:Ue,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"请输入新密码",value:K,onChange:k=>fe(k.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>{O(null),fe("")},className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:pe,className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold shadow-lg shadow-amber-500/25 transition-all disabled:opacity-50",children:pe?"重置中...":"确认重置"})]})]})]})})]})},dx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState([]),[m,y]=g.useState(!1),[p,j]=g.useState({tenantId:"",title:"⚠️ 全校紧急预警通报",message:"",voice:!0,shake:!0,durationSeconds:30}),[C,S]=g.useState(!1),[$,D]=g.useState(!1),[H,F]=g.useState(null),I=[{title:"⚠️ 消防紧急疏散演练",content:"全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速、有序撤离至操场,不要慌乱!",duration:60,shake:!0,voice:!0,icon:x0},{title:"⛈️ 恶劣雷雨大风避险通报",content:"气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁学生前往走廊与室外活动!",duration:45,shake:!0,voice:!0,icon:d0},{title:"📢 临时紧急集合通知",content:"请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学保持教室内安静自习。",duration:30,shake:!1,voice:!0,icon:Hn},{title:"🔔 全校临时作息调整",content:"因突发教学安排,今天下午放学时间调整为 16:30,请任课老师提醒学生整理个人物品按时离校。",duration:30,shake:!1,voice:!0,icon:C0}],q=async()=>{try{const b=await oe.getTenants();l(b)}catch(b){console.error("Failed to load tenants",b)}finally{u(!1)}},G=async()=>{y(!0);try{const b=await oe.getAdminNotifications(15);f(b)}catch(b){console.error("Failed to load recent broadcasts",b)}finally{y(!1)}};g.useEffect(()=>{q(),G()},[]);const Z=b=>{j(ne=>({...ne,title:b.title,message:b.content,durationSeconds:b.duration,shake:b.shake,voice:b.voice}))},te=b=>{if(b.preventDefault(),!p.message.trim()){alert("请输入广播通知正文");return}S(!0)},O=async()=>{D(!0);try{const b=await oe.sendEmergencyBroadcast({...p,tenantId:p.tenantId||void 0});F({dispatchedCount:b.dispatchedCount,targetSchools:b.targetSchools,message:b.message,success:!0,timestamp:new Date().toLocaleTimeString()}),S(!1),j(ne=>({...ne,message:""})),G()}catch(b){F({dispatchedCount:0,targetSchools:0,message:b.message||"应急广播下发失败",success:!1,timestamp:new Date().toLocaleTimeString()}),S(!1)}finally{D(!1)}},K=a.find(b=>b.id===p.tenantId),fe=K?K.classroomCount:a.reduce((b,ne)=>b+(ne.classroomCount||0),0),pe=K?K.deviceCount:a.reduce((b,ne)=>b+(ne.deviceCount||0),0);return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(br,{className:"w-5 h-5 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域紧急应急广播"}),n.jsx("p",{className:"text-sm text-slate-400 mt-0.5",children:"超级管理员最高优先调度通道,覆盖全网多校区所有教室大屏终端,支持强置顶、TTS 语音播报与视效抖动"})]})]})}),H&&n.jsx("div",{className:`p-5 rounded-xl border transition-all animate-in fade-in slide-in-from-top-2 ${H.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[H.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0 mt-0.5"}):n.jsx(ks,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-sm",children:H.success?"全域紧急广播指令已成功下发":"广播下发遇到异常"}),n.jsx("p",{className:"text-xs text-slate-300 mt-1",children:H.message}),H.success&&n.jsxs("div",{className:"flex flex-wrap gap-4 mt-3 text-xs",children:[n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["目标学校: ",n.jsx("strong",{className:"text-white",children:H.targetSchools})," 所"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["投递教室班级: ",n.jsx("strong",{className:"text-emerald-400",children:H.dispatchedCount})," 间"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-400 font-mono",children:["下发时间: ",H.timestamp]})]})]})]}),n.jsx("button",{onClick:()=>F(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-4 h-4"})})]})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"应急广播预设模板 (点击快速填装)"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:I.map((b,ne)=>{const Ee=b.icon;return n.jsxs("button",{type:"button",onClick:()=>Z(b),className:"glass-panel p-3.5 border-slate-800 text-left hover:border-indigo-500/50 hover:bg-slate-800/40 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-slate-200 group-hover:text-indigo-400 mb-1",children:[n.jsx(Ee,{className:"w-4 h-4 text-indigo-400"}),n.jsx("span",{children:b.title})]}),n.jsx("p",{className:"text-[11px] text-slate-500 line-clamp-2",children:b.content})]},ne)})})]}),n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:te,className:"space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Qt,{className:"w-3.5 h-3.5 text-indigo-400"}),"目标广播范围"]}),n.jsxs("span",{className:"text-[11px] text-slate-400 font-normal",children:["预计覆盖 ",fe," 班级 / ",pe," 大屏"]})]}),n.jsxs("select",{value:p.tenantId||"",onChange:b=>j({...p,tenantId:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"🚨 全网所有学校与所有教室大屏 (全域覆盖)"}),a.map(b=>n.jsxs("option",{value:b.id,children:["仅该校: ",b.name," (",b.classroomCount," 班级, ",b.deviceCount," 大屏)"]},b.id))]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1.5",children:[n.jsx(Bl,{className:"w-3.5 h-3.5 text-rose-400"}),"广播标题"]}),n.jsx("input",{type:"text",required:!0,value:p.title,onChange:b=>j({...p,title:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",placeholder:"例如: ⚠️ 全校紧急避险预警"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"广播正文内容 (将同步在所有大屏全屏高显并由 Windows TTS 朗读)"}),n.jsx("textarea",{required:!0,rows:4,value:p.message,onChange:b=>j({...p,message:b.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 font-sans",placeholder:"请输入紧急通报具体事项,语言力求简明扼要..."})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 pt-2 border-t border-slate-800",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-indigo-400"}),"展示持续时长: ",p.durationSeconds," 秒"]}),n.jsx("input",{type:"range",min:10,max:300,step:5,value:p.durationSeconds,onChange:b=>j({...p,durationSeconds:parseInt(b.target.value,10)}),className:"w-full accent-indigo-500 cursor-pointer"}),n.jsxs("div",{className:"flex justify-between text-[11px] text-slate-500 mt-1",children:[n.jsx("span",{children:"10秒"}),n.jsx("span",{children:"60秒"}),n.jsx("span",{children:"5分钟"})]})]}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.voice,onChange:b=>j({...p,voice:b.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-emerald-400"}),"TTS 语音朗读"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"大屏端通过系统扬声器朗读"})]})]})}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.shake,onChange:b=>j({...p,shake:b.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(X0,{className:"w-3.5 h-3.5 text-rose-400"}),"窗口视效震颤"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"高频强抖动提醒上课师生"})]})]})})]}),n.jsx("div",{className:"pt-2 flex justify-end",children:n.jsxs("button",{type:"submit",disabled:$||!p.message.trim(),className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-sm font-semibold shadow-xl shadow-rose-600/30 transition-all disabled:opacity-50",children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"下发全域紧急广播..."})]})})]})}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"最近全网广播与呼叫调度记录"]}),n.jsx("button",{onClick:G,disabled:m,className:"text-xs text-indigo-400 hover:text-indigo-300 disabled:opacity-50",children:m?"刷新中...":"刷新记录"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs",children:[n.jsx("thead",{className:"text-[11px] uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2.5 px-3",children:"发起时间"}),n.jsx("th",{className:"py-2.5 px-3",children:"调度类型"}),n.jsx("th",{className:"py-2.5 px-3",children:"目标班级/范围"}),n.jsx("th",{className:"py-2.5 px-3",children:"通知内容"}),n.jsx("th",{className:"py-2.5 px-3 text-right",children:"投递状态"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"py-8 text-center text-slate-500",children:m?"正在加载历史记录...":"暂无最近调度记录"})}):d.slice(0,8).map(b=>n.jsxs("tr",{className:"hover:bg-slate-800/20",children:[n.jsx("td",{className:"py-3 px-3 font-mono text-slate-400 whitespace-nowrap",children:new Date(b.createdAt).toLocaleTimeString()}),n.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:b.priority==="Urgent"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/20 font-medium",children:[n.jsx(ks,{className:"w-3 h-3"}),"紧急通报"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/20",children:"日常呼叫"})}),n.jsx("td",{className:"py-3 px-3 text-white font-medium whitespace-nowrap",children:b.className||"全域广播"}),n.jsx("td",{className:"py-3 px-3 text-slate-300 max-w-xs truncate",children:b.message}),n.jsx("td",{className:"py-3 px-3 text-right whitespace-nowrap",children:b.status==="Cancelled"?n.jsx("span",{className:"text-slate-400",children:"已撤回关闭"}):b.status==="Acknowledged"?n.jsx("span",{className:"text-emerald-400 font-medium",children:"已确认"}):b.status==="Delivered"?n.jsx("span",{className:"text-sky-400",children:"大屏已接收"}):n.jsx("span",{className:"text-slate-400",children:"已发送"})})]},b.id))})]})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-lg w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(Bl,{className:"w-6 h-6 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"全域极高优先级应急调度二次核验"}),n.jsx("p",{className:"text-xs text-rose-400/90 font-medium mt-0.5",children:"请谨慎操作:此指令将强制穿透终端并在全网大屏置顶展示"})]})]}),n.jsxs("div",{className:"space-y-3 mb-5",children:[n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 space-y-2 text-xs",children:[n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"目标受众范围:"}),n.jsx("span",{className:"text-white font-semibold",children:p.tenantId?`${(K==null?void 0:K.name)||p.tenantId} (${fe} 班级)`:`全域所有学校 (${a.length} 所学校, 约 ${fe} 班级)`})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"广播标题:"}),n.jsx("span",{className:"text-white font-medium",children:p.title})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"展示时长与视效:"}),n.jsxs("span",{className:"text-slate-200",children:[p.durationSeconds," 秒 · ",p.voice?"TTS 语音":"无声音"," · ",p.shake?"视效抖动":"无抖动"]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3 rounded-xl border border-slate-800/80 text-xs",children:[n.jsx("span",{className:"text-slate-500 text-[11px] block mb-1",children:"播报正文内容:"}),n.jsx("p",{className:"text-slate-200 font-sans leading-relaxed",children:p.message})]}),n.jsx("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-[11px] text-rose-300/90 leading-relaxed",children:"⚠️ 确认后,云端将在毫秒内将此通报广播下发至所选教室大屏。终端如果处于上课或展示课件状态,也将直接浮现全屏红框强提醒!"})]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:$,onClick:()=>S(!1),className:"px-4 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"放弃下发"}),n.jsx("button",{type:"button",disabled:$,onClick:O,className:"px-5 py-2.5 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/30 transition-all flex items-center gap-2 disabled:opacity-50",children:$?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在全域调度广播..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"确认立即全网广播"})]})})]})]})})]})},hx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),p=async()=>{f(!0),y(null);try{const[j,C]=await Promise.all([oe.getSchoolOverview(),oe.getSchoolDevices()]);l(j),u(C)}catch(j){y((j==null?void 0:j.message)||"加载学校总览与设备数据失败")}finally{f(!1)}};return g.useEffect(()=>{p();const j=Ot.onDeviceStatusChanged(S=>{u($=>{const D=S.state===1||String(S.state).toLowerCase()==="online",H=$.map(I=>I.deviceId===S.deviceId?{...I,isOnline:D,lastHeartbeat:S.lastHeartbeat,clientVersion:S.agentVersion||I.clientVersion}:I),F=H.filter(I=>I.isOnline).length;return l(I=>I?{...I,onlineCount:F}:null),H})}),C=Ot.onHealthReportReceived(S=>{u($=>$.map(D=>D.deviceId===S.deviceId?{...D,healthStatus:S.overallStatus,lastHeartbeat:S.timestamp||new Date().toISOString()}:D))});return()=>{j(),C()}},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:(a==null?void 0:a.tenantName)||"本校管理后台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"管理本校班级配置、多媒体教室设备绑定与科任教师账号"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:p,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"已建班级"}),n.jsx(gr,{className:"w-4 h-4 text-sky-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.classCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"个教学班"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教室终端"}),n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.deviceCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台已安装"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"实时在线"}),n.jsx(ua,{className:"w-4 h-4 text-emerald-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),d?"-":(a==null?void 0:a.onlineCount)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 总 ",d?"-":(a==null?void 0:a.deviceCount)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教师账号"}),n.jsx(Hn,{className:"w-4 h-4 text-amber-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.teacherCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"位老师"})]})]})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-sky-400"}),"本校各教室设备状态与健康体检"]}),n.jsx(ge,{to:"/school-admin/classes",className:"text-xs text-sky-400 hover:text-sky-300 font-medium flex items-center gap-1",children:"班级管理"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"设备编号"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"在线状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"健康状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最后心跳"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"版本"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在同步设备列表..."})]})})}):o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-500",children:"暂无已绑定的教室设备,请前往【本校激活码】生成激活码并在教室电脑安装"})}):o.map(j=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-3.5 px-4 font-medium text-white",children:j.classroomName}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:j.deviceId}),n.jsx("td",{className:"py-3.5 px-4",children:j.isOnline?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"在线"]}):n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线"})}),n.jsx("td",{className:"py-3.5 px-4",children:j.healthStatus==="Degraded"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Bl,{className:"w-3 h-3 text-amber-400"}),"亚健康"]}):j.healthStatus==="Healthy"||j.isOnline&&!j.healthStatus?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(_s,{className:"w-3 h-3 text-emerald-400"}),"健康"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线未检"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400",children:j.lastHeartbeat?new Date(j.lastHeartbeat).toLocaleTimeString():"无"}),n.jsxs("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:["v",j.clientVersion||"2.1.0"]})]},j.deviceId))})]})})]})]})},fx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState(""),[H,F]=g.useState(!1),[I,q]=g.useState(null),G=async()=>{try{const O=await oe.getSchoolClasses();l(O)}catch(O){console.error("Failed to load classes",O)}finally{u(!1)}};g.useEffect(()=>{G()},[]);const Z=async O=>{if(O.preventDefault(),!(!m||!p)){F(!0);try{await oe.createSchoolClass({id:m,displayName:p,grade:C,roomNumber:$}),f(!1),y(""),j(""),S(""),D(""),G()}catch(K){alert(K.message||"创建班级失败")}finally{F(!1)}}},te=async O=>{try{const K=await oe.generateSchoolCode(O);q({classId:O,code:K.code})}catch(K){alert(K.message||"生成激活码失败")}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校班级管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"维护学校全部教学班级,并为各班级生成设备激活码"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建教学班"]})]}),I&&n.jsxs("div",{className:"p-4 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsxs("span",{className:"font-semibold",children:["【",I.classId,"】激活码已生成:"]}),n.jsx("span",{className:"font-mono text-base font-bold text-white ml-2 bg-slate-900 px-2 py-1 rounded",children:I.code}),n.jsx("span",{className:"text-xs text-emerald-400/80 ml-3",children:"(请在教室电脑运行 ClassNotifySetup.exe 输入该激活码完成绑定)"})]}),n.jsx("button",{onClick:()=>{navigator.clipboard.writeText(I.code),alert("激活码已复制!")},className:"px-3 py-1 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium",children:"复制激活码"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级编号 (ClassId)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"年级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教室位置"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:a.map(O=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-semibold text-white",children:O.displayName}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:O.id}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:O.grade||"-"}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:O.roomNumber||"-"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("button",{onClick:()=>te(O.id),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sky-600/10 hover:bg-sky-600/20 border border-sky-500/30 text-sky-400 text-xs font-medium transition-colors",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成安装激活码"]})})]},O.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(gr,{className:"w-5 h-5 text-sky-400"}),"新建教学班级"]}),n.jsxs("form",{onSubmit:Z,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级编号 (唯一识别码)"}),n.jsx("input",{type:"text",value:m,onChange:O=>y(O.target.value),placeholder:"如 cls_803 或 cls_grade7_1",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级显示名称"}),n.jsx("input",{type:"text",value:p,onChange:O=>j(O.target.value),placeholder:"如 八年级(3)班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"年级 (可选)"}),n.jsx("input",{type:"text",value:C,onChange:O=>S(O.target.value),placeholder:"如 初二 / 高一",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教室位置 (可选)"}),n.jsx("input",{type:"text",value:$,onChange:O=>D(O.target.value),placeholder:"如 教学楼 303",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"创建中...":"确认创建"})]})]})]})})]})},mx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[C,S]=g.useState(""),[$,D]=g.useState("Teacher"),[H,F]=g.useState(!1),[I,q]=g.useState(null),[G,Z]=g.useState(""),[te,O]=g.useState(!1),[K,fe]=g.useState(null),[pe,b]=g.useState(!1),[ne,Ee]=g.useState(null),je=(V,k)=>{Ee({type:V,text:k}),setTimeout(()=>{Ee(W=>(W==null?void 0:W.text)===k?null:W)},4e3)},_e=async()=>{try{const V=await oe.getSchoolTeachers();l(V)}catch(V){je("error",(V==null?void 0:V.message)||"加载教师列表失败")}finally{u(!1)}};g.useEffect(()=>{_e()},[]);const Ue=async V=>{if(V.preventDefault(),!(!m||!p||!C)){F(!0);try{await oe.createSchoolTeacher({username:m,password:p,fullName:C,role:$}),f(!1),y(""),j(""),S(""),je("success",`教师账号 ${C} 开设成功`),_e()}catch(k){alert(k.message||"创建教师账号失败")}finally{F(!1)}}},$e=async V=>{if(V.preventDefault(),!(!I||!G)){if(G.length<6){alert("新密码长度不能少于 6 位");return}O(!0);try{await oe.resetSchoolTeacherPassword(I.id,G),je("success",`已成功将教师 [${I.fullName}] 的密码重置`),q(null),Z("")}catch(k){alert(k.message||"重置密码失败")}finally{O(!1)}}},Te=async()=>{if(!K)return;b(!0);const V=!K.isLocked;try{await oe.setSchoolTeacherLock(K.id,V),je("success",`已成功${V?"停用":"启用"}教师 [${K.fullName}] 账号`),fe(null),_e()}catch(k){alert(k.message||"操作失败")}finally{b(!1)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教师账号管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"为科任教师开设 ClassNotify 网页控制台与后续 Android 移动端登录权限"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"开设教师账号"]})]}),ne&&n.jsxs("div",{className:`p-3.5 rounded-xl border text-xs flex items-center justify-between transition-all ${ne.type==="success"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[ne.type==="success"?n.jsx(Pt,{className:"w-4 h-4 text-emerald-400 shrink-0"}):n.jsx(ks,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:ne.text})]}),n.jsx("button",{onClick:()=>Ee(null),className:"text-slate-400 hover:text-white",children:n.jsx(kr,{className:"w-3.5 h-3.5"})})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教师姓名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"登录账号"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"权限角色"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(kn,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-sky-400"}),n.jsx("span",{children:"正在加载教师列表..."})]})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:"暂未开设任何教师账号,请点击右上角按钮添加"})}):a.map(V=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-semibold text-white flex items-center gap-2",children:[V.role==="SchoolAdmin"?n.jsx(H0,{className:"w-4 h-4 text-sky-400"}):n.jsx(Nr,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:V.fullName})]}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:V.username}),n.jsx("td",{className:"py-4 px-4 text-xs",children:V.role==="SchoolAdmin"?n.jsx("span",{className:"px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/30",children:"学校管理员"}):n.jsx("span",{className:"px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:"任课教师"})}),n.jsx("td",{className:"py-4 px-4",children:V.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/30 text-xs font-medium",children:[n.jsx(bs,{className:"w-3 h-3"}),"已停用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 text-xs font-medium",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常可用"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400 font-mono",children:V.lastLoginAt?new Date(V.lastLoginAt).toLocaleString():n.jsxs("span",{className:"text-slate-600 flex items-center gap-1",children:[n.jsx(Kn,{className:"w-3 h-3"}),"从未登录"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>{q(V),Z("")},className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-slate-800 hover:bg-slate-700 text-sky-400 hover:text-sky-300 text-xs font-medium border border-slate-700 transition-colors",title:"重置登录密码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"重置密码"})]}),n.jsx("button",{type:"button",onClick:()=>fe(V),className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${V.isLocked?"bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 border-rose-500/30"}`,title:V.isLocked?"恢复账号":"停用账号",children:V.isLocked?n.jsxs(n.Fragment,{children:[n.jsx(ea,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"恢复"})]}):n.jsxs(n.Fragment,{children:[n.jsx(bs,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"停用"})]})})]})})]},V.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(Hn,{className:"w-5 h-5 text-sky-400"}),"开设新账号"]}),n.jsxs("form",{onSubmit:Ue,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教师真实姓名"}),n.jsx("input",{type:"text",value:C,onChange:V=>S(V.target.value),placeholder:"如 王老师 / 李明",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsx("input",{type:"text",value:m,onChange:V=>y(V.target.value),placeholder:"如 teacher_wang",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录初始密码"}),n.jsx("input",{type:"password",value:p,onChange:V=>j(V.target.value),placeholder:"••••••••",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"角色权限"}),n.jsxs("select",{value:$,onChange:V=>D(V.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",children:[n.jsx("option",{value:"Teacher",children:"普通科任教师 (仅呼叫与回执)"}),n.jsx("option",{value:"SchoolAdmin",children:"学校管理员 (可管理班级与账号)"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"开设计算中...":"确认开通"})]})]})]})}),I&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-sky-500/10 border border-sky-500/20 text-sky-400",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"重置教师密码"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",I.fullName," (",I.username,")"]})]})]}),n.jsxs("form",{onSubmit:$e,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"请输入新密码 (不少于 6 位)"}),n.jsx("input",{type:"text",autoFocus:!0,required:!0,minLength:6,value:G,onChange:V=>Z(V.target.value),placeholder:"例如: Teacher@2026",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm font-mono focus:ring-2 focus:ring-sky-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"密码重置后请告知教师,教师下一次在网页端或移动端即可使用此新密码登录。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",disabled:te,onClick:()=>q(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:te||G.length<6,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50 flex items-center gap-1.5",children:te?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在重置..."})]}):n.jsx("span",{children:"确认重置密码"})})]})]})]})}),K&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:`p-2.5 rounded-xl border ${K.isLocked?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-rose-500/10 border-rose-500/20 text-rose-400"}`,children:K.isLocked?n.jsx(ea,{className:"w-5 h-5"}):n.jsx(bs,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:K.isLocked?"恢复启用教师账号?":"停用该教师账号?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",K.fullName," (",K.username,")"]})]})]}),n.jsx("p",{className:"text-xs text-slate-300 leading-relaxed mb-5",children:K.isLocked?"恢复启用后,该教师可重新登录控制台并向关联班级发送上课通知。":"停用后,该教师将无法登录网页控制台与 Android 移动端,且无法继续发送呼叫通知。教师的历史发送记录与回执将完整保留。"}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:pe,onClick:()=>fe(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"button",disabled:pe,onClick:Te,className:`px-4 py-2 rounded-xl text-white text-xs font-semibold shadow-lg transition-all flex items-center gap-1.5 disabled:opacity-50 ${K.isLocked?"bg-emerald-600 hover:bg-emerald-500 shadow-emerald-600/25":"bg-rose-600 hover:bg-rose-500 shadow-rose-600/25"}`,children:pe?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"处理中..."})]}):n.jsx("span",{children:K.isLocked?"确认恢复启用":"确认停用账号"})})]})]})})]})},px=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),[p,j]=g.useState(null),[C,S]=g.useState(!1),[$,D]=g.useState(""),[H,F]=g.useState(!1),[I,q]=g.useState(null),G=async()=>{f(!0),y(null);try{const[O,K]=await Promise.all([oe.getSchoolCodes(),oe.getSchoolClasses()]);l(O),u(K),K.length>0&&!$&&D(K[0].id)}catch(O){y((O==null?void 0:O.message)||"加载本校激活码数据失败")}finally{f(!1)}};g.useEffect(()=>{G()},[]);const Z=O=>{navigator.clipboard.writeText(O),j(O),setTimeout(()=>j(null),2e3)},te=async O=>{if(O.preventDefault(),!!$){F(!0),q(null);try{await oe.generateSchoolCode($),S(!1),G()}catch(K){q((K==null?void 0:K.message)||"生成激活码失败")}finally{F(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教室终端激活码"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理本校教室电脑安装所需的 8 位一次性硬件绑定激活码"})]}),n.jsxs("button",{onClick:()=>{q(null),S(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:G,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在加载本校激活码..."})]})})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-500",children:"本校暂无生成的激活码,请点击右上角生成"})}):a.map(O=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-mono font-bold text-sky-400 text-base flex items-center gap-2",children:[n.jsx("span",{children:O.code}),n.jsx("button",{onClick:()=>Z(O.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:p===O.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:O.classroomName||O.classroomId}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:O.classroomId})]}),n.jsx("td",{className:"py-4 px-4",children:O.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:[n.jsx(Pt,{className:"w-3.5 h-3.5 text-slate-500"}),"已激活使用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),"待激活 (可用)"]})}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:O.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:O.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsxs("span",{children:[new Date(O.expiresAt).toLocaleDateString()," 到期"]})]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsx("button",{onClick:()=>Z(O.code),className:"text-xs text-slate-400 hover:text-white underline underline-offset-4",children:p===O.code?"已复制":"复制用于安装"})})]},O.code))})]})})}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-sky-400"}),"生成本校班级设备激活码"]}),I&&n.jsx("div",{className:"mb-4 p-3 rounded-lg bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs",children:I}),n.jsxs("form",{onSubmit:te,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标班级"}),o.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-2 bg-amber-500/10 rounded-lg border border-amber-500/30",children:"本校暂无班级,请先前往“班级管理”创建班级。"}):n.jsx("select",{value:$,onChange:O=>D(O.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0,children:o.map(O=>n.jsxs("option",{value:O.id,children:[O.displayName," (",O.id,")"]},O.id))})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>S(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:H||o.length===0,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:H?"生成中...":"立即生成"})]})]})]})})]})};function Ed(a){if(typeof a=="string")switch(a.toLowerCase()){case"acknowledged":case"confirmed":return"Acknowledged";case"delivered":return"Delivered";case"sent":return"Sent";case"cancelled":case"canceled":return"Cancelled";case"timeout":return"Timeout";case"failed":return"Failed";default:return"Sent"}switch(a){case 5:return"Cancelled";case 2:return"Acknowledged";case 1:return"Delivered";case 0:return"Sent";case 3:return"Timeout";case 4:return"Failed";default:return"Sent"}}const xx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(""),[d,f]=g.useState(""),[m,y]=g.useState(""),[p,j]=g.useState(!0),[C,S]=g.useState(!0),[$,D]=g.useState(!1),[H,F]=g.useState(15),[I,q]=g.useState(!1),[G,Z]=g.useState([]),[te,O]=g.useState(!0),[K,fe]=g.useState(null),[pe,b]=g.useState(null),[ne,Ee]=g.useState(null),[je,_e]=g.useState(!1),[Ue,$e]=g.useState(null),[Te,V]=g.useState(1),k=async(U,de,ot,be)=>{b({notificationId:U,deviceId:de,className:ot,capturedAt:be}),_e(!0),$e(null),Ee(null),V(1);try{const We=await oe.getVisualReceiptBlob(U,de),Le=URL.createObjectURL(We);Ee(Le)}catch(We){$e((We==null?void 0:We.message)||"获取视觉核验图像失败")}finally{_e(!1)}},W=()=>{ne&&URL.revokeObjectURL(ne),Ee(null),b(null),$e(null),V(1)},[T,N]=g.useState(null),[L,ie]=g.useState(!1),ce=async()=>{if(T){ie(!0);try{await oe.cancelNotification(T.id),Z(U=>U.map(de=>de.id===T.id?{...de,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:de)),N(null)}catch(U){alert(U.message||"提前关闭通知失败")}finally{ie(!1)}}},he=na.useRef(a);g.useEffect(()=>{he.current=a},[a]);const ve=["请带各科作业本到办公室","马上到操场集合整队","课代表请到教研室领试卷","午休时间请教室内保持安静","请班长负责维护自习纪律","放学后值日生留下来打扫卫生"],ke=async()=>{O(!0),fe(null);try{const U=await oe.getTeacherClasses();l(U),U.length>0&&!o&&u(U[0].id);const de=await oe.getTeacherHistory(void 0,20);Z(de.map(ot=>({...ot,status:Ed(ot.status)})))}catch(U){fe((U==null?void 0:U.message)||"加载班级或历史记录失败")}finally{O(!1)}};g.useEffect(()=>{ke()},[]),g.useEffect(()=>{const U=Ot.onAckReceiptReceived(be=>{Z(We=>We.map(Le=>{if(Le.id===be.messageId){const Jn=Ed(be.status);return{...Le,status:Jn,confirmedAt:be.timestamp||Le.confirmedAt||new Date().toISOString()}}return Le}))}),de=Ot.onNewNotificationBroadcast(be=>{Z(We=>{if(We.some(nn=>nn.id===be.id))return We;const Le=he.current.find(nn=>nn.id===be.classId);return[{id:be.id,tenantId:be.tenantId,classId:be.classId,className:(Le==null?void 0:Le.displayName)||be.classId,senderName:"教师",message:be.message,priority:be.type===2?"Urgent":"Normal",createdAt:be.createdAt,status:"Sent"},...We]})}),ot=Ot.onNotificationCancelled(be=>{Z(We=>We.map(Le=>Le.id===be?{...Le,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:Le))});return()=>{U(),de(),ot()}},[]);const Ne=async U=>{if(U.preventDefault(),!(!o||!m.trim())){q(!0);try{const de=a.find(Le=>Le.id===o),ot=d.trim()?`🔔 老师呼叫: ${d.trim()}`:`📢 ${(de==null?void 0:de.displayName)||"班级"}通知`,be=await oe.sendNotification({classId:o,studentName:d.trim()||void 0,title:ot,message:m.trim(),type:$?2:0,voice:p,shake:C,durationSeconds:H}),We=m.trim();y(""),f(""),be!=null&&be.messageId&&Z(Le=>Le.some(nn=>nn.id===be.messageId)?Le:[{id:be.messageId,tenantId:"",classId:o,className:(de==null?void 0:de.displayName)||o,senderName:"教师",message:We,priority:$?"Urgent":"Normal",createdAt:new Date().toISOString(),status:"Sent"},...Le])}catch(de){alert(de.message||"呼叫发送失败")}finally{q(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"教师呼叫工作台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"向指定教室大屏下发即时点呼与通知,支持语音朗读(TTS)与学生回执确认"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),K&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:K})]}),n.jsxs("button",{onClick:ke,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[n.jsx("div",{className:"lg:col-span-7 space-y-5",children:n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:Ne,className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-2",children:"目标授课班级"}),a.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-3 bg-amber-500/10 rounded-xl border border-amber-500/30",children:"未查询到可用班级,请联系学校管理员添加班级"}):n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:a.map(U=>{const de=o===U.id;return n.jsxs("button",{type:"button",onClick:()=>u(U.id),className:`p-3 rounded-xl border text-left transition-all relative ${de?"bg-indigo-600/20 border-indigo-500/50 text-white shadow-lg shadow-indigo-600/10":"bg-slate-900/60 border-slate-800 text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[n.jsx("div",{className:"font-semibold text-sm truncate",children:U.displayName}),n.jsx("div",{className:"text-[11px] text-slate-500 truncate mt-0.5",children:U.roomNumber||U.id}),de&&n.jsx(Fl,{className:"w-4 h-4 text-indigo-400 absolute top-3 right-3"})]},U.id)})})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Xd,{className:"w-3.5 h-3.5 text-slate-400"}),"指定学生姓名(可选,点呼场景使用)"]}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"留空则为全班广播"})]}),n.jsx("input",{type:"text",value:d,onChange:U=>f(U.target.value),placeholder:"如:张三、李四(支持单人或多人)",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsx("span",{children:"呼叫通知内容"}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:[m.length,"/200 字"]})]}),n.jsx("textarea",{rows:4,value:m,onChange:U=>y(U.target.value.slice(0,200)),placeholder:"请输入需要大屏弹窗展示并朗读的内容...",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600",required:!0})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Jd,{className:"w-3.5 h-3.5 text-amber-400"}),"快捷点呼短语推荐"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:ve.map((U,de)=>n.jsx("button",{type:"button",onClick:()=>y(U),className:"px-2.5 py-1 rounded-lg bg-slate-900 border border-slate-800 text-xs text-slate-300 hover:text-white hover:bg-slate-800 hover:border-slate-700 transition-colors",children:U},de))})]}),n.jsxs("div",{className:"pt-2 border-t border-slate-800/80 grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:p,onChange:U=>j(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-indigo-400"}),"TTS 语音朗读"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"教室音响朗读2遍"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:C,onChange:U=>S(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsx("span",{className:"font-medium text-slate-200 block",children:"窗口抖动震颤"}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"强制吸引注意力"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:$,onChange:U=>D(U.target.checked),className:"rounded bg-slate-950 border-slate-700 text-rose-600 focus:ring-rose-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(ks,{className:"w-3.5 h-3.5 text-rose-400"}),"紧急通知"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"红色全屏强提醒"})]})]})]}),n.jsx("button",{type:"submit",disabled:I||!o||!m.trim(),className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 text-white font-semibold text-sm shadow-lg shadow-indigo-600/25 flex items-center justify-center gap-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:I?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在秒级投递至教室大屏..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"立即下发到教室大屏"})]})})]})})}),n.jsx("div",{className:"lg:col-span-5 space-y-4",children:n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-emerald-400"}),"实时回执动态 (ACK)"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"SignalR 实时推送"})]}),n.jsx("div",{className:"space-y-3 max-h-[580px] overflow-y-auto pr-1",children:te&&G.length===0?n.jsxs("div",{className:"text-center py-16 text-xs text-slate-500",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin mx-auto mb-2 text-indigo-400"}),n.jsx("span",{children:"正在加载历史动态..."})]}):G.length===0?n.jsx("div",{className:"text-center py-16 text-xs text-slate-500",children:"暂无发送记录,在左侧选择班级即可下发第一条呼叫"}):G.map(U=>n.jsxs("div",{className:"glass-card p-4 space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-sm text-white",children:U.className}),n.jsx("span",{className:"text-[11px] font-mono text-slate-500",children:new Date(U.createdAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-xs text-slate-300 bg-slate-950/50 p-2.5 rounded-lg border border-slate-800/80",children:U.message}),n.jsxs("div",{className:"pt-1.5 border-t border-slate-800/60 flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-slate-400 text-[11px]",children:"回执阶段:"}),U.status==="Cancelled"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-slate-400 font-medium",children:[n.jsx(Go,{className:"w-3.5 h-3.5 text-slate-400"}),n.jsx("span",{children:"已提前关闭撤回"})]}),U.status==="Acknowledged"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(Pt,{className:"w-4 h-4 text-emerald-400"}),n.jsxs("span",{children:["学生已点击确认 (",U.confirmedAt?new Date(U.confirmedAt).toLocaleTimeString():"刚刚",")"]})]}),U.status==="Delivered"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sky-400 font-medium",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"教室大屏已接收"})]}),U.status==="Sent"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"云端投递中..."})]}),U.status==="Timeout"&&n.jsx("div",{className:"text-slate-400 text-xs",children:n.jsx("span",{children:"超时已自动关闭"})}),U.status==="Failed"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-rose-400 font-medium",children:[n.jsx(ks,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"投递失败"})]})]}),(U.status==="Sent"||U.status==="Delivered")&&!U.isCancelled&&n.jsx("div",{className:"flex items-center justify-end pt-1",children:n.jsxs("button",{type:"button",onClick:()=>N(U),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded bg-rose-500/10 hover:bg-rose-500/20 text-rose-300 text-[11px] font-medium transition-colors border border-rose-500/30",title:"在大屏端停止TTS并关闭弹窗",children:[n.jsx(kr,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"提前关闭 / 撤回"})]})}),U.receipts&&U.receipts.length>0&&(()=>{const de=U.receipts.find(be=>be.visualReceiptState==="Available"),ot=U.receipts.find(be=>be.visualReceiptState==="Expired");return de?n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-xs",children:[n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(_s,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:"视觉核验:已完成"})]}),n.jsxs("button",{type:"button",onClick:()=>k(U.id,de.deviceId,U.className,de.visualReceiptCapturedAt),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-indigo-600/30 hover:bg-indigo-600/50 text-indigo-300 text-[11px] font-medium transition-colors border border-indigo-500/30",children:[n.jsx(m0,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"查看大屏实际展示"})]})]}):ot?n.jsx("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-[11px] text-slate-500",children:n.jsxs("div",{className:"inline-flex items-center gap-1",children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsx("span",{children:"视觉核验:已按 24h 策略自动销毁"})]})}):null})()]},U.id))})]})})]}),pe&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel w-full max-w-3xl bg-slate-900 border-slate-800 rounded-2xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-800 bg-slate-950/60",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_s,{className:"w-5 h-5 text-emerald-400"}),n.jsxs("h3",{className:"font-semibold text-white text-base",children:[pe.className," · 通知视觉核验"]})]}),n.jsx("button",{type:"button",onClick:W,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 flex-1 overflow-auto flex flex-col items-center justify-center min-h-[320px] bg-slate-950/40",children:[je&&n.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 text-sm",children:[n.jsx(kn,{className:"w-8 h-8 animate-spin text-indigo-400"}),n.jsx("span",{children:"正在安全解密并加载现场回执画面..."})]}),Ue&&n.jsxs("div",{className:"flex flex-col items-center gap-2 text-rose-400 text-sm",children:[n.jsx(Sn,{className:"w-8 h-8 text-rose-400"}),n.jsx("span",{children:Ue})]}),ne&&!je&&n.jsxs("div",{className:"flex flex-col items-center w-full",children:[n.jsx("div",{className:"overflow-auto max-h-[60vh] max-w-full flex items-center justify-center p-2 rounded-xl bg-black/60 border border-slate-800",children:n.jsx("img",{src:ne,alt:"教室大屏实际展示画面",style:{transform:`scale(${Te})`,transformOrigin:"center center",transition:"transform 0.2s"},className:"rounded-lg shadow-lg object-contain max-h-[55vh]"})}),n.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[n.jsx("button",{type:"button",onClick:()=>V(U=>Math.max(.5,+(U-.25).toFixed(2))),disabled:Te<=.5,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"缩小",children:n.jsx(nx,{className:"w-4 h-4"})}),n.jsxs("span",{className:"text-xs font-mono text-slate-300 min-w-[50px] text-center",children:[Math.round(Te*100),"%"]}),n.jsx("button",{type:"button",onClick:()=>V(U=>Math.min(3,+(U+.25).toFixed(2))),disabled:Te>=3,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"放大",children:n.jsx(ex,{className:"w-4 h-4"})}),n.jsx("button",{type:"button",onClick:()=>V(1),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"重置"})]})]})]}),n.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between text-[11px] text-slate-400 gap-2",children:[n.jsx("span",{children:pe.capturedAt?`捕获时间: ${new Date(pe.capturedAt).toLocaleString()}`:""}),n.jsx("span",{className:"text-amber-400/90 text-right",children:"该现场画面仅用于核验通知是否成功显示,并将在捕获后 24 小时自动销毁。"})]})]})}),T&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-400",children:n.jsx(ks,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"提前关闭并撤回通知?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["目标班级: ",T.className]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 mb-4 text-xs text-slate-300",children:[n.jsx("div",{className:"text-slate-400 text-[11px] mb-1",children:"通知内容:"}),n.jsx("p",{className:"line-clamp-3",children:T.message})]}),n.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-[11px] text-amber-300/90 mb-5 leading-relaxed",children:["💡 确认后,云端将立即向教室大屏发出关闭指令,大屏将",n.jsx("strong",{children:"立即停止 TTS 语音播报"}),"并",n.jsx("strong",{children:"收起弹窗窗口"}),"。"]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:L,onClick:()=>N(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"button",disabled:L,onClick:ce,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/25 transition-all flex items-center gap-1.5 disabled:opacity-50",children:L?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在撤回..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"确认提前关闭"})]})})]})]})})]})},gx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户身份..."}):a?n.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col",children:[n.jsx(sx,{}),n.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n.jsx(Bd,{})})]}):n.jsx(Vt,{to:"/login",replace:!0})},vx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在初始化..."}):a?a.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):a.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},yx=()=>n.jsxs(Zm,{children:[n.jsx(Qe,{path:"/login",element:n.jsx(rx,{})}),n.jsx(Qe,{path:"/",element:n.jsx(vx,{})}),n.jsxs(Qe,{element:n.jsx(gx,{}),children:[n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SuperAdmin"]}),children:[n.jsx(Qe,{path:"/admin",element:n.jsx(lx,{})}),n.jsx(Qe,{path:"/admin/tenants",element:n.jsx(cx,{})}),n.jsx(Qe,{path:"/admin/users",element:n.jsx(ux,{})}),n.jsx(Qe,{path:"/admin/devices",element:n.jsx(ix,{})}),n.jsx(Qe,{path:"/admin/broadcast",element:n.jsx(dx,{})}),n.jsx(Qe,{path:"/admin/codes",element:n.jsx(ox,{})}),n.jsx(Qe,{path:"/admin/history",element:n.jsx(ax,{})})]}),n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SchoolAdmin"]}),children:[n.jsx(Qe,{path:"/school-admin",element:n.jsx(hx,{})}),n.jsx(Qe,{path:"/school-admin/classes",element:n.jsx(fx,{})}),n.jsx(Qe,{path:"/school-admin/teachers",element:n.jsx(mx,{})}),n.jsx(Qe,{path:"/school-admin/codes",element:n.jsx(px,{})})]}),n.jsx(Qe,{element:n.jsx(Qo,{allowedRoles:["Teacher"]}),children:n.jsx(Qe,{path:"/teacher",element:n.jsx(xx,{})})})]}),n.jsx(Qe,{path:"*",element:n.jsx(Vt,{to:"/",replace:!0})})]}),wx=()=>n.jsx(Gp,{children:n.jsx(op,{children:n.jsx(yx,{})})});om.createRoot(document.getElementById("root")).render(n.jsx(na.StrictMode,{children:n.jsx(wx,{})})); /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/assets/index-DYQz3G89.css SIZE: 36341 chars SHA256: B1B268B90712BE5D9B908A9DC136D98C5880051D2EF9C3C07419FB28E2EFE51F ===================================================================== */ *,: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}body{min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}body *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-5rem}.-top-20{top:-5rem}.left-3\.5{left:.875rem}.right-3{right:.75rem}.top-0{top:0}.top-3{top:.75rem}.top-3\.5{top:.875rem}.z-10{z-index:10}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.max-h-\[55vh\]{max-height:55vh}.max-h-\[580px\]{max-height:580px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[320px\]{min-height:320px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-full{width:100%}.min-w-\[50px\]{min-width:50px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.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 ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) 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}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.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\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * 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-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * 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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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))}.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-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.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-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/50{border-color:#10b98180}.border-indigo-500\/20{border-color:#6366f133}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/50{border-color:#6366f180}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-sky-500\/20{border-color:#0ea5e933}.border-sky-500\/30{border-color:#0ea5e94d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/40{border-color:#1e293b66}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/25{background-color:#f59e0b40}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/15{background-color:#05966926}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-950\/20{background-color:#022c2233}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/10{background-color:#4f46e51a}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-600\/30{background-color:#4f46e54d}.bg-rose-400{--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/15{background-color:#f43f5e26}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity, 1))}.bg-rose-600\/15{background-color:#e11d4826}.bg-rose-600\/20{background-color:#e11d4833}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-500\/10{background-color:#0ea5e91a}.bg-sky-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1))}.bg-sky-600\/10{background-color:#0284c71a}.bg-sky-600\/20{background-color:#0284c733}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/50{background-color:#02061780}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/70{background-color:#020617b3}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/95{background-color:#020617f2}.bg-transparent{background-color:transparent}.bg-violet-500\/10{background-color:#8b5cf61a}.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))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-600{--tw-gradient-from: #4f46e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-950{--tw-gradient-from: #020617 var(--tw-gradient-from-position);--tw-gradient-to: rgb(2 6 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-slate-200{--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #e2e8f0 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-900{--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #0f172a var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-950\/40{--tw-gradient-to: rgb(30 27 75 / .4) var(--tw-gradient-to-position)}.to-slate-400{--tw-gradient-to: #94a3b8 var(--tw-gradient-to-position)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.to-violet-600{--tw-gradient-to: #7c3aed var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.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-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.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-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.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-3\.5{padding-top:.875rem;padding-bottom:.875rem}.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-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pr-1{padding-right:.25rem}.pr-4{padding-right:1rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-\[\'Inter\'\,system-ui\,-apple-system\,sans-serif\]{font-family:Inter,system-ui,-apple-system,sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.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-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/90{color:#fcd34de6}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/90{color:#fbbf24e6}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/80{color:#34d399cc}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-300\/90{color:#fda4afe6}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-400\/90{color:#fb7185e6}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.accent-indigo-500{accent-color:#6366f1}.opacity-70{opacity:.7}.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-amber-500\/10{--tw-shadow-color: rgb(245 158 11 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/25{--tw-shadow-color: rgb(245 158 11 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-600\/25{--tw-shadow-color: rgb(5 150 105 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/25{--tw-shadow-color: rgb(99 102 241 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/10{--tw-shadow-color: rgb(79 70 229 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/25{--tw-shadow-color: rgb(79 70 229 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/30{--tw-shadow-color: rgb(79 70 229 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/25{--tw-shadow-color: rgb(225 29 72 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/30{--tw-shadow-color: rgb(225 29 72 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-600\/25{--tw-shadow-color: rgb(2 132 199 / .25);--tw-shadow: var(--tw-shadow-colored)}.blur-3xl{--tw-blur: blur(64px);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-sm{--tw-backdrop-blur: blur(4px);-webkit-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-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-xl{--tw-backdrop-blur: blur(24px);-webkit-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-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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.glass-panel{border-radius:1rem;border-width:1px;border-color:#1e293bcc;background-color:#0f172ab3;--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);--tw-backdrop-blur: blur(24px);-webkit-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-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)}.glass-card{border-radius:.75rem;border-width:1px;border-color:#33415580;background-color:#1e293b66;--tw-backdrop-blur: blur(12px);-webkit-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-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-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.glass-card:hover{border-color:#475569b3;background-color:#1e293b99}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:border-amber-500\/50:hover{border-color:#f59e0b80}.hover\:border-emerald-500\/50:hover{border-color:#10b98180}.hover\:border-indigo-500\/50:hover{border-color:#6366f180}.hover\:border-rose-500\/50:hover{border-color:#f43f5e80}.hover\:border-rose-700\/50:hover{border-color:#be123c80}.hover\:border-sky-500\/50:hover{border-color:#0ea5e980}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-amber-500:hover{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-600\/25:hover{background-color:#05966940}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-600\/20:hover{background-color:#4f46e533}.hover\:bg-indigo-600\/50:hover{background-color:#4f46e580}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-500\/20:hover{background-color:#f43f5e33}.hover\:bg-rose-600\/25:hover{background-color:#e11d4840}.hover\:bg-rose-900\/40:hover{background-color:#88133766}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-600\/20:hover{background-color:#0284c733}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/20:hover{background-color:#1e293b33}.hover\:bg-slate-800\/25:hover{background-color:#1e293b40}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-indigo-500:hover{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-500:hover{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.hover\:to-violet-500:hover{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-rose-300:hover{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / 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-amber-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/50:focus{--tw-ring-color: rgb(99 102 241 / .5)}.focus\:ring-rose-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(244 63 94 / var(--tw-ring-opacity, 1))}.focus\:ring-sky-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;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))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;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))}.group:hover .group-hover\:text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:block{display:block}.sm\:flex{display:flex}.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\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media(min-width:768px){.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:grid-cols-12{grid-template-columns:repeat(12,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\:px-8{padding-left:2rem;padding-right:2rem}}@media(min-width:1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}} /* ===================================================================== FILE: src/Server/ClassNotify.Server/publish/wwwroot/index.html SIZE: 957 chars SHA256: 9021E66A9ACB97367F2B73B40BC60729A3C323A4DE1A6D715777B6EE718BC24A ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/DeviceCommandTimeoutWorker.cs SIZE: 4641 chars SHA256: 7B98FB1CB55A595434BA263D5F231EF9756259456771FB3A18F1DB0BC35180ED ===================================================================== */ using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Server.Hubs; using ClassNotify.Shared.Contracts; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace ClassNotify.Server.Services; /// /// 后台受控远程命令超时与生命周期流转服务 /// 严格兑现封板要求: /// 1. Pending 超时 -> 自动标记 Expired 并推 TeacherHub /// 2. Dispatched 超过 TTL 或持续无心跳响应 -> 自动标记 TimedOut 并推 TeacherHub /// 3. 定期持久化状态至 PostgreSQL 实体 /// public class DeviceCommandTimeoutWorker : BackgroundService { private readonly IServiceScopeFactory _scopeFactory; private readonly IHubContext _teacherHub; private readonly ILogger _logger; private readonly TimeSpan _checkInterval; public DeviceCommandTimeoutWorker( IServiceScopeFactory scopeFactory, IHubContext teacherHub, ILogger logger, TimeSpan? checkInterval = null) { _scopeFactory = scopeFactory; _teacherHub = teacherHub; _logger = logger; _checkInterval = checkInterval ?? TimeSpan.FromSeconds(10); } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("DeviceCommandTimeoutWorker started (CheckInterval: {Interval}s)", _checkInterval.TotalSeconds); while (!stoppingToken.IsCancellationRequested) { try { await ProcessTimeoutsAsync(stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } catch (Exception ex) { _logger.LogError(ex, "Error processing device command timeouts and expirations"); } try { await Task.Delay(_checkInterval, stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } } _logger.LogInformation("DeviceCommandTimeoutWorker stopped."); } public async Task ProcessTimeoutsAsync(CancellationToken cancellationToken = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; // Fetch all active non-terminal commands var activeCommands = await db.DeviceCommands .Where(c => c.Status == DeviceCommandStatuses.Pending || c.Status == DeviceCommandStatuses.Dispatched) .ToListAsync(cancellationToken); if (activeCommands.Count == 0) return 0; var transitioned = new List(); foreach (var cmd in activeCommands) { if (Domain.Entities.DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { transitioned.Add(cmd); _logger.LogWarning("Command {CommandId} (Device {DeviceId}, Tenant {TenantId}) transitioned to terminal status '{Status}': {Reason}", cmd.Id, cmd.DeviceId, cmd.TenantId, cmd.Status, cmd.ResultMessage); } } if (transitioned.Count == 0) return 0; // 1. SAVE TO DATABASE FIRST - Fail-safe against broadcasting ghost states await db.SaveChangesAsync(cancellationToken); // 2. BROADCAST TO TEACHERHUB ONLY AFTER DB PERSISTENCE SUCCEEDS foreach (var cmd in transitioned) { var resultDto = new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? (cmd.Status == DeviceCommandStatuses.Expired ? -2 : -4), ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? 0, Timestamp = now }; try { await _teacherHub.Clients.Group($"t:{cmd.TenantId}:teachers").OnDeviceCommandStatusChanged(resultDto); } catch (Exception ex) { _logger.LogWarning(ex, "Failed to broadcast command status change for {CommandId} to TeacherHub", cmd.Id); } } return transitioned.Count; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/ISecurityService.cs SIZE: 5589 chars SHA256: 384B29A4F41C8164C59E630449F659F2074980EB554D8CD7193994AA71539D3D ===================================================================== */ using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Models; namespace ClassNotify.Server.Services; public sealed record DeviceConnectionRegistrationResult( string CurrentConnectionId, string? ReplacedConnectionId); public interface ISecurityService { // Auth & Identity Task LoginTeacherAsync(TeacherLoginDto dto, string? remoteIp = null); Task ActivateDeviceAsync(DeviceActivationRequestDto dto); Task ValidateDeviceAsync(string deviceId, string deviceToken); // Tenant & Classrooms Task GetClassroomAsync(string tenantId, string classId); Task> GetClassroomsAsync(string tenantId); Task CreateClassroomAsync(string tenantId, CreateClassroomDto dto); Task GetTenantAsync(string tenantId); Task> GetTenantsOverviewAsync(); // Users Task> GetUsersAsync(string tenantId); Task CreateUserAsync(string tenantId, CreateTeacherDto dto); // Devices & Metrics Task GetAdminMetricsAsync(); Task> GetAllDevicesAsync(); Task> GetTenantDevicesAsync(string tenantId); Task RegisterDeviceConnectionAsync(string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion); Task UnregisterDeviceConnectionAsync(string connectionId); bool IsCurrentDeviceConnection(string deviceId, string connectionId); Task UpdateDeviceHeartbeatAsync(string connectionId); string? GetDeviceConnectionId(string deviceId); // Activation Codes Task GenerateActivationCodeAsync(string tenantId, string classId, string? actor = null, string? actorRole = null, string? ip = null); Task> GetActivationCodesAsync(string? tenantId); // Notifications & ACKs (PostgreSQL & NotificationReceipt per-device isolation) Task RecordNotificationAsync(NotificationDto notification, string? senderUserId, string senderName); Task RecordAckAsync(string messageId, string authenticatedDeviceId, AckReceiptDto ack); Task ValidateNotificationTargetAsync(string messageId, string tenantId, string classroomId); Task> GetNotificationsAsync(string? tenantId, string? classId, int limit = 50); Task> GetPendingNotificationsForDeviceAsync(string deviceId); Task CancelNotificationAsync(string notificationId, string actorUserId, string actorUsername, string role, string tenantId, string? ip, CancellationToken ct = default); Task ResetSchoolTeacherPasswordAsync(string schoolAdminTenantId, string teacherUserId, string newPassword, string actorUsername, string? ip, CancellationToken ct = default); Task SetSchoolTeacherLockAsync(string schoolAdminTenantId, string teacherUserId, bool isLocked, string actorUsername, string? ip, CancellationToken ct = default); Task GetBroadcastReceiptSummaryAsync(string broadcastId, CancellationToken ct = default); // Device Commands (P1 Batch 10) Task CreateDeviceCommandAsync(string? callerTenantId, string deviceId, string commandType, string? parameters, string createdBy, string? actorRole = null, string? ip = null); Task MarkCommandDispatchedAsync(string commandId); Task RecordCommandResultAsync(DeviceCommandResultDto result, string callerDeviceId, string? callerTenantId); Task GetDeviceCommandAsync(string commandId, string? callerTenantId = null); Task> GetPendingCommandsForDeviceAsync(string deviceId); Task> GetDeviceCommandHistoryAsync(string? tenantId, string? deviceId, string? status, int limit = 50); // SuperAdmin Control Plane Extensions Task CreateTenantAsync(string id, string name, string? actor = null, string? actorRole = null, string? ip = null); Task UpdateTenantAsync(string id, string name, bool isActive, string? actor = null, string? actorRole = null, string? ip = null); Task> GetAllUsersAdminAsync(string? tenantId, string? role); Task CreateUserAdminAsync(CreateUserAdminRequest req, string? actor = null, string? actorRole = null, string? ip = null); Task ResetPasswordAsync(string userId, string newPassword, string? actor = null, string? actorRole = null, string? ip = null); Task SetUserLockAsync(string userId, bool isLocked, string? actor = null, string? actorRole = null, string? ip = null); Task DeleteUserAsync(string userId, string? actor = null, string? actorRole = null, string? ip = null); Task UpdateDeviceAsync(string deviceId, string? hostname, string? classroomId, string? actor = null, string? actorRole = null, string? ip = null); Task DecommissionDeviceAsync(string deviceId, string? actor = null, string? actorRole = null, string? ip = null); Task DeleteActivationCodeAsync(string code, string? actor = null, string? actorRole = null, string? ip = null); Task GetSystemHealthAsync(); Task LogAdminAuditAsync(string actorUsername, string actorRole, string action, string targetType, string targetId, string? details, string? ip); Task> GetAdminAuditLogsAsync(int limit = 100); } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/IVisualReceiptService.cs SIZE: 769 chars SHA256: 2C2D2646C69CCDEDED145F65F9835D23EF76AB9207DF1D164F4B56BB8BC47928 ===================================================================== */ using System.Security.Claims; namespace ClassNotify.Server.Services; public record VisualReceiptUploadResult(bool Success, string Message, int StatusCode, string? ReceiptId = null, DateTimeOffset? CapturedAt = null, DateTimeOffset? ExpiresAt = null); public record VisualReceiptFileResult(bool Success, string? FilePath = null, int StatusCode = 200, string? ErrorMessage = null); public interface IVisualReceiptService { Task SaveVisualReceiptAsync(string notificationId, string deviceId, string deviceToken, byte[] jpegBytes); Task GetVisualReceiptFileAsync(string notificationId, string deviceId, ClaimsPrincipal user); Task CleanupExpiredVisualReceiptsAsync(CancellationToken ct = default); } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/SecurityService.cs SIZE: 89235 chars SHA256: 658EF0791E14B4317A3FBDB93CC045E0DBABABBF96F86CB6257A7007498F1165 ===================================================================== */ using System.Collections.Concurrent; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Security.Cryptography; using System.Text; using ClassNotify.Server.Configuration; using ClassNotify.Server.Data; using ClassNotify.Server.Domain.Entities; using ClassNotify.Shared.Enums; using ClassNotify.Shared.Models; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; namespace ClassNotify.Server.Services; public class LiveConnectionInfo { public string ConnectionId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string? Hostname { get; set; } public string? RemoteIp { get; set; } public string? ClientVersion { get; set; } public DateTimeOffset LastHeartbeat { get; set; } = DateTimeOffset.UtcNow; public LiveConnectionInfo(string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion, DateTimeOffset lastHeartbeat) { ConnectionId = connectionId; DeviceId = deviceId; TenantId = tenantId; ClassroomId = classroomId; Hostname = hostname; RemoteIp = remoteIp; ClientVersion = clientVersion; LastHeartbeat = lastHeartbeat; } } public class SecurityService : ISecurityService { private readonly IServiceScopeFactory _scopeFactory; private readonly ILogger _logger; private readonly IDataProtector _protector; private readonly IPasswordHasher _passwordHasher; private readonly JwtOptions _jwtOptions; // In-memory real-time SignalR live connection registries (NOT in PostgreSQL) private readonly ConcurrentDictionary _liveConnections = new(); private readonly ConcurrentDictionary _deviceToConnection = new(); private readonly ConcurrentDictionary _connectionTenantMap = new(); // Heartbeat DB update throttle map (at most once every 30s per device) private readonly ConcurrentDictionary _lastHeartbeatDbUpdate = new(); public SecurityService( IServiceScopeFactory scopeFactory, IDataProtectionProvider dataProtectionProvider, IPasswordHasher passwordHasher, IOptions jwtOptions, ILogger logger) { _scopeFactory = scopeFactory; _logger = logger; _protector = dataProtectionProvider.CreateProtector("ClassNotify.DeviceTokens.v1"); _passwordHasher = passwordHasher; _jwtOptions = jwtOptions.Value; } #region Auth & Identity public async Task LoginTeacherAsync(TeacherLoginDto dto, string? remoteIp = null) { if (string.IsNullOrWhiteSpace(dto.Username) || string.IsNullOrWhiteSpace(dto.Password)) { return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名与密码不可为空" }; } var normalizedUser = dto.Username.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var user = await db.Users.FirstOrDefaultAsync(u => u.Username == normalizedUser); if (user == null) { _logger.LogWarning("Authentication failed: User '{Username}' not found. Remote IP: {RemoteIp} at {Timestamp}", normalizedUser, remoteIp ?? "unknown", DateTimeOffset.UtcNow); return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名或密码错误" }; } // P0-01 Security Gate: Check if user account is locked if (user.IsLocked) { _logger.LogWarning("Authentication rejected: Account '{Username}' is locked by administrator. Remote IP: {RemoteIp}", normalizedUser, remoteIp ?? "unknown"); return new TeacherLoginResultDto { Success = false, ErrorMessage = "该账号已被管理员锁定封禁,无法登录系统" }; } // P0-02 Security Gate: Check if school tenant is active (non-global users) if (user.TenantId != "global") { var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == user.TenantId); if (tenant != null && !tenant.IsActive) { _logger.LogWarning("Authentication rejected: User '{Username}' belongs to suspended tenant '{TenantId}'.", normalizedUser, user.TenantId); return new TeacherLoginResultDto { Success = false, ErrorMessage = "该账号所属学校已暂停服务或被冻结,请联系平台管理员" }; } } bool passwordValid = false; bool needsRehash = false; // 1. Try modern ASP.NET Core PasswordHasher var verifyResult = _passwordHasher.VerifyHashedPassword(user, user.PasswordHash, dto.Password); if (verifyResult == PasswordVerificationResult.Success) { passwordValid = true; } else if (verifyResult == PasswordVerificationResult.SuccessRehashNeeded) { passwordValid = true; needsRehash = true; } else { // 2. Fallback to legacy SHA256 with fixed salt for backward compatibility if (VerifyLegacyPassword(dto.Password, user.PasswordHash)) { passwordValid = true; needsRehash = true; _logger.LogInformation("Legacy password verified for user '{Username}'. Will upgrade to PasswordHasher.", normalizedUser); } } if (!passwordValid) { _logger.LogWarning("Authentication failed: Invalid credentials for user '{Username}'. Remote IP: {RemoteIp} at {Timestamp}", normalizedUser, remoteIp ?? "unknown", DateTimeOffset.UtcNow); return new TeacherLoginResultDto { Success = false, ErrorMessage = "用户名或密码错误" }; } // 3. Automatic on-the-fly hash upgrade if legacy or rehash needed if (needsRehash) { user.PasswordHash = _passwordHasher.HashPassword(user, dto.Password); _logger.LogInformation("Password hash successfully upgraded to ASP.NET Core PasswordHasher for user '{Username}'.", normalizedUser); } // 4. Update LastLoginAt upon successful authentication user.LastLoginAt = DateTimeOffset.UtcNow; await db.SaveChangesAsync(); _logger.LogInformation("User '{Username}' ({UserId}) successfully authenticated from IP {RemoteIp}.", normalizedUser, user.Id, remoteIp ?? "unknown"); var token = GenerateJwtToken(user); return new TeacherLoginResultDto { Success = true, Token = token, UserId = user.Id, FullName = user.FullName, TenantId = user.TenantId, Role = user.Role }; } public async Task ActivateDeviceAsync(DeviceActivationRequestDto dto) { if (string.IsNullOrWhiteSpace(dto.ActivationCode)) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码不可为空" }; } if (string.IsNullOrWhiteSpace(dto.InstallationId) || !dto.InstallationId.StartsWith("inst_") || dto.InstallationId.Length > 50) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "安装实例标识符 (InstallationId) 无效或格式不正确" }; } var normalizedCode = dto.ActivationCode.Trim().ToUpperInvariant(); var normalizedInstId = dto.InstallationId.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); using var tx = await db.Database.BeginTransactionAsync(); try { var code = await db.ActivationCodes.FirstOrDefaultAsync(c => c.Code == normalizedCode); if (code == null) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码无效" }; } if (code.IsUsed) { // P0-09 / P1-02 Idempotency Rule: If same installationId, return original device credentials if (!string.IsNullOrEmpty(code.InstallationId) && string.Equals(code.InstallationId, normalizedInstId, StringComparison.OrdinalIgnoreCase)) { var existingDev = await db.Devices.FirstOrDefaultAsync(d => (!string.IsNullOrEmpty(code.UsedByDeviceId) && d.Id == code.UsedByDeviceId) || d.InstallationId == normalizedInstId); var existingCred = await db.DeviceCredentials.FirstOrDefaultAsync(c => (!string.IsNullOrEmpty(code.UsedByDeviceId) && c.DeviceId == code.UsedByDeviceId) || c.InstallationId == normalizedInstId); var existingCls = await db.Classrooms.FirstOrDefaultAsync(c => c.TenantId == code.TenantId && c.Id == code.ClassroomId); if (existingDev != null && existingCred != null && existingCls != null) { string recoveredToken; try { recoveredToken = _protector.Unprotect(existingCred.EncryptedRecoverableToken); } catch (Exception ex) { _logger.LogError(ex, "Failed to unprotect recoverable token for InstallationId {InstallationId}", normalizedInstId); return new DeviceActivationResultDto { Success = false, ErrorMessage = "解密设备凭据失败,请联系管理员" }; } _logger.LogInformation("Idempotent activation retry for InstallationId {InstallationId}, returning recovered token for Device {DeviceId}", normalizedInstId, existingDev.Id); return new DeviceActivationResultDto { Success = true, DeviceId = existingDev.Id, DeviceToken = recoveredToken, TenantId = existingCls.TenantId, ClassId = existingCls.Id, ClassDisplayName = existingCls.DisplayName }; } } // Different installationId or unable to match installationId -> 409 Conflict return new DeviceActivationResultDto { Success = false, ErrorMessage = "该激活码已被其他设备安装实例使用" }; } if (code.ExpiresAt < DateTimeOffset.UtcNow) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "激活码已过期" }; } var cls = await db.Classrooms.FirstOrDefaultAsync(c => c.TenantId == code.TenantId && c.Id == code.ClassroomId); if (cls == null) { return new DeviceActivationResultDto { Success = false, ErrorMessage = "绑定的班级不存在" }; } var deviceId = $"dev_{Guid.NewGuid():N}"[..12]; var rawToken = $"dtoken_{Guid.NewGuid():N}"; var tokenHash = HashToken(rawToken); var device = new Device { Id = deviceId, TenantId = code.TenantId, ClassroomId = code.ClassroomId, DeviceTokenHash = tokenHash, InstallationId = normalizedInstId, Hostname = dto.Hostname, IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; var credRecord = new DeviceCredentialRecord { DeviceId = deviceId, InstallationId = normalizedInstId, DeviceTokenHash = tokenHash, EncryptedRecoverableToken = _protector.Protect(rawToken), CreatedAt = DateTimeOffset.UtcNow }; db.Devices.Add(device); db.DeviceCredentials.Add(credRecord); code.IsUsed = true; code.UsedAt = DateTimeOffset.UtcNow; code.UsedByDeviceId = deviceId; code.InstallationId = normalizedInstId; await db.SaveChangesAsync(); await tx.CommitAsync(); _logger.LogInformation("Device {DeviceId} activated successfully for {TenantId} / {ClassId} ({DisplayName}) [InstallationId: {InstallationId}]", deviceId, cls.TenantId, cls.Id, cls.DisplayName, normalizedInstId); return new DeviceActivationResultDto { Success = true, DeviceId = deviceId, DeviceToken = rawToken, TenantId = cls.TenantId, ClassId = cls.Id, ClassDisplayName = cls.DisplayName }; } catch (Exception ex) { await tx.RollbackAsync(); _logger.LogError(ex, "Exception during device activation transaction for code {Code}", normalizedCode); throw; } } public async Task ValidateDeviceAsync(string deviceId, string deviceToken) { if (string.IsNullOrEmpty(deviceId) || string.IsNullOrEmpty(deviceToken)) { return null; } var tokenHash = HashToken(deviceToken); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var device = await db.Devices.AsNoTracking().FirstOrDefaultAsync(d => d.Id == deviceId && d.DeviceTokenHash == tokenHash && d.IsActive); if (device == null) return null; // P0-02 Security Gate: Verify tenant is active var tenant = await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == device.TenantId); if (tenant != null && !tenant.IsActive) { _logger.LogWarning("Rejecting device {DeviceId} connection: Tenant {TenantId} is suspended/inactive.", deviceId, device.TenantId); return null; } return device; } #endregion #region Tenants & Classrooms public async Task GetTenantAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId && t.IsActive); } public async Task> GetTenantsOverviewAsync() { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var tenants = await db.Tenants.AsNoTracking().Where(t => t.Id != "global").ToListAsync(); var classrooms = await db.Classrooms.AsNoTracking().ToListAsync(); var devices = await db.Devices.AsNoTracking().ToListAsync(); var liveSnapshots = _liveConnections.Values.ToList(); return tenants.Select(t => { var classCount = classrooms.Count(c => c.TenantId == t.Id); var deviceCount = devices.Count(d => d.TenantId == t.Id); var onlineCount = liveSnapshots.Count(c => c.TenantId == t.Id); return new TenantAdminDto { Id = t.Id, Name = t.Name, ClassroomCount = classCount, DeviceCount = deviceCount, OnlineCount = onlineCount, IsActive = t.IsActive, CreatedAt = t.CreatedAt }; }).ToList(); } public async Task GetClassroomAsync(string tenantId, string classId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Classrooms.AsNoTracking().FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Id == classId); } public async Task> GetClassroomsAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Classrooms.AsNoTracking().Where(c => c.TenantId == tenantId).ToListAsync(); } public async Task CreateClassroomAsync(string tenantId, CreateClassroomDto dto) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); if (await db.Classrooms.AnyAsync(c => c.TenantId == tenantId && c.Id == dto.Id)) { return false; } db.Classrooms.Add(new Classroom { Id = dto.Id, TenantId = tenantId, DisplayName = dto.DisplayName, Grade = dto.Grade, RoomNumber = dto.RoomNumber, CreatedAt = DateTimeOffset.UtcNow }); await db.SaveChangesAsync(); return true; } #endregion #region Users public async Task> GetUsersAsync(string tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Users.AsNoTracking().Where(u => u.TenantId == tenantId).ToListAsync(); } public async Task CreateUserAsync(string tenantId, CreateTeacherDto dto) { if (string.IsNullOrWhiteSpace(dto.Password) || dto.Password.Length < 8) { _logger.LogWarning("CreateUser rejected: Password must be at least 8 characters long."); return false; } // P0 Verification Gate: Strictly enforce role whitelist to prevent SuperAdmin privilege escalation if (dto.Role != "Teacher" && dto.Role != "SchoolAdmin") { _logger.LogWarning("CreateUser rejected: Role '{Role}' is not allowed via standard user creation API.", dto.Role); return false; } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); // P0-02 Security Gate: Verify school tenant is active var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { _logger.LogWarning("CreateUser rejected: School tenant '{TenantId}' does not exist or is suspended.", tenantId); return false; } if (await db.Users.AnyAsync(u => u.Username == dto.Username.Trim())) { return false; } var user = new User { Id = $"usr_{Guid.NewGuid():N}"[..12], TenantId = tenantId, Username = dto.Username.Trim(), FullName = dto.FullName, Role = dto.Role, CreatedAt = DateTimeOffset.UtcNow }; // Strictly use modern PasswordHasher for new user creation user.PasswordHash = _passwordHasher.HashPassword(user, dto.Password); db.Users.Add(user); await db.SaveChangesAsync(); return true; } #endregion #region Devices & Live SignalR Connections public async Task GetAdminMetricsAsync() { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var totalTenants = await db.Tenants.CountAsync(t => t.Id != "global"); var totalClassrooms = await db.Classrooms.CountAsync(); var totalDevices = await db.Devices.CountAsync(); var onlineDevices = _liveConnections.Count; var startOfToday = DateTimeOffset.UtcNow.Date; var todayNotifications = await db.Notifications.CountAsync(n => n.CreatedAt >= startOfToday); return new AdminMetricsDto { TotalTenants = totalTenants, TotalClassrooms = totalClassrooms, TotalDevices = totalDevices, OnlineDevices = onlineDevices, TodayNotifications = todayNotifications, AbnormalDevices = 0 }; } public async Task> GetAllDevicesAsync() { return await BuildDeviceAdminDtosAsync(null); } public async Task> GetTenantDevicesAsync(string tenantId) { return await BuildDeviceAdminDtosAsync(tenantId); } private async Task> BuildDeviceAdminDtosAsync(string? tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Devices.AsNoTracking(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(d => d.TenantId == tenantId); } var devices = await query.ToListAsync(); var tenants = await db.Tenants.AsNoTracking().ToDictionaryAsync(t => t.Id, t => t.Name); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); var liveSnapshot = _liveConnections.ToDictionary(k => k.Key, v => v.Value); return devices.Select(d => { var isOnline = _deviceToConnection.TryGetValue(d.Id, out var connId) && liveSnapshot.ContainsKey(connId); liveSnapshot.TryGetValue(connId ?? string.Empty, out var connInfo); tenants.TryGetValue(d.TenantId, out var tName); classrooms.TryGetValue($"{d.TenantId}_{d.ClassroomId}", out var cName); return new DeviceAdminDto { DeviceId = d.Id, TenantId = d.TenantId, TenantName = tName ?? d.TenantId, ClassroomId = d.ClassroomId, ClassroomName = cName ?? d.ClassroomId, Hostname = d.Hostname, IsOnline = isOnline, LastHeartbeat = isOnline ? connInfo?.LastHeartbeat : d.LastHeartbeatAt, ClientVersion = isOnline ? connInfo?.ClientVersion : null, RemoteIp = isOnline ? connInfo?.RemoteIp : null, ServiceRunning = isOnline, ClientRunning = isOnline }; }).ToList(); } public Task RegisterDeviceConnectionAsync( string connectionId, string deviceId, string tenantId, string classroomId, string? hostname, string? remoteIp, string? clientVersion) { string? replacedConnectionId = null; if (_deviceToConnection.TryGetValue(deviceId, out var existingConnId)) { replacedConnectionId = existingConnId; _liveConnections.TryRemove(existingConnId, out _); _connectionTenantMap.TryRemove(existingConnId, out _); _logger.LogInformation("Replacing previous ConnectionId {OldConnId} with {NewConnId} for Device {DeviceId}", existingConnId, connectionId, deviceId); } _deviceToConnection[deviceId] = connectionId; var liveInfo = new LiveConnectionInfo(connectionId, deviceId, tenantId, classroomId, hostname, remoteIp, clientVersion, DateTimeOffset.UtcNow); _liveConnections[connectionId] = liveInfo; _connectionTenantMap[connectionId] = (tenantId, classroomId, deviceId); _logger.LogInformation("Device {DeviceId} connected via SignalR. ConnectionId={ConnId}, IP={RemoteIp}", deviceId, connectionId, remoteIp); return Task.FromResult(new DeviceConnectionRegistrationResult(connectionId, replacedConnectionId)); } public Task UnregisterDeviceConnectionAsync(string connectionId) { if (_connectionTenantMap.TryRemove(connectionId, out var info)) { _liveConnections.TryRemove(connectionId, out _); if (_deviceToConnection.TryGetValue(info.DeviceId, out var currentConnId) && currentConnId == connectionId) { _deviceToConnection.TryRemove(info.DeviceId, out _); _logger.LogInformation("Unregistered active device connection {ConnId} for Device {DeviceId}", connectionId, info.DeviceId); return Task.FromResult(true); } else { _logger.LogWarning("Ignored stale disconnect for {ConnId} (Device {DeviceId} active connection is {CurrentConnId})", connectionId, info.DeviceId, currentConnId); return Task.FromResult(false); } } return Task.FromResult(false); } public bool IsCurrentDeviceConnection(string deviceId, string connectionId) { return _deviceToConnection.TryGetValue(deviceId, out var currentConnId) && currentConnId == connectionId; } public Task UpdateDeviceHeartbeatAsync(string connectionId) { if (_liveConnections.TryGetValue(connectionId, out var info)) { info.LastHeartbeat = DateTimeOffset.UtcNow; // Throttled DB heartbeat update (every 30s) var now = DateTimeOffset.UtcNow; var lastUpdate = _lastHeartbeatDbUpdate.GetOrAdd(info.DeviceId, DateTimeOffset.MinValue); if (now - lastUpdate >= TimeSpan.FromSeconds(30)) { _lastHeartbeatDbUpdate[info.DeviceId] = now; _ = Task.Run(async () => { try { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var dev = await db.Devices.FindAsync(info.DeviceId); if (dev != null) { dev.LastHeartbeatAt = now; await db.SaveChangesAsync(); } } catch { } }); } } return Task.CompletedTask; } public string? GetDeviceConnectionId(string deviceId) { return _deviceToConnection.TryGetValue(deviceId, out var connId) ? connId : null; } #endregion #region Activation Codes public async Task GenerateActivationCodeAsync(string tenantId, string classId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var tenant = await db.Tenants.AsNoTracking().FirstOrDefaultAsync(t => t.Id == tenantId); if (tenant == null || !tenant.IsActive) { throw new InvalidOperationException($"租户不存在或已被禁用: {tenantId}"); } var classroomExists = await db.Classrooms.AnyAsync(c => c.TenantId == tenantId && c.Id == classId); if (!classroomExists) { db.Classrooms.Add(new Classroom { Id = classId, TenantId = tenantId, DisplayName = classId, CreatedAt = DateTimeOffset.UtcNow }); await db.SaveChangesAsync(); } var code = $"{tenantId[..Math.Min(4, tenantId.Length)].ToUpperInvariant()}-{Guid.NewGuid():N}"[..12].ToUpperInvariant(); db.ActivationCodes.Add(new ActivationCode { Code = code, TenantId = tenantId, ClassroomId = classId, ExpiresAt = DateTimeOffset.UtcNow.AddDays(7), IsUsed = false }); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "GENERATE_ACTIVATION_CODE", TargetType = "ActivationCode", TargetId = code, Details = $"为学校 {tenantId} 班级 {classId} 生成激活码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return code; } catch { await tx.RollbackAsync(); throw; } } public async Task> GetActivationCodesAsync(string? tenantId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.ActivationCodes.AsNoTracking(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(c => c.TenantId == tenantId); } var codes = await query.OrderByDescending(c => c.ExpiresAt).ToListAsync(); var tenants = await db.Tenants.AsNoTracking().ToDictionaryAsync(t => t.Id, t => t.Name); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); return codes.Select(c => { tenants.TryGetValue(c.TenantId, out var tName); classrooms.TryGetValue($"{c.TenantId}_{c.ClassroomId}", out var cName); return new ActivationCodeDto { Code = c.Code, TenantId = c.TenantId, TenantName = tName ?? c.TenantId, ClassroomId = c.ClassroomId, ClassroomName = cName ?? c.ClassroomId, ExpiresAt = c.ExpiresAt, IsUsed = c.IsUsed, UsedAt = c.UsedAt, UsedByDeviceId = c.UsedByDeviceId }; }).ToList(); } #endregion #region Notifications & NotificationReceipts (PostgreSQL) public async Task RecordNotificationAsync(NotificationDto notification, string? senderUserId, string senderName) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notifEntity = new Notification { Id = notification.Id, TenantId = notification.TenantId, ClassroomId = notification.ClassId, BroadcastId = notification.BroadcastId, SenderUserId = senderUserId, SenderName = senderName, Message = notification.Message, Title = notification.Title, Priority = notification.Type.ToString(), CreatedAt = notification.CreatedAt, ExpiresAt = notification.ExpiresAt, Voice = notification.Voice, Shake = notification.Shake, DurationSeconds = notification.DurationSeconds }; db.Notifications.Add(notifEntity); // Find active devices for this classroom and create initial Receipt with Status = "Sent" var targetDevices = await db.Devices.AsNoTracking() .Where(d => d.TenantId == notification.TenantId && d.ClassroomId == notification.ClassId && d.IsActive) .ToListAsync(); foreach (var dev in targetDevices) { db.NotificationReceipts.Add(new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = notification.Id, DeviceId = dev.Id, Status = "Sent", UpdatedAt = DateTimeOffset.UtcNow }); } await db.SaveChangesAsync(); } public async Task RecordAckAsync(string messageId, string authenticatedDeviceId, AckReceiptDto ack) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var receipt = await db.NotificationReceipts .FirstOrDefaultAsync(r => r.NotificationId == messageId && r.DeviceId == authenticatedDeviceId); if (receipt == null) { // If receipt didn't exist (e.g. device activated after notification or direct delivery), create it receipt = new NotificationReceipt { Id = $"rcpt_{Guid.NewGuid():N}", NotificationId = messageId, DeviceId = authenticatedDeviceId, Status = "Sent", UpdatedAt = DateTimeOffset.UtcNow }; db.NotificationReceipts.Add(receipt); } // State Machine Protection: // Rank: Sent (0) -> DeviceReceived (1) -> Displayed (2) -> Acknowledged (3) // Terminal states: Timeout, Failed, Cancelled. // Rule: Never resurrect a Cancelled receipt, and never regress from Acknowledged to any lower rank or failure. if (receipt.Status == "Cancelled" || receipt.Status == "Acknowledged") { _logger.LogInformation("Receipt {ReceiptId} (Dev {DevId}) is terminal {Status}. Ignoring subsequent {NewStatus}.", receipt.Id, authenticatedDeviceId, receipt.Status, ack.Status); return; } switch (ack.Status) { case AckStatus.Delivered: // Client WPF displayed window on screen receipt.DeviceReceivedAt ??= ack.Timestamp; receipt.DisplayedAt ??= ack.Timestamp; if (receipt.Status != "Displayed" && receipt.Status != "Acknowledged") { receipt.Status = "Displayed"; } break; case AckStatus.Acknowledged: receipt.DeviceReceivedAt ??= ack.Timestamp; receipt.DisplayedAt ??= ack.Timestamp; receipt.AcknowledgedAt = ack.Timestamp; receipt.Status = "Acknowledged"; break; case AckStatus.Timeout: if (receipt.Status != "Acknowledged") { receipt.Status = "Timeout"; } break; case AckStatus.Failed: if (receipt.Status != "Acknowledged") { receipt.Status = "Failed"; receipt.FailedAt = ack.Timestamp; receipt.FailureReason = ack.Remark; } break; case AckStatus.Sent: default: break; } receipt.UpdatedAt = DateTimeOffset.UtcNow; await db.SaveChangesAsync(); } public async Task ValidateNotificationTargetAsync(string messageId, string tenantId, string classroomId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); return await db.Notifications.AsNoTracking() .AnyAsync(n => n.Id == messageId && n.TenantId == tenantId && n.ClassroomId == classroomId); } public async Task> GetNotificationsAsync(string? tenantId, string? classId, int limit = 50) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Notifications.AsNoTracking().Include(n => n.Receipts).AsQueryable(); if (!string.IsNullOrEmpty(tenantId) && tenantId != "global") { query = query.Where(n => n.TenantId == tenantId); } if (!string.IsNullOrEmpty(classId)) { query = query.Where(n => n.ClassroomId == classId); } var notifications = await query.OrderByDescending(n => n.CreatedAt).Take(limit).ToListAsync(); var classrooms = await db.Classrooms.AsNoTracking().ToDictionaryAsync(c => $"{c.TenantId}_{c.Id}", c => c.DisplayName); return notifications.Select(n => { classrooms.TryGetValue($"{n.TenantId}_{n.ClassroomId}", out var cName); // Compute aggregate status across all device receipts string status = "Sent"; DateTimeOffset? confirmedAt = null; if (n.IsCancelled) { status = "Cancelled"; } else if (n.Receipts.Any(r => r.Status == "Acknowledged")) { status = "Acknowledged"; confirmedAt = n.Receipts.FirstOrDefault(r => r.Status == "Acknowledged")?.AcknowledgedAt; } else if (n.Receipts.Any(r => r.Status == "Displayed" || r.Status == "DeviceReceived")) { status = "Delivered"; } else if (n.Receipts.Any(r => r.Status == "Failed")) { status = "Failed"; } else if (n.Receipts.Any(r => r.Status == "Timeout")) { status = "Timeout"; } else if ((n.Receipts.Any() && n.Receipts.All(r => r.Status == "Expired")) || (n.ExpiresAt.HasValue && n.ExpiresAt.Value <= DateTimeOffset.UtcNow)) { status = "Expired"; } return new NotificationRecordDto { Id = n.Id, TenantId = n.TenantId, ClassId = n.ClassroomId, ClassName = cName ?? n.ClassroomId, SenderName = n.SenderName, Message = n.Message, Priority = n.Priority, CreatedAt = n.CreatedAt, Status = status, IsCancelled = n.IsCancelled, CancelledAt = n.CancelledAt, CancelledBy = n.CancelledBy, ConfirmedAt = confirmedAt, ExpiresAt = n.ExpiresAt, Receipts = n.Receipts.Select(r => new NotificationReceiptViewDto { DeviceId = r.DeviceId, Status = r.Status, DisplayedAt = r.DisplayedAt, VisualReceiptState = r.VisualReceiptState, VisualReceiptCapturedAt = r.VisualReceiptCapturedAt, VisualReceiptExpiresAt = r.VisualReceiptExpiresAt }).ToList() }; }).ToList(); } public async Task> GetPendingNotificationsForDeviceAsync(string deviceId) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; // Query pending receipts for this authenticated device (excluding cancelled notifications) var pendingReceipts = await db.NotificationReceipts .Include(r => r.Notification) .Where(r => r.DeviceId == deviceId && r.Status == "Sent" && r.Notification != null && !r.Notification.IsCancelled) .ToListAsync(); var validDtos = new List(); bool hasStateChanges = false; foreach (var receipt in pendingReceipts) { if (receipt.Notification == null) continue; if (receipt.Notification.IsCancelled) { receipt.Status = "Cancelled"; receipt.UpdatedAt = now; hasStateChanges = true; continue; } // Check if notification has expired (or is legacy Batch 8 record where ExpiresAt is NULL) if (!receipt.Notification.ExpiresAt.HasValue || receipt.Notification.ExpiresAt.Value <= now) { receipt.Status = "Expired"; receipt.UpdatedAt = now; hasStateChanges = true; _logger.LogInformation("Receipt {ReceiptId} for Device {DeviceId} (Msg {MsgId}) marked Expired (ExpiresAt: {ExpiresAt}).", receipt.Id, deviceId, receipt.NotificationId, receipt.Notification.ExpiresAt); } else { var n = receipt.Notification; validDtos.Add(new NotificationDto { Id = n.Id, TenantId = n.TenantId, ClassId = n.ClassroomId, Title = n.Title, Message = n.Message, Type = Enum.TryParse(n.Priority, out var p) ? p : ClassNotify.Shared.Enums.NotificationType.Call, Voice = n.Voice, Shake = n.Shake, DurationSeconds = n.DurationSeconds, CreatedAt = n.CreatedAt, ExpiresAt = n.ExpiresAt }); } } if (hasStateChanges) { await db.SaveChangesAsync(); } return validDtos.OrderBy(d => d.CreatedAt).ToList(); } public async Task CancelNotificationAsync( string notificationId, string actorUserId, string actorUsername, string role, string tenantId, string? ip, CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var snapshot = await db.Notifications .AsNoTracking() .Where(n => n.Id == notificationId) .Select(n => new { n.Id, n.TenantId, n.ClassroomId, n.SenderUserId, n.SenderName, n.Message, n.IsCancelled, n.CancelledAt, n.CancelledBy }) .SingleOrDefaultAsync(ct); if (snapshot == null) throw new KeyNotFoundException("通知记录不存在。"); // ---------- Authorization (Enforced at Service Layer) ---------- switch (role) { case "SuperAdmin": break; case "SchoolAdmin": if (snapshot.TenantId != tenantId) throw new UnauthorizedAccessException("无权撤回其他学校的通知。"); break; case "Teacher": if (snapshot.TenantId != tenantId) throw new UnauthorizedAccessException("无权撤回其他学校的通知。"); // Check ownership: Strict SenderUserId matching (never rely on mutable display name) if (!string.IsNullOrEmpty(snapshot.SenderUserId) && snapshot.SenderUserId != actorUserId) throw new UnauthorizedAccessException("教师只能撤回自己发送的通知。"); break; default: throw new UnauthorizedAccessException("当前角色无通知撤回权限。"); } if (snapshot.IsCancelled) { return new CancelNotificationResult( snapshot.Id, snapshot.TenantId, snapshot.ClassroomId, true, snapshot.CancelledAt, snapshot.CancelledBy); } var now = DateTimeOffset.UtcNow; await using var tx = await db.Database.BeginTransactionAsync(ct); try { // 原子 first-writer-wins var affected = await db.Notifications .Where(n => n.Id == notificationId && !n.IsCancelled) .ExecuteUpdateAsync(setters => setters .SetProperty(n => n.IsCancelled, true) .SetProperty(n => n.CancelledAt, now) .SetProperty(n => n.CancelledBy, actorUsername), ct); if (affected == 0) { var current = await db.Notifications.AsNoTracking() .SingleAsync(n => n.Id == notificationId, ct); await tx.RollbackAsync(ct); return new CancelNotificationResult( current.Id, current.TenantId, current.ClassroomId, true, current.CancelledAt, current.CancelledBy); } // 只终止尚未 Displayed / Acknowledged 的 Receipt await db.NotificationReceipts .Where(r => r.NotificationId == notificationId && (r.Status == "Sent" || r.Status == "DeviceReceived")) .ExecuteUpdateAsync(setters => setters .SetProperty(r => r.Status, "Cancelled") .SetProperty(r => r.UpdatedAt, now), ct); db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = now, ActorUsername = actorUsername, ActorRole = role, Action = "NOTIFICATION_CANCELLED", TargetType = "Notification", TargetId = notificationId, Details = $"提前关闭通知,Tenant={snapshot.TenantId}, Classroom={snapshot.ClassroomId}: {snapshot.Message}", IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return new CancelNotificationResult( notificationId, snapshot.TenantId, snapshot.ClassroomId, false, now, actorUsername); } catch { await tx.RollbackAsync(ct); throw; } } #endregion #region Device Commands (P1 Batch 10) public async Task CreateDeviceCommandAsync(string? callerTenantId, string deviceId, string commandType, string? parameters, string createdBy, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(deviceId)) { throw new ArgumentException("DeviceId cannot be empty", nameof(deviceId)); } // Whitelist check if (!DeviceCommandTypes.IsSupported(commandType)) { throw new ArgumentException($"Unsupported command type '{commandType}'. Whitelist: {string.Join(", ", DeviceCommandTypes.AllSupported)}"); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) { throw new InvalidOperationException($"Target device '{deviceId}' not found"); } // Multi-tenant isolation: non-superadmin caller must match device tenant if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(callerTenantId, device.TenantId, StringComparison.OrdinalIgnoreCase)) { throw new UnauthorizedAccessException($"Device '{deviceId}' does not belong to tenant '{callerTenantId}'"); } // P0-02 Security Gate: Verify tenant is active var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == device.TenantId); if (tenant != null && !tenant.IsActive) { throw new InvalidOperationException($"设备所属学校 [{tenant.Name}] 已停用冻结,无法下发远程运维指令"); } var ttl = DeviceCommandTypes.GetDefaultTtl(commandType); var now = DateTimeOffset.UtcNow; var commandId = $"cmd_{Guid.NewGuid():N}"; var entity = new DeviceCommand { Id = commandId, TenantId = device.TenantId, DeviceId = device.Id, CommandType = commandType, Parameters = parameters, CreatedBy = createdBy, CreatedAt = now, ExpiresAt = now.Add(ttl), Status = DeviceCommandStatuses.Pending }; db.DeviceCommands.Add(entity); // Pre-Audit in the EXACT SAME database transaction: // Ensures DeviceCommand cannot persist without immutable REMOTE_COMMAND_REQUESTED audit db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = now, ActorUsername = createdBy, ActorRole = actorRole ?? "SuperAdmin", Action = "REMOTE_COMMAND_REQUESTED", TargetType = "Device", TargetId = device.Id, Details = $"创建远程控制指令: {commandType} (CommandId: {commandId}, 参数: {parameters ?? "none"})", IpAddress = ip }); await db.SaveChangesAsync(); await tx.CommitAsync(); _logger.LogInformation("Created remote command {CommandId} ({CommandType}) with atomic Pre-Audit for Device {DeviceId} (Tenant {TenantId}) by {CreatedBy}", commandId, commandType, device.Id, device.TenantId, createdBy); return new DeviceCommandDto { CommandId = entity.Id, TenantId = entity.TenantId, DeviceId = entity.DeviceId, CommandType = entity.CommandType, Parameters = entity.Parameters, CreatedBy = entity.CreatedBy, CreatedAt = entity.CreatedAt, ExpiresAt = entity.ExpiresAt, Status = entity.Status }; } catch { await tx.RollbackAsync(); throw; } } public async Task MarkCommandDispatchedAsync(string commandId) { if (string.IsNullOrWhiteSpace(commandId)) return false; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == commandId); if (cmd == null) return false; if (cmd.Status == DeviceCommandStatuses.Pending) { cmd.Status = DeviceCommandStatuses.Dispatched; await db.SaveChangesAsync(); return true; } return false; } public async Task RecordCommandResultAsync(DeviceCommandResultDto result, string callerDeviceId, string? callerTenantId) { if (result == null || string.IsNullOrWhiteSpace(result.CommandId)) { _logger.LogWarning("RecordCommandResultAsync called with empty CommandId"); return null; } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == result.CommandId); if (cmd == null) { _logger.LogWarning("Remote command {CommandId} not found when recording execution result", result.CommandId); return null; } // Security assertion: device and tenant isolation if (!string.Equals(cmd.DeviceId, callerDeviceId, StringComparison.OrdinalIgnoreCase)) { _logger.LogWarning("Rejecting command result: DeviceId mismatch. Target: {TargetDevice}, Caller: {CallerDevice} (Command {CommandId})", cmd.DeviceId, callerDeviceId, result.CommandId); return null; } if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(cmd.TenantId, callerTenantId, StringComparison.OrdinalIgnoreCase)) { _logger.LogWarning("Rejecting command result: TenantId mismatch. Target: {TargetTenant}, Caller: {CallerTenant} (Command {CommandId})", cmd.TenantId, callerTenantId, result.CommandId); return null; } // Idempotency: if already reached terminal state, do not overwrite final outcome if (DeviceCommandStatuses.IsTerminal(cmd.Status)) { _logger.LogInformation("Command {CommandId} already completed with terminal status '{Status}'. Ignoring duplicate result report.", cmd.Id, cmd.Status); return new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? 0, ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? 0, Timestamp = cmd.CompletedAt ?? DateTimeOffset.UtcNow }; } var now = DateTimeOffset.UtcNow; cmd.Status = result.Status; cmd.ResultCode = result.ResultCode; cmd.DurationMs = result.ExecutionDurationMs; cmd.ResultMessage = result.ResultMessage != null && result.ResultMessage.Length > 1000 ? result.ResultMessage[..1000] : result.ResultMessage; cmd.StartedAt ??= result.Timestamp; cmd.CompletedAt = now; await db.SaveChangesAsync(); _logger.LogInformation("Recorded execution result for Command {CommandId} (Device {DeviceId}): Status={Status}, ResultCode={ResultCode}, Duration={Duration}ms", cmd.Id, cmd.DeviceId, cmd.Status, cmd.ResultCode, cmd.DurationMs); return new DeviceCommandResultDto { CommandId = cmd.Id, DeviceId = cmd.DeviceId, Status = cmd.Status, ResultCode = cmd.ResultCode ?? 0, ResultMessage = cmd.ResultMessage, ExecutionDurationMs = cmd.DurationMs ?? result.ExecutionDurationMs, Timestamp = cmd.CompletedAt ?? now }; } public async Task GetDeviceCommandAsync(string commandId, string? callerTenantId = null) { if (string.IsNullOrWhiteSpace(commandId)) return null; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var cmd = await db.DeviceCommands.FirstOrDefaultAsync(c => c.Id == commandId); if (cmd == null) return null; if (!string.IsNullOrEmpty(callerTenantId) && !string.Equals(cmd.TenantId, callerTenantId, StringComparison.OrdinalIgnoreCase)) { return null; } // Active TTL evaluation: if Pending/Dispatched and past ExpiresAt, transition via Normalizer if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, DateTimeOffset.UtcNow)) { await db.SaveChangesAsync(); } return new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }; } public async Task> GetPendingCommandsForDeviceAsync(string deviceId) { if (string.IsNullOrWhiteSpace(deviceId)) return new List(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var list = await db.DeviceCommands .Where(c => c.DeviceId == deviceId && (c.Status == DeviceCommandStatuses.Pending || c.Status == DeviceCommandStatuses.Dispatched)) .OrderBy(c => c.CreatedAt) .ToListAsync(); var now = DateTimeOffset.UtcNow; var valid = new List(); bool hasExpiredUpdates = false; foreach (var cmd in list) { if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { hasExpiredUpdates = true; _logger.LogInformation("Command {CommandId} for Device {DeviceId} marked {Status} (ExpiresAt: {ExpiresAt}).", cmd.Id, deviceId, cmd.Status, cmd.ExpiresAt); } else { valid.Add(new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }); } } if (hasExpiredUpdates) { await db.SaveChangesAsync(); } return valid; } public async Task> GetDeviceCommandHistoryAsync(string? tenantId, string? deviceId, string? status, int limit = 50) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.DeviceCommands.AsQueryable(); if (!string.IsNullOrEmpty(tenantId)) { query = query.Where(c => c.TenantId == tenantId); } if (!string.IsNullOrEmpty(deviceId)) { query = query.Where(c => c.DeviceId == deviceId); } if (!string.IsNullOrEmpty(status)) { query = query.Where(c => c.Status == status); } var commands = await query .OrderByDescending(c => c.CreatedAt) .Take(Math.Min(limit, 200)) .ToListAsync(); var now = DateTimeOffset.UtcNow; bool hasExpiredUpdates = false; var result = new List(); foreach (var cmd in commands) { if (DeviceCommandNormalizer.NormalizeExpiredOrTimedOut(cmd, now)) { hasExpiredUpdates = true; } result.Add(new DeviceCommandDto { CommandId = cmd.Id, TenantId = cmd.TenantId, DeviceId = cmd.DeviceId, CommandType = cmd.CommandType, Parameters = cmd.Parameters, CreatedBy = cmd.CreatedBy, CreatedAt = cmd.CreatedAt, ExpiresAt = cmd.ExpiresAt, Status = cmd.Status, StartedAt = cmd.StartedAt, CompletedAt = cmd.CompletedAt, DurationMs = cmd.DurationMs, ResultCode = cmd.ResultCode, ResultMessage = cmd.ResultMessage }); } if (hasExpiredUpdates) { await db.SaveChangesAsync(); } return result; } #endregion #region Helpers public string GenerateJwtToken(User user) { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.UTF8.GetBytes(_jwtOptions.SigningKey); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, user.Id), new Claim(ClaimTypes.Name, user.FullName), new Claim(ClaimTypes.Role, user.Role), new Claim("tenant_id", user.TenantId), new Claim("token_version", user.TokenVersion.ToString()) }), Issuer = _jwtOptions.Issuer, Audience = _jwtOptions.Audience, Expires = DateTime.UtcNow.AddDays(_jwtOptions.LifetimeDays > 0 ? _jwtOptions.LifetimeDays : 14), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); return tokenHandler.WriteToken(token); } /// /// Legacy SHA256 password verifier for migration of existing accounts. /// STRICTLY PROHIBITED FOR GENERATING NEW PASSWORDS. /// public static bool VerifyLegacyPassword(string plaintextPassword, string legacyHash) { if (string.IsNullOrEmpty(plaintextPassword) || string.IsNullOrEmpty(legacyHash)) { return false; } using var sha = SHA256.Create(); var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(plaintextPassword + "_classnotify_salt")); var computed = Convert.ToBase64String(bytes); return CryptographicOperations.FixedTimeEquals( Encoding.UTF8.GetBytes(computed), Encoding.UTF8.GetBytes(legacyHash)); } private static string HashToken(string token) { using var sha = SHA256.Create(); var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(token)); return Convert.ToBase64String(bytes); } #region SuperAdmin Control Plane Implementations public async Task CreateTenantAsync(string id, string name, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(name)) throw new ArgumentException("学校ID与名称不可为空"); var cleanId = id.Trim().ToLowerInvariant(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { if (await db.Tenants.AnyAsync(t => t.Id == cleanId)) throw new InvalidOperationException($"租户ID '{cleanId}' 已存在"); var tenant = new Tenant { Id = cleanId, Name = name.Trim(), IsActive = true, CreatedAt = DateTimeOffset.UtcNow }; db.Tenants.Add(tenant); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "CREATE_TENANT", TargetType = "Tenant", TargetId = tenant.Id, Details = $"创建学校: {tenant.Name} ({tenant.Id})", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return new TenantAdminDto { Id = tenant.Id, Name = tenant.Name, ClassroomCount = 0, DeviceCount = 0, OnlineCount = 0, IsActive = tenant.IsActive, CreatedAt = tenant.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task UpdateTenantAsync(string id, string name, bool isActive, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == id); if (tenant == null) return null; if (!string.IsNullOrWhiteSpace(name)) tenant.Name = name.Trim(); tenant.IsActive = isActive; if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "UPDATE_TENANT", TargetType = "Tenant", TargetId = tenant.Id, Details = $"更新学校: {tenant.Name}, 启用状态: {tenant.IsActive}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); var classroomCount = await db.Classrooms.CountAsync(c => c.TenantId == id); var deviceCount = await db.Devices.CountAsync(d => d.TenantId == id); var onlineCount = _liveConnections.Values.Count(c => c.TenantId == id); return new TenantAdminDto { Id = tenant.Id, Name = tenant.Name, ClassroomCount = classroomCount, DeviceCount = deviceCount, OnlineCount = onlineCount, IsActive = tenant.IsActive, CreatedAt = tenant.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task> GetAllUsersAdminAsync(string? tenantId, string? role) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var query = db.Users.Include(u => u.Tenant).AsQueryable(); if (!string.IsNullOrWhiteSpace(tenantId)) query = query.Where(u => u.TenantId == tenantId); if (!string.IsNullOrWhiteSpace(role)) query = query.Where(u => u.Role == role); var list = await query.OrderByDescending(u => u.CreatedAt).ToListAsync(); return list.Select(u => new UserAdminDto { Id = u.Id, TenantId = u.TenantId, TenantName = u.Tenant?.Name ?? u.TenantId, Username = u.Username, FullName = u.FullName, Role = u.Role, IsLocked = u.IsLocked, CreatedAt = u.CreatedAt, LastLoginAt = u.LastLoginAt }).ToList(); } public async Task CreateUserAdminAsync(CreateUserAdminRequest req, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(req.TenantId) || string.IsNullOrWhiteSpace(req.Username) || string.IsNullOrWhiteSpace(req.Password) || string.IsNullOrWhiteSpace(req.FullName)) throw new ArgumentException("所有必填字段均不可为空"); // P1 Gate: Minimum password length 8 characters if (req.Password.Trim().Length < 8) throw new ArgumentException("密码长度不能少于 8 位"); var targetRole = req.Role?.Trim(); if (targetRole != "SchoolAdmin" && targetRole != "Teacher") throw new ArgumentException("角色必须为 'SchoolAdmin' 或 'Teacher'"); var cleanUser = req.Username.Trim(); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { if (await db.Users.AnyAsync(u => u.Username == cleanUser)) throw new InvalidOperationException($"用户名 '{cleanUser}' 已被占用"); var tenant = await db.Tenants.FirstOrDefaultAsync(t => t.Id == req.TenantId); if (tenant == null) throw new InvalidOperationException($"租户 '{req.TenantId}' 不存在"); // P0-02 Security Gate: Verify tenant is active if (!tenant.IsActive) throw new InvalidOperationException($"学校租户 '{tenant.Name}' 处于停用冻结状态,无法开通新账号"); var user = new User { Id = $"usr_{Guid.NewGuid():N}".Substring(0, 12), TenantId = req.TenantId, Username = cleanUser, FullName = req.FullName.Trim(), Role = targetRole, IsLocked = false, TokenVersion = 1, CreatedAt = DateTimeOffset.UtcNow }; user.PasswordHash = _passwordHasher.HashPassword(user, req.Password); db.Users.Add(user); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "CREATE_USER", TargetType = "User", TargetId = user.Username, Details = $"创建用户: {user.FullName} ({user.Role}),学校: {tenant.Name}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return new UserAdminDto { Id = user.Id, TenantId = user.TenantId, TenantName = tenant.Name, Username = user.Username, FullName = user.FullName, Role = user.Role, IsLocked = user.IsLocked, CreatedAt = user.CreatedAt }; } catch { await tx.RollbackAsync(); throw; } } public async Task ResetPasswordAsync(string userId, string newPassword, string? actor = null, string? actorRole = null, string? ip = null) { if (string.IsNullOrWhiteSpace(newPassword) || newPassword.Trim().Length < 8) throw new ArgumentException("新密码长度不能少于 8 位"); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; user.PasswordHash = _passwordHasher.HashPassword(user, newPassword); user.TokenVersion++; // Permanent invalidation of existing JWTs if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "RESET_PASSWORD", TargetType = "User", TargetId = userId, Details = "管理员重置用户登录密码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task SetUserLockAsync(string userId, bool isLocked, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; user.IsLocked = isLocked; user.TokenVersion++; // Invalidate existing tokens if (!string.IsNullOrEmpty(actor)) { var action = isLocked ? "LOCK_USER" : "UNLOCK_USER"; var detail = isLocked ? "锁定账号 (禁止登录)" : "解锁账号 (恢复登录)"; db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = action, TargetType = "User", TargetId = userId, Details = detail, IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task ResetSchoolTeacherPasswordAsync(string schoolAdminTenantId, string teacherUserId, string newPassword, string actorUsername, string? ip, CancellationToken ct = default) { if (string.IsNullOrWhiteSpace(newPassword) || newPassword.Trim().Length < 8) throw new ArgumentException("新密码长度不得少于 8 位"); using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var targetUser = await db.Users .FirstOrDefaultAsync(u => u.Id == teacherUserId, ct); if (targetUser == null) throw new KeyNotFoundException("账号不存在。"); if (targetUser.Role == "SuperAdmin") throw new UnauthorizedAccessException("无权修改超级管理员密码。"); if (targetUser.TenantId != schoolAdminTenantId) throw new UnauthorizedAccessException("无权修改其他学校账号密码。"); if (targetUser.Role != "Teacher") throw new UnauthorizedAccessException("学校管理员无权修改非教师角色账号密码。"); await using var tx = await db.Database.BeginTransactionAsync(ct); try { targetUser.PasswordHash = _passwordHasher.HashPassword(targetUser, newPassword); targetUser.TokenVersion += 1; // 吊销旧 Token db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = "SchoolAdmin", Action = "SCHOOLADMIN_RESET_TEACHER_PASSWORD", TargetType = "User", TargetId = teacherUserId, Details = $"重置教师密码: {targetUser.Username}", IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return true; } catch { await tx.RollbackAsync(ct); throw; } } public async Task SetSchoolTeacherLockAsync(string schoolAdminTenantId, string teacherUserId, bool isLocked, string actorUsername, string? ip, CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var targetUser = await db.Users .FirstOrDefaultAsync(u => u.Id == teacherUserId, ct); if (targetUser == null) throw new KeyNotFoundException("账号不存在。"); if (targetUser.Role == "SuperAdmin") throw new UnauthorizedAccessException("无权锁定超级管理员账号。"); if (targetUser.TenantId != schoolAdminTenantId) throw new UnauthorizedAccessException("无权操作其他学校账号。"); if (targetUser.Role != "Teacher") throw new UnauthorizedAccessException("学校管理员无权启停非教师角色账号。"); if (targetUser.IsLocked == isLocked) return false; await using var tx = await db.Database.BeginTransactionAsync(ct); try { targetUser.IsLocked = isLocked; targetUser.TokenVersion += 1; var action = isLocked ? "SCHOOLADMIN_LOCK_TEACHER" : "SCHOOLADMIN_UNLOCK_TEACHER"; var details = isLocked ? $"停用教师账号: {targetUser.Username}" : $"恢复教师账号: {targetUser.Username}"; db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = "SchoolAdmin", Action = action, TargetType = "User", TargetId = teacherUserId, Details = details, IpAddress = ip }); await db.SaveChangesAsync(ct); await tx.CommitAsync(ct); return true; } catch { await tx.RollbackAsync(ct); throw; } } public async Task GetBroadcastReceiptSummaryAsync(string broadcastId, CancellationToken ct = default) { if (string.IsNullOrWhiteSpace(broadcastId)) return null; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notifications = await db.Notifications .AsNoTracking() .Include(n => n.Receipts) .Where(n => n.BroadcastId == broadcastId) .ToListAsync(ct); if (notifications.Count == 0) return null; var receipts = notifications .SelectMany(n => n.Receipts) .ToList(); return new BroadcastReceiptSummaryDto { BroadcastId = broadcastId, TargetSchools = notifications.Select(n => n.TenantId).Distinct().Count(), TargetClassrooms = notifications.Count, TargetDevices = receipts.Count, Displayed = receipts.Count(r => NotificationReceiptStatuses.IsDisplayed(r.Status)), Pending = receipts.Count(r => NotificationReceiptStatuses.IsPending(r.Status)), Cancelled = receipts.Count(r => r.Status == NotificationReceiptStatuses.Cancelled), Failed = receipts.Count(r => NotificationReceiptStatuses.IsFailed(r.Status)), CreatedAt = notifications.Min(n => n.CreatedAt) }; } public async Task DeleteUserAsync(string userId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var user = await db.Users.FirstOrDefaultAsync(u => u.Id == userId); if (user == null) return false; if (user.Role == "SuperAdmin") throw new InvalidOperationException("无法删除超级管理员"); db.Users.Remove(user); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DELETE_USER", TargetType = "User", TargetId = userId, Details = "删除用户", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task UpdateDeviceAsync(string deviceId, string? hostname, string? classroomId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) return false; if (!string.IsNullOrWhiteSpace(hostname)) device.Hostname = hostname.Trim(); if (!string.IsNullOrWhiteSpace(classroomId)) { var targetClass = classroomId.Trim(); var classExists = await db.Classrooms.AsNoTracking().AnyAsync(c => c.TenantId == device.TenantId && c.Id == targetClass); if (!classExists) { throw new InvalidOperationException($"目标班级不存在或不属于设备所在的学校租户 ({device.TenantId}): {targetClass}"); } device.ClassroomId = targetClass; } if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "UPDATE_DEVICE", TargetType = "Device", TargetId = deviceId, Details = $"更新设备元数据: 主机名={hostname}, 绑定班级={classroomId}", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task DecommissionDeviceAsync(string deviceId, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var device = await db.Devices.FirstOrDefaultAsync(d => d.Id == deviceId); if (device == null) return false; device.IsActive = false; device.LastHeartbeatAt = null; if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DECOMMISSION_DEVICE", TargetType = "Device", TargetId = deviceId, Details = "清退并注销指定设备", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); if (_deviceToConnection.TryRemove(deviceId, out var connId)) { _liveConnections.TryRemove(connId, out _); _connectionTenantMap.TryRemove(connId, out _); } return true; } catch { await tx.RollbackAsync(); throw; } } public async Task DeleteActivationCodeAsync(string code, string? actor = null, string? actorRole = null, string? ip = null) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await using var tx = await db.Database.BeginTransactionAsync(); try { var act = await db.ActivationCodes.FirstOrDefaultAsync(a => a.Code == code); if (act == null) return false; db.ActivationCodes.Remove(act); if (!string.IsNullOrEmpty(actor)) { db.AdminAuditEvents.Add(new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}"[..16], OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actor, ActorRole = actorRole ?? "SuperAdmin", Action = "DELETE_ACTIVATION_CODE", TargetType = "ActivationCode", TargetId = code, Details = "作废/删除激活码", IpAddress = ip }); } await db.SaveChangesAsync(); await tx.CommitAsync(); return true; } catch { await tx.RollbackAsync(); throw; } } public async Task GetSystemHealthAsync() { bool dbOk = false; double latencyMs = 0; using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); try { var sw = System.Diagnostics.Stopwatch.StartNew(); dbOk = await db.Database.CanConnectAsync(); sw.Stop(); latencyMs = sw.Elapsed.TotalMilliseconds; } catch {} var process = System.Diagnostics.Process.GetCurrentProcess(); var uptime = DateTime.UtcNow - process.StartTime.ToUniversalTime(); return new SystemHealthDto { Status = dbOk ? "Healthy" : "Degraded", DatabaseConnected = dbOk, DatabaseLatencyMs = Math.Round(latencyMs, 2), ActiveSignalRConnections = _liveConnections.Count, OnlineDevices = _liveConnections.Count, ServerTime = DateTimeOffset.UtcNow.ToString("o"), Uptime = $"{(int)uptime.TotalHours}h {uptime.Minutes}m {uptime.Seconds}s", MemoryUsedBytes = process.WorkingSet64 }; } public async Task LogAdminAuditAsync(string actorUsername, string actorRole, string action, string targetType, string targetId, string? details, string? ip) { try { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var evt = new AdminAuditEvent { Id = $"aud_{Guid.NewGuid():N}".Substring(0, 16), OccurredAt = DateTimeOffset.UtcNow, ActorUsername = actorUsername, ActorRole = actorRole, Action = action, TargetType = targetType, TargetId = targetId, Details = details, IpAddress = ip }; db.AdminAuditEvents.Add(evt); await db.SaveChangesAsync(); } catch (Exception ex) { _logger.LogError(ex, "FATAL SECURITY AUDIT FAILURE: Failed to persist AdminAuditEvent for action {Action} (fail-closed engaged)", action); throw; } } public async Task> GetAdminAuditLogsAsync(int limit = 100) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var list = await db.AdminAuditEvents .OrderByDescending(a => a.OccurredAt) .Take(limit) .ToListAsync(); return list.Select(a => new AdminAuditLogDto { Id = a.Id, OccurredAt = a.OccurredAt, ActorUsername = a.ActorUsername, ActorRole = a.ActorRole, Action = a.Action, TargetType = a.TargetType, TargetId = a.TargetId, Details = a.Details, IpAddress = a.IpAddress }).ToList(); } #endregion #endregion } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/VisualReceiptCleanupWorker.cs SIZE: 1550 chars SHA256: 37010A2C4F9267EE287472B9657DDC3F0EFC8185E2507B0E545FF78A87041E99 ===================================================================== */ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace ClassNotify.Server.Services; public class VisualReceiptCleanupWorker : BackgroundService { private readonly IServiceProvider _serviceProvider; private readonly ILogger _logger; public VisualReceiptCleanupWorker( IServiceProvider serviceProvider, ILogger logger) { _serviceProvider = serviceProvider; _logger = logger; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("VisualReceiptCleanupWorker started (24h retention enforcer)."); while (!stoppingToken.IsCancellationRequested) { try { using var scope = _serviceProvider.CreateScope(); var service = scope.ServiceProvider.GetRequiredService(); await service.CleanupExpiredVisualReceiptsAsync(stoppingToken); } catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) { break; } catch (Exception ex) { _logger.LogError(ex, "Error occurred during visual receipt cleanup execution."); } // Check every 30 minutes await Task.Delay(TimeSpan.FromMinutes(30), stoppingToken); } _logger.LogInformation("VisualReceiptCleanupWorker stopped."); } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/Services/VisualReceiptService.cs SIZE: 14413 chars SHA256: 8BD9F45D9B860A76EC3937F1637F884F901B613CCB97D5661675D45A87E725D2 ===================================================================== */ using System.Collections.Concurrent; using System.Security.Claims; using System.Security.Cryptography; using System.Threading; using ClassNotify.Server.Data; using Microsoft.EntityFrameworkCore; namespace ClassNotify.Server.Services; public class VisualReceiptService : IVisualReceiptService { private static readonly ConcurrentDictionary _receiptLocks = new(); private readonly IServiceScopeFactory _scopeFactory; private readonly ISecurityService _securityService; private readonly IConfiguration _configuration; private readonly ILogger _logger; private readonly string _storageBasePath; public VisualReceiptService( IServiceScopeFactory scopeFactory, ISecurityService securityService, IConfiguration configuration, ILogger logger) { _scopeFactory = scopeFactory; _securityService = securityService; _configuration = configuration; _logger = logger; // Path resolution: config > /var/lib/classnotify/visual-receipts (if linux directory exists or creatable) > AppContext.BaseDirectory var configuredPath = _configuration.GetValue("VisualReceipt:StoragePath"); if (!string.IsNullOrWhiteSpace(configuredPath)) { _storageBasePath = configuredPath; } else if (OperatingSystem.IsLinux()) { _storageBasePath = "/var/lib/classnotify/visual-receipts"; } else { _storageBasePath = Path.Combine(AppContext.BaseDirectory, "visual_receipts"); } try { Directory.CreateDirectory(_storageBasePath); } catch (Exception ex) { _logger.LogWarning(ex, "Failed to create visual receipts storage directory at {Path}, falling back to temp directory.", _storageBasePath); _storageBasePath = Path.Combine(Path.GetTempPath(), "classnotify_visual_receipts"); Directory.CreateDirectory(_storageBasePath); } } public async Task SaveVisualReceiptAsync( string notificationId, string deviceId, string deviceToken, byte[] jpegBytes) { if (string.IsNullOrWhiteSpace(notificationId) || string.IsNullOrWhiteSpace(deviceId) || string.IsNullOrWhiteSpace(deviceToken)) { return new VisualReceiptUploadResult(false, "缺少必要参数或凭据", 400); } // 1. Payload size check (Max 512 KiB) if (jpegBytes == null || jpegBytes.Length == 0) { return new VisualReceiptUploadResult(false, "图片数据为空", 400); } if (jpegBytes.Length > 524288) { return new VisualReceiptUploadResult(false, "图片文件超过 512 KiB 大小限制", 413); } // 2. JPEG magic bytes check: Starts with 0xFF 0xD8, Ends with 0xFF 0xD9 if (jpegBytes.Length < 4 || jpegBytes[0] != 0xFF || jpegBytes[1] != 0xD8 || jpegBytes[^2] != 0xFF || jpegBytes[^1] != 0xD9) { return new VisualReceiptUploadResult(false, "上传内容不是合法的 JPEG 格式图像", 415); } // 3. Authenticate device token var device = await _securityService.ValidateDeviceAsync(deviceId, deviceToken); if (device == null || !device.IsActive) { return new VisualReceiptUploadResult(false, "设备凭据无效或设备已被禁用", 401); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); // 4. Validate Notification and NotificationReceipt attribution var notification = await db.Notifications.AsNoTracking().FirstOrDefaultAsync(n => n.Id == notificationId); if (notification == null) { return new VisualReceiptUploadResult(false, "目标通知不存在", 404); } // Defense in depth: Check tenant and class isolation if (notification.TenantId != device.TenantId || notification.ClassroomId != device.ClassroomId) { _logger.LogWarning("Cross-tenant/class visual receipt upload spoofing attempt: Device {DevId} ({DevTenant}/{DevClass}) vs Notif {NotifId} ({NotifTenant}/{NotifClass})", deviceId, device.TenantId, device.ClassroomId, notificationId, notification.TenantId, notification.ClassroomId); return new VisualReceiptUploadResult(false, "设备归属与通知目标班级不匹配", 403); } var receipt = await db.NotificationReceipts.FirstOrDefaultAsync(r => r.NotificationId == notificationId && r.DeviceId == deviceId); if (receipt == null) { return new VisualReceiptUploadResult(false, "该设备未被分配此通知回执记录", 403); } // 5. Concurrency & Idempotency: First Successful Receipt Wins with Per-Receipt Mutex var receiptLock = _receiptLocks.GetOrAdd(receipt.Id, _ => new SemaphoreSlim(1, 1)); await receiptLock.WaitAsync(); try { // Fresh check from database inside mutex var currentReceipt = await db.NotificationReceipts.FirstOrDefaultAsync(r => r.Id == receipt.Id); if (currentReceipt == null) { return new VisualReceiptUploadResult(false, "回执记录不存在", 404); } if (currentReceipt.VisualReceiptState == "Available") { _logger.LogInformation("Visual receipt already available for Notification {NotifId} / Device {DevId} (Receipt {ReceiptId}). First-wins idempotent success returned.", notificationId, deviceId, receipt.Id); return new VisualReceiptUploadResult(true, "视觉回执已存在", 200, currentReceipt.Id, currentReceipt.VisualReceiptCapturedAt, currentReceipt.VisualReceiptExpiresAt); } // 6. Compute SHA256 hash string sha256Hex; using (var sha = SHA256.Create()) { var hashBytes = sha.ComputeHash(jpegBytes); sha256Hex = BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant(); } // 7. Atomic file writing with unique temporary file and overwrite: false var now = DateTimeOffset.UtcNow; var dateFolder = now.ToString("yyyyMMdd"); var targetDir = Path.Combine(_storageBasePath, dateFolder); Directory.CreateDirectory(targetDir); var relativePath = $"{dateFolder}/{currentReceipt.Id}.jpg"; var finalFilePath = Path.Combine(_storageBasePath, dateFolder, $"{currentReceipt.Id}.jpg"); var tempFilePath = Path.Combine(_storageBasePath, dateFolder, $"{currentReceipt.Id}_{Guid.NewGuid():N}.tmp"); try { await File.WriteAllBytesAsync(tempFilePath, jpegBytes); File.Move(tempFilePath, finalFilePath, overwrite: false); } catch (IOException ex) when (File.Exists(finalFilePath)) { // File already placed by a winning race; clean up temp and return idempotent success _logger.LogInformation(ex, "Final visual receipt file already exists at {Path}. Cleaned temp and returning first-wins idempotent.", finalFilePath); try { if (File.Exists(tempFilePath)) File.Delete(tempFilePath); } catch { } return new VisualReceiptUploadResult(true, "视觉回执已存在", 200, currentReceipt.Id, currentReceipt.VisualReceiptCapturedAt ?? now, currentReceipt.VisualReceiptExpiresAt ?? now.AddHours(24)); } catch (Exception ex) { _logger.LogError(ex, "Failed to write visual receipt file to {Path}", finalFilePath); try { if (File.Exists(tempFilePath)) File.Delete(tempFilePath); } catch { } return new VisualReceiptUploadResult(false, "服务端写入视觉回执文件失败", 500); } // 8. Update database record with 24-hour retention var expiresAt = now.AddHours(24); currentReceipt.VisualReceiptState = "Available"; currentReceipt.VisualReceiptPath = relativePath; currentReceipt.VisualReceiptCapturedAt = now; currentReceipt.VisualReceiptExpiresAt = expiresAt; currentReceipt.VisualReceiptSizeBytes = jpegBytes.Length; currentReceipt.VisualReceiptSha256 = sha256Hex; currentReceipt.UpdatedAt = now; try { await db.SaveChangesAsync(); _logger.LogInformation("Visual receipt successfully saved for Notification {NotifId} / Device {DevId} (Size: {Size} bytes, SHA256: {Sha256}, Expires: {ExpiresAt})", notificationId, deviceId, jpegBytes.Length, sha256Hex, expiresAt); return new VisualReceiptUploadResult(true, "视觉回执上传成功", 200, currentReceipt.Id, now, expiresAt); } catch (Exception ex) { _logger.LogError(ex, "Database update failed after saving visual receipt file. Compensating by removing file {Path}", finalFilePath); try { if (File.Exists(finalFilePath)) File.Delete(finalFilePath); } catch { } return new VisualReceiptUploadResult(false, "更新回执数据库状态失败", 500); } } finally { receiptLock.Release(); } } public async Task GetVisualReceiptFileAsync(string notificationId, string deviceId, ClaimsPrincipal user) { if (user.Identity?.IsAuthenticated != true) { return new VisualReceiptFileResult(false, null, 401, "未登录或登录凭据无效"); } using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var notification = await db.Notifications.AsNoTracking().FirstOrDefaultAsync(n => n.Id == notificationId); if (notification == null) { return new VisualReceiptFileResult(false, null, 404, "通知记录不存在"); } // Permission check var userRole = user.FindFirst(ClaimTypes.Role)?.Value ?? "Teacher"; var userTenant = user.FindFirst("tenant_id")?.Value; var userId = user.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (userRole != "SuperAdmin") { if (string.IsNullOrEmpty(userTenant) || userTenant != notification.TenantId) { return new VisualReceiptFileResult(false, null, 403, "无权查看非本校通知记录的视觉回执"); } if (userRole == "Teacher") { // Teacher can view notifications sent by themselves or targeting their classroom bool isSender = !string.IsNullOrEmpty(userId) && notification.SenderUserId == userId; if (!isSender) { // Allow teacher within same school to view class notification history // (Consistent with existing NotificationController.GetNotifications policy) } } } var receipt = await db.NotificationReceipts.AsNoTracking() .FirstOrDefaultAsync(r => r.NotificationId == notificationId && r.DeviceId == deviceId); if (receipt == null || receipt.VisualReceiptState == "None") { return new VisualReceiptFileResult(false, null, 404, "该设备无视觉回执记录"); } var now = DateTimeOffset.UtcNow; if (receipt.VisualReceiptState == "Expired" || (receipt.VisualReceiptExpiresAt.HasValue && receipt.VisualReceiptExpiresAt.Value <= now)) { return new VisualReceiptFileResult(false, null, 410, "该视觉回执已按 24 小时隐私保存策略自动销毁"); } if (string.IsNullOrEmpty(receipt.VisualReceiptPath)) { return new VisualReceiptFileResult(false, null, 404, "视觉回执文件路径为空"); } // Prevent path traversal var safeRelativePath = receipt.VisualReceiptPath.Replace('\\', '/').TrimStart('/'); if (safeRelativePath.Contains("..")) { return new VisualReceiptFileResult(false, null, 400, "非法文件路径"); } var fullPath = Path.Combine(_storageBasePath, safeRelativePath); if (!File.Exists(fullPath)) { _logger.LogWarning("Visual receipt file missing on disk: {Path}", fullPath); return new VisualReceiptFileResult(false, null, 404, "视觉回执图像文件已被物理删除"); } return new VisualReceiptFileResult(true, fullPath, 200); } public async Task CleanupExpiredVisualReceiptsAsync(CancellationToken ct = default) { using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var now = DateTimeOffset.UtcNow; var expiredReceipts = await db.NotificationReceipts .Where(r => r.VisualReceiptState == "Available" && r.VisualReceiptExpiresAt <= now) .Take(200) .ToListAsync(ct); if (expiredReceipts.Count == 0) return 0; int cleanedCount = 0; foreach (var r in expiredReceipts) { if (!string.IsNullOrEmpty(r.VisualReceiptPath)) { var safeRelativePath = r.VisualReceiptPath.Replace('\\', '/').TrimStart('/'); var fullPath = Path.Combine(_storageBasePath, safeRelativePath); try { if (File.Exists(fullPath)) { File.Delete(fullPath); } } catch (Exception ex) { _logger.LogWarning(ex, "Failed to delete expired visual receipt file at {Path}. Retaining Available state in database for retry in next cleanup cycle.", fullPath); continue; // Retain Available state and Path in database! Next worker cycle will retry. } } r.VisualReceiptPath = null; r.VisualReceiptState = "Expired"; r.UpdatedAt = now; cleanedCount++; } if (cleanedCount > 0) { await db.SaveChangesAsync(ct); _logger.LogInformation("Cleaned up {Count} expired visual receipts per 24-hour privacy retention policy.", cleanedCount); } return cleanedCount; } } /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/assets/index-BJNbsTE0.js SIZE: 399630 chars SHA256: 9883EC30030301B276C8CB343D4FFDD1A755A59356EB7CB238E3E323DB9F08DB ===================================================================== */ var Jf=Object.defineProperty;var Xf=(a,l,o)=>l in a?Jf(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;var xt=(a,l,o)=>Xf(a,typeof l!="symbol"?l+"":l,o);function Gf(a,l){for(var o=0;ou[d]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();function Td(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Oo={exports:{}},pr={},Uo={exports:{}},me={};/** * @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 rd;function Yf(){if(rd)return me;rd=1;var a=Symbol.for("react.element"),l=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),k=Symbol.iterator;function $(N){return N===null||typeof N!="object"?null:(N=k&&N[k]||N["@@iterator"],typeof N=="function"?N:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Q=Object.assign,H={};function P(N,L,ae){this.props=N,this.context=L,this.refs=H,this.updater=ae||D}P.prototype.isReactComponent={},P.prototype.setState=function(N,L){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,L,"setState")},P.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function J(){}J.prototype=P.prototype;function K(N,L,ae){this.props=N,this.context=L,this.refs=H,this.updater=ae||D}var Y=K.prototype=new J;Y.constructor=K,Q(Y,P.prototype),Y.isPureReactComponent=!0;var ne=Array.isArray,U=Object.prototype.hasOwnProperty,Z={current:null},ge={key:!0,ref:!0,__self:!0,__source:!0};function xe(N,L,ae){var ue,fe={},we=null,Ee=null;if(L!=null)for(ue in L.ref!==void 0&&(Ee=L.ref),L.key!==void 0&&(we=""+L.key),L)U.call(L,ue)&&!ge.hasOwnProperty(ue)&&(fe[ue]=L[ue]);var ke=arguments.length-2;if(ke===1)fe.children=ae;else if(1>>1,L=_[N];if(0>>1;Nd(fe,E))wed(Ee,fe)?(_[N]=Ee,_[we]=E,N=we):(_[N]=fe,_[ue]=E,N=ue);else if(wed(Ee,E))_[N]=Ee,_[we]=E,N=we;else break e}}return V}function d(_,V){var E=_.sortIndex-V.sortIndex;return E!==0?E:_.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,y=m.now();a.unstable_now=function(){return m.now()-y}}var p=[],j=[],S=1,k=null,$=3,D=!1,Q=!1,H=!1,P=typeof setTimeout=="function"?setTimeout:null,J=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Y(_){for(var V=o(j);V!==null;){if(V.callback===null)u(j);else if(V.startTime<=_)u(j),V.sortIndex=V.expirationTime,l(p,V);else break;V=o(j)}}function ne(_){if(H=!1,Y(_),!Q)if(o(p)!==null)Q=!0,_e(U);else{var V=o(j);V!==null&&W(ne,V.startTime-_)}}function U(_,V){Q=!1,H&&(H=!1,J(xe),xe=-1),D=!0;var E=$;try{for(Y(V),k=o(p);k!==null&&(!(k.expirationTime>V)||_&&!Ce());){var N=k.callback;if(typeof N=="function"){k.callback=null,$=k.priorityLevel;var L=N(k.expirationTime<=V);V=a.unstable_now(),typeof L=="function"?k.callback=L:k===o(p)&&u(p),Y(V)}else u(p);k=o(p)}if(k!==null)var ae=!0;else{var ue=o(j);ue!==null&&W(ne,ue.startTime-V),ae=!1}return ae}finally{k=null,$=E,D=!1}}var Z=!1,ge=null,xe=-1,R=5,se=-1;function Ce(){return!(a.unstable_now()-se_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<_?Math.floor(1e3/_):5},a.unstable_getCurrentPriorityLevel=function(){return $},a.unstable_getFirstCallbackNode=function(){return o(p)},a.unstable_next=function(_){switch($){case 1:case 2:case 3:var V=3;break;default:V=$}var E=$;$=V;try{return _()}finally{$=E}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(_,V){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var E=$;$=_;try{return V()}finally{$=E}},a.unstable_scheduleCallback=function(_,V,E){var N=a.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0N?(_.sortIndex=E,l(j,_),o(p)===null&&_===o(j)&&(H?(J(xe),xe=-1):H=!0,W(ne,E-N))):(_.sortIndex=L,l(p,_),Q||D||(Q=!0,_e(U))),_},a.unstable_shouldYield=Ce,a.unstable_wrapCallback=function(_){var V=$;return function(){var E=$;$=V;try{return _.apply(this,arguments)}finally{$=E}}}})(Ho)),Ho}var cd;function sm(){return cd||(cd=1,Bo.exports=nm()),Bo.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 ud;function rm(){if(ud)return gt;ud=1;var a=ta(),l=sm();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,j=/^[: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]*$/,S={},k={};function $(e){return p.call(k,e)?!0:p.call(S,e)?!1:j.test(e)?k[e]=!0:(S[e]=!0,!1)}function D(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q(e,t,s,r){if(t===null||typeof t>"u"||D(e,t,s,r))return!0;if(r)return!1;if(s!==null)switch(s.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 H(e,t,s,r,i,c,h){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=h}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){P[e]=new H(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];P[t]=new H(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){P[e]=new H(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){P[e]=new H(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){P[e]=new H(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){P[e]=new H(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){P[e]=new H(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){P[e]=new H(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){P[e]=new H(e,5,!1,e.toLowerCase(),null,!1,!1)});var J=/[\-:]([a-z])/g;function K(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(J,K);P[t]=new H(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(J,K);P[t]=new H(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(J,K);P[t]=new H(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){P[e]=new H(e,1,!1,e.toLowerCase(),null,!1,!1)}),P.xlinkHref=new H("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){P[e]=new H(e,1,!1,e.toLowerCase(),null,!0,!0)});function Y(e,t,s,r){var i=P.hasOwnProperty(t)?P[t]:null;(i!==null?i.type!==0:r||!(2x||i[h]!==c[x]){var v=` `+i[h].replace(" at new "," at ");return e.displayName&&v.includes("")&&(v=v.replace("",e.displayName)),v}while(1<=h&&0<=x);break}}}finally{ae=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?L(e):""}function fe(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ue(e.type,!1),e;case 11:return e=ue(e.type.render,!1),e;case 1:return e=ue(e.type,!0),e;default:return""}}function we(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 ge:return"Fragment";case Z:return"Portal";case R:return"Profiler";case xe:return"StrictMode";case O:return"Suspense";case ve:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ce:return(e.displayName||"Context")+".Consumer";case se:return(e._context.displayName||"Context")+".Provider";case je:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pe:return t=e.displayName||null,t!==null?t:we(e.type)||"Memo";case _e:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}function Ee(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 we(t);case 8:return t===xe?"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 ke(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function F(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function he(e){var t=F(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var i=s.get,c=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(h){r=""+h,c.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(h){r=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ot(e){e._valueTracker||(e._valueTracker=he(e))}function Se(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=F(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function We(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 $e(e,t){var s=t.checked;return E({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Jn(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=ke(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function nn(e,t){t=t.checked,t!=null&&Y(e,"checked",t,!1)}function Ql(e,t){nn(e,t);var s=ke(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ql(e,t.type,s):t.hasOwnProperty("defaultValue")&&ql(e,t.type,ke(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fa(e,t,s){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,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function ql(e,t,s){(t!=="number"||We(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ps=Array.isArray;function Xn(e,t,s,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Is(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Rs={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},Yd=["Webkit","ms","Moz","O"];Object.keys(Rs).forEach(function(e){Yd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rs[t]=Rs[e]})});function ya(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Rs.hasOwnProperty(e)&&Rs[e]?(""+t).trim():t+"px"}function wa(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,i=ya(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,i):e[s]=i}}var Zd=E({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 Xl(e,t){if(t){if(Zd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function Gl(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 Yl=null;function Zl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ei=null,Gn=null,Yn=null;function ja(e){if(e=er(e)){if(typeof ei!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Gr(t),ei(e.stateNode,e.type,t))}}function Na(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function ba(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,ja(e),t)for(e=0;e>>=0,e===0?32:31-(uh(e)/dh|0)|0}var Lr=64,Dr=4194304;function Ms(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 $r(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,c=e.pingedLanes,h=s&268435455;if(h!==0){var x=h&~i;x!==0?r=Ms(x):(c&=h,c!==0&&(r=Ms(c)))}else h=s&~i,h!==0?r=Ms(h):c!==0&&(r=Ms(c));if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,c=t&-t,i>=c||i===16&&(c&4194240)!==0))return t;if((r&4)!==0&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0s;s++)t.push(e);return t}function As(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=s}function ph(e,t){var s=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=Vs),Ga=" ",Ya=!1;function Za(e,t){switch(e){case"keyup":return Hh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function Vh(e,t){switch(e){case"compositionend":return ec(t);case"keypress":return t.which!==32?null:(Ya=!0,Ga);case"textInput":return e=t.data,e===Ga&&Ya?null:e;default:return null}}function Qh(e,t){if(ts)return e==="compositionend"||!vi&&Za(e,t)?(e=Va(),Ur=hi=an=null,ts=!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:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=oc(s)}}function cc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function uc(){for(var e=window,t=We();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=We(e.document)}return t}function ji(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 tf(e){var t=uc(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&cc(s.ownerDocument.documentElement,s)){if(r!==null&&ji(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=s.textContent.length,c=Math.min(r.start,i);r=r.end===void 0?c:Math.min(r.end,i),!e.extend&&c>r&&(i=r,r=c,c=i),i=ac(s,c);var h=ac(s,r);i&&h&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),c>r?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ns=null,Ni=null,Js=null,bi=!1;function dc(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bi||ns==null||ns!==We(r)||(r=ns,"selectionStart"in r&&ji(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}),Js&&Ks(Js,r)||(Js=r,r=Kr(Ni,"onSelect"),0os||(e.current=$i[os],$i[os]=null,os--)}function Re(e,t){os++,$i[os]=e.current,e.current=t}var hn={},nt=dn(hn),dt=dn(!1),Pn=hn;function as(e,t){var s=e.type.contextTypes;if(!s)return hn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},c;for(c in s)i[c]=t[c];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ht(e){return e=e.childContextTypes,e!=null}function Yr(){De(dt),De(nt)}function Sc(e,t,s){if(nt.current!==hn)throw Error(o(168));Re(nt,t),Re(dt,s)}function Cc(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(o(108,Ee(e)||"Unknown",i));return E({},s,r)}function Zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hn,Pn=nt.current,Re(nt,e),Re(dt,dt.current),!0}function Ec(e,t,s){var r=e.stateNode;if(!r)throw Error(o(169));s?(e=Cc(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,De(dt),De(nt),Re(nt,e)):De(dt),Re(dt,s)}var Kt=null,el=!1,Mi=!1;function Tc(e){Kt===null?Kt=[e]:Kt.push(e)}function mf(e){el=!0,Tc(e)}function fn(){if(!Mi&&Kt!==null){Mi=!0;var e=0,t=Te;try{var s=Kt;for(Te=1;e>=h,i-=h,Jt=1<<32-It(t)+i|s<ie?(Ze=le,le=null):Ze=le.sibling;var be=M(b,le,C[ie],B);if(be===null){le===null&&(le=Ze);break}e&&le&&be.alternate===null&&t(b,le),w=c(be,w,ie),re===null?te=be:re.sibling=be,re=be,le=Ze}if(ie===C.length)return s(b,le),Me&&Rn(b,ie),te;if(le===null){for(;ieie?(Ze=le,le=null):Ze=le.sibling;var Nn=M(b,le,be.value,B);if(Nn===null){le===null&&(le=Ze);break}e&&le&&Nn.alternate===null&&t(b,le),w=c(Nn,w,ie),re===null?te=Nn:re.sibling=Nn,re=Nn,le=Ze}if(be.done)return s(b,le),Me&&Rn(b,ie),te;if(le===null){for(;!be.done;ie++,be=C.next())be=z(b,be.value,B),be!==null&&(w=c(be,w,ie),re===null?te=be:re.sibling=be,re=be);return Me&&Rn(b,ie),te}for(le=r(b,le);!be.done;ie++,be=C.next())be=q(le,b,ie,be.value,B),be!==null&&(e&&be.alternate!==null&&le.delete(be.key===null?ie:be.key),w=c(be,w,ie),re===null?te=be:re.sibling=be,re=be);return e&&le.forEach(function(Kf){return t(b,Kf)}),Me&&Rn(b,ie),te}function Be(b,w,C,B){if(typeof C=="object"&&C!==null&&C.type===ge&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case U:e:{for(var te=C.key,re=w;re!==null;){if(re.key===te){if(te=C.type,te===ge){if(re.tag===7){s(b,re.sibling),w=i(re,C.props.children),w.return=b,b=w;break e}}else if(re.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===_e&&$c(te)===re.type){s(b,re.sibling),w=i(re,C.props),w.ref=tr(b,re,C),w.return=b,b=w;break e}s(b,re);break}else t(b,re);re=re.sibling}C.type===ge?(w=Un(C.props.children,b.mode,B,C.key),w.return=b,b=w):(B=El(C.type,C.key,C.props,null,b.mode,B),B.ref=tr(b,w,C),B.return=b,b=B)}return h(b);case Z:e:{for(re=C.key;w!==null;){if(w.key===re)if(w.tag===4&&w.stateNode.containerInfo===C.containerInfo&&w.stateNode.implementation===C.implementation){s(b,w.sibling),w=i(w,C.children||[]),w.return=b,b=w;break e}else{s(b,w);break}else t(b,w);w=w.sibling}w=Do(C,b.mode,B),w.return=b,b=w}return h(b);case _e:return re=C._init,Be(b,w,re(C._payload),B)}if(Ps(C))return G(b,w,C,B);if(V(C))return ee(b,w,C,B);rl(b,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,w!==null&&w.tag===6?(s(b,w.sibling),w=i(w,C),w.return=b,b=w):(s(b,w),w=Lo(C,b.mode,B),w.return=b,b=w),h(b)):s(b,w)}return Be}var hs=Mc(!0),Ac=Mc(!1),ll=dn(null),il=null,fs=null,Bi=null;function Hi(){Bi=fs=il=null}function Wi(e){var t=ll.current;De(ll),e._currentValue=t}function Vi(e,t,s){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===s)break;e=e.return}}function ms(e,t){il=e,Bi=fs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ft=!0),e.firstContext=null)}function St(e){var t=e._currentValue;if(Bi!==e)if(e={context:e,memoizedValue:t,next:null},fs===null){if(il===null)throw Error(o(308));fs=e,il.dependencies={lanes:0,firstContext:e}}else fs=fs.next=e;return t}var Ln=null;function Qi(e){Ln===null?Ln=[e]:Ln.push(e)}function zc(e,t,s,r){var i=t.interleaved;return i===null?(s.next=s,Qi(t)):(s.next=i.next,i.next=s),t.interleaved=s,Gt(e,r)}function Gt(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var mn=!1;function qi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oc(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 Yt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ne&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Gt(e,s)}return i=r.interleaved,i===null?(t.next=t,Qi(r)):(t.next=i.next,i.next=t),r.interleaved=t,Gt(e,s)}function ol(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}function Uc(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var i=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};c===null?i=c=h:c=c.next=h,s=s.next}while(s!==null);c===null?i=c=t:c=c.next=t}else i=c=t;s={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:c,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function al(e,t,s,r){var i=e.updateQueue;mn=!1;var c=i.firstBaseUpdate,h=i.lastBaseUpdate,x=i.shared.pending;if(x!==null){i.shared.pending=null;var v=x,T=v.next;v.next=null,h===null?c=T:h.next=T,h=v;var A=e.alternate;A!==null&&(A=A.updateQueue,x=A.lastBaseUpdate,x!==h&&(x===null?A.firstBaseUpdate=T:x.next=T,A.lastBaseUpdate=v))}if(c!==null){var z=i.baseState;h=0,A=T=v=null,x=c;do{var M=x.lane,q=x.eventTime;if((r&M)===M){A!==null&&(A=A.next={eventTime:q,lane:0,tag:x.tag,payload:x.payload,callback:x.callback,next:null});e:{var G=e,ee=x;switch(M=t,q=s,ee.tag){case 1:if(G=ee.payload,typeof G=="function"){z=G.call(q,z,M);break e}z=G;break e;case 3:G.flags=G.flags&-65537|128;case 0:if(G=ee.payload,M=typeof G=="function"?G.call(q,z,M):G,M==null)break e;z=E({},z,M);break e;case 2:mn=!0}}x.callback!==null&&x.lane!==0&&(e.flags|=64,M=i.effects,M===null?i.effects=[x]:M.push(x))}else q={eventTime:q,lane:M,tag:x.tag,payload:x.payload,callback:x.callback,next:null},A===null?(T=A=q,v=z):A=A.next=q,h|=M;if(x=x.next,x===null){if(x=i.shared.pending,x===null)break;M=x,x=M.next,M.next=null,i.lastBaseUpdate=M,i.shared.pending=null}}while(!0);if(A===null&&(v=z),i.baseState=v,i.firstBaseUpdate=T,i.lastBaseUpdate=A,t=i.shared.interleaved,t!==null){i=t;do h|=i.lane,i=i.next;while(i!==t)}else c===null&&(i.shared.lanes=0);Mn|=h,e.lanes=h,e.memoizedState=z}}function Fc(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;ts?s:4,e(!0);var r=Yi.transition;Yi.transition={};try{e(!1),t()}finally{Te=s,Yi.transition=r}}function iu(){return Ct().memoizedState}function vf(e,t,s){var r=yn(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},ou(e))au(t,s);else if(s=zc(e,t,s,r),s!==null){var i=ct();At(s,e,r,i),cu(s,t,r)}}function yf(e,t,s){var r=yn(e),i={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(ou(e))au(t,i);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,x=c(h,s);if(i.hasEagerState=!0,i.eagerState=x,Rt(x,h)){var v=t.interleaved;v===null?(i.next=i,Qi(t)):(i.next=v.next,v.next=i),t.interleaved=i;return}}catch{}finally{}s=zc(e,t,i,r),s!==null&&(i=ct(),At(s,e,r,i),cu(s,t,r))}}function ou(e){var t=e.alternate;return e===ze||t!==null&&t===ze}function au(e,t){lr=dl=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function cu(e,t,s){if((s&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,oi(e,s)}}var ml={readContext:St,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useInsertionEffect:st,useLayoutEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useMutableSource:st,useSyncExternalStore:st,useId:st,unstable_isNewReconciler:!1},wf={readContext:St,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Yc,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,hl(4194308,4,tu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return hl(4,2,e,t)},useMemo:function(e,t){var s=Ht();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=Ht();return t=s!==void 0?s(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=vf.bind(null,ze,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:Xc,useDebugValue:lo,useDeferredValue:function(e){return Ht().memoizedState=e},useTransition:function(){var e=Xc(!1),t=e[0];return e=gf.bind(null,e[1]),Ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=ze,i=Ht();if(Me){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),Ye===null)throw Error(o(349));($n&30)!==0||Vc(r,t,s)}i.memoizedState=s;var c={value:s,getSnapshot:t};return i.queue=c,Yc(qc.bind(null,r,c,e),[e]),r.flags|=2048,ar(9,Qc.bind(null,r,c,s,t),void 0,null),s},useId:function(){var e=Ht(),t=Ye.identifierPrefix;if(Me){var s=Xt,r=Jt;s=(r&~(1<<32-It(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=h.createElement(s,{is:r.is}):(e=h.createElement(s),s==="select"&&(h=e,r.multiple?h.multiple=!0:r.size&&(h.size=r.size))):e=h.createElementNS(e,s),e[Ft]=t,e[Zs]=r,Tu(e,t,!1,!1),t.stateNode=e;e:{switch(h=Gl(s,r),s){case"dialog":Le("cancel",e),Le("close",e),i=r;break;case"iframe":case"object":case"embed":Le("load",e),i=r;break;case"video":case"audio":for(i=0;iys&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304)}else{if(!r)if(e=cl(h),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),cr(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!Me)return rt(t),null}else 2*Fe()-c.renderingStartTime>ys&&s!==1073741824&&(t.flags|=128,r=!0,cr(c,!1),t.lanes=4194304);c.isBackwards?(h.sibling=t.child,t.child=h):(s=c.last,s!==null?s.sibling=h:t.child=h,c.last=h)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Fe(),t.sibling=null,s=Ae.current,Re(Ae,r?s&1|2:s&1),t):(rt(t),null);case 22:case 23:return Po(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(jt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Ef(e,t){switch(zi(t),t.tag){case 1:return ht(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ps(),De(dt),De(nt),Gi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(De(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ds()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Ae),null;case 4:return ps(),null;case 10:return Wi(t.type._context),null;case 22:case 23:return Po(),null;case 24:return null;default:return null}}var vl=!1,lt=!1,Tf=typeof WeakSet=="function"?WeakSet:Set,X=null;function gs(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Ue(e,t,r)}else s.current=null}function vo(e,t,s){try{s()}catch(r){Ue(e,t,r)}}var Ru=!1;function Pf(e,t){if(Ti=zr,e=uc(),ji(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var i=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{s.nodeType,c.nodeType}catch{s=null;break e}var h=0,x=-1,v=-1,T=0,A=0,z=e,M=null;t:for(;;){for(var q;z!==s||i!==0&&z.nodeType!==3||(x=h+i),z!==c||r!==0&&z.nodeType!==3||(v=h+r),z.nodeType===3&&(h+=z.nodeValue.length),(q=z.firstChild)!==null;)M=z,z=q;for(;;){if(z===e)break t;if(M===s&&++T===i&&(x=h),M===c&&++A===r&&(v=h),(q=z.nextSibling)!==null)break;z=M,M=z.parentNode}z=q}s=x===-1||v===-1?null:{start:x,end:v}}else s=null}s=s||{start:0,end:0}}else s=null;for(Pi={focusedElem:e,selectionRange:s},zr=!1,X=t;X!==null;)if(t=X,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var G=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(G!==null){var ee=G.memoizedProps,Be=G.memoizedState,b=t.stateNode,w=b.getSnapshotBeforeUpdate(t.elementType===t.type?ee:Dt(t.type,ee),Be);b.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var C=t.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(B){Ue(t,t.return,B)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return G=Ru,Ru=!1,G}function ur(e,t,s){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var c=i.destroy;i.destroy=void 0,c!==void 0&&vo(t,s,c)}i=i.next}while(i!==r)}}function yl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function yo(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function Lu(e){var t=e.alternate;t!==null&&(e.alternate=null,Lu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ft],delete t[Zs],delete t[Di],delete t[hf],delete t[ff])),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 Du(e){return e.tag===5||e.tag===3||e.tag===4}function $u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Du(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 wo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Xr));else if(r!==4&&(e=e.child,e!==null))for(wo(e,t,s),e=e.sibling;e!==null;)wo(e,t,s),e=e.sibling}function jo(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(jo(e,t,s),e=e.sibling;e!==null;)jo(e,t,s),e=e.sibling}var et=null,$t=!1;function xn(e,t,s){for(s=s.child;s!==null;)Mu(e,t,s),s=s.sibling}function Mu(e,t,s){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Rr,s)}catch{}switch(s.tag){case 5:lt||gs(s,t);case 6:var r=et,i=$t;et=null,xn(e,t,s),et=r,$t=i,et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):et.removeChild(s.stateNode));break;case 18:et!==null&&($t?(e=et,s=s.stateNode,e.nodeType===8?Li(e.parentNode,s):e.nodeType===1&&Li(e,s),Bs(e)):Li(et,s.stateNode));break;case 4:r=et,i=$t,et=s.stateNode.containerInfo,$t=!0,xn(e,t,s),et=r,$t=i;break;case 0:case 11:case 14:case 15:if(!lt&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var c=i,h=c.destroy;c=c.tag,h!==void 0&&((c&2)!==0||(c&4)!==0)&&vo(s,t,h),i=i.next}while(i!==r)}xn(e,t,s);break;case 1:if(!lt&&(gs(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(x){Ue(s,t,x)}xn(e,t,s);break;case 21:xn(e,t,s);break;case 22:s.mode&1?(lt=(r=lt)||s.memoizedState!==null,xn(e,t,s),lt=r):xn(e,t,s);break;default:xn(e,t,s)}}function Au(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Tf),t.forEach(function(r){var i=Of.bind(null,e,r);s.has(r)||(s.add(r),r.then(i,i))})}}function Mt(e,t){var s=t.deletions;if(s!==null)for(var r=0;ri&&(i=h),r&=~c}if(r=i,r=Fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Rf(r/1960))-r,10e?16:e,vn===null)var r=!1;else{if(e=vn,vn=null,_l=0,(Ne&6)!==0)throw Error(o(331));var i=Ne;for(Ne|=4,X=e.current;X!==null;){var c=X,h=c.child;if((X.flags&16)!==0){var x=c.deletions;if(x!==null){for(var v=0;vFe()-_o?zn(e,0):bo|=s),pt(e,t)}function Xu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Dr,Dr<<=1,(Dr&130023424)===0&&(Dr=4194304)));var s=ct();e=Gt(e,t),e!==null&&(As(e,t,s),pt(e,s))}function zf(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Xu(e,s)}function Of(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(s=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}r!==null&&r.delete(t),Xu(e,s)}var Gu;Gu=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||dt.current)ft=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return ft=!1,Sf(e,t,s);ft=(e.flags&131072)!==0}else ft=!1,Me&&(t.flags&1048576)!==0&&Pc(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gl(e,t),e=t.pendingProps;var i=as(t,nt.current);ms(t,s),i=eo(null,t,r,e,i,s);var c=to();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(r)?(c=!0,Zr(t)):c=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,qi(t),i.updater=pl,t.stateNode=i,i._reactInternals=t,oo(t,r,e,s),t=ho(null,t,r,!0,c,s)):(t.tag=0,Me&&c&&Ai(t),at(null,t,i,s),t=t.child),t;case 16:r=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Ff(r),e=Dt(r,e),i){case 0:t=uo(null,t,r,e,s);break e;case 1:t=bu(null,t,r,e,s);break e;case 11:t=vu(null,t,r,e,s);break e;case 14:t=yu(null,t,r,Dt(r.type,e),s);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),uo(e,t,r,i,s);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),bu(e,t,r,i,s);case 3:e:{if(_u(t),e===null)throw Error(o(387));r=t.pendingProps,c=t.memoizedState,i=c.element,Oc(e,t),al(t,r,null,s);var h=t.memoizedState;if(r=h.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){i=xs(Error(o(423)),t),t=ku(e,t,r,s,i);break e}else if(r!==i){i=xs(Error(o(424)),t),t=ku(e,t,r,s,i);break e}else for(wt=un(t.stateNode.containerInfo.firstChild),yt=t,Me=!0,Lt=null,s=Ac(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ds(),r===i){t=Zt(e,t,s);break e}at(e,t,r,s)}t=t.child}return t;case 5:return Bc(t),e===null&&Ui(t),r=t.type,i=t.pendingProps,c=e!==null?e.memoizedProps:null,h=i.children,Ii(r,i)?h=null:c!==null&&Ii(r,c)&&(t.flags|=32),Nu(e,t),at(e,t,h,s),t.child;case 6:return e===null&&Ui(t),null;case 13:return Su(e,t,s);case 4:return Ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hs(t,null,r,s):at(e,t,r,s),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),vu(e,t,r,i,s);case 7:return at(e,t,t.pendingProps,s),t.child;case 8:return at(e,t,t.pendingProps.children,s),t.child;case 12:return at(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,c=t.memoizedProps,h=i.value,Re(ll,r._currentValue),r._currentValue=h,c!==null)if(Rt(c.value,h)){if(c.children===i.children&&!dt.current){t=Zt(e,t,s);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var x=c.dependencies;if(x!==null){h=c.child;for(var v=x.firstContext;v!==null;){if(v.context===r){if(c.tag===1){v=Yt(-1,s&-s),v.tag=2;var T=c.updateQueue;if(T!==null){T=T.shared;var A=T.pending;A===null?v.next=v:(v.next=A.next,A.next=v),T.pending=v}}c.lanes|=s,v=c.alternate,v!==null&&(v.lanes|=s),Vi(c.return,s,t),x.lanes|=s;break}v=v.next}}else if(c.tag===10)h=c.type===t.type?null:c.child;else if(c.tag===18){if(h=c.return,h===null)throw Error(o(341));h.lanes|=s,x=h.alternate,x!==null&&(x.lanes|=s),Vi(h,s,t),h=c.sibling}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===t){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}at(e,t,i.children,s),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ms(t,s),i=St(i),r=r(i),t.flags|=1,at(e,t,r,s),t.child;case 14:return r=t.type,i=Dt(r,t.pendingProps),i=Dt(r.type,i),yu(e,t,r,i,s);case 15:return wu(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),gl(e,t),t.tag=1,ht(r)?(e=!0,Zr(t)):e=!1,ms(t,s),du(t,r,i),oo(t,r,i,s),ho(null,t,r,!0,e,s);case 19:return Eu(e,t,s);case 22:return ju(e,t,s)}throw Error(o(156,t.tag))};function Yu(e,t){return Ia(e,t)}function Uf(e,t,s,r){this.tag=e,this.key=s,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 Tt(e,t,s,r){return new Uf(e,t,s,r)}function Ro(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ff(e){if(typeof e=="function")return Ro(e)?1:0;if(e!=null){if(e=e.$$typeof,e===je)return 11;if(e===Pe)return 14}return 2}function jn(e,t){var s=e.alternate;return s===null?(s=Tt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function El(e,t,s,r,i,c){var h=2;if(r=e,typeof e=="function")Ro(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case ge:return Un(s.children,i,c,t);case xe:h=8,i|=8;break;case R:return e=Tt(12,s,t,i|2),e.elementType=R,e.lanes=c,e;case O:return e=Tt(13,s,t,i),e.elementType=O,e.lanes=c,e;case ve:return e=Tt(19,s,t,i),e.elementType=ve,e.lanes=c,e;case W:return Tl(s,i,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case se:h=10;break e;case Ce:h=9;break e;case je:h=11;break e;case Pe:h=14;break e;case _e:h=16,r=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Tt(h,s,t,i),t.elementType=e,t.type=r,t.lanes=c,t}function Un(e,t,s,r){return e=Tt(7,e,r,t),e.lanes=s,e}function Tl(e,t,s,r){return e=Tt(22,e,r,t),e.elementType=W,e.lanes=s,e.stateNode={isHidden:!1},e}function Lo(e,t,s){return e=Tt(6,e,null,t),e.lanes=s,e}function Do(e,t,s){return t=Tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bf(e,t,s,r,i){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=ii(0),this.expirationTimes=ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ii(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $o(e,t,s,r,i,c,h,x,v){return e=new Bf(e,t,s,x,v),t===1?(t=1,c===!0&&(t|=8)):t=0,c=Tt(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qi(c),e}function Hf(e,t,s){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Fo.exports=rm(),Fo.exports}var hd;function lm(){if(hd)return Ml;hd=1;var a=Pd();return Ml.createRoot=a.createRoot,Ml.hydrateRoot=a.hydrateRoot,Ml}var im=lm();const om=Td(im);Pd();/** * @remix-run/router v1.23.4 * * 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 */function vr(){return vr=Object.assign?Object.assign.bind():function(a){for(var l=1;l"u")throw new Error(l)}function Id(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function cm(){return Math.random().toString(36).substr(2,8)}function md(a,l){return{usr:a.state,key:a.key,idx:l}}function qo(a,l,o,u){return o===void 0&&(o=null),vr({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof l=="string"?Es(l):l,{state:o,key:l&&l.key||u||cm()})}function zl(a){let{pathname:l="/",search:o="",hash:u=""}=a;return o&&o!=="?"&&(l+=o.charAt(0)==="?"?o:"?"+o),u&&u!=="#"&&(l+=u.charAt(0)==="#"?u:"#"+u),l}function Es(a){let l={};if(a){let o=a.indexOf("#");o>=0&&(l.hash=a.substr(o),a=a.substr(0,o));let u=a.indexOf("?");u>=0&&(l.search=a.substr(u),a=a.substr(0,u)),a&&(l.pathname=a)}return l}function um(a,l,o,u){u===void 0&&(u={});let{window:d=document.defaultView,v5Compat:f=!1}=u,m=d.history,y=bn.Pop,p=null,j=S();j==null&&(j=0,m.replaceState(vr({},m.state,{idx:j}),""));function S(){return(m.state||{idx:null}).idx}function k(){y=bn.Pop;let P=S(),J=P==null?null:P-j;j=P,p&&p({action:y,location:H.location,delta:J})}function $(P,J){y=bn.Push;let K=qo(H.location,P,J);j=S()+1;let Y=md(K,j),ne=H.createHref(K);try{m.pushState(Y,"",ne)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;d.location.assign(ne)}f&&p&&p({action:y,location:H.location,delta:1})}function D(P,J){y=bn.Replace;let K=qo(H.location,P,J);j=S();let Y=md(K,j),ne=H.createHref(K);m.replaceState(Y,"",ne),f&&p&&p({action:y,location:H.location,delta:0})}function Q(P){let J=d.location.origin!=="null"?d.location.origin:d.location.href,K=typeof P=="string"?P:zl(P);return K=K.replace(/ $/,"%20"),He(J,"No window.location.(origin|href) available to create URL for href: "+K),new URL(K,J)}let H={get action(){return y},get location(){return a(d,m)},listen(P){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(fd,k),p=P,()=>{d.removeEventListener(fd,k),p=null}},createHref(P){return l(d,P)},createURL:Q,encodeLocation(P){let J=Q(P);return{pathname:J.pathname,search:J.search,hash:J.hash}},push:$,replace:D,go(P){return m.go(P)}};return H}var pd;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(pd||(pd={}));function dm(a,l,o){return o===void 0&&(o="/"),hm(a,l,o)}function hm(a,l,o,u){let d=typeof l=="string"?Es(l):l,f=sa(d.pathname||"/",o);if(f==null)return null;let m=Rd(a);fm(m);let y=null,p=km(f);for(let j=0;y==null&&j{let p={relativePath:y===void 0?f.path||"":y,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};p.relativePath.startsWith("/")&&(He(p.relativePath.startsWith(u),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(u.length));let j=_n([u,p.relativePath]),S=o.concat(p);f.children&&f.children.length>0&&(He(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+j+'".')),Rd(f.children,l,S,j)),!(f.path==null&&!f.index)&&l.push({path:j,score:wm(j,f.index),routesMeta:S})};return a.forEach((f,m)=>{var y;if(f.path===""||!((y=f.path)!=null&&y.includes("?")))d(f,m);else for(let p of Ld(f.path))d(f,m,p)}),l}function Ld(a){let l=a.split("/");if(l.length===0)return[];let[o,...u]=l,d=o.endsWith("?"),f=o.replace(/\?$/,"");if(u.length===0)return d?[f,""]:[f];let m=Ld(u.join("/")),y=[];return y.push(...m.map(p=>p===""?f:[f,p].join("/"))),d&&y.push(...m),y.map(p=>a.startsWith("/")&&p===""?"/":p)}function fm(a){a.sort((l,o)=>l.score!==o.score?o.score-l.score:jm(l.routesMeta.map(u=>u.childrenIndex),o.routesMeta.map(u=>u.childrenIndex)))}const mm=/^:[\w-]+$/,pm=3,xm=2,gm=1,vm=10,ym=-2,xd=a=>a==="*";function wm(a,l){let o=a.split("/"),u=o.length;return o.some(xd)&&(u+=ym),l&&(u+=xm),o.filter(d=>!xd(d)).reduce((d,f)=>d+(mm.test(f)?pm:f===""?gm:vm),u)}function jm(a,l){return a.length===l.length&&a.slice(0,-1).every((u,d)=>u===l[d])?a[a.length-1]-l[l.length-1]:0}function Nm(a,l,o){let{routesMeta:u}=a,d={},f="/",m=[];for(let y=0;y{let{paramName:$,isOptional:D}=S;if($==="*"){let H=y[k]||"";m=f.slice(0,f.length-H.length).replace(/(.)\/+$/,"$1")}const Q=y[k];return D&&!Q?j[$]=void 0:j[$]=(Q||"").replace(/%2F/g,"/"),j},{}),pathname:f,pathnameBase:m,pattern:a}}function _m(a,l,o){l===void 0&&(l=!1),o===void 0&&(o=!0),Id(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let u=[],d="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,y,p)=>(u.push({paramName:y,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(u.push({paramName:"*"}),d+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?d+="\\/*$":a!==""&&a!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,l?void 0:"i"),u]}function km(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Id(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+l+").")),a}}function sa(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,u=a.charAt(o);return u&&u!=="/"?null:a.slice(o)||"/"}function Sm(a,l){l===void 0&&(l="/");let{pathname:o,search:u="",hash:d=""}=typeof a=="string"?Es(a):a,f;return o?(o=Dd(o),o.startsWith("/")?f=gd(o.substring(1),"/"):f=gd(o,l)):f=l,{pathname:f,search:Tm(u),hash:Pm(d)}}function gd(a,l){let o=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(d=>{d===".."?o.length>1&&o.pop():d!=="."&&o.push(d)}),o.length>1?o.join("/"):"/"}function Wo(a,l,o,u){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+o+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Cm(a){return a.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function ra(a,l){let o=Cm(a);return l?o.map((u,d)=>d===o.length-1?u.pathname:u.pathnameBase):o.map(u=>u.pathnameBase)}function la(a,l,o,u){u===void 0&&(u=!1);let d;typeof a=="string"?d=Es(a):(d=vr({},a),He(!d.pathname||!d.pathname.includes("?"),Wo("?","pathname","search",d)),He(!d.pathname||!d.pathname.includes("#"),Wo("#","pathname","hash",d)),He(!d.search||!d.search.includes("#"),Wo("#","search","hash",d)));let f=a===""||d.pathname==="",m=f?"/":d.pathname,y;if(m==null)y=o;else{let k=l.length-1;if(!u&&m.startsWith("..")){let $=m.split("/");for(;$[0]==="..";)$.shift(),k-=1;d.pathname=$.join("/")}y=k>=0?l[k]:"/"}let p=Sm(d,y),j=m&&m!=="/"&&m.endsWith("/"),S=(f||m===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(j||S)&&(p.pathname+="/"),p}const Dd=a=>a.replace(/\/\/+/g,"/"),_n=a=>Dd(a.join("/")),Em=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Tm=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Pm=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Im(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const $d=["post","put","patch","delete"];new Set($d);const Rm=["get",...$d];new Set(Rm);/** * React Router v6.30.6 * * 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 */function yr(){return yr=Object.assign?Object.assign.bind():function(a){for(var l=1;l{y.current=!0}),g.useCallback(function(j,S){if(S===void 0&&(S={}),!y.current)return;if(typeof j=="number"){u.go(j);return}let k=la(j,JSON.parse(m),f,S.relative==="path");a==null&&l!=="/"&&(k.pathname=k.pathname==="/"?l:_n([l,k.pathname])),(S.replace?u.replace:u.push)(k,S.state,S)},[l,u,m,f,a])}const Mm=g.createContext(null);function Am(a){let l=g.useContext(tn).outlet;return l&&g.createElement(Mm.Provider,{value:a},l)}function zd(a,l){let{relative:o}=l===void 0?{}:l,{future:u}=g.useContext(Cn),{matches:d}=g.useContext(tn),{pathname:f}=qn(),m=JSON.stringify(ra(d,u.v7_relativeSplatPath));return g.useMemo(()=>la(a,JSON.parse(m),f,o==="path"),[a,m,f,o])}function zm(a,l){return Om(a,l)}function Om(a,l,o,u){Ts()||He(!1);let{navigator:d}=g.useContext(Cn),{matches:f}=g.useContext(tn),m=f[f.length-1],y=m?m.params:{};m&&m.pathname;let p=m?m.pathnameBase:"/";m&&m.route;let j=qn(),S;if(l){var k;let P=typeof l=="string"?Es(l):l;p==="/"||(k=P.pathname)!=null&&k.startsWith(p)||He(!1),S=P}else S=j;let $=S.pathname||"/",D=$;if(p!=="/"){let P=p.replace(/^\//,"").split("/");D="/"+$.replace(/^\//,"").split("/").slice(P.length).join("/")}let Q=dm(a,{pathname:D}),H=Wm(Q&&Q.map(P=>Object.assign({},P,{params:Object.assign({},y,P.params),pathname:_n([p,d.encodeLocation?d.encodeLocation(P.pathname).pathname:P.pathname]),pathnameBase:P.pathnameBase==="/"?p:_n([p,d.encodeLocation?d.encodeLocation(P.pathnameBase).pathname:P.pathnameBase])})),f,o,u);return l&&H?g.createElement(Hl.Provider,{value:{location:yr({pathname:"/",search:"",hash:"",state:null,key:"default"},S),navigationType:bn.Pop}},H):H}function Um(){let a=Km(),l=Im(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),o=a instanceof Error?a.stack:null,d={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},l),o?g.createElement("pre",{style:d},o):null,null)}const Fm=g.createElement(Um,null);class Bm extends g.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,o){return o.location!==l.location||o.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:o.error,location:o.location,revalidation:l.revalidation||o.revalidation}}componentDidCatch(l,o){console.error("React Router caught the following error during render",l,o)}render(){return this.state.error!==void 0?g.createElement(tn.Provider,{value:this.props.routeContext},g.createElement(Md.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Hm(a){let{routeContext:l,match:o,children:u}=a,d=g.useContext(ia);return d&&d.static&&d.staticContext&&(o.route.errorElement||o.route.ErrorBoundary)&&(d.staticContext._deepestRenderedBoundaryId=o.route.id),g.createElement(tn.Provider,{value:l},u)}function Wm(a,l,o,u){var d;if(l===void 0&&(l=[]),o===void 0&&(o=null),u===void 0&&(u=null),a==null){var f;if(!o)return null;if(o.errors)a=o.matches;else if((f=u)!=null&&f.v7_partialHydration&&l.length===0&&!o.initialized&&o.matches.length>0)a=o.matches;else return null}let m=a,y=(d=o)==null?void 0:d.errors;if(y!=null){let S=m.findIndex(k=>k.route.id&&(y==null?void 0:y[k.route.id])!==void 0);S>=0||He(!1),m=m.slice(0,Math.min(m.length,S+1))}let p=!1,j=-1;if(o&&u&&u.v7_partialHydration)for(let S=0;S=0?m=m.slice(0,j+1):m=[m[0]];break}}}return m.reduceRight((S,k,$)=>{let D,Q=!1,H=null,P=null;o&&(D=y&&k.route.id?y[k.route.id]:void 0,H=k.route.errorElement||Fm,p&&(j<0&&$===0?(Xm("route-fallback"),Q=!0,P=null):j===$&&(Q=!0,P=k.route.hydrateFallbackElement||null)));let J=l.concat(m.slice(0,$+1)),K=()=>{let Y;return D?Y=H:Q?Y=P:k.route.Component?Y=g.createElement(k.route.Component,null):k.route.element?Y=k.route.element:Y=S,g.createElement(Hm,{match:k,routeContext:{outlet:S,matches:J,isDataRoute:o!=null},children:Y})};return o&&(k.route.ErrorBoundary||k.route.errorElement||$===0)?g.createElement(Bm,{location:o.location,revalidation:o.revalidation,component:H,error:D,children:K(),routeContext:{outlet:null,matches:J,isDataRoute:!0}}):K()},null)}var Od=(function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a})(Od||{}),Ud=(function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a})(Ud||{});function Vm(a){let l=g.useContext(ia);return l||He(!1),l}function Qm(a){let l=g.useContext(Lm);return l||He(!1),l}function qm(a){let l=g.useContext(tn);return l||He(!1),l}function Fd(a){let l=qm(),o=l.matches[l.matches.length-1];return o.route.id||He(!1),o.route.id}function Km(){var a;let l=g.useContext(Md),o=Qm(),u=Fd();return l!==void 0?l:(a=o.errors)==null?void 0:a[u]}function Jm(){let{router:a}=Vm(Od.UseNavigateStable),l=Fd(Ud.UseNavigateStable),o=g.useRef(!1);return Ad(()=>{o.current=!0}),g.useCallback(function(d,f){f===void 0&&(f={}),o.current&&(typeof d=="number"?a.navigate(d):a.navigate(d,yr({fromRouteId:l},f)))},[a,l])}const vd={};function Xm(a,l,o){vd[a]||(vd[a]=!0)}function Gm(a,l){a==null||a.v7_startTransition,a==null||a.v7_relativeSplatPath}function Vt(a){let{to:l,replace:o,state:u,relative:d}=a;Ts()||He(!1);let{future:f,static:m}=g.useContext(Cn),{matches:y}=g.useContext(tn),{pathname:p}=qn(),j=Wl(),S=la(l,ra(y,f.v7_relativeSplatPath),p,d==="path"),k=JSON.stringify(S);return g.useEffect(()=>j(JSON.parse(k),{replace:o,state:u,relative:d}),[j,k,d,o,u]),null}function Bd(a){return Am(a.context)}function Qe(a){He(!1)}function Ym(a){let{basename:l="/",children:o=null,location:u,navigationType:d=bn.Pop,navigator:f,static:m=!1,future:y}=a;Ts()&&He(!1);let p=l.replace(/^\/*/,"/"),j=g.useMemo(()=>({basename:p,navigator:f,static:m,future:yr({v7_relativeSplatPath:!1},y)}),[p,y,f,m]);typeof u=="string"&&(u=Es(u));let{pathname:S="/",search:k="",hash:$="",state:D=null,key:Q="default"}=u,H=g.useMemo(()=>{let P=sa(S,p);return P==null?null:{location:{pathname:P,search:k,hash:$,state:D,key:Q},navigationType:d}},[p,S,k,$,D,Q,d]);return H==null?null:g.createElement(Cn.Provider,{value:j},g.createElement(Hl.Provider,{children:o,value:H}))}function Zm(a){let{children:l,location:o}=a;return zm(Ko(l),o)}new Promise(()=>{});function Ko(a,l){l===void 0&&(l=[]);let o=[];return g.Children.forEach(a,(u,d)=>{if(!g.isValidElement(u))return;let f=[...l,d];if(u.type===g.Fragment){o.push.apply(o,Ko(u.props.children,f));return}u.type!==Qe&&He(!1),!u.props.index||!u.props.children||He(!1);let m={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(m.children=Ko(u.props.children,f)),o.push(m)}),o}/** * React Router DOM v6.30.6 * * 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 */function Jo(){return Jo=Object.assign?Object.assign.bind():function(a){for(var l=1;l{let u=a[o];return l.concat(Array.isArray(u)?u.map(d=>[o,d]):[[o,u]])},[]))}function sp(a,l){let o=Xo(a);return l&&l.forEach((u,d)=>{o.has(d)||l.getAll(d).forEach(f=>{o.append(d,f)})}),o}const rp=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],lp="6";try{window.__reactRouterVersion=lp}catch{}const ip="startTransition",yd=tm[ip];function op(a){let{basename:l,children:o,future:u,window:d}=a,f=g.useRef();f.current==null&&(f.current=am({window:d,v5Compat:!0}));let m=f.current,[y,p]=g.useState({action:m.action,location:m.location}),{v7_startTransition:j}=u||{},S=g.useCallback(k=>{j&&yd?yd(()=>p(k)):p(k)},[p,j]);return g.useLayoutEffect(()=>m.listen(S),[m,S]),g.useEffect(()=>Gm(u),[u]),g.createElement(Ym,{basename:l,children:o,location:y.location,navigationType:y.action,navigator:m,future:u})}const ap=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ye=g.forwardRef(function(l,o){let{onClick:u,relative:d,reloadDocument:f,replace:m,state:y,target:p,to:j,preventScrollReset:S,viewTransition:k}=l,$=ep(l,rp),{basename:D}=g.useContext(Cn),Q,H=!1;if(typeof j=="string"&&cp.test(j)&&(Q=j,ap))try{let Y=new URL(window.location.href),ne=j.startsWith("//")?new URL(Y.protocol+j):new URL(j),U=sa(ne.pathname,D);ne.origin===Y.origin&&U!=null?j=U+ne.search+ne.hash:H=!0}catch{}let P=Dm(j,{relative:d}),J=up(j,{replace:m,state:y,target:p,preventScrollReset:S,relative:d,viewTransition:k});function K(Y){u&&u(Y),Y.defaultPrevented||J(Y)}return g.createElement("a",Jo({},$,{href:Q||P,onClick:H||f?u:K,ref:o,target:p}))});var wd;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(wd||(wd={}));var jd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(jd||(jd={}));function up(a,l){let{target:o,replace:u,state:d,preventScrollReset:f,relative:m,viewTransition:y}=l===void 0?{}:l,p=Wl(),j=qn(),S=zd(a,{relative:m});return g.useCallback(k=>{if(np(k,o)){k.preventDefault();let $=u!==void 0?u:zl(j)===zl(S);p(a,{replace:$,state:d,preventScrollReset:f,relative:m,viewTransition:y})}},[j,p,S,u,d,o,a,f,m,y])}function dp(a){let l=g.useRef(Xo(a)),o=g.useRef(!1),u=qn(),d=g.useMemo(()=>sp(u.search,o.current?null:l.current),[u.search]),f=Wl(),m=g.useCallback((y,p)=>{const j=Xo(typeof y=="function"?y(d):y);o.current=!0,f("?"+j,p)},[f,d]);return[d,m]}class hp{constructor(){xt(this,"listeners",new Set);xt(this,"isTerminated",!1)}subscribe(l){return this.listeners.add(l),()=>this.listeners.delete(l)}notifySessionExpired(l="登录已过期,请重新登录"){this.isTerminated||(this.isTerminated=!0,this.listeners.forEach(o=>{try{o(l)}catch(u){console.error("Error in session expired listener",u)}}))}reset(){this.isTerminated=!1}}const Ns=new hp,Hd="/api";function Ss(){return localStorage.getItem("classnotify_token")}function fp(a){localStorage.setItem("classnotify_token",a)}function xr(){localStorage.removeItem("classnotify_token"),localStorage.removeItem("classnotify_user")}async function pe(a,l={}){const o=Ss(),u={"Content-Type":"application/json",...l.headers};o&&(u.Authorization=`Bearer ${o}`);const d=await fetch(`${Hd}${a}`,{...l,headers:u});if(d.status===401)throw xr(),Ns.notifySessionExpired("未授权或登录已过期,请重新登录"),new Error("未授权或登录已过期,请重新登录");if(!d.ok){let f=`请求失败 (${d.status})`;try{const m=await d.json();f=m.message||m.errorMessage||f}catch{}throw new Error(f)}return d.json()}const oe={login:(a,l)=>pe("/auth/login",{method:"POST",body:JSON.stringify({username:a,password:l})}),getMe:()=>pe("/auth/me"),getAdminMetrics:()=>pe("/admin/metrics"),getTenants:()=>pe("/admin/tenants"),getAllDevices:()=>pe("/admin/devices"),sendDeviceCommand:(a,l,o)=>pe(`/admin/devices/${a}/command`,{method:"POST",body:JSON.stringify({command:l,parameters:o})}),getAdminActivationCodes:()=>pe("/admin/activation-codes"),getAdminClasses:a=>pe(`/admin/classes?tenantId=${encodeURIComponent(a)}`),generateAdminCode:(a,l)=>pe(`/admin/activation-codes?tenantId=${encodeURIComponent(a)}&classId=${encodeURIComponent(l)}`,{method:"POST"}),getAdminNotifications:(a=50)=>pe(`/admin/notifications?limit=${a}`),createTenant:a=>pe("/admin/tenants",{method:"POST",body:JSON.stringify(a)}),updateTenant:(a,l)=>pe(`/admin/tenants/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),getUsers:(a,l)=>{const o=new URLSearchParams;a&&o.append("tenantId",a),l&&o.append("role",l);const u=o.toString();return pe(`/admin/users${u?`?${u}`:""}`)},createUser:a=>pe("/admin/users",{method:"POST",body:JSON.stringify(a)}),resetPassword:(a,l)=>pe(`/admin/users/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setUserLock:(a,l)=>pe(`/admin/users/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),deleteUser:a=>pe(`/admin/users/${encodeURIComponent(a)}`,{method:"DELETE"}),updateDevice:(a,l)=>pe(`/admin/devices/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),decommissionDevice:a=>pe(`/admin/devices/${encodeURIComponent(a)}/decommission`,{method:"POST"}),deleteActivationCode:a=>pe(`/admin/activation-codes/${encodeURIComponent(a)}`,{method:"DELETE"}),sendEmergencyBroadcast:a=>pe("/admin/broadcasts",{method:"POST",body:JSON.stringify(a)}),getBroadcastReceiptSummary:a=>pe(`/admin/broadcasts/${encodeURIComponent(a)}/receipt-summary`),getSystemHealth:()=>pe("/admin/system/health"),getAuditLogs:(a=100)=>pe(`/admin/audit-logs?limit=${a}`),getSchoolOverview:()=>pe("/school-admin/overview"),getSchoolClasses:()=>pe("/school-admin/classes"),createSchoolClass:a=>pe("/school-admin/classes",{method:"POST",body:JSON.stringify(a)}),getSchoolTeachers:()=>pe("/school-admin/teachers"),createSchoolTeacher:a=>pe("/school-admin/teachers",{method:"POST",body:JSON.stringify(a)}),resetSchoolTeacherPassword:(a,l)=>pe(`/school-admin/teachers/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setSchoolTeacherLock:(a,l)=>pe(`/school-admin/teachers/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),getSchoolDevices:()=>pe("/school-admin/devices"),getSchoolCodes:()=>pe("/school-admin/activation-codes"),generateSchoolCode:a=>pe(`/school-admin/activation-codes?classId=${encodeURIComponent(a)}`,{method:"POST"}),getTeacherClasses:()=>pe("/notification/classes"),sendNotification:a=>pe("/notification/send",{method:"POST",body:JSON.stringify(a)}),cancelNotification:a=>pe(`/notifications/${encodeURIComponent(a)}/cancel`,{method:"POST"}),getTeacherHistory:(a,l=50)=>pe(`/notification/history?${a?`classId=${encodeURIComponent(a)}&`:""}limit=${l}`),getVisualReceiptBlob:async(a,l)=>{const o=Ss(),u=await fetch(`${Hd}/notifications/${encodeURIComponent(a)}/receipts/${encodeURIComponent(l)}/visual-receipt`,{headers:o?{Authorization:`Bearer ${o}`}:{}});if(u.status===410)throw new Error("视觉回执已按24小时保存策略自动销毁");if(u.status===404)throw new Error("未找到该通知的视觉回执");if(!u.ok)throw new Error(`获取视觉回执失败 (${u.status})`);return u.blob()}};class Fn extends Error{constructor(l,o){const u=new.target.prototype;super(`${l}: Status code '${o}'`),this.statusCode=o,this.__proto__=u}}class oa extends Error{constructor(l="A timeout occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class zt extends Error{constructor(l="An abort occurred."){const o=new.target.prototype;super(l),this.__proto__=o}}class mp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="UnsupportedTransportError",this.__proto__=u}}class pp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="DisabledTransportError",this.__proto__=u}}class xp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.transport=o,this.errorType="FailedToStartTransportError",this.__proto__=u}}class Nd extends Error{constructor(l){const o=new.target.prototype;super(l),this.errorType="FailedToNegotiateWithServerError",this.__proto__=o}}class gp extends Error{constructor(l,o){const u=new.target.prototype;super(l),this.innerErrors=o,this.__proto__=u}}class Wd{constructor(l,o,u){this.statusCode=l,this.statusText=o,this.content=u}}class Vl{get(l,o){return this.send({...o,method:"GET",url:l})}post(l,o){return this.send({...o,method:"POST",url:l})}delete(l,o){return this.send({...o,method:"DELETE",url:l})}getCookieString(l){return""}}var I;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(I||(I={}));class wr{constructor(){}log(l,o){}}wr.instance=new wr;const vp="8.0.29";class qe{static isRequired(l,o){if(l==null)throw new Error(`The '${o}' argument is required.`)}static isNotEmpty(l,o){if(!l||l.match(/^\s*$/))throw new Error(`The '${o}' argument should not be empty.`)}static isIn(l,o,u){if(!(l in o))throw new Error(`Unknown ${u} value: ${l}.`)}}class Oe{static get isBrowser(){return!Oe.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Oe.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Oe.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function jr(a,l){let o="";return Wn(a)?(o=`Binary data of length ${a.byteLength}`,l&&(o+=`. Content: '${yp(a)}'`)):typeof a=="string"&&(o=`String data of length ${a.length}`,l&&(o+=`. Content: '${a}'`)),o}function yp(a){const l=new Uint8Array(a);let o="";return l.forEach(u=>{const d=u<16?"0":"";o+=`0x${d}${u.toString(16)} `}),o.substr(0,o.length-1)}function Wn(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function Vd(a,l,o,u,d,f){const m={},[y,p]=Cs();m[y]=p,a.log(I.Trace,`(${l} transport) sending data. ${jr(d,f.logMessageContent)}.`);const j=Wn(d)?"arraybuffer":"text",S=await o.post(u,{content:d,headers:{...m,...f.headers},responseType:j,timeout:f.timeout,withCredentials:f.withCredentials});a.log(I.Trace,`(${l} transport) request complete. Response status: ${S.statusCode}.`)}function wp(a){return a===void 0?new Ol(I.Information):a===null?wr.instance:a.log!==void 0?a:new Ol(a)}class jp{constructor(l,o){this._subject=l,this._observer=o}dispose(){const l=this._subject.observers.indexOf(this._observer);l>-1&&this._subject.observers.splice(l,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(o=>{})}}class Ol{constructor(l){this._minLevel=l,this.out=console}log(l,o){if(l>=this._minLevel){const u=`[${new Date().toISOString()}] ${I[l]}: ${o}`;switch(l){case I.Critical:case I.Error:this.out.error(u);break;case I.Warning:this.out.warn(u);break;case I.Information:this.out.info(u);break;default:this.out.log(u);break}}}}function Cs(){let a="X-SignalR-User-Agent";return Oe.isNode&&(a="User-Agent"),[a,Np(vp,bp(),kp(),_p())]}function Np(a,l,o,u){let d="Microsoft SignalR/";const f=a.split(".");return d+=`${f[0]}.${f[1]}`,d+=` (${a}; `,l&&l!==""?d+=`${l}; `:d+="Unknown OS; ",d+=`${o}`,u?d+=`; ${u}`:d+="; Unknown Runtime Version",d+=")",d}function bp(){if(Oe.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function _p(){if(Oe.isNode)return process.versions.node}function kp(){return Oe.isNode?"NodeJS":"Browser"}function Vo(a){return a.stack?a.stack:a.message?a.message:`${a}`}function Sp(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Cp extends Vl{constructor(l){if(super(),this._logger=l,typeof fetch>"u"||Oe.isNode){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(o("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=o("node-fetch"):this._fetchType=fetch,this._fetchType=o("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Sp());if(typeof AbortController>"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=o("abort-controller")}else this._abortControllerType=AbortController}async send(l){if(l.abortSignal&&l.abortSignal.aborted)throw new zt;if(!l.method)throw new Error("No method defined.");if(!l.url)throw new Error("No url defined.");const o=new this._abortControllerType;let u;l.abortSignal&&(l.abortSignal.onabort=()=>{o.abort(),u=new zt});let d=null;if(l.timeout){const p=l.timeout;d=setTimeout(()=>{o.abort(),this._logger.log(I.Warning,"Timeout from HTTP request."),u=new oa},p)}l.content===""&&(l.content=void 0),l.content&&(l.headers=l.headers||{},Wn(l.content)?l.headers["Content-Type"]="application/octet-stream":l.headers["Content-Type"]="text/plain;charset=UTF-8");let f;try{f=await this._fetchType(l.url,{body:l.content,cache:"no-cache",credentials:l.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...l.headers},method:l.method,mode:"cors",redirect:"follow",signal:o.signal})}catch(p){throw u||(this._logger.log(I.Warning,`Error from HTTP request. ${p}.`),p)}finally{d&&clearTimeout(d),l.abortSignal&&(l.abortSignal.onabort=null)}if(!f.ok){const p=await bd(f,"text");throw new Fn(p||f.statusText,f.status)}const y=await bd(f,l.responseType);return new Wd(f.status,f.statusText,y)}getCookieString(l){let o="";return Oe.isNode&&this._jar&&this._jar.getCookies(l,(u,d)=>o=d.join("; ")),o}}function bd(a,l){let o;switch(l){case"arraybuffer":o=a.arrayBuffer();break;case"text":o=a.text();break;case"blob":case"document":case"json":throw new Error(`${l} is not supported.`);default:o=a.text();break}return o}class Ep extends Vl{constructor(l){super(),this._logger=l}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?new Promise((o,u)=>{const d=new XMLHttpRequest;d.open(l.method,l.url,!0),d.withCredentials=l.withCredentials===void 0?!0:l.withCredentials,d.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.content===""&&(l.content=void 0),l.content&&(Wn(l.content)?d.setRequestHeader("Content-Type","application/octet-stream"):d.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const f=l.headers;f&&Object.keys(f).forEach(m=>{d.setRequestHeader(m,f[m])}),l.responseType&&(d.responseType=l.responseType),l.abortSignal&&(l.abortSignal.onabort=()=>{d.abort(),u(new zt)}),l.timeout&&(d.timeout=l.timeout),d.onload=()=>{l.abortSignal&&(l.abortSignal.onabort=null),d.status>=200&&d.status<300?o(new Wd(d.status,d.statusText,d.response||d.responseText)):u(new Fn(d.response||d.responseText||d.statusText,d.status))},d.onerror=()=>{this._logger.log(I.Warning,`Error from HTTP request. ${d.status}: ${d.statusText}.`),u(new Fn(d.statusText,d.status))},d.ontimeout=()=>{this._logger.log(I.Warning,"Timeout from HTTP request."),u(new oa)},d.send(l.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Tp extends Vl{constructor(l){if(super(),typeof fetch<"u"||Oe.isNode)this._httpClient=new Cp(l);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ep(l);else throw new Error("No usable HttpClient found.")}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new zt):l.method?l.url?this._httpClient.send(l):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(l){return this._httpClient.getCookieString(l)}}class Nt{static write(l){return`${l}${Nt.RecordSeparator}`}static parse(l){if(l[l.length-1]!==Nt.RecordSeparator)throw new Error("Message is incomplete.");const o=l.split(Nt.RecordSeparator);return o.pop(),o}}Nt.RecordSeparatorCode=30;Nt.RecordSeparator=String.fromCharCode(Nt.RecordSeparatorCode);class Pp{writeHandshakeRequest(l){return Nt.write(JSON.stringify(l))}parseHandshakeResponse(l){let o,u;if(Wn(l)){const y=new Uint8Array(l),p=y.indexOf(Nt.RecordSeparatorCode);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=String.fromCharCode.apply(null,Array.prototype.slice.call(y.slice(0,j))),u=y.byteLength>j?y.slice(j).buffer:null}else{const y=l,p=y.indexOf(Nt.RecordSeparator);if(p===-1)throw new Error("Message is incomplete.");const j=p+1;o=y.substring(0,j),u=y.length>j?y.substring(j):null}const d=Nt.parse(o),f=JSON.parse(d[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[u,f]}}var de;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close",a[a.Ack=8]="Ack",a[a.Sequence=9]="Sequence"})(de||(de={}));class Ip{constructor(){this.observers=[]}next(l){for(const o of this.observers)o.next(l)}error(l){for(const o of this.observers)o.error&&o.error(l)}complete(){for(const l of this.observers)l.complete&&l.complete()}subscribe(l){return this.observers.push(l),new jp(this,l)}}class Rp{constructor(l,o,u){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=l,this._connection=o,this._bufferSize=u}async _send(l){const o=this._protocol.writeMessage(l);let u=Promise.resolve();if(this._isInvocationMessage(l)){this._totalMessageCount++;let d=()=>{},f=()=>{};Wn(o)?this._bufferedByteCount+=o.byteLength:this._bufferedByteCount+=o.length,this._bufferedByteCount>=this._bufferSize&&(u=new Promise((m,y)=>{d=m,f=y})),this._messages.push(new Lp(o,this._totalMessageCount,d,f))}try{this._reconnectInProgress||await this._connection.send(o)}catch{this._disconnected()}await u}_ack(l){let o=-1;for(let u=0;uthis._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=l.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const l=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:de.Sequence,sequenceId:l}));const o=this._messages;for(const u of o)await this._connection.send(u._message);this._reconnectInProgress=!1}_dispose(l){l??(l=new Error("Unable to reconnect to server."));for(const o of this._messages)o._rejector(l)}_isInvocationMessage(l){switch(l.type){case de.Invocation:case de.StreamItem:case de.Completion:case de.StreamInvocation:case de.CancelInvocation:return!0;case de.Close:case de.Sequence:case de.Ping:case de.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:de.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class Lp{constructor(l,o,u,d){this._message=l,this._id=o,this._resolver=u,this._rejector=d}}const Dp=30*1e3,$p=15*1e3,Mp=1e5;var Ie;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(Ie||(Ie={}));class aa{static create(l,o,u,d,f,m,y){return new aa(l,o,u,d,f,m,y)}constructor(l,o,u,d,f,m,y){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(I.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},qe.isRequired(l,"connection"),qe.isRequired(o,"logger"),qe.isRequired(u,"protocol"),this.serverTimeoutInMilliseconds=f??Dp,this.keepAliveIntervalInMilliseconds=m??$p,this._statefulReconnectBufferSize=y??Mp,this._logger=o,this._protocol=u,this.connection=l,this._reconnectPolicy=d,this._handshakeProtocol=new Pp,this.connection.onreceive=p=>this._processIncomingData(p),this.connection.onclose=p=>this._connectionClosed(p),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ie.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:de.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(l){if(this._connectionState!==Ie.Disconnected&&this._connectionState!==Ie.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!l)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=l}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ie.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ie.Connecting,this._logger.log(I.Debug,"Starting HubConnection.");try{await this._startInternal(),Oe.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ie.Connected,this._connectionStarted=!0,this._logger.log(I.Debug,"HubConnection connected successfully.")}catch(l){return this._connectionState=Ie.Disconnected,this._logger.log(I.Debug,`HubConnection failed to start successfully because of error '${l}'.`),Promise.reject(l)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const l=new Promise((o,u)=>{this._handshakeResolver=o,this._handshakeRejecter=u});await this.connection.start(this._protocol.transferFormat);try{let o=this._protocol.version;this.connection.features.reconnect||(o=1);const u={protocol:this._protocol.name,version:o};if(this._logger.log(I.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(u)),this._logger.log(I.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await l,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Rp(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(o){throw this._logger.log(I.Debug,`Hub handshake failed with error '${o}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(o),o}}async stop(){const l=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await l}catch{}}_stopInternal(l){if(this._connectionState===Ie.Disconnected)return this._logger.log(I.Debug,`Call to HubConnection.stop(${l}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ie.Disconnecting)return this._logger.log(I.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const o=this._connectionState;return this._connectionState=Ie.Disconnecting,this._logger.log(I.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(I.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(o===Ie.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=l||new zt("The connection was stopped before the hub handshake could complete."),this.connection.stop(l))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createStreamInvocation(l,o,d);let m;const y=new Ip;return y.cancelCallback=()=>{const p=this._createCancelInvocation(f.invocationId);return delete this._callbacks[f.invocationId],m.then(()=>this._sendWithProtocol(p))},this._callbacks[f.invocationId]=(p,j)=>{if(j){y.error(j);return}else p&&(p.type===de.Completion?p.error?y.error(new Error(p.error)):y.complete():y.next(p.item))},m=this._sendWithProtocol(f).catch(p=>{y.error(p),delete this._callbacks[f.invocationId]}),this._launchStreams(u,m),y}_sendMessage(l){return this._resetKeepAliveInterval(),this.connection.send(l)}_sendWithProtocol(l){return this._messageBuffer?this._messageBuffer._send(l):this._sendMessage(this._protocol.writeMessage(l))}send(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._sendWithProtocol(this._createInvocation(l,o,!0,d));return this._launchStreams(u,f),f}invoke(l,...o){const[u,d]=this._replaceStreamingParams(o),f=this._createInvocation(l,o,!1,d);return new Promise((y,p)=>{this._callbacks[f.invocationId]=(S,k)=>{if(k){p(k);return}else S&&(S.type===de.Completion?S.error?p(new Error(S.error)):y(S.result):p(new Error(`Unexpected message type: ${S.type}`)))};const j=this._sendWithProtocol(f).catch(S=>{p(S),delete this._callbacks[f.invocationId]});this._launchStreams(u,j)})}on(l,o){!l||!o||(l=l.toLowerCase(),this._methods[l]||(this._methods[l]=[]),this._methods[l].indexOf(o)===-1&&this._methods[l].push(o))}off(l,o){if(!l)return;l=l.toLowerCase();const u=this._methods[l];if(u)if(o){const d=u.indexOf(o);d!==-1&&(u.splice(d,1),u.length===0&&delete this._methods[l])}else delete this._methods[l]}onclose(l){l&&this._closedCallbacks.push(l)}onreconnecting(l){l&&this._reconnectingCallbacks.push(l)}onreconnected(l){l&&this._reconnectedCallbacks.push(l)}_processIncomingData(l){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(l=this._processHandshakeResponse(l),this._receivedHandshakeResponse=!0),l){const o=this._protocol.parseMessages(l,this._logger);for(const u of o)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(u)))switch(u.type){case de.Invocation:this._invokeClientMethod(u).catch(d=>{this._logger.log(I.Error,`Invoke client method threw error: ${Vo(d)}`)});break;case de.StreamItem:case de.Completion:{const d=this._callbacks[u.invocationId];if(d){u.type===de.Completion&&delete this._callbacks[u.invocationId];try{d(u)}catch(f){this._logger.log(I.Error,`Stream callback threw error: ${Vo(f)}`)}}break}case de.Ping:break;case de.Close:{this._logger.log(I.Information,"Close message received from server.");const d=u.error?new Error("Server returned an error on close: "+u.error):void 0;u.allowReconnect===!0?this.connection.stop(d):this._stopPromise=this._stopInternal(d);break}case de.Ack:this._messageBuffer&&this._messageBuffer._ack(u);break;case de.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(u);break;default:this._logger.log(I.Warning,`Invalid message type: ${u.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(l){let o,u;try{[u,o]=this._handshakeProtocol.parseHandshakeResponse(l)}catch(d){const f="Error parsing handshake response: "+d;this._logger.log(I.Error,f);const m=new Error(f);throw this._handshakeRejecter(m),m}if(o.error){const d="Server returned handshake error: "+o.error;this._logger.log(I.Error,d);const f=new Error(d);throw this._handshakeRejecter(f),f}else this._logger.log(I.Debug,"Server handshake complete.");return this._handshakeResolver(),u}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let l=this._nextKeepAlive-new Date().getTime();l<0&&(l=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===Ie.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},l)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(l){const o=l.target.toLowerCase(),u=this._methods[o];if(!u){this._logger.log(I.Warning,`No client method with the name '${o}' found.`),l.invocationId&&(this._logger.log(I.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)));return}const d=u.slice(),f=!!l.invocationId;let m,y,p;for(const j of d)try{const S=m;m=await j.apply(this,l.arguments),f&&m&&S&&(this._logger.log(I.Error,`Multiple results provided for '${o}'. Sending error to server.`),p=this._createCompletionMessage(l.invocationId,"Client provided multiple results.",null)),y=void 0}catch(S){y=S,this._logger.log(I.Error,`A callback for the method '${o}' threw error '${S}'.`)}p?await this._sendWithProtocol(p):f?(y?p=this._createCompletionMessage(l.invocationId,`${y}`,null):m!==void 0?p=this._createCompletionMessage(l.invocationId,null,m):(this._logger.log(I.Warning,`No result given for '${o}' method and invocation ID '${l.invocationId}'.`),p=this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(p)):m&&this._logger.log(I.Error,`Result given for '${o}' method but server is not expecting a result.`)}_connectionClosed(l){this._logger.log(I.Debug,`HubConnection.connectionClosed(${l}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||l||new zt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(l||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ie.Disconnecting?this._completeClose(l):this._connectionState===Ie.Connected&&this._reconnectPolicy?this._reconnect(l):this._connectionState===Ie.Connected&&this._completeClose(l)}_completeClose(l){if(this._connectionStarted){this._connectionState=Ie.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(l??new Error("Connection closed.")),this._messageBuffer=void 0),Oe.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(o=>o.apply(this,[l]))}catch(o){this._logger.log(I.Error,`An onclose callback called with error '${l}' threw error '${o}'.`)}}}async _reconnect(l){const o=Date.now();let u=0,d=l!==void 0?l:new Error("Attempting to reconnect due to a unknown error."),f=this._getNextRetryDelay(u++,0,d);if(f===null){this._logger.log(I.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(l);return}if(this._connectionState=Ie.Reconnecting,l?this._logger.log(I.Information,`Connection reconnecting because of error '${l}'.`):this._logger.log(I.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(m=>m.apply(this,[l]))}catch(m){this._logger.log(I.Error,`An onreconnecting callback called with error '${l}' threw error '${m}'.`)}if(this._connectionState!==Ie.Reconnecting){this._logger.log(I.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;f!==null;){if(this._logger.log(I.Information,`Reconnect attempt number ${u} will start in ${f} ms.`),await new Promise(m=>{this._reconnectDelayHandle=setTimeout(m,f)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ie.Reconnecting){this._logger.log(I.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ie.Connected,this._logger.log(I.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(m=>m.apply(this,[this.connection.connectionId]))}catch(m){this._logger.log(I.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${m}'.`)}return}catch(m){if(this._logger.log(I.Information,`Reconnect attempt failed because of error '${m}'.`),this._connectionState!==Ie.Reconnecting){this._logger.log(I.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ie.Disconnecting&&this._completeClose();return}d=m instanceof Error?m:new Error(m.toString()),f=this._getNextRetryDelay(u++,Date.now()-o,d)}}this._logger.log(I.Information,`Reconnect retries have been exhausted after ${Date.now()-o} ms and ${u} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(l,o,u){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:o,previousRetryCount:l,retryReason:u})}catch(d){return this._logger.log(I.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${l}, ${o}) threw error '${d}'.`),null}}_cancelCallbacksWithError(l){const o=this._callbacks;this._callbacks={},Object.keys(o).forEach(u=>{const d=o[u];try{d(null,l)}catch(f){this._logger.log(I.Error,`Stream 'error' callback called with '${l}' threw error: ${Vo(f)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(l,o,u,d){if(u)return d.length!==0?{arguments:o,streamIds:d,target:l,type:de.Invocation}:{arguments:o,target:l,type:de.Invocation};{const f=this._invocationId;return this._invocationId++,d.length!==0?{arguments:o,invocationId:f.toString(),streamIds:d,target:l,type:de.Invocation}:{arguments:o,invocationId:f.toString(),target:l,type:de.Invocation}}}_launchStreams(l,o){if(l.length!==0){o||(o=Promise.resolve());for(const u in l)l[u].subscribe({complete:()=>{o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u)))},error:d=>{let f;d instanceof Error?f=d.message:d&&d.toString?f=d.toString():f="Unknown error",o=o.then(()=>this._sendWithProtocol(this._createCompletionMessage(u,f)))},next:d=>{o=o.then(()=>this._sendWithProtocol(this._createStreamItemMessage(u,d)))}})}}_replaceStreamingParams(l){const o=[],u=[];for(let d=0;d0)&&(o=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(l);const u=await this._innerClient.send(l);return o&&u.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(l),await this._innerClient.send(l)):u}_setAuthorizationHeader(l){l.headers||(l.headers={}),this._accessToken?l.headers[Bn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&l.headers[Bn.Authorization]&&delete l.headers[Bn.Authorization]}getCookieString(l){return this._innerClient.getCookieString(l)}}var Xe;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(Xe||(Xe={}));var it;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(it||(it={}));let Op=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class kd{get pollAborted(){return this._pollAbort.aborted}constructor(l,o,u){this._httpClient=l,this._logger=o,this._pollAbort=new Op,this._options=u,this._running=!1,this.onreceive=null,this.onclose=null}async connect(l,o){if(qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._url=l,this._logger.log(I.Trace,"(LongPolling transport) Connecting."),o===it.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[u,d]=Cs(),f={[u]:d,...this._options.headers},m={abortSignal:this._pollAbort.signal,headers:f,timeout:1e5,withCredentials:this._options.withCredentials};o===it.Binary&&(m.responseType="arraybuffer");const y=`${l}&_=${Date.now()}`;this._logger.log(I.Trace,`(LongPolling transport) polling: ${y}.`);const p=await this._httpClient.get(y,m);p.statusCode!==200?(this._logger.log(I.Error,`(LongPolling transport) Unexpected response code: ${p.statusCode}.`),this._closeError=new Fn(p.statusText||"",p.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,m)}async _poll(l,o){try{for(;this._running;)try{const u=`${l}&_=${Date.now()}`;this._logger.log(I.Trace,`(LongPolling transport) polling: ${u}.`);const d=await this._httpClient.get(u,o);d.statusCode===204?(this._logger.log(I.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):d.statusCode!==200?(this._logger.log(I.Error,`(LongPolling transport) Unexpected response code: ${d.statusCode}.`),this._closeError=new Fn(d.statusText||"",d.statusCode),this._running=!1):d.content?(this._logger.log(I.Trace,`(LongPolling transport) data received. ${jr(d.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(d.content)):this._logger.log(I.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(u){this._running?u instanceof oa?this._logger.log(I.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=u,this._running=!1):this._logger.log(I.Trace,`(LongPolling transport) Poll errored after shutdown: ${u.message}`)}}finally{this._logger.log(I.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(l){return this._running?Vd(this._logger,"LongPolling",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(I.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(I.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const l={},[o,u]=Cs();l[o]=u;const d={headers:{...l,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let f;try{await this._httpClient.delete(this._url,d)}catch(m){f=m}f?f instanceof Fn&&(f.statusCode===404?this._logger.log(I.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(I.Trace,`(LongPolling transport) Error sending a DELETE request: ${f}`)):this._logger.log(I.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(I.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let l="(LongPolling transport) Firing onclose event.";this._closeError&&(l+=" Error: "+this._closeError),this._logger.log(I.Trace,l),this.onclose(this._closeError)}}}class Up{constructor(l,o,u,d){this._httpClient=l,this._accessToken=o,this._logger=u,this._options=d,this.onreceive=null,this.onclose=null}async connect(l,o){return qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(I.Trace,"(SSE transport) Connecting."),this._url=l,this._accessToken&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((u,d)=>{let f=!1;if(o!==it.Text){d(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let m;if(Oe.isBrowser||Oe.isWebWorker)m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials});else{const y=this._httpClient.getCookieString(l),p={};p.Cookie=y;const[j,S]=Cs();p[j]=S,m=new this._options.EventSource(l,{withCredentials:this._options.withCredentials,headers:{...p,...this._options.headers}})}try{m.onmessage=y=>{if(this.onreceive)try{this._logger.log(I.Trace,`(SSE transport) data received. ${jr(y.data,this._options.logMessageContent)}.`),this.onreceive(y.data)}catch(p){this._close(p);return}},m.onerror=y=>{f?this._close():d(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},m.onopen=()=>{this._logger.log(I.Information,`SSE connected to ${this._url}`),this._eventSource=m,f=!0,u()}}catch(y){d(y);return}})}async send(l){return this._eventSource?Vd(this._logger,"SSE",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(l){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(l))}}class Fp{constructor(l,o,u,d,f,m){this._logger=u,this._accessTokenFactory=o,this._logMessageContent=d,this._webSocketConstructor=f,this._httpClient=l,this.onreceive=null,this.onclose=null,this._headers=m}async connect(l,o){qe.isRequired(l,"url"),qe.isRequired(o,"transferFormat"),qe.isIn(o,it,"transferFormat"),this._logger.log(I.Trace,"(WebSockets transport) Connecting.");let u;return this._accessTokenFactory&&(u=await this._accessTokenFactory()),new Promise((d,f)=>{l=l.replace(/^http/,"ws");let m;const y=this._httpClient.getCookieString(l);let p=!1;if(Oe.isNode||Oe.isReactNative){const j={},[S,k]=Cs();j[S]=k,u&&(j[Bn.Authorization]=`Bearer ${u}`),y&&(j[Bn.Cookie]=y),m=new this._webSocketConstructor(l,void 0,{headers:{...j,...this._headers}})}else u&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(u)}`);m||(m=new this._webSocketConstructor(l)),o===it.Binary&&(m.binaryType="arraybuffer"),m.onopen=j=>{this._logger.log(I.Information,`WebSocket connected to ${l}.`),this._webSocket=m,p=!0,d()},m.onerror=j=>{let S=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?S=j.error:S="There was an error with the transport",this._logger.log(I.Information,`(WebSockets transport) ${S}.`)},m.onmessage=j=>{if(this._logger.log(I.Trace,`(WebSockets transport) data received. ${jr(j.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(j.data)}catch(S){this._close(S);return}},m.onclose=j=>{if(p)this._close(j);else{let S=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?S=j.error:S="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",f(new Error(S))}}})}send(l){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(I.Trace,`(WebSockets transport) sending data. ${jr(l,this._logMessageContent)}.`),this._webSocket.send(l),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(l){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(I.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(l)&&(l.wasClean===!1||l.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${l.code} (${l.reason||"no reason given"}).`)):l instanceof Error?this.onclose(l):this.onclose())}_isCloseEvent(l){return l&&typeof l.wasClean=="boolean"&&typeof l.code=="number"}}const Sd=100;class Bp{constructor(l,o={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,qe.isRequired(l,"url"),this._logger=wp(o.logger),this.baseUrl=this._resolveUrl(l),o=o||{},o.logMessageContent=o.logMessageContent===void 0?!1:o.logMessageContent,typeof o.withCredentials=="boolean"||o.withCredentials===void 0)o.withCredentials=o.withCredentials===void 0?!0:o.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");o.timeout=o.timeout===void 0?100*1e3:o.timeout;let u=null,d=null;if(Oe.isNode&&typeof require<"u"){const f=typeof __webpack_require__=="function"?__non_webpack_require__:require;u=f("ws"),d=f("eventsource")}!Oe.isNode&&typeof WebSocket<"u"&&!o.WebSocket?o.WebSocket=WebSocket:Oe.isNode&&!o.WebSocket&&u&&(o.WebSocket=u),!Oe.isNode&&typeof EventSource<"u"&&!o.EventSource?o.EventSource=EventSource:Oe.isNode&&!o.EventSource&&typeof d<"u"&&(o.EventSource=d),this._httpClient=new zp(o.httpClient||new Tp(this._logger),o.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=o,this.onreceive=null,this.onclose=null}async start(l){if(l=l||it.Binary,qe.isIn(l,it,"transferFormat"),this._logger.log(I.Debug,`Starting connection with transfer format '${it[l]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(l),await this._startInternalPromise,this._connectionState==="Disconnecting"){const o="Failed to start the HttpConnection before stop() was called.";return this._logger.log(I.Error,o),await this._stopPromise,Promise.reject(new zt(o))}else if(this._connectionState!=="Connected"){const o="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(I.Error,o),Promise.reject(new zt(o))}this._connectionStarted=!0}send(l){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ca(this.transport)),this._sendQueue.send(l))}async stop(l){if(this._connectionState==="Disconnected")return this._logger.log(I.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(I.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(o=>{this._stopPromiseResolver=o}),await this._stopInternal(l),await this._stopPromise}async _stopInternal(l){this._stopError=l;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(o){this._logger.log(I.Error,`HttpConnection.transport.stop() threw error '${o}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(I.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(l){let o=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Xe.WebSockets)this.transport=this._constructTransport(Xe.WebSockets),await this._startTransport(o,l);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let u=null,d=0;do{if(u=await this._getNegotiationResponse(o),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new zt("The connection was stopped during negotiation.");if(u.error)throw new Error(u.error);if(u.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(u.url&&(o=u.url),u.accessToken){const f=u.accessToken;this._accessTokenFactory=()=>f,this._httpClient._accessToken=f,this._httpClient._accessTokenFactory=void 0}d++}while(u.url&&d0?Promise.reject(new gp(`Unable to connect to the server with any of the available transports. ${m.join(" ")}`,m)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(l){switch(l){case Xe.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Fp(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Xe.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Up(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Xe.LongPolling:return new kd(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${l}.`)}}_startTransport(l,o){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async u=>{let d=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(l,o),await this.features.resend()}catch{d=!0}else{this._stopConnection(u);return}d&&this._stopConnection(u)}:this.transport.onclose=u=>this._stopConnection(u),this.transport.connect(l,o)}_resolveTransportOrError(l,o,u,d){const f=Xe[l.transport];if(f==null)return this._logger.log(I.Debug,`Skipping transport '${l.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${l.transport}' because it is not supported by this client.`);if(Hp(o,f))if(l.transferFormats.map(y=>it[y]).indexOf(u)>=0){if(f===Xe.WebSockets&&!this._options.WebSocket||f===Xe.ServerSentEvents&&!this._options.EventSource)return this._logger.log(I.Debug,`Skipping transport '${Xe[f]}' because it is not supported in your environment.'`),new mp(`'${Xe[f]}' is not supported in your environment.`,f);this._logger.log(I.Debug,`Selecting transport '${Xe[f]}'.`);try{return this.features.reconnect=f===Xe.WebSockets?d:void 0,this._constructTransport(f)}catch(y){return y}}else return this._logger.log(I.Debug,`Skipping transport '${Xe[f]}' because it does not support the requested transfer format '${it[u]}'.`),new Error(`'${Xe[f]}' does not support ${it[u]}.`);else return this._logger.log(I.Debug,`Skipping transport '${Xe[f]}' because it was disabled by the client.`),new pp(`'${Xe[f]}' is disabled by the client.`,f)}_isITransport(l){return l&&typeof l=="object"&&"connect"in l}_stopConnection(l){if(this._logger.log(I.Debug,`HttpConnection.stopConnection(${l}) called while in state ${this._connectionState}.`),this.transport=void 0,l=this._stopError||l,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(I.Debug,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(I.Warning,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${l}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),l?this._logger.log(I.Error,`Connection disconnected with error '${l}'.`):this._logger.log(I.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(o=>{this._logger.log(I.Error,`TransportSendQueue.stop() threw error '${o}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(l)}catch(o){this._logger.log(I.Error,`HttpConnection.onclose(${l}) threw error '${o}'.`)}}}_resolveUrl(l){if(l.lastIndexOf("https://",0)===0||l.lastIndexOf("http://",0)===0)return l;if(!Oe.isBrowser)throw new Error(`Cannot resolve '${l}'.`);const o=window.document.createElement("a");return o.href=l,this._logger.log(I.Information,`Normalizing '${l}' to '${o.href}'.`),o.href}_resolveNegotiateUrl(l){const o=new URL(l);o.pathname.endsWith("/")?o.pathname+="negotiate":o.pathname+="/negotiate";const u=new URLSearchParams(o.searchParams);return u.has("negotiateVersion")||u.append("negotiateVersion",this._negotiateVersion.toString()),u.has("useStatefulReconnect")?u.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&u.append("useStatefulReconnect","true"),o.search=u.toString(),o.toString()}}function Hp(a,l){return!a||(l&a)!==0}class ca{constructor(l){this._transport=l,this._buffer=[],this._executing=!0,this._sendBufferedData=new Al,this._transportResult=new Al,this._sendLoopPromise=this._sendLoop()}send(l){return this._bufferData(l),this._transportResult||(this._transportResult=new Al),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(l){if(this._buffer.length&&typeof this._buffer[0]!=typeof l)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof l}`);this._buffer.push(l),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Al;const l=this._transportResult;this._transportResult=void 0;const o=typeof this._buffer[0]=="string"?this._buffer.join(""):ca._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(o),l.resolve()}catch(u){l.reject(u)}}}static _concatBuffers(l){const o=l.map(f=>f.byteLength).reduce((f,m)=>f+m),u=new Uint8Array(o);let d=0;for(const f of l)u.set(new Uint8Array(f),d),d+=f.byteLength;return u.buffer}}class Al{constructor(){this.promise=new Promise((l,o)=>[this._resolver,this._rejecter]=[l,o])}resolve(){this._resolver()}reject(l){this._rejecter(l)}}const Wp="json";class Vp{constructor(){this.name=Wp,this.version=2,this.transferFormat=it.Text}parseMessages(l,o){if(typeof l!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!l)return[];o===null&&(o=wr.instance);const u=Nt.parse(l),d=[];for(const f of u){const m=JSON.parse(f);if(typeof m.type!="number")throw new Error("Invalid payload.");switch(m.type){case de.Invocation:this._isInvocationMessage(m);break;case de.StreamItem:this._isStreamItemMessage(m);break;case de.Completion:this._isCompletionMessage(m);break;case de.Ping:break;case de.Close:break;case de.Ack:this._isAckMessage(m);break;case de.Sequence:this._isSequenceMessage(m);break;default:o.log(I.Information,"Unknown message type '"+m.type+"' ignored.");continue}d.push(m)}return d}writeMessage(l){return Nt.write(JSON.stringify(l))}_isInvocationMessage(l){this._assertNotEmptyString(l.target,"Invalid payload for Invocation message."),l.invocationId!==void 0&&this._assertNotEmptyString(l.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(l){if(this._assertNotEmptyString(l.invocationId,"Invalid payload for StreamItem message."),l.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(l){if(l.result&&l.error)throw new Error("Invalid payload for Completion message.");!l.result&&l.error&&this._assertNotEmptyString(l.error,"Invalid payload for Completion message."),this._assertNotEmptyString(l.invocationId,"Invalid payload for Completion message.")}_isAckMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(l,o){if(typeof l!="string"||l==="")throw new Error(o)}}const Qp={trace:I.Trace,debug:I.Debug,info:I.Information,information:I.Information,warn:I.Warning,warning:I.Warning,error:I.Error,critical:I.Critical,none:I.None};function qp(a){const l=Qp[a.toLowerCase()];if(typeof l<"u")return l;throw new Error(`Unknown log level: ${a}`)}class Kp{configureLogging(l){if(qe.isRequired(l,"logging"),Jp(l))this.logger=l;else if(typeof l=="string"){const o=qp(l);this.logger=new Ol(o)}else this.logger=new Ol(l);return this}withUrl(l,o){return qe.isRequired(l,"url"),qe.isNotEmpty(l,"url"),this.url=l,typeof o=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...o}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:o},this}withHubProtocol(l){return qe.isRequired(l,"protocol"),this.protocol=l,this}withAutomaticReconnect(l){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return l?Array.isArray(l)?this.reconnectPolicy=new _d(l):this.reconnectPolicy=l:this.reconnectPolicy=new _d,this}withServerTimeout(l){return qe.isRequired(l,"milliseconds"),this._serverTimeoutInMilliseconds=l,this}withKeepAliveInterval(l){return qe.isRequired(l,"milliseconds"),this._keepAliveIntervalInMilliseconds=l,this}withStatefulReconnect(l){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=l==null?void 0:l.bufferSize,this}build(){const l=this.httpConnectionOptions||{};if(l.logger===void 0&&(l.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const o=new Bp(this.url,l);return aa.create(o,this.logger||wr.instance,this.protocol||new Vp,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Jp(a){return a.log!==void 0}class Xp{constructor(){xt(this,"connection",null);xt(this,"state","Disconnected");xt(this,"startPromise",null);xt(this,"permanentRetryTimer",null);xt(this,"isAuthenticated",!1);xt(this,"stateListeners",new Set);xt(this,"ackListeners",new Set);xt(this,"deviceStatusListeners",new Set);xt(this,"healthReportListeners",new Set);xt(this,"notificationListeners",new Set);xt(this,"cancelledListeners",new Set);Ns.subscribe(()=>{this.stop()})}getState(){return this.state}setState(l){this.state!==l&&(this.state=l,this.stateListeners.forEach(o=>o(l)))}onStateChange(l){return this.stateListeners.add(l),l(this.state),()=>this.stateListeners.delete(l)}onAckReceiptReceived(l){return this.ackListeners.add(l),()=>this.ackListeners.delete(l)}onDeviceStatusChanged(l){return this.deviceStatusListeners.add(l),()=>this.deviceStatusListeners.delete(l)}onHealthReportReceived(l){return this.healthReportListeners.add(l),()=>this.healthReportListeners.delete(l)}onNewNotificationBroadcast(l){return this.notificationListeners.add(l),()=>this.notificationListeners.delete(l)}onNotificationCancelled(l){return this.cancelledListeners.add(l),()=>this.cancelledListeners.delete(l)}async start(){var o,u;if(!Ss()){this.setState("Disconnected");return}if(this.isAuthenticated=!0,((o=this.connection)==null?void 0:o.state)===Ie.Connected){this.setState("Connected");return}return this.startPromise?this.startPromise:(this.connection||this.buildConnection(),this.setState(((u=this.connection)==null?void 0:u.state)===Ie.Reconnecting?"Reconnecting":"Connecting"),this.startPromise=(async()=>{try{this.connection&&this.connection.state===Ie.Disconnected&&(await this.connection.start(),this.setState("Connected"),this.clearPermanentRetryTimer())}catch(d){console.warn("SignalR start failed:",d),this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}finally{this.startPromise=null}})(),this.startPromise)}async stop(){if(this.isAuthenticated=!1,this.clearPermanentRetryTimer(),this.setState("Disconnected"),this.startPromise){try{await this.startPromise}catch{}this.startPromise=null}if(this.connection)try{await this.connection.stop()}catch(l){console.warn("Error stopping SignalR connection:",l)}finally{this.connection=null}}buildConnection(){this.connection=new Kp().withUrl("/hubs/teacher",{accessTokenFactory:()=>Ss()||""}).withAutomaticReconnect([0,2e3,5e3,1e4,3e4]).configureLogging(I.Warning).build(),this.connection.onreconnecting(()=>{this.setState("Reconnecting")}),this.connection.onreconnected(()=>{this.setState("Connected"),this.clearPermanentRetryTimer()}),this.connection.onclose(()=>{this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}),this.connection.on("OnAckReceiptReceived",l=>{this.ackListeners.forEach(o=>o(l))}),this.connection.on("OnDeviceStatusChanged",l=>{this.deviceStatusListeners.forEach(o=>o(l))}),this.connection.on("OnHealthReportReceived",l=>{this.healthReportListeners.forEach(o=>o(l))}),this.connection.on("OnNewNotificationBroadcast",l=>{this.notificationListeners.forEach(o=>o(l))}),this.connection.on("OnNotificationCancelled",l=>{this.cancelledListeners.forEach(o=>o(l))})}schedulePermanentRetry(){this.permanentRetryTimer||!this.isAuthenticated||(this.permanentRetryTimer=setInterval(()=>{var l;if(!this.isAuthenticated){this.clearPermanentRetryTimer();return}((l=this.connection)==null?void 0:l.state)===Ie.Disconnected&&this.start()},3e4))}clearPermanentRetryTimer(){this.permanentRetryTimer&&(clearInterval(this.permanentRetryTimer),this.permanentRetryTimer=null)}}const Ot=new Xp,Qd=g.createContext(void 0),Gp=({children:a})=>{const[l,o]=g.useState(()=>{try{const j=localStorage.getItem("classnotify_user");return j?JSON.parse(j):null}catch{return null}}),[u,d]=g.useState(Ss()),[f,m]=g.useState(!0);g.useEffect(()=>{const j=Ns.subscribe(()=>{Ot.stop(),xr(),d(null),o(null)});return()=>j()},[]),g.useEffect(()=>{(async()=>{var k,$;if(Ss())try{const D=await oe.getMe();o(D),localStorage.setItem("classnotify_user",JSON.stringify(D)),Ns.reset(),Ot.start()}catch(D){((k=D==null?void 0:D.message)!=null&&k.includes("未授权")||($=D==null?void 0:D.message)!=null&&$.includes("401"))&&(xr(),d(null),o(null))}else xr(),o(null),d(null);m(!1)})()},[]);const y=async(j,S)=>{const k=await oe.login(j,S);if(!k.success||!k.token||!k.role)throw new Error(k.errorMessage||"登录失败");fp(k.token),d(k.token);const $={userId:k.userId||"",name:k.fullName||j,role:k.role,tenantId:k.tenantId||""};return o($),localStorage.setItem("classnotify_user",JSON.stringify($)),Ns.reset(),Ot.start(),k.role},p=()=>{Ot.stop(),xr(),d(null),o(null),Ns.reset()};return n.jsx(Qd.Provider,{value:{user:l,token:u,login:y,logout:p,isLoading:f},children:a})},Sr=()=>{const a=g.useContext(Qd);if(!a)throw new Error("useAuth must be used within an AuthProvider");return a};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yp=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qd=(...a)=>a.filter((l,o,u)=>!!l&&l.trim()!==""&&u.indexOf(l)===o).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Zp={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e0=g.forwardRef(({color:a="currentColor",size:l=24,strokeWidth:o=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...y},p)=>g.createElement("svg",{ref:p,...Zp,width:l,height:l,stroke:a,strokeWidth:u?Number(o)*24/Number(l):o,className:qd("lucide",d),...y},[...m.map(([j,S])=>g.createElement(j,S)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ce=(a,l)=>{const o=g.forwardRef(({className:u,...d},f)=>g.createElement(e0,{ref:f,iconNode:l,className:qd(`lucide-${Yp(a)}`,u),...d}));return o.displayName=`${a}`,o};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ua=ce("Activity",t0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],js=ce("ArrowRight",n0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s0=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ul=ce("Bell",s0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r0=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Qt=ce("Building2",r0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fl=ce("Check",l0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sn=ce("CircleAlert",i0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pt=ce("CircleCheck",o0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Go=ce("CircleX",a0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Kn=ce("Clock",c0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u0=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]],d0=ce("CloudRain",u0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Yo=ce("Copy",h0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],m0=ce("Eye",f0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],x0=ce("Flame",p0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Nr=ce("GraduationCap",g0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Zo=ce("History",v0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y0=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ut=ce("KeyRound",y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w0=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],gr=ce("Layers",w0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kn=ce("LoaderCircle",j0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ea=ce("LockOpen",N0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bs=ce("Lock",b0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _0=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],k0=ce("LogOut",_0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S0=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],C0=ce("Megaphone",S0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E0=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],T0=ce("Menu",E0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vn=ce("Monitor",P0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I0=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],Kd=ce("PenLine",I0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qn=ce("Plus",R0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L0=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],br=ce("Radio",L0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],bt=ce("RefreshCw",D0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],M0=ce("RotateCcw",$0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A0=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Cd=ce("School",A0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Cr=ce("Search",z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],_r=ce("Send",O0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Bl=ce("ShieldAlert",U0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_s=ce("ShieldCheck",F0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],H0=ce("Shield",B0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Jd=ce("Sparkles",W0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],da=ce("Trash2",V0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ks=ce("TriangleAlert",Q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Xd=ce("User",q0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Hn=ce("Users",K0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J0=[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]],X0=ce("Vibrate",J0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Gd=ce("Volume2",G0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kr=ce("X",Y0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ex=ce("ZoomIn",Z0);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tx=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],nx=ce("ZoomOut",tx),ha=()=>{const[a,l]=g.useState(Ot.getState());return g.useEffect(()=>Ot.onStateChange(l),[]),a==="Connected"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"云端已连接"]}):a==="Reconnecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),"正在重连"]}):a==="Connecting"?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400 animate-pulse"}),"正在连接..."]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),"连接断开"]})},sx=()=>{const{user:a,logout:l}=Sr(),o=qn(),[u,d]=g.useState(!1);if(g.useEffect(()=>{d(!1)},[o.pathname]),!a)return null;const f=m=>o.pathname===m;return n.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"flex items-center justify-between h-16",children:[n.jsxs("div",{className:"flex items-center space-x-4",children:[n.jsxs(ye,{to:"/",className:"flex items-center space-x-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:n.jsx(Ul,{className:"w-5 h-5 text-white"})}),n.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),n.jsxs("span",{className:"text-xs px-2.5 py-1 rounded-full font-medium flex items-center gap-1.5 border bg-slate-900 border-slate-800 text-slate-300",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-amber-400"}),n.jsx("span",{className:"text-amber-400 font-semibold",children:"超级运维后台"})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(Cd,{className:"w-3.5 h-3.5 text-sky-400"}),n.jsx("span",{className:"text-sky-400 font-semibold",children:"学校管理后台"})]}),a.role==="Teacher"&&n.jsxs(n.Fragment,{children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-emerald-400"}),n.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]})]}),n.jsx("div",{className:"hidden sm:block",children:n.jsx(ha,{})})]}),n.jsxs("nav",{className:"hidden md:flex items-center space-x-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ye,{to:"/admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"总览"]}),n.jsxs(ye,{to:"/admin/tenants",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Qt,{className:"w-4 h-4"}),"学校租户"]}),n.jsxs(ye,{to:"/admin/users",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"用户中枢"]}),n.jsxs(ye,{to:"/admin/devices",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Vn,{className:"w-4 h-4"}),"设备集控"]}),n.jsxs(ye,{to:"/admin/broadcast",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400 border border-rose-500/30":"text-slate-400 hover:text-rose-300 hover:bg-slate-900"}`,children:[n.jsx(br,{className:"w-4 h-4"}),"应急广播"]}),n.jsxs(ye,{to:"/admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"激活码"]}),n.jsxs(ye,{to:"/admin/history",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Zo,{className:"w-4 h-4"}),"审计"]})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsxs(ye,{to:"/school-admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Cd,{className:"w-4 h-4"}),"学校概览"]}),n.jsxs(ye,{to:"/school-admin/classes",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(gr,{className:"w-4 h-4"}),"班级管理"]}),n.jsxs(ye,{to:"/school-admin/teachers",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Hn,{className:"w-4 h-4"}),"教师账号"]}),n.jsxs(ye,{to:"/school-admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${f("/school-admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"本校激活码"]})]}),a.role==="Teacher"&&n.jsxs(ye,{to:"/teacher",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${f("/teacher")?"bg-emerald-600/20 text-emerald-400 border border-emerald-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[n.jsx(Ul,{className:"w-4 h-4"}),"呼叫与回执"]})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsxs("div",{className:"hidden sm:flex flex-col text-right",children:[n.jsx("span",{className:"text-sm font-medium text-slate-200",children:a.name}),n.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":a.tenantId})]}),n.jsx("button",{onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 transition-colors",title:"退出登录",children:n.jsx(k0,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>d(!u),className:"md:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-900 border border-slate-800 transition-colors","aria-label":"展开菜单",children:u?n.jsx(kr,{className:"w-5 h-5"}):n.jsx(T0,{className:"w-5 h-5"})})]})]}),u&&n.jsxs("div",{className:"md:hidden py-3 px-2 border-t border-slate-800/80 bg-slate-950/95 space-y-1",children:[a.role==="SuperAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ye,{to:"/admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gr,{className:"w-4 h-4 text-indigo-400"}),"总览大盘"]})}),n.jsx(ye,{to:"/admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/30":"text-amber-400 bg-amber-500/10 hover:bg-amber-500/20"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[n.jsx(ut,{className:"w-4 h-4 text-amber-400"}),"设备激活码生成与管理"]}),n.jsx("span",{className:"text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded border border-amber-500/30 font-bold",children:"重点"})]})}),n.jsx(ye,{to:"/admin/tenants",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/tenants")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"学校租户"]})}),n.jsx(ye,{to:"/admin/users",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/users")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hn,{className:"w-4 h-4 text-indigo-400"}),"用户中枢"]})}),n.jsx(ye,{to:"/admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/devices")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"}),"设备集控"]})}),n.jsx(ye,{to:"/admin/broadcast",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/broadcast")?"bg-rose-600/20 text-rose-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})}),n.jsx(ye,{to:"/admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/admin/history")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"审计历史"]})})]}),a.role==="SchoolAdmin"&&n.jsxs(n.Fragment,{children:[n.jsx(ye,{to:"/school-admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"学校概览"}),n.jsx(ye,{to:"/school-admin/classes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/classes")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"班级管理"}),n.jsx(ye,{to:"/school-admin/teachers",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/teachers")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"教师账号"}),n.jsx(ye,{to:"/school-admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/school-admin/codes")?"bg-sky-600/20 text-sky-400":"text-amber-400 font-semibold"}`,children:"本校激活码"})]}),a.role==="Teacher"&&n.jsx(ye,{to:"/teacher",className:`block px-3 py-2 rounded-lg text-sm font-medium ${f("/teacher")?"bg-emerald-600/20 text-emerald-400":"text-slate-300 hover:bg-slate-900"}`,children:"呼叫与回执"})]})]})})},Qo=({allowedRoles:a,children:l})=>{const{user:o,isLoading:u}=Sr();return u?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户权限..."}):o?a.includes(o.role)?l?n.jsx(n.Fragment,{children:l}):n.jsx(Bd,{}):o.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):o.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},rx=()=>{const[a,l]=g.useState(""),[o,u]=g.useState(""),[d,f]=g.useState(null),[m,y]=g.useState(!1),{login:p}=Sr(),j=Wl(),S=async(k=a,$=o)=>{f(null),y(!0);try{const D=await p(k,$);j(D==="SuperAdmin"?"/admin":D==="SchoolAdmin"?"/school-admin":"/teacher")}catch(D){f(D.message||"登录失败,请检查账号密码")}finally{y(!1)}};return n.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/40 relative overflow-hidden",children:[n.jsx("div",{className:"absolute w-96 h-96 bg-indigo-500/10 rounded-full blur-3xl -top-20 -left-20 pointer-events-none"}),n.jsx("div",{className:"absolute w-96 h-96 bg-violet-500/10 rounded-full blur-3xl -bottom-20 -right-20 pointer-events-none"}),n.jsx("div",{className:"w-full max-w-md relative z-10",children:n.jsxs("div",{className:"glass-panel p-8 border-slate-800",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center mx-auto mb-4 shadow-xl shadow-indigo-500/25",children:n.jsx(Ul,{className:"w-8 h-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white",children:"ClassNotify 控制台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1.5",children:"智慧教室通知与设备集控一体化系统"})]}),d&&n.jsxs("div",{className:"mb-6 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-sm flex items-center gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),d]}),n.jsxs("form",{onSubmit:k=>{k.preventDefault(),S()},className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsxs("div",{className:"relative",children:[n.jsx(Xd,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"text",value:a,onChange:k=>l(k.target.value),placeholder:"请输入账号",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录密码"}),n.jsxs("div",{className:"relative",children:[n.jsx(bs,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),n.jsx("input",{type:"password",value:o,onChange:k=>u(k.target.value),placeholder:"请输入密码",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),n.jsx("button",{type:"submit",disabled:m,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:m?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在验证身份..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"登 录"}),n.jsx(js,{className:"w-4 h-4"})]})})]})]})})]})},lx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState([]),[m,y]=g.useState(null),[p,j]=g.useState([]),[S,k]=g.useState(!0),$=async()=>{try{const[D,Q,H,P,J]=await Promise.all([oe.getAdminMetrics(),oe.getTenants(),oe.getAdminNotifications(6),oe.getSystemHealth().catch(()=>null),oe.getAuditLogs(6).catch(()=>[])]);l(D),u(Q),f(H),P&&y(P),J&&j(J)}catch(D){console.error("Failed to load admin dashboard data",D)}finally{k(!1)}};return g.useEffect(()=>{$();const D=setInterval($,1e4);return()=>clearInterval(D)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域云控超管总览"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时管控多校区实体、网格化终端生命周期、底层微内核与紧急调度通道"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 self-start sm:self-auto",children:[n.jsxs(ye,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold shadow-md shadow-amber-500/20 active:scale-95 transition-all",children:[n.jsx(ut,{className:"w-4 h-4"}),"生成设备激活码"]}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 rounded-xl bg-slate-900/80 border border-slate-800 text-xs",children:[m!=null&&m.databaseConnected?n.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),n.jsxs("span",{className:"font-medium",children:["PostgreSQL 正常 (",m.databaseLatencyMs.toFixed(1),"ms)"]})]}):n.jsxs("div",{className:"flex items-center gap-2 text-rose-400",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-500"}),n.jsx("span",{className:"font-medium",children:"数据库异常断开"})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsxs("div",{className:"text-slate-400",children:[n.jsx("span",{children:"在线屏: "}),n.jsx("span",{className:"text-white font-mono",children:(m==null?void 0:m.onlineDevices)??(a==null?void 0:a.onlineDevices)??0})]}),n.jsx("span",{className:"text-slate-600",children:"|"}),n.jsx("div",{className:"text-slate-400 font-mono text-[11px]",children:n.jsxs("span",{children:["运行: ",(m==null?void 0:m.uptime)||"99.98%"]})})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"入驻学校 / 租户"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:S?"-":(a==null?void 0:a.totalTenants)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"所校区"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"总设备数量"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:S?"-":(a==null?void 0:a.totalDevices)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台教室终端"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800 relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"在线设备 (实时连通)"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(ua,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),S?"-":(a==null?void 0:a.onlineDevices)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 离线 ",S?"-":(a==null?void 0:a.offlineDevices)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"今日呼叫通知"}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 text-amber-400 flex items-center justify-center",children:n.jsx(Ul,{className:"w-4 h-4"})})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:S?"-":(a==null?void 0:a.todayNotifications)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"次下发"})]})]})]}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"核心管控中枢入口"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4",children:[n.jsxs(ye,{to:"/admin/tenants",className:"glass-panel p-4 border-slate-800 hover:border-indigo-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-500/10 text-indigo-400 flex items-center justify-center",children:n.jsx(Qt,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-indigo-400",children:"学校租户"}),n.jsx("div",{className:"text-xs text-slate-400",children:"入驻、变更与冻结"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-indigo-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ye,{to:"/admin/users",className:"glass-panel p-4 border-slate-800 hover:border-sky-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-sky-500/10 text-sky-400 flex items-center justify-center",children:n.jsx(Hn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-sky-400",children:"用户中枢"}),n.jsx("div",{className:"text-xs text-slate-400",children:"跨校开户、改密与封禁"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-sky-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ye,{to:"/admin/devices",className:"glass-panel p-4 border-slate-800 hover:border-emerald-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:n.jsx(Vn,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-emerald-400",children:"设备集控"}),n.jsx("div",{className:"text-xs text-slate-400",children:"心跳、远程指令与清退"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-emerald-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ye,{to:"/admin/codes",className:"glass-panel p-4 border-slate-800 hover:border-amber-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group relative overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-sm font-semibold text-white group-hover:text-amber-400 flex items-center gap-1.5",children:["激活码大盘",n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-300 font-normal",children:"快速生成"})]}),n.jsx("div",{className:"text-xs text-slate-400",children:"生成、绑定与废除"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-amber-400 transition-transform group-hover:translate-x-1"})]}),n.jsxs(ye,{to:"/admin/broadcast",className:"glass-panel p-4 border-slate-800 hover:border-rose-500/50 hover:bg-slate-800/30 transition-all flex items-center justify-between group",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 text-rose-400 flex items-center justify-center",children:n.jsx(br,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white group-hover:text-rose-400",children:"应急广播"}),n.jsx("div",{className:"text-xs text-slate-400",children:"全域群发与强置顶"})]})]}),n.jsx(js,{className:"w-4 h-4 text-slate-500 group-hover:text-rose-400 transition-transform group-hover:translate-x-1"})]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[n.jsxs("div",{className:"lg:col-span-2 glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Qt,{className:"w-4 h-4 text-indigo-400"}),"各校区终端在线统计"]}),n.jsx(ye,{to:"/admin/tenants",className:"text-xs text-indigo-400 hover:underline",children:"管理学校 →"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"pb-3 font-medium",children:"学校名称"}),n.jsx("th",{className:"pb-3 font-medium",children:"班级数"}),n.jsx("th",{className:"pb-3 font-medium",children:"设备数"}),n.jsx("th",{className:"pb-3 font-medium",children:"在线状态"}),n.jsx("th",{className:"pb-3 font-medium text-right",children:"在线率"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o.map(D=>{const Q=D.deviceCount>0?Math.round(D.onlineCount/D.deviceCount*100):0;return n.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[n.jsxs("td",{className:"py-3 font-medium text-white flex items-center gap-2",children:[n.jsx("span",{children:D.name}),n.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:["(",D.id,")"]})]}),n.jsx("td",{className:"py-3 text-slate-300",children:D.classroomCount}),n.jsx("td",{className:"py-3 text-slate-300",children:D.deviceCount}),n.jsx("td",{className:"py-3",children:n.jsxs("span",{className:"text-xs text-slate-300",children:[D.onlineCount," / ",D.deviceCount," 在线"]})}),n.jsx("td",{className:"py-3 text-right",children:n.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${Q>=80?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":Q>0?"bg-amber-500/10 text-amber-400 border border-amber-500/30":"bg-slate-800 text-slate-400"}`,children:[Q,"%"]})})]},D.id)})})]})})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(_s,{className:"w-4 h-4 text-amber-400"}),"管理员关键操作审计"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"不可篡改"})]}),n.jsx("div",{className:"space-y-3",children:p.length===0?n.jsx("div",{className:"text-center py-8 text-xs text-slate-500",children:"暂无审计记录"}):p.map(D=>n.jsxs("div",{className:"glass-card p-3 text-xs space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-indigo-300 font-mono",children:D.action}),n.jsx("span",{className:"text-[10px] text-slate-500",children:new Date(D.occurredAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-slate-300 text-[11px] line-clamp-1",children:D.details||D.targetId}),n.jsxs("div",{className:"flex items-center justify-between text-slate-500 text-[10px]",children:[n.jsxs("span",{children:["操作者: ",D.actorUsername]}),n.jsx("span",{className:"font-mono",children:D.targetType})]})]},D.id))})]})]})]})},ix=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(null),[S,k]=g.useState(null),[$,D]=g.useState(""),[Q,H]=g.useState(""),[P,J]=g.useState(!1),K=async()=>{try{const R=await oe.getAllDevices();l(R)}catch(R){console.error("Failed to load devices",R)}finally{u(!1)}};g.useEffect(()=>{K();const R=setInterval(K,5e3);return()=>clearInterval(R)},[]);const Y=async(R,se,Ce)=>{j(`${R}_${se}`),y(null);try{const je=await oe.sendDeviceCommand(R,se,Ce);y({deviceId:R,message:je.message,success:!0}),K()}catch(je){y({deviceId:R,message:je.message||"远程指令下发失败",success:!1})}finally{j(null)}},ne=R=>{k(R),D(R.hostname||""),H(R.classroomId||"")},U=async R=>{if(R.preventDefault(),!!S){J(!0);try{await oe.updateDevice(S.deviceId,{hostname:$.trim()||void 0,classroomId:Q.trim()||void 0}),y({deviceId:S.deviceId,message:"设备信息更新成功",success:!0}),k(null),K()}catch(se){y({deviceId:S.deviceId,message:se.message||"更新设备失败",success:!1})}finally{J(!1)}}},Z=async R=>{if(window.confirm(`高危操作确认:确定要注销并清退设备 [${R.deviceId} (${R.hostname||R.classroomName})] 吗? 清退后该设备将无法接入,需重新生成激活码绑定!`)){j(`decommission_${R.deviceId}`);try{await oe.decommissionDevice(R.deviceId),y({deviceId:R.deviceId,message:"设备已成功清退并注销",success:!0}),K()}catch(se){y({deviceId:R.deviceId,message:se.message||"清退设备失败",success:!1})}finally{j(null)}}},ge=R=>{if(!R)return"从无心跳";const se=Math.floor((Date.now()-new Date(R).getTime())/1e3);return se<10?"刚刚 (几秒前)":se<60?`${se} 秒前`:se<3600?`${Math.floor(se/60)} 分钟前`:`${Math.floor(se/3600)} 小时前`},xe=a.filter(R=>R.tenantName.toLowerCase().includes(d.toLowerCase())||R.classroomName.toLowerCase().includes(d.toLowerCase())||R.deviceId.toLowerCase().includes(d.toLowerCase())||R.hostname&&R.hostname.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备集控中心"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"实时监控教室终端健康心跳与服务状态,支持在线秒级下发或离线指令入队补发、元数据变更与清退"})]}),n.jsxs("div",{className:"flex items-center gap-2 self-start sm:self-auto",children:[n.jsxs("button",{onClick:()=>{u(!0),K()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新状态"]}),n.jsxs(ye,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-600/25 transition-all",children:[n.jsx(ut,{className:"w-3.5 h-3.5 text-amber-300"}),"生成新设备激活码"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between transition-all ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsxs("span",{children:["[设备 ",m.deviceId,"] ",m.message]})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:R=>f(R.target.value),placeholder:"按学校、班级、设备编号或计算机名过滤...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"设备编号 / 主机名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"运行状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"心跳与 IP"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"版本"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"运维指令与管理"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:xe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在同步设备状态...":"暂无匹配的设备"})}):xe.map(R=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:R.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:R.tenantName})]}),n.jsxs("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:[n.jsx("div",{children:R.deviceId}),n.jsxs("div",{className:"text-[11px] text-slate-500 font-sans mt-0.5 flex items-center gap-1",children:[n.jsx(Vn,{className:"w-3 h-3 text-slate-500"}),n.jsx("span",{children:R.hostname||"Classroom-PC"})]})]}),n.jsx("td",{className:"py-4 px-4",children:R.isOnline?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),n.jsx("span",{children:"在线 (实时连通)"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-400",title:"指令将入队,上线时自动补发",children:[n.jsx(Kn,{className:"w-3 h-3 text-amber-500"}),n.jsx("span",{children:"离线 (支持离线入队)"})]})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:ge(R.lastHeartbeat)}),n.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5 font-mono",children:R.remoteIp||"127.0.0.1"})]}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-300 font-mono",children:["v",R.clientVersion||"2.1.0"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>Y(R.deviceId,"self_check"),disabled:p===`${R.deviceId}_self_check`,className:"px-2 py-1 rounded-lg bg-indigo-600/10 hover:bg-indigo-600/20 border border-indigo-500/30 text-indigo-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发远程自检指令 (若离线将入队补发)",children:[n.jsx(ua,{className:"w-3 h-3"}),"自检"]}),n.jsxs("button",{onClick:()=>Y(R.deviceId,"restart_client"),disabled:p===`${R.deviceId}_restart_client`,className:"px-2 py-1 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-400 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"远程重启前台 WPF Client 弹窗进程",children:[n.jsx(M0,{className:"w-3 h-3"}),"重启"]}),n.jsxs("button",{onClick:()=>Y(R.deviceId,"refresh_config"),disabled:p===`${R.deviceId}_refresh_config`,className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-xs font-medium transition-colors disabled:opacity-40 flex items-center gap-1",title:"下发配置刷新指令",children:[n.jsx(bt,{className:"w-3 h-3"}),"刷新"]}),n.jsx("button",{onClick:()=>ne(R),className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 transition-colors",title:"重命名或调整班级绑定",children:n.jsx(Kd,{className:"w-3.5 h-3.5"})}),n.jsx("button",{onClick:()=>Z(R),disabled:p===`decommission_${R.deviceId}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"清退并注销设备",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},R.deviceId))})]})})}),S&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"调整设备元数据"}),n.jsxs("p",{className:"text-xs text-slate-400",children:["设备唯一识别码: ",n.jsx("span",{className:"font-mono text-indigo-400",children:S.deviceId})]}),n.jsxs("form",{onSubmit:U,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"计算机名 / 主机标识 (Hostname)"}),n.jsx("input",{type:"text",value:$,onChange:R=>D(R.target.value),placeholder:"例如: LAB-BUILDING-201-PC",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"所属班级编号 (Classroom ID)"}),n.jsx("input",{type:"text",value:Q,onChange:R=>H(R.target.value),placeholder:"例如: cls_801",className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>k(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:P,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:P?"保存中...":"确认保存"})]})]})]})})]})},ox=()=>{const[a]=dp(),[l,o]=g.useState([]),[u,d]=g.useState([]),[f,m]=g.useState(!0),[y,p]=g.useState(null),[j,S]=g.useState(""),[k,$]=g.useState(""),[D,Q]=g.useState(!1),[H,P]=g.useState(""),[J,K]=g.useState([]),[Y,ne]=g.useState(!1),[U,Z]=g.useState(""),[ge,xe]=g.useState(!1),[R,se]=g.useState(""),[Ce,je]=g.useState(!1),[O,ve]=g.useState(null),Pe=async()=>{try{const[E,N]=await Promise.all([oe.getAdminActivationCodes(),oe.getTenants()]);o(E),d(N),N.length>0&&!H&&P(N[0].id)}catch(E){console.error("Failed to load activation codes",E)}finally{m(!1)}};g.useEffect(()=>{Pe()},[]),g.useEffect(()=>{const E=a.get("tenantId"),N=a.get("openGenerate")==="true";E&&($(E),P(E),N&&Q(!0))},[a]),g.useEffect(()=>{H&&(ne(!0),oe.getAdminClasses(H).then(E=>{K(E),E.length>0?(Z(E[0].id),xe(!1)):(Z(""),xe(!0))}).catch(E=>{console.warn("Could not load classes for tenant:",H,E),K([]),xe(!0)}).finally(()=>ne(!1)))},[H]);const _e=E=>{navigator.clipboard.writeText(E),p(E),setTimeout(()=>p(null),2e3)},W=async E=>{E.preventDefault();const N=ge?R.trim():U.trim();if(!H||!N){alert("请选择学校及目标班级");return}je(!0);try{const L=await oe.generateAdminCode(H,N),ae=u.find(fe=>fe.id===H),ue=J.find(fe=>fe.id===N);ve({code:L.code,schoolName:(ae==null?void 0:ae.name)||H,className:(ue==null?void 0:ue.displayName)||N}),Q(!1),se(""),Pe()}catch(L){alert(L.message||"生成激活码失败")}finally{je(!1)}},_=async E=>{if(window.confirm(`确定要废弃/删除激活码 [${E}] 吗?废弃后将无法用于设备初始化绑定。`))try{await oe.deleteActivationCode(E),Pe()}catch(N){alert(N.message||"删除激活码失败")}},V=l.filter(E=>{const N=!k||E.tenantId===k,L=E.code.toLowerCase().includes(j.toLowerCase())||E.classroomName.toLowerCase().includes(j.toLowerCase())||E.tenantName.toLowerCase().includes(j.toLowerCase());return N&&L});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:n.jsx(ut,{className:"w-4 h-4"})}),n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备激活码大盘"})]}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m(!0),Pe()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${f?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{ve(null),Q(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold transition-all shadow-lg shadow-amber-500/20 active:scale-95",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]})]}),O&&n.jsxs("div",{className:"glass-panel p-5 border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:n.jsx(Jd,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-emerald-300",children:"激活码生成成功!"}),n.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["归属:",n.jsx("span",{className:"font-medium text-white",children:O.schoolName})," / ",n.jsx("span",{className:"font-medium text-white",children:O.className}),"(有效期 7 天,一次性硬件绑定)"]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"px-4 py-1.5 rounded-xl bg-slate-900 border border-emerald-500/50 font-mono text-xl font-bold text-emerald-400 tracking-wider",children:O.code}),n.jsx("button",{onClick:()=>_e(O.code),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors",children:y===O.code?n.jsxs(n.Fragment,{children:[n.jsx(Fl,{className:"w-3.5 h-3.5"}),"已复制"]}):n.jsxs(n.Fragment,{children:[n.jsx(Yo,{className:"w-3.5 h-3.5"}),"一键复制"]})})]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:E=>S(E.target.value),placeholder:"搜索激活码、班级或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:k,onChange:E=>$(E.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsxs("option",{value:"",children:["全部学校 (",u.length,")"]}),u.map(E=>n.jsxs("option",{value:E.id,children:[E.name," (",E.id,")"]},E.id))]})]}),n.jsxs("div",{className:"ml-auto text-xs text-slate-400",children:["共 ",n.jsx("span",{className:"text-white font-medium",children:V.length})," 个激活码"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定学校 / 班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:V.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-400",children:n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[n.jsx(ut,{className:"w-8 h-8 text-slate-600"}),n.jsx("div",{className:"text-sm font-medium",children:f?"正在读取激活码...":"暂无匹配的激活码"}),n.jsx("div",{className:"text-xs text-slate-500",children:"点击右上角“生成新激活码”即可为任意学校教室开通绑定码"}),n.jsxs("button",{onClick:()=>Q(!0),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium",children:[n.jsx(Qn,{className:"w-3.5 h-3.5"}),"立即生成激活码"]})]})})}):V.map(E=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-mono font-bold text-indigo-400 text-base",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:E.code}),n.jsx("button",{onClick:()=>_e(E.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:y===E.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]})}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:E.classroomName}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:E.tenantName})]}),n.jsx("td",{className:"py-4 px-4",children:E.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[n.jsx(Pt,{className:"w-3 h-3"}),"已激活绑定"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[n.jsx(Kn,{className:"w-3 h-3"}),"等待激活"]})}),n.jsx("td",{className:"py-4 px-4 text-xs font-mono text-slate-300",children:E.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:E.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-400",children:[new Date(E.expiresAt).toLocaleDateString()," ",new Date(E.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:()=>_e(E.code),className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:y===E.code?"已复制":"复制"}),n.jsx("button",{onClick:()=>_(E.code),className:"p-1 rounded text-slate-500 hover:text-rose-400 transition-colors",title:"废弃/删除此激活码",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},E.code))})]})})}),D&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl rounded-2xl animate-in zoom-in-95 duration-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-amber-400"}),"生成班级设备激活码"]}),n.jsxs("form",{onSubmit:W,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属学校 / 租户"}),n.jsx("select",{value:H,onChange:E=>P(E.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:u.map(E=>n.jsxs("option",{value:E.id,children:[E.name," (",E.id,") ",E.isActive?"":"[已冻结]"]},E.id))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-slate-300",children:"目标班级"}),n.jsx("button",{type:"button",onClick:()=>xe(!ge),className:"text-[11px] text-amber-400 hover:underline",children:ge?"从班级列表选择":"手动输入班级ID"})]}),Y?n.jsxs("div",{className:"text-xs text-slate-400 py-2.5 px-3 bg-slate-900 rounded-xl border border-slate-800 flex items-center gap-2",children:[n.jsx(bt,{className:"w-3.5 h-3.5 animate-spin"}),"正在读取该校班级列表..."]}):ge?n.jsx("input",{type:"text",value:R,onChange:E=>se(E.target.value),placeholder:"输入班级编号,如 cls_801",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}):J.length>0?n.jsx("select",{value:U,onChange:E=>Z(E.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:J.map(E=>n.jsxs("option",{value:E.id,children:[E.displayName," (",E.id,")"]},E.id))}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-xs text-amber-400/90 flex items-center gap-1.5",children:[n.jsx(Sn,{className:"w-3.5 h-3.5 shrink-0"}),"该校暂无预设班级,请手动输入班级代码:"]}),n.jsx("input",{type:"text",value:R,onChange:E=>se(E.target.value),placeholder:"如 cls_801 或 cls_new",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]})]}),n.jsxs("div",{className:"p-3 bg-slate-900/60 rounded-xl border border-slate-800 text-xs text-slate-400 space-y-1",children:[n.jsx("div",{className:"text-slate-300 font-medium",children:"💡 使用说明:"}),n.jsx("div",{children:"1. 激活码生成后有效期为 7 天;"}),n.jsx("div",{children:"2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>Q(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Ce,className:"px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold disabled:opacity-50 transition-all shadow-md shadow-amber-500/20",children:Ce?"生成中...":"立即生成激活码"})]})]})]})})]})},ax=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),m=async()=>{try{const p=await oe.getAdminNotifications(100);l(p)}catch(p){console.error("Failed to load notifications",p)}finally{u(!1)}};g.useEffect(()=>{m();const p=setInterval(m,8e3);return()=>clearInterval(p)},[]);const y=a.filter(p=>p.className.toLowerCase().includes(d.toLowerCase())||p.senderName.toLowerCase().includes(d.toLowerCase())||p.message.toLowerCase().includes(d.toLowerCase())||p.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网呼叫历史与回执审计"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"追踪全网每条通知从下发、教室大屏接收、到学生点击确认的全流程时间戳与 ACK 回执"})]}),n.jsxs("button",{onClick:()=>{u(!0),m()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700 self-start sm:self-auto",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新审计"]})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:p=>f(p.target.value),placeholder:"搜索消息内容、班级或教师姓名...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"目标班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"通知正文"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"发起老师"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"下发时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"回执状态 (ACK)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"确认时间"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:y.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在加载审计数据...":"暂无呼叫历史记录"})}):y.map(p=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:p.className}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:p.classId})]}),n.jsxs("td",{className:"py-4 px-4 text-slate-200 max-w-md",children:[n.jsx("div",{className:"font-medium text-sm",children:p.message}),n.jsx("div",{className:"text-[11px] font-mono text-slate-500 mt-0.5",children:p.id})]}),n.jsx("td",{className:"py-4 px-4 text-slate-300 text-xs",children:p.senderName}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(p.createdAt).toLocaleTimeString()}),n.jsxs("td",{className:"py-4 px-4",children:[p.status==="Acknowledged"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),"学生已点击确认"]}),p.status==="Delivered"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/30",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),"已送达教室大屏"]}),p.status==="Sent"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),"云端下发中"]}),p.status==="Timeout"&&n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"超时自动关闭"})]}),n.jsx("td",{className:"py-4 px-4 text-right text-xs text-slate-400",children:p.confirmedAt?n.jsx("span",{className:"text-emerald-400 font-mono",children:new Date(p.confirmedAt).toLocaleTimeString()}):n.jsx("span",{className:"text-slate-600",children:"-"})})]},p.id))})]})})})]})},cx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(""),[m,y]=g.useState(null),[p,j]=g.useState(!1),[S,k]=g.useState({id:"",name:""}),[$,D]=g.useState(!1),[Q,H]=g.useState(null),[P,J]=g.useState({name:"",isActive:!0}),[K,Y]=g.useState(!1),ne=async()=>{try{const R=await oe.getTenants();l(R)}catch(R){console.error("Failed to load tenants",R)}finally{u(!1)}};g.useEffect(()=>{ne()},[]);const U=async R=>{if(R.preventDefault(),!(!S.id.trim()||!S.name.trim())){D(!0);try{await oe.createTenant({id:S.id.trim(),name:S.name.trim()}),y({text:`学校 [${S.name}] 创建成功!`,success:!0}),j(!1),k({id:"",name:""}),ne()}catch(se){y({text:se.message||"创建学校失败",success:!1})}finally{D(!1)}}},Z=R=>{H(R),J({name:R.name,isActive:R.isActive})},ge=async R=>{if(R.preventDefault(),!(!Q||!P.name.trim())){Y(!0);try{await oe.updateTenant(Q.id,{name:P.name.trim(),isActive:P.isActive}),y({text:`学校 [${P.name}] 配置已更新`,success:!0}),H(null),ne()}catch(se){y({text:se.message||"更新学校配置失败",success:!1})}finally{Y(!1)}}},xe=a.filter(R=>R.name.toLowerCase().includes(d.toLowerCase())||R.id.toLowerCase().includes(d.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"学校租户生命周期管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"统筹多校区租户实体,支持新校区入驻配置、基础信息变更与服务启停冻结"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{u(!0),ne()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${o?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建学校"]})]})]}),m&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${m.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:m.text})]}),n.jsx("button",{onClick:()=>y(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400"}),n.jsx("input",{type:"text",value:d,onChange:R=>f(R.target.value),placeholder:"按学校标识代码 (ID) 或名称搜索...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"}),d&&n.jsx("button",{onClick:()=>f(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校名称 / 标识码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级总数"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"终端大屏 (在线/总计)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"服务状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"接入时间"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"管理操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:xe.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:o?"正在读取租户列表...":"暂无匹配的学校租户"})}):xe.map(R=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 font-bold",children:n.jsx(Qt,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-white",children:R.name}),n.jsx("div",{className:"text-xs text-slate-500 font-mono mt-0.5",children:R.id})]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700",children:[n.jsx(Nr,{className:"w-3.5 h-3.5 text-indigo-400"}),n.jsxs("span",{children:[R.classroomCount," 个班级"]})]})}),n.jsx("td",{className:"py-4 px-4 text-xs",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"font-semibold text-emerald-400",children:[R.onlineCount," 在线"]}),n.jsx("span",{className:"text-slate-500",children:"/"}),n.jsxs("span",{className:"text-slate-400",children:[R.deviceCount," 总屏"]})]})}),n.jsx("td",{className:"py-4 px-4",children:R.isActive?n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[n.jsx(Pt,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"正常运营"})]}):n.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"已停用冻结"})]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(R.createdAt).toLocaleDateString()}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsxs(ye,{to:`/admin/codes?tenantId=${R.id}&openGenerate=true`,className:"px-2.5 py-1.5 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"为此学校生成班级设备激活码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成激活码"]}),n.jsxs("button",{onClick:()=>Z(R),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",children:[n.jsx(Kd,{className:"w-3 h-3"}),"编辑配置"]})]})})]},R.id))})]})})}),p&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"接入新学校租户"}),n.jsxs("form",{onSubmit:U,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校唯一标识代码 (Tenant ID)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: t_beijing_no8 或 bj_highschool",value:S.id,onChange:R=>k({...S,id:R.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"只能包含小写字母、数字和下划线,作为多租户隔离主键不可篡改"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称 (Display Name)"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 北京市第四中学",value:S.name,onChange:R=>k({...S,name:R.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:$,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:$?"正在创建...":"确认接入"})]})]})]})}),Q&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["编辑学校配置: ",Q.id]}),n.jsxs("form",{onSubmit:ge,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称"}),n.jsx("input",{type:"text",required:!0,value:P.name,onChange:R=>J({...P,name:R.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"运营状态"}),n.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:P.isActive===!0,onChange:()=>J({...P,isActive:!0}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-emerald-400",children:"正常运营"})]}),n.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"isActive",checked:P.isActive===!1,onChange:()=>J({...P,isActive:!1}),className:"text-indigo-600 focus:ring-indigo-500"}),n.jsx("span",{className:"text-sm text-rose-400",children:"停用冻结 (拒绝该校任何指令)"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>H(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:K,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:K?"保存中...":"保存更改"})]})]})]})})]})},ux=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(""),[p,j]=g.useState(""),[S,k]=g.useState(""),[$,D]=g.useState(null),[Q,H]=g.useState(!1),[P,J]=g.useState({tenantId:"",username:"",password:"",fullName:"",role:"Teacher"}),[K,Y]=g.useState(!1),[ne,U]=g.useState(null),[Z,ge]=g.useState(""),[xe,R]=g.useState(!1),[se,Ce]=g.useState(null),je=async()=>{try{const[_,V]=await Promise.all([oe.getUsers(p||void 0,S||void 0),oe.getTenants()]);l(_),u(V)}catch(_){console.error("Failed to load user management data",_)}finally{f(!1)}};g.useEffect(()=>{je()},[p,S]);const O=async _=>{var V;if(_.preventDefault(),!P.tenantId||!P.username||!P.password||!P.fullName){D({text:"请填写所有必填字段",success:!1});return}Y(!0);try{await oe.createUser(P),D({text:`用户 [${P.username}] 创建成功!`,success:!0}),H(!1),J({tenantId:((V=o[0])==null?void 0:V.id)||"",username:"",password:"",fullName:"",role:"Teacher"}),je()}catch(E){D({text:E.message||"创建用户失败",success:!1})}finally{Y(!1)}},ve=async _=>{if(_.preventDefault(),!(!ne||!Z.trim())){R(!0);try{await oe.resetPassword(ne.id,Z.trim()),D({text:`用户 [${ne.username}] 的密码已重置成功`,success:!0}),U(null),ge("")}catch(V){D({text:V.message||"重置密码失败",success:!1})}finally{R(!1)}}},Pe=async _=>{const V=!_.isLocked,E=V?`确定要锁定账号 [${_.username}] 吗?锁定后该用户将无法登录系统。`:`确定要解锁账号 [${_.username}] 吗?`;if(window.confirm(E)){Ce(`lock_${_.id}`);try{await oe.setUserLock(_.id,V),D({text:`用户 [${_.username}] 已成功${V?"锁定":"解锁"}`,success:!0}),je()}catch(N){D({text:N.message||"操作失败",success:!1})}finally{Ce(null)}}},_e=async _=>{if(_.role==="SuperAdmin"){alert("超级管理员账号不可删除");return}if(window.confirm(`警告:确定要永久删除用户 [${_.username} (${_.fullName})] 吗?此操作不可逆!`)){Ce(`delete_${_.id}`);try{await oe.deleteUser(_.id),D({text:`用户 [${_.username}] 已被删除`,success:!0}),je()}catch(V){D({text:V.message||"删除用户失败",success:!1})}finally{Ce(null)}}},W=a.filter(_=>_.username.toLowerCase().includes(m.toLowerCase())||_.fullName.toLowerCase().includes(m.toLowerCase())||_.tenantName.toLowerCase().includes(m.toLowerCase()));return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"多租户统一用户中枢"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"全网教职工与校级管理员统一管控,支持跨校账号开户、密码强行重置、异常封禁与权限审计"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{f(!0),je()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[n.jsx(bt,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`}),"刷新"]}),n.jsxs("button",{onClick:()=>{o.length>0&&!P.tenantId&&J(_=>({..._,tenantId:o[0].id})),H(!0)},className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建用户"]})]})]}),$&&n.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${$.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[$.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0"}):n.jsx(Sn,{className:"w-5 h-5 text-rose-400 shrink-0"}),n.jsx("span",{children:$.text})]}),n.jsx("button",{onClick:()=>D(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),n.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-80",children:[n.jsx(Cr,{className:"w-4 h-4 text-slate-400 shrink-0"}),n.jsx("input",{type:"text",value:m,onChange:_=>y(_.target.value),placeholder:"搜索用户名、姓名或学校...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Qt,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:p,onChange:_=>j(_.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部学校 (全网)"}),o.map(_=>n.jsxs("option",{value:_.id,children:[_.name," (",_.id,")"]},_.id))]})]}),n.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[n.jsx(Nr,{className:"w-4 h-4 text-slate-400"}),n.jsxs("select",{value:S,onChange:_=>k(_.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"全部角色"}),n.jsx("option",{value:"SuperAdmin",children:"平台超级管理员"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员"}),n.jsx("option",{value:"Teacher",children:"普通授课教师"})]})]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"用户姓名 / 登录名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"归属学校"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"角色身份"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"生命周期操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:W.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:d?"正在同步用户中枢...":"暂无匹配的用户"})}):W.map(_=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-semibold text-white",children:_.fullName}),n.jsx("div",{className:"text-xs text-slate-400 font-mono mt-0.5",children:_.username})]}),n.jsxs("td",{className:"py-4 px-4 text-xs text-slate-300",children:[n.jsx("div",{children:_.tenantName}),n.jsx("div",{className:"text-[11px] text-slate-500 font-mono",children:_.tenantId})]}),n.jsx("td",{className:"py-4 px-4",children:_.role==="SuperAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[n.jsx(Bl,{className:"w-3 h-3"}),"超级管理员"]}):_.role==="SchoolAdmin"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-indigo-500/10 border border-indigo-500/30 text-indigo-400",children:[n.jsx(Qt,{className:"w-3 h-3"}),"校区管理员"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-300",children:[n.jsx(Nr,{className:"w-3 h-3"}),"授课老师"]})}),n.jsx("td",{className:"py-4 px-4",children:_.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-rose-500/15 text-rose-400 border border-rose-500/30",children:[n.jsx(bs,{className:"w-3 h-3"}),"已锁定封禁"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:_.lastLoginAt?new Date(_.lastLoginAt).toLocaleString():"尚未登录"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[n.jsxs("button",{onClick:()=>U(_),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"强制重置登录密码",children:[n.jsx(ut,{className:"w-3 h-3 text-amber-400"}),"重置密码"]}),_.role!=="SuperAdmin"&&n.jsxs("button",{onClick:()=>Pe(_),disabled:se===`lock_${_.id}`,className:`px-2 py-1 rounded-lg border text-xs font-medium transition-colors inline-flex items-center gap-1 ${_.isLocked?"bg-emerald-600/15 border-emerald-500/30 text-emerald-300 hover:bg-emerald-600/25":"bg-rose-600/15 border-rose-500/30 text-rose-300 hover:bg-rose-600/25"}`,title:_.isLocked?"解除账号锁定":"锁定账号",children:[_.isLocked?n.jsx(ea,{className:"w-3 h-3"}):n.jsx(bs,{className:"w-3 h-3"}),_.isLocked?"解锁":"锁定"]}),_.role!=="SuperAdmin"&&n.jsx("button",{onClick:()=>_e(_),disabled:se===`delete_${_.id}`,className:"p-1.5 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors",title:"删除用户",children:n.jsx(da,{className:"w-3.5 h-3.5"})})]})})]},_.id))})]})})}),Q&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsx("h2",{className:"text-lg font-bold text-white",children:"开通新用户账号"}),n.jsxs("form",{onSubmit:O,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"归属学校"}),n.jsxs("select",{required:!0,value:P.tenantId,onChange:_=>J({...P,tenantId:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"-- 请选择学校 --"}),o.map(_=>n.jsxs("option",{value:_.id,children:[_.name," (",_.id,")"]},_.id))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户角色"}),n.jsxs("select",{value:P.role,onChange:_=>J({...P,role:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"Teacher",children:"普通授课老师 (Teacher)"}),n.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"})]}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"平台超级管理员只可通过系统底层配置文件委任,禁止通过控制台赋予。"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: teacher_li 或 admin_no4",value:P.username,onChange:_=>J({...P,username:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"用户真实姓名"}),n.jsx("input",{type:"text",required:!0,placeholder:"例如: 李老师",value:P.fullName,onChange:_=>J({...P,fullName:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始登录密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"设置 6 位以上密码",value:P.password,onChange:_=>J({...P,password:_.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>H(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:K,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:K?"正在创建...":"确认开户"})]})]})]})}),ne&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md p-6 space-y-4",children:[n.jsxs("h2",{className:"text-lg font-bold text-white",children:["重置用户密码: ",ne.username]}),n.jsxs("p",{className:"text-xs text-slate-400",children:["为归属于 [",ne.tenantName,"] 的 [",ne.fullName,"] 强行设置新密码。"]}),n.jsxs("form",{onSubmit:ve,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码"}),n.jsx("input",{type:"password",required:!0,placeholder:"请输入新密码",value:Z,onChange:_=>ge(_.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:()=>{U(null),ge("")},className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"submit",disabled:xe,className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold shadow-lg shadow-amber-500/25 transition-all disabled:opacity-50",children:xe?"重置中...":"确认重置"})]})]})]})})]})},dx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState([]),[m,y]=g.useState(!1),[p,j]=g.useState({tenantId:"",title:"⚠️ 全校紧急预警通报",message:"",voice:!0,shake:!0,durationSeconds:30}),[S,k]=g.useState(!1),[$,D]=g.useState(!1),[Q,H]=g.useState(null),[P,J]=g.useState(null),[K,Y]=g.useState(null),ne=[{title:"⚠️ 消防紧急疏散演练",content:"全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速、有序撤离至操场,不要慌乱!",duration:60,shake:!0,voice:!0,icon:x0},{title:"⛈️ 恶劣雷雨大风避险通报",content:"气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁学生前往走廊与室外活动!",duration:45,shake:!0,voice:!0,icon:d0},{title:"📢 临时紧急集合通知",content:"请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学保持教室内安静自习。",duration:30,shake:!1,voice:!0,icon:Hn},{title:"🔔 全校临时作息调整",content:"因突发教学安排,今天下午放学时间调整为 16:30,请任课老师提醒学生整理个人物品按时离校。",duration:30,shake:!1,voice:!0,icon:C0}],U=async()=>{try{const O=await oe.getTenants();l(O)}catch(O){console.error("Failed to load tenants",O)}finally{u(!1)}},Z=async()=>{y(!0);try{const O=await oe.getAdminNotifications(15);f(O)}catch(O){console.error("Failed to load recent broadcasts",O)}finally{y(!1)}};g.useEffect(()=>{U(),Z()},[]);const ge=O=>{j(ve=>({...ve,title:O.title,message:O.content,durationSeconds:O.duration,shake:O.shake,voice:O.voice}))},xe=O=>{if(O.preventDefault(),!p.message.trim()){alert("请输入广播通知正文");return}k(!0)};g.useEffect(()=>{if(!Q)return;let O=!1,ve;const Pe=Date.now(),_e=async()=>{try{const W=await oe.getBroadcastReceiptSummary(Q);if(O)return;J(W),!W.completed&&Date.now()-Pe<6e4&&(ve=window.setTimeout(_e,2e3))}catch{!O&&Date.now()-Pe<6e4&&(ve=window.setTimeout(_e,3e3))}};return _e(),()=>{O=!0,ve&&clearTimeout(ve)}},[Q]);const R=async()=>{D(!0);try{const O=await oe.sendEmergencyBroadcast({...p,tenantId:p.tenantId||void 0});O.broadcastId&&H(O.broadcastId),Y({dispatchedCount:O.dispatchedCount,targetSchools:O.targetSchools,message:O.message,success:!0,timestamp:new Date().toLocaleTimeString()}),k(!1),j(ve=>({...ve,message:""})),Z()}catch(O){Y({dispatchedCount:0,targetSchools:0,message:O.message||"应急广播下发失败",success:!1,timestamp:new Date().toLocaleTimeString()}),k(!1)}finally{D(!1)}},se=a.find(O=>O.id===p.tenantId),Ce=se?se.classroomCount:a.reduce((O,ve)=>O+(ve.classroomCount||0),0),je=se?se.deviceCount:a.reduce((O,ve)=>O+(ve.deviceCount||0),0);return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(br,{className:"w-5 h-5 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全域紧急应急广播"}),n.jsx("p",{className:"text-sm text-slate-400 mt-0.5",children:"超级管理员最高优先调度通道,覆盖全网多校区所有教室大屏终端,支持强置顶、TTS 语音播报与视效抖动"})]})]})}),K&&n.jsx("div",{className:`p-5 rounded-xl border transition-all animate-in fade-in slide-in-from-top-2 ${K.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[K.success?n.jsx(Pt,{className:"w-5 h-5 text-emerald-400 shrink-0 mt-0.5"}):n.jsx(ks,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"font-semibold text-sm",children:K.success?"全域紧急广播指令已成功下发":"广播下发遇到异常"}),n.jsx("p",{className:"text-xs text-slate-300 mt-1",children:K.message}),K.success&&n.jsxs("div",{className:"flex flex-wrap gap-4 mt-3 text-xs",children:[n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["目标学校: ",n.jsx("strong",{className:"text-white",children:K.targetSchools})," 所"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-200",children:["投递教室班级: ",n.jsx("strong",{className:"text-emerald-400",children:K.dispatchedCount})," 间"]}),n.jsxs("span",{className:"px-2.5 py-1 rounded bg-black/30 border border-slate-700/60 text-slate-400 font-mono",children:["下发时间: ",K.timestamp]})]}),P&&n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-2 mt-4 pt-3 border-t border-slate-700/50 text-xs",children:[n.jsxs("div",{className:"p-2 rounded-lg bg-black/40 border border-slate-700/60 text-center",children:[n.jsx("span",{className:"text-[11px] text-slate-400 block",children:"目标终端设备"}),n.jsx("strong",{className:"text-white text-sm font-mono",children:P.targetDevices})]}),n.jsxs("div",{className:"p-2 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-center",children:[n.jsx("span",{className:"text-[11px] text-emerald-300 block",children:"已在屏幕显示"}),n.jsx("strong",{className:"text-emerald-400 text-sm font-mono",children:P.displayed})]}),n.jsxs("div",{className:"p-2 rounded-lg bg-amber-500/10 border border-amber-500/30 text-center",children:[n.jsx("span",{className:"text-[11px] text-amber-300 block",children:"排队 / 离线等待"}),n.jsx("strong",{className:"text-amber-400 text-sm font-mono",children:P.pending})]}),n.jsxs("div",{className:"p-2 rounded-lg bg-slate-800 border border-slate-700 text-center",children:[n.jsx("span",{className:"text-[11px] text-slate-400 block",children:"已取消"}),n.jsx("strong",{className:"text-slate-300 text-sm font-mono",children:P.cancelled})]}),n.jsxs("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/30 text-center",children:[n.jsx("span",{className:"text-[11px] text-rose-300 block",children:"失败 / 超时"}),n.jsx("strong",{className:"text-rose-400 text-sm font-mono",children:P.failed})]})]})]})]}),n.jsx("button",{onClick:()=>{Y(null),H(null),J(null)},className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-4 h-4"})})]})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xs uppercase text-slate-400 font-semibold tracking-wider mb-3",children:"应急广播预设模板 (点击快速填装)"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:ne.map((O,ve)=>{const Pe=O.icon;return n.jsxs("button",{type:"button",onClick:()=>ge(O),className:"glass-panel p-3.5 border-slate-800 text-left hover:border-indigo-500/50 hover:bg-slate-800/40 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-slate-200 group-hover:text-indigo-400 mb-1",children:[n.jsx(Pe,{className:"w-4 h-4 text-indigo-400"}),n.jsx("span",{children:O.title})]}),n.jsx("p",{className:"text-[11px] text-slate-500 line-clamp-2",children:O.content})]},ve)})})]}),n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:xe,className:"space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Qt,{className:"w-3.5 h-3.5 text-indigo-400"}),"目标广播范围"]}),n.jsxs("span",{className:"text-[11px] text-slate-400 font-normal",children:["预计覆盖 ",Ce," 班级 / ",je," 大屏"]})]}),n.jsxs("select",{value:p.tenantId||"",onChange:O=>j({...p,tenantId:O.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",children:[n.jsx("option",{value:"",children:"🚨 全网所有学校与所有教室大屏 (全域覆盖)"}),a.map(O=>n.jsxs("option",{value:O.id,children:["仅该校: ",O.name," (",O.classroomCount," 班级, ",O.deviceCount," 大屏)"]},O.id))]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1.5",children:[n.jsx(Bl,{className:"w-3.5 h-3.5 text-rose-400"}),"广播标题"]}),n.jsx("input",{type:"text",required:!0,value:p.title,onChange:O=>j({...p,title:O.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500",placeholder:"例如: ⚠️ 全校紧急避险预警"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"广播正文内容 (将同步在所有大屏全屏高显并由 Windows TTS 朗读)"}),n.jsx("textarea",{required:!0,rows:4,value:p.message,onChange:O=>j({...p,message:O.target.value}),className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 font-sans",placeholder:"请输入紧急通报具体事项,语言力求简明扼要..."})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 pt-2 border-t border-slate-800",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-indigo-400"}),"展示持续时长: ",p.durationSeconds," 秒"]}),n.jsx("input",{type:"range",min:10,max:300,step:5,value:p.durationSeconds,onChange:O=>j({...p,durationSeconds:parseInt(O.target.value,10)}),className:"w-full accent-indigo-500 cursor-pointer"}),n.jsxs("div",{className:"flex justify-between text-[11px] text-slate-500 mt-1",children:[n.jsx("span",{children:"10秒"}),n.jsx("span",{children:"60秒"}),n.jsx("span",{children:"5分钟"})]})]}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.voice,onChange:O=>j({...p,voice:O.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-emerald-400"}),"TTS 语音朗读"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"大屏端通过系统扬声器朗读"})]})]})}),n.jsx("div",{className:"flex items-center",children:n.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-3 rounded-xl bg-slate-900/60 border border-slate-800 hover:border-slate-700 w-full",children:[n.jsx("input",{type:"checkbox",checked:p.shake,onChange:O=>j({...p,shake:O.target.checked}),className:"w-4 h-4 rounded accent-indigo-500"}),n.jsxs("div",{children:[n.jsxs("div",{className:"text-xs font-semibold text-white flex items-center gap-1.5",children:[n.jsx(X0,{className:"w-3.5 h-3.5 text-rose-400"}),"窗口视效震颤"]}),n.jsx("div",{className:"text-[11px] text-slate-500",children:"高频强抖动提醒上课师生"})]})]})})]}),n.jsx("div",{className:"pt-2 flex justify-end",children:n.jsxs("button",{type:"submit",disabled:$||!p.message.trim(),className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-sm font-semibold shadow-xl shadow-rose-600/30 transition-all disabled:opacity-50",children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"下发全域紧急广播..."})]})})]})}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[n.jsx(Zo,{className:"w-4 h-4 text-indigo-400"}),"最近全网广播与呼叫调度记录"]}),n.jsx("button",{onClick:Z,disabled:m,className:"text-xs text-indigo-400 hover:text-indigo-300 disabled:opacity-50",children:m?"刷新中...":"刷新记录"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-xs",children:[n.jsx("thead",{className:"text-[11px] uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2.5 px-3",children:"发起时间"}),n.jsx("th",{className:"py-2.5 px-3",children:"调度类型"}),n.jsx("th",{className:"py-2.5 px-3",children:"目标班级/范围"}),n.jsx("th",{className:"py-2.5 px-3",children:"通知内容"}),n.jsx("th",{className:"py-2.5 px-3 text-right",children:"投递状态"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"py-8 text-center text-slate-500",children:m?"正在加载历史记录...":"暂无最近调度记录"})}):d.slice(0,8).map(O=>n.jsxs("tr",{className:"hover:bg-slate-800/20",children:[n.jsx("td",{className:"py-3 px-3 font-mono text-slate-400 whitespace-nowrap",children:new Date(O.createdAt).toLocaleTimeString()}),n.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:O.priority==="Urgent"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/20 font-medium",children:[n.jsx(ks,{className:"w-3 h-3"}),"紧急通报"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/20",children:"日常呼叫"})}),n.jsx("td",{className:"py-3 px-3 text-white font-medium whitespace-nowrap",children:O.className||"全域广播"}),n.jsx("td",{className:"py-3 px-3 text-slate-300 max-w-xs truncate",children:O.message}),n.jsx("td",{className:"py-3 px-3 text-right whitespace-nowrap",children:O.status==="Cancelled"?n.jsx("span",{className:"text-slate-400",children:"已撤回关闭"}):O.status==="Acknowledged"?n.jsx("span",{className:"text-emerald-400 font-medium",children:"已确认"}):O.status==="Delivered"?n.jsx("span",{className:"text-sky-400",children:"大屏已接收"}):n.jsx("span",{className:"text-slate-400",children:"已发送"})})]},O.id))})]})})]}),S&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-lg w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-400",children:n.jsx(Bl,{className:"w-6 h-6 animate-pulse"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"全域极高优先级应急调度二次核验"}),n.jsx("p",{className:"text-xs text-rose-400/90 font-medium mt-0.5",children:"请谨慎操作:此指令将强制穿透终端并在全网大屏置顶展示"})]})]}),n.jsxs("div",{className:"space-y-3 mb-5",children:[n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 space-y-2 text-xs",children:[n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"目标受众范围:"}),n.jsx("span",{className:"text-white font-semibold",children:p.tenantId?`${(se==null?void 0:se.name)||p.tenantId} (${Ce} 班级)`:`全域所有学校 (${a.length} 所学校, 约 ${Ce} 班级)`})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"广播标题:"}),n.jsx("span",{className:"text-white font-medium",children:p.title})]}),n.jsxs("div",{className:"flex justify-between items-center text-slate-400",children:[n.jsx("span",{children:"展示时长与视效:"}),n.jsxs("span",{className:"text-slate-200",children:[p.durationSeconds," 秒 · ",p.voice?"TTS 语音":"无声音"," · ",p.shake?"视效抖动":"无抖动"]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3 rounded-xl border border-slate-800/80 text-xs",children:[n.jsx("span",{className:"text-slate-500 text-[11px] block mb-1",children:"播报正文内容:"}),n.jsx("p",{className:"text-slate-200 font-sans leading-relaxed",children:p.message})]}),n.jsx("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-[11px] text-rose-300/90 leading-relaxed",children:"⚠️ 确认后,云端将在毫秒内将此通报广播下发至所选教室大屏。终端如果处于上课或展示课件状态,也将直接浮现全屏红框强提醒!"})]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:$,onClick:()=>k(!1),className:"px-4 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"放弃下发"}),n.jsx("button",{type:"button",disabled:$,onClick:R,className:"px-5 py-2.5 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/30 transition-all flex items-center gap-2 disabled:opacity-50",children:$?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在全域调度广播..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"确认立即全网广播"})]})})]})]})})]})},hx=()=>{const[a,l]=g.useState(null),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),p=async()=>{f(!0),y(null);try{const[j,S]=await Promise.all([oe.getSchoolOverview(),oe.getSchoolDevices()]);l(j),u(S)}catch(j){y((j==null?void 0:j.message)||"加载学校总览与设备数据失败")}finally{f(!1)}};return g.useEffect(()=>{p();const j=Ot.onDeviceStatusChanged(k=>{u($=>{const D=k.state===1||String(k.state).toLowerCase()==="online",Q=$.map(P=>P.deviceId===k.deviceId?{...P,isOnline:D,lastHeartbeat:k.lastHeartbeat,clientVersion:k.agentVersion||P.clientVersion}:P),H=Q.filter(P=>P.isOnline).length;return l(P=>P?{...P,onlineCount:H}:null),Q})}),S=Ot.onHealthReportReceived(k=>{u($=>$.map(D=>D.deviceId===k.deviceId?{...D,healthStatus:k.overallStatus,lastHeartbeat:k.timestamp||new Date().toISOString()}:D))});return()=>{j(),S()}},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:(a==null?void 0:a.tenantName)||"本校管理后台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"管理本校班级配置、多媒体教室设备绑定与科任教师账号"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:p,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"已建班级"}),n.jsx(gr,{className:"w-4 h-4 text-sky-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.classCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"个教学班"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教室终端"}),n.jsx(Vn,{className:"w-4 h-4 text-indigo-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.deviceCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"台已安装"})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"实时在线"}),n.jsx(ua,{className:"w-4 h-4 text-emerald-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsxs("span",{className:"text-3xl font-bold text-emerald-400 tracking-tight flex items-center gap-2",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400 animate-ping inline-block"}),d?"-":(a==null?void 0:a.onlineCount)??0]}),n.jsxs("span",{className:"text-xs text-slate-400",children:["/ 总 ",d?"-":(a==null?void 0:a.deviceCount)??0]})]})]}),n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-medium text-slate-400",children:"教师账号"}),n.jsx(Hn,{className:"w-4 h-4 text-amber-400"})]}),n.jsxs("div",{className:"mt-3 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-3xl font-bold text-white tracking-tight",children:d?"-":(a==null?void 0:a.teacherCount)??0}),n.jsx("span",{className:"text-xs text-slate-400",children:"位老师"})]})]})]}),n.jsxs("div",{className:"glass-panel p-6 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(Vn,{className:"w-4 h-4 text-sky-400"}),"本校各教室设备状态与健康体检"]}),n.jsx(ye,{to:"/school-admin/classes",className:"text-xs text-sky-400 hover:text-sky-300 font-medium flex items-center gap-1",children:"班级管理"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"设备编号"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"在线状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"健康状态"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"最后心跳"}),n.jsx("th",{className:"py-3 px-4 font-medium",children:"版本"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在同步设备列表..."})]})})}):o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"text-center py-8 text-xs text-slate-500",children:"暂无已绑定的教室设备,请前往【本校激活码】生成激活码并在教室电脑安装"})}):o.map(j=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-3.5 px-4 font-medium text-white",children:j.classroomName}),n.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:j.deviceId}),n.jsx("td",{className:"py-3.5 px-4",children:j.isOnline?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"在线"]}):n.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线"})}),n.jsx("td",{className:"py-3.5 px-4",children:j.healthStatus==="Degraded"?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[n.jsx(Bl,{className:"w-3 h-3 text-amber-400"}),"亚健康"]}):j.healthStatus==="Healthy"||j.isOnline&&!j.healthStatus?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx(_s,{className:"w-3 h-3 text-emerald-400"}),"健康"]}):n.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"离线未检"})}),n.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400",children:j.lastHeartbeat?new Date(j.lastHeartbeat).toLocaleTimeString():"无"}),n.jsxs("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:["v",j.clientVersion||"2.1.0"]})]},j.deviceId))})]})})]})]})},fx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[S,k]=g.useState(""),[$,D]=g.useState(""),[Q,H]=g.useState(!1),[P,J]=g.useState(null),K=async()=>{try{const U=await oe.getSchoolClasses();l(U)}catch(U){console.error("Failed to load classes",U)}finally{u(!1)}};g.useEffect(()=>{K()},[]);const Y=async U=>{if(U.preventDefault(),!(!m||!p)){H(!0);try{await oe.createSchoolClass({id:m,displayName:p,grade:S,roomNumber:$}),f(!1),y(""),j(""),k(""),D(""),K()}catch(Z){alert(Z.message||"创建班级失败")}finally{H(!1)}}},ne=async U=>{try{const Z=await oe.generateSchoolCode(U);J({classId:U,code:Z.code})}catch(Z){alert(Z.message||"生成激活码失败")}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校班级管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"维护学校全部教学班级,并为各班级生成设备激活码"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"新建教学班"]})]}),P&&n.jsxs("div",{className:"p-4 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsxs("span",{className:"font-semibold",children:["【",P.classId,"】激活码已生成:"]}),n.jsx("span",{className:"font-mono text-base font-bold text-white ml-2 bg-slate-900 px-2 py-1 rounded",children:P.code}),n.jsx("span",{className:"text-xs text-emerald-400/80 ml-3",children:"(请在教室电脑运行 ClassNotifySetup.exe 输入该激活码完成绑定)"})]}),n.jsx("button",{onClick:()=>{navigator.clipboard.writeText(P.code),alert("激活码已复制!")},className:"px-3 py-1 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium",children:"复制激活码"})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级名称"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级编号 (ClassId)"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"年级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教室位置"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:a.map(U=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsx("td",{className:"py-4 px-4 font-semibold text-white",children:U.displayName}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:U.id}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:U.grade||"-"}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:U.roomNumber||"-"}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsxs("button",{onClick:()=>ne(U.id),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sky-600/10 hover:bg-sky-600/20 border border-sky-500/30 text-sky-400 text-xs font-medium transition-colors",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),"生成安装激活码"]})})]},U.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(gr,{className:"w-5 h-5 text-sky-400"}),"新建教学班级"]}),n.jsxs("form",{onSubmit:Y,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级编号 (唯一识别码)"}),n.jsx("input",{type:"text",value:m,onChange:U=>y(U.target.value),placeholder:"如 cls_803 或 cls_grade7_1",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级显示名称"}),n.jsx("input",{type:"text",value:p,onChange:U=>j(U.target.value),placeholder:"如 八年级(3)班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"年级 (可选)"}),n.jsx("input",{type:"text",value:S,onChange:U=>k(U.target.value),placeholder:"如 初二 / 高一",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教室位置 (可选)"}),n.jsx("input",{type:"text",value:$,onChange:U=>D(U.target.value),placeholder:"如 教学楼 303",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Q,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:Q?"创建中...":"确认创建"})]})]})]})})]})},mx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(!0),[d,f]=g.useState(!1),[m,y]=g.useState(""),[p,j]=g.useState(""),[S,k]=g.useState(""),[$,D]=g.useState("Teacher"),[Q,H]=g.useState(!1),[P,J]=g.useState(null),[K,Y]=g.useState(""),[ne,U]=g.useState(!1),[Z,ge]=g.useState(null),[xe,R]=g.useState(!1),[se,Ce]=g.useState(null),je=(W,_)=>{Ce({type:W,text:_}),setTimeout(()=>{Ce(V=>(V==null?void 0:V.text)===_?null:V)},4e3)},O=async()=>{try{const W=await oe.getSchoolTeachers();l(W)}catch(W){je("error",(W==null?void 0:W.message)||"加载教师列表失败")}finally{u(!1)}};g.useEffect(()=>{O()},[]);const ve=async W=>{if(W.preventDefault(),!(!m||!p||!S)){H(!0);try{await oe.createSchoolTeacher({username:m,password:p,fullName:S,role:$}),f(!1),y(""),j(""),k(""),je("success",`教师账号 ${S} 开设成功`),O()}catch(_){alert(_.message||"创建教师账号失败")}finally{H(!1)}}},Pe=async W=>{if(W.preventDefault(),!(!P||!K)){if(K.length<6){alert("新密码长度不能少于 6 位");return}U(!0);try{await oe.resetSchoolTeacherPassword(P.id,K),je("success",`已成功将教师 [${P.fullName}] 的密码重置`),J(null),Y("")}catch(_){alert(_.message||"重置密码失败")}finally{U(!1)}}},_e=async()=>{if(!Z)return;R(!0);const W=!Z.isLocked;try{await oe.setSchoolTeacherLock(Z.id,W),je("success",`已成功${W?"停用":"启用"}教师 [${Z.fullName}] 账号`),ge(null),O()}catch(_){alert(_.message||"操作失败")}finally{R(!1)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教师账号管理"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"为科任教师开设 ClassNotify 网页控制台与后续 Android 移动端登录权限"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"开设教师账号"]})]}),se&&n.jsxs("div",{className:`p-3.5 rounded-xl border text-xs flex items-center justify-between transition-all ${se.type==="success"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[se.type==="success"?n.jsx(Pt,{className:"w-4 h-4 text-emerald-400 shrink-0"}):n.jsx(ks,{className:"w-4 h-4 text-rose-400 shrink-0"}),n.jsx("span",{children:se.text})]}),n.jsx("button",{onClick:()=>Ce(null),className:"text-slate-400 hover:text-white",children:n.jsx(kr,{className:"w-3.5 h-3.5"})})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"教师姓名"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"登录账号"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"权限角色"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:o?n.jsx("tr",{children:n.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[n.jsx(kn,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-sky-400"}),n.jsx("span",{children:"正在加载教师列表..."})]})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:"暂未开设任何教师账号,请点击右上角按钮添加"})}):a.map(W=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-semibold text-white flex items-center gap-2",children:[W.role==="SchoolAdmin"?n.jsx(H0,{className:"w-4 h-4 text-sky-400"}):n.jsx(Nr,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:W.fullName})]}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-300",children:W.username}),n.jsx("td",{className:"py-4 px-4 text-xs",children:W.role==="SchoolAdmin"?n.jsx("span",{className:"px-2 py-0.5 rounded bg-sky-500/10 text-sky-400 border border-sky-500/30",children:"学校管理员"}):n.jsx("span",{className:"px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:"任课教师"})}),n.jsx("td",{className:"py-4 px-4",children:W.isLocked?n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-500/10 text-rose-400 border border-rose-500/30 text-xs font-medium",children:[n.jsx(bs,{className:"w-3 h-3"}),"已停用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 text-xs font-medium",children:[n.jsx(Pt,{className:"w-3 h-3"}),"正常可用"]})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400 font-mono",children:W.lastLoginAt?new Date(W.lastLoginAt).toLocaleString():n.jsxs("span",{className:"text-slate-600 flex items-center gap-1",children:[n.jsx(Kn,{className:"w-3 h-3"}),"从未登录"]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsx("div",{className:"inline-flex items-center gap-2",children:W.role==="Teacher"&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>{J(W),Y("")},className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-slate-800 hover:bg-slate-700 text-sky-400 hover:text-sky-300 text-xs font-medium border border-slate-700 transition-colors",title:"重置登录密码",children:[n.jsx(ut,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"重置密码"})]}),n.jsx("button",{type:"button",onClick:()=>ge(W),className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${W.isLocked?"bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 border-rose-500/30"}`,title:W.isLocked?"恢复账号":"停用账号",children:W.isLocked?n.jsxs(n.Fragment,{children:[n.jsx(ea,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"恢复"})]}):n.jsxs(n.Fragment,{children:[n.jsx(bs,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"停用"})]})})]})})})]},W.id))})]})})}),d&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(Hn,{className:"w-5 h-5 text-sky-400"}),"开设新账号"]}),n.jsxs("form",{onSubmit:ve,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"教师真实姓名"}),n.jsx("input",{type:"text",value:S,onChange:W=>k(W.target.value),placeholder:"如 王老师 / 李明",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录账号"}),n.jsx("input",{type:"text",value:m,onChange:W=>y(W.target.value),placeholder:"如 teacher_wang",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录初始密码"}),n.jsx("input",{type:"password",value:p,onChange:W=>j(W.target.value),placeholder:"••••••••",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"角色权限"}),n.jsxs("select",{value:$,onChange:W=>D(W.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",children:[n.jsx("option",{value:"Teacher",children:"普通科任教师 (仅呼叫与回执)"}),n.jsx("option",{value:"SchoolAdmin",children:"学校管理员 (可管理班级与账号)"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>f(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Q,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:Q?"开设计算中...":"确认开通"})]})]})]})}),P&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-sky-500/10 border border-sky-500/20 text-sky-400",children:n.jsx(ut,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"重置教师密码"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",P.fullName," (",P.username,")"]})]})]}),n.jsxs("form",{onSubmit:Pe,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"请输入新密码 (不少于 8 位)"}),n.jsx("input",{type:"text",autoFocus:!0,required:!0,minLength:8,value:K,onChange:W=>Y(W.target.value),placeholder:"例如: Teacher@2026",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm font-mono focus:ring-2 focus:ring-sky-500"}),n.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"密码重置后请告知教师,教师下一次在网页端或移动端即可使用此新密码登录。"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",disabled:ne,onClick:()=>J(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:ne||K.length<8,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50 flex items-center gap-1.5",children:ne?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在重置..."})]}):n.jsx("span",{children:"确认重置密码"})})]})]})]})}),Z&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:`p-2.5 rounded-xl border ${Z.isLocked?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-rose-500/10 border-rose-500/20 text-rose-400"}`,children:Z.isLocked?n.jsx(ea,{className:"w-5 h-5"}):n.jsx(bs,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:Z.isLocked?"恢复启用教师账号?":"停用该教师账号?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["教师: ",Z.fullName," (",Z.username,")"]})]})]}),n.jsx("p",{className:"text-xs text-slate-300 leading-relaxed mb-5",children:Z.isLocked?"恢复启用后,该教师可重新登录控制台并向关联班级发送上课通知。":"停用后,该教师将无法登录网页控制台与 Android 移动端,且无法继续发送呼叫通知。教师的历史发送记录与回执将完整保留。"}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:xe,onClick:()=>ge(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"button",disabled:xe,onClick:_e,className:`px-4 py-2 rounded-xl text-white text-xs font-semibold shadow-lg transition-all flex items-center gap-1.5 disabled:opacity-50 ${Z.isLocked?"bg-emerald-600 hover:bg-emerald-500 shadow-emerald-600/25":"bg-rose-600 hover:bg-rose-500 shadow-rose-600/25"}`,children:xe?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"处理中..."})]}):n.jsx("span",{children:Z.isLocked?"确认恢复启用":"确认停用账号"})})]})]})})]})},px=()=>{const[a,l]=g.useState([]),[o,u]=g.useState([]),[d,f]=g.useState(!0),[m,y]=g.useState(null),[p,j]=g.useState(null),[S,k]=g.useState(!1),[$,D]=g.useState(""),[Q,H]=g.useState(!1),[P,J]=g.useState(null),K=async()=>{f(!0),y(null);try{const[U,Z]=await Promise.all([oe.getSchoolCodes(),oe.getSchoolClasses()]);l(U),u(Z),Z.length>0&&!$&&D(Z[0].id)}catch(U){y((U==null?void 0:U.message)||"加载本校激活码数据失败")}finally{f(!1)}};g.useEffect(()=>{K()},[]);const Y=U=>{navigator.clipboard.writeText(U),j(U),setTimeout(()=>j(null),2e3)},ne=async U=>{if(U.preventDefault(),!!$){H(!0),J(null);try{await oe.generateSchoolCode($),k(!1),K()}catch(Z){J((Z==null?void 0:Z.message)||"生成激活码失败")}finally{H(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"本校教室终端激活码"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"生成与管理本校教室电脑安装所需的 8 位一次性硬件绑定激活码"})]}),n.jsxs("button",{onClick:()=>{J(null),k(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium transition-colors shadow-lg shadow-sky-600/25 self-start sm:self-auto",children:[n.jsx(Qn,{className:"w-4 h-4"}),"生成新激活码"]})]}),m&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:m})]}),n.jsxs("button",{onClick:K,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-left text-sm",children:[n.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定班级"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),n.jsx("th",{className:"py-3.5 px-4 font-medium",children:"有效期限"}),n.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y divide-slate-800/50",children:d?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-400",children:n.jsxs("div",{className:"inline-flex items-center gap-2",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin text-sky-400"}),n.jsx("span",{children:"正在加载本校激活码..."})]})})}):a.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-500",children:"本校暂无生成的激活码,请点击右上角生成"})}):a.map(U=>n.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[n.jsxs("td",{className:"py-4 px-4 font-mono font-bold text-sky-400 text-base flex items-center gap-2",children:[n.jsx("span",{children:U.code}),n.jsx("button",{onClick:()=>Y(U.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:p===U.code?n.jsx(Fl,{className:"w-3.5 h-3.5 text-emerald-400"}):n.jsx(Yo,{className:"w-3.5 h-3.5"})})]}),n.jsxs("td",{className:"py-4 px-4",children:[n.jsx("div",{className:"font-medium text-white",children:U.classroomName||U.classroomId}),n.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:U.classroomId})]}),n.jsx("td",{className:"py-4 px-4",children:U.isUsed?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:[n.jsx(Pt,{className:"w-3.5 h-3.5 text-slate-500"}),"已激活使用"]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),"待激活 (可用)"]})}),n.jsx("td",{className:"py-4 px-4 font-mono text-xs text-slate-400",children:U.usedByDeviceId?n.jsx("span",{className:"text-slate-200",children:U.usedByDeviceId}):n.jsx("span",{className:"text-slate-600",children:"-"})}),n.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Kn,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsxs("span",{children:[new Date(U.expiresAt).toLocaleDateString()," 到期"]})]})}),n.jsx("td",{className:"py-4 px-4 text-right",children:n.jsx("button",{onClick:()=>Y(U.code),className:"text-xs text-slate-400 hover:text-white underline underline-offset-4",children:p===U.code?"已复制":"复制用于安装"})})]},U.code))})]})})}),S&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800",children:[n.jsxs("h2",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[n.jsx(ut,{className:"w-5 h-5 text-sky-400"}),"生成本校班级设备激活码"]}),P&&n.jsx("div",{className:"mb-4 p-3 rounded-lg bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs",children:P}),n.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标班级"}),o.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-2 bg-amber-500/10 rounded-lg border border-amber-500/30",children:"本校暂无班级,请先前往“班级管理”创建班级。"}):n.jsx("select",{value:$,onChange:U=>D(U.target.value),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-sky-500",required:!0,children:o.map(U=>n.jsxs("option",{value:U.id,children:[U.displayName," (",U.id,")"]},U.id))})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[n.jsx("button",{type:"button",onClick:()=>k(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),n.jsx("button",{type:"submit",disabled:Q||o.length===0,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-medium disabled:opacity-50",children:Q?"生成中...":"立即生成"})]})]})]})})]})};function Ed(a){if(typeof a=="string")switch(a.toLowerCase()){case"acknowledged":case"confirmed":return"Acknowledged";case"delivered":return"Delivered";case"sent":return"Sent";case"cancelled":case"canceled":return"Cancelled";case"timeout":return"Timeout";case"failed":return"Failed";default:return"Sent"}switch(a){case 5:return"Cancelled";case 2:return"Acknowledged";case 1:return"Delivered";case 0:return"Sent";case 3:return"Timeout";case 4:return"Failed";default:return"Sent"}}const xx=()=>{const[a,l]=g.useState([]),[o,u]=g.useState(""),[d,f]=g.useState(""),[m,y]=g.useState(""),[p,j]=g.useState(!0),[S,k]=g.useState(!0),[$,D]=g.useState(!1),[Q,H]=g.useState(15),[P,J]=g.useState(!1),[K,Y]=g.useState([]),[ne,U]=g.useState(!0),[Z,ge]=g.useState(null),[xe,R]=g.useState(null),[se,Ce]=g.useState(null),[je,O]=g.useState(!1),[ve,Pe]=g.useState(null),[_e,W]=g.useState(1),_=async(F,he,ot,Se)=>{R({notificationId:F,deviceId:he,className:ot,capturedAt:Se}),O(!0),Pe(null),Ce(null),W(1);try{const We=await oe.getVisualReceiptBlob(F,he),$e=URL.createObjectURL(We);Ce($e)}catch(We){Pe((We==null?void 0:We.message)||"获取视觉核验图像失败")}finally{O(!1)}},V=()=>{se&&URL.revokeObjectURL(se),Ce(null),R(null),Pe(null),W(1)},[E,N]=g.useState(null),[L,ae]=g.useState(!1),ue=async()=>{if(E){ae(!0);try{await oe.cancelNotification(E.id),Y(F=>F.map(he=>he.id===E.id?{...he,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:he)),N(null)}catch(F){alert(F.message||"提前关闭通知失败")}finally{ae(!1)}}},fe=na.useRef(a);g.useEffect(()=>{fe.current=a},[a]);const we=["请带各科作业本到办公室","马上到操场集合整队","课代表请到教研室领试卷","午休时间请教室内保持安静","请班长负责维护自习纪律","放学后值日生留下来打扫卫生"],Ee=async()=>{U(!0),ge(null);try{const F=await oe.getTeacherClasses();l(F),F.length>0&&!o&&u(F[0].id);const he=await oe.getTeacherHistory(void 0,20);Y(he.map(ot=>({...ot,status:Ed(ot.status)})))}catch(F){ge((F==null?void 0:F.message)||"加载班级或历史记录失败")}finally{U(!1)}};g.useEffect(()=>{Ee()},[]),g.useEffect(()=>{const F=Ot.onAckReceiptReceived(Se=>{Y(We=>We.map($e=>{if($e.id===Se.messageId){const Jn=Ed(Se.status);return{...$e,status:Jn,confirmedAt:Se.timestamp||$e.confirmedAt||new Date().toISOString()}}return $e}))}),he=Ot.onNewNotificationBroadcast(Se=>{Y(We=>{if(We.some(nn=>nn.id===Se.id))return We;const $e=fe.current.find(nn=>nn.id===Se.classId);return[{id:Se.id,tenantId:Se.tenantId,classId:Se.classId,className:($e==null?void 0:$e.displayName)||Se.classId,senderName:"教师",message:Se.message,priority:Se.type===2?"Urgent":"Normal",createdAt:Se.createdAt,status:"Sent"},...We]})}),ot=Ot.onNotificationCancelled(Se=>{Y(We=>We.map($e=>$e.id===Se?{...$e,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:$e))});return()=>{F(),he(),ot()}},[]);const ke=async F=>{if(F.preventDefault(),!(!o||!m.trim())){J(!0);try{const he=a.find($e=>$e.id===o),ot=d.trim()?`🔔 老师呼叫: ${d.trim()}`:`📢 ${(he==null?void 0:he.displayName)||"班级"}通知`,Se=await oe.sendNotification({classId:o,studentName:d.trim()||void 0,title:ot,message:m.trim(),type:$?2:0,voice:p,shake:S,durationSeconds:Q}),We=m.trim();y(""),f(""),Se!=null&&Se.messageId&&Y($e=>$e.some(nn=>nn.id===Se.messageId)?$e:[{id:Se.messageId,tenantId:"",classId:o,className:(he==null?void 0:he.displayName)||o,senderName:"教师",message:We,priority:$?"Urgent":"Normal",createdAt:new Date().toISOString(),status:"Sent"},...$e])}catch(he){alert(he.message||"呼叫发送失败")}finally{J(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"教师呼叫工作台"}),n.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"向指定教室大屏下发即时点呼与通知,支持语音朗读(TTS)与学生回执确认"})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto",children:n.jsx(ha,{})})]}),Z&&n.jsxs("div",{className:"glass-panel p-4 border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Sn,{className:"w-4 h-4 text-rose-400"}),n.jsx("span",{children:Z})]}),n.jsxs("button",{onClick:Ee,className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[n.jsx(bt,{className:"w-3.5 h-3.5"}),"重新加载"]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[n.jsx("div",{className:"lg:col-span-7 space-y-5",children:n.jsx("div",{className:"glass-panel p-6 border-slate-800",children:n.jsxs("form",{onSubmit:ke,className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-2",children:"目标授课班级"}),a.length===0?n.jsx("div",{className:"text-xs text-amber-400 p-3 bg-amber-500/10 rounded-xl border border-amber-500/30",children:"未查询到可用班级,请联系学校管理员添加班级"}):n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:a.map(F=>{const he=o===F.id;return n.jsxs("button",{type:"button",onClick:()=>u(F.id),className:`p-3 rounded-xl border text-left transition-all relative ${he?"bg-indigo-600/20 border-indigo-500/50 text-white shadow-lg shadow-indigo-600/10":"bg-slate-900/60 border-slate-800 text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[n.jsx("div",{className:"font-semibold text-sm truncate",children:F.displayName}),n.jsx("div",{className:"text-[11px] text-slate-500 truncate mt-0.5",children:F.roomNumber||F.id}),he&&n.jsx(Fl,{className:"w-4 h-4 text-indigo-400 absolute top-3 right-3"})]},F.id)})})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Xd,{className:"w-3.5 h-3.5 text-slate-400"}),"指定学生姓名(可选,点呼场景使用)"]}),n.jsx("span",{className:"text-[11px] text-slate-500",children:"留空则为全班广播"})]}),n.jsx("input",{type:"text",value:d,onChange:F=>f(F.target.value),placeholder:"如:张三、李四(支持单人或多人)",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[n.jsx("span",{children:"呼叫通知内容"}),n.jsxs("span",{className:"text-[11px] text-slate-500",children:[m.length,"/200 字"]})]}),n.jsx("textarea",{rows:4,value:m,onChange:F=>y(F.target.value.slice(0,200)),placeholder:"请输入需要大屏弹窗展示并朗读的内容...",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all placeholder:text-slate-600",required:!0})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-medium text-slate-400 mb-2 flex items-center gap-1.5",children:[n.jsx(Jd,{className:"w-3.5 h-3.5 text-amber-400"}),"快捷点呼短语推荐"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:we.map((F,he)=>n.jsx("button",{type:"button",onClick:()=>y(F),className:"px-2.5 py-1 rounded-lg bg-slate-900 border border-slate-800 text-xs text-slate-300 hover:text-white hover:bg-slate-800 hover:border-slate-700 transition-colors",children:F},he))})]}),n.jsxs("div",{className:"pt-2 border-t border-slate-800/80 grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:p,onChange:F=>j(F.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(Gd,{className:"w-3.5 h-3.5 text-indigo-400"}),"TTS 语音朗读"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"教室音响朗读2遍"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:S,onChange:F=>k(F.target.checked),className:"rounded bg-slate-950 border-slate-700 text-indigo-600 focus:ring-indigo-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsx("span",{className:"font-medium text-slate-200 block",children:"窗口抖动震颤"}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"强制吸引注意力"})]})]}),n.jsxs("label",{className:"flex items-center gap-2.5 p-3 rounded-xl bg-slate-900/60 border border-slate-800 cursor-pointer hover:bg-slate-800/40 transition-colors",children:[n.jsx("input",{type:"checkbox",checked:$,onChange:F=>D(F.target.checked),className:"rounded bg-slate-950 border-slate-700 text-rose-600 focus:ring-rose-500"}),n.jsxs("div",{className:"text-xs",children:[n.jsxs("span",{className:"font-medium text-slate-200 block flex items-center gap-1",children:[n.jsx(ks,{className:"w-3.5 h-3.5 text-rose-400"}),"紧急通知"]}),n.jsx("span",{className:"text-[10px] text-slate-500",children:"红色全屏强提醒"})]})]})]}),n.jsx("button",{type:"submit",disabled:P||!o||!m.trim(),className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 text-white font-semibold text-sm shadow-lg shadow-indigo-600/25 flex items-center justify-center gap-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:P?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"正在秒级投递至教室大屏..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(_r,{className:"w-4 h-4"}),n.jsx("span",{children:"立即下发到教室大屏"})]})})]})})}),n.jsx("div",{className:"lg:col-span-5 space-y-4",children:n.jsxs("div",{className:"glass-panel p-5 border-slate-800",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[n.jsx(br,{className:"w-4 h-4 text-emerald-400"}),"实时回执动态 (ACK)"]}),n.jsx("span",{className:"text-xs text-slate-500",children:"SignalR 实时推送"})]}),n.jsx("div",{className:"space-y-3 max-h-[580px] overflow-y-auto pr-1",children:ne&&K.length===0?n.jsxs("div",{className:"text-center py-16 text-xs text-slate-500",children:[n.jsx(bt,{className:"w-4 h-4 animate-spin mx-auto mb-2 text-indigo-400"}),n.jsx("span",{children:"正在加载历史动态..."})]}):K.length===0?n.jsx("div",{className:"text-center py-16 text-xs text-slate-500",children:"暂无发送记录,在左侧选择班级即可下发第一条呼叫"}):K.map(F=>n.jsxs("div",{className:"glass-card p-4 space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-semibold text-sm text-white",children:F.className}),n.jsx("span",{className:"text-[11px] font-mono text-slate-500",children:new Date(F.createdAt).toLocaleTimeString()})]}),n.jsx("div",{className:"text-xs text-slate-300 bg-slate-950/50 p-2.5 rounded-lg border border-slate-800/80",children:F.message}),n.jsxs("div",{className:"pt-1.5 border-t border-slate-800/60 flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-slate-400 text-[11px]",children:"回执阶段:"}),F.status==="Cancelled"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-slate-400 font-medium",children:[n.jsx(Go,{className:"w-3.5 h-3.5 text-slate-400"}),n.jsx("span",{children:"已提前关闭撤回"})]}),F.status==="Acknowledged"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(Pt,{className:"w-4 h-4 text-emerald-400"}),n.jsxs("span",{children:["学生已点击确认 (",F.confirmedAt?new Date(F.confirmedAt).toLocaleTimeString():"刚刚",")"]})]}),F.status==="Delivered"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sky-400 font-medium",children:[n.jsx(_r,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"教室大屏已接收"})]}),F.status==="Sent"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[n.jsx(Kn,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"云端投递中..."})]}),F.status==="Timeout"&&n.jsx("div",{className:"text-slate-400 text-xs",children:n.jsx("span",{children:"超时已自动关闭"})}),F.status==="Failed"&&n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-rose-400 font-medium",children:[n.jsx(ks,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"投递失败"})]})]}),(F.status==="Sent"||F.status==="Delivered")&&!F.isCancelled&&n.jsx("div",{className:"flex items-center justify-end pt-1",children:n.jsxs("button",{type:"button",onClick:()=>N(F),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded bg-rose-500/10 hover:bg-rose-500/20 text-rose-300 text-[11px] font-medium transition-colors border border-rose-500/30",title:"在大屏端停止TTS并关闭弹窗",children:[n.jsx(kr,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"提前关闭 / 撤回"})]})}),F.receipts&&F.receipts.length>0&&(()=>{const he=F.receipts.find(Se=>Se.visualReceiptState==="Available"),ot=F.receipts.find(Se=>Se.visualReceiptState==="Expired");return he?n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-xs",children:[n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-emerald-400 font-medium",children:[n.jsx(_s,{className:"w-4 h-4 text-emerald-400"}),n.jsx("span",{children:"视觉核验:已完成"})]}),n.jsxs("button",{type:"button",onClick:()=>_(F.id,he.deviceId,F.className,he.visualReceiptCapturedAt),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-indigo-600/30 hover:bg-indigo-600/50 text-indigo-300 text-[11px] font-medium transition-colors border border-indigo-500/30",children:[n.jsx(m0,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"查看大屏实际展示"})]})]}):ot?n.jsx("div",{className:"flex items-center justify-between pt-2 border-t border-slate-800/40 text-[11px] text-slate-500",children:n.jsxs("div",{className:"inline-flex items-center gap-1",children:[n.jsx(_s,{className:"w-3.5 h-3.5 text-slate-500"}),n.jsx("span",{children:"视觉核验:已按 24h 策略自动销毁"})]})}):null})()]},F.id))})]})})]}),xe&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel w-full max-w-3xl bg-slate-900 border-slate-800 rounded-2xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-800 bg-slate-950/60",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_s,{className:"w-5 h-5 text-emerald-400"}),n.jsxs("h3",{className:"font-semibold text-white text-base",children:[xe.className," · 通知视觉核验"]})]}),n.jsx("button",{type:"button",onClick:V,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:n.jsx(kr,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 flex-1 overflow-auto flex flex-col items-center justify-center min-h-[320px] bg-slate-950/40",children:[je&&n.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 text-sm",children:[n.jsx(kn,{className:"w-8 h-8 animate-spin text-indigo-400"}),n.jsx("span",{children:"正在安全解密并加载现场回执画面..."})]}),ve&&n.jsxs("div",{className:"flex flex-col items-center gap-2 text-rose-400 text-sm",children:[n.jsx(Sn,{className:"w-8 h-8 text-rose-400"}),n.jsx("span",{children:ve})]}),se&&!je&&n.jsxs("div",{className:"flex flex-col items-center w-full",children:[n.jsx("div",{className:"overflow-auto max-h-[60vh] max-w-full flex items-center justify-center p-2 rounded-xl bg-black/60 border border-slate-800",children:n.jsx("img",{src:se,alt:"教室大屏实际展示画面",style:{transform:`scale(${_e})`,transformOrigin:"center center",transition:"transform 0.2s"},className:"rounded-lg shadow-lg object-contain max-h-[55vh]"})}),n.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[n.jsx("button",{type:"button",onClick:()=>W(F=>Math.max(.5,+(F-.25).toFixed(2))),disabled:_e<=.5,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"缩小",children:n.jsx(nx,{className:"w-4 h-4"})}),n.jsxs("span",{className:"text-xs font-mono text-slate-300 min-w-[50px] text-center",children:[Math.round(_e*100),"%"]}),n.jsx("button",{type:"button",onClick:()=>W(F=>Math.min(3,+(F+.25).toFixed(2))),disabled:_e>=3,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"放大",children:n.jsx(ex,{className:"w-4 h-4"})}),n.jsx("button",{type:"button",onClick:()=>W(1),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"重置"})]})]})]}),n.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between text-[11px] text-slate-400 gap-2",children:[n.jsx("span",{children:xe.capturedAt?`捕获时间: ${new Date(xe.capturedAt).toLocaleString()}`:""}),n.jsx("span",{className:"text-amber-400/90 text-right",children:"该现场画面仅用于核验通知是否成功显示,并将在捕获后 24 小时自动销毁。"})]})]})}),E&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"glass-panel max-w-md w-full p-6 border-slate-800 shadow-2xl animate-in fade-in zoom-in-95 duration-150",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-400",children:n.jsx(ks,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-base font-bold text-white",children:"提前关闭并撤回通知?"}),n.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["目标班级: ",E.className]})]})]}),n.jsxs("div",{className:"bg-slate-950/70 p-3.5 rounded-xl border border-slate-800/80 mb-4 text-xs text-slate-300",children:[n.jsx("div",{className:"text-slate-400 text-[11px] mb-1",children:"通知内容:"}),n.jsx("p",{className:"line-clamp-3",children:E.message})]}),n.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-[11px] text-amber-300/90 mb-5 leading-relaxed",children:["💡 确认后,云端将立即向教室大屏发出关闭指令,大屏将",n.jsx("strong",{children:"立即停止 TTS 语音播报"}),"并",n.jsx("strong",{children:"收起弹窗窗口"}),"。"]}),n.jsxs("div",{className:"flex justify-end gap-2.5",children:[n.jsx("button",{type:"button",disabled:L,onClick:()=>N(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),n.jsx("button",{type:"button",disabled:L,onClick:ue,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-lg shadow-rose-600/25 transition-all flex items-center gap-1.5 disabled:opacity-50",children:L?n.jsxs(n.Fragment,{children:[n.jsx(kn,{className:"w-3.5 h-3.5 animate-spin"}),n.jsx("span",{children:"正在撤回..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Go,{className:"w-3.5 h-3.5"}),n.jsx("span",{children:"确认提前关闭"})]})})]})]})})]})},gx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户身份..."}):a?n.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col",children:[n.jsx(sx,{}),n.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6",children:n.jsx(Bd,{})})]}):n.jsx(Vt,{to:"/login",replace:!0})},vx=()=>{const{user:a,isLoading:l}=Sr();return l?n.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在初始化..."}):a?a.role==="SuperAdmin"?n.jsx(Vt,{to:"/admin",replace:!0}):a.role==="SchoolAdmin"?n.jsx(Vt,{to:"/school-admin",replace:!0}):n.jsx(Vt,{to:"/teacher",replace:!0}):n.jsx(Vt,{to:"/login",replace:!0})},yx=()=>n.jsxs(Zm,{children:[n.jsx(Qe,{path:"/login",element:n.jsx(rx,{})}),n.jsx(Qe,{path:"/",element:n.jsx(vx,{})}),n.jsxs(Qe,{element:n.jsx(gx,{}),children:[n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SuperAdmin"]}),children:[n.jsx(Qe,{path:"/admin",element:n.jsx(lx,{})}),n.jsx(Qe,{path:"/admin/tenants",element:n.jsx(cx,{})}),n.jsx(Qe,{path:"/admin/users",element:n.jsx(ux,{})}),n.jsx(Qe,{path:"/admin/devices",element:n.jsx(ix,{})}),n.jsx(Qe,{path:"/admin/broadcast",element:n.jsx(dx,{})}),n.jsx(Qe,{path:"/admin/codes",element:n.jsx(ox,{})}),n.jsx(Qe,{path:"/admin/history",element:n.jsx(ax,{})})]}),n.jsxs(Qe,{element:n.jsx(Qo,{allowedRoles:["SchoolAdmin"]}),children:[n.jsx(Qe,{path:"/school-admin",element:n.jsx(hx,{})}),n.jsx(Qe,{path:"/school-admin/classes",element:n.jsx(fx,{})}),n.jsx(Qe,{path:"/school-admin/teachers",element:n.jsx(mx,{})}),n.jsx(Qe,{path:"/school-admin/codes",element:n.jsx(px,{})})]}),n.jsx(Qe,{element:n.jsx(Qo,{allowedRoles:["Teacher"]}),children:n.jsx(Qe,{path:"/teacher",element:n.jsx(xx,{})})})]}),n.jsx(Qe,{path:"*",element:n.jsx(Vt,{to:"/",replace:!0})})]}),wx=()=>n.jsx(Gp,{children:n.jsx(op,{children:n.jsx(yx,{})})});om.createRoot(document.getElementById("root")).render(n.jsx(na.StrictMode,{children:n.jsx(wx,{})})); /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/assets/index-D-Vcu7vf.css SIZE: 36511 chars SHA256: 264FD1E80AD5D351722E35CD5B7EDE75EF8E0A7641F674D2E59CB147F41F61DE ===================================================================== */ *,: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}body{min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}body *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-5rem}.-top-20{top:-5rem}.left-3\.5{left:.875rem}.right-3{right:.75rem}.top-0{top:0}.top-3{top:.75rem}.top-3\.5{top:.875rem}.z-10{z-index:10}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.max-h-\[55vh\]{max-height:55vh}.max-h-\[580px\]{max-height:580px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[320px\]{min-height:320px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-full{width:100%}.min-w-\[50px\]{min-width:50px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.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 ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) 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}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.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\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * 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-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * 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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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))}.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-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.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-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/50{border-color:#10b98180}.border-indigo-500\/20{border-color:#6366f133}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/50{border-color:#6366f180}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-sky-500\/20{border-color:#0ea5e933}.border-sky-500\/30{border-color:#0ea5e94d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/40{border-color:#1e293b66}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/25{background-color:#f59e0b40}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/15{background-color:#05966926}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-950\/20{background-color:#022c2233}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/10{background-color:#4f46e51a}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-600\/30{background-color:#4f46e54d}.bg-rose-400{--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/15{background-color:#f43f5e26}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity, 1))}.bg-rose-600\/15{background-color:#e11d4826}.bg-rose-600\/20{background-color:#e11d4833}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-500\/10{background-color:#0ea5e91a}.bg-sky-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1))}.bg-sky-600\/10{background-color:#0284c71a}.bg-sky-600\/20{background-color:#0284c733}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/50{background-color:#02061780}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/70{background-color:#020617b3}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/95{background-color:#020617f2}.bg-transparent{background-color:transparent}.bg-violet-500\/10{background-color:#8b5cf61a}.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))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-600{--tw-gradient-from: #4f46e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-950{--tw-gradient-from: #020617 var(--tw-gradient-from-position);--tw-gradient-to: rgb(2 6 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-slate-200{--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #e2e8f0 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-900{--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #0f172a var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-950\/40{--tw-gradient-to: rgb(30 27 75 / .4) var(--tw-gradient-to-position)}.to-slate-400{--tw-gradient-to: #94a3b8 var(--tw-gradient-to-position)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.to-violet-600{--tw-gradient-to: #7c3aed var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.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-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.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-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.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-3\.5{padding-top:.875rem;padding-bottom:.875rem}.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-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pr-1{padding-right:.25rem}.pr-4{padding-right:1rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-\[\'Inter\'\,system-ui\,-apple-system\,sans-serif\]{font-family:Inter,system-ui,-apple-system,sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.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-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/90{color:#fcd34de6}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/90{color:#fbbf24e6}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/80{color:#34d399cc}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-300\/90{color:#fda4afe6}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-400\/90{color:#fb7185e6}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.accent-indigo-500{accent-color:#6366f1}.opacity-70{opacity:.7}.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-amber-500\/10{--tw-shadow-color: rgb(245 158 11 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/25{--tw-shadow-color: rgb(245 158 11 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-600\/25{--tw-shadow-color: rgb(5 150 105 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/25{--tw-shadow-color: rgb(99 102 241 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/10{--tw-shadow-color: rgb(79 70 229 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/25{--tw-shadow-color: rgb(79 70 229 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/30{--tw-shadow-color: rgb(79 70 229 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/25{--tw-shadow-color: rgb(225 29 72 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/30{--tw-shadow-color: rgb(225 29 72 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-600\/25{--tw-shadow-color: rgb(2 132 199 / .25);--tw-shadow: var(--tw-shadow-colored)}.blur-3xl{--tw-blur: blur(64px);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-sm{--tw-backdrop-blur: blur(4px);-webkit-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-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-xl{--tw-backdrop-blur: blur(24px);-webkit-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-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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.glass-panel{border-radius:1rem;border-width:1px;border-color:#1e293bcc;background-color:#0f172ab3;--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);--tw-backdrop-blur: blur(24px);-webkit-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-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)}.glass-card{border-radius:.75rem;border-width:1px;border-color:#33415580;background-color:#1e293b66;--tw-backdrop-blur: blur(12px);-webkit-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-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-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.glass-card:hover{border-color:#475569b3;background-color:#1e293b99}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:border-amber-500\/50:hover{border-color:#f59e0b80}.hover\:border-emerald-500\/50:hover{border-color:#10b98180}.hover\:border-indigo-500\/50:hover{border-color:#6366f180}.hover\:border-rose-500\/50:hover{border-color:#f43f5e80}.hover\:border-rose-700\/50:hover{border-color:#be123c80}.hover\:border-sky-500\/50:hover{border-color:#0ea5e980}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-amber-500:hover{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-600\/25:hover{background-color:#05966940}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-600\/20:hover{background-color:#4f46e533}.hover\:bg-indigo-600\/50:hover{background-color:#4f46e580}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-500\/20:hover{background-color:#f43f5e33}.hover\:bg-rose-600\/25:hover{background-color:#e11d4840}.hover\:bg-rose-900\/40:hover{background-color:#88133766}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-600\/20:hover{background-color:#0284c733}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/20:hover{background-color:#1e293b33}.hover\:bg-slate-800\/25:hover{background-color:#1e293b40}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-indigo-500:hover{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-500:hover{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.hover\:to-violet-500:hover{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-rose-300:hover{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / 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-amber-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/50:focus{--tw-ring-color: rgb(99 102 241 / .5)}.focus\:ring-rose-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(244 63 94 / var(--tw-ring-opacity, 1))}.focus\:ring-sky-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;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))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;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))}.group:hover .group-hover\:text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:block{display:block}.sm\:flex{display:flex}.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-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media(min-width:768px){.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:grid-cols-12{grid-template-columns:repeat(12,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\:px-8{padding-left:2rem;padding-right:2rem}}@media(min-width:1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}} /* ===================================================================== FILE: src/Server/ClassNotify.Server/wwwroot/index.html SIZE: 957 chars SHA256: 2395FA612AB3A793B6D779158579C6B07F3A74E490733FE76B415F433A98426E ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Shared/ClassNotify.Shared/ClassNotify.Shared.csproj SIZE: 242 chars SHA256: 3D130EF85C63DF9966763BEE1B9DFE0E5666C91DD26FB6AB15AEF185FA8910C1 ===================================================================== */ net8.0 enable enable latest /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Contracts/IDeviceHubClient.cs SIZE: 700 chars SHA256: D273339634DEC0C5AF58F362BF2C67432CA78FB1E4BDB2AA4983766E4B76A575 ===================================================================== */ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教室端 (Windows Service) 接收来自服务端的强类型 SignalR 契约 /// public interface IDeviceHubClient { /// /// 接收呼叫/通知指令 /// Task ReceiveNotification(NotificationDto notification); /// /// 接收服务端下发的端到端受控运维指令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// Task ReceiveRemoteCommand(DeviceCommandDto command); /// /// 接收服务端下达的撤回/提前关闭通知指令 /// Task CancelNotification(string notificationId); /// /// 接收配置更新 /// Task ReceiveConfigUpdate(string configJson); } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Contracts/ITeacherHubClient.cs SIZE: 998 chars SHA256: 6625CFAFB854B000D9D3767F6BD8BD64A3C2061EB607F01C9E37039C86191CD2 ===================================================================== */ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教师控制端 (Web / Android) 接收来自服务端的强类型 SignalR 契约 /// public interface ITeacherHubClient { /// /// 设备在线状态变更通知 (上线/离线/心跳刷新) /// Task OnDeviceStatusChanged(DeviceStatusDto status); /// /// 消息回执更新 (已送达、学生已点击【我知道了】、超时关闭) /// Task OnAckReceiptReceived(AckReceiptDto receipt); /// /// 收到教室端健康自检体检报告 /// Task OnHealthReportReceived(DeviceHealthReportDto report); /// /// 新消息广播 /// Task OnNewNotificationBroadcast(NotificationDto notification); /// /// 远程运维命令状态变更 (Pending -> Dispatched -> Succeeded / Failed / TimedOut / Expired) /// Task OnDeviceCommandStatusChanged(DeviceCommandResultDto result); /// /// 通知撤回/提前关闭广播 /// Task OnNotificationCancelled(string notificationId); } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/AckStatus.cs SIZE: 487 chars SHA256: 1DCE55D558D0DD5FFAD1EA0C96E70B8106FFB486C1B6D003F820D434B855C674 ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 消息状态与回执阶段 /// public enum AckStatus { /// /// 已提交至云端服务器 /// Sent = 0, /// /// 教室端大屏/后台已成功接收 /// Delivered = 1, /// /// 学生或值日生点击了【我知道了】 /// Acknowledged = 2, /// /// 倒计时结束,窗口自动淡出关闭 /// Timeout = 3, /// /// 设备离线或投递失败 /// Failed = 4 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/DeviceOnlineState.cs SIZE: 346 chars SHA256: B4B452E56ECB1D968C584EC05482EDCCE187EFE816221B6823D75FB37ECE998B ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 设备在线与健康状态 /// public enum DeviceOnlineState { /// /// 离线(无心跳连接) /// Offline = 0, /// /// 正常在线 /// Online = 1, /// /// 降级运行(如后台在线但 UI 进程异常或 TTS 不可用) /// Degraded = 2 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Enums/NotificationType.cs SIZE: 334 chars SHA256: 40D28DFBF41FEA8FF3FC34CD2C7EB4827BFBE6017702FB50CADAB03BFDCA68FB ===================================================================== */ namespace ClassNotify.Shared.Enums; /// /// 通知类别 /// public enum NotificationType { /// /// 老师呼叫(默认蓝色,高优先级) /// Call = 0, /// /// 班级常规通知(绿色) /// Notice = 1, /// /// 紧急/重要提醒(红色,全屏强调) /// Urgent = 2 } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Ipc/IpcMessage.cs SIZE: 591 chars SHA256: A770014CC85DEA1D77A2ECF9B240F2431B7C9E2FCBB94E25122A74FDEEBE7743 ===================================================================== */ namespace ClassNotify.Shared.Ipc; /// /// Windows Service 与 WinUI 3 前台进程之间的命名管道 IPC 消息类型 /// public enum IpcCommandType { Ping = 0, Pong = 1, ShowNotification = 2, CloseNotification = 3, ReportAck = 4, HealthCheck = 5, Hello = 6, TtsCheck = 7, TtsCheckResult = 8, ReportVisualReceipt = 9 } /// /// 命名管道传输帧 /// public class IpcMessage { public IpcCommandType Type { get; set; } public string? CorrelationId { get; set; } = Guid.NewGuid().ToString("N"); public string? PayloadJson { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/AckReceiptDto.cs SIZE: 751 chars SHA256: 58C007127FFAE6FABC81DF16A8DC28754018EF6BC69702ACDCC8267D3BFA627E ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室端确认与回执数据对象 /// public class AckReceiptDto { /// /// 对应的消息 ID /// public string MessageId { get; set; } = string.Empty; /// /// 班级编号 /// public string ClassId { get; set; } = string.Empty; /// /// 当前回执状态(Delivered / Acknowledged / Timeout) /// public AckStatus Status { get; set; } = AckStatus.Delivered; /// /// 触发时间戳 /// public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; /// /// 备注信息(如“值日生张三确认”) /// public string? Remark { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/AdminDtos.cs SIZE: 7364 chars SHA256: E2FF8BD2DAAD1857BD83135BC739C7744F708CF04A19EBEF706DE2689726A964 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 全局平台统计指标 (超级管理员大盘) /// public class AdminMetricsDto { public int TotalTenants { get; set; } public int TotalClassrooms { get; set; } public int TotalDevices { get; set; } public int OnlineDevices { get; set; } public int OfflineDevices => Math.Max(0, TotalDevices - OnlineDevices); public int TodayNotifications { get; set; } public int AbnormalDevices { get; set; } } /// /// 设备明细与实时状态 DTO /// public class DeviceAdminDto { public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public string? Hostname { get; set; } public bool IsOnline { get; set; } public DateTimeOffset? LastHeartbeat { get; set; } public string? ClientVersion { get; set; } public string? RemoteIp { get; set; } public bool ServiceRunning { get; set; } = true; public bool ClientRunning { get; set; } = true; } /// /// 学校/租户大盘 DTO /// public class TenantAdminDto { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public int ClassroomCount { get; set; } public int DeviceCount { get; set; } public int OnlineCount { get; set; } public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } } /// /// 激活码详情 DTO /// public class ActivationCodeDto { public string Code { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } public bool IsUsed { get; set; } public DateTimeOffset? UsedAt { get; set; } public string? UsedByDeviceId { get; set; } } /// /// 远程指令下发请求 /// public class RemoteCommandRequestDto { public string Command { get; set; } = string.Empty; // "ping", "restart_client", "refresh_config" public string? Parameters { get; set; } } /// /// 创建班级请求 /// public class CreateClassroomDto { public string Id { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; public string? Grade { get; set; } public string? RoomNumber { get; set; } } /// /// 创建教师账号请求 /// public class CreateTeacherDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "Teacher"; // Teacher, SchoolAdmin } /// /// 消息历史记录与回执 /// public class NotificationRecordDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string SenderName { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public string Priority { get; set; } = "Normal"; public DateTimeOffset CreatedAt { get; set; } public string Status { get; set; } = "Sent"; // Sent, Delivered, Acknowledged, Timeout, Failed, Cancelled public bool IsCancelled { get; set; } public DateTimeOffset? CancelledAt { get; set; } public string? CancelledBy { get; set; } public DateTimeOffset? ConfirmedAt { get; set; } public DateTimeOffset? ExpiresAt { get; set; } public List Receipts { get; set; } = new(); } public class UserAdminDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = string.Empty; public bool IsLocked { get; set; } public DateTimeOffset CreatedAt { get; set; } public DateTimeOffset? LastLoginAt { get; set; } } public class CreateUserAdminRequest { public string TenantId { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "SchoolAdmin"; // SchoolAdmin, Teacher } public class ResetPasswordRequest { public string NewPassword { get; set; } = string.Empty; } public class LockUserRequest { public bool IsLocked { get; set; } = true; } public class CreateTenantRequest { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; } public class UpdateTenantRequest { public string Name { get; set; } = string.Empty; public bool IsActive { get; set; } = true; } public class UpdateDeviceRequest { public string? Hostname { get; set; } public string? ClassroomId { get; set; } } public class EmergencyBroadcastRequest { public string? TenantId { get; set; } // null or empty = all schools public string Title { get; set; } = "⚠️ 全校紧急通知"; public string Message { get; set; } = string.Empty; public bool Voice { get; set; } = true; public bool Shake { get; set; } = true; public int DurationSeconds { get; set; } = 30; } public class SystemHealthDto { public string Status { get; set; } = "Healthy"; public bool DatabaseConnected { get; set; } = true; public double DatabaseLatencyMs { get; set; } public int ActiveSignalRConnections { get; set; } public int OnlineDevices { get; set; } public string ServerTime { get; set; } = string.Empty; public string Uptime { get; set; } = string.Empty; public long MemoryUsedBytes { get; set; } } public class AdminAuditLogDto { public string Id { get; set; } = string.Empty; public DateTimeOffset OccurredAt { get; set; } public string ActorUsername { get; set; } = string.Empty; public string ActorRole { get; set; } = string.Empty; public string Action { get; set; } = string.Empty; public string TargetType { get; set; } = string.Empty; public string TargetId { get; set; } = string.Empty; public string? Details { get; set; } public string? IpAddress { get; set; } } public sealed class BroadcastReceiptSummaryDto { public string BroadcastId { get; set; } = string.Empty; public int TargetSchools { get; set; } public int TargetClassrooms { get; set; } public int TargetDevices { get; set; } public int Displayed { get; set; } public int Pending { get; set; } public int Cancelled { get; set; } public int Failed { get; set; } public bool Completed => Pending == 0; public DateTimeOffset? CreatedAt { get; set; } } public sealed record CancelNotificationResult( string NotificationId, string TenantId, string ClassroomId, bool AlreadyCancelled, DateTimeOffset? CancelledAt, string? CancelledBy); /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceActivationRequestDto.cs SIZE: 662 chars SHA256: CD8B9127242CA36E336AA6897EBA9B08B62C8A264016D85DFA70D3A024C0A567 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备首次激活请求 DTO /// public class DeviceActivationRequestDto { /// /// 一次性设备激活码 (例如: H8K4-29DP) /// public string ActivationCode { get; set; } = string.Empty; /// /// 教室电脑主机名 /// public string Hostname { get; set; } = Environment.MachineName; /// /// 客户端版本号 /// public string ClientVersion { get; set; } = "2.1.0"; /// /// 安装实例唯一标识符 (例如: inst_550e8400-e29b-41d4-a716-446655440000) /// public string InstallationId { get; set; } = string.Empty; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceActivationResultDto.cs SIZE: 431 chars SHA256: F510CEA69A7BEBF285EDEC2B885B445F81B02A5782C4EB578B317D3BBD4145B5 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备激活响应 DTO /// public class DeviceActivationResultDto { public bool Success { get; set; } public string? DeviceId { get; set; } public string? DeviceToken { get; set; } public string? TenantId { get; set; } public string? ClassId { get; set; } public string? ClassDisplayName { get; set; } public string? ErrorMessage { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceCommandDto.cs SIZE: 3086 chars SHA256: 8A641211C56C55DF5566005B54D583A9B987C0D0026C2CC95BA15A798BB6AB61 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 远程维护命令类型常量 /// public static class DeviceCommandTypes { public const string SelfCheck = "SelfCheck"; public const string RestartClient = "RestartClient"; public const string Reconnect = "Reconnect"; public const string RefreshConfig = "RefreshConfig"; public static readonly string[] AllSupported = [SelfCheck, RestartClient, Reconnect, RefreshConfig]; public static bool IsSupported(string? commandType) { if (string.IsNullOrWhiteSpace(commandType)) return false; return AllSupported.Contains(commandType, StringComparer.OrdinalIgnoreCase); } /// /// 获取命令类型的默认安全 TTL(生命周期) /// 严禁长期补发,过期即弃 /// public static TimeSpan GetDefaultTtl(string commandType) { return commandType?.ToLowerInvariant() switch { "restartclient" or "restart_client" => TimeSpan.FromMinutes(2), "reconnect" => TimeSpan.FromMinutes(2), "refreshconfig" or "refresh_config" => TimeSpan.FromMinutes(5), "selfcheck" or "self_check" => TimeSpan.FromMinutes(5), _ => TimeSpan.FromMinutes(2) }; } } /// /// 远程维护命令状态常量 /// public static class DeviceCommandStatuses { public const string Pending = "Pending"; public const string Dispatched = "Dispatched"; public const string Succeeded = "Succeeded"; public const string Failed = "Failed"; public const string TimedOut = "TimedOut"; public const string Expired = "Expired"; public static bool IsTerminal(string status) => status is Succeeded or Failed or TimedOut or Expired; } /// /// 远程运维命令传输对象 /// 全链路统一 CommandId (cmd_xxxxx),从创建到最终上报不可篡改 /// public class DeviceCommandDto { public string CommandId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string CommandType { get; set; } = string.Empty; public string? Parameters { get; set; } public string CreatedBy { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset ExpiresAt { get; set; } public string Status { get; set; } = DeviceCommandStatuses.Pending; public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? CompletedAt { get; set; } public long? DurationMs { get; set; } public int? ResultCode { get; set; } public string? ResultMessage { get; set; } } /// /// 终端设备执行远程命令后回传的结果报文 /// public class DeviceCommandResultDto { public string CommandId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = DeviceCommandStatuses.Succeeded; public int ResultCode { get; set; } = 0; public string? ResultMessage { get; set; } public long ExecutionDurationMs { get; set; } public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceCredentials.cs SIZE: 549 chars SHA256: 936C4CB817E4F20FBD006412EF31FF4735C9B3929C96280F6D9AE4D9EA7CB084 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室本地保存的永久设备凭证 (存储于 C:\ProgramData\ClassNotify\device_credentials.json) /// public class DeviceCredentials { public string DeviceId { get; set; } = string.Empty; public string DeviceToken { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassDisplayName { get; set; } = string.Empty; public DateTimeOffset ActivatedAt { get; set; } = DateTimeOffset.UtcNow; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceHealthReportDto.cs SIZE: 1787 chars SHA256: 86918ABF93CAA8357916AED6A78760237563B1C1AC975479F0E4503244CF9508 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教室设备详细健康自检报告 /// public class DeviceHealthReportDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; // Detailed health indicators public bool ServiceRunning { get; set; } = true; public bool ClientConnected { get; set; } public int ClientHeartbeatAgeSeconds { get; set; } = -1; public bool DnsOk { get; set; } public bool HttpsOk { get; set; } public bool SignalROk { get; set; } public bool CredentialsOk { get; set; } public bool DataDirectoryWritable { get; set; } public bool PipeOk { get; set; } public bool TtsOk { get; set; } public string OverallStatus { get; set; } = "Offline"; // Healthy, Degraded, Offline public DateTimeOffset CheckedAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// Windows SAPI / WinRT TTS 语音引擎是否可用 /// public bool IsTtsAvailable { get => TtsOk; set => TtsOk = value; } /// /// WinUI 3 前台 UI 进程是否处于就绪/健康状态 /// public bool IsUiProcessRunning { get => ClientConnected; set => ClientConnected = value; } /// /// 互联网与云端连接是否正常 /// public bool IsNetworkReachable { get => HttpsOk; set => HttpsOk = value; } /// /// 域名 DNS 解析是否正常 /// public bool IsDnsResolved { get => DnsOk; set => DnsOk = value; } /// /// 诊断详情信息 /// public string DiagnosticMessage { get; set; } = "All checks passed."; } public class TtsCheckResultDto { public bool Available { get; set; } public int VoiceCount { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/DeviceStatusDto.cs SIZE: 576 chars SHA256: 01CE7FE6054592EC308B3C5C35A4C35A459D63A17202468C0164246186B79266 ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室设备简要在线状态模型 /// public class DeviceStatusDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string? Hostname { get; set; } public DeviceOnlineState State { get; set; } = DeviceOnlineState.Offline; public DateTimeOffset LastHeartbeat { get; set; } = DateTimeOffset.UtcNow; public string AgentVersion { get; set; } = "2.0.0"; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/NotificationDto.cs SIZE: 1688 chars SHA256: C1AB89A8863A3A793B6AC6E49C2DCD0DB2444656ACC0135B5894E522F6442795 ===================================================================== */ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 通知消息传输对象 (DTO) /// public class NotificationDto { /// /// 唯一消息 ID (如 msg_20260920_xxxx) /// public string Id { get; set; } = Guid.NewGuid().ToString("N"); /// /// 所属学校/租户 ID (如 "t_beijing_no4") /// public string TenantId { get; set; } = string.Empty; /// /// 目标班级编号 (如 "cls_801") /// public string ClassId { get; set; } = string.Empty; /// /// 呼叫的目标学生姓名(可选,如 "张三") /// public string? StudentName { get; set; } /// /// 弹窗标题 /// public string Title { get; set; } = "🔔 老师呼叫"; /// /// 通知正文内容 /// public string Message { get; set; } = string.Empty; /// /// 通知类型 /// public NotificationType Type { get; set; } = NotificationType.Call; /// /// 是否开启 Windows TTS 中文语音朗读 /// public bool Voice { get; set; } = true; /// /// 是否开启窗口抖动震颤 /// public bool Shake { get; set; } = true; /// /// 展示持续时长(秒),超时后自动关闭 /// public int DurationSeconds { get; set; } = 15; /// /// 教师端发送时间戳 /// public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; /// /// 消息过期时间(UTC),超过此时间不再向离线设备补发 /// public DateTimeOffset? ExpiresAt { get; set; } /// /// 全局应急广播关联 ID(可选) /// public string? BroadcastId { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/NotificationReceiptStatuses.cs SIZE: 780 chars SHA256: 3BBDCE6A28391661DCE0AC9C2DA03FA23428AB8AB056746484812472518FAADA ===================================================================== */ namespace ClassNotify.Shared.Models; public static class NotificationReceiptStatuses { public const string Sent = "Sent"; public const string DeviceReceived = "DeviceReceived"; public const string Displayed = "Displayed"; public const string Acknowledged = "Acknowledged"; public const string Cancelled = "Cancelled"; public const string Failed = "Failed"; public const string Timeout = "Timeout"; public const string Expired = "Expired"; public static bool IsDisplayed(string status) => status == Displayed || status == Acknowledged; public static bool IsPending(string status) => status == Sent || status == DeviceReceived; public static bool IsFailed(string status) => status == Failed || status == Timeout || status == Expired; } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/TeacherLoginDto.cs SIZE: 621 chars SHA256: 6866BAB6B943DA3CC5B9536648B8684F7F9EE1F6BB25D88FA00DF974A2A9C434 ===================================================================== */ namespace ClassNotify.Shared.Models; /// /// 教师登录请求 DTO /// public class TeacherLoginDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; } /// /// 教师登录成功返回包含 Tenant Claims 的 JWT 凭证 /// public class TeacherLoginResultDto { public bool Success { get; set; } public string? Token { get; set; } public string? TenantId { get; set; } public string? UserId { get; set; } public string? FullName { get; set; } public string? Role { get; set; } public string? ErrorMessage { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Models/VisualReceiptModels.cs SIZE: 850 chars SHA256: C34E5153E3981F939E575E00542BC40263F5F991A3F64C6DFDD69ED34CB06757 ===================================================================== */ using System; namespace ClassNotify.Shared.Models; /// /// IPC 传输的视觉回执数据包 (WPF Client -> Windows Service) /// public sealed class VisualReceiptIpcDto { public string NotificationId { get; set; } = string.Empty; public byte[] JpegBytes { get; set; } = Array.Empty(); } /// /// Web / Server 暴露给前端查看的设备通知回执视图模型 /// public sealed class NotificationReceiptViewDto { public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset? DisplayedAt { get; set; } /// /// None / Available / Expired /// public string VisualReceiptState { get; set; } = "None"; public DateTimeOffset? VisualReceiptCapturedAt { get; set; } public DateTimeOffset? VisualReceiptExpiresAt { get; set; } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/ClientNotificationBuffer.cs SIZE: 6784 chars SHA256: A39ED9B75407A449F51B86098EB51FE045AE90B940A9F40021DE6C5A2DBA57E9 ===================================================================== */ using System.Collections.Concurrent; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// Thread-safe client notification buffer and FIFO delivery dispatcher for Windows Service. /// Guarantees strict FIFO delivery order, single-concurrent flushing via SemaphoreSlim(1,1), /// and atomic peek-then-dequeue so broken-pipe failures leave the item at the head of the queue. /// When a backlog exists, new live notifications are enqueued to preserve FIFO order and never bypass pending items. /// public class ClientNotificationBuffer { private readonly ConcurrentQueue _pendingQueue = new(); private readonly SemaphoreSlim _flushLock = new(1, 1); public int PendingCount => _pendingQueue.Count; public IReadOnlyCollection GetPendingSnapshot() => _pendingQueue.ToArray(); public void Enqueue(NotificationDto notification) { if (notification == null) return; _pendingQueue.Enqueue(notification); } public void Clear() { while (_pendingQueue.TryDequeue(out _)) { } } /// /// Delivers the notification to the client or safely buffers it. /// If there is an existing backlog, the notification is enqueued to the tail of the backlog /// to preserve strict FIFO ordering, and a flush is triggered if connected. /// If there is no backlog and the client is connected, an immediate live delivery is attempted. /// If delivery fails, the notification is buffered so it can be flushed on reconnect. /// public async Task DeliverOrBufferAsync( NotificationDto notification, Func isClientConnected, Func> sendToClientAsync, int waitAttempts = 0, int delayMsBetweenAttempts = 500) { if (notification == null) return false; await _flushLock.WaitAsync(); try { // Case 1: Existing backlog exists. Must enqueue behind backlog to guarantee FIFO ordering! if (!_pendingQueue.IsEmpty) { _pendingQueue.Enqueue(notification); if (isClientConnected()) { await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, DateTimeOffset.UtcNow); } return false; } // Case 2: No backlog. If client is connected, attempt immediate live send. if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } // Case 3: Client handshaking / transient wait window for (int i = 0; i < waitAttempts; i++) { if (delayMsBetweenAttempts > 0) { await Task.Delay(delayMsBetweenAttempts); } if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } } // Delivery failed or client not connected: buffer notification for next reconnect flush _pendingQueue.Enqueue(notification); return false; } finally { _flushLock.Release(); } } /// /// Flushes pending notifications to the connected client. /// Uses peek-then-dequeue: only dequeues upon verified successful send. /// If send fails or client disconnects, the failed notification remains at the head of the queue, /// flushing stops immediately, and strict FIFO order is naturally preserved. /// public async Task FlushAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset? currentUtc = null) { var now = currentUtc ?? DateTimeOffset.UtcNow; await _flushLock.WaitAsync(); try { return await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, now); } finally { _flushLock.Release(); } } private async Task FlushInternalUnderLockAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset now) { int flushed = 0; while (_pendingQueue.TryPeek(out var notif)) { // Drop expired notification while waiting in queue if (notif.ExpiresAt.HasValue && notif.ExpiresAt.Value <= now) { _pendingQueue.TryDequeue(out _); continue; } if (!isClientConnected()) { // Client not connected: halt flush, leave notif at head of queue break; } bool success; try { success = await sendToClientAsync(notif); } catch { success = false; } if (success) { // Dequeue ONLY after successful delivery _pendingQueue.TryDequeue(out _); flushed++; } else { // Send failed (pipe broken mid-send). Do NOT dequeue! // notif remains at the head of the queue. Halt flushing to preserve FIFO order. break; } } return flushed; } public void Remove(string notificationId) { if (string.IsNullOrEmpty(notificationId)) return; _flushLock.Wait(); try { var items = _pendingQueue.ToArray(); while (_pendingQueue.TryDequeue(out _)) { } foreach (var item in items) { if (!string.Equals(item.Id, notificationId, StringComparison.OrdinalIgnoreCase)) { _pendingQueue.Enqueue(item); } } } finally { _flushLock.Release(); } } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/ClientNotificationDeduplicator.cs SIZE: 3434 chars SHA256: 2DB19AD641E7DCA72254F8A3D5D3CF5154BEBF8F0F017AD6138950EA2D85219E ===================================================================== */ using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; namespace ClassNotify.Shared.Services; /// /// Client-side idempotent duplicate suppression for at-least-once message delivery. /// Ensures running clients do not display duplicate popups or trigger multiple TTS announcements /// when catching up or receiving retransmitted notifications with the same Notification ID. /// public class ClientNotificationDeduplicator { private readonly ConcurrentDictionary _processedMessageIds = new(); private readonly int _maxCapacity; private readonly TimeSpan _retentionPeriod; private readonly object _cleanupLock = new(); public ClientNotificationDeduplicator(int maxCapacity = 1000, TimeSpan? retentionPeriod = null) { _maxCapacity = maxCapacity; _retentionPeriod = retentionPeriod ?? TimeSpan.FromHours(24); } /// /// Atomically attempts to mark the notification as processed. /// /// The unique notification ID. /// True if this is the first time receiving this ID (allow processing); False if duplicate (suppress presentation). public bool TryProcess(string notificationId) { if (string.IsNullOrWhiteSpace(notificationId)) return false; var now = DateTimeOffset.UtcNow; if (!_processedMessageIds.TryAdd(notificationId, now)) { // Key already exists -> atomic duplicate detection return false; } // Bounded capacity protection if (_processedMessageIds.Count > _maxCapacity) { ThreadPool.QueueUserWorkItem(_ => CleanupStaleEntries()); } return true; } /// /// Checks whether an ID has been seen without mutating deduplication state. /// public bool IsProcessed(string notificationId) { return !string.IsNullOrWhiteSpace(notificationId) && _processedMessageIds.ContainsKey(notificationId); } public int Count => _processedMessageIds.Count; public void Clear() { _processedMessageIds.Clear(); } private void CleanupStaleEntries() { if (!Monitor.TryEnter(_cleanupLock)) return; try { var threshold = DateTimeOffset.UtcNow.Subtract(_retentionPeriod); foreach (var kvp in _processedMessageIds) { if (kvp.Value < threshold) { _processedMessageIds.TryRemove(kvp.Key, out _); } } // If still over capacity after expiry cleanup, purge oldest half if (_processedMessageIds.Count > _maxCapacity) { var removeCount = _processedMessageIds.Count - (_maxCapacity / 2); var oldestKeys = _processedMessageIds .OrderBy(kvp => kvp.Value) .Take(removeCount) .Select(kvp => kvp.Key) .ToList(); foreach (var key in oldestKeys) { _processedMessageIds.TryRemove(key, out _); } } } catch { // Best effort cleanup } finally { Monitor.Exit(_cleanupLock); } } } /* ===================================================================== FILE: src/Shared/ClassNotify.Shared/Services/DeviceCommandDeduplicator.cs SIZE: 7671 chars SHA256: 7AB6EE236FE3217D620DEC7982CB9144D054EB554C747EE1BEB112C27F037383 ===================================================================== */ using System.Collections.Concurrent; using System.Text.Json; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// 命令认领抢占状态 /// public enum CommandClaimResult { /// 成功抢占并在内存与磁盘物理账本中双重持久化成功 Claimed, /// 命令此前已执行完毕,持有已完成缓存结果 AlreadyCompleted, /// 命令当前正处于执行流中,尚未得出最终结果 InFlight, /// 持久化账本写入失败或本地账本文件已损坏,Fail-Closed 拒绝执行任何副作用 StorageError } /// /// 专用远程命令幂等去重器与持久化本地账本 (Windows Service 端) /// 保证同一 CommandId 在网络抖动、SignalR 重连、重复派发、乃至 Service 崩溃或重启后, /// 严格至多在物理终端执行一次实际副作用,并能安全幂等返回先前的执行结果。 /// 严格遵循 Fail-Closed 原则:当磁盘持久化失败或文件损坏时,决不允许在不具备持久保证的情况下执行副作用。 /// public class DeviceCommandDeduplicator { public class CommandExecutionRecord { public bool IsCompleted { get; set; } public DateTimeOffset Timestamp { get; set; } public DeviceCommandResultDto? Result { get; set; } } private readonly ConcurrentDictionary _records = new(); private readonly TimeSpan _slidingWindow; private readonly int _maxCapacity; private readonly string? _ledgerFilePath; private readonly object _fileLock = new(); private volatile bool _isCorrupted = false; public int Count => _records.Count; public string? LedgerFilePath => _ledgerFilePath; public bool IsCorrupted => _isCorrupted; public DeviceCommandDeduplicator( TimeSpan? slidingWindow = null, int maxCapacity = 1000, string? ledgerFilePath = null) { _slidingWindow = slidingWindow ?? TimeSpan.FromHours(1); _maxCapacity = maxCapacity; _ledgerFilePath = ledgerFilePath; LoadLedgerFromDisk(); } /// /// 尝试以持久化 Fail-Closed 保证抢占执行锁。 /// 只有在内存认领成功 且 磁盘持久化写入原子成功时,才返回 Claimed; /// 若账本损坏或持久化失败,立即回滚内存状态并返回 StorageError,阻断副作用执行。 /// public CommandClaimResult TryDurablyClaim(string commandId, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return CommandClaimResult.StorageError; if (_isCorrupted) return CommandClaimResult.StorageError; var now = nowUtc ?? DateTimeOffset.UtcNow; PruneIfNeeded(now); if (_records.TryGetValue(commandId, out var existing)) { return existing.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } var record = new CommandExecutionRecord { IsCompleted = false, Timestamp = now }; if (!_records.TryAdd(commandId, record)) { return _records.TryGetValue(commandId, out var r) && r.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } try { SaveLedgerToDisk(); return CommandClaimResult.Claimed; } catch { // Fail-closed: 回滚内存记录,确保没有虚假的 InFlight 状态残留在内存中 _records.TryRemove(commandId, out _); return CommandClaimResult.StorageError; } } /// /// 尝试抢占执行锁(兼容既有布尔接口,底层严格遵循 TryDurablyClaim 的 Fail-Closed 保证)。 /// public bool TryBeginExecution(string commandId, DateTimeOffset? nowUtc = null) { return TryDurablyClaim(commandId, nowUtc) == CommandClaimResult.Claimed; } /// /// 命令执行完毕后记录最终执行结果并持久化至磁盘 /// public void CompleteExecution(string commandId, DeviceCommandResultDto result, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return; var now = nowUtc ?? DateTimeOffset.UtcNow; if (_records.TryGetValue(commandId, out var record)) { record.IsCompleted = true; record.Timestamp = now; record.Result = result; } else { _records[commandId] = new CommandExecutionRecord { IsCompleted = true, Timestamp = now, Result = result }; } try { SaveLedgerToDisk(); } catch { // 写入失败时保留内存记录 } } /// /// 查询已完成命令的历史缓存结果(用于重复到达时直接返回原结果) /// public bool TryGetCachedResult(string commandId, out DeviceCommandResultDto? result) { result = null; if (string.IsNullOrWhiteSpace(commandId)) return false; if (_records.TryGetValue(commandId, out var record) && record.IsCompleted && record.Result != null) { result = record.Result; return true; } return false; } public void Clear() { _records.Clear(); _isCorrupted = false; try { SaveLedgerToDisk(); } catch { } } private void PruneIfNeeded(DateTimeOffset now) { bool pruned = false; var cutoff = now.Subtract(_slidingWindow); if (_records.Count > _maxCapacity) { foreach (var kvp in _records) { if (kvp.Value.Timestamp < cutoff) { if (_records.TryRemove(kvp.Key, out _)) { pruned = true; } } } } if (pruned) { try { SaveLedgerToDisk(); } catch { } } } private void LoadLedgerFromDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; try { lock (_fileLock) { if (!File.Exists(_ledgerFilePath)) return; var json = File.ReadAllText(_ledgerFilePath); if (string.IsNullOrWhiteSpace(json)) { // 存在但为空,视同损坏文件以防读取非预期状态 _isCorrupted = true; return; } var data = JsonSerializer.Deserialize>(json); if (data != null) { var now = DateTimeOffset.UtcNow; var cutoff = now.Subtract(_slidingWindow); foreach (var (k, v) in data) { if (v.Timestamp >= cutoff) { _records[k] = v; } } } else { _isCorrupted = true; } } } catch { // Fail-closed: 遇到反序列化异常或文件损坏时标记 Corrupted,阻止无保护的执行 _isCorrupted = true; } } private void SaveLedgerToDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; lock (_fileLock) { var dir = Path.GetDirectoryName(_ledgerFilePath); if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var snapshot = _records.ToDictionary(k => k.Key, v => v.Value); var json = JsonSerializer.Serialize(snapshot, new JsonSerializerOptions { WriteIndented = true }); var tmp = _ledgerFilePath + $".{Guid.NewGuid():N}.tmp"; File.WriteAllText(tmp, json); File.Move(tmp, _ledgerFilePath, overwrite: true); } } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/index.html SIZE: 859 chars SHA256: B2691CC09D200CB9D0A4CB5A6B8286AB1C8B628022D8CF034AA55DA215BC5244 ===================================================================== */ ClassNotify 智慧教室通知与集控平台
/* ===================================================================== FILE: src/Web/ClassNotify.Web/package-lock.json SIZE: 143265 chars SHA256: A475C6DD695A0ACCED51F30316CD03F2B72EF6ABFA29EF48A55B419656292C53 ===================================================================== */ { "name": "classnotify-web", "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "classnotify-web", "version": "2.1.0", "dependencies": { "@microsoft/signalr": "^8.0.7", "clsx": "^2.1.1", "lucide-react": "^0.475.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.28.0", "tailwind-merge": "^2.6.0" }, "devDependencies": { "@testing-library/jest-dom": "^7.0.1", "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.6.7", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.20", "jsdom": "^30.1.0", "playwright": "^1.63.0", "postcss": "^8.4.49", "tailwindcss": "^3.4.17", "typescript": "~5.6.2", "vite": "^6.0.1", "vitest": "^5.0.1" } }, "node_modules/@adobe/css-tools": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz", "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==", "dev": true, "license": "MIT" }, "node_modules/@alloc/quick-lru": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz", "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==", "dev": true, "license": "MIT", "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@asamuzakjp/css-color": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.0.1.tgz", "integrity": "sha512-C9duntabagkBZ1LebM7FKmphR4Q1pBclLxVbZETQV0akkFjV0ooFxo8FlvAQyKj9F6l8rEnmidgcTlpyxFYizg==", "dev": true, "license": "MIT", "dependencies": { "@csstools/css-calc": "^3.4.0", "@csstools/css-color-parser": "^4.2.3", "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.1", "lru-cache": "^11.5.3" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" } }, "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/@asamuzakjp/dom-selector": { "version": "9.2.1", "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-9.2.1.tgz", "integrity": "sha512-NT4s3yZLjovPpliRpTvdsdzyPjqRqiCZj9MxnarBihbaY5MbAG7DWAJcrLlhmC7xKTNCXsTELcqB8YsqpLnUFQ==", "dev": true, "license": "MIT", "dependencies": { "bidi-js": "^1.1.0", "css-tree": "^3.2.1", "is-potential-custom-element-name": "^1.0.1", "lru-cache": "^11.5.3" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" } }, "node_modules/@asamuzakjp/dom-selector/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-module-transforms": "^7.29.7", "@babel/helpers": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/babel" } }, "node_modules/@babel/generator": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.29.8", "@babel/types": "^7.29.8", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-globals": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", "dev": true, "license": "MIT", "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7", "@babel/traverse": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-plugin-utils": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { "version": "7.29.9", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.29.8" }, "bin": { "parser": "bin/babel-parser.js" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/plugin-transform-react-jsx-self": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/@babel/plugin-transform-react-jsx-source": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/@babel/runtime": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz", "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/template": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.8", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.8", "@babel/template": "^7.29.7", "@babel/types": "^7.29.8", "debug": "^4.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/types": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@bramus/specificity": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", "dev": true, "license": "MIT", "dependencies": { "css-tree": "^3.0.0" }, "bin": { "specificity": "bin/cli.js" } }, "node_modules/@csstools/color-helpers": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.1.tgz", "integrity": "sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT-0", "engines": { "node": ">=20.19.0" } }, "node_modules/@csstools/css-calc": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.0.tgz", "integrity": "sha512-XQKj5B7QiZcHiegCOCAzcAOJdhGgWOHbbu62h5e5mkHnn8lWcfiJhllkqWmxu5zWR9jucPHuo1iTB56P033hcg==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-color-parser": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.3.tgz", "integrity": "sha512-y4LpL+lmpuyKDiEFq2PnZUVFdAjsoB/qQJod79yLNokXyW7jewi+/WJ69EfItj8A2unWtxXnGjw6LYXgXu5ZjA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "dependencies": { "@csstools/color-helpers": "^6.1.1", "@csstools/css-calc": "^3.4.0" }, "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-parser-algorithms": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" }, "peerDependencies": { "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-syntax-patches-for-csstree": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.14.tgz", "integrity": "sha512-HpbVXyrofRXpHpgkNIjU/3EWR4WJvOkO3emNK/L6X/mTJU7bGUI3AkkpoTNXznQLp0KRjLHELTGeKI5dIkI9JQ==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT-0", "peerDependencies": { "css-tree": "^3.2.1" }, "peerDependenciesMeta": { "css-tree": { "optional": true } } }, "node_modules/@csstools/css-tokenizer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.1.tgz", "integrity": "sha512-bPlN9S9O1A0euCpEWE4qnvB5YDuyYVsUTrxSgmAM1Is0j4tICHoVyOVAXfWMP/kS9ZrjvyIXWV2PmomiAXXqOw==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/csstools" }, { "type": "opencollective", "url": "https://opencollective.com/csstools" } ], "license": "MIT", "engines": { "node": ">=20.19.0" } }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", "cpu": [ "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "aix" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-arm": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/android-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", "cpu": [ "loong64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", "cpu": [ "mips64el" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", "cpu": [ "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", "cpu": [ "riscv64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", "cpu": [ "s390x" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/netbsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openbsd-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/openharmony-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openharmony" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "sunos" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { "node": ">=18" } }, "node_modules/@exodus/bytes": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==", "dev": true, "license": "MIT", "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" }, "peerDependencies": { "@noble/hashes": "^1.8.0 || ^2.0.0" }, "peerDependenciesMeta": { "@noble/hashes": { "optional": true } } }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "node_modules/@jridgewell/remapping": { "version": "2.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.31", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@microsoft/signalr": { "version": "8.0.29", "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.29.tgz", "integrity": "sha512-yzszFiTAuRxHm3qxNaSan3YzN8dffLqQcc3ZNJD2tn9eInCBBi7u2xCJ6AVNXjw19RDoBc+NPWfYN43K1HcjdA==", "license": "MIT", "dependencies": { "abort-controller": "^3.0.0", "eventsource": "^2.0.2", "fetch-cookie": "^2.0.3", "node-fetch": "^2.6.7", "ws": "^7.5.10" } }, "node_modules/@napi-rs/lzma-linux-x64-gnu": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", "cpu": [ "x64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { "node": "^22.20 || ^24.12 || >=25" } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" }, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.stat": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" }, "engines": { "node": ">= 8" } }, "node_modules/@remix-run/router": { "version": "1.23.4", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.4.tgz", "integrity": "sha512-q7j5geK7xs3UJSdm9/iytUNclBnLmYx1EnSeCFXHPeutdqgIMeFeHtUZgS3EhlKxdBEAu8OwtJCwmLrEzpSs7Q==", "license": "MIT", "engines": { "node": ">=14.0.0" } }, "node_modules/@rolldown/pluginutils": { "version": "1.0.0-beta.27", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", "dev": true, "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.4.tgz", "integrity": "sha512-I+BSHzTAhKN2n7ZwGZsegGcZjDpLqFOMAtJz/u6uFGe0pUFbq56dEHjqJV/ZUdRJtNXNxA+hREUatZBvMR3Oiw==", "cpu": [ "arm" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.4.tgz", "integrity": "sha512-pu3BdjS2LtEzRu2elmGzS3fIeWSZy4BMDIaLNwjorO76+k2d0LMluijhsDx3KQyQBQ/lLUZCQA9/s6csvUfuhw==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.4.tgz", "integrity": "sha512-xfSrj9MHnWK9GaSqT9U0ImHtH/N8WZlHLx4cZHiuLcqs640hvZ3hLPd5UR2AZS57FaE8HrRUSpltbZdWRxHiDA==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.4.tgz", "integrity": "sha512-bqU99PLJb/dqb3S0GIMdeuyAEETSUgZBoqXYd3Sd+WCsV+MmPhnN6JrotWyir31+QgH7EvvE5/mwGJlEoci8Fw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-freebsd-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.4.tgz", "integrity": "sha512-JinsFZ5G40oXQb+sUuiA5x689vhr6dDYK0H0NL+rwKdL6CqnmYN8PE4ZwfRSoIjrCxqTQG/SLfTtSvHeGxoVlw==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-freebsd-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.4.tgz", "integrity": "sha512-GAdA4UxpiNm27cLHr2GqXBpAD0x9FqwYBY7/YSP0Ss0/PNi4k8gbviqpIpYbVSRBaS2ZcegXEzgTQMbRNCwxCw==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.4.tgz", "integrity": "sha512-qDd6NoA1znaLjp4jR5U/KWCdLAKDJNB8W9ChbbDaKbo0xA+Atln5HK6LFCZ4oJQpemtRZA288DCirFRjrspptw==", "cpu": [ "arm" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.4.tgz", "integrity": "sha512-WtB5Tz5KTNINb8ZA+8sQ7bmjuS1JrRT7YverYIhUGdWWDlpzVWmIwuZE+jidkEXUn1l0zrEkaIMa8dHF3NGcsA==", "cpu": [ "arm" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.4.tgz", "integrity": "sha512-VcQ3L1tjnkKzWjryAVaFhHEWcqOfICX9uxVVoDzm2t0DpgKRHd2zOpVrJc0xsWeBZcBFyYROCIBdyR/fS174pg==", "cpu": [ "arm64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.4.tgz", "integrity": "sha512-6+ZQX6P5s0cMDN2Ypb8Lbm2+/sZYmZjdaYny992ujUU9UKi/4CWoJWsl1pNvjWJHNHGK51m+jKGLlh1ylb2ifQ==", "cpu": [ "arm64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.4.tgz", "integrity": "sha512-D72ZnvkFkBXOfzMMQLcwfPLyGkKb7HZ9/mf97B7v6/P5Lbv4oFOtSY/uHbS8lH6uKUOxoKiuokdb50XZSzzbJw==", "cpu": [ "loong64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.4.tgz", "integrity": "sha512-piU6BxeqA3O9KSu3kRCIQQtNqFFaTu21SEV4FwaRZowpnj3bLaWPZHw+xFqCs0XlJ+aOH3PTRWGoglH+mKA/OA==", "cpu": [ "loong64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.4.tgz", "integrity": "sha512-/5PGpHwqt2EEEOUs1XwzubE/ucr0dWDQ+to3zqi4Ds7EWpwtQ79wXc4JBoxqj/OwpawTsKWzJxHfSuBOq3DrWA==", "cpu": [ "ppc64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.4.tgz", "integrity": "sha512-cX3beZDLWt7G2oJF+nhChiT+qtaihs+S2xi7ziGmVB+2pwPng6D0Ed0HmElQOgv2UsUmSJJLGwpBao/3TDx3VA==", "cpu": [ "ppc64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.4.tgz", "integrity": "sha512-1uz2mGWHyptR7DgHHrlbdRAjXK7v7elGZ9lMja910/RP+ZYbX6xAmCiU9UZSX4hqmgtHMv6lr5l3kq1HIOpcag==", "cpu": [ "riscv64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.4.tgz", "integrity": "sha512-nLS8topojxyz7SRpKR2IODRpQ0XPZ+xaOXvT3+hqK/Uy8Lo5HFgkkIBiIrCu5tL5YqzTvgovGw55PwpahTAGig==", "cpu": [ "riscv64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.4.tgz", "integrity": "sha512-gs7DRKotr3l3q+jGPQBjH0ng1FjlEDm5ueQrkw5JtQvtLyEIcLASqAEaor56BhkKRzk+IcQzrcanBdb/bBQn8g==", "cpu": [ "s390x" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.4.tgz", "integrity": "sha512-791ET7W17NnScOZM7h4dX5hYspxE28htPFsb1awY/NRR8+PRNkS53e475rDdxXXDrP+kwnCcNWg9CX5ztn/Aqw==", "cpu": [ "x64" ], "dev": true, "libc": [ "glibc" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.4.tgz", "integrity": "sha512-iwZQRcmj7g88g3tzefIrQY7qvmuA/cfYwhrDtTBhsmukO4U2huVO5W+86XacUMRvdSFVAc6kZUZy21JaRwiB9w==", "cpu": [ "x64" ], "dev": true, "libc": [ "musl" ], "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-openbsd-x64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.4.tgz", "integrity": "sha512-dVHFp9gRWrdTpnqQuGfCwd7hOQDatK1VCP2iWhLY/cGrOQs/ucFzJ6A5SRqbXX12ZDI8EUuejSM5kwg+ja7Png==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openbsd" ] }, "node_modules/@rollup/rollup-openharmony-arm64": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.4.tgz", "integrity": "sha512-t3NlauOW6gxZVVFcBEnO62Cb4wbyDFL416gTg1uFI/2tgqYQlf69FbSE115Ajre9I+c26Lk4mcmdFUsS/DGifQ==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "openharmony" ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.4.tgz", "integrity": "sha512-xWuIaSye5FWZF8+UYtVEcHtRJDN5kN9Kfgxx3Kq8XIov9KSKbc1fiqQCm90SKrgQbUXZelbnUhnlUJmfSE7P9A==", "cpu": [ "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.4.tgz", "integrity": "sha512-9ALJJUOg/ZflMJepVo2PlgsGxSaxN7SQ4Z8GoZfVlarWr6r3rkHUNsd/zAio7p4YMtChSMXPionxej4Hkf6CXQ==", "cpu": [ "ia32" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.4.tgz", "integrity": "sha512-blj9z5qx/Pv4WU0W1NMFDB97e0JH5ed+aZGywW8WCvp/NhWX/4PFAq5uu6Q0AebNn+Vo6KzUYDT++JzTT5ojlQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.4.tgz", "integrity": "sha512-Erx822VRBwLa124shbj+wNXe//BOgMEctDV0m1aqTQdNO1S69DgNUCFKC1RCeZfixs1J31l6igk1ziyXErbigQ==", "cpu": [ "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@testing-library/dom": { "version": "10.4.2", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" }, "engines": { "node": ">=18" } }, "node_modules/@testing-library/jest-dom": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-7.0.1.tgz", "integrity": "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==", "dev": true, "license": "MIT", "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" }, "engines": { "node": ">=22", "npm": ">=6", "yarn": ">=1" }, "peerDependencies": { "@testing-library/dom": ">=10 <11", "vitest": ">= 0.32" }, "peerDependenciesMeta": { "vitest": { "optional": true } } }, "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", "dev": true, "license": "MIT" }, "node_modules/@testing-library/react": { "version": "16.3.3", "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5" }, "engines": { "node": ">=18" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true }, "@types/react-dom": { "optional": true } } }, "node_modules/@testing-library/user-event": { "version": "14.6.7", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.7.tgz", "integrity": "sha512-MPCpX8bxe8zS+JmmTwLp8jd0dy1rAm60Te/SL8JrQM3qvQJcBOs1d7IefJMyZzqM3EWBrDn/LWDt1BCGu4ASfg==", "dev": true, "license": "MIT", "engines": { "node": ">=12", "npm": ">=6" }, "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true, "license": "MIT", "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "node_modules/@types/babel__generator": { "version": "7.27.0", "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__traverse": { "version": "7.28.0", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.28.2" } }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", "dev": true, "license": "MIT", "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "node_modules/@types/deep-eql": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", "dev": true, "license": "MIT" }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, "node_modules/@types/prop-types": { "version": "15.7.15", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", "dev": true, "license": "MIT" }, "node_modules/@types/react": { "version": "18.3.31", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz", "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==", "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" } }, "node_modules/@types/react-dom": { "version": "18.3.7", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^18.0.0" } }, "node_modules/@vitejs/plugin-react": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "node_modules/@vitest/mocker": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.1.tgz", "integrity": "sha512-6K1DoBNAPGvuOcSsGA4D6x+5zEEff/KmOOP3uetT2TrGpVfI+HRHRnJJfKi5ib/g1vx8IYHQD8s0pbJz8WQI7Q==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.0.1", "estree-walker": "^3.0.3", "magic-string": "^1.2.3" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "msw": { "optional": true }, "vite": { "optional": true } } }, "node_modules/@vitest/spy": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.1.tgz", "integrity": "sha512-rbto/mF/SGERxEgYOek7Xm6B9b+y+mVoo+f4b2LymYO8zM1b7uB5nHuhVMTP2hxdzgxvGiZYGxGIaMvL5y180Q==", "dev": true, "license": "MIT", "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "license": "MIT", "dependencies": { "event-target-shim": "^5.0.0" }, "engines": { "node": ">=6.5" } }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", "dev": true, "license": "MIT" }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" }, "engines": { "node": ">= 8" } }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "dev": true, "license": "MIT" }, "node_modules/aria-query": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, "license": "Apache-2.0", "dependencies": { "dequal": "^2.0.3" } }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" } }, "node_modules/autoprefixer": { "version": "10.6.1", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.6.1.tgz", "integrity": "sha512-cL1Qz6ADZhcEbny/8HPfe99J6HhNoYtpX2LFLIbhgGE7Q1hlQVkYFdetDN7Id3KiQxhDrHwzlHr/YQCnZ8+xSA==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/autoprefixer" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "browserslist": "^4.28.9", "caniuse-lite": "^1.0.30001810", "fraction.js": "^5.3.4", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { "autoprefixer": "bin/autoprefixer" }, "engines": { "node": "^10 || ^12 || >=14" }, "peerDependencies": { "postcss": "^8.1.0" } }, "node_modules/baseline-browser-mapping": { "version": "2.11.25", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz", "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==", "dev": true, "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" }, "engines": { "node": ">=6.0.0" } }, "node_modules/bidi-js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", "dev": true, "license": "MIT", "dependencies": { "require-from-string": "^2.0.2" } }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "license": "MIT", "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, "engines": { "node": ">=8" } }, "node_modules/browserslist": { "version": "4.29.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "baseline-browser-mapping": "^2.11.23", "caniuse-lite": "^1.0.30001810", "electron-to-chromium": "^1.5.427", "node-releases": "^2.0.55", "update-browserslist-db": "^1.3.3" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, "node_modules/camelcase-css": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/caniuse-lite": { "version": "1.0.30001810", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "CC-BY-4.0" }, "node_modules/chai": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "engines": { "node": ">= 8.10.0" }, "funding": { "url": "https://paulmillr.com/funding/" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/chokidar/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true, "license": "MIT" }, "node_modules/css-tree": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", "dev": true, "license": "MIT", "dependencies": { "mdn-data": "2.27.1", "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, "node_modules/css.escape": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", "dev": true, "license": "MIT" }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true, "license": "MIT", "bin": { "cssesc": "bin/cssesc" }, "engines": { "node": ">=4" } }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "dev": true, "license": "MIT" }, "node_modules/data-urls": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", "dev": true, "license": "MIT", "dependencies": { "whatwg-mimetype": "^5.0.0", "whatwg-url": "^16.0.0" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/data-urls/node_modules/tr46": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", "dev": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "engines": { "node": ">=20" } }, "node_modules/data-urls/node_modules/webidl-conversions": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20" } }, "node_modules/data-urls/node_modules/whatwg-url": { "version": "16.0.1", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.11.0", "tr46": "^6.0.0", "webidl-conversions": "^8.0.1" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", "dev": true, "license": "MIT" }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true, "license": "Apache-2.0" }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "dev": true, "license": "MIT" }, "node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true, "license": "MIT", "peer": true }, "node_modules/electron-to-chromium": { "version": "1.5.433", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.433.tgz", "integrity": "sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA==", "dev": true, "license": "ISC" }, "node_modules/entities": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20.19.0" }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/es-errors": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/es-module-lexer": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", "dev": true, "license": "MIT" }, "node_modules/esbuild": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { "node": ">=18" }, "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" } }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.0" } }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/eventsource": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", "license": "MIT", "engines": { "node": ">=12.0.0" } }, "node_modules/expect-type": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.0.0" } }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" }, "engines": { "node": ">=8.6.0" } }, "node_modules/fast-glob/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/fastq": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", "dev": true, "license": "ISC", "dependencies": { "reusify": "^1.0.4" } }, "node_modules/fetch-cookie": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.2.0.tgz", "integrity": "sha512-h9AgfjURuCgA2+2ISl8GbavpUdR+WGAM2McW/ovn4tVccegp8ZqCKWSBR8uRdM8dDNlx5WdKRWxBYUwteLDCNQ==", "license": "Unlicense", "dependencies": { "set-cookie-parser": "^2.4.8", "tough-cookie": "^4.0.0" } }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/fraction.js": { "version": "5.3.4", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", "dev": true, "license": "MIT", "engines": { "node": "*" }, "funding": { "type": "github", "url": "https://github.com/sponsors/rawify" } }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, "engines": { "node": ">=10.13.0" } }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/html-encoding-sniffer": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.6.0" }, "engines": { "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-core-module": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.4" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "license": "MIT", "engines": { "node": ">=0.12.0" } }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true, "license": "MIT" }, "node_modules/jiti": { "version": "1.21.7", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, "license": "MIT", "bin": { "jiti": "bin/jiti.js" } }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "license": "MIT" }, "node_modules/jsdom": { "version": "30.1.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.0.tgz", "integrity": "sha512-h/Q+H+KmlGf49ITw3TrykSVbg04S75S2O7ZtJc9gMGOWBrQRZmx5AJIKLtJ01e6Kszl+/tpFthCVqxNifxhoqg==", "dev": true, "license": "MIT", "dependencies": { "@asamuzakjp/css-color": "^7.0.0", "@asamuzakjp/dom-selector": "^9.1.2", "@bramus/specificity": "^2.4.2", "@csstools/css-syntax-patches-for-csstree": "^1.1.13", "@exodus/bytes": "^1.15.1", "css-tree": "^3.2.1", "data-urls": "^7.0.0", "decimal.js": "^10.6.0", "html-encoding-sniffer": "^6.0.0", "is-potential-custom-element-name": "^1.0.1", "lru-cache": "^11.5.2", "parse5": "^8.0.1", "saxes": "^6.0.0", "tough-cookie": "^6.0.2", "undici": "^8.10.2", "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^8.0.1", "whatwg-mimetype": "^5.0.0", "whatwg-url": "^17.1.1", "xml-name-validator": "^5.0.0" }, "engines": { "node": "^22.22.2 || ^24.15.0 || >=26.0.0" }, "peerDependencies": { "canvas": "^3.2.3" }, "peerDependenciesMeta": { "canvas": { "optional": true } } }, "node_modules/jsdom/node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, "node_modules/jsdom/node_modules/tough-cookie": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { "tldts": "^7.0.5" }, "engines": { "node": ">=16" } }, "node_modules/jsdom/node_modules/tr46": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", "dev": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "engines": { "node": ">=20" } }, "node_modules/jsdom/node_modules/webidl-conversions": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=20" } }, "node_modules/jsdom/node_modules/whatwg-url": { "version": "17.1.2", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.2.tgz", "integrity": "sha512-TEZA+Zqxin7Jjsm2cjRohCmen5awh+hT6Zi3VZdqZlNRk7zvOI/9WpBFg/DWlA56bWnzwm6DuB8NS0EsxQH9uQ==", "dev": true, "license": "MIT", "dependencies": { "@exodus/bytes": "^1.15.1", "tr46": "^6.0.0", "webidl-conversions": "^8.0.1" }, "engines": { "node": "^22.14.0 || >=24.0.0" } }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { "node": ">=6" } }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "license": "MIT", "bin": { "json5": "lib/cli.js" }, "engines": { "node": ">=6" } }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "dev": true, "license": "MIT", "engines": { "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/antonk52" } }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true, "license": "MIT" }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "license": "MIT", "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, "license": "ISC", "dependencies": { "yallist": "^3.0.2" } }, "node_modules/lucide-react": { "version": "0.475.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.475.0.tgz", "integrity": "sha512-NJzvVu1HwFVeZ+Gwq2q00KygM1aBhy/ZrhY9FsAgJtpB+E4R7uxRk9M2iKvHa6/vNxZydIB59htha4c2vvwvVg==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "license": "MIT", "peer": true, "bin": { "lz-string": "bin/bin.js" } }, "node_modules/magic-string": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.1.tgz", "integrity": "sha512-8lyCu36ErXR0J9uaGKlKQoiLZKmtI63YGLE8G2o9jyRPdr4X47LusSOwgOJOzcVtp81fTAAjxR7BwKz682Jhow==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "node_modules/mdn-data": { "version": "2.27.1", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", "dev": true, "license": "CC0-1.0" }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" } }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true, "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "license": "MIT" }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", "dev": true, "license": "MIT", "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "node_modules/nanoid": { "version": "3.3.19", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, "engines": { "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, "engines": { "node": "4.x || >=6.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "peerDependenciesMeta": { "encoding": { "optional": true } } }, "node_modules/node-releases": { "version": "2.0.56", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.56.tgz", "integrity": "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-hash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/obug": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", "dev": true, "funding": [ "https://github.com/sponsors/sxzz", "https://opencollective.com/debug" ], "license": "MIT", "engines": { "node": ">=12.20.0" } }, "node_modules/parse5": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", "dev": true, "license": "MIT", "dependencies": { "entities": "^8.0.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" } }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true, "license": "MIT" }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true, "license": "MIT", "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pirates": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", "dev": true, "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/playwright": { "version": "1.63.0", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.63.0.tgz", "integrity": "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==", "dev": true, "license": "Apache-2.0", "dependencies": { "playwright-core": "1.63.0" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=20" } }, "node_modules/playwright-core": { "version": "1.63.0", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz", "integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==", "dev": true, "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { "node": ">=20" } }, "node_modules/postcss": { "version": "8.5.28", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "nanoid": "^3.3.18", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" } }, "node_modules/postcss-import": { "version": "15.1.0", "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", "dev": true, "license": "MIT", "dependencies": { "postcss-value-parser": "^4.0.0", "read-cache": "^1.0.0", "resolve": "^1.1.7" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "postcss": "^8.0.0" } }, "node_modules/postcss-js": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "camelcase-css": "^2.0.1" }, "engines": { "node": "^12 || ^14 || >= 16" }, "peerDependencies": { "postcss": "^8.4.21" } }, "node_modules/postcss-load-config": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "lilconfig": "^3.1.1" }, "engines": { "node": ">= 18" }, "peerDependencies": { "jiti": ">=1.21.0", "postcss": ">=8.0.9", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "peerDependenciesMeta": { "jiti": { "optional": true }, "postcss": { "optional": true }, "tsx": { "optional": true }, "yaml": { "optional": true } } }, "node_modules/postcss-nested": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/postcss/" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.1.1" }, "engines": { "node": ">=12.0" }, "peerDependencies": { "postcss": "^8.2.14" } }, "node_modules/postcss-selector-parser": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", "dev": true, "license": "MIT", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" }, "engines": { "node": ">=4" } }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true, "license": "MIT" }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/psl": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", "license": "MIT", "dependencies": { "punycode": "^2.3.1" }, "funding": { "url": "https://github.com/sponsors/lupomontero" } }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", "license": "MIT" }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "license": "MIT" }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" }, "peerDependencies": { "react": "^18.3.1" } }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true, "license": "MIT", "peer": true }, "node_modules/react-refresh": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-router": { "version": "6.30.6", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.6.tgz", "integrity": "sha512-5HfK7k5im7LTOB0EqCQmfvy4C13G92Ssj1VTmouTK3AJvyjKTnFuCV0vcMAD/JS+JC4DvDIBRrlAeJIFjh5VWg==", "license": "MIT", "dependencies": { "@remix-run/router": "1.23.4" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8" } }, "node_modules/react-router-dom": { "version": "6.30.6", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.6.tgz", "integrity": "sha512-0RHKZz7wwffvkU+2MFVT2NnjK44ssLEV+m0CAJaS2Ksmorrwj7WxH00jO0SOCW26/tINUnJHToXblDs33I38YQ==", "license": "MIT", "dependencies": { "@remix-run/router": "1.23.4", "react-router": "6.30.6" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8", "react-dom": ">=16.8" } }, "node_modules/read-cache": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz", "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==", "dev": true, "license": "MIT" }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, "engines": { "node": ">=8.10.0" } }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, "license": "MIT", "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "license": "MIT" }, "node_modules/resolve": { "version": "1.22.12", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rollup": { "version": "4.63.4", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.4.tgz", "integrity": "sha512-4U0liVayNIoLp3GFl1FcI8561WepLnZ1rqfraGh7S9B3Ur5F9S283y8Futii7RUU2C/97tOBmBy7nYvhoiOpbQ==", "dev": true, "license": "MIT", "dependencies": { "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.63.4", "@rollup/rollup-android-arm64": "4.63.4", "@rollup/rollup-darwin-arm64": "4.63.4", "@rollup/rollup-darwin-x64": "4.63.4", "@rollup/rollup-freebsd-arm64": "4.63.4", "@rollup/rollup-freebsd-x64": "4.63.4", "@rollup/rollup-linux-arm-gnueabihf": "4.63.4", "@rollup/rollup-linux-arm-musleabihf": "4.63.4", "@rollup/rollup-linux-arm64-gnu": "4.63.4", "@rollup/rollup-linux-arm64-musl": "4.63.4", "@rollup/rollup-linux-loong64-gnu": "4.63.4", "@rollup/rollup-linux-loong64-musl": "4.63.4", "@rollup/rollup-linux-ppc64-gnu": "4.63.4", "@rollup/rollup-linux-ppc64-musl": "4.63.4", "@rollup/rollup-linux-riscv64-gnu": "4.63.4", "@rollup/rollup-linux-riscv64-musl": "4.63.4", "@rollup/rollup-linux-s390x-gnu": "4.63.4", "@rollup/rollup-linux-x64-gnu": "4.63.4", "@rollup/rollup-linux-x64-musl": "4.63.4", "@rollup/rollup-openbsd-x64": "4.63.4", "@rollup/rollup-openharmony-arm64": "4.63.4", "@rollup/rollup-win32-arm64-msvc": "4.63.4", "@rollup/rollup-win32-ia32-msvc": "4.63.4", "@rollup/rollup-win32-x64-gnu": "4.63.4", "@rollup/rollup-win32-x64-msvc": "4.63.4", "fsevents": "~2.3.2" } }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, "license": "ISC", "dependencies": { "xmlchars": "^2.2.0" }, "engines": { "node": ">=v12.22.7" } }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" } }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" } }, "node_modules/set-cookie-parser": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", "license": "MIT" }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true, "license": "ISC" }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true, "license": "MIT" }, "node_modules/std-env": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", "dev": true, "license": "MIT" }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, "license": "MIT", "dependencies": { "min-indent": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/sucrase": { "version": "3.35.1", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" }, "engines": { "node": ">=16 || 14 >=14.17" } }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/tailwind-merge": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.6.1.tgz", "integrity": "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ==", "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/dcastil" } }, "node_modules/tailwindcss": { "version": "3.4.19", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", "dev": true, "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", "jiti": "^1.21.7", "lilconfig": "^3.1.3", "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.1.1", "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", "postcss-nested": "^6.2.0", "postcss-selector-parser": "^6.1.2", "resolve": "^1.22.8", "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", "tailwindcss": "lib/cli.js" }, "engines": { "node": ">=14.0.0" } }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", "dev": true, "license": "MIT", "dependencies": { "any-promise": "^1.0.0" } }, "node_modules/thenify-all": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", "dev": true, "license": "MIT", "dependencies": { "thenify": ">= 3.1.0 < 4" }, "engines": { "node": ">=0.8" } }, "node_modules/tinybench": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.1.4.tgz", "integrity": "sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" } }, "node_modules/tinyexec": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" }, "funding": { "url": "https://github.com/sponsors/SuperchupuDev" } }, "node_modules/tinyglobby/node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", "engines": { "node": ">=12.0.0" }, "peerDependencies": { "picomatch": "^3 || ^4" }, "peerDependenciesMeta": { "picomatch": { "optional": true } } }, "node_modules/tinyglobby/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/tldts": { "version": "7.4.13", "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.13.tgz", "integrity": "sha512-iHtaIWWIbMDkCeJdTBzZFGgbluE5J+oHlb2g7+oAz1S1gpuVpabRZdQyd471Vl8UUkcz2vXSL8xZH2kyCe8tfA==", "dev": true, "license": "MIT", "dependencies": { "tldts-core": "^7.4.13" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { "version": "7.4.13", "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.13.tgz", "integrity": "sha512-mbYsrih5FRtGxs3Usvl/PqwJsNpp+jsmrdFviiK02teHDG0/HebBG/pqCylje3kzgXYzuLoHJF/0mz9W53t8Xg==", "dev": true, "license": "MIT" }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/tough-cookie": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", "license": "BSD-3-Clause", "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", "universalify": "^0.2.0", "url-parse": "^1.5.3" }, "engines": { "node": ">=6" } }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "license": "MIT" }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", "dev": true, "license": "Apache-2.0" }, "node_modules/typescript": { "version": "5.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=14.17" } }, "node_modules/undici": { "version": "8.10.2", "resolved": "https://registry.npmjs.org/undici/-/undici-8.10.2.tgz", "integrity": "sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ==", "dev": true, "license": "MIT", "engines": { "node": ">=22.19.0" } }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "license": "MIT", "engines": { "node": ">= 4.0.0" } }, "node_modules/update-browserslist-db": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==", "dev": true, "funding": [ { "type": "opencollective", "url": "https://opencollective.com/browserslist" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" }, { "type": "github", "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" } }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "license": "MIT", "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true, "license": "MIT" }, "node_modules/vite": { "version": "6.4.3", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "bin": { "vite": "bin/vite.js" }, "engines": { "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, "jiti": { "optional": true }, "less": { "optional": true }, "lightningcss": { "optional": true }, "sass": { "optional": true }, "sass-embedded": { "optional": true }, "stylus": { "optional": true }, "sugarss": { "optional": true }, "terser": { "optional": true }, "tsx": { "optional": true }, "yaml": { "optional": true } } }, "node_modules/vite/node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", "engines": { "node": ">=12.0.0" }, "peerDependencies": { "picomatch": "^3 || ^4" }, "peerDependenciesMeta": { "picomatch": { "optional": true } } }, "node_modules/vite/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/vitest": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.1.tgz", "integrity": "sha512-iA95lQbKEkvrtTkdAgnWbXfbipWiiWe/hDl2P5tMi6WFwD76G0NxXAGp/M9EOcYupeGJRr6wppMc7CoA41TQjg==", "dev": true, "license": "MIT", "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.0.1", "chai": "^6.2.2", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.2.3", "obug": "^2.1.4", "picomatch": "^4.0.7", "std-env": "^4.2.0", "tinybench": "6.1.4", "tinyexec": "1.3.0", "tinyglobby": "^0.2.17", "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { "node": "^22.12.0 || ^24.0.0 || >=26.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.0.1", "@vitest/browser-preview": "5.0.1", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.0.1", "@vitest/coverage-v8": "5.0.1", "@vitest/ui": "5.0.1", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "@edge-runtime/vm": { "optional": true }, "@opentelemetry/api": { "optional": true }, "@types/node": { "optional": true }, "@vitest/browser-playwright": { "optional": true }, "@vitest/browser-preview": { "optional": true }, "@vitest/browser-webdriverio": { "optional": true }, "@vitest/coverage-istanbul": { "optional": true }, "@vitest/coverage-v8": { "optional": true }, "@vitest/ui": { "optional": true }, "happy-dom": { "optional": true }, "jsdom": { "optional": true }, "vite": { "optional": false } } }, "node_modules/vitest/node_modules/picomatch": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dev": true, "license": "MIT", "dependencies": { "xml-name-validator": "^5.0.0" }, "engines": { "node": ">=18" } }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, "node_modules/whatwg-mimetype": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", "dev": true, "license": "MIT", "engines": { "node": ">=20" } }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "node_modules/why-is-node-running": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, "license": "MIT", "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" }, "engines": { "node": ">=8" } }, "node_modules/ws": { "version": "7.5.13", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.13.tgz", "integrity": "sha512-rsKI6xDBFVf4r/x8XyChGK04QR/XHroxs/jUcoWvtEZM8TPU/X/uIY9B1CsSzYws9ZJb/6bbBu7dPhFW00CAoA==", "license": "MIT", "engines": { "node": ">=8.3.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }, "node_modules/xml-name-validator": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "dev": true, "license": "Apache-2.0", "engines": { "node": ">=18" } }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true, "license": "MIT" }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "license": "ISC" } } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/package.json SIZE: 932 chars SHA256: 5A8E537F6900EEA1BC3E774C807BAD5F393E2F0BA1015B3D79EAC2187A2BA423 ===================================================================== */ { "name": "classnotify-web", "private": true, "version": "2.1.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", "test": "vitest run" }, "dependencies": { "@microsoft/signalr": "^8.0.7", "clsx": "^2.1.1", "lucide-react": "^0.475.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.28.0", "tailwind-merge": "^2.6.0" }, "devDependencies": { "@testing-library/jest-dom": "^7.0.1", "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.6.7", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.20", "jsdom": "^30.1.0", "playwright": "^1.63.0", "postcss": "^8.4.49", "tailwindcss": "^3.4.17", "typescript": "~5.6.2", "vite": "^6.0.1", "vitest": "^5.0.1" } } /* ===================================================================== FILE: src/Web/ClassNotify.Web/postcss.config.js SIZE: 80 chars SHA256: 190C877DB466995BF1482F4A16ABD06E04A89EDE3119341E2A86FF96E1737B27 ===================================================================== */ export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, } /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/api/client.ts SIZE: 9490 chars SHA256: FC9C311F9464D089A3C27A0B1E49D519BDF91DD652808AB47ED0B54941CA5B52 ===================================================================== */ import { AdminMetrics, TenantAdmin, DeviceAdmin, ActivationCode, Classroom, TeacherUser, NotificationRecord, SendNotificationPayload, LoginResult, CurrentUser, UserAdmin, CreateUserAdminRequest, CreateTenantRequest, UpdateTenantRequest, UpdateDeviceRequest, EmergencyBroadcastRequest, SystemHealth, AdminAuditLog, BroadcastReceiptSummary } from '../types'; import { sessionManager } from '../realtime/SessionManager'; const API_BASE = '/api'; export function getToken(): string | null { return localStorage.getItem('classnotify_token'); } export function setToken(token: string) { localStorage.setItem('classnotify_token', token); } export function clearToken() { localStorage.removeItem('classnotify_token'); localStorage.removeItem('classnotify_user'); } async function request(endpoint: string, options: RequestInit = {}): Promise { const token = getToken(); const headers: Record = { 'Content-Type': 'application/json', ...(options.headers as Record), }; if (token) { headers['Authorization'] = `Bearer ${token}`; } const res = await fetch(`${API_BASE}${endpoint}`, { ...options, headers, }); if (res.status === 401) { clearToken(); sessionManager.notifySessionExpired('未授权或登录已过期,请重新登录'); throw new Error('未授权或登录已过期,请重新登录'); } if (!res.ok) { let errorMsg = `请求失败 (${res.status})`; try { const err = await res.json(); errorMsg = err.message || err.errorMessage || errorMsg; } catch { // ignore json parse error } throw new Error(errorMsg); } return res.json() as Promise; } export const api = { // Auth login: (username: string, password: string): Promise => request('/auth/login', { method: 'POST', body: JSON.stringify({ username, password }), }), getMe: (): Promise => request('/auth/me'), // SuperAdmin getAdminMetrics: (): Promise => request('/admin/metrics'), getTenants: (): Promise => request('/admin/tenants'), getAllDevices: (): Promise => request('/admin/devices'), sendDeviceCommand: (deviceId: string, command: string, parameters?: string) => request<{ success: boolean; message: string }>(`/admin/devices/${deviceId}/command`, { method: 'POST', body: JSON.stringify({ command, parameters }), }), getAdminActivationCodes: (): Promise => request('/admin/activation-codes'), getAdminClasses: (tenantId: string): Promise => request(`/admin/classes?tenantId=${encodeURIComponent(tenantId)}`), generateAdminCode: (tenantId: string, classId: string) => request<{ success: boolean; code: string; message: string }>( `/admin/activation-codes?tenantId=${encodeURIComponent(tenantId)}&classId=${encodeURIComponent(classId)}`, { method: 'POST' } ), getAdminNotifications: (limit = 50): Promise => request(`/admin/notifications?limit=${limit}`), // Tenant Management createTenant: (dto: CreateTenantRequest): Promise => request('/admin/tenants', { method: 'POST', body: JSON.stringify(dto), }), updateTenant: (tenantId: string, dto: UpdateTenantRequest): Promise => request(`/admin/tenants/${encodeURIComponent(tenantId)}`, { method: 'PATCH', body: JSON.stringify(dto), }), // User Management getUsers: (tenantId?: string, role?: string): Promise => { const params = new URLSearchParams(); if (tenantId) params.append('tenantId', tenantId); if (role) params.append('role', role); const qs = params.toString(); return request(`/admin/users${qs ? `?${qs}` : ''}`); }, createUser: (dto: CreateUserAdminRequest): Promise => request('/admin/users', { method: 'POST', body: JSON.stringify(dto), }), resetPassword: (userId: string, newPassword: string) => request<{ success: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}/reset-password`, { method: 'POST', body: JSON.stringify({ newPassword }), }), setUserLock: (userId: string, isLocked: boolean) => request<{ success: boolean; isLocked: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}/lock`, { method: 'POST', body: JSON.stringify({ isLocked }), }), deleteUser: (userId: string) => request<{ success: boolean; message: string }>(`/admin/users/${encodeURIComponent(userId)}`, { method: 'DELETE', }), // Device Extensions updateDevice: (deviceId: string, dto: UpdateDeviceRequest) => request<{ success: boolean; message: string }>(`/admin/devices/${encodeURIComponent(deviceId)}`, { method: 'PATCH', body: JSON.stringify(dto), }), decommissionDevice: (deviceId: string) => request<{ success: boolean; message: string }>(`/admin/devices/${encodeURIComponent(deviceId)}/decommission`, { method: 'POST', }), // Activation Code Management deleteActivationCode: (code: string) => request<{ success: boolean; message: string }>(`/admin/activation-codes/${encodeURIComponent(code)}`, { method: 'DELETE', }), // Emergency Broadcast sendEmergencyBroadcast: (dto: EmergencyBroadcastRequest) => request<{ success: boolean; broadcastId: string; dispatchedCount: number; targetSchools: number; message: string }>('/admin/broadcasts', { method: 'POST', body: JSON.stringify(dto), }), getBroadcastReceiptSummary: (broadcastId: string): Promise => request(`/admin/broadcasts/${encodeURIComponent(broadcastId)}/receipt-summary`), // System Health & Audit getSystemHealth: (): Promise => request('/admin/system/health'), getAuditLogs: (limit = 100): Promise => request(`/admin/audit-logs?limit=${limit}`), // School Admin getSchoolOverview: (): Promise<{ tenantId: string; tenantName: string; classCount: number; deviceCount: number; onlineCount: number; teacherCount: number; }> => request('/school-admin/overview'), getSchoolClasses: (): Promise => request('/school-admin/classes'), createSchoolClass: (dto: { id: string; displayName: string; grade?: string; roomNumber?: string }) => request<{ success: boolean; message: string }>('/school-admin/classes', { method: 'POST', body: JSON.stringify(dto), }), getSchoolTeachers: (): Promise => request('/school-admin/teachers'), createSchoolTeacher: (dto: { username: string; password: string; fullName: string; role: string }) => request<{ success: boolean; message: string }>('/school-admin/teachers', { method: 'POST', body: JSON.stringify(dto), }), resetSchoolTeacherPassword: (userId: string, newPassword: string) => request<{ success: boolean; message: string }>(`/school-admin/teachers/${encodeURIComponent(userId)}/reset-password`, { method: 'POST', body: JSON.stringify({ newPassword }), }), setSchoolTeacherLock: (userId: string, isLocked: boolean) => request<{ success: boolean; message: string }>(`/school-admin/teachers/${encodeURIComponent(userId)}/lock`, { method: 'POST', body: JSON.stringify({ isLocked }), }), getSchoolDevices: (): Promise => request('/school-admin/devices'), getSchoolCodes: (): Promise => request('/school-admin/activation-codes'), generateSchoolCode: (classId: string) => request<{ success: boolean; code: string; message: string }>( `/school-admin/activation-codes?classId=${encodeURIComponent(classId)}`, { method: 'POST' } ), // Teacher getTeacherClasses: (): Promise => request('/notification/classes'), sendNotification: (payload: SendNotificationPayload) => request<{ success: boolean; messageId: string; className: string; message: string }>( '/notification/send', { method: 'POST', body: JSON.stringify(payload), } ), cancelNotification: (notificationId: string) => request<{ success: boolean; message: string }>( `/notifications/${encodeURIComponent(notificationId)}/cancel`, { method: 'POST' } ), getTeacherHistory: (classId?: string, limit = 50): Promise => request( `/notification/history?${classId ? `classId=${encodeURIComponent(classId)}&` : ''}limit=${limit}` ), getVisualReceiptBlob: async (notificationId: string, deviceId: string): Promise => { const token = getToken(); const res = await fetch(`${API_BASE}/notifications/${encodeURIComponent(notificationId)}/receipts/${encodeURIComponent(deviceId)}/visual-receipt`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, }); if (res.status === 410) { throw new Error('视觉回执已按24小时保存策略自动销毁'); } if (res.status === 404) { throw new Error('未找到该通知的视觉回执'); } if (!res.ok) { throw new Error(`获取视觉回执失败 (${res.status})`); } return res.blob(); }, }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/App.tsx SIZE: 4068 chars SHA256: 16CDE291A22BB1C6C9E5BBE5CDB5F6B3ACBA873A4B42BC7704C700452258D291 ===================================================================== */ import React from 'react'; import { BrowserRouter, Routes, Route, Navigate, Outlet } from 'react-router-dom'; import { AuthProvider, useAuth } from './context/AuthContext'; import { Navbar } from './components/Navbar'; import { RoleRoute } from './components/RoleRoute'; import { Login } from './pages/Login'; // SuperAdmin import { AdminDashboard } from './pages/admin/AdminDashboard'; import { DeviceManagement } from './pages/admin/DeviceManagement'; import { AdminActivationCodes } from './pages/admin/ActivationCodes'; import { HistoryAudit } from './pages/admin/HistoryAudit'; import { TenantManagement } from './pages/admin/TenantManagement'; import { UserManagement } from './pages/admin/UserManagement'; import { EmergencyBroadcast } from './pages/admin/EmergencyBroadcast'; // SchoolAdmin import { SchoolDashboard } from './pages/school/SchoolDashboard'; import { ClassManagement } from './pages/school/ClassManagement'; import { TeacherManagement } from './pages/school/TeacherManagement'; import { SchoolActivationCodes } from './pages/school/SchoolActivationCodes'; // Teacher import { TeacherConsole } from './pages/teacher/TeacherConsole'; // Role Guard Component export const ProtectedLayout: React.FC = () => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在验证用户身份...
); } if (!user) { return ; } return (
); }; export const RootRedirect: React.FC = () => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在初始化...
); } if (!user) return ; if (user.role === 'SuperAdmin') return ; if (user.role === 'SchoolAdmin') return ; return ; }; export const AppRoutes: React.FC = () => { return ( } /> } /> {/* Authenticated Layout */} }> {/* SuperAdmin Routes */} }> } /> } /> } /> } /> } /> } /> } /> {/* SchoolAdmin Routes */} }> } /> } /> } /> } /> {/* Teacher Routes */} }> } /> {/* Fallback */} } /> ); }; export const App: React.FC = () => { return ( ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/Navbar.tsx SIZE: 16705 chars SHA256: 1C22FBFD452578D7593D56E8E87121B3D6A5A720F3F31CCBDA2CC79167790842 ===================================================================== */ import React, { useState, useEffect } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { Bell, Monitor, KeyRound, History, School, Users, Layers, LogOut, ShieldCheck, GraduationCap, Building2, Radio, Menu, X } from 'lucide-react'; import { RealtimeStatusBadge } from './RealtimeStatusBadge'; export const Navbar: React.FC = () => { const { user, logout } = useAuth(); const location = useLocation(); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); // Close mobile menu on route change useEffect(() => { setMobileMenuOpen(false); }, [location.pathname]); if (!user) return null; const isActive = (path: string) => location.pathname === path; return (
{/* Brand & Role */}
ClassNotify {user.role === 'SuperAdmin' && ( <> 超级运维后台 )} {user.role === 'SchoolAdmin' && ( <> 学校管理后台 )} {user.role === 'Teacher' && ( <> 教师工作台 )} {/* Cloud Realtime Connection Badge */}
{/* Navigation Links */} {/* User profile & Logout */}
{user.name} {user.tenantId === 'global' ? '全平台' : user.tenantId}
{/* Mobile menu toggle button */}
{/* Mobile Navigation Drawer */} {mobileMenuOpen && (
{user.role === 'SuperAdmin' && ( <>
总览大盘
设备激活码生成与管理 重点
学校租户
用户中枢
设备集控
全校应急广播
审计历史
)} {user.role === 'SchoolAdmin' && ( <> 学校概览 班级管理 教师账号 本校激活码 )} {user.role === 'Teacher' && ( 呼叫与回执 )}
)}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/RealtimeStatusBadge.tsx SIZE: 1590 chars SHA256: 0673D53A29C1CE75D141AF25D6B2EE082A33BFA3D54AFBC64DFE6419AE2A7659 ===================================================================== */ import React, { useEffect, useState } from 'react'; import { teacherRealtime, RealtimeState } from '../realtime/TeacherRealtime'; export const RealtimeStatusBadge: React.FC = () => { const [state, setState] = useState(teacherRealtime.getState()); useEffect(() => { return teacherRealtime.onStateChange(setState); }, []); if (state === 'Connected') { return ( 云端已连接 ); } if (state === 'Reconnecting') { return ( 正在重连 ); } if (state === 'Connecting') { return ( 正在连接... ); } return ( 连接断开 ); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/components/RoleRoute.tsx SIZE: 941 chars SHA256: 140F05FFBFC62F181514254F980DBCB96070D807EA959A7C2FCB185B510AF9F5 ===================================================================== */ import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { UserRole } from '../types'; interface RoleRouteProps { allowedRoles: UserRole[]; children?: React.ReactNode; } export const RoleRoute: React.FC = ({ allowedRoles, children }) => { const { user, isLoading } = useAuth(); if (isLoading) { return (
正在验证用户权限...
); } if (!user) { return ; } if (!allowedRoles.includes(user.role)) { if (user.role === 'SuperAdmin') return ; if (user.role === 'SchoolAdmin') return ; return ; } return children ? <>{children} : ; }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/context/AuthContext.tsx SIZE: 3365 chars SHA256: 2FABC71795C1598B27643EADA77A0D55B02C7FCBF73BBB202DDAC7A462A79A92 ===================================================================== */ import React, { createContext, useContext, useState, useEffect } from 'react'; import { CurrentUser, UserRole } from '../types'; import { api, setToken, clearToken, getToken } from '../api/client'; import { teacherRealtime } from '../realtime/TeacherRealtime'; import { sessionManager } from '../realtime/SessionManager'; interface AuthContextType { user: CurrentUser | null; token: string | null; login: (username: string, password: string) => Promise; logout: () => void; isLoading: boolean; } const AuthContext = createContext(undefined); export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const [user, setUser] = useState(() => { try { const cached = localStorage.getItem('classnotify_user'); return cached ? JSON.parse(cached) : null; } catch { return null; } }); const [token, setTokenState] = useState(getToken()); const [isLoading, setIsLoading] = useState(true); // Subscribe to 401 session expiration useEffect(() => { const unsubscribe = sessionManager.subscribe(() => { teacherRealtime.stop(); clearToken(); setTokenState(null); setUser(null); }); return () => unsubscribe(); }, []); useEffect(() => { const initAuth = async () => { const savedToken = getToken(); if (savedToken) { try { const me = await api.getMe(); setUser(me); localStorage.setItem('classnotify_user', JSON.stringify(me)); sessionManager.reset(); // Start SignalR for authenticated users teacherRealtime.start(); } catch (err: any) { // If 401, sessionManager already handled it. // If network error / 502 / timeout, keep existing cached session and do NOT clear token! if (err?.message?.includes('未授权') || err?.message?.includes('401')) { clearToken(); setTokenState(null); setUser(null); } } } else { clearToken(); setUser(null); setTokenState(null); } setIsLoading(false); }; initAuth(); }, []); const login = async (username: string, password: string): Promise => { const res = await api.login(username, password); if (!res.success || !res.token || !res.role) { throw new Error(res.errorMessage || '登录失败'); } setToken(res.token); setTokenState(res.token); const currentUser: CurrentUser = { userId: res.userId || '', name: res.fullName || username, role: res.role, tenantId: res.tenantId || '', }; setUser(currentUser); localStorage.setItem('classnotify_user', JSON.stringify(currentUser)); sessionManager.reset(); // Start SignalR on login teacherRealtime.start(); return res.role; }; const logout = () => { teacherRealtime.stop(); clearToken(); setTokenState(null); setUser(null); sessionManager.reset(); }; return ( {children} ); }; export const useAuth = () => { const ctx = useContext(AuthContext); if (!ctx) throw new Error('useAuth must be used within an AuthProvider'); return ctx; }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/index.css SIZE: 503 chars SHA256: 99F80F1313DE3E940567C017B03E34D2E5A8EE9552517F1C9C81546315389284 ===================================================================== */ @tailwind base; @tailwind components; @tailwind utilities; @layer base { body { @apply bg-slate-950 text-slate-100 min-h-screen selection:bg-indigo-500 selection:text-white; } } /* Glassmorphic card styling */ .glass-panel { @apply bg-slate-900/70 backdrop-blur-xl border border-slate-800/80 rounded-2xl shadow-xl; } .glass-card { @apply bg-slate-800/40 backdrop-blur-md border border-slate-700/50 rounded-xl transition-all duration-200 hover:border-slate-600/70 hover:bg-slate-800/60; } /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/main.tsx SIZE: 240 chars SHA256: 79FAF095F462C11B5DC445DAC9043C06809247D25C47F6693FCCD656D1A1D35A ===================================================================== */ import React from 'react'; import ReactDOM from 'react-dom/client'; import { App } from './App'; import './index.css'; ReactDOM.createRoot(document.getElementById('root')!).render( ); /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/ActivationCodes.tsx SIZE: 20779 chars SHA256: 27AA34EB24006DE68B972889BB6CB919AA2ED22C9CB0B882FF02A9DB8207EB5D ===================================================================== */ import React, { useEffect, useState } from 'react'; import { useSearchParams, Link } from 'react-router-dom'; import { api } from '../../api/client'; import { ActivationCode, TenantAdmin, Classroom } from '../../types'; import { KeyRound, Plus, Copy, Check, Clock, CheckCircle2, Trash2, RefreshCw, Search, Building2, Layers, Sparkles, AlertCircle } from 'lucide-react'; export const AdminActivationCodes: React.FC = () => { const [searchParams] = useSearchParams(); const [codes, setCodes] = useState([]); const [tenants, setTenants] = useState([]); const [loading, setLoading] = useState(true); const [copiedCode, setCopiedCode] = useState(null); const [search, setSearch] = useState(''); const [selectedFilterTenant, setSelectedFilterTenant] = useState(''); // Modal state const [showModal, setShowModal] = useState(false); const [selectedTenant, setSelectedTenant] = useState(''); const [classes, setClasses] = useState([]); const [loadingClasses, setLoadingClasses] = useState(false); const [selectedClassId, setSelectedClassId] = useState(''); const [isCustomClass, setIsCustomClass] = useState(false); const [customClassId, setCustomClassId] = useState(''); const [generating, setGenerating] = useState(false); const [generatedResult, setGeneratedResult] = useState<{ code: string; schoolName: string; className: string } | null>(null); const loadData = async () => { try { const [c, t] = await Promise.all([api.getAdminActivationCodes(), api.getTenants()]); setCodes(c); setTenants(t); if (t.length > 0 && !selectedTenant) { setSelectedTenant(t[0].id); } } catch (err) { console.error('Failed to load activation codes', err); } finally { setLoading(false); } }; useEffect(() => { loadData(); }, []); // Handle URL search params useEffect(() => { const urlTenant = searchParams.get('tenantId'); const autoOpen = searchParams.get('openGenerate') === 'true'; if (urlTenant) { setSelectedFilterTenant(urlTenant); setSelectedTenant(urlTenant); if (autoOpen) setShowModal(true); } }, [searchParams]); // Load classrooms when selectedTenant changes useEffect(() => { if (!selectedTenant) return; setLoadingClasses(true); api.getAdminClasses(selectedTenant) .then((cls) => { setClasses(cls); if (cls.length > 0) { setSelectedClassId(cls[0].id); setIsCustomClass(false); } else { setSelectedClassId(''); setIsCustomClass(true); } }) .catch((err) => { console.warn('Could not load classes for tenant:', selectedTenant, err); setClasses([]); setIsCustomClass(true); }) .finally(() => setLoadingClasses(false)); }, [selectedTenant]); const copyToClipboard = (code: string) => { navigator.clipboard.writeText(code); setCopiedCode(code); setTimeout(() => setCopiedCode(null), 2000); }; const handleGenerate = async (e: React.FormEvent) => { e.preventDefault(); const finalClassId = isCustomClass ? customClassId.trim() : selectedClassId.trim(); if (!selectedTenant || !finalClassId) { alert('请选择学校及目标班级'); return; } setGenerating(true); try { const res = await api.generateAdminCode(selectedTenant, finalClassId); const schoolObj = tenants.find((t) => t.id === selectedTenant); const classObj = classes.find((c) => c.id === finalClassId); setGeneratedResult({ code: res.code, schoolName: schoolObj?.name || selectedTenant, className: classObj?.displayName || finalClassId, }); setShowModal(false); setCustomClassId(''); loadData(); } catch (err: any) { alert(err.message || '生成激活码失败'); } finally { setGenerating(false); } }; const handleDelete = async (code: string) => { if (!window.confirm(`确定要废弃/删除激活码 [${code}] 吗?废弃后将无法用于设备初始化绑定。`)) { return; } try { await api.deleteActivationCode(code); loadData(); } catch (err: any) { alert(err.message || '删除激活码失败'); } }; const filteredCodes = codes.filter((c) => { const matchesTenant = !selectedFilterTenant || c.tenantId === selectedFilterTenant; const matchesSearch = c.code.toLowerCase().includes(search.toLowerCase()) || c.classroomName.toLowerCase().includes(search.toLowerCase()) || c.tenantName.toLowerCase().includes(search.toLowerCase()); return matchesTenant && matchesSearch; }); return (
{/* Top Banner & Action */}

全网设备激活码大盘

生成与管理各学校教室电脑安装所需的 8 位一次性硬件绑定激活码,支持过期清理与强制废除

{/* Generated Success Callout */} {generatedResult && (
激活码生成成功!
归属:{generatedResult.schoolName} / {generatedResult.className}(有效期 7 天,一次性硬件绑定)
{generatedResult.code}
)} {/* Filter Toolbar */}
setSearch(e.target.value)} placeholder="搜索激活码、班级或学校..." className="bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full" />
共 {filteredCodes.length} 个激活码
{/* Codes Table */}
{filteredCodes.length === 0 ? ( ) : ( filteredCodes.map((c) => ( {/* Code */} {/* School / Class */} {/* Status */} {/* Device info */} {/* Expiry */} {/* Actions */} )) )}
激活码 绑定学校 / 班级 使用状态 激活设备 有效期限 操作
{loading ? '正在读取激活码...' : '暂无匹配的激活码'}
点击右上角“生成新激活码”即可为任意学校教室开通绑定码
{c.code}
{c.classroomName}
{c.tenantName}
{c.isUsed ? ( 已激活绑定 ) : ( 等待激活 )} {c.usedByDeviceId ? ( {c.usedByDeviceId} ) : ( - )} {new Date(c.expiresAt).toLocaleDateString()} {new Date(c.expiresAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
{/* Generate Code Modal */} {showModal && (

生成班级设备激活码

{/* Select School */}
{/* Select Classroom */}
{loadingClasses ? (
正在读取该校班级列表...
) : isCustomClass ? ( setCustomClassId(e.target.value)} placeholder="输入班级编号,如 cls_801" className="w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none" required /> ) : classes.length > 0 ? ( ) : (
该校暂无预设班级,请手动输入班级代码:
setCustomClassId(e.target.value)} placeholder="如 cls_801 或 cls_new" className="w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none" required />
)}
💡 使用说明:
1. 激活码生成后有效期为 7 天;
2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定。
)}
); }; export const ActivationCodes = AdminActivationCodes; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/AdminDashboard.tsx SIZE: 16461 chars SHA256: 68B372020850C0BC17EC83BB413E33EC2A5473617593BE0EA23248B6C5E96051 ===================================================================== */ import React, { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { api } from '../../api/client'; import { AdminMetrics, TenantAdmin, NotificationRecord, SystemHealth, AdminAuditLog } from '../../types'; import { Building2, Monitor, Bell, Activity, CheckCircle2, Clock, Radio, Users, KeyRound, Database, Cpu, ShieldCheck, AlertTriangle, ArrowRight } from 'lucide-react'; export const AdminDashboard: React.FC = () => { const [metrics, setMetrics] = useState(null); const [tenants, setTenants] = useState([]); const [recentNotifs, setRecentNotifs] = useState([]); const [health, setHealth] = useState(null); const [auditLogs, setAuditLogs] = useState([]); const [loading, setLoading] = useState(true); const loadData = async () => { try { const [m, t, n, h, a] = await Promise.all([ api.getAdminMetrics(), api.getTenants(), api.getAdminNotifications(6), api.getSystemHealth().catch(() => null), api.getAuditLogs(6).catch(() => []), ]); setMetrics(m); setTenants(t); setRecentNotifs(n); if (h) setHealth(h); if (a) setAuditLogs(a); } catch (err) { console.error('Failed to load admin dashboard data', err); } finally { setLoading(false); } }; useEffect(() => { loadData(); const timer = setInterval(loadData, 10000); // 10s auto-refresh return () => clearInterval(timer); }, []); return (
{/* Top Header & System Health Live Pill */}

全域云控超管总览

实时管控多校区实体、网格化终端生命周期、底层微内核与紧急调度通道

生成设备激活码 {/* Real Live Health Status */}
{health?.databaseConnected ? (
PostgreSQL 正常 ({health.databaseLatencyMs.toFixed(1)}ms)
) : (
数据库异常断开
)} |
在线屏: {health?.onlineDevices ?? metrics?.onlineDevices ?? 0}
|
运行: {health?.uptime || '99.98%'}
{/* Metric Cards */}
{/* Total Tenants */}
入驻学校 / 租户
{loading ? '-' : metrics?.totalTenants ?? 0} 所校区
{/* Total Devices */}
总设备数量
{loading ? '-' : metrics?.totalDevices ?? 0} 台教室终端
{/* Online Devices */}
在线设备 (实时连通)
{loading ? '-' : metrics?.onlineDevices ?? 0} / 离线 {loading ? '-' : metrics?.offlineDevices ?? 0}
{/* Today Notifications */}
今日呼叫通知
{loading ? '-' : metrics?.todayNotifications ?? 0} 次下发
{/* Quick Access Control Plane Panels */}

核心管控中枢入口

学校租户
入驻、变更与冻结
用户中枢
跨校开户、改密与封禁
设备集控
心跳、远程指令与清退
激活码大盘 快速生成
生成、绑定与废除
应急广播
全域群发与强置顶
{/* Grid: Tenants Summary & Recent Audit Logs */}
{/* Tenants List */}

各校区终端在线统计

管理学校 →
{tenants.map((t) => { const rate = t.deviceCount > 0 ? Math.round((t.onlineCount / t.deviceCount) * 100) : 0; return ( ); })}
学校名称 班级数 设备数 在线状态 在线率
{t.name} ({t.id}) {t.classroomCount} {t.deviceCount} {t.onlineCount} / {t.deviceCount} 在线 = 80 ? 'bg-emerald-500/10 text-emerald-400 border border-emerald-500/30' : rate > 0 ? 'bg-amber-500/10 text-amber-400 border border-amber-500/30' : 'bg-slate-800 text-slate-400' }`} > {rate}%
{/* Admin Audit Trail Feed */}

管理员关键操作审计

不可篡改
{auditLogs.length === 0 ? (
暂无审计记录
) : ( auditLogs.map((log) => (
{log.action} {new Date(log.occurredAt).toLocaleTimeString()}
{log.details || log.targetId}
操作者: {log.actorUsername} {log.targetType}
)) )}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/DeviceManagement.tsx SIZE: 16822 chars SHA256: 9CF45E48FBC2D0A534ECE8660C3293B4E43540618C721EB7D238A5DC4A921DA2 ===================================================================== */ import React, { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { api } from '../../api/client'; import { DeviceAdmin } from '../../types'; import { Monitor, RefreshCw, RotateCcw, Activity, CheckCircle2, AlertCircle, Search, Edit3, Trash2, Clock, KeyRound } from 'lucide-react'; export const DeviceManagement: React.FC = () => { const [devices, setDevices] = useState([]); const [loading, setLoading] = useState(true); const [search, setSearch] = useState(''); const [commandResult, setCommandResult] = useState<{ deviceId: string; message: string; success: boolean; } | null>(null); const [actionLoading, setActionLoading] = useState(null); // Edit Device State const [editingDevice, setEditingDevice] = useState(null); const [editHostname, setEditHostname] = useState(''); const [editClassroomId, setEditClassroomId] = useState(''); const [editLoading, setEditLoading] = useState(false); const loadDevices = async () => { try { const data = await api.getAllDevices(); setDevices(data); } catch (err) { console.error('Failed to load devices', err); } finally { setLoading(false); } }; useEffect(() => { loadDevices(); const interval = setInterval(loadDevices, 5000); // Live poll return () => clearInterval(interval); }, []); const handleCommand = async (deviceId: string, cmd: string, params?: string) => { setActionLoading(`${deviceId}_${cmd}`); setCommandResult(null); try { const res = await api.sendDeviceCommand(deviceId, cmd, params); setCommandResult({ deviceId, message: res.message, success: true, }); loadDevices(); } catch (err: any) { setCommandResult({ deviceId, message: err.message || '远程指令下发失败', success: false, }); } finally { setActionLoading(null); } }; const openEdit = (d: DeviceAdmin) => { setEditingDevice(d); setEditHostname(d.hostname || ''); setEditClassroomId(d.classroomId || ''); }; const handleSaveEdit = async (e: React.FormEvent) => { e.preventDefault(); if (!editingDevice) return; setEditLoading(true); try { await api.updateDevice(editingDevice.deviceId, { hostname: editHostname.trim() || undefined, classroomId: editClassroomId.trim() || undefined, }); setCommandResult({ deviceId: editingDevice.deviceId, message: '设备信息更新成功', success: true, }); setEditingDevice(null); loadDevices(); } catch (err: any) { setCommandResult({ deviceId: editingDevice.deviceId, message: err.message || '更新设备失败', success: false, }); } finally { setEditLoading(false); } }; const handleDecommission = async (d: DeviceAdmin) => { if (!window.confirm(`高危操作确认:确定要注销并清退设备 [${d.deviceId} (${d.hostname || d.classroomName})] 吗?\n清退后该设备将无法接入,需重新生成激活码绑定!`)) { return; } setActionLoading(`decommission_${d.deviceId}`); try { await api.decommissionDevice(d.deviceId); setCommandResult({ deviceId: d.deviceId, message: '设备已成功清退并注销', success: true, }); loadDevices(); } catch (err: any) { setCommandResult({ deviceId: d.deviceId, message: err.message || '清退设备失败', success: false, }); } finally { setActionLoading(null); } }; const formatHeartbeat = (timeStr?: string) => { if (!timeStr) return '从无心跳'; const diff = Math.floor((Date.now() - new Date(timeStr).getTime()) / 1000); if (diff < 10) return '刚刚 (几秒前)'; if (diff < 60) return `${diff} 秒前`; if (diff < 3600) return `${Math.floor(diff / 60)} 分钟前`; return `${Math.floor(diff / 3600)} 小时前`; }; const filteredDevices = devices.filter( (d) => d.tenantName.toLowerCase().includes(search.toLowerCase()) || d.classroomName.toLowerCase().includes(search.toLowerCase()) || d.deviceId.toLowerCase().includes(search.toLowerCase()) || (d.hostname && d.hostname.toLowerCase().includes(search.toLowerCase())) ); return (
{/* Header */}

全网设备集控中心

实时监控教室终端健康心跳与服务状态,支持在线秒级下发或离线指令入队补发、元数据变更与清退

生成新设备激活码
{/* Command Result Banner */} {commandResult && (
{commandResult.success ? ( ) : ( )} [设备 {commandResult.deviceId}] {commandResult.message}
)} {/* Search Filter */}
setSearch(e.target.value)} placeholder="按学校、班级、设备编号或计算机名过滤..." className="bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full" /> {search && ( )}
{/* Devices Table */}
{filteredDevices.length === 0 ? ( ) : ( filteredDevices.map((d) => ( {/* School / Class */} {/* Device ID / Hostname */} {/* Status */} {/* Last Heartbeat */} {/* Version */} {/* Operations */} )) )}
学校 / 班级 设备编号 / 主机名 运行状态 心跳与 IP 版本 运维指令与管理
{loading ? '正在同步设备状态...' : '暂无匹配的设备'}
{d.classroomName}
{d.tenantName}
{d.deviceId}
{d.hostname || 'Classroom-PC'}
{d.isOnline ? (
在线 (实时连通)
) : (
离线 (支持离线入队)
)}
{formatHeartbeat(d.lastHeartbeat)}
{d.remoteIp || '127.0.0.1'}
v{d.clientVersion || '2.1.0'}
{/* Ping / SelfCheck (Offline queuing supported!) */} {/* Restart Client */} {/* Refresh Config */} {/* Edit metadata */} {/* Decommission */}
{/* Edit Modal */} {editingDevice && (

调整设备元数据

设备唯一识别码: {editingDevice.deviceId}

setEditHostname(e.target.value)} placeholder="例如: LAB-BUILDING-201-PC" className="w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500" />
setEditClassroomId(e.target.value)} placeholder="例如: cls_801" className="w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500" />
)}
); }; /* ===================================================================== FILE: src/Web/ClassNotify.Web/src/pages/admin/EmergencyBroadcast.tsx SIZE: 24823 chars SHA256: 922E86B403FD4B2A7D8FD47090FAC7BF08877B4C7CFFC18E15BD4F28245B223E ===================================================================== */ import React, { useEffect, useState } from 'react'; import { api } from '../../api/client'; import { TenantAdmin, EmergencyBroadcastRequest, NotificationRecord, BroadcastReceiptSummary } from '../../types'; import { Radio, AlertTriangle, Send, Volume2, Vibrate, Clock, Building2, CheckCircle2, ShieldAlert, Flame, CloudRain, Users, Megaphone, Loader2, X, History, Tv } from 'lucide-react'; export const EmergencyBroadcast: React.FC = () => { const [tenants, setTenants] = useState([]); const [loadingTenants, setLoadingTenants] = useState(true); const [recentBroadcasts, setRecentBroadcasts] = useState([]); const [loadingHistory, setLoadingHistory] = useState(false); const [form, setForm] = useState({ tenantId: '', title: '⚠️ 全校紧急预警通报', message: '', voice: true, shake: true, durationSeconds: 30, }); // Modal & Submit State const [showConfirmModal, setShowConfirmModal] = useState(false); const [submitting, setSubmitting] = useState(false); const [activeBroadcastId, setActiveBroadcastId] = useState(null); const [receiptSummary, setReceiptSummary] = useState(null); const [result, setResult] = useState<{ dispatchedCount: number; targetSchools: number; message: string; success: boolean; timestamp: string; } | null>(null); const templates = [ { title: '⚠️ 消防紧急疏散演练', content: '全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速、有序撤离至操场,不要慌乱!', duration: 60, shake: true, voice: true, icon: Flame, }, { title: '⛈️ 恶劣雷雨大风避险通报', content: '气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁学生前往走廊与室外活动!', duration: 45, shake: true, voice: true, icon: CloudRain, }, { title: '📢 临时紧急集合通知', content: '请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学保持教室内安静自习。', duration: 30, shake: false, voice: true, icon: Users, }, { title: '🔔 全校临时作息调整', content: '因突发教学安排,今天下午放学时间调整为 16:30,请任课老师提醒学生整理个人物品按时离校。', duration: 30, shake: false, voice: true, icon: Megaphone, }, ]; const fetchTenants = async () => { try { const data = await api.getTenants(); setTenants(data); } catch (err) { console.error('Failed to load tenants', err); } finally { setLoadingTenants(false); } }; const fetchRecentBroadcasts = async () => { setLoadingHistory(true); try { const data = await api.getAdminNotifications(15); // Filter urgent broadcasts or show recent ones setRecentBroadcasts(data); } catch (err) { console.error('Failed to load recent broadcasts', err); } finally { setLoadingHistory(false); } }; useEffect(() => { fetchTenants(); fetchRecentBroadcasts(); }, []); const handleApplyTemplate = (tpl: typeof templates[0]) => { setForm((prev) => ({ ...prev, title: tpl.title, message: tpl.content, durationSeconds: tpl.duration, shake: tpl.shake, voice: tpl.voice, })); }; const handlePreBroadcast = (e: React.FormEvent) => { e.preventDefault(); if (!form.message.trim()) { alert('请输入广播通知正文'); return; } setShowConfirmModal(true); }; useEffect(() => { if (!activeBroadcastId) return; let stopped = false; let timer: number | undefined; const startTime = Date.now(); const poll = async () => { try { const summary = await api.getBroadcastReceiptSummary(activeBroadcastId); if (stopped) return; setReceiptSummary(summary); if (!summary.completed && Date.now() - startTime < 60000) { timer = window.setTimeout(poll, 2000); } } catch { if (!stopped && Date.now() - startTime < 60000) { timer = window.setTimeout(poll, 3000); } } }; poll(); return () => { stopped = true; if (timer) clearTimeout(timer); }; }, [activeBroadcastId]); const handleExecuteBroadcast = async () => { setSubmitting(true); try { const res = await api.sendEmergencyBroadcast({ ...form, tenantId: form.tenantId || undefined, }); if (res.broadcastId) { setActiveBroadcastId(res.broadcastId); } setResult({ dispatchedCount: res.dispatchedCount, targetSchools: res.targetSchools, message: res.message, success: true, timestamp: new Date().toLocaleTimeString(), }); setShowConfirmModal(false); setForm((prev) => ({ ...prev, message: '' })); fetchRecentBroadcasts(); } catch (err: any) { setResult({ dispatchedCount: 0, targetSchools: 0, message: err.message || '应急广播下发失败', success: false, timestamp: new Date().toLocaleTimeString(), }); setShowConfirmModal(false); } finally { setSubmitting(false); } }; // Target summary calculation const selectedTenant = tenants.find((t) => t.id === form.tenantId); const totalClassesTargeted = selectedTenant ? selectedTenant.classroomCount : tenants.reduce((acc, t) => acc + (t.classroomCount || 0), 0); const totalDevicesTargeted = selectedTenant ? selectedTenant.deviceCount : tenants.reduce((acc, t) => acc + (t.deviceCount || 0), 0); return (
{/* Header */}

全域紧急应急广播

超级管理员最高优先调度通道,覆盖全网多校区所有教室大屏终端,支持强置顶、TTS 语音播报与视效抖动

{/* Result Breakdown Panel */} {result && (
{result.success ? ( ) : ( )}

{result.success ? '全域紧急广播指令已成功下发' : '广播下发遇到异常'}

{result.message}

{result.success && (
目标学校: {result.targetSchools} 所 投递教室班级: {result.dispatchedCount} 间 下发时间: {result.timestamp}
)} {/* Real-time Receipt Aggregation */} {receiptSummary && (
目标终端设备 {receiptSummary.targetDevices}
已在屏幕显示 {receiptSummary.displayed}
排队 / 离线等待 {receiptSummary.pending}
已取消 {receiptSummary.cancelled}
失败 / 超时 {receiptSummary.failed}
)}
)} {/* Quick Templates */}

应急广播预设模板 (点击快速填装)

{templates.map((tpl, i) => { const Icon = tpl.icon; return ( ); })}
{/* Form Panel */}
{/* Target Scope */}
setForm({ ...form, title: e.target.value })} className="w-full px-3.5 py-2.5 rounded-xl bg-slate-900/80 border border-slate-700 text-sm text-white focus:outline-none focus:border-indigo-500" placeholder="例如: ⚠️ 全校紧急避险预警" />
{/* Broadcast Message */}