From a0930986574039e96c3573f40ed03d4faac83f0f Mon Sep 17 00:00:00 2001 From: GUARDiA AutoDeploy Date: Sun, 5 Jul 2026 08:23:08 +0900 Subject: [PATCH] =?UTF-8?q?feat(ux):=20=EB=82=A0=EC=A7=9C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=EC=A0=84=EB=A9=B4=20=EC=BA=98=EB=A6=B0=EB=8D=94=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=E2=80=94=20=EC=9B=B9=20datetime-local/dat?= =?UTF-8?q?e/time=20+=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EC=88=9C=EC=88=98JS?= =?UTF-8?q?=20CalendarPicker=20[auto-sync]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 8 - .../zioinfo/mes/admin/AdminController.java | 6 - .../zioinfo/mes/admin/AdminUserService.java | 11 - .../mes/admin/mapper/AdminUserMapper.java | 3 - .../java/com/zioinfo/mes/ai/AiService.java | 18 +- .../java/com/zioinfo/mes/ai/OllamaClient.java | 19 +- .../com/zioinfo/mes/auth/AuthController.java | 79 +-- .../com/zioinfo/mes/auth/AuthService.java | 194 +------ .../java/com/zioinfo/mes/auth/JwtFilter.java | 5 +- .../java/com/zioinfo/mes/auth/JwtUtil.java | 40 -- .../java/com/zioinfo/mes/auth/MesUser.java | 20 - .../zioinfo/mes/auth/mapper/UserMapper.java | 78 --- .../mes/common/GlobalExceptionHandler.java | 9 - .../zioinfo/mes/config/SecurityConfig.java | 9 - backend/src/main/resources/application.yml | 36 +- .../main/resources/mapper/AdminUserMapper.xml | 4 - .../main/resources/mapper/AnalyticsMapper.xml | 2 +- .../src/main/resources/mapper/UserMapper.xml | 57 +-- .../resources/static/assets/index-BLHiicbF.js | 480 ++++++++++++++++++ .../static/assets/index-BwkEm3xg.css | 1 + backend/src/main/resources/static/index.html | 5 +- frontend/index.html | 1 - frontend/src/App.tsx | 48 -- frontend/src/api/client.ts | 27 - frontend/src/components/Header.tsx | 6 +- frontend/src/components/Sidebar.tsx | 43 +- frontend/src/main.tsx | 6 +- frontend/src/pages/AiTools.tsx | 202 +------- frontend/src/pages/Login.tsx | 266 +--------- frontend/src/pages/UserManagement.tsx | 8 +- frontend/src/pages/uiws/ScheduleCalendar.tsx | 16 +- 31 files changed, 545 insertions(+), 1162 deletions(-) create mode 100644 backend/src/main/resources/static/assets/index-BLHiicbF.js create mode 100644 backend/src/main/resources/static/assets/index-BwkEm3xg.css diff --git a/backend/pom.xml b/backend/pom.xml index 970bff3..54b4888 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -22,7 +22,6 @@ 2.6.0 3.0.3 42.7.7 - 1.1.3 @@ -43,10 +42,6 @@ org.postgresqlpostgresql${postgresql.version} - - - org.duckdbduckdb_jdbc${duckdb.version}runtime - io.jsonwebtokenjjwt-api${jjwt.version} io.jsonwebtokenjjwt-impl${jjwt.version}runtime @@ -59,9 +54,6 @@ ${springdoc.version} - - dev.samstevens.totptotp1.7.1 - org.projectlomboklomboktrue diff --git a/backend/src/main/java/com/zioinfo/mes/admin/AdminController.java b/backend/src/main/java/com/zioinfo/mes/admin/AdminController.java index 523a89d..2f7649f 100644 --- a/backend/src/main/java/com/zioinfo/mes/admin/AdminController.java +++ b/backend/src/main/java/com/zioinfo/mes/admin/AdminController.java @@ -56,12 +56,6 @@ public class AdminController { return ApiResponse.ok(userService.resetPassword(id, req.password())); } - /** 관리자 OTP 초기화(SUPERADMIN). 대상 OTP 시크릿 폐기 → 다음 로그인 재등록. 시크릿 미노출·감사 기록. */ - @PostMapping("/users/{id}/otp-reset") - public ApiResponse resetOtp(@PathVariable Long id) { - return ApiResponse.ok(userService.resetOtp(id)); - } - @DeleteMapping("/users/{id}") public ApiResponse deleteUser(@PathVariable Long id, Authentication auth) { String currentUsername = auth != null ? auth.getName() : null; diff --git a/backend/src/main/java/com/zioinfo/mes/admin/AdminUserService.java b/backend/src/main/java/com/zioinfo/mes/admin/AdminUserService.java index 7353707..76b7c31 100644 --- a/backend/src/main/java/com/zioinfo/mes/admin/AdminUserService.java +++ b/backend/src/main/java/com/zioinfo/mes/admin/AdminUserService.java @@ -85,17 +85,6 @@ public class AdminUserService { return UserDto.from(user); } - /** - * 관리자 OTP 초기화(SUPERADMIN). 대상 사용자의 OTP 시크릿을 폐기하고 등록을 해제한다. - * 사용자는 다음 로그인 시 OTP_SETUP(재등록) 플로우를 탄다. 시크릿은 응답/로그에 노출하지 않는다. - */ - public UserDto resetOtp(Long id) { - MesUser user = require(id); - mapper.clearOtp(id); - auditService.log("USER_OTP_RESET", user.getUsername(), "OTP 초기화(다음 로그인 재등록)"); - return UserDto.from(user); - } - public void delete(Long id, String currentUsername) { MesUser user = require(id); if (user.getUsername().equals(currentUsername)) { diff --git a/backend/src/main/java/com/zioinfo/mes/admin/mapper/AdminUserMapper.java b/backend/src/main/java/com/zioinfo/mes/admin/mapper/AdminUserMapper.java index 05e27eb..42b74ca 100644 --- a/backend/src/main/java/com/zioinfo/mes/admin/mapper/AdminUserMapper.java +++ b/backend/src/main/java/com/zioinfo/mes/admin/mapper/AdminUserMapper.java @@ -22,9 +22,6 @@ public interface AdminUserMapper { int updatePassword(@Param("id") Long id, @Param("passwordHash") String passwordHash); - /** 관리자 OTP 초기화: 시크릿 폐기 + otp_enabled=false(다음 로그인 시 재등록 유도). 시크릿 미노출. */ - int clearOtp(@Param("id") Long id); - int deleteById(@Param("id") Long id); /** 활성 SUPERADMIN 계정 수 (마지막 관리자 삭제/강등 방지용). */ diff --git a/backend/src/main/java/com/zioinfo/mes/ai/AiService.java b/backend/src/main/java/com/zioinfo/mes/ai/AiService.java index 6cd39db..d38c564 100644 --- a/backend/src/main/java/com/zioinfo/mes/ai/AiService.java +++ b/backend/src/main/java/com/zioinfo/mes/ai/AiService.java @@ -1,7 +1,5 @@ package com.zioinfo.mes.ai; -import com.zioinfo.mes.ai.service.AiTextRouter; -import com.zioinfo.mes.common.ai.TextAiClient.GenResult; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -33,19 +31,11 @@ import java.util.Map; public class AiService { private final OllamaClient ollama; - /** provider 라우팅(Claude→Ollama 폴백) + 로컬 학습 로그 경유. 기존 OllamaClient 직접 호출을 대체. */ - private final AiTextRouter aiTextRouter; public boolean ollamaAvailable() { return ollama.available(); } - /** 라우터 경유 텍스트 생성 — degraded 면 null(호출부가 Java 폴백 수행). */ - private String routeGenerate(String prompt) { - GenResult r = aiTextRouter.generate(prompt); - return (r != null && !r.degraded()) ? r.text() : null; - } - // 1. 불량 원인 분석 (공정/설비/자재 상관) public Map defectRootCause(String defectCode, List> context) { Map result = new LinkedHashMap<>(); @@ -54,11 +44,11 @@ public class AiService { "당신은 제조 품질 엔지니어입니다. 불량코드 '%s' 와 관련 공정/설비/자재 데이터: %s. " + "가장 가능성 높은 추정 원인 1가지와 권고 조치를 'CAUSE: ...\\nACTION: ...' 형식 한국어로 출력.", defectCode, ctx); - String out = routeGenerate(prompt); + String out = ollama.generate(prompt); if (out != null && !out.isBlank()) { result.put("cause", firstNonBlank(extractLine(out, "CAUSE:"), out)); result.put("action", extractLine(out, "ACTION:")); - result.put("source", "ai"); + result.put("source", "ollama"); return result; } // Java 폴백: 불량코드 분류 규칙 @@ -166,12 +156,12 @@ public class AiService { Map filter = new LinkedHashMap<>(); if (naturalQuery == null || naturalQuery.isBlank()) return filter; String prompt = "다음 질의에서 검색 필터를 'STATUS:..\\nITEM:..\\nDATE:..' 형식으로만 추출:\\n" + naturalQuery; - String out = routeGenerate(prompt); + String out = ollama.generate(prompt); if (out != null && !out.isBlank()) { putIf(filter, "status", extractLine(out, "STATUS:")); putIf(filter, "item", extractLine(out, "ITEM:")); putIf(filter, "date", extractLine(out, "DATE:")); - if (!filter.isEmpty()) { filter.put("source", "ai"); return filter; } + if (!filter.isEmpty()) { filter.put("source", "ollama"); return filter; } } // Java 폴백: 키워드 매칭 String q = naturalQuery.toLowerCase(); diff --git a/backend/src/main/java/com/zioinfo/mes/ai/OllamaClient.java b/backend/src/main/java/com/zioinfo/mes/ai/OllamaClient.java index 10dab85..e3844b1 100644 --- a/backend/src/main/java/com/zioinfo/mes/ai/OllamaClient.java +++ b/backend/src/main/java/com/zioinfo/mes/ai/OllamaClient.java @@ -34,26 +34,17 @@ public class OllamaClient { this.visionModel = visionModel; } - /** 프롬프트로 텍스트 생성(기본 텍스트 모델). 실패 시 빈 문자열 반환(예외 없음). */ - public String generate(String prompt) { - return generate(prompt, textModel); - } - - /** - * 지정 모델로 텍스트 생성(AiTextRouter 의 provider 별 소형 모델 선택 경유). 실패 시 빈 문자열. - * 기존 {@link #generate(String)} 계약 보존 — 본 오버로드만 추가. - */ + /** 프롬프트로 텍스트 생성. 실패 시 빈 문자열 반환(예외 없음). */ @SuppressWarnings("unchecked") - public String generate(String prompt, String model) { - String useModel = (model == null || model.isBlank()) ? textModel : model.trim(); + public String generate(String prompt) { try { - Map body = Map.of("model", useModel, "prompt", prompt, "stream", false); + Map body = Map.of("model", textModel, "prompt", prompt, "stream", false); Map res = builder.baseUrl(ollamaUrl).build() .post().uri("/api/generate") .bodyValue(body) .retrieve() .bodyToMono(Map.class) - .timeout(Duration.ofSeconds(120)) + .timeout(Duration.ofSeconds(30)) .map(m -> (Map) m) .block(); if (res == null) return ""; @@ -79,7 +70,7 @@ public class OllamaClient { .bodyValue(body) .retrieve() .bodyToMono(Map.class) - .timeout(Duration.ofSeconds(120)) + .timeout(Duration.ofSeconds(45)) .map(m -> (Map) m) .block(); if (res == null) return ""; diff --git a/backend/src/main/java/com/zioinfo/mes/auth/AuthController.java b/backend/src/main/java/com/zioinfo/mes/auth/AuthController.java index 8fff6ec..cb500bf 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/AuthController.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/AuthController.java @@ -1,52 +1,22 @@ package com.zioinfo.mes.auth; -import com.zioinfo.mes.auth.dto.ChangePasswordRequest; -import com.zioinfo.mes.auth.dto.OtpConfirmRequest; -import com.zioinfo.mes.auth.dto.OtpSetupResponse; -import com.zioinfo.mes.auth.dto.OtpVerifyRequest; import com.zioinfo.mes.common.ApiResponse; -import com.zioinfo.mes.uiws.auth.OtpAuthService; -import com.zioinfo.mes.uiws.auth.TwoFactorService; -import com.zioinfo.mes.uiws.common.UiwsApiException; -import com.zioinfo.mes.uiws.common.UiwsErrorCode; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.util.Map; -/** - * MES 인증 컨트롤러. - * - /login: 2FA off 면 { token, type, twofa:"false" }, 2FA on 이면 { twofa:"true", verifyToken, verifyMethod|step, ... }. - * - /verify: (UIWS 2FA 이식) verify-token + 이메일코드 → access/refresh 발급. - * - /verify-otp: (TOTP 이식) verify-token + 6자리 → access/refresh 발급(최초 로그인이면 등록 확정). - * 기존 클라이언트(2FA off)는 응답 형태 token 보존 → 회귀 0. - */ @RestController @RequestMapping("/api/mes/auth") @RequiredArgsConstructor public class AuthController { private final AuthService authService; - private final TwoFactorService twoFactorService; - private final OtpAuthService otpAuthService; - private final JwtUtil jwtUtil; @PostMapping("/login") public ApiResponse> login(@RequestBody LoginRequest req) { - return ApiResponse.ok(authService.login(req.username(), req.password())); - } - - /** UIWS 2FA(이메일코드) 이식: 2차 인증 코드 검증 → access/refresh 발급. */ - @PostMapping("/verify") - public ApiResponse> verify(@RequestBody VerifyRequest req) { - return ApiResponse.ok(twoFactorService.verify(req.verifyToken(), req.code())); - } - - /** TOTP 이식: 로그인 2단계 6자리 검증 → access/refresh 발급(최초 로그인이면 등록 확정). */ - @PostMapping("/verify-otp") - public ApiResponse> verifyOtp(@Valid @RequestBody OtpVerifyRequest req) { - return ApiResponse.ok(otpAuthService.verifyOtp(req.verifyToken(), req.code())); + String token = authService.login(req.username(), req.password()); + return ApiResponse.ok(Map.of("token", token, "type", "Bearer")); } @GetMapping("/me") @@ -55,50 +25,5 @@ public class AuthController { return ApiResponse.ok(authService.me(token)); } - // ── 마이페이지: OTP 등록/재설정/해제 + 비밀번호 변경 (본인, access 토큰 필요) ────────── - - /** 마이페이지 OTP 등록/재설정 시작 → { secret, otpAuthUri, qrImage }(이 응답에서만 시크릿/QR 노출). */ - @PostMapping("/otp/setup") - public ApiResponse otpSetup(@RequestHeader("Authorization") String header) { - return ApiResponse.ok(otpAuthService.setup(requireUser(header))); - } - - /** 마이페이지 OTP 확인·활성화(앱 6자리 코드). */ - @PostMapping("/otp/confirm") - public ApiResponse> otpConfirm(@RequestHeader("Authorization") String header, - @Valid @RequestBody OtpConfirmRequest req) { - otpAuthService.confirm(requireUser(header), req.code()); - return ApiResponse.ok(Map.of("result", "ok")); - } - - /** 마이페이지 OTP 해제. */ - @PostMapping("/otp/disable") - public ApiResponse> otpDisable(@RequestHeader("Authorization") String header) { - otpAuthService.disable(requireUser(header)); - return ApiResponse.ok(Map.of("result", "ok")); - } - - /** 마이페이지 비밀번호 변경(현재 비번 검증 + BCrypt). 새 비번은 응답/로그 미포함. */ - @PostMapping("/change-password") - public ApiResponse> changePassword(@RequestHeader("Authorization") String header, - @Valid @RequestBody ChangePasswordRequest req) { - authService.changePassword(requireUser(header), req); - return ApiResponse.ok(Map.of("result", "ok")); - } - - /** - * Authorization 헤더에서 인증 사용자를 해석한다. verify-token(2fa 단계용)은 거부. - * (/api/mes/auth/** 는 permitAll 이라 필터 인증이 없으므로 여기서 access 토큰을 명시 검증.) - */ - private String requireUser(String header) { - String token = header == null ? "" : header.replace("Bearer ", "").trim(); - if (token.isEmpty() || jwtUtil.isVerifyToken(token) || !jwtUtil.isValid(token)) { - throw new UiwsApiException(UiwsErrorCode.UNAUTHORIZED); - } - return jwtUtil.getUsername(token); - } - record LoginRequest(String username, String password) {} - - record VerifyRequest(String verifyToken, String code) {} } diff --git a/backend/src/main/java/com/zioinfo/mes/auth/AuthService.java b/backend/src/main/java/com/zioinfo/mes/auth/AuthService.java index f880cfd..da7156b 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/AuthService.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/AuthService.java @@ -1,103 +1,30 @@ package com.zioinfo.mes.auth; -import com.zioinfo.mes.admin.AuditService; -import com.zioinfo.mes.auth.dto.AuthHelperResult; -import com.zioinfo.mes.auth.dto.ChangePasswordRequest; -import com.zioinfo.mes.auth.dto.FindIdRequest; -import com.zioinfo.mes.auth.dto.FindIdResponse; -import com.zioinfo.mes.auth.dto.ResetPasswordRequest; -import com.zioinfo.mes.auth.dto.SignupRequest; import com.zioinfo.mes.auth.mapper.UserMapper; -import com.zioinfo.mes.uiws.auth.OtpAuthService; -import com.zioinfo.mes.uiws.auth.TwoFactorService; -import com.zioinfo.mes.uiws.common.UiwsApiException; -import com.zioinfo.mes.uiws.common.UiwsErrorCode; -import com.zioinfo.mes.uiws.common.mail.MailSender; import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import java.security.SecureRandom; import java.util.HashMap; import java.util.Map; -/** - * MES 인증 서비스. - * - 기존 단일 JWT 로그인 보존(2FA off 또는 미설정 시 회귀 0). - * - UIWS 2FA 레이어(이메일 코드) 추가: 2FA on 이면 1차 통과 후 verify-token + 이메일코드 발급. - * 실패 누적 max-login-fail 회 시 계정 잠금. - */ -@Slf4j @Service @RequiredArgsConstructor public class AuthService { - private static final SecureRandom RANDOM = new SecureRandom(); - /** 임시 비밀번호 문자셋(혼동 문자 0/O/1/l/I 제외). */ - private static final String TMP_PW_CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789@#$%"; - private final UserMapper userMapper; private final PasswordEncoder passwordEncoder; private final JwtUtil jwtUtil; - private final TwoFactorService twoFactorService; - private final OtpAuthService otpAuthService; - private final MailSender mailSender; - private final AuditService auditService; - /** - * 1차 로그인. 2FA 활성 시 verify-token + 이메일코드 흐름으로 분기, - * 비활성 시 기존처럼 access 토큰 즉시 발급. - * - * @return 2FA off: { token, type, twofa:"false" } - * 2FA on : { verifyToken, step:"EMAIL", maskedEmail, twofa:"true" } - */ - public Map login(String username, String password) { + public String login(String username, String password) { MesUser user = userMapper.findByUsername(username); - - // 잠금 우선 차단(존재하는 계정에 한해 잠금 메시지 — 존재 여부 누설 최소화) - if (user != null && twoFactorService.isLocked(user)) { - throw new UiwsApiException(UiwsErrorCode.ACCOUNT_LOCKED); - } if (user == null || !user.isActive()) { throw new RuntimeException("ERR-AUTH-001: 존재하지 않거나 비활성 계정"); } - // 회원가입 승인 게이트(로그인 보조 이식): 미승인 계정은 비번 일치 전에 차단. - if (Boolean.FALSE.equals(user.getApproved())) { - throw new RuntimeException("ERR-AUTH-003: 승인 대기 중인 계정입니다. 관리자 승인 후 이용 가능합니다."); - } if (!passwordEncoder.matches(password, user.getPasswordHash())) { - // 2FA(OTP 또는 이메일) 활성 시 실패 누적/잠금. 비활성 시 기존 동작(메시지만) 유지. - if (otpAuthService.isEnabled() || twoFactorService.isEnabled()) { - twoFactorService.recordLoginFailure(username); - MesUser after = userMapper.findByUsername(username); - if (after != null && Boolean.TRUE.equals(after.getLocked())) { - throw new UiwsApiException(UiwsErrorCode.ACCOUNT_LOCKED); - } - } throw new RuntimeException("ERR-AUTH-002: 비밀번호 불일치"); } - - // 비밀번호 검증 통과 — 2단계 우선순위: OTP > 이메일코드 > 단일 로그인 - if (otpAuthService.isEnabled()) { - // { twofa:true, verifyToken, verifyMethod:(OTP|OTP_SETUP), secret?, otpAuthUri?, qrImage? } - return otpAuthService.beginOtp(user); - } - if (twoFactorService.isEnabled()) { - Map step1 = twoFactorService.beginTwoFactor(user); - // verifyToken/step/maskedEmail + twofa 플래그 - return Map.of( - "twofa", "true", - "verifyToken", step1.get("verifyToken"), - "step", step1.get("step"), - "maskedEmail", step1.getOrDefault("maskedEmail", "")); - } - - // 2FA 비활성 — 기존 단일 로그인 흐름(회귀 0) - userMapper.resetLoginFail(username); - String token = jwtUtil.generate(username, user.getRole()); - return Map.of("twofa", "false", "token", token, "type", "Bearer"); + return jwtUtil.generate(username, user.getRole()); } public Map me(String token) { @@ -110,121 +37,4 @@ public class AuthService { m.put("displayName", u != null ? u.getDisplayName() : username); return m; } - - // ── 로그인 보조 이식: 회원가입 / 아이디찾기 / 비밀번호 초기화 ─────────────────── - - /** - * 운영자 회원가입(승인 대기). username/email 중복 검사 후 approved=false·role=VIEWER 로 INSERT. - * 비밀번호는 BCrypt 저장. 활성/승인 전까지 로그인 차단(AuthService.login 의 승인 게이트). - */ - @Transactional - public AuthHelperResult signup(SignupRequest req) { - if (req.username() == null || req.username().isBlank() - || req.password() == null || req.password().length() < 4 - || req.email() == null || req.email().isBlank()) { - return new AuthHelperResult(false, "아이디·비밀번호(4자 이상)·이메일은 필수입니다."); - } - if (userMapper.countByUsername(req.username()) > 0) { - return new AuthHelperResult(false, "이미 사용 중인 아이디입니다."); - } - if (userMapper.countByEmail(req.email()) > 0) { - return new AuthHelperResult(false, "이미 등록된 이메일입니다."); - } - MesUser u = new MesUser(); - u.setUsername(req.username()); - u.setPasswordHash(passwordEncoder.encode(req.password())); - u.setDisplayName(req.displayName() != null && !req.displayName().isBlank() - ? req.displayName() : req.username()); - u.setEmail(req.email()); - userMapper.signup(u); - log.info("[auth-helper] signup pending approval: username={}", req.username()); - return new AuthHelperResult(true, "가입 신청이 접수되었습니다. 관리자 승인 후 로그인할 수 있습니다."); - } - - /** - * 아이디 찾기: 표시명+이메일 동시 일치 운영자 1건 조회. username 은 부분 마스킹 후 반환. - * 미발견 시 found=false(원문 username 절대 미노출). - */ - public FindIdResponse findId(FindIdRequest req) { - if (req.displayName() == null || req.displayName().isBlank() - || req.email() == null || req.email().isBlank()) { - return new FindIdResponse(false, ""); - } - MesUser u = userMapper.findByDisplayNameAndEmail(req.displayName(), req.email()); - if (u == null) { - return new FindIdResponse(false, ""); - } - return new FindIdResponse(true, maskUsername(u.getUsername())); - } - - /** - * 비밀번호 초기화: username+email 일치 검증 → 임시비번 생성·BCrypt 저장·잠금/실패카운트 해제. - * 임시비번은 메일(미설정 시 LogMailSender 로그)로만 전달. API 응답·로그 메시지에 비번 미노출. - * 대상 미존재여도 success=true(계정 열거 방지). - */ - @Transactional - public AuthHelperResult resetPassword(ResetPasswordRequest req) { - final String okMsg = "임시 비밀번호를 등록된 이메일로 발송했습니다. 메일을 확인하세요."; - if (req.username() == null || req.username().isBlank() - || req.email() == null || req.email().isBlank()) { - return new AuthHelperResult(false, "아이디와 이메일을 모두 입력하세요."); - } - MesUser u = userMapper.findByUsernameAndEmail(req.username(), req.email()); - if (u == null) { - // 존재 여부 누설 방지 — 동일 성공 메시지 반환(실제 발송 없음). - log.info("[auth-helper] reset-password no match (suppressed): username={}", req.username()); - return new AuthHelperResult(true, okMsg); - } - String tempPw = generateTempPassword(); - userMapper.updatePasswordHash(req.username(), passwordEncoder.encode(tempPw)); - - String subject = "[GUARDiA MES] 임시 비밀번호 안내"; - String body = String.format( - "안녕하세요 %s 님,\n임시 비밀번호는 [%s] 입니다.\n로그인 후 즉시 비밀번호를 변경하세요.", - u.getDisplayName() != null ? u.getDisplayName() : u.getUsername(), tempPw); - // 메일 본문에만 임시비번 포함. mailSender 미설정 환경은 LogMailSender 폴백(서버 로그). - mailSender.send(u.getEmail(), subject, body); - log.info("[auth-helper] reset-password issued temp pw (sent via mail/log): username={}", req.username()); - return new AuthHelperResult(true, okMsg); - } - - /** - * 마이페이지 비밀번호 변경(현재 비밀번호 검증 + BCrypt 저장). UIWS changePassword 미러. - * 현재 비번 불일치 → PASSWORD_MISMATCH, 기존과 동일 → PASSWORD_SAME_AS_OLD. - * 새 비밀번호 평문은 로그/응답/감사에 절대 기록하지 않는다(보안 불변규칙). - */ - @Transactional - public void changePassword(String username, ChangePasswordRequest req) { - MesUser user = userMapper.findByUsername(username); - if (user == null) { - throw new UiwsApiException(UiwsErrorCode.USER_NOT_FOUND); - } - if (!passwordEncoder.matches(req.currentPassword(), user.getPasswordHash())) { - throw new UiwsApiException(UiwsErrorCode.PASSWORD_MISMATCH); - } - if (passwordEncoder.matches(req.newPassword(), user.getPasswordHash())) { - throw new UiwsApiException(UiwsErrorCode.PASSWORD_SAME_AS_OLD); - } - userMapper.updatePasswordHash(username, passwordEncoder.encode(req.newPassword())); - auditService.log(username, "PASSWORD_CHANGE", username, "본인 비밀번호 변경"); - } - - private static String generateTempPassword() { - StringBuilder sb = new StringBuilder(10); - for (int i = 0; i < 10; i++) { - sb.append(TMP_PW_CHARS.charAt(RANDOM.nextInt(TMP_PW_CHARS.length()))); - } - return sb.toString(); - } - - /** username 부분 마스킹: 앞 2자만 노출(예: admin → ad***). 2자 이하는 첫 글자만. */ - private static String maskUsername(String username) { - if (username == null || username.isBlank()) { - return ""; - } - if (username.length() <= 2) { - return username.charAt(0) + "*"; - } - return username.substring(0, 2) + "*".repeat(Math.max(1, username.length() - 2)); - } } diff --git a/backend/src/main/java/com/zioinfo/mes/auth/JwtFilter.java b/backend/src/main/java/com/zioinfo/mes/auth/JwtFilter.java index b660f8d..b1897e3 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/JwtFilter.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/JwtFilter.java @@ -26,10 +26,7 @@ public class JwtFilter extends OncePerRequestFilter { String header = req.getHeader("Authorization"); if (header != null && header.startsWith("Bearer ")) { String token = header.substring(7); - // 보안(UIWS 2FA): purpose=2fa verify-token 은 access 토큰이 아니다. - // 동일 서명키라 isValid()는 통과하므로 별도 차단하지 않으면 2차 인증 전 API 접근(2FA 우회)이 가능. - // → verify-token 은 인증 컨텍스트를 세우지 않고 무시한다(/api/mes/auth/verify 에서만 사용). - if (jwtUtil.isValid(token) && !jwtUtil.isVerifyToken(token)) { + if (jwtUtil.isValid(token)) { String username = jwtUtil.getUsername(token); String role = jwtUtil.getRole(token); var auth = new UsernamePasswordAuthenticationToken( diff --git a/backend/src/main/java/com/zioinfo/mes/auth/JwtUtil.java b/backend/src/main/java/com/zioinfo/mes/auth/JwtUtil.java index 29eb3de..70cc21e 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/JwtUtil.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/JwtUtil.java @@ -34,46 +34,6 @@ public class JwtUtil { .compact(); } - /** - * UIWS 2FA 이식: 1차 로그인 통과 후 발급하는 단기 verify-token. - * purpose=2fa 클레임으로 access 토큰과 구분(verify-token 으로는 API 접근 불가). - */ - public String generateVerifyToken(String username, long validitySeconds) { - return Jwts.builder() - .subject(username) - .claim("purpose", "2fa") - .issuedAt(new Date()) - .expiration(new Date(System.currentTimeMillis() + validitySeconds * 1000L)) - .signWith(key()) - .compact(); - } - - /** verify-token 검증 후 username 반환. 유효하지 않거나 purpose!=2fa 면 null. */ - public String parseVerifyTokenUsername(String token) { - try { - Claims c = parse(token); - if (!"2fa".equals(c.get("purpose", String.class))) { - return null; - } - return c.getSubject(); - } catch (JwtException | IllegalArgumentException e) { - log.debug("verify-token 검증 실패: {}", e.getMessage()); - return null; - } - } - - /** - * 보안: 토큰이 2FA verify-token(purpose=2fa)인지 판별. - * JwtFilter 가 access 토큰만 인증 컨텍스트로 인정하도록 verify-token 을 걸러내는 데 사용. - */ - public boolean isVerifyToken(String token) { - try { - return "2fa".equals(parse(token).get("purpose", String.class)); - } catch (JwtException | IllegalArgumentException e) { - return false; - } - } - public Claims parse(String token) { return Jwts.parser().verifyWith(key()).build() .parseSignedClaims(token).getPayload(); diff --git a/backend/src/main/java/com/zioinfo/mes/auth/MesUser.java b/backend/src/main/java/com/zioinfo/mes/auth/MesUser.java index 149d3a5..c4f97c0 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/MesUser.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/MesUser.java @@ -17,24 +17,4 @@ public class MesUser { private String role; private boolean active; private LocalDateTime createdAt; - - // ── UIWS 2FA 이식 (mes_user ALTER, db/91_uiws_port.sql) ───────────────────── - /** 2FA 발송 대상 이메일. mes_user 원본 미보유 → 91_uiws_port.sql ALTER 로 추가. */ - private String email; - /** 이메일 인증코드(6자리). 발급 후 verify 단계에서 검증. API 응답에는 절대 미포함. */ - private String emailVerifyCode; - /** 인증코드 만료시각. */ - private LocalDateTime emailVerifyExpire; - /** 로그인 실패 누적 횟수(기본 0). max-login-fail 도달 시 locked. */ - private Integer loginFailCount; - /** 계정 잠금 여부(기본 false). */ - private Boolean locked; - /** TOTP 시크릿(보류/확정 공용). API 응답·로그 미노출. */ - private String otpSecret; - /** OTP 등록 확정 여부(최초 로그인 verify 성공 시 true). db/93_auth_otp.sql ALTER. */ - private Boolean otpEnabled; - - // ── 로그인 보조 이식(회원가입 승인 게이트) mes_user.approved ─────────────── - /** 회원가입 승인 여부(기본 true). 신규 가입자는 false → SUPERADMIN 승인 전 로그인 차단. */ - private Boolean approved; } diff --git a/backend/src/main/java/com/zioinfo/mes/auth/mapper/UserMapper.java b/backend/src/main/java/com/zioinfo/mes/auth/mapper/UserMapper.java index dbd376b..a095b8b 100644 --- a/backend/src/main/java/com/zioinfo/mes/auth/mapper/UserMapper.java +++ b/backend/src/main/java/com/zioinfo/mes/auth/mapper/UserMapper.java @@ -3,89 +3,11 @@ package com.zioinfo.mes.auth.mapper; import com.zioinfo.mes.auth.MesUser; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Update; - -import java.time.LocalDateTime; @Mapper public interface UserMapper { - // findByUsername / insert 는 mapper/UserMapper.xml 에 정의(2FA 컬럼 포함 resultMap). - // 어노테이션 중복 정의 시 "statement already contains value" 크래시 → XML 유지. MesUser findByUsername(@Param("username") String username); int insert(MesUser user); - - // ── UIWS 2FA 이식: 실패 카운트/잠금/인증코드 갱신 (멱등 UPDATE) ─────────────── - - /** 로그인 성공 시 실패 카운트 초기화. */ - @Update("UPDATE mes_user SET login_fail_count = 0 WHERE username = #{username}") - int resetLoginFail(@Param("username") String username); - - /** 로그인 실패 누적(+1) 및 임계 도달 시 잠금. */ - @Update(""" - UPDATE mes_user - SET login_fail_count = COALESCE(login_fail_count, 0) + 1, - locked = (COALESCE(login_fail_count, 0) + 1 >= #{maxFail}) - WHERE username = #{username} - """) - int incrementLoginFail(@Param("username") String username, @Param("maxFail") int maxFail); - - /** 1차 통과 시 이메일 인증코드/만료 저장(verify 단계에서 검증). */ - @Update(""" - UPDATE mes_user - SET email_verify_code = #{code}, email_verify_expire = #{expire}, login_fail_count = 0 - WHERE username = #{username} - """) - int saveEmailCode(@Param("username") String username, - @Param("code") String code, - @Param("expire") LocalDateTime expire); - - /** 2차 검증 성공 시 코드 폐기. */ - @Update("UPDATE mes_user SET email_verify_code = NULL, email_verify_expire = NULL WHERE username = #{username}") - int clearEmailCode(@Param("username") String username); - - /** 관리자 잠금 해제(실패 카운트/잠금 초기화). */ - @Update("UPDATE mes_user SET locked = false, login_fail_count = 0 WHERE username = #{username}") - int unlock(@Param("username") String username); - - // ── TOTP(OTP 2차 인증) 이식 (멱등 UPDATE) ──────────────────────────────────── - - /** 보류 시크릿 저장(등록 확정 전). otp_enabled 은 건드리지 않는다(verify/confirm 에서 확정). */ - @Update("UPDATE mes_user SET otp_secret = #{secret} WHERE username = #{username}") - int updateOtpSecret(@Param("username") String username, @Param("secret") String secret); - - /** 등록 확정: otp_enabled=true (시크릿은 유지). */ - @Update("UPDATE mes_user SET otp_enabled = true WHERE username = #{username}") - int enableOtp(@Param("username") String username); - - /** 해제/초기화: 시크릿 폐기 + otp_enabled=false. (마이페이지 해제) */ - @Update("UPDATE mes_user SET otp_secret = NULL, otp_enabled = false WHERE username = #{username}") - int disableOtp(@Param("username") String username); - - // ── 로그인 보조 이식: 회원가입 / 아이디찾기 / 비밀번호 초기화 (XML 정의) ─────────────── - - /** username 존재 여부(회원가입 중복 검사). */ - int countByUsername(@Param("username") String username); - - /** email 존재 여부(회원가입 중복 검사 — 운영자 계정 한정). */ - int countByEmail(@Param("email") String email); - - /** - * 회원가입(승인 대기). approved=false·is_active=true·role=VIEWER 고정. - * 관리자 화면에서 활성/승인 전까지 로그인 차단. - */ - int signup(MesUser user); - - /** 아이디찾기: 표시명(display_name)+이메일 일치 운영자 1건. */ - MesUser findByDisplayNameAndEmail(@Param("displayName") String displayName, - @Param("email") String email); - - /** 비밀번호 초기화 대상 검증: username+email 동시 일치 운영자 1건. */ - MesUser findByUsernameAndEmail(@Param("username") String username, - @Param("email") String email); - - /** 임시 비밀번호 적용 + 잠금/실패카운트 해제(초기화 시). */ - int updatePasswordHash(@Param("username") String username, - @Param("passwordHash") String passwordHash); } diff --git a/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java b/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java index 8aabecb..1586a58 100644 --- a/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/zioinfo/mes/common/GlobalExceptionHandler.java @@ -1,7 +1,6 @@ package com.zioinfo.mes.common; import lombok.extern.slf4j.Slf4j; -import org.springframework.dao.DataAccessException; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -40,14 +39,6 @@ public class GlobalExceptionHandler { return ApiResponse.fail(e.getMessage()); } - @ExceptionHandler(DataAccessException.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public ApiResponse handleDataAccess(DataAccessException e) { - // 보안 불변 규칙: SQL/테이블/쿼리/스택 상세 절대 미노출 — 내부 로그만 남기고 일반 메시지 반환 - log.error("DB 오류", e); - return ApiResponse.fail("ERR-MES-DB: 데이터 처리 중 오류가 발생했습니다"); - } - @ExceptionHandler(RuntimeException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ApiResponse handleRuntime(RuntimeException e) { diff --git a/backend/src/main/java/com/zioinfo/mes/config/SecurityConfig.java b/backend/src/main/java/com/zioinfo/mes/config/SecurityConfig.java index d9b6175..bf3a2bd 100644 --- a/backend/src/main/java/com/zioinfo/mes/config/SecurityConfig.java +++ b/backend/src/main/java/com/zioinfo/mes/config/SecurityConfig.java @@ -43,12 +43,9 @@ public class SecurityConfig { .cors(cors -> {}) .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(auth -> auth - // 로그인 + 로그인 보조 3종(signup/find-id/reset-password) + 2FA verify 모두 /api/mes/auth/** 하위 → permitAll .requestMatchers("/api/mes/auth/**").permitAll() .requestMatchers("/actuator/health").permitAll() .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/api/mes/docs/**", "/api/mes/swagger/**").permitAll() - // UIWS system 이식: 무인증 공개 조회(회사/부서 룩업) — 회원가입 화면 등에서 사용 - .requestMatchers(HttpMethod.GET, "/api/public/**").permitAll() // 정적 프론트 번들 .requestMatchers("/", "/index.html", "/assets/**", "/favicon.ico").permitAll() @@ -60,9 +57,6 @@ public class SecurityConfig { .requestMatchers("/api/admin/audit").hasAnyRole("SUPERADMIN", "MANAGER") .requestMatchers("/api/admin/**").hasRole("SUPERADMIN") - // RAG 기법 토글 변경 — MANAGER 이상(운영자 전용). 분석 트리거(POST)는 아래 WORKER+ 규칙 적용. - .requestMatchers(HttpMethod.PUT, "/api/mes/rag/toggles/**").hasAnyRole("SUPERADMIN", "MANAGER") - // 변경(실적·검사·입출고·재고이동) — WORKER 이상 (기준정보/마감/승인은 서비스에서 MANAGER+ 가드) .requestMatchers(HttpMethod.POST, "/api/mes/**").hasAnyRole("SUPERADMIN", "MANAGER", "WORKER") .requestMatchers(HttpMethod.PUT, "/api/mes/**").hasAnyRole("SUPERADMIN", "MANAGER", "WORKER") @@ -71,9 +65,6 @@ public class SecurityConfig { // 조회 — 인증 사용자 전체(Viewer+) .requestMatchers(HttpMethod.GET, "/api/mes/**").hasAnyRole("SUPERADMIN", "MANAGER", "WORKER", "VIEWER") - // UIWS system(권한관리) 이식 — 사용자/역할/메뉴/부서/거래처/코드 관리는 SUPERADMIN 전용(RBAC 게이트) - .requestMatchers("/api/system/**").hasRole("SUPERADMIN") - .anyRequest().authenticated() ) .addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class); diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 6105819..6ac6c0d 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -15,12 +15,8 @@ spring: minimum-idle: 1 sql: init: - # UIWS 이식: 91_uiws_port.sql(tb_uiws_* + mes_user 2FA ALTER, 전부 멱등)만 부팅 시 적용. - # 기존 schema.sql 은 deploy_server 가 psql 로 별도 적용(비멱등 시드 충돌 회피). - mode: ${SQL_INIT_MODE:always} - # 91=업무/2FA(tb_uiws_* + mes_user ALTER), 92=권한관리 system, 104=AI 플랫폼 설정 시드(멱등). 전부 멱등. - schema-locations: classpath:db/91_uiws_port.sql,classpath:db/92_uiws_system.sql,classpath:db/93_auth_otp.sql,classpath:db/104_seed_ai_config.sql - continue-on-error: true + mode: ${SQL_INIT_MODE:never} + schema-locations: classpath:db/schema.sql servlet: multipart: max-file-size: 20MB @@ -38,39 +34,15 @@ springdoc: swagger-ui: path: /api/mes/swagger -# ── UIWS 이식 모듈 설정 (worklog/schedule/message/stats + 2FA 레이어) ────────── -mes: - uiws: - auth: - twofa-enabled: ${UIWS_2FA:true} # off=기존 단일로그인 회귀 0 - verify-token-validity-seconds: 300 # 1차 통과 후 verify-token 5분 - email-code-validity-seconds: 300 # 이메일 인증코드 5분 - max-login-fail: 5 # 실패 5회 누적 시 계정 잠금 - mail: - mode: ${UIWS_MAIL_MODE:log} # LogMailSender 폴백(외부 API 0). 운영 smtp 시 별도 빈 - upload: - upload-dir: ${UIWS_UPLOAD_DIR:./uploads/uiws} - # ── AI 로컬 학습 저장소(임베디드 DuckDB) — 피드백/추론 로그. 미가용 시 조용히 비활성(AI 기능 무영향) ── - ai: - duckdb-path: ${MES_DUCKDB_PATH:/opt/guardia-mes/data/mes_learning.duckdb} - guardia: erp-url: ${ERP_URL:http://localhost:8003} itsm-url: ${ITSM_URL:http://localhost:9001} ocr-url: ${OCR_URL:http://localhost:8005} bi-url: ${BI_URL:http://localhost:8006} - # 중앙 guardia-rag (최신 AI 기법: 하이브리드/그래프/리랭크 검색·에이전틱 tool-use·구조화·스트리밍) - # 보안 불변: 온프레미스 루프백 전용. 미가용/타임아웃 시 MES 결정론 로컬 폴백(degraded:true). - rag: - base-url: ${RAG_URL:http://127.0.0.1:8020} - timeout-ms: ${RAG_TIMEOUT_MS:120000} - enabled: ${RAG_ENABLED:true} - solution: mes # 보안 불변 규칙: Ollama 온프레미스만 허용. 외부 AI API 절대 금지. - # (예외: Claude 는 소유자 승인으로 api.anthropic.com 단일 경로 허용 — 키는 ANTHROPIC_API_KEY env 로만 주입) ollama-url: ${OLLAMA_URL:http://localhost:11434} - ollama-text-model: ${OLLAMA_TEXT_MODEL:llama3.2:1b} - ollama-vision-model: ${OLLAMA_VISION_MODEL:moondream} + ollama-text-model: ${OLLAMA_TEXT_MODEL:llama3} + ollama-vision-model: ${OLLAMA_VISION_MODEL:llava} crypto: secret: ${MES_CRYPTO_SECRET:guardia-mes-aes-256-gcm-master-key-2026-zioinfo} jwt: diff --git a/backend/src/main/resources/mapper/AdminUserMapper.xml b/backend/src/main/resources/mapper/AdminUserMapper.xml index e856bd8..0f363f1 100644 --- a/backend/src/main/resources/mapper/AdminUserMapper.xml +++ b/backend/src/main/resources/mapper/AdminUserMapper.xml @@ -41,10 +41,6 @@ UPDATE mes_user SET password_hash = #{passwordHash} WHERE id = #{id} - - UPDATE mes_user SET otp_secret = NULL, otp_enabled = false WHERE id = #{id} - - DELETE FROM mes_user WHERE id = #{id} diff --git a/backend/src/main/resources/mapper/AnalyticsMapper.xml b/backend/src/main/resources/mapper/AnalyticsMapper.xml index af79ba9..a244b25 100644 --- a/backend/src/main/resources/mapper/AnalyticsMapper.xml +++ b/backend/src/main/resources/mapper/AnalyticsMapper.xml @@ -8,7 +8,7 @@ COALESCE(SUM(good_qty),0) AS total_good, COALESCE(SUM(defect_qty),0) AS total_defect, ROUND( (COALESCE(SUM(defect_qty),0)::numeric - / NULLIF(SUM(good_qty)+SUM(defect_qty),0) * 100)::numeric, 2) AS defect_rate, + / NULLIF(SUM(good_qty)+SUM(defect_qty),0) * 100), 2) AS defect_rate, (SELECT COUNT(*) FROM mes_workorder WHERE status IN ('DONE','CLOSED') AND updated_at >= CURRENT_DATE - (#{days} || ' days')::interval) AS completed_workorders diff --git a/backend/src/main/resources/mapper/UserMapper.xml b/backend/src/main/resources/mapper/UserMapper.xml index 3d73d1a..5203a0c 100644 --- a/backend/src/main/resources/mapper/UserMapper.xml +++ b/backend/src/main/resources/mapper/UserMapper.xml @@ -11,21 +11,10 @@ - - - - - - - - - - @@ -36,48 +25,4 @@ VALUES (#{username}, #{passwordHash}, #{displayName}, #{role}, #{active}) - - - - - - - - - - - INSERT INTO mes_user (username, password_hash, display_name, role, email, - is_active, approved, login_fail_count, locked) - VALUES (#{username}, #{passwordHash}, #{displayName}, 'VIEWER', #{email}, - true, false, 0, false) - - - - - - - - - UPDATE mes_user - SET password_hash = #{passwordHash}, locked = false, login_fail_count = 0 - WHERE username = #{username} - - diff --git a/backend/src/main/resources/static/assets/index-BLHiicbF.js b/backend/src/main/resources/static/assets/index-BLHiicbF.js new file mode 100644 index 0000000..1b532fb --- /dev/null +++ b/backend/src/main/resources/static/assets/index-BLHiicbF.js @@ -0,0 +1,480 @@ +var D1=e=>{throw TypeError(e)};var Qm=(e,t,n)=>t.has(e)||D1("Cannot "+n);var I=(e,t,n)=>(Qm(e,t,"read from private field"),n?n.call(e):t.get(e)),be=(e,t,n)=>t.has(e)?D1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),fe=(e,t,n,r)=>(Qm(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Dt=(e,t,n)=>(Qm(e,t,"access private method"),n);var Af=(e,t,n,r)=>({set _(a){fe(e,t,a,n)},get _(){return I(e,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var Nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hE={exports:{}},Sp={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var R3=Symbol.for("react.transitional.element"),k3=Symbol.for("react.fragment");function pE(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:R3,type:e,key:r,ref:t!==void 0?t:null,props:n}}Sp.Fragment=k3;Sp.jsx=pE;Sp.jsxs=pE;hE.exports=Sp;var o=hE.exports,mE={exports:{}},he={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ib=Symbol.for("react.transitional.element"),D3=Symbol.for("react.portal"),L3=Symbol.for("react.fragment"),z3=Symbol.for("react.strict_mode"),B3=Symbol.for("react.profiler"),I3=Symbol.for("react.consumer"),U3=Symbol.for("react.context"),q3=Symbol.for("react.forward_ref"),H3=Symbol.for("react.suspense"),F3=Symbol.for("react.memo"),yE=Symbol.for("react.lazy"),G3=Symbol.for("react.activity"),L1=Symbol.iterator;function K3(e){return e===null||typeof e!="object"?null:(e=L1&&e[L1]||e["@@iterator"],typeof e=="function"?e:null)}var vE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},gE=Object.assign,xE={};function ws(e,t,n){this.props=e,this.context=t,this.refs=xE,this.updater=n||vE}ws.prototype.isReactComponent={};ws.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ws.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function bE(){}bE.prototype=ws.prototype;function lb(e,t,n){this.props=e,this.context=t,this.refs=xE,this.updater=n||vE}var ob=lb.prototype=new bE;ob.constructor=lb;gE(ob,ws.prototype);ob.isPureReactComponent=!0;var z1=Array.isArray;function xv(){}var We={H:null,A:null,T:null,S:null},jE=Object.prototype.hasOwnProperty;function sb(e,t,n){var r=n.ref;return{$$typeof:ib,type:e,key:t,ref:r!==void 0?r:null,props:n}}function V3(e,t){return sb(e.type,t,e.props)}function cb(e){return typeof e=="object"&&e!==null&&e.$$typeof===ib}function Y3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var B1=/\/+/g;function Wm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Y3(""+e.key):t.toString(36)}function X3(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(xv,xv):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Gl(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(i){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case ib:case D3:l=!0;break;case yE:return l=e._init,Gl(l(e._payload),t,n,r,a)}}if(l)return a=a(e),l=r===""?"."+Wm(e,0):r,z1(a)?(n="",l!=null&&(n=l.replace(B1,"$&/")+"/"),Gl(a,t,n,"",function(u){return u})):a!=null&&(cb(a)&&(a=V3(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(B1,"$&/")+"/")+l)),t.push(a)),1;l=0;var s=r===""?".":r+":";if(z1(e))for(var c=0;c>>1,X=$[V];if(0>>1;Va(ie,q))aea(Se,ie)?($[V]=Se,$[ae]=q,V=ae):($[V]=ie,$[Q]=q,V=Q);else if(aea(Se,q))$[V]=Se,$[ae]=q,V=ae;else break e}}return L}function a($,L){var q=$.sortIndex-L.sortIndex;return q!==0?q:$.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,s=l.now();e.unstable_now=function(){return l.now()-s}}var c=[],u=[],f=1,d=null,h=3,m=!1,j=!1,v=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function x($){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=$)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function w($){if(v=!1,x($),!j)if(n(c)!==null)j=!0,S||(S=!0,P());else{var L=n(u);L!==null&&E(w,L.startTime-$)}}var S=!1,A=-1,N=5,C=-1;function M(){return p?!0:!(e.unstable_now()-C$&&M());){var V=d.callback;if(typeof V=="function"){d.callback=null,h=d.priorityLevel;var X=V(d.expirationTime<=$);if($=e.unstable_now(),typeof X=="function"){d.callback=X,x($),L=!0;break t}d===n(c)&&r(c),x($)}else r(c);d=n(c)}if(d!==null)L=!0;else{var J=n(u);J!==null&&E(w,J.startTime-$),L=!1}}break e}finally{d=null,h=q,m=!1}L=void 0}}finally{L?P():S=!1}}}var P;if(typeof b=="function")P=function(){b(R)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,_=B.port2;B.port1.onmessage=R,P=function(){_.postMessage(null)}}else P=function(){y(R,0)};function E($,L){A=y(function(){$(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var q=h;h=L;try{return $()}finally{h=q}},e.unstable_requestPaint=function(){p=!0},e.unstable_runWithPriority=function($,L){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var q=h;h=$;try{return L()}finally{h=q}},e.unstable_scheduleCallback=function($,L,q){var V=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0V?($.sortIndex=q,t(u,$),n(c)===null&&$===n(u)&&(v?(g(A),A=-1):v=!0,E(w,q-V))):($.sortIndex=X,t(c,$),j||m||(j=!0,S||(S=!0,P()))),$},e.unstable_shouldYield=M,e.unstable_wrapCallback=function($){var L=h;return function(){var q=h;h=L;try{return $.apply(this,arguments)}finally{h=q}}}})(OE);wE.exports=OE;var Z3=wE.exports,AE={exports:{}},ln={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var J3=O;function NE(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(EE)}catch(e){console.error(e)}}EE(),AE.exports=ln;var nR=AE.exports;/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Et=Z3,CE=O,rR=nR;function F(e){var t="https://react.dev/errors/"+e;if(1Xl||(e.current=Av[Xl],Av[Xl]=null,Xl--)}function qe(e,t){Xl++,Av[Xl]=e.current,e.current=t}var Lr=Ur(null),Gc=Ur(null),ri=Ur(null),Dd=Ur(null);function Ld(e,t){switch(qe(ri,t),qe(Gc,e),qe(Lr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yj(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yj(t),e=e_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Rt(Lr),qe(Lr,e)}function Ro(){Rt(Lr),Rt(Gc),Rt(ri)}function Nv(e){e.memoizedState!==null&&qe(Dd,e);var t=Lr.current,n=e_(t,e.type);t!==n&&(qe(Gc,e),qe(Lr,n))}function zd(e){Gc.current===e&&(Rt(Lr),Rt(Gc)),Dd.current===e&&(Rt(Dd),nu._currentValue=al)}var Zm,H1;function zi(e){if(Zm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Zm=t&&t[1]||"",H1=-1)":-1a||c[r]!==u[a]){var f=` +`+c[r].replace(" at new "," at ");return e.displayName&&f.includes("")&&(f=f.replace("",e.displayName)),f}while(1<=r&&0<=a);break}}}finally{Jm=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?zi(n):""}function sR(e,t){switch(e.tag){case 26:case 27:case 5:return zi(e.type);case 16:return zi("Lazy");case 13:return e.child!==t&&t!==null?zi("Suspense Fallback"):zi("Suspense");case 19:return zi("SuspenseList");case 0:case 15:return ey(e.type,!1);case 11:return ey(e.type.render,!1);case 1:return ey(e.type,!0);case 31:return zi("Activity");default:return""}}function F1(e){try{var t="",n=null;do t+=sR(e,n),n=e,e=e.return;while(e);return t}catch(r){return` +Error generating stack: `+r.message+` +`+r.stack}}var Ev=Object.prototype.hasOwnProperty,db=Et.unstable_scheduleCallback,ty=Et.unstable_cancelCallback,cR=Et.unstable_shouldYield,uR=Et.unstable_requestPaint,En=Et.unstable_now,fR=Et.unstable_getCurrentPriorityLevel,kE=Et.unstable_ImmediatePriority,DE=Et.unstable_UserBlockingPriority,Bd=Et.unstable_NormalPriority,dR=Et.unstable_LowPriority,LE=Et.unstable_IdlePriority,hR=Et.log,pR=Et.unstable_setDisableYieldValue,Yu=null,Cn=null;function Xa(e){if(typeof hR=="function"&&pR(e),Cn&&typeof Cn.setStrictMode=="function")try{Cn.setStrictMode(Yu,e)}catch{}}var _n=Math.clz32?Math.clz32:vR,mR=Math.log,yR=Math.LN2;function vR(e){return e>>>=0,e===0?32:31-(mR(e)/yR|0)|0}var _f=256,Tf=262144,Pf=4194304;function Bi(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ap(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,i=e.suspendedLanes,l=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~i,r!==0?a=Bi(r):(l&=s,l!==0?a=Bi(l):n||(n=s&~e,n!==0&&(a=Bi(n))))):(s=r&~i,s!==0?a=Bi(s):l!==0?a=Bi(l):n||(n=r&~e,n!==0&&(a=Bi(n)))),a===0?0:t!==0&&t!==a&&!(t&i)&&(i=a&-a,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:a}function Xu(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function gR(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zE(){var e=Pf;return Pf<<=1,!(Pf&62914560)&&(Pf=4194304),e}function ny(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qu(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xR(e,t,n,r,a,i){var l=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=l&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var AR=/[\n"\\]/g;function Kn(e){return e.replace(AR,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Tv(e,t,n,r,a,i,l,s){e.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.type=l:e.removeAttribute("type"),t!=null?l==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Hn(t)):e.value!==""+Hn(t)&&(e.value=""+Hn(t)):l!=="submit"&&l!=="reset"||e.removeAttribute("value"),t!=null?Pv(e,l,Hn(t)):n!=null?Pv(e,l,Hn(n)):r!=null&&e.removeAttribute("value"),a==null&&i!=null&&(e.defaultChecked=!!i),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Hn(s):e.removeAttribute("name")}function VE(e,t,n,r,a,i,l,s){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){_v(e);return}n=n!=null?""+Hn(n):"",t=t!=null?""+Hn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??a,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.name=l),_v(e)}function Pv(e,t,n){t==="number"&&Id(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function mo(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$v=!1;if(ma)try{var Zs={};Object.defineProperty(Zs,"passive",{get:function(){$v=!0}}),window.addEventListener("test",Zs,Zs),window.removeEventListener("test",Zs,Zs)}catch{$v=!1}var Qa=null,gb=null,vd=null;function ZE(){if(vd)return vd;var e,t=gb,n=t.length,r,a="value"in Qa?Qa.value:Qa.textContent,i=a.length;for(e=0;e=wc),tj=" ",nj=!1;function e2(e,t){switch(e){case"keyup":return JR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t2(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zl=!1;function tk(e,t){switch(e){case"compositionend":return t2(t);case"keypress":return t.which!==32?null:(nj=!0,tj);case"textInput":return e=t.data,e===tj&&nj?null:e;default:return null}}function nk(e,t){if(Zl)return e==="compositionend"||!bb&&e2(e,t)?(e=ZE(),vd=gb=Qa=null,Zl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=oj(n)}}function i2(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?i2(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function l2(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Id(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Id(e.document)}return t}function jb(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")}var uk=ma&&"documentMode"in document&&11>=document.documentMode,Jl=null,Rv=null,Ac=null,kv=!1;function cj(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kv||Jl==null||Jl!==Id(r)||(r=Jl,"selectionStart"in r&&jb(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}),Ac&&Yc(Ac,r)||(Ac=r,r=ah(Rv,"onSelect"),0>=l,a-=l,Mr=1<<32-_n(t)+a|n<N?(C=A,A=null):C=A.sibling;var M=h(y,A,b[N],x);if(M===null){A===null&&(A=C);break}e&&A&&M.alternate===null&&t(y,A),g=i(M,g,N),S===null?w=M:S.sibling=M,S=M,A=C}if(N===b.length)return n(y,A),we&&ea(y,N),w;if(A===null){for(;NN?(C=A,A=null):C=A.sibling;var R=h(y,A,M.value,x);if(R===null){A===null&&(A=C);break}e&&A&&R.alternate===null&&t(y,A),g=i(R,g,N),S===null?w=R:S.sibling=R,S=R,A=C}if(M.done)return n(y,A),we&&ea(y,N),w;if(A===null){for(;!M.done;N++,M=b.next())M=d(y,M.value,x),M!==null&&(g=i(M,g,N),S===null?w=M:S.sibling=M,S=M);return we&&ea(y,N),w}for(A=r(A);!M.done;N++,M=b.next())M=m(A,y,N,M.value,x),M!==null&&(e&&M.alternate!==null&&A.delete(M.key===null?N:M.key),g=i(M,g,N),S===null?w=M:S.sibling=M,S=M);return e&&A.forEach(function(P){return t(y,P)}),we&&ea(y,N),w}function p(y,g,b,x){if(typeof b=="object"&&b!==null&&b.type===Yl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Cf:e:{for(var w=b.key;g!==null;){if(g.key===w){if(w=b.type,w===Yl){if(g.tag===7){n(y,g.sibling),x=a(g,b.props.children),x.return=y,y=x;break e}}else if(g.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===ka&&Ii(w)===g.type){n(y,g.sibling),x=a(g,b.props),ec(x,b),x.return=y,y=x;break e}n(y,g);break}else t(y,g);g=g.sibling}b.type===Yl?(x=il(b.props.children,y.mode,x,b.key),x.return=y,y=x):(x=xd(b.type,b.key,b.props,null,y.mode,x),ec(x,b),x.return=y,y=x)}return l(y);case yc:e:{for(w=b.key;g!==null;){if(g.key===w)if(g.tag===4&&g.stateNode.containerInfo===b.containerInfo&&g.stateNode.implementation===b.implementation){n(y,g.sibling),x=a(g,b.children||[]),x.return=y,y=x;break e}else{n(y,g);break}else t(y,g);g=g.sibling}x=fy(b,y.mode,x),x.return=y,y=x}return l(y);case ka:return b=Ii(b),p(y,g,b,x)}if(vc(b))return j(y,g,b,x);if(Ws(b)){if(w=Ws(b),typeof w!="function")throw Error(F(150));return b=w.call(b),v(y,g,b,x)}if(typeof b.then=="function")return p(y,g,kf(b),x);if(b.$$typeof===aa)return p(y,g,Rf(y,b),x);Df(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,g!==null&&g.tag===6?(n(y,g.sibling),x=a(g,b),x.return=y,y=x):(n(y,g),x=uy(b,y.mode,x),x.return=y,y=x),l(y)):n(y,g)}return function(y,g,b,x){try{Wc=0;var w=p(y,g,b,x);return go=null,w}catch(A){if(A===Es||A===Pp)throw A;var S=On(29,A,null,y.mode);return S.lanes=x,S.return=y,S}finally{}}}var yl=j2(!0),S2=j2(!1),Da=!1;function Tb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qv(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ii(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function li(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ne&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=qd(e),h2(e,null,n),t}return Tp(e,r,t,n),qd(e)}function Ec(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,IE(e,n)}}function hy(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?a=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Hv=!1;function Cc(){if(Hv){var e=vo;if(e!==null)throw e}}function _c(e,t,n,r){Hv=!1;var a=e.updateQueue;Da=!1;var i=a.firstBaseUpdate,l=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var c=s,u=c.next;c.next=null,l===null?i=u:l.next=u,l=c;var f=e.alternate;f!==null&&(f=f.updateQueue,s=f.lastBaseUpdate,s!==l&&(s===null?f.firstBaseUpdate=u:s.next=u,f.lastBaseUpdate=c))}if(i!==null){var d=a.baseState;l=0,f=u=c=null,s=i;do{var h=s.lane&-536870913,m=h!==s.lane;if(m?(je&h)===h:(r&h)===h){h!==0&&h===Lo&&(Hv=!0),f!==null&&(f=f.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var j=e,v=s;h=t;var p=n;switch(v.tag){case 1:if(j=v.payload,typeof j=="function"){d=j.call(p,d,h);break e}d=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,h=typeof j=="function"?j.call(p,d,h):j,h==null)break e;d=Ze({},d,h);break e;case 2:Da=!0}}h=s.callback,h!==null&&(e.flags|=64,m&&(e.flags|=8192),m=a.callbacks,m===null?a.callbacks=[h]:m.push(h))}else m={lane:h,tag:s.tag,payload:s.payload,callback:s.callback,next:null},f===null?(u=f=m,c=d):f=f.next=m,l|=h;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;m=s,s=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);f===null&&(c=d),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=f,i===null&&(a.shared.lanes=0),vi|=l,e.lanes=l,e.memoizedState=d}}function w2(e,t){if(typeof e!="function")throw Error(F(191,e));e.call(t)}function O2(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ei?i:8;var l=ue.T,s={};ue.T=s,Hb(e,!1,t,n);try{var c=a(),u=ue.S;if(u!==null&&u(s,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=xk(c,r);Tc(e,t,f,Tn(e))}else Tc(e,t,r,Tn(e))}catch(d){Tc(e,t,{then:function(){},status:"rejected",reason:d},Tn())}finally{Ee.p=i,l!==null&&s.types!==null&&(l.types=s.types),ue.T=l}}function Ak(){}function Yv(e,t,n,r){if(e.tag!==5)throw Error(F(476));var a=X2(e).queue;Y2(e,a,t,al,n===null?Ak:function(){return Q2(e),n(r)})}function X2(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:al,baseState:al,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:al},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Q2(e){var t=X2(e);t.next===null&&(t=e.alternate.memoizedState),Tc(e,t.next.queue,{},Tn())}function qb(){return qt(nu)}function W2(){return pt().memoizedState}function Z2(){return pt().memoizedState}function Nk(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tn();e=ii(n);var r=li(t,e,n);r!==null&&(hn(r,t,n),Ec(r,t,n)),t={cache:Eb()},e.payload=t;return}t=t.return}}function Ek(e,t,n){var r=Tn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},kp(e)?eC(t,n):(n=wb(e,t,n,r),n!==null&&(hn(n,e,r),tC(n,t,r)))}function J2(e,t,n){var r=Tn();Tc(e,t,n,r)}function Tc(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(kp(e))eC(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,s=i(l,n);if(a.hasEagerState=!0,a.eagerState=s,Mn(s,l))return Tp(e,t,a,0),ze===null&&_p(),!1}catch{}finally{}if(n=wb(e,t,a,r),n!==null)return hn(n,e,r),tC(n,t,r),!0}return!1}function Hb(e,t,n,r){if(r={lane:2,revertLane:Zb(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},kp(e)){if(t)throw Error(F(479))}else t=wb(e,n,r,2),t!==null&&hn(t,e,2)}function kp(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function eC(e,t){xo=Yd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tC(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,IE(e,n)}}var Jc={readContext:qt,use:$p,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};Jc.useEffectEvent=st;var nC={readContext:qt,use:$p,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Oj,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Sd(4194308,4,H2.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sd(4194308,4,e,t)},useInsertionEffect:function(e,t){Sd(4,2,e,t)},useMemo:function(e,t){var n=Qt();t=t===void 0?null:t;var r=e();if(vl){Xa(!0);try{e()}finally{Xa(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Qt();if(n!==void 0){var a=n(t);if(vl){Xa(!0);try{n(t)}finally{Xa(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=Ek.bind(null,pe,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:function(e){e=Kv(e);var t=e.queue,n=J2.bind(null,pe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ib,useDeferredValue:function(e,t){var n=Qt();return Ub(n,e,t)},useTransition:function(){var e=Kv(!1);return e=Y2.bind(null,pe,e.queue,!0,!1),Qt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=pe,a=Qt();if(we){if(n===void 0)throw Error(F(407));n=n()}else{if(n=t(),ze===null)throw Error(F(349));je&127||_2(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,Oj(P2.bind(null,r,i,e),[e]),r.flags|=2048,Bo(9,{destroy:void 0},T2.bind(null,r,i,n,t),null),n},useId:function(){var e=Qt(),t=ze.identifierPrefix;if(we){var n=$r,r=Mr;n=(r&~(1<<32-_n(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Xd++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?l.createElement(a,{is:r.is}):l.createElement(a)}}i[Bt]=t,i[mn]=r;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)i.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=i;e:switch(Ht(i,a,r),a){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Vr(t)}}return Ke(t),jy(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Vr(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(F(166));if(e=ri.current,Ll(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=It,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Bt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||JC(e.nodeValue,n)),e||mi(t,!0)}else e=ih(e).createTextNode(r),e[Bt]=t,t.stateNode=e}return Ke(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ll(t),n!==null){if(e===null){if(!r)throw Error(F(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(557));e[Bt]=t}else pl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else n=dy(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(wn(t),t):(wn(t),null);if(t.flags&128)throw Error(F(558))}return Ke(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ll(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(F(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(F(317));a[Bt]=t}else pl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ke(t),a=!1}else a=dy(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(wn(t),t):(wn(t),null)}return wn(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lf(t,t.updateQueue),Ke(t),null);case 4:return Ro(),e===null&&Jb(t.stateNode.containerInfo),Ke(t),null;case 10:return fa(t.type),Ke(t),null;case 19:if(Rt(ht),r=t.memoizedState,r===null)return Ke(t),null;if(a=(t.flags&128)!==0,i=r.rendering,i===null)if(a)tc(r,!1);else{if(ft!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Vd(e),i!==null){for(t.flags|=128,tc(r,!1),e=i.updateQueue,t.updateQueue=e,Lf(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)p2(n,e),n=n.sibling;return qe(ht,ht.current&1|2),we&&ea(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&En()>Jd&&(t.flags|=128,a=!0,tc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Vd(i),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lf(t,e),tc(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!we)return Ke(t),null}else 2*En()-r.renderingStartTime>Jd&&n!==536870912&&(t.flags|=128,a=!0,tc(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=En(),e.sibling=null,n=ht.current,qe(ht,a?n&1|2:n&1),we&&ea(t,r.treeForkCount),e):(Ke(t),null);case 22:case 23:return wn(t),Pb(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),n=t.updateQueue,n!==null&&Lf(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Rt(ll),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fa(bt),Ke(t),null;case 25:return null;case 30:return null}throw Error(F(156,t.tag))}function Mk(e,t){switch(Nb(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(bt),Ro(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zd(t),null;case 31:if(t.memoizedState!==null){if(wn(t),t.alternate===null)throw Error(F(340));pl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(wn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));pl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Rt(ht),null;case 4:return Ro(),null;case 10:return fa(t.type),null;case 22:case 23:return wn(t),Pb(),e!==null&&Rt(ll),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(bt),null;case 25:return null;default:return null}}function pC(e,t){switch(Nb(t),t.tag){case 3:fa(bt),Ro();break;case 26:case 27:case 5:zd(t);break;case 4:Ro();break;case 31:t.memoizedState!==null&&wn(t);break;case 13:wn(t);break;case 19:Rt(ht);break;case 10:fa(t.type);break;case 22:case 23:wn(t),Pb(),e!==null&&Rt(ll);break;case 24:fa(bt)}}function tf(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var i=n.create,l=n.inst;r=i(),l.destroy=r}n=n.next}while(n!==a)}}catch(s){Me(t,t.return,s)}}function yi(e,t,n){try{var r=t.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var i=a.next;r=i;do{if((r.tag&e)===e){var l=r.inst,s=l.destroy;if(s!==void 0){l.destroy=void 0,a=t;var c=n,u=s;try{u()}catch(f){Me(a,c,f)}}}r=r.next}while(r!==i)}}catch(f){Me(t,t.return,f)}}function mC(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{O2(t,n)}catch(r){Me(e,e.return,r)}}}function yC(e,t,n){n.props=gl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Me(e,t,r)}}function Pc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(a){Me(e,t,a)}}function Rr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(a){Me(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){Me(e,t,a)}else n.current=null}function vC(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){Me(e,e.return,a)}}function Sy(e,t,n){try{var r=e.stateNode;eD(r,e.type,n,t),r[mn]=t}catch(a){Me(e,e.return,a)}}function gC(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Oi(e.type)||e.tag===4}function wy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gC(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.tag===27&&Oi(e.type)||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 Jv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ia));else if(r!==4&&(r===27&&Oi(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jv(e,t,n),e=e.sibling;e!==null;)Jv(e,t,n),e=e.sibling}function Zd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Oi(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zd(e,t,n),e=e.sibling;e!==null;)Zd(e,t,n),e=e.sibling}function xC(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Ht(t,r,n),t[Bt]=e,t[mn]=n}catch(i){Me(e,e.return,i)}}var ra=!1,xt=!1,Oy=!1,Lj=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function $k(e,t){if(e=e.containerInfo,lg=ch,e=l2(e),jb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,s=-1,c=-1,u=0,f=0,d=e,h=null;t:for(;;){for(var m;d!==n||a!==0&&d.nodeType!==3||(s=l+a),d!==i||r!==0&&d.nodeType!==3||(c=l+r),d.nodeType===3&&(l+=d.nodeValue.length),(m=d.firstChild)!==null;)h=d,d=m;for(;;){if(d===e)break t;if(h===n&&++u===a&&(s=l),h===i&&++f===r&&(c=l),(m=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=m}n=s===-1||c===-1?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(og={focusedElem:e,selectionRange:n},ch=!1,Pt=t;Pt!==null;)if(t=Pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pt=e;else for(;Pt!==null;){switch(t=Pt,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ht(i,r,n),i[Bt]=e,Mt(i),r=i;break e;case"link":var l=rS("link","href",a).get(r+(n.href||""));if(l){for(var s=0;sp&&(l=p,p=v,v=l);var y=sj(s,v),g=sj(s,p);if(y&&g&&(m.rangeCount!==1||m.anchorNode!==y.node||m.anchorOffset!==y.offset||m.focusNode!==g.node||m.focusOffset!==g.offset)){var b=d.createRange();b.setStart(y.node,y.offset),m.removeAllRanges(),v>p?(m.addRange(b),m.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),m.addRange(b))}}}}for(d=[],m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;sn?32:n,ue.T=null,n=ng,ng=null;var i=si,l=da;if(At=0,Uo=si=null,da=0,Ne&6)throw Error(F(331));var s=Ne;if(Ne|=4,TC(i.current),EC(i,i.current,l,n),Ne=s,nf(0,!1),Cn&&typeof Cn.onPostCommitFiberRoot=="function")try{Cn.onPostCommitFiberRoot(Yu,i)}catch{}return!0}finally{Ee.p=a,ue.T=r,GC(e,t)}}function Uj(e,t,n){t=Vn(n,t),t=Qv(e.stateNode,t,2),e=li(e,t,2),e!==null&&(Qu(e,2),qr(e))}function Me(e,t,n){if(e.tag===3)Uj(e,e,n);else for(;t!==null;){if(t.tag===3){Uj(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(oi===null||!oi.has(r))){e=Vn(n,e),n=oC(2),r=li(t,n,2),r!==null&&(sC(n,r,t,e),Qu(r,2),qr(r));break}}t=t.return}}function Ny(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Dk;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(Xb=!0,a.add(n),e=Uk.bind(null,e,t,n),t.then(e,e))}function Uk(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ze===e&&(je&n)===n&&(ft===4||ft===3&&(je&62914560)===je&&300>En()-Dp?!(Ne&2)&&qo(e,0):Qb|=n,Io===je&&(Io=0)),qr(e)}function VC(e,t){t===0&&(t=zE()),e=_l(e,t),e!==null&&(Qu(e,t),qr(e))}function qk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),VC(e,n)}function Hk(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(F(314))}r!==null&&r.delete(t),VC(e,n)}function Fk(e,t){return db(e,t)}var nh=null,Vl=null,ag=!1,rh=!1,Ey=!1,Ja=0;function qr(e){e!==Vl&&e.next===null&&(Vl===null?nh=Vl=e:Vl=Vl.next=e),rh=!0,ag||(ag=!0,Kk())}function nf(e,t){if(!Ey&&rh){Ey=!0;do for(var n=!1,r=nh;r!==null;){if(e!==0){var a=r.pendingLanes;if(a===0)var i=0;else{var l=r.suspendedLanes,s=r.pingedLanes;i=(1<<31-_n(42|e)+1)-1,i&=a&~(l&~s),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,qj(r,i))}else i=je,i=Ap(r,r===ze?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||Xu(r,i)||(n=!0,qj(r,i));r=r.next}while(n);Ey=!1}}function Gk(){YC()}function YC(){rh=ag=!1;var e=0;Ja!==0&&nD()&&(e=Ja);for(var t=En(),n=null,r=nh;r!==null;){var a=r.next,i=XC(r,t);i===0?(r.next=null,n===null?nh=a:n.next=a,a===null&&(Vl=n)):(n=r,(e!==0||i&3)&&(rh=!0)),r=a}At!==0&&At!==5||nf(e),Ja!==0&&(Ja=0)}function XC(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes&-62914561;0s)break;var f=c.transferSize,d=c.initiatorType;f&&Vj(d)&&(c=c.responseEnd,l+=f*(c"u"?null:document;function a_(e,t,n){var r=_s;if(r&&typeof t=="string"&&t){var a=Kn(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),eS.has(a)||(eS.add(a),e={rel:e,crossOrigin:n,href:t},r.querySelector(a)===null&&(t=r.createElement("link"),Ht(t,"link",e),Mt(t),r.head.appendChild(t)))}}function fD(e){Oa.D(e),a_("dns-prefetch",e,null)}function dD(e,t){Oa.C(e,t),a_("preconnect",e,t)}function hD(e,t,n){Oa.L(e,t,n);var r=_s;if(r&&e&&t){var a='link[rel="preload"][as="'+Kn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Kn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Kn(n.imageSizes)+'"]')):a+='[href="'+Kn(e)+'"]';var i=a;switch(t){case"style":i=Ho(e);break;case"script":i=Ts(e)}er.has(i)||(e=Ze({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),er.set(i,e),r.querySelector(a)!==null||t==="style"&&r.querySelector(rf(i))||t==="script"&&r.querySelector(af(i))||(t=r.createElement("link"),Ht(t,"link",e),Mt(t),r.head.appendChild(t)))}}function pD(e,t){Oa.m(e,t);var n=_s;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Kn(r)+'"][href="'+Kn(e)+'"]',i=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Ts(e)}if(!er.has(i)&&(e=Ze({rel:"modulepreload",href:e},t),er.set(i,e),n.querySelector(a)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(af(i)))return}r=n.createElement("link"),Ht(r,"link",e),Mt(r),n.head.appendChild(r)}}}function mD(e,t,n){Oa.S(e,t,n);var r=_s;if(r&&e){var a=po(r).hoistableStyles,i=Ho(e);t=t||"default";var l=a.get(i);if(!l){var s={loading:0,preload:null};if(l=r.querySelector(rf(i)))s.loading=5;else{e=Ze({rel:"stylesheet",href:e,"data-precedence":t},n),(n=er.get(i))&&e0(e,n);var c=l=r.createElement("link");Mt(c),Ht(c,"link",e),c._p=new Promise(function(u,f){c.onload=u,c.onerror=f}),c.addEventListener("load",function(){s.loading|=1}),c.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Nd(l,t,r)}l={type:"stylesheet",instance:l,count:1,state:s},a.set(i,l)}}}function yD(e,t){Oa.X(e,t);var n=_s;if(n&&e){var r=po(n).hoistableScripts,a=Ts(e),i=r.get(a);i||(i=n.querySelector(af(a)),i||(e=Ze({src:e,async:!0},t),(t=er.get(a))&&t0(e,t),i=n.createElement("script"),Mt(i),Ht(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}function vD(e,t){Oa.M(e,t);var n=_s;if(n&&e){var r=po(n).hoistableScripts,a=Ts(e),i=r.get(a);i||(i=n.querySelector(af(a)),i||(e=Ze({src:e,async:!0,type:"module"},t),(t=er.get(a))&&t0(e,t),i=n.createElement("script"),Mt(i),Ht(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}function tS(e,t,n,r){var a=(a=ri.current)?lh(a):null;if(!a)throw Error(F(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ho(n.href),n=po(a).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ho(n.href);var i=po(a).hoistableStyles,l=i.get(e);if(l||(a=a.ownerDocument||a,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,l),(i=a.querySelector(rf(e)))&&!i._p&&(l.instance=i,l.state.loading=5),er.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},er.set(e,n),i||gD(a,e,n,l.state))),t&&r===null)throw Error(F(528,""));return l}if(t&&r!==null)throw Error(F(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ts(n),n=po(a).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(F(444,e))}}function Ho(e){return'href="'+Kn(e)+'"'}function rf(e){return'link[rel="stylesheet"]['+e+"]"}function i_(e){return Ze({},e,{"data-precedence":e.precedence,precedence:null})}function gD(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Ht(t,"link",n),Mt(t),e.head.appendChild(t))}function Ts(e){return'[src="'+Kn(e)+'"]'}function af(e){return"script[async]"+e}function nS(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Kn(n.href)+'"]');if(r)return t.instance=r,Mt(r),r;var a=Ze({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Mt(r),Ht(r,"style",a),Nd(r,n.precedence,e),t.instance=r;case"stylesheet":a=Ho(n.href);var i=e.querySelector(rf(a));if(i)return t.state.loading|=4,t.instance=i,Mt(i),i;r=i_(n),(a=er.get(a))&&e0(r,a),i=(e.ownerDocument||e).createElement("link"),Mt(i);var l=i;return l._p=new Promise(function(s,c){l.onload=s,l.onerror=c}),Ht(i,"link",r),t.state.loading|=4,Nd(i,n.precedence,e),t.instance=i;case"script":return i=Ts(n.src),(a=e.querySelector(af(i)))?(t.instance=a,Mt(a),a):(r=n,(a=er.get(i))&&(r=Ze({},n),t0(r,a)),e=e.ownerDocument||e,a=e.createElement("script"),Mt(a),Ht(a,"link",r),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(F(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Nd(r,n.precedence,e));return t.instance}function Nd(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,i=a,l=0;l title"):null)}function xD(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function l_(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function bD(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=Ho(r.href),i=t.querySelector(rf(a));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=oh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Mt(i);return}i=t.ownerDocument||t,r=i_(r),(a=er.get(a))&&e0(r,a),i=i.createElement("link"),Mt(i);var l=i;l._p=new Promise(function(s,c){l.onload=s,l.onerror=c}),Ht(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=oh.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var $y=0;function jD(e,t){return e.stylesheets&&e.count===0&&Cd(e,e.stylesheets),0$y?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}function oh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cd(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sh=null;function Cd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sh=new Map,t.forEach(SD,e),sh=null,oh.call(e))}function SD(e,t){if(!(t.state.loading&4)){var n=sh.get(e);if(n)var r=n.get(null);else{n=new Map,sh.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(p_)}catch(e){console.error(e)}}p_(),SE.exports=wp;var TD=SE.exports;const PD=_e(TD);/** + * react-router v7.17.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var fS="popstate";function dS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function MD(e={}){function t(r,a){var u;let i=(u=a.state)==null?void 0:u.masked,{pathname:l,search:s,hash:c}=i||r.location;return mg("",{pathname:l,search:s,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:iu(a)}return RD(t,n,null,e)}function tt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function br(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function $D(){return Math.random().toString(36).substring(2,10)}function hS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function mg(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ps(t):t,state:n,key:t&&t.key||r||$D(),mask:a}}function iu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ps(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function RD(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,s="POP",c=null,u=f();u==null&&(u=0,l.replaceState({...l.state,idx:u},""));function f(){return(l.state||{idx:null}).idx}function d(){s="POP";let p=f(),y=p==null?null:p-u;u=p,c&&c({action:s,location:v.location,delta:y})}function h(p,y){s="PUSH";let g=dS(p)?p:mg(v.location,p,y);u=f()+1;let b=hS(g,u),x=v.createHref(g.mask||g);try{l.pushState(b,"",x)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;a.location.assign(x)}i&&c&&c({action:s,location:v.location,delta:1})}function m(p,y){s="REPLACE";let g=dS(p)?p:mg(v.location,p,y);u=f();let b=hS(g,u),x=v.createHref(g.mask||g);l.replaceState(b,"",x),i&&c&&c({action:s,location:v.location,delta:0})}function j(p){return kD(a,p)}let v={get action(){return s},get location(){return e(a,l)},listen(p){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(fS,d),c=p,()=>{a.removeEventListener(fS,d),c=null}},createHref(p){return t(a,p)},createURL:j,encodeLocation(p){let y=j(p);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:m,go(p){return l.go(p)}};return v}function kD(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),tt(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:iu(t);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function m_(e,t,n="/"){return DD(e,t,n,!1)}function DD(e,t,n,r,a){let i=typeof t=="string"?Ps(t):t,l=ba(i.pathname||"/",n);if(l==null)return null;let s=LD(e),c=null,u=XD(l);for(let f=0;c==null&&f{let f={relativePath:u===void 0?l.path||"":u,caseSensitive:l.caseSensitive===!0,childrenIndex:s,route:l};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;tt(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let d=mr([r,f.relativePath]),h=n.concat(f);l.children&&l.children.length>0&&(tt(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),y_(l.children,t,h,d,c)),!(l.path==null&&!l.index)&&t.push({path:d,score:GD(d,l.index),routesMeta:h})};return e.forEach((l,s)=>{var c;if(l.path===""||!((c=l.path)!=null&&c.includes("?")))i(l,s);else for(let u of v_(l.path))i(l,s,!0,u)}),t}function v_(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=v_(r.join("/")),s=[];return s.push(...l.map(c=>c===""?i:[i,c].join("/"))),a&&s.push(...l),s.map(c=>e.startsWith("/")&&c===""?"/":c)}function zD(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:KD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var BD=/^:[\w-]+$/,ID=3,UD=2,qD=1,HD=10,FD=-2,pS=e=>e==="*";function GD(e,t){let n=e.split("/"),r=n.length;return n.some(pS)&&(r+=FD),t&&(r+=UD),n.filter(a=>!pS(a)).reduce((a,i)=>a+(BD.test(i)?ID:i===""?qD:HD),r)}function KD(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function VD(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",l=[];for(let s=0;s{if(f==="*"){let j=s[h]||"";l=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const m=s[h];return d&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:l,pattern:e}}function YD(e,t=!1,n=!0){br(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,s,c,u,f)=>{if(r.push({paramName:s,isOptional:c!=null}),c){let d=f.charAt(u+l.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function XD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return br(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ba(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var QD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function WD(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Ps(e):e,i;return n?(n=g_(n),n.startsWith("/")?i=mS(n.substring(1),"/"):i=mS(n,t)):i=t,{pathname:i,search:e4(r),hash:t4(a)}}function mS(e,t){let n=dh(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Ry(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function ZD(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function l0(e){let t=ZD(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Up(e,t,n,r=!1){let a;typeof e=="string"?a=Ps(e):(a={...e},tt(!a.pathname||!a.pathname.includes("?"),Ry("?","pathname","search",a)),tt(!a.pathname||!a.pathname.includes("#"),Ry("#","pathname","hash",a)),tt(!a.search||!a.search.includes("#"),Ry("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,s;if(l==null)s=n;else{let d=t.length-1;if(!r&&l.startsWith("..")){let h=l.split("/");for(;h[0]==="..";)h.shift(),d-=1;a.pathname=h.join("/")}s=d>=0?t[d]:"/"}let c=WD(a,s),u=l&&l!=="/"&&l.endsWith("/"),f=(i||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}var g_=e=>e.replace(/\/\/+/g,"/"),mr=e=>g_(e.join("/")),dh=e=>e.replace(/\/+$/,""),JD=e=>dh(e).replace(/^\/*/,"/"),e4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,t4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,n4=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function r4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function a4(e){let t=e.map(n=>n.route.path).filter(Boolean);return mr(t)||"/"}var x_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function b_(e,t){let n=e;if(typeof n!="string"||!QD.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(x_)try{let i=new URL(window.location.href),l=n.startsWith("//")?new URL(i.protocol+n):new URL(n),s=ba(l.pathname,t);l.origin===i.origin&&s!=null?n=s+l.search+l.hash:a=!0}catch{br(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var j_=["POST","PUT","PATCH","DELETE"];new Set(j_);var i4=["GET",...j_];new Set(i4);var Ms=O.createContext(null);Ms.displayName="DataRouter";var qp=O.createContext(null);qp.displayName="DataRouterState";var S_=O.createContext(!1);function l4(){return O.useContext(S_)}var w_=O.createContext({isTransitioning:!1});w_.displayName="ViewTransition";var o4=O.createContext(new Map);o4.displayName="Fetchers";var s4=O.createContext(null);s4.displayName="Await";var kn=O.createContext(null);kn.displayName="Navigation";var lf=O.createContext(null);lf.displayName="Location";var Sr=O.createContext({outlet:null,matches:[],isDataRoute:!1});Sr.displayName="Route";var o0=O.createContext(null);o0.displayName="RouteError";var O_="REACT_ROUTER_ERROR",c4="REDIRECT",u4="ROUTE_ERROR_RESPONSE";function f4(e){if(e.startsWith(`${O_}:${c4}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function d4(e){if(e.startsWith(`${O_}:${u4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new n4(t.status,t.statusText,t.data)}catch{}}function h4(e,{relative:t}={}){tt($s(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=O.useContext(kn),{hash:a,pathname:i,search:l}=of(e,{relative:t}),s=i;return n!=="/"&&(s=i==="/"?n:mr([n,i])),r.createHref({pathname:s,search:l,hash:a})}function $s(){return O.useContext(lf)!=null}function Hr(){return tt($s(),"useLocation() may be used only in the context of a component."),O.useContext(lf).location}var A_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function N_(e){O.useContext(kn).static||O.useLayoutEffect(e)}function Hp(){let{isDataRoute:e}=O.useContext(Sr);return e?C4():p4()}function p4(){tt($s(),"useNavigate() may be used only in the context of a component.");let e=O.useContext(Ms),{basename:t,navigator:n}=O.useContext(kn),{matches:r}=O.useContext(Sr),{pathname:a}=Hr(),i=JSON.stringify(l0(r)),l=O.useRef(!1);return N_(()=>{l.current=!0}),O.useCallback((c,u={})=>{if(br(l.current,A_),!l.current)return;if(typeof c=="number"){n.go(c);return}let f=Up(c,JSON.parse(i),a,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:mr([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,i,a,e])}var m4=O.createContext(null);function y4(e){let t=O.useContext(Sr).outlet;return O.useMemo(()=>t&&O.createElement(m4.Provider,{value:e},t),[t,e])}function of(e,{relative:t}={}){let{matches:n}=O.useContext(Sr),{pathname:r}=Hr(),a=JSON.stringify(l0(n));return O.useMemo(()=>Up(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function v4(e,t){return E_(e,t)}function E_(e,t,n){var p;tt($s(),"useRoutes() may be used only in the context of a component.");let{navigator:r}=O.useContext(kn),{matches:a}=O.useContext(Sr),i=a[a.length-1],l=i?i.params:{},s=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let y=u&&u.path||"";__(s,!u||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let f=Hr(),d;if(t){let y=typeof t=="string"?Ps(t):t;tt(c==="/"||((p=y.pathname)==null?void 0:p.startsWith(c)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${y.pathname}" was given in the \`location\` prop.`),d=y}else d=f;let h=d.pathname||"/",m=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let j=n&&n.state.matches.length?n.state.matches.map(y=>Object.assign(y,{route:n.manifest[y.route.id]||y.route})):m_(e,{pathname:m});br(u||j!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),br(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let v=S4(j&&j.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:mr([c,r.encodeLocation?r.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:mr([c,r.encodeLocation?r.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),a,n);return t&&v?O.createElement(lf.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},v):v}function g4(){let e=E4(),t=r4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=O.createElement(O.Fragment,null,O.createElement("p",null,"💿 Hey developer 👋"),O.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",O.createElement("code",{style:i},"ErrorBoundary")," or"," ",O.createElement("code",{style:i},"errorElement")," prop on your route.")),O.createElement(O.Fragment,null,O.createElement("h2",null,"Unexpected Application Error!"),O.createElement("h3",{style:{fontStyle:"italic"}},t),n?O.createElement("pre",{style:a},n):null,l)}var x4=O.createElement(g4,null),C_=class extends O.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=d4(e.digest);n&&(e=n)}let t=e!==void 0?O.createElement(Sr.Provider,{value:this.props.routeContext},O.createElement(o0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?O.createElement(b4,{error:e},t):t}};C_.contextType=S_;var ky=new WeakMap;function b4({children:e,error:t}){let{basename:n}=O.useContext(kn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=f4(t.digest);if(r){let a=ky.get(t);if(a)throw a;let i=b_(r.location,n);if(x_&&!ky.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw ky.set(t,l),l}return O.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function j4({routeContext:e,match:t,children:n}){let r=O.useContext(Ms);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(Sr.Provider,{value:e},n)}function S4(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let f=a.findIndex(d=>d.route.id&&(i==null?void 0:i[d.route.id])!==void 0);tt(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let l=!1,s=-1;if(n&&r){l=r.renderFallback;for(let f=0;f=0?a=a.slice(0,s+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(f,d)=>{var h,m;c(f,{location:r.location,params:((m=(h=r.matches)==null?void 0:h[0])==null?void 0:m.params)??{},pattern:a4(r.matches),errorInfo:d})}:void 0;return a.reduceRight((f,d,h)=>{let m,j=!1,v=null,p=null;r&&(m=i&&d.route.id?i[d.route.id]:void 0,v=d.route.errorElement||x4,l&&(s<0&&h===0?(__("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,p=null):s===h&&(j=!0,p=d.route.hydrateFallbackElement||null)));let y=t.concat(a.slice(0,h+1)),g=()=>{let b;return m?b=v:j?b=p:d.route.Component?b=O.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=f,O.createElement(j4,{match:d,routeContext:{outlet:f,matches:y,isDataRoute:r!=null},children:b})};return r&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?O.createElement(C_,{location:r.location,revalidation:r.revalidation,component:v,error:m,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:u}):g()},null)}function s0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function w4(e){let t=O.useContext(Ms);return tt(t,s0(e)),t}function O4(e){let t=O.useContext(qp);return tt(t,s0(e)),t}function A4(e){let t=O.useContext(Sr);return tt(t,s0(e)),t}function c0(e){let t=A4(e),n=t.matches[t.matches.length-1];return tt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function N4(){return c0("useRouteId")}function E4(){var r;let e=O.useContext(o0),t=O4("useRouteError"),n=c0("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function C4(){let{router:e}=w4("useNavigate"),t=c0("useNavigate"),n=O.useRef(!1);return N_(()=>{n.current=!0}),O.useCallback(async(a,i={})=>{br(n.current,A_),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var yS={};function __(e,t,n){!t&&!yS[e]&&(yS[e]=!0,br(!1,n))}O.memo(_4);function _4({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return E_(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function T_({to:e,replace:t,state:n,relative:r}){tt($s()," may be used only in the context of a component.");let{static:a}=O.useContext(kn);br(!a," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:i}=O.useContext(Sr),{pathname:l}=Hr(),s=Hp(),c=Up(e,l0(i),l,r==="path"),u=JSON.stringify(c);return O.useEffect(()=>{s(JSON.parse(u),{replace:t,state:n,relative:r})},[s,u,r,t,n]),null}function T4(e){return y4(e.context)}function Oe(e){tt(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function P4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:l}){tt(!$s(),"You cannot render a inside another . You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),c=O.useMemo(()=>({basename:s,navigator:a,static:i,useTransitions:l,future:{}}),[s,a,i,l]);typeof n=="string"&&(n=Ps(n));let{pathname:u="/",search:f="",hash:d="",state:h=null,key:m="default",mask:j}=n,v=O.useMemo(()=>{let p=ba(u,s);return p==null?null:{location:{pathname:p,search:f,hash:d,state:h,key:m,mask:j},navigationType:r}},[s,u,f,d,h,m,r,j]);return br(v!=null,` is not able to match the URL "${u}${f}${d}" because it does not start with the basename, so the won't render anything.`),v==null?null:O.createElement(kn.Provider,{value:c},O.createElement(lf.Provider,{children:t,value:v}))}function M4({children:e,location:t}){return v4(yg(e),t)}function yg(e,t=[]){let n=[];return O.Children.forEach(e,(r,a)=>{if(!O.isValidElement(r))return;let i=[...t,a];if(r.type===O.Fragment){n.push.apply(n,yg(r.props.children,i));return}tt(r.type===Oe,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),tt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=yg(r.props.children,i)),n.push(l)}),n}var Td="get",Pd="application/x-www-form-urlencoded";function Fp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $4(e){return Fp(e)&&e.tagName.toLowerCase()==="button"}function R4(e){return Fp(e)&&e.tagName.toLowerCase()==="form"}function k4(e){return Fp(e)&&e.tagName.toLowerCase()==="input"}function D4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function L4(e,t){return e.button===0&&(!t||t==="_self")&&!D4(e)}var Hf=null;function z4(){if(Hf===null)try{new FormData(document.createElement("form"),0),Hf=!1}catch{Hf=!0}return Hf}var B4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Dy(e){return e!=null&&!B4.has(e)?(br(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Pd}"`),null):e}function I4(e,t){let n,r,a,i,l;if(R4(e)){let s=e.getAttribute("action");r=s?ba(s,t):null,n=e.getAttribute("method")||Td,a=Dy(e.getAttribute("enctype"))||Pd,i=new FormData(e)}else if($4(e)||k4(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index de88ba9..2580a44 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -5,11 +5,9 @@ import { Gauge, Network, CalendarRange, PackagePlus, Truck, Boxes, ClipboardCheck, Barcode, ScanSearch, Ruler, AlertTriangle, ListChecks, LineChart, FileBadge, Package, ListTree, Route as RouteIcon, Building2, Warehouse, BarChart3, Sparkles, ShieldCheck, ScrollText, - Settings, Cpu, NotebookPen, CalendarDays, Mail, PieChart, Smartphone, - KeyRound, ShieldHalf, ListTodo, Menu as MenuIcon, Users2, Contact, + Settings, Cpu, } from 'lucide-react' import { currentRole, hasRole } from './rbac' -import ThemeToggle from './uiws/ThemeToggle' interface Link { to: string; label: string; icon: any; min?: string } @@ -50,35 +48,13 @@ const masterLinks: Link[] = [ ] const commonLinks: Link[] = [ { to: '/analytics', label: '분석 / KPI', icon: BarChart3 }, - { to: '/ai-tools', label: 'WISE AI', icon: Sparkles }, - { to: '/ai-techniques', label: 'AI 기법 설정', icon: Cpu, min: 'MANAGER' }, -] -// 업무 (UIWS 이식) — 업무일지/일정/쪽지/업무통계 -const uiwsLinks: Link[] = [ - { to: '/uiws/worklog', label: '업무일지', icon: NotebookPen }, - { to: '/uiws/schedule', label: '일정', icon: CalendarDays }, - { to: '/uiws/message', label: '쪽지', icon: Mail }, - { to: '/uiws/stats', label: '업무통계', icon: PieChart }, -] -// 시스템관리(권한) (UIWS 이식) — SUPERADMIN 전용 -const sysLinks: Link[] = [ - { to: '/uiws/system/roles', label: '권한 관리', icon: KeyRound, min: 'SUPERADMIN' }, - { to: '/uiws/system/role-menus', label: '역할-메뉴 권한', icon: ShieldHalf, min: 'SUPERADMIN' }, - { to: '/uiws/system/codes', label: '공통코드', icon: ListTodo, min: 'SUPERADMIN' }, - { to: '/uiws/system/menus', label: '메뉴 관리', icon: MenuIcon, min: 'SUPERADMIN' }, - { to: '/uiws/system/depts', label: '부서 관리', icon: Users2, min: 'SUPERADMIN' }, - { to: '/uiws/system/companies', label: '거래처 관리', icon: Contact, min: 'SUPERADMIN' }, + { to: '/ai-tools', label: 'AI 도구', icon: Sparkles }, ] const adminLinks: Link[] = [ { to: '/admin/users', label: '사용자/권한', icon: ShieldCheck, min: 'SUPERADMIN' }, - { to: '/admin/ai-platform', label: 'AI 플랫폼 설정', icon: Cpu, min: 'SUPERADMIN' }, { to: '/admin/audit', label: '감사 로그', icon: ScrollText, min: 'MANAGER' }, { to: '/admin/settings', label: '시스템 설정', icon: Settings, min: 'MANAGER' }, ] -// 통합 메신저 앱(읽기전용 QR 설치) — 인증 사용자 전체 -const mobileLinks: Link[] = [ - { to: '/admin/mobile-app', label: '모바일 앱 설치', icon: Smartphone }, -] const linkClass = ({ isActive }: { isActive: boolean }) => `flex items-center gap-3 px-5 py-1.5 text-sm transition-colors ${ @@ -117,7 +93,6 @@ export default function Sidebar() { return () => { window.clearInterval(t); window.removeEventListener('storage', sync) } }, []) - const visibleSys = sysLinks.filter(l => hasRole(l.min || 'VIEWER', role)) const visibleAdmin = adminLinks.filter(l => hasRole(l.min || 'VIEWER', role)) return ( @@ -136,25 +111,13 @@ export default function Sidebar() {
-
-
-
-
- {visibleSys.length > 0 && ( -
-
-
- )} {visibleAdmin.length > 0 && (
)} -
- -
-
+
Ollama 온프레미스 · WMS·MES·QMS 통합
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 303352d..4a1b150 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -2,13 +2,9 @@ import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' import './index.css' -import './theme/theme.css' -import { ThemeProvider } from './theme/ThemeContext' ReactDOM.createRoot(document.getElementById('root')!).render( - - - + ) diff --git a/frontend/src/pages/AiTools.tsx b/frontend/src/pages/AiTools.tsx index 8176a62..85a769f 100644 --- a/frontend/src/pages/AiTools.tsx +++ b/frontend/src/pages/AiTools.tsx @@ -1,117 +1,13 @@ import { useEffect, useState } from 'react' -import { Link } from 'react-router-dom' import { Sparkles, AlertTriangle, TrendingUp, Wrench, LineChart, Search, Boxes, CalendarClock, - Cpu, ThumbsUp, ThumbsDown, Quote, } from 'lucide-react' import { Card, Btn, Field } from '../components/ui' import { getAiStatus, aiDefectRootCause, aiForecast, aiPredictiveMaintenance, aiSpcAnomaly, aiParseQuery, aiSafetyStock, aiScheduleOptimize, - ragDefectAnalysis, ragPredictAnalysis, ragFeedback, postAiFeedback, } from '../api/client' -/** 적용된 기법 배지 — 응답의 applied metadata 를 시각화(토글 effect 관측). */ -function AppliedBadge({ data }: { data: any }) { - const a = data?.applied - if (!a) return null - const chips: string[] = [`mode:${a.retrievalMode}`, `기법:${a.technique}`] - if (a.rerank) chips.push('rerank') - if (a.graphrag) chips.push('graphrag') - if (a.hybrid) chips.push('hybrid') - if (a.toolUse) chips.push(`agent(${a.maxSteps})`) - if (a.structured) chips.push('structured') - if (a.stream) chips.push('stream') - if (data?.degraded) chips.push('⚠ degraded(폴백)') - return ( -
- {chips.map((c, i) => ( - {c} - ))} -
- ) -} - -/** 👍/👎 피드백 (중앙 /rag/feedback, solution=mes 격리). answerId 가 있을 때만 노출. */ -function FeedbackBar({ answerId, query }: { answerId?: string; query?: string }) { - const [done, setDone] = useState('') - if (!answerId) return null - const send = async (verdict: 'up' | 'down') => { - try { await ragFeedback({ answerId, query, verdict }); setDone(verdict === 'up' ? '👍 반영됨' : '👎 반영됨') } catch { setDone('전송 실패') } - } - return ( -
- 이 답변이 도움이 됐나요? - - - {done && {done}} -
- ) -} - -/** 👍/👎 로컬 학습 피드백 (POST /api/ai/feedback → 로컬 DuckDB + 중앙 rag). 결과가 있을 때만 노출. */ -function LocalFeedbackBar({ feature, question, answer }: { feature: string; question?: string; answer?: any }) { - const [done, setDone] = useState('') - if (answer == null) return null - const ans = typeof answer === 'string' ? answer : JSON.stringify(answer) - const send = async (verdict: 'up' | 'down') => { - try { await postAiFeedback({ feature, question, answer: ans, verdict }); setDone(verdict === 'up' ? '👍 반영됨' : '👎 반영됨') } - catch { setDone('전송 실패') } - } - return ( -
- 이 결과가 도움이 됐나요? - - - {done && {done}} -
- ) -} - -/** 인용 라벨 — 문서명·위치·근거지지도. citation/source 객체 형태 방어적 처리. */ -function citeLabel(c: any): string { - if (c == null) return '문서' - if (typeof c === 'string') return c - const src = c.source || c.document || c.doc || c.title || c.chunk_id || c.id || '문서' - const loc = c.page != null ? ` p.${c.page}` : (c.location ? ` ${c.location}` : '') - const sup = c.support != null ? ` · ${Math.round(Number(c.support) * 100)}%` : '' - return `${src}${loc}${sup}` -} - -/** - * WISE 근거 UX — 인용 카드(sources/citations) + 환각차단(abstained) 배지. - * node = 응답의 defect / interpretation 서브객체. 근거·보류 정보가 있을 때만 노출. - */ -function WiseEvidence({ node }: { node: any }) { - if (node == null) return null - const citations: any[] = Array.isArray(node.citations) ? node.citations : [] - const sources: any[] = Array.isArray(node.sources) ? node.sources : [] - const items = citations.length ? citations : sources - const abstained = node.abstained === true - if (!abstained && items.length === 0) return null - return ( -
- {abstained && ( -
- 근거가 부족해 답변을 보류했습니다 (오류 아님 · 안내) -
- )} - {items.length > 0 ? ( - <> -
근거 인용 ({items.length})
-
- {items.map((c, i) => ( - {citeLabel(c)} - ))} -
- - ) : ( -
근거 문서 없음
- )} -
- ) -} - function Output({ data }: { data: any }) { if (data == null) return null if (typeof data === 'string') return
{data}
@@ -126,8 +22,8 @@ export default function AiTools() {
-

WISE AI

-

Enterprise AI for Trusted Knowledge · 근거·인용·환각차단(중앙 guardia-rag) + 불량분석·생산예측·예지보전·SPC이상 (Ollama 온프레미스 + Java 폴백)

+

AI 도구

+

불량분석 · 생산예측 · 예지보전 · SPC이상 · 자연어조회 · 안전재고 · 일정최적화 (Ollama 온프레미스 + Java 폴백)

@@ -135,17 +31,6 @@ export default function AiTools() {
- {/* ── 최신 기법 (중앙 guardia-rag 경유) — 대표 2개 기능 ───────────── */} -
-

WISE AI · 근거 기반 분석 (RAG · 에이전틱 · 구조화)

- 기법 토글 설정 → -
-
- -
- - {/* ── 기존 AI 도구 (불변, Ollama + Java 폴백) ───────────────────── */} -

기본 AI 도구

@@ -154,87 +39,6 @@ export default function AiTools() { ) } -/** 대표 1: 불량 원인분석 + SPC 이상감지 (SPC 수치=결정론, 원인서술=/rag/agent+structured). */ -function RagDefectTool() { - const [code, setCode] = useState(''); const [ctx, setCtx] = useState('') - const [values, setValues] = useState(''); const [ucl, setUcl] = useState(''); const [lcl, setLcl] = useState(''); const [cl, setCl] = useState('') - const [out, setOut] = useState(null); const [busy, setBusy] = useState(false) - const run = async () => { - setBusy(true) - try { - const vals = values.split(',').map(s => s.trim()).filter(Boolean).map(Number) - const req: any = { defectCode: code, context: ctx ? [{ note: ctx }] : [] } - if (vals.length) { req.values = vals; req.ucl = Number(ucl) || 0; req.lcl = Number(lcl) || 0; req.cl = Number(cl) || 0 } - setOut(await ragDefectAnalysis(req)) - } finally { setBusy(false) } - } - return ( - }> - setCode(e.target.value)} placeholder="예: D-DIM-01" /> -