From e418e6ecc210b9e219fba366ed42b87a14f79637 Mon Sep 17 00:00:00 2001 From: liumangmang Date: Thu, 11 Jun 2026 14:10:30 +0800 Subject: [PATCH] feat: add port forwarding and optimize connection status checks --- backend/pom.xml | 58 ++-- .../config/WebSocketThreadPoolConfig.java | 12 - .../controller/PortForwardController.java | 163 ++++++++++ .../controller/TerminalWebSocketHandler.java | 38 +++ .../service/ConnectionStatusService.java | 102 ++++-- .../service/PortForwardRegistry.java | 176 +++++++++++ .../service/QuickConnectionRegistry.java | 71 ++++- .../com/sshmanager/service/RealTcpProbe.java | 27 ++ .../sshmanager/service/SshSessionFactory.java | 24 ++ .../java/com/sshmanager/service/TcpProbe.java | 12 + backend/src/main/resources/application.yml | 9 + ...-BQqMAlQh.js => DashboardPage-8WtAnohf.js} | 2 +- .../{Modal-DTj05goU.js => Modal-B96Ao-J_.js} | 2 +- ...rodx.js => UserManagementPage-3xCLOZtk.js} | 2 +- ...-B8Ud6Ns4.js => WorkspacePage-cbzo-ogN.js} | 20 +- .../static/assets/index-B4Duc4SL.css | 1 - .../{index-Z2D8CQl5.js => index-BQbRYAGj.js} | 4 +- .../static/assets/index-CPovcnGC.css | 1 + ...onitor-D01QXMh7.js => monitor-BOliCSBz.js} | 2 +- backend/src/main/resources/static/index.html | 4 +- .../controller/PortForwardControllerTest.java | 204 ++++++++++++ .../TerminalWebSocketHandlerTest.java | 50 +++ .../service/ConnectionStatusServiceTest.java | 140 +++++++-- .../service/PortForwardRegistryTest.java | 191 ++++++++++++ .../service/QuickConnectionRegistryTest.java | 137 ++++++++ docker/Dockerfile | 4 +- frontend/public/ssh-manager.svg | 109 +++++-- frontend/src/components/PortForwardModal.tsx | 293 ++++++++++++++++++ frontend/src/pages/WorkspacePage.tsx | 38 ++- frontend/src/services/portForwards.ts | 43 +++ 30 files changed, 1789 insertions(+), 150 deletions(-) create mode 100644 backend/src/main/java/com/sshmanager/controller/PortForwardController.java create mode 100644 backend/src/main/java/com/sshmanager/service/PortForwardRegistry.java create mode 100644 backend/src/main/java/com/sshmanager/service/RealTcpProbe.java create mode 100644 backend/src/main/java/com/sshmanager/service/SshSessionFactory.java create mode 100644 backend/src/main/java/com/sshmanager/service/TcpProbe.java rename backend/src/main/resources/static/assets/{DashboardPage-BQqMAlQh.js => DashboardPage-8WtAnohf.js} (98%) rename backend/src/main/resources/static/assets/{Modal-DTj05goU.js => Modal-B96Ao-J_.js} (96%) rename backend/src/main/resources/static/assets/{UserManagementPage-CpLFrodx.js => UserManagementPage-3xCLOZtk.js} (99%) rename backend/src/main/resources/static/assets/{WorkspacePage-B8Ud6Ns4.js => WorkspacePage-cbzo-ogN.js} (52%) delete mode 100644 backend/src/main/resources/static/assets/index-B4Duc4SL.css rename backend/src/main/resources/static/assets/{index-Z2D8CQl5.js => index-BQbRYAGj.js} (99%) create mode 100644 backend/src/main/resources/static/assets/index-CPovcnGC.css rename backend/src/main/resources/static/assets/{monitor-D01QXMh7.js => monitor-BOliCSBz.js} (95%) create mode 100644 backend/src/test/java/com/sshmanager/controller/PortForwardControllerTest.java create mode 100644 backend/src/test/java/com/sshmanager/service/PortForwardRegistryTest.java create mode 100644 backend/src/test/java/com/sshmanager/service/QuickConnectionRegistryTest.java create mode 100644 frontend/src/components/PortForwardModal.tsx create mode 100644 frontend/src/services/portForwards.ts diff --git a/backend/pom.xml b/backend/pom.xml index 7fb0e71..b84bde7 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -53,35 +53,35 @@ jjwt-api 0.11.5 - - io.jsonwebtoken - jjwt-impl - 0.11.5 - runtime - - - io.jsonwebtoken - jjwt-jackson - 0.11.5 - runtime - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.security - spring-security-test - test - - - + + io.jsonwebtoken + jjwt-impl + 0.11.5 + runtime + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + diff --git a/backend/src/main/java/com/sshmanager/config/WebSocketThreadPoolConfig.java b/backend/src/main/java/com/sshmanager/config/WebSocketThreadPoolConfig.java index a433e7a..607f039 100644 --- a/backend/src/main/java/com/sshmanager/config/WebSocketThreadPoolConfig.java +++ b/backend/src/main/java/com/sshmanager/config/WebSocketThreadPoolConfig.java @@ -5,9 +5,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -35,14 +33,4 @@ public class WebSocketThreadPoolConfig { ); return executor; } - - @Bean - public ScheduledExecutorService websocketCleanupScheduler() { - ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - scheduler.scheduleAtFixedRate(this::cleanupIdleSessions, 30, 30, TimeUnit.MINUTES); - return scheduler; - } - - private void cleanupIdleSessions() { - } } diff --git a/backend/src/main/java/com/sshmanager/controller/PortForwardController.java b/backend/src/main/java/com/sshmanager/controller/PortForwardController.java new file mode 100644 index 0000000..07a4d68 --- /dev/null +++ b/backend/src/main/java/com/sshmanager/controller/PortForwardController.java @@ -0,0 +1,163 @@ +package com.sshmanager.controller; + +import com.sshmanager.entity.Connection; +import com.sshmanager.entity.User; +import com.sshmanager.exception.AccessDeniedException; +import com.sshmanager.exception.NotFoundException; +import com.sshmanager.repository.ConnectionRepository; +import com.sshmanager.repository.UserRepository; +import com.sshmanager.service.ConnectionService; +import com.sshmanager.service.PortForwardRegistry; +import com.sshmanager.service.PortForwardRegistry.TunnelEntry; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; +import org.springframework.web.bind.annotation.*; + +import java.time.Instant; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * REST API for managing in-memory SSH port-forwarding tunnels. + * + *
    + *
  • GET /api/port-forwards – list running tunnels for the current user
  • + *
  • POST /api/port-forwards – create a new tunnel
  • + *
  • DELETE /api/port-forwards/{id} – stop a tunnel
  • + *
+ * + *

All tunnels are ephemeral: they live only while the server is running. + */ +@RestController +@RequestMapping("/api/port-forwards") +public class PortForwardController { + + private final PortForwardRegistry portForwardRegistry; + private final ConnectionRepository connectionRepository; + private final ConnectionService connectionService; + private final UserRepository userRepository; + + public PortForwardController(PortForwardRegistry portForwardRegistry, + ConnectionRepository connectionRepository, + ConnectionService connectionService, + UserRepository userRepository) { + this.portForwardRegistry = portForwardRegistry; + this.connectionRepository = connectionRepository; + this.connectionService = connectionService; + this.userRepository = userRepository; + } + + // ── helpers ─────────────────────────────────────────────────────────────── + + private Long getCurrentUserId(Authentication auth) { + User user = userRepository.findByUsername(auth.getName()) + .orElseThrow(() -> new IllegalStateException("User not found")); + return user.getId(); + } + + private static Map toDto(TunnelEntry e) { + Map dto = new HashMap<>(); + dto.put("id", e.getId()); + dto.put("connectionId", e.getConnectionId()); + dto.put("connectionName", e.getConnectionName()); + dto.put("localPort", e.getLocalPort()); + dto.put("remoteHost", e.getRemoteHost()); + dto.put("remotePort", e.getRemotePort()); + dto.put("status", e.getStatus().name().toLowerCase()); + dto.put("createdAt", e.getCreatedAt().toString()); + return dto; + } + + // ── endpoints ───────────────────────────────────────────────────────────── + + /** GET /api/port-forwards — list active tunnels for the authenticated user. */ + @GetMapping + public ResponseEntity>> list(Authentication auth) { + Long userId = getCurrentUserId(auth); + List> dtos = portForwardRegistry.listByUser(userId).stream() + .map(PortForwardController::toDto) + .collect(Collectors.toList()); + return ResponseEntity.ok(dtos); + } + + /** + * POST /api/port-forwards — create a new port-forwarding tunnel. + * + *

Expected request body: + *

+     * {
+     *   "connectionId": 42,
+     *   "localPort":    8080,
+     *   "remoteHost":   "127.0.0.1",
+     *   "remotePort":   3306
+     * }
+     * 
+ */ + @PostMapping + public ResponseEntity create(@RequestBody Map body, Authentication auth) { + Long userId = getCurrentUserId(auth); + + // ── parse & validate request ────────────────────────────────────────── + Long connectionId; + int localPort, remotePort; + String remoteHost; + try { + connectionId = Long.valueOf(body.get("connectionId").toString()); + localPort = Integer.parseInt(body.get("localPort").toString()); + remotePort = Integer.parseInt(body.get("remotePort").toString()); + remoteHost = body.get("remoteHost").toString().trim(); + } catch (Exception e) { + Map err = new HashMap<>(); + err.put("error", "Invalid request body: connectionId, localPort, remoteHost and remotePort are required"); + return ResponseEntity.badRequest().body(err); + } + + // ── ownership check ─────────────────────────────────────────────────── + Connection conn = connectionRepository.findById(connectionId).orElse(null); + if (conn == null) { + throw new NotFoundException("Connection not found: " + connectionId); + } + if (!conn.getUserId().equals(userId)) { + throw new AccessDeniedException("Access denied to connection: " + connectionId); + } + + // ── decrypt credentials ─────────────────────────────────────────────── + String password = connectionService.getDecryptedPassword(conn); + String privateKey = connectionService.getDecryptedPrivateKey(conn); + String passphrase = connectionService.getDecryptedPassphrase(conn); + + // ── create tunnel ───────────────────────────────────────────────────── + try { + TunnelEntry entry = portForwardRegistry.create( + userId, conn, password, privateKey, passphrase, + localPort, remoteHost, remotePort); + return ResponseEntity.ok(toDto(entry)); + } catch (IllegalArgumentException e) { + Map err = new HashMap<>(); + err.put("error", e.getMessage()); + return ResponseEntity.badRequest().body(err); + } catch (Exception e) { + Map err = new HashMap<>(); + err.put("error", "Failed to create port-forward: " + e.getMessage()); + return ResponseEntity.internalServerError().body(err); + } + } + + /** DELETE /api/port-forwards/{id} — stop and remove a tunnel. */ + @DeleteMapping("/{id}") + public ResponseEntity> stop(@PathVariable String id, Authentication auth) { + Long userId = getCurrentUserId(auth); + try { + portForwardRegistry.stop(id, userId); + Map ok = new HashMap<>(); + ok.put("message", "Tunnel stopped"); + return ResponseEntity.ok(ok); + } catch (IllegalArgumentException e) { + Map err = new HashMap<>(); + err.put("error", e.getMessage()); + return ResponseEntity.badRequest().body(err); + } + } +} diff --git a/backend/src/main/java/com/sshmanager/controller/TerminalWebSocketHandler.java b/backend/src/main/java/com/sshmanager/controller/TerminalWebSocketHandler.java index 1ec433b..0f41c27 100644 --- a/backend/src/main/java/com/sshmanager/controller/TerminalWebSocketHandler.java +++ b/backend/src/main/java/com/sshmanager/controller/TerminalWebSocketHandler.java @@ -9,6 +9,8 @@ import com.sshmanager.service.QuickConnectionRegistry; import com.sshmanager.service.QuickCredentialRegistry; import com.sshmanager.service.SshService; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; @@ -34,7 +36,11 @@ public class TerminalWebSocketHandler extends TextWebSocketHandler { private final QuickCredentialRegistry quickCredentials; private final ExecutorService executor; + @Value("${sshmanager.terminal.idle-timeout-minutes:30}") + private long idleTimeoutMinutes; + private final AtomicInteger sessionCount = new AtomicInteger(0); + private final Map wsSessions = new ConcurrentHashMap<>(); private final Map sessions = new ConcurrentHashMap<>(); private final Map lastActivity = new ConcurrentHashMap<>(); @@ -100,9 +106,15 @@ public class TerminalWebSocketHandler extends TextWebSocketHandler { try { SshService.SshSession sshSession = sshService.createShellSession(conn, password, privateKey, passphrase); sessions.put(webSocketSession.getId(), sshSession); + wsSessions.put(webSocketSession.getId(), webSocketSession); lastActivity.put(webSocketSession.getId(), System.currentTimeMillis()); sessionCount.incrementAndGet(); + // Refresh the quick-connection TTL so an active terminal is not evicted mid-session + if (quickConnections.get(connectionId) != null) { + quickConnections.touch(connectionId); + } + executor.submit(() -> { try { InputStream in = sshSession.getOutputStream(); @@ -132,6 +144,12 @@ public class TerminalWebSocketHandler extends TextWebSocketHandler { if (sshSession != null && sshSession.isConnected()) { lastActivity.put(webSocketSession.getId(), System.currentTimeMillis()); + // Touch the quick connection registry to keep metadata alive + Long connectionId = (Long) webSocketSession.getAttributes().get("connectionId"); + if (connectionId != null) { + quickConnections.touch(connectionId); + } + String payload = message.getPayload(); TerminalControlMessage.parse(payload).ifPresent(ctrl -> { if ("resize".equals(ctrl.getType()) && ctrl.getCols() != null && ctrl.getRows() != null) { @@ -151,6 +169,7 @@ public class TerminalWebSocketHandler extends TextWebSocketHandler { public void afterConnectionClosed(@NonNull WebSocketSession webSocketSession, @NonNull CloseStatus status) throws Exception { SshService.SshSession sshSession = sessions.remove(webSocketSession.getId()); lastActivity.remove(webSocketSession.getId()); + wsSessions.remove(webSocketSession.getId()); if (sshSession != null) { sshSession.disconnect(); sessionCount.decrementAndGet(); @@ -165,4 +184,23 @@ public class TerminalWebSocketHandler extends TextWebSocketHandler { } } } + + @Scheduled(fixedDelay = 60000) + public void cleanupIdleSessions() { + long now = System.currentTimeMillis(); + long maxIdleMillis = idleTimeoutMinutes * 60_000L; + lastActivity.forEach((sessionId, lastTime) -> { + if (now - lastTime > maxIdleMillis) { + WebSocketSession ws = wsSessions.get(sessionId); + if (ws != null && ws.isOpen()) { + try { + ws.sendMessage(new TextMessage("\r\n[Session idle timeout closed]\r\n")); + ws.close(CloseStatus.GOING_AWAY); + } catch (IOException e) { + // ignore + } + } + } + }); + } } diff --git a/backend/src/main/java/com/sshmanager/service/ConnectionStatusService.java b/backend/src/main/java/com/sshmanager/service/ConnectionStatusService.java index e16a0c1..5163361 100644 --- a/backend/src/main/java/com/sshmanager/service/ConnectionStatusService.java +++ b/backend/src/main/java/com/sshmanager/service/ConnectionStatusService.java @@ -4,18 +4,43 @@ import com.sshmanager.dto.ConnectionStatusCheckRequest; import com.sshmanager.dto.ConnectionStatusItemDto; import com.sshmanager.dto.ConnectionStatusResponseDto; import com.sshmanager.entity.Connection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PreDestroy; @Service public class ConnectionStatusService { - private final ConnectionService connectionService; + private static final Logger log = LoggerFactory.getLogger(ConnectionStatusService.class); + private static final int MAX_CONCURRENCY = 20; + private static final int PROBE_TIMEOUT_SECONDS = 5; - public ConnectionStatusService(ConnectionService connectionService) { + private final ConnectionService connectionService; + private final TcpProbe tcpProbe; + private final ExecutorService executor; + + public ConnectionStatusService(ConnectionService connectionService, TcpProbe tcpProbe) { this.connectionService = connectionService; + this.tcpProbe = tcpProbe; + this.executor = Executors.newFixedThreadPool(MAX_CONCURRENCY, r -> { + Thread t = new Thread(r, "status-probe-" + r.hashCode()); + t.setDaemon(true); + return t; + }); + } + + @PreDestroy + public void shutdown() { + executor.shutdownNow(); } public ConnectionStatusResponseDto checkStatuses(Long userId, ConnectionStatusCheckRequest request) { @@ -23,39 +48,28 @@ public class ConnectionStatusService { throw new IllegalArgumentException("At least one connection is required"); } - List results = new ArrayList(); + // Execute all probes in parallel with a bounded thread pool + List> futures = new ArrayList<>(); + for (Long connectionId : request.getConnectionIds()) { + futures.add(CompletableFuture.supplyAsync(() -> probeConnection(connectionId, userId), executor)); + } + + List results = new ArrayList<>(); int onlineCount = 0; int offlineCount = 0; - for (Long connectionId : request.getConnectionIds()) { - Connection connection = connectionService.getConnectionForSsh(connectionId, userId); - long startedAt = System.currentTimeMillis(); + for (CompletableFuture future : futures) { try { - connectionService.testConnection( - connection, - connectionService.getDecryptedPassword(connection), - connectionService.getDecryptedPrivateKey(connection), - connectionService.getDecryptedPassphrase(connection) - ); - long durationMs = System.currentTimeMillis() - startedAt; - results.add(new ConnectionStatusItemDto( - connection.getId(), - connection.getName(), - "online", - "SSH connection available", - durationMs - )); - onlineCount += 1; - } catch (Exception error) { - long durationMs = System.currentTimeMillis() - startedAt; - results.add(new ConnectionStatusItemDto( - connection.getId(), - connection.getName(), - "offline", - error.getMessage(), - durationMs - )); - offlineCount += 1; + ConnectionStatusItemDto result = future.get(PROBE_TIMEOUT_SECONDS * 2, TimeUnit.SECONDS); + results.add(result); + if ("online".equals(result.getStatus())) { + onlineCount++; + } else { + offlineCount++; + } + } catch (Exception e) { + results.add(new ConnectionStatusItemDto(0L, null, "offline", "Probe timeout", 0)); + offlineCount++; } } @@ -66,4 +80,30 @@ public class ConnectionStatusService { response.setResults(results); return response; } + + private ConnectionStatusItemDto probeConnection(Long connectionId, Long userId) { + long startedAt = System.currentTimeMillis(); + try { + Connection connection = connectionService.getConnectionForSsh(connectionId, userId); + // Quick TCP probe — no SSH handshake, just checks port liveness + tcpProbe.checkReachable(connection, PROBE_TIMEOUT_SECONDS); + long durationMs = System.currentTimeMillis() - startedAt; + return new ConnectionStatusItemDto( + connection.getId(), connection.getName(), + "online", "TCP port reachable", durationMs + ); + } catch (Exception error) { + long durationMs = System.currentTimeMillis() - startedAt; + Long id = connectionId; + String name = null; + try { + Connection conn = connectionService.getConnectionForSsh(connectionId, userId); + id = conn.getId(); + name = conn.getName(); + } catch (Exception ignored) {} + return new ConnectionStatusItemDto( + id, name, "offline", error.getMessage(), durationMs + ); + } + } } diff --git a/backend/src/main/java/com/sshmanager/service/PortForwardRegistry.java b/backend/src/main/java/com/sshmanager/service/PortForwardRegistry.java new file mode 100644 index 0000000..d9cd2d5 --- /dev/null +++ b/backend/src/main/java/com/sshmanager/service/PortForwardRegistry.java @@ -0,0 +1,176 @@ +package com.sshmanager.service; + +import com.jcraft.jsch.Session; +import com.sshmanager.entity.Connection; +import com.sshmanager.util.JschUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +/** + * In-memory registry for active SSH port-forwarding tunnels. + * + *

All tunnels are ephemeral — they exist only for the lifetime of the server + * process. Restarting the server clears all tunnels automatically. + * + *

One JSch {@link Session} is kept per tunnel. When a tunnel is stopped the + * session is disconnected and the local port is freed. + */ +@Component +public class PortForwardRegistry { + + private static final Logger log = LoggerFactory.getLogger(PortForwardRegistry.class); + + // ── public data model ──────────────────────────────────────────────────── + + public enum TunnelStatus { RUNNING, STOPPED, ERROR } + + public static class TunnelEntry { + private final String id; + private final Long userId; + private final Long connectionId; + private final String connectionName; + private final int localPort; + private final String remoteHost; + private final int remotePort; + private final Instant createdAt; + private volatile TunnelStatus status; + // not exposed in DTO + final Session jschSession; + + public TunnelEntry(String id, Long userId, Long connectionId, String connectionName, + int localPort, String remoteHost, int remotePort, + Session jschSession) { + this.id = id; + this.userId = userId; + this.connectionId = connectionId; + this.connectionName = connectionName; + this.localPort = localPort; + this.remoteHost = remoteHost; + this.remotePort = remotePort; + this.jschSession = jschSession; + this.createdAt = Instant.now(); + this.status = TunnelStatus.RUNNING; + } + + public String getId() { return id; } + public Long getUserId() { return userId; } + public Long getConnectionId() { return connectionId; } + public String getConnectionName(){ return connectionName; } + public int getLocalPort() { return localPort; } + public String getRemoteHost() { return remoteHost; } + public int getRemotePort() { return remotePort; } + public Instant getCreatedAt() { return createdAt; } + public TunnelStatus getStatus() { return status; } + void setStatus(TunnelStatus s) { this.status = s; } + } + + // ── state ──────────────────────────────────────────────────────────────── + + private final Map tunnels = new ConcurrentHashMap<>(); + private final SshSessionFactory sshSessionFactory; + + public PortForwardRegistry(SshSessionFactory sshSessionFactory) { + this.sshSessionFactory = sshSessionFactory; + } + + // ── public API ─────────────────────────────────────────────────────────── + + /** + * Create and register a new port-forwarding tunnel. + * + * @param userId owner's user ID + * @param conn the SSH connection entity to tunnel through + * @param password decrypted password (null for key auth) + * @param privateKey decrypted private key PEM (null for password auth) + * @param passphrase key passphrase (null if none) + * @param localPort local TCP port to bind (1–65535) + * @param remoteHost the host reachable from the SSH server to forward to + * @param remotePort the port on remoteHost to forward to (1–65535) + * @return the registered {@link TunnelEntry} + * @throws IllegalArgumentException if port numbers are out of range or remoteHost is blank + * @throws Exception if the SSH session or port-forward setup fails + */ + public TunnelEntry create(Long userId, Connection conn, + String password, String privateKey, String passphrase, + int localPort, String remoteHost, int remotePort) throws Exception { + validatePorts(localPort, remotePort); + if (remoteHost == null || remoteHost.trim().isEmpty()) { + throw new IllegalArgumentException("remoteHost must not be blank"); + } + + Session session = sshSessionFactory.createSession(conn, password, privateKey, passphrase); + try { + session.setPortForwardingL(localPort, remoteHost, remotePort); + } catch (Exception e) { + session.disconnect(); + throw e; + } + + String id = UUID.randomUUID().toString().replace("-", ""); + TunnelEntry entry = new TunnelEntry(id, userId, conn.getId(), conn.getName(), + localPort, remoteHost, remotePort, session); + tunnels.put(id, entry); + log.info("Port-forward started: id={} user={} {}:{}:{} via connection={}", + id, userId, localPort, remoteHost, remotePort, conn.getId()); + return entry; + } + + /** + * Stop and remove a tunnel. + * + * @param id tunnel ID + * @param userId caller's user ID — must match the tunnel owner + * @throws IllegalArgumentException if the tunnel is not found or not owned by this user + */ + public void stop(String id, Long userId) { + TunnelEntry entry = tunnels.get(id); + if (entry == null) { + throw new IllegalArgumentException("Port-forward tunnel not found: " + id); + } + if (!entry.getUserId().equals(userId)) { + throw new IllegalArgumentException("Access denied to tunnel: " + id); + } + tunnels.remove(id); + try { + entry.jschSession.delPortForwardingL(entry.getLocalPort()); + } catch (Exception ignored) { + // best-effort cancel + } + if (entry.jschSession.isConnected()) { + entry.jschSession.disconnect(); + } + entry.setStatus(TunnelStatus.STOPPED); + log.info("Port-forward stopped: id={} user={} localPort={}", id, userId, entry.getLocalPort()); + } + + /** List all active tunnels belonging to a user. */ + public List listByUser(Long userId) { + List result = new ArrayList<>(); + for (TunnelEntry e : tunnels.values()) { + if (e.getUserId().equals(userId)) { + result.add(e); + } + } + result.sort((a, b) -> a.getCreatedAt().compareTo(b.getCreatedAt())); + return result; + } + + // ── helpers ────────────────────────────────────────────────────────────── + + private static void validatePorts(int localPort, int remotePort) { + if (localPort < 1 || localPort > 65535) { + throw new IllegalArgumentException("localPort must be in range 1-65535, got: " + localPort); + } + if (remotePort < 1 || remotePort > 65535) { + throw new IllegalArgumentException("remotePort must be in range 1-65535, got: " + remotePort); + } + } +} diff --git a/backend/src/main/java/com/sshmanager/service/QuickConnectionRegistry.java b/backend/src/main/java/com/sshmanager/service/QuickConnectionRegistry.java index 1f4b4fd..8b7f3a6 100644 --- a/backend/src/main/java/com/sshmanager/service/QuickConnectionRegistry.java +++ b/backend/src/main/java/com/sshmanager/service/QuickConnectionRegistry.java @@ -1,6 +1,10 @@ package com.sshmanager.service; import com.sshmanager.entity.Connection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.time.Instant; @@ -10,15 +14,30 @@ import java.util.concurrent.atomic.AtomicLong; /** * In-memory registry for quick-connect (ephemeral) SSH connections. - * Entries are NOT persisted to the database and are cleaned up - * when the WebSocket session closes. + * + *

Entries are NOT persisted to the database. They are cleaned up either: + *

    + *
  • immediately when the WebSocket session closes ({@link #remove}), or
  • + *
  • by the background TTL sweep ({@link #evictExpired}) after + * {@code sshmanager.quick-connection.ttl-minutes} minutes of inactivity.
  • + *
+ * + *

Call {@link #touch} after a successful WebSocket handshake to reset the + * last-active timestamp and prevent premature eviction of long-lived sessions. */ @Component public class QuickConnectionRegistry { + private static final Logger log = LoggerFactory.getLogger(QuickConnectionRegistry.class); + + @Value("${sshmanager.quick-connection.ttl-minutes:30}") + private long ttlMinutes; + private final AtomicLong idGen = new AtomicLong(10_000_000); private final Map entries = new ConcurrentHashMap<>(); + // ── public API ─────────────────────────────────────────────────────────── + public Connection create(String host, String username, int port, Long userId) { long id = idGen.incrementAndGet(); Connection conn = new Connection(); @@ -36,11 +55,25 @@ public class QuickConnectionRegistry { return conn; } + /** Retrieve a quick connection; returns null if not found or already expired. */ public Connection get(Long id) { Entry entry = entries.get(id); return entry != null ? entry.connection : null; } + /** + * Refresh the last-active timestamp for a quick connection. + * Call this after a WebSocket session is successfully established so that + * the entry is not evicted while the terminal is still in use. + */ + public void touch(Long id) { + Entry entry = entries.get(id); + if (entry != null) { + entry.lastAccessAt = System.currentTimeMillis(); + } + } + + /** Immediately remove a quick connection (called on WebSocket close). */ public void remove(Long id) { entries.remove(id); } @@ -49,9 +82,41 @@ public class QuickConnectionRegistry { return entries.size(); } + // ── background cleanup ─────────────────────────────────────────────────── + + /** + * Scheduled eviction of stale quick connections. + * + *

The interval is controlled by + * {@code sshmanager.quick-connection.cleanup-interval-ms} (default 60 s). + * An entry is evicted when its last-active time exceeds + * {@code sshmanager.quick-connection.ttl-minutes}. + */ + @Scheduled(fixedDelayString = "${sshmanager.quick-connection.cleanup-interval-ms:60000}") + public void evictExpired() { + long ttlMillis = ttlMinutes * 60_000L; + long now = System.currentTimeMillis(); + int[] removed = {0}; + entries.entrySet().removeIf(e -> { + boolean expired = (now - e.getValue().lastAccessAt) > ttlMillis; + if (expired) { + removed[0]++; + log.info("Evicting stale quick connection id={} (inactive > {} min)", + e.getKey(), ttlMinutes); + } + return expired; + }); + if (removed[0] > 0) { + log.info("Quick-connection TTL sweep removed {} entr{}, {} remaining", + removed[0], removed[0] == 1 ? "y" : "ies", entries.size()); + } + } + + // ── internal entry ─────────────────────────────────────────────────────── + private static class Entry { final Connection connection; - final long createdAt = System.currentTimeMillis(); + volatile long lastAccessAt = System.currentTimeMillis(); Entry(Connection connection) { this.connection = connection; diff --git a/backend/src/main/java/com/sshmanager/service/RealTcpProbe.java b/backend/src/main/java/com/sshmanager/service/RealTcpProbe.java new file mode 100644 index 0000000..7c331b1 --- /dev/null +++ b/backend/src/main/java/com/sshmanager/service/RealTcpProbe.java @@ -0,0 +1,27 @@ +package com.sshmanager.service; + +import com.sshmanager.entity.Connection; +import org.springframework.stereotype.Component; + +import java.net.InetSocketAddress; +import java.net.Socket; + +/** + * Production TCP probe implementation. + * Opens a raw TCP socket to the target host:port — no SSH handshake. + */ +@Component +public class RealTcpProbe implements TcpProbe { + + @Override + public void checkReachable(Connection conn, int timeoutSeconds) throws Exception { + Socket socket = new Socket(); + try { + socket.connect(new InetSocketAddress(conn.getHost(), conn.getPort()), timeoutSeconds * 1000); + } catch (Exception e) { + try { socket.close(); } catch (Exception ignored) {} + throw e; + } + socket.close(); + } +} diff --git a/backend/src/main/java/com/sshmanager/service/SshSessionFactory.java b/backend/src/main/java/com/sshmanager/service/SshSessionFactory.java new file mode 100644 index 0000000..236f450 --- /dev/null +++ b/backend/src/main/java/com/sshmanager/service/SshSessionFactory.java @@ -0,0 +1,24 @@ +package com.sshmanager.service; + +import com.jcraft.jsch.Session; +import com.sshmanager.entity.Connection; +import com.sshmanager.util.JschUtil; +import org.springframework.stereotype.Component; + +/** + * A Spring-managed factory for JSch sessions. + * + *

Wraps the static utility calls to {@link JschUtil#createSession} so that + * dependent components can be easily tested via dependency injection and standard mocking. + */ +@Component +public class SshSessionFactory { + + /** + * Create and connect an SSH session. + */ + public Session createSession(Connection conn, String password, String privateKey, String passphrase) + throws Exception { + return JschUtil.createSession(conn, password, privateKey, passphrase); + } +} diff --git a/backend/src/main/java/com/sshmanager/service/TcpProbe.java b/backend/src/main/java/com/sshmanager/service/TcpProbe.java new file mode 100644 index 0000000..eb7571f --- /dev/null +++ b/backend/src/main/java/com/sshmanager/service/TcpProbe.java @@ -0,0 +1,12 @@ +package com.sshmanager.service; + +import com.sshmanager.entity.Connection; + +/** + * Abstraction for TCP connectivity probing. + * Production: {@link RealTcpProbe} uses raw Socket.connect(). + * Tests: mock to return success/failure without real network. + */ +public interface TcpProbe { + void checkReachable(Connection conn, int timeoutSeconds) throws Exception; +} diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 816cc74..1bedf8f 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -39,8 +39,17 @@ sshmanager: jwt-expiration-ms: 86400000 password-expiration-days: ${SSHMANAGER_PASSWORD_EXPIRATION_DAYS:90} terminal: + # Idle timeout threshold for active terminal websocket sessions, in minutes. + # Disconnects the underlying SSH session and closes the terminal on timeout. Default: 30. + idle-timeout-minutes: 30 websocket: thread-pool: core-size: 10 max-size: 50 keep-alive-seconds: 60 + quick-connection: + # Time-to-live for idle quick (ephemeral) SSH connections, in minutes. + # An active WebSocket terminal resets the timer. Default: 30 minutes. + ttl-minutes: 30 + # How often to run the TTL cleanup sweep, in milliseconds. Default: 60 s. + cleanup-interval-ms: 60000 diff --git a/backend/src/main/resources/static/assets/DashboardPage-BQqMAlQh.js b/backend/src/main/resources/static/assets/DashboardPage-8WtAnohf.js similarity index 98% rename from backend/src/main/resources/static/assets/DashboardPage-BQqMAlQh.js rename to backend/src/main/resources/static/assets/DashboardPage-8WtAnohf.js index 9c08276..6cd53d2 100644 --- a/backend/src/main/resources/static/assets/DashboardPage-BQqMAlQh.js +++ b/backend/src/main/resources/static/assets/DashboardPage-8WtAnohf.js @@ -1 +1 @@ -import{c as B,r as o,j as e}from"./index-Z2D8CQl5.js";import{l as L,M as $,S as P,A as I,c as _,g as A}from"./monitor-D01QXMh7.js";const D=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],F=B("cpu",D);const R=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],z=B("wifi",R);function G({data:s,color:r}){if(s.length<2)return null;const g=Math.max(...s,1),m=Math.min(...s,0),f=g-m||1,u=120,i=32,p=s.map((N,v)=>`${v/(s.length-1)*u},${i-(N-m)/f*(i-4)-2}`).join(" ");return e.jsx("svg",{width:u,height:i,className:"shrink-0",children:e.jsx("polyline",{fill:"none",stroke:r,strokeWidth:"1.5",points:p})})}function k({value:s,label:r,color:g}){const i=2*Math.PI*28,p=i-s/100*i;return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 64 64",children:[e.jsx("circle",{cx:32,cy:32,r:28,fill:"none",stroke:"rgba(148,163,184,0.1)",strokeWidth:"5"}),e.jsx("circle",{cx:32,cy:32,r:28,fill:"none",stroke:g,strokeWidth:"5",strokeDasharray:i,strokeDashoffset:p,strokeLinecap:"round",transform:"rotate(-90 32 32)"}),e.jsxs("text",{x:32,y:32,textAnchor:"middle",dominantBaseline:"central",fill:"#e2e8f0",fontSize:"11",fontWeight:"600",children:[Math.round(s),"%"]})]}),e.jsx("span",{className:"mt-1 text-[10px] text-content-dim",children:r})]})}function K({onBack:s}){const[r,g]=o.useState([]),[m,f]=o.useState({}),[u,i]=o.useState({}),[p,N]=o.useState({}),[v,E]=o.useState(!0),[W,b]=o.useState(!1),[n,y]=o.useState(null);o.useEffect(()=>{let t=!1;return(async()=>{try{const h=await L();if(t)return;const c=h.data;g(c),c.length>0&&!n&&y(c[0].id)}catch{}finally{t||E(!1)}})(),()=>{t=!0}},[]),o.useEffect(()=>{if(!n)return;let t=!1;const h=async()=>{b(!0),f(l=>({...l,[n]:"checking"}));try{const l=await _([n]);if(t)return;const d=l.data.results[0]?.status??"unknown";if(f(x=>({...x,[n]:d})),d!=="online"){i(x=>{const C={...x};return delete C[n],C});return}const M=await A(n);if(t)return;i(x=>({...x,[n]:M.data}));const S=M.data.cpuUsage;S!=null&&N(x=>({...x,[n]:[...(x[n]||[]).slice(-29),S]}))}catch{t||(f(l=>({...l,[n]:"unknown"})),i(l=>{const d={...l};return delete d[n],d}))}finally{t||b(!1)}};h();const c=window.setInterval(h,5e3);return()=>{t=!0,window.clearInterval(c)}},[n]);const w=o.useMemo(()=>{const t={online:0,offline:0,unknown:0};return r.forEach(h=>{const c=m[h.id];c==="online"?t.online++:c==="offline"?t.offline++:t.unknown++}),t},[r,m]),j=r.find(t=>t.id===n),a=n?u[n]:null;return e.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface-app",children:[e.jsxs("header",{className:"flex h-12 items-center justify-between shrink-0 px-4 border-b border-border-main bg-surface-panel/60",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-xs font-medium transition hover:brightness-150 text-cyan-500",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),"返回工作台"]}),e.jsx("div",{className:"h-4 w-px bg-border-main"}),e.jsx($,{size:16,className:"text-cyan-500"}),e.jsx("h1",{className:"text-sm font-semibold text-content-main",children:"监控仪表盘"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-main",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),"在线 ",w.online]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-main",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),"离线 ",w.offline]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-dim",children:["共 ",r.length," 台"]})]})]}),v?e.jsx("div",{className:"flex flex-1 items-center justify-center text-xs text-content-dim",children:"加载中..."}):r.length===0?e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center",children:[e.jsx($,{size:48,className:"text-cyan-500/15"}),e.jsx("p",{className:"mt-3 text-sm text-content-dim",children:"暂无连接,请先创建 SSH 连接"})]}):e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("aside",{className:"w-56 shrink-0 overflow-auto p-2 border-r border-border-main",children:r.map(t=>{const c=m[t.id]==="online",l=u[t.id],d=n===t.id;return e.jsxs("button",{onClick:()=>y(t.id),className:`w-full rounded-lg px-3 py-2 text-left text-xs transition-all mb-0.5 ${d?"bg-cyan-500/5 border border-cyan-500/20":"border border-transparent hover:bg-surface-muted"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${c?"bg-emerald-500":"bg-content-dim"}`}),e.jsx("span",{className:`truncate font-medium ${d?"text-content-main":"text-content-muted"}`,children:t.name})]}),c&&l?e.jsxs("div",{className:"mt-1 flex gap-2 text-[10px] text-content-dim",children:[e.jsxs("span",{children:["CPU ",l.cpuUsage??"-","%"]}),e.jsxs("span",{children:["MEM ",l.memUsage??"-","%"]})]}):null]},t.id)})}),e.jsx("main",{className:"flex-1 overflow-auto p-5",children:j&&a?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-content-main",children:j.name}),e.jsxs("p",{className:"text-xs mt-0.5 text-content-dim",children:[j.host,":",j.port]})]}),e.jsxs("div",{className:"flex gap-6 flex-wrap",children:[e.jsx(k,{value:a.cpuUsage??0,label:"CPU",color:"#22d3ee"}),e.jsx(k,{value:a.memUsage??0,label:"内存",color:"#818cf8"}),e.jsx(k,{value:a.diskUsage??0,label:"磁盘",color:"#34d399"})]}),e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-xs font-medium text-content-muted",children:"CPU 历史 (最近30s)"}),e.jsxs("div",{className:"flex gap-4 text-[10px] text-content-dim",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{size:10})," 负载: ",a.load1??"-"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{size:10})," 核数: ",a.cpuCores??"-"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:10})," 运行: ",a.uptime??"-"]})]})]}),(p[n]?.length??0)>=2?e.jsx(G,{data:p[n],color:"#22d3ee"}):e.jsx("div",{className:"h-8 flex items-center text-[10px] text-content-dim",children:"采集数据中..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsx("div",{className:"text-xs font-medium mb-2 text-content-muted",children:"内存详情"}),e.jsxs("div",{className:"text-lg font-semibold text-content-main",children:[U(a.memUsed??0)," / ",U(a.memTotal??0)]}),e.jsx("div",{className:"text-[10px] mt-0.5 text-content-dim",children:"已用 / 总量"})]}),e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsx("div",{className:"text-xs font-medium mb-2 text-content-muted",children:"磁盘使用"}),e.jsx("div",{className:"text-lg font-semibold text-content-main",children:a.diskUsage!=null?`${a.diskUsage}%`:"-"}),e.jsx("div",{className:"text-[10px] mt-0.5 text-content-dim",children:"根分区"})]})]})]}):j&&W?e.jsxs("div",{className:"flex flex-1 items-center justify-center h-full text-xs text-content-dim",children:[e.jsx(z,{size:32,className:"mr-3 animate-pulse text-cyan-500/30"}),"正在采集当前主机数据..."]}):j&&!a?e.jsxs("div",{className:"flex flex-1 items-center justify-center h-full text-xs text-content-dim",children:[e.jsx(z,{size:32,className:"mr-3 text-red-500/30"}),"该主机处于离线或无法获取监控数据"]}):null})]})]})}function U(s){return s==null||Number.isNaN(s)?"-":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:s<1024*1024*1024?`${(s/(1024*1024)).toFixed(0)} MB`:`${(s/(1024*1024*1024)).toFixed(1)} GB`}export{K as default}; +import{c as B,r as o,j as e}from"./index-BQbRYAGj.js";import{l as L,M as $,S as P,A as I,c as _,g as A}from"./monitor-BOliCSBz.js";const D=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],F=B("cpu",D);const R=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],z=B("wifi",R);function G({data:s,color:r}){if(s.length<2)return null;const g=Math.max(...s,1),m=Math.min(...s,0),f=g-m||1,u=120,i=32,p=s.map((N,v)=>`${v/(s.length-1)*u},${i-(N-m)/f*(i-4)-2}`).join(" ");return e.jsx("svg",{width:u,height:i,className:"shrink-0",children:e.jsx("polyline",{fill:"none",stroke:r,strokeWidth:"1.5",points:p})})}function k({value:s,label:r,color:g}){const i=2*Math.PI*28,p=i-s/100*i;return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 64 64",children:[e.jsx("circle",{cx:32,cy:32,r:28,fill:"none",stroke:"rgba(148,163,184,0.1)",strokeWidth:"5"}),e.jsx("circle",{cx:32,cy:32,r:28,fill:"none",stroke:g,strokeWidth:"5",strokeDasharray:i,strokeDashoffset:p,strokeLinecap:"round",transform:"rotate(-90 32 32)"}),e.jsxs("text",{x:32,y:32,textAnchor:"middle",dominantBaseline:"central",fill:"#e2e8f0",fontSize:"11",fontWeight:"600",children:[Math.round(s),"%"]})]}),e.jsx("span",{className:"mt-1 text-[10px] text-content-dim",children:r})]})}function K({onBack:s}){const[r,g]=o.useState([]),[m,f]=o.useState({}),[u,i]=o.useState({}),[p,N]=o.useState({}),[v,E]=o.useState(!0),[W,b]=o.useState(!1),[n,y]=o.useState(null);o.useEffect(()=>{let t=!1;return(async()=>{try{const h=await L();if(t)return;const c=h.data;g(c),c.length>0&&!n&&y(c[0].id)}catch{}finally{t||E(!1)}})(),()=>{t=!0}},[]),o.useEffect(()=>{if(!n)return;let t=!1;const h=async()=>{b(!0),f(l=>({...l,[n]:"checking"}));try{const l=await _([n]);if(t)return;const d=l.data.results[0]?.status??"unknown";if(f(x=>({...x,[n]:d})),d!=="online"){i(x=>{const C={...x};return delete C[n],C});return}const M=await A(n);if(t)return;i(x=>({...x,[n]:M.data}));const S=M.data.cpuUsage;S!=null&&N(x=>({...x,[n]:[...(x[n]||[]).slice(-29),S]}))}catch{t||(f(l=>({...l,[n]:"unknown"})),i(l=>{const d={...l};return delete d[n],d}))}finally{t||b(!1)}};h();const c=window.setInterval(h,5e3);return()=>{t=!0,window.clearInterval(c)}},[n]);const w=o.useMemo(()=>{const t={online:0,offline:0,unknown:0};return r.forEach(h=>{const c=m[h.id];c==="online"?t.online++:c==="offline"?t.offline++:t.unknown++}),t},[r,m]),j=r.find(t=>t.id===n),a=n?u[n]:null;return e.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface-app",children:[e.jsxs("header",{className:"flex h-12 items-center justify-between shrink-0 px-4 border-b border-border-main bg-surface-panel/60",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-xs font-medium transition hover:brightness-150 text-cyan-500",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),"返回工作台"]}),e.jsx("div",{className:"h-4 w-px bg-border-main"}),e.jsx($,{size:16,className:"text-cyan-500"}),e.jsx("h1",{className:"text-sm font-semibold text-content-main",children:"监控仪表盘"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-main",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),"在线 ",w.online]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-main",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),"离线 ",w.offline]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-content-dim",children:["共 ",r.length," 台"]})]})]}),v?e.jsx("div",{className:"flex flex-1 items-center justify-center text-xs text-content-dim",children:"加载中..."}):r.length===0?e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center",children:[e.jsx($,{size:48,className:"text-cyan-500/15"}),e.jsx("p",{className:"mt-3 text-sm text-content-dim",children:"暂无连接,请先创建 SSH 连接"})]}):e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("aside",{className:"w-56 shrink-0 overflow-auto p-2 border-r border-border-main",children:r.map(t=>{const c=m[t.id]==="online",l=u[t.id],d=n===t.id;return e.jsxs("button",{onClick:()=>y(t.id),className:`w-full rounded-lg px-3 py-2 text-left text-xs transition-all mb-0.5 ${d?"bg-cyan-500/5 border border-cyan-500/20":"border border-transparent hover:bg-surface-muted"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${c?"bg-emerald-500":"bg-content-dim"}`}),e.jsx("span",{className:`truncate font-medium ${d?"text-content-main":"text-content-muted"}`,children:t.name})]}),c&&l?e.jsxs("div",{className:"mt-1 flex gap-2 text-[10px] text-content-dim",children:[e.jsxs("span",{children:["CPU ",l.cpuUsage??"-","%"]}),e.jsxs("span",{children:["MEM ",l.memUsage??"-","%"]})]}):null]},t.id)})}),e.jsx("main",{className:"flex-1 overflow-auto p-5",children:j&&a?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-content-main",children:j.name}),e.jsxs("p",{className:"text-xs mt-0.5 text-content-dim",children:[j.host,":",j.port]})]}),e.jsxs("div",{className:"flex gap-6 flex-wrap",children:[e.jsx(k,{value:a.cpuUsage??0,label:"CPU",color:"#22d3ee"}),e.jsx(k,{value:a.memUsage??0,label:"内存",color:"#818cf8"}),e.jsx(k,{value:a.diskUsage??0,label:"磁盘",color:"#34d399"})]}),e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-xs font-medium text-content-muted",children:"CPU 历史 (最近30s)"}),e.jsxs("div",{className:"flex gap-4 text-[10px] text-content-dim",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{size:10})," 负载: ",a.load1??"-"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{size:10})," 核数: ",a.cpuCores??"-"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:10})," 运行: ",a.uptime??"-"]})]})]}),(p[n]?.length??0)>=2?e.jsx(G,{data:p[n],color:"#22d3ee"}):e.jsx("div",{className:"h-8 flex items-center text-[10px] text-content-dim",children:"采集数据中..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsx("div",{className:"text-xs font-medium mb-2 text-content-muted",children:"内存详情"}),e.jsxs("div",{className:"text-lg font-semibold text-content-main",children:[U(a.memUsed??0)," / ",U(a.memTotal??0)]}),e.jsx("div",{className:"text-[10px] mt-0.5 text-content-dim",children:"已用 / 总量"})]}),e.jsxs("div",{className:"rounded-xl p-4 bg-surface-panel/40 border border-border-main",children:[e.jsx("div",{className:"text-xs font-medium mb-2 text-content-muted",children:"磁盘使用"}),e.jsx("div",{className:"text-lg font-semibold text-content-main",children:a.diskUsage!=null?`${a.diskUsage}%`:"-"}),e.jsx("div",{className:"text-[10px] mt-0.5 text-content-dim",children:"根分区"})]})]})]}):j&&W?e.jsxs("div",{className:"flex flex-1 items-center justify-center h-full text-xs text-content-dim",children:[e.jsx(z,{size:32,className:"mr-3 animate-pulse text-cyan-500/30"}),"正在采集当前主机数据..."]}):j&&!a?e.jsxs("div",{className:"flex flex-1 items-center justify-center h-full text-xs text-content-dim",children:[e.jsx(z,{size:32,className:"mr-3 text-red-500/30"}),"该主机处于离线或无法获取监控数据"]}):null})]})]})}function U(s){return s==null||Number.isNaN(s)?"-":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:s<1024*1024*1024?`${(s/(1024*1024)).toFixed(0)} MB`:`${(s/(1024*1024*1024)).toFixed(1)} GB`}export{K as default}; diff --git a/backend/src/main/resources/static/assets/Modal-DTj05goU.js b/backend/src/main/resources/static/assets/Modal-B96Ao-J_.js similarity index 96% rename from backend/src/main/resources/static/assets/Modal-DTj05goU.js rename to backend/src/main/resources/static/assets/Modal-B96Ao-J_.js index afc06ad..69eee7f 100644 --- a/backend/src/main/resources/static/assets/Modal-DTj05goU.js +++ b/backend/src/main/resources/static/assets/Modal-B96Ao-J_.js @@ -1 +1 @@ -import{c as r,j as e}from"./index-Z2D8CQl5.js";const l=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],m=r("circle-alert",l);const o=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],b=r("trash-2",o);const i=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x=r("x",i);function h({title:c,onClose:t,children:d,footer:a,maxWidth:s="max-w-3xl",open:n=!0}){return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",children:e.jsxs("div",{className:`flex max-h-[92vh] w-full flex-col overflow-hidden rounded-3xl border border-border-main bg-surface-card ${s}`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle bg-surface-card/90 px-5 py-4",children:[e.jsx("h3",{className:"text-lg font-medium text-content-main",children:c}),t?e.jsx("button",{onClick:t,className:"rounded-xl border border-border-main bg-surface-muted p-2 text-content-muted transition hover:text-content-main",children:e.jsx(x,{size:18})}):null]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:d}),a?e.jsx("div",{className:"flex justify-end gap-3 border-t border-border-subtle bg-surface-card/90 px-5 py-4",children:a}):null]})}):null}export{m as C,h as M,b as T,x as X}; +import{c as r,j as e}from"./index-BQbRYAGj.js";const l=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],m=r("circle-alert",l);const o=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],b=r("trash-2",o);const i=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x=r("x",i);function h({title:c,onClose:t,children:d,footer:a,maxWidth:s="max-w-3xl",open:n=!0}){return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",children:e.jsxs("div",{className:`flex max-h-[92vh] w-full flex-col overflow-hidden rounded-3xl border border-border-main bg-surface-card ${s}`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle bg-surface-card/90 px-5 py-4",children:[e.jsx("h3",{className:"text-lg font-medium text-content-main",children:c}),t?e.jsx("button",{onClick:t,className:"rounded-xl border border-border-main bg-surface-muted p-2 text-content-muted transition hover:text-content-main",children:e.jsx(x,{size:18})}):null]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:d}),a?e.jsx("div",{className:"flex justify-end gap-3 border-t border-border-subtle bg-surface-card/90 px-5 py-4",children:a}):null]})}):null}export{m as C,h as M,b as T,x as X}; diff --git a/backend/src/main/resources/static/assets/UserManagementPage-CpLFrodx.js b/backend/src/main/resources/static/assets/UserManagementPage-3xCLOZtk.js similarity index 99% rename from backend/src/main/resources/static/assets/UserManagementPage-CpLFrodx.js rename to backend/src/main/resources/static/assets/UserManagementPage-3xCLOZtk.js index f8b3152..521b74a 100644 --- a/backend/src/main/resources/static/assets/UserManagementPage-CpLFrodx.js +++ b/backend/src/main/resources/static/assets/UserManagementPage-3xCLOZtk.js @@ -1 +1 @@ -import{c as i,h as m,u as H,r as s,j as e,U as J}from"./index-Z2D8CQl5.js";import{C as Q,T as X,M as N}from"./Modal-DTj05goU.js";const Y=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Z=i("chevron-left",Y);const ee=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],te=i("key-round",ee);const se=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ne=i("pencil",se);const ae=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],re=i("shield-off",ae);const oe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],le=i("shield",oe);function ce(){return m.get("/users")}function de(a){return m.post("/users",a)}function ie(a,d){return m.put(`/users/${a}`,d)}function me(a){return m.delete(`/users/${a}`)}function xe(a,d){return m.post(`/users/${a}/reset-password`,{newPassword:d})}function pe({onBack:a}){const{user:d}=H(),[U,P]=s.useState([]),[F,E]=s.useState(!0),[R,_]=s.useState(null),[$,v]=s.useState(!1),[x,w]=s.useState(null),[u,k]=s.useState(null),[h,p]=s.useState(null),[C,M]=s.useState(""),[S,z]=s.useState(""),[b,f]=s.useState(""),[y,g]=s.useState("ROLE_USER"),[L,D]=s.useState(!0),[j,A]=s.useState(""),[r,o]=s.useState(!1),[l,n]=s.useState(null),c=s.useCallback(async()=>{E(!0),_(null);try{const t=await ce();P(t.data)}catch(t){_(t.response?.data?.message||"加载用户列表失败")}finally{E(!1)}},[]);s.useEffect(()=>{c()},[c]);function I(){M(""),z(""),f(""),g("ROLE_USER"),n(null),v(!0)}function W(t){w(t),f(t.displayName||""),g(t.role),D(t.enabled),n(null)}function T(t){k(t),A(""),n(null)}async function V(){o(!0),n(null);try{const t={username:C.trim(),password:S,displayName:b.trim()||void 0,role:y};await de(t),v(!1),await c()}catch(t){n(t.response?.data?.message||"创建用户失败")}finally{o(!1)}}async function K(){if(x){o(!0),n(null);try{const t={displayName:b.trim()||void 0,role:y,enabled:L};await ie(x.id,t),w(null),await c()}catch(t){n(t.response?.data?.message||"更新用户失败")}finally{o(!1)}}}async function q(){if(h){o(!0),n(null);try{await me(h.id),p(null),await c()}catch(t){n(t.response?.data?.message||"删除用户失败")}finally{o(!1)}}}async function B(){if(u){if(j.length<8){n("密码至少需要 8 个字符");return}o(!0),n(null);try{await xe(u.id,j),k(null)}catch(t){n(t.response?.data?.message||"重置密码失败")}finally{o(!1)}}}function G(t){try{return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return"-"}}return e.jsxs("div",{className:"flex h-screen flex-col bg-surface-app text-content-main",children:[e.jsxs("header",{className:"flex h-14 items-center justify-between border-b border-border-main bg-surface-panel px-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{className:"flex items-center gap-1 rounded-md px-2 py-1 text-sm text-content-muted transition hover:text-content-main",onClick:a,children:[e.jsx(Z,{size:18}),"返回"]}),e.jsx("div",{className:"h-6 w-px bg-border-main"}),e.jsx("h1",{className:"text-lg font-semibold tracking-wide text-blue-400",children:"用户管理"})]}),e.jsxs("button",{className:"flex items-center gap-2 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500",onClick:I,children:[e.jsx(J,{size:16}),"新建用户"]})]}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:F?e.jsx("div",{className:"flex items-center justify-center py-20 text-content-dim",children:"加载中..."}):R?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-20 text-red-400",children:[e.jsx(Q,{size:18}),R,e.jsx("button",{className:"ml-2 underline hover:text-red-300",onClick:()=>{c()},children:"重试"})]}):e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel/60",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-main bg-surface-panel/80",children:[e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"ID"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"用户名"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"显示名"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"角色"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"状态"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"创建时间"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"操作"})]})}),e.jsx("tbody",{children:U.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-5 py-16 text-center text-content-dim",children:"暂无用户"})}):U.map(t=>{const O=d?.username===t.username;return e.jsxs("tr",{className:"border-b border-border-subtle transition hover:bg-surface-muted",children:[e.jsx("td",{className:"px-5 py-3.5 text-content-dim",children:t.id}),e.jsxs("td",{className:"px-5 py-3.5 font-medium text-content-main",children:[t.username,O&&e.jsx("span",{className:"ml-2 rounded bg-blue-500/15 px-1.5 py-0.5 text-xs text-blue-400",children:"当前"})]}),e.jsx("td",{className:"px-5 py-3.5 text-content-muted",children:t.displayName||"-"}),e.jsx("td",{className:"px-5 py-3.5",children:e.jsx("span",{className:`inline-block rounded-full px-2.5 py-0.5 text-xs font-medium ${t.role==="ROLE_ADMIN"?"bg-amber-500/15 text-amber-400":"bg-surface-muted text-content-muted"}`,children:t.role==="ROLE_ADMIN"?"管理员":"普通用户"})}),e.jsx("td",{className:"px-5 py-3.5",children:t.enabled?e.jsxs("span",{className:"flex items-center gap-1.5 text-emerald-400",children:[e.jsx(le,{size:14}),"启用"]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-red-400",children:[e.jsx(re,{size:14}),"禁用"]})}),e.jsx("td",{className:"px-5 py-3.5 text-content-dim",children:G(t.createdAt)}),e.jsx("td",{className:"px-5 py-3.5",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",title:"编辑",onClick:()=>W(t),children:e.jsx(ne,{size:15})}),e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-amber-400",title:"重置密码",onClick:()=>T(t),children:e.jsx(te,{size:15})}),!O&&e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-red-400",title:"删除",onClick:()=>{n(null),p(t)},children:e.jsx(X,{size:15})})]})})]},t.id)})})]})})}),e.jsx(N,{title:"新建用户",open:$,onClose:()=>v(!1),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"用户名 *"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:C,onChange:t=>M(t.target.value),placeholder:"登录用户名"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"密码 *"}),e.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:S,onChange:t=>z(t.target.value),placeholder:"至少 8 个字符"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"显示名"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:b,onChange:t=>f(t.target.value),placeholder:"用户显示名称(选填)"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"角色"}),e.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:t=>g(t.target.value),children:[e.jsx("option",{value:"ROLE_USER",children:"普通用户"}),e.jsx("option",{value:"ROLE_ADMIN",children:"管理员"})]})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r||!C.trim()||S.length<8,onClick:()=>{V()},children:r?"创建中...":"创建"})]})}),e.jsx(N,{title:"编辑用户",open:!!x,onClose:()=>w(null),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-main bg-surface-muted px-4 py-2.5 text-sm text-content-muted",children:["用户名: ",e.jsx("span",{className:"text-content-main",children:x?.username})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"显示名"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:b,onChange:t=>f(t.target.value)})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"角色"}),e.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:t=>g(t.target.value),children:[e.jsx("option",{value:"ROLE_USER",children:"普通用户"}),e.jsx("option",{value:"ROLE_ADMIN",children:"管理员"})]})]}),e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border-main bg-surface-control text-cyan-500 focus:ring-cyan-500/30",checked:L,onChange:t=>D(t.target.checked)}),e.jsx("span",{className:"text-sm text-content-muted",children:"账号已启用"})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:()=>{K()},children:r?"保存中...":"保存"})]})}),e.jsx(N,{title:"重置密码",open:!!u,onClose:()=>k(null),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-main bg-surface-muted px-4 py-2.5 text-sm text-content-muted",children:["用户: ",e.jsx("span",{className:"text-content-main",children:u?.username})]}),e.jsx("p",{className:"text-xs text-amber-400",children:"重置后该用户下次登录将被要求修改密码。"}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"新密码 *"}),e.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:j,onChange:t=>A(t.target.value),placeholder:"至少 8 个字符"})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-amber-900/30 transition hover:from-amber-400 hover:to-orange-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r||j.length<8,onClick:()=>{B()},children:r?"重置中...":"确认重置"})]})}),e.jsx(N,{title:"确认删除",open:!!h,onClose:()=>p(null),maxWidth:"max-w-sm",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-content-muted",children:["确定要删除用户 ",e.jsx("span",{className:"font-medium text-content-main",children:h?.username})," 吗?此操作不可撤销。"]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{className:"rounded-xl border border-border-main px-4 py-2 text-sm text-content-muted transition hover:bg-surface-muted",onClick:()=>p(null),children:"取消"}),e.jsx("button",{className:"rounded-xl bg-red-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-red-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:()=>{q()},children:r?"删除中...":"删除"})]})]})})]})}export{pe as default}; +import{c as i,h as m,u as H,r as s,j as e,U as J}from"./index-BQbRYAGj.js";import{C as Q,T as X,M as N}from"./Modal-B96Ao-J_.js";const Y=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Z=i("chevron-left",Y);const ee=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],te=i("key-round",ee);const se=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ne=i("pencil",se);const ae=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],re=i("shield-off",ae);const oe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],le=i("shield",oe);function ce(){return m.get("/users")}function de(a){return m.post("/users",a)}function ie(a,d){return m.put(`/users/${a}`,d)}function me(a){return m.delete(`/users/${a}`)}function xe(a,d){return m.post(`/users/${a}/reset-password`,{newPassword:d})}function pe({onBack:a}){const{user:d}=H(),[U,P]=s.useState([]),[F,E]=s.useState(!0),[R,_]=s.useState(null),[$,v]=s.useState(!1),[x,w]=s.useState(null),[u,k]=s.useState(null),[h,p]=s.useState(null),[C,M]=s.useState(""),[S,z]=s.useState(""),[b,f]=s.useState(""),[y,g]=s.useState("ROLE_USER"),[L,D]=s.useState(!0),[j,A]=s.useState(""),[r,o]=s.useState(!1),[l,n]=s.useState(null),c=s.useCallback(async()=>{E(!0),_(null);try{const t=await ce();P(t.data)}catch(t){_(t.response?.data?.message||"加载用户列表失败")}finally{E(!1)}},[]);s.useEffect(()=>{c()},[c]);function I(){M(""),z(""),f(""),g("ROLE_USER"),n(null),v(!0)}function W(t){w(t),f(t.displayName||""),g(t.role),D(t.enabled),n(null)}function T(t){k(t),A(""),n(null)}async function V(){o(!0),n(null);try{const t={username:C.trim(),password:S,displayName:b.trim()||void 0,role:y};await de(t),v(!1),await c()}catch(t){n(t.response?.data?.message||"创建用户失败")}finally{o(!1)}}async function K(){if(x){o(!0),n(null);try{const t={displayName:b.trim()||void 0,role:y,enabled:L};await ie(x.id,t),w(null),await c()}catch(t){n(t.response?.data?.message||"更新用户失败")}finally{o(!1)}}}async function q(){if(h){o(!0),n(null);try{await me(h.id),p(null),await c()}catch(t){n(t.response?.data?.message||"删除用户失败")}finally{o(!1)}}}async function B(){if(u){if(j.length<8){n("密码至少需要 8 个字符");return}o(!0),n(null);try{await xe(u.id,j),k(null)}catch(t){n(t.response?.data?.message||"重置密码失败")}finally{o(!1)}}}function G(t){try{return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return"-"}}return e.jsxs("div",{className:"flex h-screen flex-col bg-surface-app text-content-main",children:[e.jsxs("header",{className:"flex h-14 items-center justify-between border-b border-border-main bg-surface-panel px-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{className:"flex items-center gap-1 rounded-md px-2 py-1 text-sm text-content-muted transition hover:text-content-main",onClick:a,children:[e.jsx(Z,{size:18}),"返回"]}),e.jsx("div",{className:"h-6 w-px bg-border-main"}),e.jsx("h1",{className:"text-lg font-semibold tracking-wide text-blue-400",children:"用户管理"})]}),e.jsxs("button",{className:"flex items-center gap-2 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500",onClick:I,children:[e.jsx(J,{size:16}),"新建用户"]})]}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:F?e.jsx("div",{className:"flex items-center justify-center py-20 text-content-dim",children:"加载中..."}):R?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-20 text-red-400",children:[e.jsx(Q,{size:18}),R,e.jsx("button",{className:"ml-2 underline hover:text-red-300",onClick:()=>{c()},children:"重试"})]}):e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel/60",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-main bg-surface-panel/80",children:[e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"ID"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"用户名"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"显示名"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"角色"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"状态"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"创建时间"}),e.jsx("th",{className:"px-5 py-3.5 font-medium text-content-muted",children:"操作"})]})}),e.jsx("tbody",{children:U.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-5 py-16 text-center text-content-dim",children:"暂无用户"})}):U.map(t=>{const O=d?.username===t.username;return e.jsxs("tr",{className:"border-b border-border-subtle transition hover:bg-surface-muted",children:[e.jsx("td",{className:"px-5 py-3.5 text-content-dim",children:t.id}),e.jsxs("td",{className:"px-5 py-3.5 font-medium text-content-main",children:[t.username,O&&e.jsx("span",{className:"ml-2 rounded bg-blue-500/15 px-1.5 py-0.5 text-xs text-blue-400",children:"当前"})]}),e.jsx("td",{className:"px-5 py-3.5 text-content-muted",children:t.displayName||"-"}),e.jsx("td",{className:"px-5 py-3.5",children:e.jsx("span",{className:`inline-block rounded-full px-2.5 py-0.5 text-xs font-medium ${t.role==="ROLE_ADMIN"?"bg-amber-500/15 text-amber-400":"bg-surface-muted text-content-muted"}`,children:t.role==="ROLE_ADMIN"?"管理员":"普通用户"})}),e.jsx("td",{className:"px-5 py-3.5",children:t.enabled?e.jsxs("span",{className:"flex items-center gap-1.5 text-emerald-400",children:[e.jsx(le,{size:14}),"启用"]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-red-400",children:[e.jsx(re,{size:14}),"禁用"]})}),e.jsx("td",{className:"px-5 py-3.5 text-content-dim",children:G(t.createdAt)}),e.jsx("td",{className:"px-5 py-3.5",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",title:"编辑",onClick:()=>W(t),children:e.jsx(ne,{size:15})}),e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-amber-400",title:"重置密码",onClick:()=>T(t),children:e.jsx(te,{size:15})}),!O&&e.jsx("button",{className:"rounded-lg p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-red-400",title:"删除",onClick:()=>{n(null),p(t)},children:e.jsx(X,{size:15})})]})})]},t.id)})})]})})}),e.jsx(N,{title:"新建用户",open:$,onClose:()=>v(!1),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"用户名 *"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:C,onChange:t=>M(t.target.value),placeholder:"登录用户名"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"密码 *"}),e.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:S,onChange:t=>z(t.target.value),placeholder:"至少 8 个字符"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"显示名"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:b,onChange:t=>f(t.target.value),placeholder:"用户显示名称(选填)"})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"角色"}),e.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:t=>g(t.target.value),children:[e.jsx("option",{value:"ROLE_USER",children:"普通用户"}),e.jsx("option",{value:"ROLE_ADMIN",children:"管理员"})]})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r||!C.trim()||S.length<8,onClick:()=>{V()},children:r?"创建中...":"创建"})]})}),e.jsx(N,{title:"编辑用户",open:!!x,onClose:()=>w(null),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-main bg-surface-muted px-4 py-2.5 text-sm text-content-muted",children:["用户名: ",e.jsx("span",{className:"text-content-main",children:x?.username})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"显示名"}),e.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:b,onChange:t=>f(t.target.value)})]}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"角色"}),e.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:t=>g(t.target.value),children:[e.jsx("option",{value:"ROLE_USER",children:"普通用户"}),e.jsx("option",{value:"ROLE_ADMIN",children:"管理员"})]})]}),e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-border-main bg-surface-control text-cyan-500 focus:ring-cyan-500/30",checked:L,onChange:t=>D(t.target.checked)}),e.jsx("span",{className:"text-sm text-content-muted",children:"账号已启用"})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-cyan-900/30 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:()=>{K()},children:r?"保存中...":"保存"})]})}),e.jsx(N,{title:"重置密码",open:!!u,onClose:()=>k(null),maxWidth:"max-w-md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-main bg-surface-muted px-4 py-2.5 text-sm text-content-muted",children:["用户: ",e.jsx("span",{className:"text-content-main",children:u?.username})]}),e.jsx("p",{className:"text-xs text-amber-400",children:"重置后该用户下次登录将被要求修改密码。"}),e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-sm text-content-muted",children:"新密码 *"}),e.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-4 py-2.5 text-sm text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:j,onChange:t=>A(t.target.value),placeholder:"至少 8 个字符"})]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsx("button",{className:"w-full rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-4 py-2.5 text-sm font-medium text-white shadow-lg shadow-amber-900/30 transition hover:from-amber-400 hover:to-orange-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r||j.length<8,onClick:()=>{B()},children:r?"重置中...":"确认重置"})]})}),e.jsx(N,{title:"确认删除",open:!!h,onClose:()=>p(null),maxWidth:"max-w-sm",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-content-muted",children:["确定要删除用户 ",e.jsx("span",{className:"font-medium text-content-main",children:h?.username})," 吗?此操作不可撤销。"]}),l&&e.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:l}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{className:"rounded-xl border border-border-main px-4 py-2 text-sm text-content-muted transition hover:bg-surface-muted",onClick:()=>p(null),children:"取消"}),e.jsx("button",{className:"rounded-xl bg-red-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-red-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:()=>{q()},children:r?"删除中...":"删除"})]})]})})]})}export{pe as default}; diff --git a/backend/src/main/resources/static/assets/WorkspacePage-B8Ud6Ns4.js b/backend/src/main/resources/static/assets/WorkspacePage-cbzo-ogN.js similarity index 52% rename from backend/src/main/resources/static/assets/WorkspacePage-B8Ud6Ns4.js rename to backend/src/main/resources/static/assets/WorkspacePage-cbzo-ogN.js index 5d04ba0..c854d2c 100644 --- a/backend/src/main/resources/static/assets/WorkspacePage-B8Ud6Ns4.js +++ b/backend/src/main/resources/static/assets/WorkspacePage-cbzo-ogN.js @@ -1,17 +1,17 @@ -import{c as ae,r as W,h as _e,j as a,T as lt,u as gs,a as er}from"./index-Z2D8CQl5.js";import{S as Ot,e as tr,M as ft,l as Kt,c as sr,A as rr,q as ir,g as nr,d as Vt,u as or,a as ar,t as lr}from"./monitor-D01QXMh7.js";import{M as Fe,T as _t,X as At,C as Gt}from"./Modal-DTj05goU.js";const cr=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],hr=ae("bookmark",cr);const dr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ct=ae("chevron-down",dr);const ur=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bs=ae("chevron-right",ur);const fr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],bt=ae("circle-check",fr);const _r=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],mr=ae("circle-x",_r);const pr=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vr=ae("clock",pr);const gr=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],xs=ae("command",gr);const br=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],xr=ae("copy",br);const Sr=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Xt=ae("download",Sr);const Cr=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],yr=ae("eye-off",Cr);const wr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],kr=ae("eye",wr);const Er=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Lr=ae("file-text",Er);const Dr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],Mt=ae("file-up",Dr);const Rr=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Tr=ae("folder-open",Rr);const Ar=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Mr=ae("folder-plus",Ar);const Nr=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Qe=ae("folder",Nr);const Ir=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],jr=ae("hard-drive",Ir);const Br=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Or=ae("link",Br);const Pr=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Ss=ae("list-tree",Pr);const Hr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Cs=ae("loader-circle",Hr);const Fr=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Wr=ae("log-out",Fr);const $r=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],zr=ae("moon",$r);const Ur=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qr=ae("play",Ur);const Kr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],mt=ae("plus",Kr);const Vr=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],pt=ae("refresh-cw",Vr);const Gr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ys=ae("search",Gr);const Xr=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yr=ae("settings",Xr);const Jr=[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],Qr=ae("square-split-horizontal",Jr);const Zr=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ei=ae("star",Zr);const ti=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],si=ae("sun",ti);const ri=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Yt=ae("target",ri);const ii=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ht=ae("upload",ii);const ni=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],oi=ae("users",ni);const ai=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Jt=ae("zap",ai);function wt(c,_){const[k,T]=W.useState(()=>{const O=localStorage.getItem(c);if(!O)return _;try{return JSON.parse(O)}catch{return _}});return W.useEffect(()=>{localStorage.setItem(c,JSON.stringify(k))},[c,k]),[k,T]}function de(...c){return c.filter(Boolean).join(" ")}function st(c){return c==null||Number.isNaN(c)?"-":c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:c<1024*1024*1024?`${(c/(1024*1024)).toFixed(1)} MB`:`${(c/(1024*1024*1024)).toFixed(1)} GB`}function li(c){if(c==null||Number.isNaN(c))return"-";const _=new Date(c);if(Number.isNaN(_.getTime()))return"-";const k=String(_.getFullYear()),T=String(_.getMonth()+1).padStart(2,"0"),O=String(_.getDate()).padStart(2,"0"),H=String(_.getHours()).padStart(2,"0"),A=String(_.getMinutes()).padStart(2,"0"),r=String(_.getSeconds()).padStart(2,"0");return`${k}-${T}-${O} ${H}:${A}:${r}`}function ci(c){return c.directory?"drwxr-xr-x":"-rw-r--r--"}function ws(c){c.sort((_,k)=>{const T=_.connection?.pinned??!1,O=k.connection?.pinned??!1;return T!==O?T?-1:1:_.order-k.order||_.name.localeCompare(k.name)}),c.forEach(_=>ws(_.children))}function Pt(c){return c.slice().sort((_,k)=>_.pinned!==k.pinned?_.pinned?-1:1:_.name.localeCompare(k.name))}function ks(c,_){return`${c}-${_}`}function Ht(c,_,k,T){return{id:ks("connection",String(c.id)),type:"connection",name:c.name,parentId:_,order:k,connectionId:c.id,createdAt:T,updatedAt:T}}function Es(c,_){return!_||!c?!1:c.nodes.some(k=>k.id===_&&k.type==="folder")}function xt(c,_){return Es(c,_)?_:null}function vt(c,_,k){const T=c.filter(O=>O.id!==k&&(O.parentId??null)===_).map(O=>O.order);return(T.length?Math.max(...T):-1)+1}function Ft(c,_){return c?.nodes.find(k=>k.type==="connection"&&k.connectionId===_)??null}function Ls(c,_){const k=new Map(_.map(A=>[A.id,A])),T=c?.nodes??[];if(T.length===0)return Pt(_).map((A,r)=>({id:`connection-${A.id}`,type:"connection",name:A.name,order:r,parentId:null,connection:A,children:[]}));const O=new Map;for(const A of T)O.set(A.id,{id:A.id,type:A.type,name:A.type==="connection"&&A.connectionId?k.get(A.connectionId)?.name??A.name:A.name,order:A.order,parentId:A.parentId,expanded:A.expanded,connection:A.connectionId?k.get(A.connectionId):void 0,children:[]});const H=[];for(const A of T){const r=O.get(A.id);r&&(A.type==="connection"&&A.connectionId&&!r.connection||(A.parentId&&O.has(A.parentId)?O.get(A.parentId).children.push(r):H.push(r)))}return ws(H),H}function dt(c){const _=Date.now();return{nodes:Pt(c).map((k,T)=>Ht(k,null,T,_)),sortMode:"manual"}}function Qt(c,_){if(!c)return dt(_);const k=new Map(_.map(h=>[h.id,h])),T=new Set,O=[];for(const h of c.nodes){if(h.type==="folder"){O.push(h);continue}if(!h.connectionId||T.has(h.connectionId))continue;const p=k.get(h.connectionId);p&&(O.push({...h,name:p.name}),T.add(h.connectionId))}const H={nodes:O.map(h=>({...h,parentId:h.parentId&&Es({nodes:O},h.parentId)?h.parentId:null})),sortMode:c.sortMode??"manual"},A=Pt(_).filter(h=>!T.has(h.id));if(A.length===0)return H;const r=Date.now(),n=H.nodes.slice();return A.forEach(h=>{n.push(Ht(h,null,vt(n,null),r))}),{...H,nodes:n}}function hi(c,_){return c&&{...c,nodes:c.nodes.map(k=>k.id===_&&k.type==="folder"?{...k,expanded:!k.expanded,updatedAt:Date.now()}:k)}}function di(c,_){if(!c)return c;const k=Date.now();return{...c,nodes:c.nodes.map(T=>T.type==="folder"?{...T,expanded:_,updatedAt:k}:T)}}function ui(c,_){const k=[],T=(O,H)=>{O.forEach(A=>{A.type==="folder"&&(k.push({id:A.id,name:A.name,depth:H}),T(A.children,H+1))})};return T(Ls(c,_),0),k}function Zt(c,_){if(!c||!_)return null;const k=c.nodes.find(T=>T.id===_);return k?k.type==="folder"?k.id:xt(c,k.parentId??null):null}function fi(c,_){return Ft(c,_)?.id??null}function _i(c,_){return xt(c,Ft(c,_)?.parentId??null)}function mi(c,_,k){const T=Date.now(),O=xt(c,k),H=ks("folder",globalThis.crypto?.randomUUID?.()??String(T)),A={id:H,type:"folder",name:_,parentId:O,order:vt(c.nodes,O),expanded:!0,createdAt:T,updatedAt:T};return{layout:{...c,nodes:[...c.nodes,A],sortMode:c.sortMode??"manual"},nodeId:H}}function pi(c,_,k){const T=Date.now(),O=xt(c,k),H=Ft(c,_.id);if(!H)return{...c,nodes:[...c.nodes,Ht(_,O,vt(c.nodes,O),T)],sortMode:c.sortMode??"manual"};const A=H.parentId===O?H.order:vt(c.nodes,O,H.id);return{...c,nodes:c.nodes.map(r=>r.id===H.id?{...r,name:_.name,parentId:O,order:A,updatedAt:T}:r),sortMode:c.sortMode??"manual"}}function vi(c,_,k){if(!c)return c;const T=k.trim();if(!T)return c;const O=Date.now();return{...c,nodes:c.nodes.map(H=>H.id===_?{...H,name:T,updatedAt:O}:H),sortMode:c.sortMode??"manual"}}function gi(c,_){if(!c)return null;if(!c.nodes.some(r=>r.id===_))return{layout:c,deletedConnectionIds:[],deletedNodeIds:[]};const T=new Map;c.nodes.forEach(r=>{if(!r.parentId)return;const n=T.get(r.parentId)??[];n.push(r.id),T.set(r.parentId,n)});const O=new Set,H=[_];for(;H.length>0;){const r=H.pop();if(!r||O.has(r))continue;O.add(r),(T.get(r)??[]).forEach(h=>H.push(h))}const A=c.nodes.flatMap(r=>O.has(r.id)&&r.type==="connection"&&r.connectionId?[r.connectionId]:[]);return{layout:{...c,nodes:c.nodes.filter(r=>!O.has(r.id)),sortMode:c.sortMode??"manual"},deletedConnectionIds:A,deletedNodeIds:Array.from(O)}}function bi(c){return _e.get("/sftp/pwd",{params:{connectionId:c}})}function xi(c,_){return _e.get("/sftp/list",{params:{connectionId:c,path:_||"."}})}async function es(c,_,k){const T=localStorage.getItem("token"),O=new URLSearchParams({connectionId:String(c),path:_}),H=await fetch(`/api/sftp/download?${O.toString()}`,{headers:T?{Authorization:`Bearer ${T}`}:{}});if(!H.ok)throw new Error("Download failed");const A=await H.blob(),r=URL.createObjectURL(A),n=document.createElement("a");n.href=r,n.download=k||_.split("/").pop()||"download",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function Ds(c,_,k,T){const O=new FormData;return O.append("file",k,k.name),_e.post("/sftp/upload",O,{params:{connectionId:c,path:_,overwrite:T?.overwrite??!1}})}function Rs(c,_){const k=localStorage.getItem("token"),T=new EventSource(`/api/sftp/upload/tasks/${encodeURIComponent(c)}/progress?token=${encodeURIComponent(k||"")}`);return T.addEventListener("progress",O=>{_(JSON.parse(O.data))}),T.addEventListener("error",()=>{T.close()}),()=>T.close()}function Si(c,_){return _e.post("/sftp/mkdir",null,{params:{connectionId:c,path:_}})}function ts(c,_,k){return _e.delete("/sftp/delete",{params:{connectionId:c,path:_,directory:k}})}function Ci(c,_,k,T){return _e.post("/sftp/transfer-remote/tasks",null,{params:{sourceConnectionId:c,sourcePath:_,targetConnectionId:k,targetPath:T}})}function yi(c,_){const k=localStorage.getItem("token"),T=new EventSource(`/api/sftp/transfer-remote/tasks/${encodeURIComponent(c)}/progress?token=${encodeURIComponent(k||"")}`);return T.addEventListener("progress",O=>{_(JSON.parse(O.data))}),T.addEventListener("error",()=>{T.close()}),()=>T.close()}function wi(c){return _e.delete(`/sftp/transfer-remote/tasks/${encodeURIComponent(c)}`)}function ki(c,_){return _e.get("/sftp/read",{params:{connectionId:c,path:_}})}function Ei(c,_,k){return _e.post("/sftp/write",{content:k},{params:{connectionId:c,path:_}})}function Li(c,_,k){return _e.post("/sftp/compress",null,{params:{connectionId:c,path:_,format:k}})}function Di(c,_,k){return _e.post("/sftp/decompress",null,{params:{connectionId:c,path:_,targetDir:"/tmp"}})}function Ri(){return _e.get("/connections/export/config",{responseType:"text"})}function Ti(){return _e.get("/session-tree")}function ss(c){return _e.put("/session-tree",c)}function Ai(){return _e.get("/snippets")}function Mi(c,_,k){return _e.post("/snippets",{name:c,command:_,description:k})}function Ni(c){return _e.delete(`/snippets/${c}`)}const Ii={unknown:{dot:"bg-content-dim",label:"未检测",text:"text-content-dim"},checking:{dot:"bg-amber-400",label:"检测中",text:"text-amber-300"},online:{dot:"bg-emerald-500 shadow-[0_0_4px_rgba(16,185,129,0.5)]",label:"在线",text:"text-emerald-500/80"},offline:{dot:"bg-content-dim",label:"离线",text:"text-content-dim"}};function ji({open:c,connections:_,connectionStatuses:k,connectionStatusDetails:T,onRefreshStatuses:O,statusError:H,statusLoading:A,onClose:r}){const[n,h]=W.useState(()=>_.slice(0,2).map(j=>j.id)),[p,o]=W.useState(`df -h -free -m`),[f,g]=W.useState(!1),[v,m]=W.useState([]),[e,s]=W.useState(null),[t,i]=W.useState([]),[l,u]=W.useState(!1),[b,x]=W.useState(""),[d,S]=W.useState(!1);W.useEffect(()=>{c&&Ai().then(j=>i(j.data)).catch(()=>{})},[c]);async function R(){if(!(!p.trim()||!b.trim())){S(!0);try{const j=await Mi(b.trim(),p);i(P=>[j.data,...P]),x(""),S(!1)}catch{S(!1)}}}async function N(j){try{await Ni(j),i(P=>P.filter(C=>C.id!==j))}catch{}}const y=W.useMemo(()=>({total:n.length,success:v.filter(j=>j.success).length,failure:v.filter(j=>!j.success).length}),[v,n.length]),E=W.useMemo(()=>_.filter(j=>k[j.id]==="online").map(j=>j.id),[k,_]),D=W.useMemo(()=>_.filter(j=>k[j.id]==="offline").length,[k,_]);if(W.useEffect(()=>{h(j=>j.filter(P=>_.some(C=>C.id===P)&&k[P]==="online"))},[k,_]),!c)return null;async function B(){const j=n.filter(P=>k[P]==="online");if(!(!j.length||!p.trim())){g(!0),s(null);try{const P=await tr(j,p);m(P.data.results)}catch(P){const C=P.response?.data?.message||"批量执行失败";s(C)}finally{g(!1)}}}return a.jsx(Fe,{title:"批量执行命令",onClose:r,maxWidth:"max-w-6xl",children:a.jsxs("div",{className:"flex h-[70vh] overflow-hidden rounded-2xl border border-border-main bg-surface-app",children:[a.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border-main bg-surface-panel/70",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border-main px-4 py-3 text-sm text-content-muted",children:[a.jsxs("span",{children:["目标主机 (",n.length,")"]}),a.jsxs("div",{className:"flex gap-3 text-xs",children:[a.jsx("button",{className:"text-blue-400 disabled:text-content-dim",disabled:A,onClick:()=>h(E),children:"全选"}),a.jsx("button",{className:"text-content-muted hover:text-content-main transition",onClick:()=>h([]),children:"清空"}),a.jsxs("button",{className:"flex items-center gap-1 text-content-muted transition hover:text-content-main disabled:text-content-dim",disabled:A||_.length===0,onClick:()=>{O().catch(()=>{})},children:[a.jsx(pt,{size:12,className:A?"animate-spin":""}),"刷新"]})]})]}),a.jsxs("div",{className:"border-b border-border-main px-4 py-2 text-xs text-content-dim",children:["在线 ",E.length," / 离线 ",D," / 总数 ",_.length]}),a.jsx("div",{className:"flex-1 space-y-1 overflow-auto p-2",children:_.map(j=>{const P=n.includes(j.id),C=k[j.id]??"unknown",L=Ii[C],M=T[j.id],I=C!=="online";return a.jsxs("label",{title:M?.message||L.label,className:`flex items-center gap-2 rounded-xl px-3 py-2 transition ${I?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-surface-muted"}`,children:[a.jsx("input",{type:"checkbox",disabled:I,checked:P,onChange:()=>h(z=>P?z.filter(K=>K!==j.id):[...z,j.id])}),a.jsxs("div",{className:"relative shrink-0",children:[a.jsx(Ot,{size:14,className:P&&!I?"text-blue-400":"text-content-dim"}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-surface-app ${L.dot}`})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"truncate text-sm text-content-muted",children:j.name}),a.jsx("div",{className:`text-[10px] ${L.text}`,children:L.label})]})]},j.id)})})]}),a.jsxs("div",{className:"flex flex-1 flex-col",children:[a.jsx("div",{className:"border-b border-border-main bg-surface-panel px-4 py-4",children:a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-muted",children:[a.jsx(lt,{size:14,className:"text-emerald-400"}),"批量执行脚本",t.length>0?a.jsx("span",{className:"ml-2 flex items-center gap-1",children:a.jsxs("button",{onClick:()=>u(!l),className:"inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[10px] text-content-muted transition hover:text-content-main",style:{background:"rgba(148,163,184,0.06)"},children:[a.jsx(hr,{size:10}),"片段库"]})}):null]}),a.jsxs("div",{className:"relative",children:[a.jsx("textarea",{rows:5,className:"w-full resize-none rounded-2xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-emerald-300 outline-none focus:border-blue-500",value:p,onChange:j=>o(j.target.value)}),l&&t.length>0&&a.jsx("div",{className:"absolute bottom-1 left-1 right-1 z-10 max-h-32 overflow-auto rounded-xl border border-border-main bg-surface-panel p-1 shadow-xl",style:{top:"auto",transform:"translateY(-105%)"},children:t.map(j=>a.jsxs("div",{className:"group flex items-center rounded-lg px-2 py-1.5 text-xs transition hover:bg-surface-muted",children:[a.jsxs("button",{className:"flex-1 text-left text-content-muted truncate",onClick:()=>{o(j.command),u(!1)},children:[a.jsx("span",{className:"font-medium text-content-main",children:j.name}),j.description?a.jsx("span",{className:"ml-2 text-content-dim",children:j.description}):null]}),a.jsx("button",{onClick:()=>{N(j.id)},className:"ml-1 rounded p-0.5 text-content-dim opacity-0 transition hover:text-red-400 group-hover:opacity-100",children:a.jsx(_t,{size:10})})]},j.id))})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx("input",{placeholder:"保存为片段...",className:"w-36 rounded-lg border border-border-main bg-surface-muted px-3 py-2.5 text-xs text-content-main outline-none placeholder:text-content-dim",value:b,onChange:j=>x(j.target.value),onKeyDown:j=>{j.key==="Enter"&&R()}}),b.trim()&&p.trim()?a.jsx("button",{onClick:()=>{R()},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-cyan-400 hover:text-cyan-300",children:a.jsx(mt,{size:14})}):null]}),a.jsxs("button",{className:"flex h-[46px] items-center gap-2 rounded-xl bg-blue-600 px-6 text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:f||A||n.filter(j=>k[j]==="online").length===0,onClick:()=>{B()},children:[f?a.jsx(pt,{size:16,className:"animate-spin"}):a.jsx(qr,{size:16,fill:"currentColor"}),f?"执行中...":"开始执行"]})]})]})}),a.jsxs("div",{className:"flex gap-6 border-b border-border-main bg-surface-muted/60 px-4 py-2 text-sm",children:[a.jsxs("span",{className:"text-content-muted",children:["总数: ",y.total]}),a.jsxs("span",{className:"font-medium text-emerald-400",children:["成功: ",y.success]}),a.jsxs("span",{className:"font-medium text-red-400",children:["失败: ",y.failure]})]}),a.jsxs("div",{className:"flex-1 space-y-4 overflow-auto p-4",children:[H?a.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-4 py-3 text-sm text-amber-200",children:H}):null,e?a.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:e}):null,!v.length&&!e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-content-dim",children:[a.jsx(xs,{size:48,className:"mb-3 text-border-main"}),a.jsx("p",{children:A?"正在检测主机状态...":"请在上方输入命令并点击执行"})]}):null,v.map(j=>a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle bg-surface-panel/80 px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[j.success?a.jsx(bt,{size:16,className:"text-emerald-500"}):a.jsx(mr,{size:16,className:"text-red-500"}),a.jsx("span",{className:"text-sm font-medium text-content-main",children:j.connectionName})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-dim",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(vr,{size:12}),j.durationMs,"ms"]}),a.jsxs("button",{className:"flex items-center gap-1 transition hover:text-content-muted",onClick:()=>navigator.clipboard.writeText(j.output||j.error||""),children:[a.jsx(xr,{size:12}),"复制输出"]})]})]}),a.jsx("pre",{className:`overflow-auto bg-surface-muted/20 p-4 text-xs leading-relaxed ${j.success?"text-content-muted":"text-red-400"}`,children:j.output||j.error||""})]},j.connectionId))]})]})]})})}function Bi({force:c,onClose:_}){const{changePassword:k}=gs(),[T,O]=W.useState(""),[H,A]=W.useState(""),[r,n]=W.useState(""),[h,p]=W.useState(!1),[o,f]=W.useState(null);async function g(){if(H!==r){f("两次输入的新密码不一致");return}p(!0),f(null);try{await k(T,H),_()}catch(v){const m=v.response?.data?.message||"修改密码失败";f(m)}finally{p(!1)}}return a.jsx(Fe,{title:"首次登录 - 请修改密码",onClose:c?void 0:_,maxWidth:"max-w-lg",footer:a.jsxs(a.Fragment,{children:[c?null:a.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:_,children:"取消"}),a.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:h,onClick:g,children:h?"提交中...":"确认修改"})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-2xl border border-blue-500/25 bg-blue-500/10 p-4 text-sm text-blue-400",children:"为了您的资产安全,系统要求首次登录的管理员必须修改默认密码。"}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"原密码"}),a.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:T,onChange:v=>O(v.target.value)})]}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"新密码"}),a.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:H,onChange:v=>A(v.target.value)})]}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"确认新密码"}),a.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:r,onChange:v=>n(v.target.value)})]}),o?a.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:o}):null]})})}const rs={name:"",host:"",port:22,username:"root",authType:"PASSWORD",password:"",privateKey:"",passphrase:"",setupMode:"NONE",bootstrapPassword:""};function Oi({open:c,connection:_,folderOptions:k,initialTargetFolderId:T,onClose:O,onSubmit:H}){const[A,r]=W.useState(rs),[n,h]=W.useState(null),[p,o]=W.useState(!1),[f,g]=W.useState(null);if(W.useEffect(()=>{c&&(r(_?{name:_.name,host:_.host,port:_.port,username:_.username,authType:_.authType,password:"",privateKey:"",passphrase:"",setupMode:"NONE",bootstrapPassword:""}:rs),h(T),g(null))},[_,T,c]),!c)return null;const v=A.setupMode==="PASSWORD_BOOTSTRAP",m=A.authType==="PASSWORD";async function e(){o(!0),g(null);try{await H({...A,port:Number(A.port||22),targetFolderId:n})}catch(s){const t=s.response?.data?.message||"保存连接失败";g(t)}finally{o(!1)}}return a.jsxs(Fe,{title:_?"编辑 SSH 连接":"新建 SSH 连接",onClose:O,maxWidth:"max-w-2xl",footer:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:O,children:"取消"}),a.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:p,onClick:e,children:p?"保存中...":_?"保存修改":"保存并连接"})]}),children:[a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"连接名称"}),a.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:prod-web-01",value:A.name,onChange:s=>r(t=>({...t,name:s.target.value}))})]}),a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"分组 / 父文件夹"}),a.jsxs("select",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:n??"__ROOT__",onChange:s=>h(s.target.value==="__ROOT__"?null:s.target.value),children:[a.jsx("option",{value:"__ROOT__",children:"根目录"}),k.map(s=>a.jsx("option",{value:s.id,children:`${"— ".repeat(s.depth)}${s.name}`},s.id))]})]})]}),a.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-[minmax(0,1.4fr)_120px_minmax(0,1fr)]",children:[a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"主机 IP"}),a.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.host,onChange:s=>r(t=>({...t,host:s.target.value}))})]}),a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"端口"}),a.jsx("input",{type:"number",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.port??22,onChange:s=>r(t=>({...t,port:Number(s.target.value)}))})]}),a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"用户名"}),a.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.username,onChange:s=>r(t=>({...t,username:s.target.value}))})]})]}),a.jsxs("div",{className:"mt-6 rounded-[28px] border border-border-main bg-surface-muted/30 p-5",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"text-sm font-medium text-content-main",children:"认证方式"}),a.jsx("div",{className:"mt-1 text-xs text-content-dim",children:"保留现有密码、私钥和一键免密部署能力。"})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${m?"border-blue-500 bg-blue-500/10 text-blue-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PASSWORD",setupMode:s.setupMode==="PASSWORD_BOOTSTRAP"?"PASSWORD_BOOTSTRAP":"NONE"})),children:"密码认证"}),a.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${A.authType==="PRIVATE_KEY"?"border-blue-500 bg-blue-500/10 text-blue-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PRIVATE_KEY",setupMode:"NONE"})),children:"私钥认证"}),a.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${v?"border-emerald-500 bg-emerald-500/10 text-emerald-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PASSWORD",setupMode:s.setupMode==="PASSWORD_BOOTSTRAP"?"NONE":"PASSWORD_BOOTSTRAP"})),children:"一键免密部署"})]}),A.authType==="PASSWORD"?a.jsxs("label",{className:"block mt-4 space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:v?"引导密码":"密码"}),a.jsx("input",{type:"password",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:v?A.bootstrapPassword??"":A.password??"",onChange:s=>r(t=>v?{...t,bootstrapPassword:s.target.value}:{...t,password:s.target.value})})]}):a.jsxs("div",{className:"mt-4 space-y-4",children:[a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"私钥内容"}),a.jsx("textarea",{rows:6,className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-content-main outline-none focus:border-blue-500",value:A.privateKey??"",onChange:s=>r(t=>({...t,privateKey:s.target.value}))})]}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"私钥口令"}),a.jsx("input",{type:"password",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.passphrase??"",onChange:s=>r(t=>({...t,passphrase:s.target.value}))})]})]})]}),f?a.jsx("div",{className:"mt-4 rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:f}):null]})}function Pi({open:c,folderOptions:_,initialParentId:k,onClose:T,onSubmit:O}){const[H,A]=W.useState(""),[r,n]=W.useState(null),[h,p]=W.useState(!1),[o,f]=W.useState(null);if(W.useEffect(()=>{c&&(A(""),n(k),p(!1),f(null))},[k,c]),!c)return null;async function g(){const v=H.trim();if(!v){f("请输入文件夹名称");return}p(!0),f(null);try{await O({name:v,parentId:r}),T()}catch(m){const e=m.response?.data?.message||"创建文件夹失败";f(e)}finally{p(!1)}}return a.jsx(Fe,{title:"新建文件夹",onClose:T,maxWidth:"max-w-lg",footer:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:T,children:"取消"}),a.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:h,onClick:g,children:h?"创建中...":"创建文件夹"})]}),children:a.jsxs("div",{className:"space-y-5",children:[a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"文件夹名称"}),a.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:生产环境",value:H,onChange:v=>A(v.target.value)})]}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"父级目录(可选)"}),a.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:r??"__ROOT__",onChange:v=>n(v.target.value==="__ROOT__"?null:v.target.value),children:[a.jsx("option",{value:"__ROOT__",children:"根目录"}),_.map(v=>a.jsx("option",{value:v.id,children:`${"— ".repeat(v.depth)}${v.name}`},v.id))]})]}),o?a.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:o}):null]})})}function Hi({open:c,initialName:_,onClose:k,onSubmit:T}){const[O,H]=W.useState(""),[A,r]=W.useState(!1),[n,h]=W.useState(null);if(W.useEffect(()=>{c&&(H(_),r(!1),h(null))},[_,c]),!c)return null;async function p(){const o=O.trim();if(!o){h("请输入文件夹名称");return}if(o===_){k();return}r(!0),h(null);try{await T(o),k()}catch(f){const g=f.response?.data?.message||"重命名文件夹失败";h(g)}finally{r(!1)}}return a.jsx(Fe,{title:"重命名文件夹",onClose:k,maxWidth:"max-w-md",footer:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:k,children:"取消"}),a.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:A,onClick:p,children:A?"保存中...":"保存"})]}),children:a.jsxs("div",{className:"space-y-5",children:[a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"文件夹名称"}),a.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:生产环境",value:O,onChange:o=>H(o.target.value),autoFocus:!0,onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),p())}})]}),n?a.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:n}):null]})})}const Fi={unknown:{dot:"bg-content-dim",label:"未检测",text:"text-content-dim"},checking:{dot:"bg-amber-400",label:"检测中",text:"text-amber-300"},online:{dot:"bg-emerald-500",label:"在线",text:"text-emerald-400"},offline:{dot:"bg-red-500",label:"离线",text:"text-red-400"}};function Ts(c,_){if(!_)return!0;const k=_.toLowerCase();return c.name.toLowerCase().includes(k)?!0:c.children.some(T=>Ts(T,_))}function As({node:c,depth:_,activeConnectionId:k,connectionStatuses:T,openConnectionIds:O,selectedNodeId:H,search:A,onSelectNode:r,onToggleFolder:n,onOpenConnection:h,onContextMenu:p,onTogglePin:o}){function f(t,i){t.preventDefault(),t.stopPropagation(),p({nodeId:c.id,nodeType:i,x:t.clientX,y:t.clientY})}if(!Ts(c,A))return null;if(c.type==="folder"){const t=c.expanded??!0,i=H===c.id;return a.jsxs("div",{children:[a.jsxs("button",{className:de("flex w-full items-center gap-2 rounded-xl px-2 py-2 text-left text-sm transition",i?"bg-surface-muted text-content-main ring-1 ring-inset ring-border-main":"text-content-muted hover:bg-surface-muted"),onClick:()=>{r(c.id),n(c.id)},onContextMenu:l=>f(l,"folder"),style:{paddingLeft:8+_*16},children:[t?a.jsx(ct,{size:14,className:"text-content-dim"}):a.jsx(bs,{size:14,className:"text-content-dim"}),a.jsx(Qe,{size:15,className:t?"text-blue-400":"text-content-dim"}),a.jsx("span",{className:"truncate",children:c.name})]}),t?a.jsx("div",{className:"space-y-1",children:c.children.map(l=>a.jsx(As,{node:l,depth:_+1,activeConnectionId:k,connectionStatuses:T,openConnectionIds:O,selectedNodeId:H,search:A,onSelectNode:r,onToggleFolder:n,onOpenConnection:h,onContextMenu:p,onTogglePin:o},l.id))}):null]})}if(!c.connection)return null;const g=H===c.id,v=k===c.connection.id,m=O.includes(c.connection.id),e=T?.[c.connection.id]??"unknown",s=Fi[e];return a.jsxs("button",{className:de("group flex w-full items-center gap-2 rounded-xl px-2 py-2 text-left text-sm transition",v?"bg-blue-600/20 text-blue-200 ring-1 ring-inset ring-blue-500/40":g?"bg-surface-muted text-content-main ring-1 ring-inset ring-border-main":m?"text-emerald-200 hover:bg-surface-muted":"text-content-muted hover:bg-surface-muted hover:text-content-main"),onDoubleClick:()=>h(c.connection,c.id),onClick:()=>{r(c.id),m&&!v&&h(c.connection,c.id)},onContextMenu:t=>f(t,"connection"),style:{paddingLeft:24+_*16},children:[a.jsxs("div",{className:"relative shrink-0",children:[a.jsx(Ot,{size:14,className:v?"text-blue-300":m?"text-emerald-400":"text-content-dim"}),a.jsx("span",{className:de("absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-surface-panel",s.dot)})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate",children:c.connection.name}),a.jsx("div",{className:de("text-[10px]",s.text),children:s.label})]}),a.jsx("button",{className:"shrink-0 rounded p-0.5 opacity-0 transition group-hover:opacity-100 hover:scale-110",onClick:t=>{t.stopPropagation(),o?.(c.connection.id)},title:c.connection.pinned?"取消置顶":"置顶",children:a.jsx(ei,{size:11,className:c.connection.pinned?"fill-amber-400 text-amber-400":"text-content-dim"})}),v?a.jsx("span",{className:"rounded-full border border-blue-500/30 bg-blue-500/10 px-2 py-0.5 text-[10px] text-blue-200",children:"当前"}):m?a.jsx("span",{className:"rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5 text-[10px] text-emerald-200",children:"已打开"}):a.jsx("span",{className:"hidden rounded bg-surface-app px-1.5 py-0.5 text-[10px] text-content-dim group-hover:inline-block",children:"双击连接"})]})}function Wi(c){return a.jsx("div",{className:"space-y-1",children:c.nodes.map(_=>a.jsx(As,{node:_,depth:0,...c},_.id))})}function $i(){return _e.get("/webhooks")}function zi(c,_){return _e.post("/webhooks",{url:c,eventType:_})}function Ui(c){return _e.delete(`/webhooks/${c}`)}function qi(c){return _e.post("/webhooks/test",{message:c})}function Ki(c,_){const k=c?.response?.data;return k?.message||k?.error||_}const Vi=[{label:"IBM Plex Mono",value:'"IBM Plex Mono", ui-monospace, monospace'},{label:"JetBrains Mono",value:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace'},{label:"Fira Code",value:'"Fira Code", "IBM Plex Mono", ui-monospace, monospace'},{label:"Source Code Pro",value:'"Source Code Pro", "IBM Plex Mono", ui-monospace, monospace'}];function Gi({open:c,terminalFontSize:_,terminalFontFamily:k,darkMode:T,onClose:O,onFontSizeChange:H,onFontFamilyChange:A,onDarkModeChange:r}){const[n,h]=W.useState("appearance"),[p,o]=W.useState([]),[f,g]=W.useState(""),[v,m]=W.useState(!1),[e,s]=W.useState(null),[t,i]=W.useState("");W.useEffect(()=>{c&&($i().then(x=>o(x.data)).catch(()=>{}),i(""))},[c]);const l=W.useCallback(async()=>{if(f.trim()){m(!0);try{const x=await zi(f.trim(),"*");o(d=>[...d,x.data]),g(""),i("已添加")}catch(x){i(Ki(x,"添加失败"))}m(!1)}},[f]),u=W.useCallback(async x=>{try{await Ui(x),o(d=>d.filter(S=>S.id!==x))}catch{}},[]),b=W.useCallback(async x=>{s(x);try{const d=p.find(S=>S.id===x);await qi(d?.url||"test"),i("测试已发送")}catch{i("测试失败")}s(null)},[p]);return c?a.jsxs(Fe,{title:"系统设置",onClose:O,maxWidth:"max-w-xl",children:[a.jsxs("div",{className:"flex gap-4 mb-4 border-b pb-3 border-border-subtle",children:[a.jsx("button",{onClick:()=>h("appearance"),className:`text-xs font-medium pb-1 ${n==="appearance"?"text-cyan-400 border-b border-cyan-400":"text-content-muted"}`,children:"外观"}),a.jsx("button",{onClick:()=>h("webhooks"),className:`text-xs font-medium pb-1 ${n==="webhooks"?"text-cyan-400 border-b border-cyan-400":"text-content-muted"}`,children:"Webhook"})]}),n==="appearance"?a.jsxs("div",{className:"space-y-6",children:[r?a.jsxs("div",{children:[a.jsx("div",{className:"mb-3 text-sm font-medium text-content-muted",children:"界面主题"}),a.jsx("div",{className:"flex gap-3",children:[{mode:!1,label:"浅色",icon:si,desc:"亮色界面"},{mode:!0,label:"暗色",icon:zr,desc:"深色界面"}].map(x=>a.jsxs("button",{onClick:()=>r(x.mode),className:`flex flex-1 items-center gap-3 rounded-xl border px-4 py-3 text-sm transition ${T===x.mode?"border-cyan-500/40 bg-cyan-500/10 text-cyan-400":"border-border-main bg-surface-muted text-content-muted hover:border-border-subtle"}`,children:[a.jsx(x.icon,{size:18}),a.jsxs("div",{className:"text-left",children:[a.jsx("div",{className:"font-medium text-content-main",children:x.label}),a.jsx("div",{className:"text-[11px] text-content-dim",children:x.desc})]})]},x.label))})]}):null,a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-content-muted",children:"终端字号"}),a.jsxs("span",{className:"text-content-dim",children:[_,"px"]})]}),a.jsx("input",{type:"range",min:11,max:22,value:_,onChange:x=>H(Number(x.target.value)),className:"w-full h-1.5 accent-cyan-500 bg-surface-muted rounded-lg appearance-none"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-sm font-medium text-content-muted",children:"终端字体"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Vi.map(x=>a.jsx("button",{onClick:()=>A(x.value),className:`rounded-lg px-3.5 py-2 text-xs transition ${k===x.value?"border border-cyan-400/30 bg-cyan-500/10 text-cyan-400":"border-border-main bg-surface-muted text-content-muted hover:border-border-subtle"}`,style:{fontFamily:x.value},children:x.label},x.label))})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"text-xs text-content-dim",children:"Webhook URL 将在连接创建/删除等事件触发时发送通知(支持钉钉、飞书、Slack 等)"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"input-cyber flex-1 bg-surface-muted border-border-main text-content-main",placeholder:"https://hooks.example.com/webhook",value:f,onChange:x=>g(x.target.value),onKeyDown:x=>{x.key==="Enter"&&l()}}),a.jsxs("button",{onClick:()=>{l()},disabled:v||!f.trim(),className:"btn-cyber-primary",children:[a.jsx(mt,{size:14}),"添加"]})]}),p.length===0?a.jsx("div",{className:"py-8 text-center text-xs text-content-muted",children:"暂无配置,输入 URL 后点击添加"}):a.jsx("div",{className:"space-y-2",children:p.map(x=>a.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-surface-muted/40 border border-border-subtle",children:[a.jsx(Or,{size:12,className:"text-cyan-400"}),a.jsx("span",{className:"flex-1 truncate text-xs text-content-muted",children:x.url}),a.jsx("button",{onClick:()=>{b(x.id)},className:"rounded p-1 text-content-dim hover:text-content-main transition",title:"发送测试",children:e===x.id?a.jsx(Cs,{size:12,className:"animate-spin"}):a.jsx(bt,{size:12})}),a.jsx("button",{onClick:()=>{u(x.id)},className:"rounded p-1 text-content-dim hover:text-red-400 transition",children:a.jsx(_t,{size:12})})]},x.id))}),t?a.jsx("div",{className:"text-xs text-cyan-400",children:t}):null]})]}):null}function is(c,_){const k=c?.response?.data;return k?.message||k?.error||_}function Xi({open:c,connectionId:_,filePath:k,onClose:T}){const[O,H]=W.useState(""),[A,r]=W.useState(!1),[n,h]=W.useState(!1),[p,o]=W.useState(null),[f,g]=W.useState(!1),[v,m]=W.useState(!1);W.useEffect(()=>{!c||!k||(r(!0),o(null),g(!1),m(!1),ki(_,k).then(t=>{H(t.data.content),r(!1)}).catch(t=>{o(is(t,"加载文件失败")),r(!1)}))},[_,k,c]);async function e(){h(!0),o(null),g(!1);try{await Ei(_,k,O),g(!0),m(!1),setTimeout(()=>g(!1),2e3)}catch(t){o(is(t,"保存失败"))}finally{h(!1)}}const s=k.split("/").pop()||k;return a.jsx(Fe,{title:`编辑: ${s}`,onClose:T,maxWidth:"max-w-5xl",footer:a.jsxs("div",{className:"flex items-center gap-3 w-full",children:[a.jsx("div",{className:"flex-1 text-xs",style:{color:"#475569"},children:k}),p?a.jsx("span",{className:"text-xs text-red-400",children:p}):null,f?a.jsx("span",{className:"text-xs text-emerald-400",children:"已保存 ✓"}):null,a.jsx("button",{onClick:T,className:"btn-cyber",children:"取消"}),a.jsx("button",{onClick:e,disabled:n||!v,className:"btn-cyber-primary",children:n?"保存中...":"保存"})]}),children:A?a.jsx("div",{className:"flex items-center justify-center py-20 text-sm",style:{color:"#64748b"},children:"加载中..."}):a.jsx("textarea",{className:"w-full h-[60vh] resize-none rounded-xl border p-4 font-mono text-sm outline-none",style:{background:"#0a0e1a",borderColor:"rgba(96, 165, 250, 0.12)",color:"#e2e8f0"},value:O,onChange:t=>{H(t.target.value),m(!0)},spellCheck:!1})})}function Yi({open:c,currentPath:_,onClose:k,onSubmit:T}){const O=W.useRef(null),[H,A]=W.useState(""),[r,n]=W.useState(!1),[h,p]=W.useState(null);if(W.useEffect(()=>{if(!c)return;A(""),n(!1),p(null);const g=window.setTimeout(()=>O.current?.focus(),0);return()=>window.clearTimeout(g)},[c]),!c)return null;async function o(){const g=H.trim();if(!g){p("请输入目录名称");return}n(!0),p(null);try{await T(g),k()}catch(v){const m=v.response?.data?.message||"创建目录失败";p(m)}finally{n(!1)}}function f(){r||k()}return a.jsx(Fe,{title:"新建目录",onClose:r?void 0:f,maxWidth:"max-w-md",footer:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:f,children:"取消"}),a.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:o,children:r?"创建中...":"确定"})]}),children:a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"rounded-2xl border border-border-main bg-surface-muted/50 px-4 py-3",children:[a.jsx("div",{className:"text-xs uppercase tracking-[0.24em] text-content-dim",children:"当前路径"}),a.jsx("div",{className:"mt-2 break-all font-mono text-sm text-content-main",children:_})]}),a.jsxs("label",{className:"block space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"目录名称"}),a.jsx("input",{ref:O,className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none transition focus:border-blue-500",placeholder:"例如:releases",value:H,onChange:g=>A(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),o())}})]}),h?a.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:h}):null]})})}function ns(c,_){const k=c?.response?.data;return k?.message||k?.error||_}const kt={visible:!1,fileName:"",fileType:"file",canOverwrite:!0,queueId:"",message:""};function Ms({connection:c,selectedFiles:_,onSelectedFilesChange:k,onRefreshSignal:T,selectionMode:O,onConfirmSelection:H}){const A=W.useRef(null),r=W.useRef(null),n=W.useRef(new Map),h=W.useRef(null),p=W.useRef(!1),[o,f]=W.useState("/"),[g,v]=W.useState([]),[m,e]=W.useState(!1),[s,t]=W.useState(null),[i,l]=W.useState(null),[u,b]=W.useState(""),[x,d]=W.useState(!1),[S,R]=W.useState(!1),[N,y]=W.useState([]),[E,D]=W.useState(!1),[B,j]=W.useState(null),[P,C]=W.useState(kt),[L,M]=W.useState(!1),[I,z]=W.useState("name"),[K,Y]=W.useState("asc"),[X,ne]=W.useState(null),[w,F]=W.useState(null),U=u.trim().toLowerCase(),q=W.useMemo(()=>g.filter($=>x||!$.name.startsWith(".")),[g,x]),ee=W.useMemo(()=>U?q.filter($=>$.name.toLowerCase().includes(U)):q,[q,U]),J=W.useMemo(()=>ee.slice().sort(($,G)=>{if($.directory!==G.directory)return $.directory?-1:1;const se=$.name.localeCompare(G.name,void 0,{numeric:!0,sensitivity:"base"});if(I==="name")return se!==0?K==="asc"?se:-se:K==="asc"?$.mtime-G.mtime:G.mtime-$.mtime;const ce=$.mtime-G.mtime;return ce!==0?K==="asc"?ce:-ce:se}),[ee,K,I]),oe=W.useMemo(()=>ee.filter($=>_.includes($.name)),[ee,_]),ue=W.useMemo(()=>ee.length>0&&oe.length===ee.length,[ee.length,oe.length]),he=W.useMemo(()=>N.filter($=>$.status==="queued"||$.status==="running").length,[N]),xe="sftp-upload-menu",ie=he>0?`上传,当前有 ${he} 个任务进行中`:"上传",ye=de("group flex h-9 min-w-0 shrink items-center overflow-hidden rounded-2xl border border-border-main bg-surface-control px-3 text-sm text-content-main shadow-[inset_0_1px_0_rgba(148,163,184,0.08)] transition-[flex-grow,flex-basis,border-color,box-shadow] duration-200 focus-within:border-blue-500/60 focus-within:shadow-[inset_0_1px_0_rgba(96,165,250,0.18)]",B==="path"?"basis-[70%] grow-[7]":B==="search"?"basis-[42%] grow-[21]":"basis-[60%] grow-[6]"),$e=de("group relative h-9 min-w-0 shrink overflow-hidden rounded-2xl border border-border-main bg-surface-control text-content-main shadow-[inset_0_1px_0_rgba(148,163,184,0.08)] transition-[flex-grow,flex-basis,border-color,box-shadow] duration-200 focus-within:border-blue-500/60 focus-within:shadow-[inset_0_1px_0_rgba(96,165,250,0.18)]",B==="search"?"basis-[58%] grow-[29]":B==="path"?"basis-[30%] grow-[3]":"basis-[40%] grow-[4]"),me=async $=>{e(!0),t(null);try{const G=$??o,se=await xi(c.id,G);v(se.data),f(G),k([])}catch(G){const se=G.response?.data?.error||"目录加载失败";t(se)}finally{e(!1)}};W.useEffect(()=>{let $=!1;return(async()=>{l(null),b(""),d(!1),y([]),D(!1),j(null),pe("cancel",!1),C(kt),M(!1),p.current=!1,z("name"),Y("asc"),n.current.forEach(G=>G()),n.current.clear();try{const G=await bi(c.id);$||(f(G.data.path),await me(G.data.path))}catch{$||await me("/")}})(),()=>{$=!0,pe("cancel",!1),p.current=!1,n.current.forEach(G=>G()),n.current.clear()}},[c.id]),W.useEffect(()=>{T?.(me)},[T]),W.useEffect(()=>{if(x)return;const $=new Set(g.filter(G=>G.name.startsWith(".")&&_.includes(G.name)).map(G=>G.name));$.size!==0&&k(_.filter(G=>!$.has(G)))},[g,k,_,x]),W.useEffect(()=>{if(!S)return;const $=G=>{r.current?.contains(G.target)||R(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[S]);function Se($,G){return $==="/"?`/${G}`:`${$.replace(/\/$/,"")}/${G}`}function we($,G){y(se=>se.map(ce=>ce.id===$?G(ce):ce))}function Ce($){const G=`${Date.now()}-${$.name}-${Math.random().toString(36).slice(2,8)}`;return y(se=>[{id:G,filename:$.name,status:"queued",progress:0,transferredBytes:0,totalBytes:$.size,message:"等待上传",createdAt:Date.now()},...se]),G}function Ae($){const G=$.response;return G?.status!==409||G.data?.code!=="SFTP_UPLOAD_CONFLICT"?null:G.data}function pe($,G=L){const se=h.current;h.current=null,C(kt),M(!1),se?.({action:$,applyToAll:G})}function Me($,G){return M(!1),C({visible:!0,fileName:$.fileName,fileType:$.conflictType,canOverwrite:$.canOverwrite,queueId:G,message:$.message}),new Promise(se=>{h.current=se})}async function Ne($,G){F(null);try{const se=Se(o,$.name),ce=await Li(c.id,se,G);F(ce.data.message),setTimeout(()=>F(null),4e3),await me()}catch(se){F(ns(se,"压缩失败"))}}async function ke($){F(null);try{const G=Se(o,$.name),se=await Di(c.id,G);F(se.data.message),setTimeout(()=>F(null),4e3),await me()}catch(G){F(ns(G,"解压失败"))}}async function ze(){const $=g.filter(G=>_.includes(G.name));await Promise.all($.map(G=>ts(c.id,Se(o,G.name),G.directory))),await me()}async function Le($){await Si(c.id,Se(o,$)),await me()}async function Be($,G,se,ce){const ge=(await Ds(c.id,G,$,{overwrite:ce})).data.taskId;we(se,ve=>({...ve,remoteTaskId:ge,status:"running",message:ce?"正在覆盖上传...":"正在上传..."}));const Ue=Rs(ge,ve=>{we(se,Oe=>({...Oe,remoteTaskId:ve.taskId,status:ve.status,progress:ve.progress,transferredBytes:ve.transferredBytes,totalBytes:ve.totalBytes,message:ve.error||(ve.status==="success"?"上传完成":"正在上传...")})),ve.status==="success"&&me(),(ve.status==="success"||ve.status==="error")&&(n.current.get(ge)?.(),n.current.delete(ge))});n.current.set(ge,Ue)}async function le($){if($.length===0)return;if(p.current){l("当前上传批次仍在处理中,请先完成冲突选择。");return}const G=o,se={applyToAll:!1,action:null};p.current=!0,M(!1),l(`已开始上传到 ${G}`);try{for(const ce of $){const De=Ce(ce);let ge=se.applyToAll&&se.action==="overwrite";for(;;)try{await Be(ce,G,De,ge);break}catch(Ue){const ve=Ae(Ue);if(!ve){const je=Ue.response?.data?.message||Ue.response?.data?.error||"上传失败";we(De,Ct=>({...Ct,status:"error",message:je}));break}we(De,je=>({...je,status:"queued",message:ve.canOverwrite?"等待冲突处理":"检测到同名文件夹,等待处理"}));let Oe;if(se.applyToAll&&se.action&&(se.action!=="overwrite"||ve.canOverwrite)?Oe={action:se.action,applyToAll:!0}:Oe=await Me(ve,De),Oe.action==="cancel"){se.applyToAll=!1,se.action=null,we(De,je=>({...je,status:"cancelled",message:"已取消上传"})),l("已取消当前上传批次,剩余文件未开始上传。");return}if(Oe.applyToAll?(se.applyToAll=!0,se.action=Oe.action):(se.applyToAll=!1,se.action=null),Oe.action==="skip"){we(De,je=>({...je,status:"skipped",message:"已跳过冲突文件"}));break}ge=!0,we(De,je=>({...je,status:"queued",message:"准备覆盖上传"}))}}}finally{p.current=!1,M(!1)}}function Ie(){R(!1),l("后端暂未支持文件夹上传,后续实现。")}function it($,G){const se=G.relatedTarget;se instanceof Node&&G.currentTarget.contains(se)||j(ce=>ce===$?null:ce)}function Ve($){if($===I){Y(G=>G==="asc"?"desc":"asc");return}z($),Y($==="mtime"?"desc":"asc")}function et($){return I!==$?"none":K==="asc"?"ascending":"descending"}function St(){y($=>$.filter(G=>G.status==="queued"||G.status==="running"))}return a.jsxs("div",{className:"relative flex h-full flex-col bg-surface-app",children:[a.jsx("input",{ref:A,type:"file",multiple:!0,className:"hidden",onChange:$=>{const G=Array.from($.target.files??[]);le(G),$.currentTarget.value=""}}),a.jsxs("div",{className:"flex min-h-14 flex-nowrap items-center gap-2 border-b border-border-main bg-surface-panel px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[a.jsx("button",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main disabled:cursor-not-allowed disabled:opacity-40",onClick:()=>{if(o==="/")return;const $=o.split("/").slice(0,-1).join("/")||"/";me($)},disabled:o==="/",title:"返回上级目录","aria-label":"返回上级目录",children:a.jsx(bs,{className:"rotate-180",size:16})}),a.jsxs("div",{className:ye,onFocusCapture:()=>j("path"),onBlurCapture:$=>it("path",$),children:[a.jsx(Qe,{size:14,className:"mr-2 shrink-0 text-blue-400 transition-colors group-focus-within:text-blue-300"}),a.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-content-dim",value:o,onChange:$=>f($.target.value),onKeyDown:$=>{$.key==="Enter"&&me(o)}})]}),a.jsxs("div",{className:$e,onFocusCapture:()=>j("search"),onBlurCapture:$=>it("search",$),children:[a.jsx(ys,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-content-dim transition-colors group-focus-within:text-blue-400"}),a.jsx("input",{type:"text",placeholder:"搜索文件...",value:u,onChange:$=>b($.target.value),className:"h-full w-full min-w-0 bg-transparent py-2 pl-9 pr-8 text-xs text-content-main outline-none placeholder:text-content-dim"}),u?a.jsx("button",{onClick:()=>b(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1 text-content-dim transition hover:bg-surface-muted hover:text-content-muted",title:"清空搜索","aria-label":"清空搜索",children:a.jsx(At,{size:12})}):null]})]}),a.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 rounded-2xl border border-border-subtle bg-surface-control p-1",children:[a.jsxs("div",{className:"relative",ref:r,children:[a.jsxs("button",{className:de("relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",S||he>0?"border-blue-500/50 bg-blue-500/10 text-blue-200":void 0),onClick:()=>R($=>!$),title:"上传","aria-label":ie,"aria-haspopup":"menu","aria-controls":xe,"aria-expanded":S,children:[a.jsx(ht,{size:16}),a.jsx(ct,{size:11,"aria-hidden":"true",className:de("absolute bottom-1 right-1 text-content-dim transition",S||he>0?"text-blue-200":"text-content-dim",S&&"rotate-180")}),he>0?a.jsx("span",{"aria-hidden":"true",className:"absolute -right-1 -top-1 rounded-full bg-blue-500/20 px-1.5 py-0.5 text-[10px] leading-none text-blue-100",children:he}):null]}),S?a.jsxs("div",{id:xe,role:"menu",className:"absolute right-0 top-[calc(100%+8px)] z-20 w-44 overflow-hidden rounded-2xl border border-border-main bg-surface-card shadow-2xl shadow-black/40",children:[a.jsxs("button",{role:"menuitem",className:"flex w-full items-center gap-2 px-4 py-3 text-left text-sm text-content-main transition hover:bg-surface-muted",onClick:()=>{R(!1),A.current?.click()},children:[a.jsx(ht,{size:14,className:"text-blue-400"}),"上传文件..."]}),a.jsxs("button",{role:"menuitem",className:"flex w-full items-center gap-2 border-t border-border-subtle px-4 py-3 text-left text-sm text-content-main transition hover:bg-surface-muted",onClick:Ie,children:[a.jsx(Qe,{size:14,className:"text-amber-400"}),"上传文件夹..."]})]}):null]}),a.jsx("button",{className:"relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",onClick:()=>{me()},title:"刷新目录","aria-label":"刷新目录",children:a.jsx(pt,{size:16})}),a.jsx("button",{className:de("relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",x?"border-blue-500/50 bg-blue-500/10 text-blue-200":void 0),onClick:()=>d($=>!$),title:x?"关闭隐藏文件显示":"显示隐藏文件","aria-label":x?"关闭隐藏文件显示":"显示隐藏文件","aria-pressed":x,children:x?a.jsx(kr,{size:16}):a.jsx(yr,{size:16})}),a.jsx("button",{className:"relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",onClick:()=>D(!0),title:"新建目录","aria-label":"新建目录",children:a.jsx(Mr,{size:16})})]})]}),i?a.jsx("div",{className:"border-b border-blue-900/30 bg-blue-950/20 px-4 py-2 text-sm text-blue-200",children:i}):null,_.length>0?a.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-blue-900/50 bg-blue-900/15 px-4 text-sm",children:[a.jsxs("span",{className:"text-blue-300",children:["已选择 ",_.length," 项"]}),a.jsxs("div",{className:"flex items-center gap-3 text-content-muted",children:[a.jsxs("button",{onClick:()=>g.filter($=>_.includes($.name)).forEach($=>{es(c.id,Se(o,$.name),$.name)}),className:"flex items-center gap-1 hover:text-content-main",children:[a.jsx(Xt,{size:14}),"下载"]}),a.jsxs("button",{onClick:()=>{ze()},className:"flex items-center gap-1 hover:text-red-400",children:[a.jsx(_t,{size:14}),"删除"]})]})]}):null,a.jsx("div",{className:"flex-1 overflow-auto isolate",children:a.jsxs("table",{className:"min-w-[48rem] w-full text-left text-sm text-content-muted",children:[a.jsx("thead",{className:"text-xs text-content-dim",children:a.jsxs("tr",{children:[a.jsx("th",{className:"sticky top-0 z-20 w-10 border-b border-border-main bg-surface-panel px-4 py-3",children:a.jsx("input",{type:"checkbox",checked:ue,onChange:()=>k(ue?_.filter($=>!ee.some(G=>G.name===$)):Array.from(new Set([..._,...ee.map($=>$.name)])))})}),a.jsx("th",{className:"sticky top-0 z-20 border-b border-border-main bg-surface-panel px-2 py-3","aria-sort":et("name"),children:a.jsxs("button",{type:"button",className:de("inline-flex items-center gap-1.5 rounded-md transition hover:text-content-main",I==="name"?"text-blue-400":void 0),onClick:()=>Ve("name"),title:I==="name"&&K==="asc"?"按文件名降序排序":"按文件名升序排序","aria-label":I==="name"&&K==="asc"?"按文件名降序排序":"按文件名升序排序",children:[a.jsx("span",{children:"文件名"}),I==="name"?a.jsx(ct,{size:13,className:de("transition",K==="asc"?"rotate-180":void 0)}):a.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-content-dim",children:"⇅"})]})}),a.jsx("th",{className:"sticky top-0 z-20 w-24 border-b border-border-main bg-surface-panel px-4 py-3",children:"大小"}),a.jsx("th",{className:"sticky top-0 z-20 w-44 border-b border-border-main bg-surface-panel px-4 py-3","aria-sort":et("mtime"),children:a.jsxs("button",{type:"button",className:de("inline-flex items-center gap-1.5 rounded-md whitespace-nowrap transition hover:text-content-main",I==="mtime"?"text-blue-400":void 0),onClick:()=>Ve("mtime"),title:I==="mtime"&&K==="desc"?"按修改时间从旧到新排序":"按修改时间从新到旧排序","aria-label":I==="mtime"&&K==="desc"?"按修改时间从旧到新排序":"按修改时间从新到旧排序",children:[a.jsx("span",{children:"修改时间"}),I==="mtime"?a.jsx(ct,{size:13,className:de("transition",K==="asc"?"rotate-180":void 0)}):a.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-content-dim",children:"⇅"})]})}),a.jsx("th",{className:"sticky top-0 z-20 w-28 border-b border-border-main bg-surface-panel px-4 py-3",children:"权限"})]})}),a.jsxs("tbody",{children:[m?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-content-dim",children:"正在加载目录..."})}):null,s?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-red-300",children:s})}):null,!m&&!s&&ee.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-16 text-center text-content-dim",children:a.jsxs("div",{className:"mx-auto flex max-w-sm flex-col items-center gap-3 rounded-[28px] border border-dashed border-border-subtle bg-surface-muted/40 px-6 py-8",children:[a.jsx(ht,{size:22,className:"text-blue-400"}),a.jsx("div",{className:"text-sm text-content-muted",children:g.length===0?"当前目录为空":q.length===0&&!U?"当前目录暂无可见文件":"未找到匹配文件"}),a.jsx("div",{className:"text-xs text-content-dim",children:g.length===0?"拖拽文件到这里,或使用上方“上传文件...”入口开始传输。":q.length===0&&!U?"当前目录内容均为隐藏文件,可点击上方眼睛按钮临时显示。":"尝试更换关键词,或清空搜索后查看当前目录全部内容。"})]})})}):null,!m&&!s?J.map($=>{const G=_.includes($.name);return a.jsxs("tr",{className:`group border-b border-border-subtle ${G?"bg-blue-500/10":"hover:bg-surface-muted"}`,onDoubleClick:()=>{$.directory&&me(Se(o,$.name))},children:[a.jsx("td",{className:"px-4 py-3",children:a.jsx("input",{type:"checkbox",checked:G,onChange:()=>k(G?_.filter(se=>se!==$.name):[..._,$.name])})}),a.jsxs("td",{className:"relative px-2 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[$.directory?a.jsx(Qe,{size:16,className:"text-blue-400"}):a.jsx(Lr,{size:16,className:"text-content-dim"}),a.jsx("span",{className:"truncate text-content-main",children:$.name})]}),a.jsxs("div",{className:"absolute right-2 top-1/2 hidden -translate-y-1/2 gap-1 rounded-lg border border-border-subtle bg-surface-card p-1 group-hover:flex",children:[$.directory?a.jsx("button",{className:"p-1 text-content-dim hover:text-blue-400",onClick:()=>{Ne($,"tar.gz")},title:`压缩 ${$.name}`,children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})}):a.jsx("button",{className:"p-1 text-content-dim hover:text-cyan-400",onClick:()=>ne(Se(o,$.name)),title:`编辑 ${$.name}`,children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),$.name.endsWith(".tar.gz")||$.name.endsWith(".zip")||$.name.endsWith(".tgz")?a.jsx("button",{className:"p-1 text-content-dim hover:text-amber-400",onClick:()=>{ke($)},title:`解压 ${$.name}`,children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),a.jsx("polyline",{points:"17 6 23 6 23 12"})]})}):null,a.jsx("button",{className:"p-1 text-content-dim hover:text-blue-300",onClick:()=>{es(c.id,Se(o,$.name),$.name)},title:`下载 ${$.name}`,children:a.jsx(Xt,{size:13})}),a.jsx("button",{className:"p-1 text-content-dim hover:text-red-400",onClick:()=>{ts(c.id,Se(o,$.name),$.directory).then(()=>me())},title:`删除 ${$.name}`,children:a.jsx(_t,{size:13})})]})]}),a.jsx("td",{className:"px-4 py-3 text-content-dim",children:$.directory?"-":st($.size)}),a.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[11px] tabular-nums text-content-dim",children:li($.mtime)}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs text-content-dim",children:ci($)})]},$.name)}):null]})]})}),N.length>0?a.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-10 w-[min(360px,calc(100%-2rem))]",children:a.jsxs("div",{className:"pointer-events-auto overflow-hidden rounded-[28px] border border-border-main bg-surface-card shadow-2xl shadow-black/30 backdrop-blur",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-content-main",children:"上传队列"}),a.jsx("div",{className:"text-xs text-content-dim",children:"单文件上传已接入现有接口与进度流。"})]}),a.jsx("button",{className:"text-xs text-content-dim transition hover:text-content-main",onClick:St,children:"清空已完成"})]}),a.jsx("div",{className:"max-h-72 space-y-3 overflow-auto p-3",children:N.map($=>a.jsxs("div",{className:"rounded-2xl border border-border-subtle bg-surface-panel p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"truncate text-sm text-content-main",children:$.filename}),a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-content-dim",children:[$.status==="running"||$.status==="queued"?a.jsx(Cs,{size:12,className:"animate-spin text-blue-400"}):$.status==="success"?a.jsx(bt,{size:12,className:"text-emerald-400"}):$.status==="skipped"||$.status==="cancelled"?a.jsx(At,{size:12,className:"text-content-dim"}):a.jsx(Gt,{size:12,className:"text-red-400"}),a.jsx("span",{children:$.message})]})]}),a.jsxs("span",{className:"text-xs text-content-dim",children:[$.progress,"%"]})]}),a.jsx("div",{className:"mt-3 h-2 rounded-full bg-surface-muted",children:a.jsx("div",{className:de("h-2 rounded-full transition-all",$.status==="success"?"bg-emerald-500":$.status==="skipped"||$.status==="cancelled"?"bg-content-dim":$.status==="error"?"bg-red-500":"bg-blue-500"),style:{width:`${$.progress}%`}})}),a.jsxs("div",{className:"mt-2 text-[11px] text-content-dim",children:[st($.transferredBytes)," / ",st($.totalBytes)]})]},$.id))})]})}):null,P.visible?a.jsx(Fe,{title:"文件冲突",maxWidth:"max-w-lg",onClose:()=>pe("cancel",!1),footer:a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>pe("cancel",!1),className:"rounded bg-surface-muted px-4 py-2 text-sm text-content-muted transition-colors hover:bg-surface-panel hover:text-content-main",children:"取消"}),a.jsx("button",{onClick:()=>pe("skip"),className:"rounded bg-surface-muted px-4 py-2 text-sm text-content-muted transition-colors hover:bg-surface-panel hover:text-content-main",children:"跳过"}),a.jsx("button",{onClick:()=>pe("overwrite"),disabled:!P.canOverwrite,className:de("rounded px-4 py-2 text-sm transition-colors",P.canOverwrite?"bg-blue-600 text-white hover:bg-blue-500 shadow-lg shadow-blue-500/20":"cursor-not-allowed bg-surface-muted text-content-dim shadow-none"),children:"覆盖"})]}),children:a.jsxs("div",{className:"flex items-start gap-3 text-content-muted",children:[a.jsx(Gt,{className:"mt-0.5 shrink-0 text-yellow-500",size:24}),a.jsxs("div",{children:[a.jsxs("p",{className:"mb-2",children:["目标目录中已存在名为 ",a.jsx("strong",{className:"text-content-main",children:P.fileName})," 的",P.fileType==="dir"?"文件夹":"文件","。"]}),a.jsx("p",{className:"text-sm text-content-dim",children:P.message}),P.canOverwrite?a.jsx("p",{className:"mt-2 text-sm text-content-dim",children:"请选择要执行的操作:覆盖原有文件,或者跳过该传输任务。"}):a.jsx("p",{className:"mt-2 text-sm text-content-dim",children:"同名文件夹无法直接覆盖,请选择跳过该文件或取消当前批次。"}),a.jsxs("label",{className:"group mt-5 flex w-max cursor-pointer items-center gap-2",children:[a.jsx("input",{type:"checkbox",checked:L,onChange:$=>M($.target.checked),className:"cursor-pointer rounded border-border-main bg-surface-control text-blue-500 transition-colors focus:ring-blue-500 focus:ring-offset-surface-app"}),a.jsx("span",{className:"text-sm text-content-muted transition-colors group-hover:text-content-main",children:"应用到之后的所有冲突文件"})]})]})]})}):null,a.jsx(Yi,{open:E,currentPath:o,onClose:()=>D(!1),onSubmit:Le}),w?a.jsx("div",{className:"absolute bottom-4 left-4 z-10 rounded-xl border border-blue-800/40 bg-blue-950/80 px-4 py-2 text-xs text-blue-200 shadow-xl backdrop-blur",children:w}):null,X&&a.jsx(Xi,{open:!!X,connectionId:c.id,filePath:X,onClose:()=>ne(null)}),O?(()=>{const $=_.length===1?_[0]:null,G=$?Se(o,$):o;return a.jsx("div",{className:"shrink-0 border-t border-purple-900/50 bg-purple-950/30 px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-content-dim",children:$?"已选择文件/文件夹":"将选择当前目录"}),a.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-purple-400",children:G})]}),a.jsx("button",{className:"shrink-0 rounded-xl bg-purple-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-purple-500",onClick:()=>H?.(G),children:"确认选择"})]})})})():null]})}var Et={exports:{}},os;function Ji(){return os||(os=1,(function(c,_){(function(k,T){c.exports=T()})(self,(()=>(()=>{var k={};return(()=>{var T=k;Object.defineProperty(T,"__esModule",{value:!0}),T.FitAddon=void 0,T.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){const O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;const H=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(H._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const O=this._terminal._core,H=O._renderService.dimensions;if(H.css.cell.width===0||H.css.cell.height===0)return;const A=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),o=n-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),f=h-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-A;return{cols:Math.max(2,Math.floor(f/H.css.cell.width)),rows:Math.max(1,Math.floor(o/H.css.cell.height))}}}})(),k})()))})(Et)),Et.exports}var Qi=Ji();var Zi=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(c){setTimeout(()=>{throw c.stack?as.isErrorNoTelemetry(c)?new as(c.message+` +import{c as oe,r as F,h as fe,j as n,T as dt,u as bs,a as or}from"./index-BQbRYAGj.js";import{S as Ht,e as ar,M as pt,l as Gt,c as lr,A as cr,q as hr,g as dr,d as Xt,u as ur,a as fr,t as _r}from"./monitor-BOliCSBz.js";import{M as Ne,T as gt,X as At,C as Mt}from"./Modal-B96Ao-J_.js";const mr=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],pr=oe("bookmark",mr);const gr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ut=oe("chevron-down",gr);const vr=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xs=oe("chevron-right",vr);const br=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],St=oe("circle-check",br);const xr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Sr=oe("circle-stop",xr);const Cr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],yr=oe("circle-x",Cr);const wr=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],kr=oe("clock",wr);const Er=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Ss=oe("command",Er);const Lr=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Dr=oe("copy",Lr);const Rr=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Yt=oe("download",Rr);const Tr=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ar=oe("eye-off",Tr);const Mr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nr=oe("eye",Mr);const jr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ir=oe("file-text",jr);const Br=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],Nt=oe("file-up",Br);const Or=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Pr=oe("folder-open",Or);const Hr=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Fr=oe("folder-plus",Hr);const Wr=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Qe=oe("folder",Wr);const zr=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],$r=oe("hard-drive",zr);const Ur=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],qr=oe("link",Ur);const Kr=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Cs=oe("list-tree",Kr);const Vr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ys=oe("loader-circle",Vr);const Gr=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Xr=oe("log-out",Gr);const Yr=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Jr=oe("moon",Yr);const Qr=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],jt=oe("network",Qr);const Zr=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ws=oe("play",Zr);const ei=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],vt=oe("plus",ei);const ti=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],it=oe("refresh-cw",ti);const si=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ks=oe("search",si);const ri=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ii=oe("settings",ri);const ni=[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],oi=oe("square-split-horizontal",ni);const ai=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],li=oe("star",ai);const ci=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],hi=oe("sun",ci);const di=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Jt=oe("target",di);const ui=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ft=oe("upload",ui);const fi=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],_i=oe("users",fi);const mi=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Qt=oe("zap",mi);function wt(c,_){const[w,R]=F.useState(()=>{const O=localStorage.getItem(c);if(!O)return _;try{return JSON.parse(O)}catch{return _}});return F.useEffect(()=>{localStorage.setItem(c,JSON.stringify(w))},[c,w]),[w,R]}function ue(...c){return c.filter(Boolean).join(" ")}function st(c){return c==null||Number.isNaN(c)?"-":c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:c<1024*1024*1024?`${(c/(1024*1024)).toFixed(1)} MB`:`${(c/(1024*1024*1024)).toFixed(1)} GB`}function pi(c){if(c==null||Number.isNaN(c))return"-";const _=new Date(c);if(Number.isNaN(_.getTime()))return"-";const w=String(_.getFullYear()),R=String(_.getMonth()+1).padStart(2,"0"),O=String(_.getDate()).padStart(2,"0"),H=String(_.getHours()).padStart(2,"0"),A=String(_.getMinutes()).padStart(2,"0"),r=String(_.getSeconds()).padStart(2,"0");return`${w}-${R}-${O} ${H}:${A}:${r}`}function gi(c){return c.directory?"drwxr-xr-x":"-rw-r--r--"}function Es(c){c.sort((_,w)=>{const R=_.connection?.pinned??!1,O=w.connection?.pinned??!1;return R!==O?R?-1:1:_.order-w.order||_.name.localeCompare(w.name)}),c.forEach(_=>Es(_.children))}function Ft(c){return c.slice().sort((_,w)=>_.pinned!==w.pinned?_.pinned?-1:1:_.name.localeCompare(w.name))}function Ls(c,_){return`${c}-${_}`}function Wt(c,_,w,R){return{id:Ls("connection",String(c.id)),type:"connection",name:c.name,parentId:_,order:w,connectionId:c.id,createdAt:R,updatedAt:R}}function Ds(c,_){return!_||!c?!1:c.nodes.some(w=>w.id===_&&w.type==="folder")}function Ct(c,_){return Ds(c,_)?_:null}function bt(c,_,w){const R=c.filter(O=>O.id!==w&&(O.parentId??null)===_).map(O=>O.order);return(R.length?Math.max(...R):-1)+1}function zt(c,_){return c?.nodes.find(w=>w.type==="connection"&&w.connectionId===_)??null}function Rs(c,_){const w=new Map(_.map(A=>[A.id,A])),R=c?.nodes??[];if(R.length===0)return Ft(_).map((A,r)=>({id:`connection-${A.id}`,type:"connection",name:A.name,order:r,parentId:null,connection:A,children:[]}));const O=new Map;for(const A of R)O.set(A.id,{id:A.id,type:A.type,name:A.type==="connection"&&A.connectionId?w.get(A.connectionId)?.name??A.name:A.name,order:A.order,parentId:A.parentId,expanded:A.expanded,connection:A.connectionId?w.get(A.connectionId):void 0,children:[]});const H=[];for(const A of R){const r=O.get(A.id);r&&(A.type==="connection"&&A.connectionId&&!r.connection||(A.parentId&&O.has(A.parentId)?O.get(A.parentId).children.push(r):H.push(r)))}return Es(H),H}function _t(c){const _=Date.now();return{nodes:Ft(c).map((w,R)=>Wt(w,null,R,_)),sortMode:"manual"}}function Zt(c,_){if(!c)return _t(_);const w=new Map(_.map(h=>[h.id,h])),R=new Set,O=[];for(const h of c.nodes){if(h.type==="folder"){O.push(h);continue}if(!h.connectionId||R.has(h.connectionId))continue;const p=w.get(h.connectionId);p&&(O.push({...h,name:p.name}),R.add(h.connectionId))}const H={nodes:O.map(h=>({...h,parentId:h.parentId&&Ds({nodes:O},h.parentId)?h.parentId:null})),sortMode:c.sortMode??"manual"},A=Ft(_).filter(h=>!R.has(h.id));if(A.length===0)return H;const r=Date.now(),o=H.nodes.slice();return A.forEach(h=>{o.push(Wt(h,null,bt(o,null),r))}),{...H,nodes:o}}function vi(c,_){return c&&{...c,nodes:c.nodes.map(w=>w.id===_&&w.type==="folder"?{...w,expanded:!w.expanded,updatedAt:Date.now()}:w)}}function bi(c,_){if(!c)return c;const w=Date.now();return{...c,nodes:c.nodes.map(R=>R.type==="folder"?{...R,expanded:_,updatedAt:w}:R)}}function xi(c,_){const w=[],R=(O,H)=>{O.forEach(A=>{A.type==="folder"&&(w.push({id:A.id,name:A.name,depth:H}),R(A.children,H+1))})};return R(Rs(c,_),0),w}function es(c,_){if(!c||!_)return null;const w=c.nodes.find(R=>R.id===_);return w?w.type==="folder"?w.id:Ct(c,w.parentId??null):null}function Si(c,_){return zt(c,_)?.id??null}function Ci(c,_){return Ct(c,zt(c,_)?.parentId??null)}function yi(c,_,w){const R=Date.now(),O=Ct(c,w),H=Ls("folder",globalThis.crypto?.randomUUID?.()??String(R)),A={id:H,type:"folder",name:_,parentId:O,order:bt(c.nodes,O),expanded:!0,createdAt:R,updatedAt:R};return{layout:{...c,nodes:[...c.nodes,A],sortMode:c.sortMode??"manual"},nodeId:H}}function wi(c,_,w){const R=Date.now(),O=Ct(c,w),H=zt(c,_.id);if(!H)return{...c,nodes:[...c.nodes,Wt(_,O,bt(c.nodes,O),R)],sortMode:c.sortMode??"manual"};const A=H.parentId===O?H.order:bt(c.nodes,O,H.id);return{...c,nodes:c.nodes.map(r=>r.id===H.id?{...r,name:_.name,parentId:O,order:A,updatedAt:R}:r),sortMode:c.sortMode??"manual"}}function ki(c,_,w){if(!c)return c;const R=w.trim();if(!R)return c;const O=Date.now();return{...c,nodes:c.nodes.map(H=>H.id===_?{...H,name:R,updatedAt:O}:H),sortMode:c.sortMode??"manual"}}function Ei(c,_){if(!c)return null;if(!c.nodes.some(r=>r.id===_))return{layout:c,deletedConnectionIds:[],deletedNodeIds:[]};const R=new Map;c.nodes.forEach(r=>{if(!r.parentId)return;const o=R.get(r.parentId)??[];o.push(r.id),R.set(r.parentId,o)});const O=new Set,H=[_];for(;H.length>0;){const r=H.pop();if(!r||O.has(r))continue;O.add(r),(R.get(r)??[]).forEach(h=>H.push(h))}const A=c.nodes.flatMap(r=>O.has(r.id)&&r.type==="connection"&&r.connectionId?[r.connectionId]:[]);return{layout:{...c,nodes:c.nodes.filter(r=>!O.has(r.id)),sortMode:c.sortMode??"manual"},deletedConnectionIds:A,deletedNodeIds:Array.from(O)}}function Li(c){return fe.get("/sftp/pwd",{params:{connectionId:c}})}function Di(c,_){return fe.get("/sftp/list",{params:{connectionId:c,path:_||"."}})}async function ts(c,_,w){const R=localStorage.getItem("token"),O=new URLSearchParams({connectionId:String(c),path:_}),H=await fetch(`/api/sftp/download?${O.toString()}`,{headers:R?{Authorization:`Bearer ${R}`}:{}});if(!H.ok)throw new Error("Download failed");const A=await H.blob(),r=URL.createObjectURL(A),o=document.createElement("a");o.href=r,o.download=w||_.split("/").pop()||"download",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}function Ts(c,_,w,R){const O=new FormData;return O.append("file",w,w.name),fe.post("/sftp/upload",O,{params:{connectionId:c,path:_,overwrite:R?.overwrite??!1}})}function As(c,_){const w=localStorage.getItem("token"),R=new EventSource(`/api/sftp/upload/tasks/${encodeURIComponent(c)}/progress?token=${encodeURIComponent(w||"")}`);return R.addEventListener("progress",O=>{_(JSON.parse(O.data))}),R.addEventListener("error",()=>{R.close()}),()=>R.close()}function Ri(c,_){return fe.post("/sftp/mkdir",null,{params:{connectionId:c,path:_}})}function ss(c,_,w){return fe.delete("/sftp/delete",{params:{connectionId:c,path:_,directory:w}})}function Ti(c,_,w,R){return fe.post("/sftp/transfer-remote/tasks",null,{params:{sourceConnectionId:c,sourcePath:_,targetConnectionId:w,targetPath:R}})}function Ai(c,_){const w=localStorage.getItem("token"),R=new EventSource(`/api/sftp/transfer-remote/tasks/${encodeURIComponent(c)}/progress?token=${encodeURIComponent(w||"")}`);return R.addEventListener("progress",O=>{_(JSON.parse(O.data))}),R.addEventListener("error",()=>{R.close()}),()=>R.close()}function Mi(c){return fe.delete(`/sftp/transfer-remote/tasks/${encodeURIComponent(c)}`)}function Ni(c,_){return fe.get("/sftp/read",{params:{connectionId:c,path:_}})}function ji(c,_,w){return fe.post("/sftp/write",{content:w},{params:{connectionId:c,path:_}})}function Ii(c,_,w){return fe.post("/sftp/compress",null,{params:{connectionId:c,path:_,format:w}})}function Bi(c,_,w){return fe.post("/sftp/decompress",null,{params:{connectionId:c,path:_,targetDir:"/tmp"}})}function Oi(){return fe.get("/connections/export/config",{responseType:"text"})}function Pi(){return fe.get("/session-tree")}function rs(c){return fe.put("/session-tree",c)}function Hi(){return fe.get("/snippets")}function Fi(c,_,w){return fe.post("/snippets",{name:c,command:_,description:w})}function Wi(c){return fe.delete(`/snippets/${c}`)}const zi={unknown:{dot:"bg-content-dim",label:"未检测",text:"text-content-dim"},checking:{dot:"bg-amber-400",label:"检测中",text:"text-amber-300"},online:{dot:"bg-emerald-500 shadow-[0_0_4px_rgba(16,185,129,0.5)]",label:"在线",text:"text-emerald-500/80"},offline:{dot:"bg-content-dim",label:"离线",text:"text-content-dim"}};function $i({open:c,connections:_,connectionStatuses:w,connectionStatusDetails:R,onRefreshStatuses:O,statusError:H,statusLoading:A,onClose:r}){const[o,h]=F.useState(()=>_.slice(0,2).map(I=>I.id)),[p,a]=F.useState(`df -h +free -m`),[f,g]=F.useState(!1),[v,m]=F.useState([]),[e,s]=F.useState(null),[t,i]=F.useState([]),[l,u]=F.useState(!1),[x,b]=F.useState(""),[d,S]=F.useState(!1);F.useEffect(()=>{c&&Hi().then(I=>i(I.data)).catch(()=>{})},[c]);async function T(){if(!(!p.trim()||!x.trim())){S(!0);try{const I=await Fi(x.trim(),p);i(P=>[I.data,...P]),b(""),S(!1)}catch{S(!1)}}}async function N(I){try{await Wi(I),i(P=>P.filter(C=>C.id!==I))}catch{}}const y=F.useMemo(()=>({total:o.length,success:v.filter(I=>I.success).length,failure:v.filter(I=>!I.success).length}),[v,o.length]),E=F.useMemo(()=>_.filter(I=>w[I.id]==="online").map(I=>I.id),[w,_]),D=F.useMemo(()=>_.filter(I=>w[I.id]==="offline").length,[w,_]);if(F.useEffect(()=>{h(I=>I.filter(P=>_.some(C=>C.id===P)&&w[P]==="online"))},[w,_]),!c)return null;async function B(){const I=o.filter(P=>w[P]==="online");if(!(!I.length||!p.trim())){g(!0),s(null);try{const P=await ar(I,p);m(P.data.results)}catch(P){const C=P.response?.data?.message||"批量执行失败";s(C)}finally{g(!1)}}}return n.jsx(Ne,{title:"批量执行命令",onClose:r,maxWidth:"max-w-6xl",children:n.jsxs("div",{className:"flex h-[70vh] overflow-hidden rounded-2xl border border-border-main bg-surface-app",children:[n.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border-main bg-surface-panel/70",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border-main px-4 py-3 text-sm text-content-muted",children:[n.jsxs("span",{children:["目标主机 (",o.length,")"]}),n.jsxs("div",{className:"flex gap-3 text-xs",children:[n.jsx("button",{className:"text-blue-400 disabled:text-content-dim",disabled:A,onClick:()=>h(E),children:"全选"}),n.jsx("button",{className:"text-content-muted hover:text-content-main transition",onClick:()=>h([]),children:"清空"}),n.jsxs("button",{className:"flex items-center gap-1 text-content-muted transition hover:text-content-main disabled:text-content-dim",disabled:A||_.length===0,onClick:()=>{O().catch(()=>{})},children:[n.jsx(it,{size:12,className:A?"animate-spin":""}),"刷新"]})]})]}),n.jsxs("div",{className:"border-b border-border-main px-4 py-2 text-xs text-content-dim",children:["在线 ",E.length," / 离线 ",D," / 总数 ",_.length]}),n.jsx("div",{className:"flex-1 space-y-1 overflow-auto p-2",children:_.map(I=>{const P=o.includes(I.id),C=w[I.id]??"unknown",L=zi[C],M=R[I.id],j=C!=="online";return n.jsxs("label",{title:M?.message||L.label,className:`flex items-center gap-2 rounded-xl px-3 py-2 transition ${j?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-surface-muted"}`,children:[n.jsx("input",{type:"checkbox",disabled:j,checked:P,onChange:()=>h($=>P?$.filter(V=>V!==I.id):[...$,I.id])}),n.jsxs("div",{className:"relative shrink-0",children:[n.jsx(Ht,{size:14,className:P&&!j?"text-blue-400":"text-content-dim"}),n.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-surface-app ${L.dot}`})]}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"truncate text-sm text-content-muted",children:I.name}),n.jsx("div",{className:`text-[10px] ${L.text}`,children:L.label})]})]},I.id)})})]}),n.jsxs("div",{className:"flex flex-1 flex-col",children:[n.jsx("div",{className:"border-b border-border-main bg-surface-panel px-4 py-4",children:n.jsxs("div",{className:"flex items-end gap-4",children:[n.jsxs("div",{className:"flex-1 space-y-2",children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-muted",children:[n.jsx(dt,{size:14,className:"text-emerald-400"}),"批量执行脚本",t.length>0?n.jsx("span",{className:"ml-2 flex items-center gap-1",children:n.jsxs("button",{onClick:()=>u(!l),className:"inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[10px] text-content-muted transition hover:text-content-main",style:{background:"rgba(148,163,184,0.06)"},children:[n.jsx(pr,{size:10}),"片段库"]})}):null]}),n.jsxs("div",{className:"relative",children:[n.jsx("textarea",{rows:5,className:"w-full resize-none rounded-2xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-emerald-300 outline-none focus:border-blue-500",value:p,onChange:I=>a(I.target.value)}),l&&t.length>0&&n.jsx("div",{className:"absolute bottom-1 left-1 right-1 z-10 max-h-32 overflow-auto rounded-xl border border-border-main bg-surface-panel p-1 shadow-xl",style:{top:"auto",transform:"translateY(-105%)"},children:t.map(I=>n.jsxs("div",{className:"group flex items-center rounded-lg px-2 py-1.5 text-xs transition hover:bg-surface-muted",children:[n.jsxs("button",{className:"flex-1 text-left text-content-muted truncate",onClick:()=>{a(I.command),u(!1)},children:[n.jsx("span",{className:"font-medium text-content-main",children:I.name}),I.description?n.jsx("span",{className:"ml-2 text-content-dim",children:I.description}):null]}),n.jsx("button",{onClick:()=>{N(I.id)},className:"ml-1 rounded p-0.5 text-content-dim opacity-0 transition hover:text-red-400 group-hover:opacity-100",children:n.jsx(gt,{size:10})})]},I.id))})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"relative",children:[n.jsx("input",{placeholder:"保存为片段...",className:"w-36 rounded-lg border border-border-main bg-surface-muted px-3 py-2.5 text-xs text-content-main outline-none placeholder:text-content-dim",value:x,onChange:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&T()}}),x.trim()&&p.trim()?n.jsx("button",{onClick:()=>{T()},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-cyan-400 hover:text-cyan-300",children:n.jsx(vt,{size:14})}):null]}),n.jsxs("button",{className:"flex h-[46px] items-center gap-2 rounded-xl bg-blue-600 px-6 text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:f||A||o.filter(I=>w[I]==="online").length===0,onClick:()=>{B()},children:[f?n.jsx(it,{size:16,className:"animate-spin"}):n.jsx(ws,{size:16,fill:"currentColor"}),f?"执行中...":"开始执行"]})]})]})}),n.jsxs("div",{className:"flex gap-6 border-b border-border-main bg-surface-muted/60 px-4 py-2 text-sm",children:[n.jsxs("span",{className:"text-content-muted",children:["总数: ",y.total]}),n.jsxs("span",{className:"font-medium text-emerald-400",children:["成功: ",y.success]}),n.jsxs("span",{className:"font-medium text-red-400",children:["失败: ",y.failure]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-auto p-4",children:[H?n.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-4 py-3 text-sm text-amber-200",children:H}):null,e?n.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:e}):null,!v.length&&!e?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-content-dim",children:[n.jsx(Ss,{size:48,className:"mb-3 text-border-main"}),n.jsx("p",{children:A?"正在检测主机状态...":"请在上方输入命令并点击执行"})]}):null,v.map(I=>n.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle bg-surface-panel/80 px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[I.success?n.jsx(St,{size:16,className:"text-emerald-500"}):n.jsx(yr,{size:16,className:"text-red-500"}),n.jsx("span",{className:"text-sm font-medium text-content-main",children:I.connectionName})]}),n.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-dim",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(kr,{size:12}),I.durationMs,"ms"]}),n.jsxs("button",{className:"flex items-center gap-1 transition hover:text-content-muted",onClick:()=>navigator.clipboard.writeText(I.output||I.error||""),children:[n.jsx(Dr,{size:12}),"复制输出"]})]})]}),n.jsx("pre",{className:`overflow-auto bg-surface-muted/20 p-4 text-xs leading-relaxed ${I.success?"text-content-muted":"text-red-400"}`,children:I.output||I.error||""})]},I.connectionId))]})]})]})})}function Ui({force:c,onClose:_}){const{changePassword:w}=bs(),[R,O]=F.useState(""),[H,A]=F.useState(""),[r,o]=F.useState(""),[h,p]=F.useState(!1),[a,f]=F.useState(null);async function g(){if(H!==r){f("两次输入的新密码不一致");return}p(!0),f(null);try{await w(R,H),_()}catch(v){const m=v.response?.data?.message||"修改密码失败";f(m)}finally{p(!1)}}return n.jsx(Ne,{title:"首次登录 - 请修改密码",onClose:c?void 0:_,maxWidth:"max-w-lg",footer:n.jsxs(n.Fragment,{children:[c?null:n.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:_,children:"取消"}),n.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:h,onClick:g,children:h?"提交中...":"确认修改"})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"rounded-2xl border border-blue-500/25 bg-blue-500/10 p-4 text-sm text-blue-400",children:"为了您的资产安全,系统要求首次登录的管理员必须修改默认密码。"}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"原密码"}),n.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:R,onChange:v=>O(v.target.value)})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"新密码"}),n.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:H,onChange:v=>A(v.target.value)})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"确认新密码"}),n.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:r,onChange:v=>o(v.target.value)})]}),a?n.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:a}):null]})})}const is={name:"",host:"",port:22,username:"root",authType:"PASSWORD",password:"",privateKey:"",passphrase:"",setupMode:"NONE",bootstrapPassword:""};function qi({open:c,connection:_,folderOptions:w,initialTargetFolderId:R,onClose:O,onSubmit:H}){const[A,r]=F.useState(is),[o,h]=F.useState(null),[p,a]=F.useState(!1),[f,g]=F.useState(null);if(F.useEffect(()=>{c&&(r(_?{name:_.name,host:_.host,port:_.port,username:_.username,authType:_.authType,password:"",privateKey:"",passphrase:"",setupMode:"NONE",bootstrapPassword:""}:is),h(R),g(null))},[_,R,c]),!c)return null;const v=A.setupMode==="PASSWORD_BOOTSTRAP",m=A.authType==="PASSWORD";async function e(){a(!0),g(null);try{await H({...A,port:Number(A.port||22),targetFolderId:o})}catch(s){const t=s.response?.data?.message||"保存连接失败";g(t)}finally{a(!1)}}return n.jsxs(Ne,{title:_?"编辑 SSH 连接":"新建 SSH 连接",onClose:O,maxWidth:"max-w-2xl",footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:O,children:"取消"}),n.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:p,onClick:e,children:p?"保存中...":_?"保存修改":"保存并连接"})]}),children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"连接名称"}),n.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:prod-web-01",value:A.name,onChange:s=>r(t=>({...t,name:s.target.value}))})]}),n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"分组 / 父文件夹"}),n.jsxs("select",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:o??"__ROOT__",onChange:s=>h(s.target.value==="__ROOT__"?null:s.target.value),children:[n.jsx("option",{value:"__ROOT__",children:"根目录"}),w.map(s=>n.jsx("option",{value:s.id,children:`${"— ".repeat(s.depth)}${s.name}`},s.id))]})]})]}),n.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-[minmax(0,1.4fr)_120px_minmax(0,1fr)]",children:[n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"主机 IP"}),n.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.host,onChange:s=>r(t=>({...t,host:s.target.value}))})]}),n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"端口"}),n.jsx("input",{type:"number",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.port??22,onChange:s=>r(t=>({...t,port:Number(s.target.value)}))})]}),n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"用户名"}),n.jsx("input",{className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.username,onChange:s=>r(t=>({...t,username:s.target.value}))})]})]}),n.jsxs("div",{className:"mt-6 rounded-[28px] border border-border-main bg-surface-muted/30 p-5",children:[n.jsxs("div",{className:"mb-4",children:[n.jsx("div",{className:"text-sm font-medium text-content-main",children:"认证方式"}),n.jsx("div",{className:"mt-1 text-xs text-content-dim",children:"保留现有密码、私钥和一键免密部署能力。"})]}),n.jsxs("div",{className:"flex flex-wrap gap-3",children:[n.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${m?"border-blue-500 bg-blue-500/10 text-blue-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PASSWORD",setupMode:s.setupMode==="PASSWORD_BOOTSTRAP"?"PASSWORD_BOOTSTRAP":"NONE"})),children:"密码认证"}),n.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${A.authType==="PRIVATE_KEY"?"border-blue-500 bg-blue-500/10 text-blue-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PRIVATE_KEY",setupMode:"NONE"})),children:"私钥认证"}),n.jsx("button",{className:`rounded-2xl border px-4 py-2 text-sm ${v?"border-emerald-500 bg-emerald-500/10 text-emerald-400":"border-border-main bg-surface-panel text-content-muted"}`,onClick:()=>r(s=>({...s,authType:"PASSWORD",setupMode:s.setupMode==="PASSWORD_BOOTSTRAP"?"NONE":"PASSWORD_BOOTSTRAP"})),children:"一键免密部署"})]}),A.authType==="PASSWORD"?n.jsxs("label",{className:"block mt-4 space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:v?"引导密码":"密码"}),n.jsx("input",{type:"password",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:v?A.bootstrapPassword??"":A.password??"",onChange:s=>r(t=>v?{...t,bootstrapPassword:s.target.value}:{...t,password:s.target.value})})]}):n.jsxs("div",{className:"mt-4 space-y-4",children:[n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"私钥内容"}),n.jsx("textarea",{rows:6,className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-content-main outline-none focus:border-blue-500",value:A.privateKey??"",onChange:s=>r(t=>({...t,privateKey:s.target.value}))})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"私钥口令"}),n.jsx("input",{type:"password",className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:A.passphrase??"",onChange:s=>r(t=>({...t,passphrase:s.target.value}))})]})]})]}),f?n.jsx("div",{className:"mt-4 rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:f}):null]})}function Ki({open:c,folderOptions:_,initialParentId:w,onClose:R,onSubmit:O}){const[H,A]=F.useState(""),[r,o]=F.useState(null),[h,p]=F.useState(!1),[a,f]=F.useState(null);if(F.useEffect(()=>{c&&(A(""),o(w),p(!1),f(null))},[w,c]),!c)return null;async function g(){const v=H.trim();if(!v){f("请输入文件夹名称");return}p(!0),f(null);try{await O({name:v,parentId:r}),R()}catch(m){const e=m.response?.data?.message||"创建文件夹失败";f(e)}finally{p(!1)}}return n.jsx(Ne,{title:"新建文件夹",onClose:R,maxWidth:"max-w-lg",footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:R,children:"取消"}),n.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:h,onClick:g,children:h?"创建中...":"创建文件夹"})]}),children:n.jsxs("div",{className:"space-y-5",children:[n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"文件夹名称"}),n.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:生产环境",value:H,onChange:v=>A(v.target.value)})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"父级目录(可选)"}),n.jsxs("select",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",value:r??"__ROOT__",onChange:v=>o(v.target.value==="__ROOT__"?null:v.target.value),children:[n.jsx("option",{value:"__ROOT__",children:"根目录"}),_.map(v=>n.jsx("option",{value:v.id,children:`${"— ".repeat(v.depth)}${v.name}`},v.id))]})]}),a?n.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:a}):null]})})}function Vi({open:c,initialName:_,onClose:w,onSubmit:R}){const[O,H]=F.useState(""),[A,r]=F.useState(!1),[o,h]=F.useState(null);if(F.useEffect(()=>{c&&(H(_),r(!1),h(null))},[_,c]),!c)return null;async function p(){const a=O.trim();if(!a){h("请输入文件夹名称");return}if(a===_){w();return}r(!0),h(null);try{await R(a),w()}catch(f){const g=f.response?.data?.message||"重命名文件夹失败";h(g)}finally{r(!1)}}return n.jsx(Ne,{title:"重命名文件夹",onClose:w,maxWidth:"max-w-md",footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main",onClick:w,children:"取消"}),n.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:opacity-60",disabled:A,onClick:p,children:A?"保存中...":"保存"})]}),children:n.jsxs("div",{className:"space-y-5",children:[n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"文件夹名称"}),n.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none focus:border-blue-500",placeholder:"例如:生产环境",value:O,onChange:a=>H(a.target.value),autoFocus:!0,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),p())}})]}),o?n.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:o}):null]})})}const Gi={unknown:{dot:"bg-content-dim",label:"未检测",text:"text-content-dim"},checking:{dot:"bg-amber-400",label:"检测中",text:"text-amber-300"},online:{dot:"bg-emerald-500",label:"在线",text:"text-emerald-400"},offline:{dot:"bg-red-500",label:"离线",text:"text-red-400"}};function Ms(c,_){if(!_)return!0;const w=_.toLowerCase();return c.name.toLowerCase().includes(w)?!0:c.children.some(R=>Ms(R,_))}function Ns({node:c,depth:_,activeConnectionId:w,connectionStatuses:R,openConnectionIds:O,selectedNodeId:H,search:A,onSelectNode:r,onToggleFolder:o,onOpenConnection:h,onContextMenu:p,onTogglePin:a}){function f(t,i){t.preventDefault(),t.stopPropagation(),p({nodeId:c.id,nodeType:i,x:t.clientX,y:t.clientY})}if(!Ms(c,A))return null;if(c.type==="folder"){const t=c.expanded??!0,i=H===c.id;return n.jsxs("div",{children:[n.jsxs("button",{className:ue("flex w-full items-center gap-2 rounded-xl px-2 py-2 text-left text-sm transition",i?"bg-surface-muted text-content-main ring-1 ring-inset ring-border-main":"text-content-muted hover:bg-surface-muted"),onClick:()=>{r(c.id),o(c.id)},onContextMenu:l=>f(l,"folder"),style:{paddingLeft:8+_*16},children:[t?n.jsx(ut,{size:14,className:"text-content-dim"}):n.jsx(xs,{size:14,className:"text-content-dim"}),n.jsx(Qe,{size:15,className:t?"text-blue-400":"text-content-dim"}),n.jsx("span",{className:"truncate",children:c.name})]}),t?n.jsx("div",{className:"space-y-1",children:c.children.map(l=>n.jsx(Ns,{node:l,depth:_+1,activeConnectionId:w,connectionStatuses:R,openConnectionIds:O,selectedNodeId:H,search:A,onSelectNode:r,onToggleFolder:o,onOpenConnection:h,onContextMenu:p,onTogglePin:a},l.id))}):null]})}if(!c.connection)return null;const g=H===c.id,v=w===c.connection.id,m=O.includes(c.connection.id),e=R?.[c.connection.id]??"unknown",s=Gi[e];return n.jsxs("button",{className:ue("group flex w-full items-center gap-2 rounded-xl px-2 py-2 text-left text-sm transition",v?"bg-blue-600/20 text-blue-200 ring-1 ring-inset ring-blue-500/40":g?"bg-surface-muted text-content-main ring-1 ring-inset ring-border-main":m?"text-emerald-200 hover:bg-surface-muted":"text-content-muted hover:bg-surface-muted hover:text-content-main"),onDoubleClick:()=>h(c.connection,c.id),onClick:()=>{r(c.id),m&&!v&&h(c.connection,c.id)},onContextMenu:t=>f(t,"connection"),style:{paddingLeft:24+_*16},children:[n.jsxs("div",{className:"relative shrink-0",children:[n.jsx(Ht,{size:14,className:v?"text-blue-300":m?"text-emerald-400":"text-content-dim"}),n.jsx("span",{className:ue("absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-surface-panel",s.dot)})]}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate",children:c.connection.name}),n.jsx("div",{className:ue("text-[10px]",s.text),children:s.label})]}),n.jsx("button",{className:"shrink-0 rounded p-0.5 opacity-0 transition group-hover:opacity-100 hover:scale-110",onClick:t=>{t.stopPropagation(),a?.(c.connection.id)},title:c.connection.pinned?"取消置顶":"置顶",children:n.jsx(li,{size:11,className:c.connection.pinned?"fill-amber-400 text-amber-400":"text-content-dim"})}),v?n.jsx("span",{className:"rounded-full border border-blue-500/30 bg-blue-500/10 px-2 py-0.5 text-[10px] text-blue-200",children:"当前"}):m?n.jsx("span",{className:"rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5 text-[10px] text-emerald-200",children:"已打开"}):n.jsx("span",{className:"hidden rounded bg-surface-app px-1.5 py-0.5 text-[10px] text-content-dim group-hover:inline-block",children:"双击连接"})]})}function Xi(c){return n.jsx("div",{className:"space-y-1",children:c.nodes.map(_=>n.jsx(Ns,{node:_,depth:0,...c},_.id))})}function Yi(){return fe.get("/webhooks")}function Ji(c,_){return fe.post("/webhooks",{url:c,eventType:_})}function Qi(c){return fe.delete(`/webhooks/${c}`)}function Zi(c){return fe.post("/webhooks/test",{message:c})}function en(c,_){const w=c?.response?.data;return w?.message||w?.error||_}const tn=[{label:"IBM Plex Mono",value:'"IBM Plex Mono", ui-monospace, monospace'},{label:"JetBrains Mono",value:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace'},{label:"Fira Code",value:'"Fira Code", "IBM Plex Mono", ui-monospace, monospace'},{label:"Source Code Pro",value:'"Source Code Pro", "IBM Plex Mono", ui-monospace, monospace'}];function sn({open:c,terminalFontSize:_,terminalFontFamily:w,darkMode:R,onClose:O,onFontSizeChange:H,onFontFamilyChange:A,onDarkModeChange:r}){const[o,h]=F.useState("appearance"),[p,a]=F.useState([]),[f,g]=F.useState(""),[v,m]=F.useState(!1),[e,s]=F.useState(null),[t,i]=F.useState("");F.useEffect(()=>{c&&(Yi().then(b=>a(b.data)).catch(()=>{}),i(""))},[c]);const l=F.useCallback(async()=>{if(f.trim()){m(!0);try{const b=await Ji(f.trim(),"*");a(d=>[...d,b.data]),g(""),i("已添加")}catch(b){i(en(b,"添加失败"))}m(!1)}},[f]),u=F.useCallback(async b=>{try{await Qi(b),a(d=>d.filter(S=>S.id!==b))}catch{}},[]),x=F.useCallback(async b=>{s(b);try{const d=p.find(S=>S.id===b);await Zi(d?.url||"test"),i("测试已发送")}catch{i("测试失败")}s(null)},[p]);return c?n.jsxs(Ne,{title:"系统设置",onClose:O,maxWidth:"max-w-xl",children:[n.jsxs("div",{className:"flex gap-4 mb-4 border-b pb-3 border-border-subtle",children:[n.jsx("button",{onClick:()=>h("appearance"),className:`text-xs font-medium pb-1 ${o==="appearance"?"text-cyan-400 border-b border-cyan-400":"text-content-muted"}`,children:"外观"}),n.jsx("button",{onClick:()=>h("webhooks"),className:`text-xs font-medium pb-1 ${o==="webhooks"?"text-cyan-400 border-b border-cyan-400":"text-content-muted"}`,children:"Webhook"})]}),o==="appearance"?n.jsxs("div",{className:"space-y-6",children:[r?n.jsxs("div",{children:[n.jsx("div",{className:"mb-3 text-sm font-medium text-content-muted",children:"界面主题"}),n.jsx("div",{className:"flex gap-3",children:[{mode:!1,label:"浅色",icon:hi,desc:"亮色界面"},{mode:!0,label:"暗色",icon:Jr,desc:"深色界面"}].map(b=>n.jsxs("button",{onClick:()=>r(b.mode),className:`flex flex-1 items-center gap-3 rounded-xl border px-4 py-3 text-sm transition ${R===b.mode?"border-cyan-500/40 bg-cyan-500/10 text-cyan-400":"border-border-main bg-surface-muted text-content-muted hover:border-border-subtle"}`,children:[n.jsx(b.icon,{size:18}),n.jsxs("div",{className:"text-left",children:[n.jsx("div",{className:"font-medium text-content-main",children:b.label}),n.jsx("div",{className:"text-[11px] text-content-dim",children:b.desc})]})]},b.label))})]}):null,n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-content-muted",children:"终端字号"}),n.jsxs("span",{className:"text-content-dim",children:[_,"px"]})]}),n.jsx("input",{type:"range",min:11,max:22,value:_,onChange:b=>H(Number(b.target.value)),className:"w-full h-1.5 accent-cyan-500 bg-surface-muted rounded-lg appearance-none"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm font-medium text-content-muted",children:"终端字体"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:tn.map(b=>n.jsx("button",{onClick:()=>A(b.value),className:`rounded-lg px-3.5 py-2 text-xs transition ${w===b.value?"border border-cyan-400/30 bg-cyan-500/10 text-cyan-400":"border-border-main bg-surface-muted text-content-muted hover:border-border-subtle"}`,style:{fontFamily:b.value},children:b.label},b.label))})]})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"text-xs text-content-dim",children:"Webhook URL 将在连接创建/删除等事件触发时发送通知(支持钉钉、飞书、Slack 等)"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{className:"input-cyber flex-1 bg-surface-muted border-border-main text-content-main",placeholder:"https://hooks.example.com/webhook",value:f,onChange:b=>g(b.target.value),onKeyDown:b=>{b.key==="Enter"&&l()}}),n.jsxs("button",{onClick:()=>{l()},disabled:v||!f.trim(),className:"btn-cyber-primary",children:[n.jsx(vt,{size:14}),"添加"]})]}),p.length===0?n.jsx("div",{className:"py-8 text-center text-xs text-content-muted",children:"暂无配置,输入 URL 后点击添加"}):n.jsx("div",{className:"space-y-2",children:p.map(b=>n.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-surface-muted/40 border border-border-subtle",children:[n.jsx(qr,{size:12,className:"text-cyan-400"}),n.jsx("span",{className:"flex-1 truncate text-xs text-content-muted",children:b.url}),n.jsx("button",{onClick:()=>{x(b.id)},className:"rounded p-1 text-content-dim hover:text-content-main transition",title:"发送测试",children:e===b.id?n.jsx(ys,{size:12,className:"animate-spin"}):n.jsx(St,{size:12})}),n.jsx("button",{onClick:()=>{u(b.id)},className:"rounded p-1 text-content-dim hover:text-red-400 transition",children:n.jsx(gt,{size:12})})]},b.id))}),t?n.jsx("div",{className:"text-xs text-cyan-400",children:t}):null]})]}):null}function ns(c,_){const w=c?.response?.data;return w?.message||w?.error||_}function rn({open:c,connectionId:_,filePath:w,onClose:R}){const[O,H]=F.useState(""),[A,r]=F.useState(!1),[o,h]=F.useState(!1),[p,a]=F.useState(null),[f,g]=F.useState(!1),[v,m]=F.useState(!1);F.useEffect(()=>{!c||!w||(r(!0),a(null),g(!1),m(!1),Ni(_,w).then(t=>{H(t.data.content),r(!1)}).catch(t=>{a(ns(t,"加载文件失败")),r(!1)}))},[_,w,c]);async function e(){h(!0),a(null),g(!1);try{await ji(_,w,O),g(!0),m(!1),setTimeout(()=>g(!1),2e3)}catch(t){a(ns(t,"保存失败"))}finally{h(!1)}}const s=w.split("/").pop()||w;return n.jsx(Ne,{title:`编辑: ${s}`,onClose:R,maxWidth:"max-w-5xl",footer:n.jsxs("div",{className:"flex items-center gap-3 w-full",children:[n.jsx("div",{className:"flex-1 text-xs",style:{color:"#475569"},children:w}),p?n.jsx("span",{className:"text-xs text-red-400",children:p}):null,f?n.jsx("span",{className:"text-xs text-emerald-400",children:"已保存 ✓"}):null,n.jsx("button",{onClick:R,className:"btn-cyber",children:"取消"}),n.jsx("button",{onClick:e,disabled:o||!v,className:"btn-cyber-primary",children:o?"保存中...":"保存"})]}),children:A?n.jsx("div",{className:"flex items-center justify-center py-20 text-sm",style:{color:"#64748b"},children:"加载中..."}):n.jsx("textarea",{className:"w-full h-[60vh] resize-none rounded-xl border p-4 font-mono text-sm outline-none",style:{background:"#0a0e1a",borderColor:"rgba(96, 165, 250, 0.12)",color:"#e2e8f0"},value:O,onChange:t=>{H(t.target.value),m(!0)},spellCheck:!1})})}function nn({open:c,currentPath:_,onClose:w,onSubmit:R}){const O=F.useRef(null),[H,A]=F.useState(""),[r,o]=F.useState(!1),[h,p]=F.useState(null);if(F.useEffect(()=>{if(!c)return;A(""),o(!1),p(null);const g=window.setTimeout(()=>O.current?.focus(),0);return()=>window.clearTimeout(g)},[c]),!c)return null;async function a(){const g=H.trim();if(!g){p("请输入目录名称");return}o(!0),p(null);try{await R(g),w()}catch(v){const m=v.response?.data?.message||"创建目录失败";p(m)}finally{o(!1)}}function f(){r||w()}return n.jsx(Ne,{title:"新建目录",onClose:r?void 0:f,maxWidth:"max-w-md",footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"rounded-xl bg-surface-muted px-4 py-2 text-sm text-content-muted transition hover:bg-surface-panel hover:text-content-main disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:f,children:"取消"}),n.jsx("button",{className:"rounded-xl bg-blue-600 px-4 py-2 text-sm text-white transition hover:bg-blue-500 disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:a,children:r?"创建中...":"确定"})]}),children:n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{className:"rounded-2xl border border-border-main bg-surface-muted/50 px-4 py-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-[0.24em] text-content-dim",children:"当前路径"}),n.jsx("div",{className:"mt-2 break-all font-mono text-sm text-content-main",children:_})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"目录名称"}),n.jsx("input",{ref:O,className:"w-full rounded-2xl border border-border-main bg-surface-muted px-4 py-3 text-content-main outline-none transition focus:border-blue-500",placeholder:"例如:releases",value:H,onChange:g=>A(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),a())}})]}),h?n.jsx("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:h}):null]})})}function os(c,_){const w=c?.response?.data;return w?.message||w?.error||_}const kt={visible:!1,fileName:"",fileType:"file",canOverwrite:!0,queueId:"",message:""};function js({connection:c,selectedFiles:_,onSelectedFilesChange:w,onRefreshSignal:R,selectionMode:O,onConfirmSelection:H}){const A=F.useRef(null),r=F.useRef(null),o=F.useRef(new Map),h=F.useRef(null),p=F.useRef(!1),[a,f]=F.useState("/"),[g,v]=F.useState([]),[m,e]=F.useState(!1),[s,t]=F.useState(null),[i,l]=F.useState(null),[u,x]=F.useState(""),[b,d]=F.useState(!1),[S,T]=F.useState(!1),[N,y]=F.useState([]),[E,D]=F.useState(!1),[B,I]=F.useState(null),[P,C]=F.useState(kt),[L,M]=F.useState(!1),[j,$]=F.useState("name"),[V,Y]=F.useState("asc"),[X,ae]=F.useState(null),[k,W]=F.useState(null),q=u.trim().toLowerCase(),U=F.useMemo(()=>g.filter(z=>b||!z.name.startsWith(".")),[g,b]),ee=F.useMemo(()=>q?U.filter(z=>z.name.toLowerCase().includes(q)):U,[U,q]),Q=F.useMemo(()=>ee.slice().sort((z,G)=>{if(z.directory!==G.directory)return z.directory?-1:1;const se=z.name.localeCompare(G.name,void 0,{numeric:!0,sensitivity:"base"});if(j==="name")return se!==0?V==="asc"?se:-se:V==="asc"?z.mtime-G.mtime:G.mtime-z.mtime;const ge=z.mtime-G.mtime;return ge!==0?V==="asc"?ge:-ge:se}),[ee,V,j]),ne=F.useMemo(()=>ee.filter(z=>_.includes(z.name)),[ee,_]),_e=F.useMemo(()=>ee.length>0&&ne.length===ee.length,[ee.length,ne.length]),ce=F.useMemo(()=>N.filter(z=>z.status==="queued"||z.status==="running").length,[N]),Ae="sftp-upload-menu",re=ce>0?`上传,当前有 ${ce} 个任务进行中`:"上传",Pe=ue("group flex h-9 min-w-0 shrink items-center overflow-hidden rounded-2xl border border-border-main bg-surface-control px-3 text-sm text-content-main shadow-[inset_0_1px_0_rgba(148,163,184,0.08)] transition-[flex-grow,flex-basis,border-color,box-shadow] duration-200 focus-within:border-blue-500/60 focus-within:shadow-[inset_0_1px_0_rgba(96,165,250,0.18)]",B==="path"?"basis-[70%] grow-[7]":B==="search"?"basis-[42%] grow-[21]":"basis-[60%] grow-[6]"),We=ue("group relative h-9 min-w-0 shrink overflow-hidden rounded-2xl border border-border-main bg-surface-control text-content-main shadow-[inset_0_1px_0_rgba(148,163,184,0.08)] transition-[flex-grow,flex-basis,border-color,box-shadow] duration-200 focus-within:border-blue-500/60 focus-within:shadow-[inset_0_1px_0_rgba(96,165,250,0.18)]",B==="search"?"basis-[58%] grow-[29]":B==="path"?"basis-[30%] grow-[3]":"basis-[40%] grow-[4]"),he=async z=>{e(!0),t(null);try{const G=z??a,se=await Di(c.id,G);v(se.data),f(G),w([])}catch(G){const se=G.response?.data?.error||"目录加载失败";t(se)}finally{e(!1)}};F.useEffect(()=>{let z=!1;return(async()=>{l(null),x(""),d(!1),y([]),D(!1),I(null),be("cancel",!1),C(kt),M(!1),p.current=!1,$("name"),Y("asc"),o.current.forEach(G=>G()),o.current.clear();try{const G=await Li(c.id);z||(f(G.data.path),await he(G.data.path))}catch{z||await he("/")}})(),()=>{z=!0,be("cancel",!1),p.current=!1,o.current.forEach(G=>G()),o.current.clear()}},[c.id]),F.useEffect(()=>{R?.(he)},[R]),F.useEffect(()=>{if(b)return;const z=new Set(g.filter(G=>G.name.startsWith(".")&&_.includes(G.name)).map(G=>G.name));z.size!==0&&w(_.filter(G=>!z.has(G)))},[g,w,_,b]),F.useEffect(()=>{if(!S)return;const z=G=>{r.current?.contains(G.target)||T(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[S]);function xe(z,G){return z==="/"?`/${G}`:`${z.replace(/\/$/,"")}/${G}`}function pe(z,G){y(se=>se.map(ge=>ge.id===z?G(ge):ge))}function Se(z){const G=`${Date.now()}-${z.name}-${Math.random().toString(36).slice(2,8)}`;return y(se=>[{id:G,filename:z.name,status:"queued",progress:0,transferredBytes:0,totalBytes:z.size,message:"等待上传",createdAt:Date.now()},...se]),G}function je(z){const G=z.response;return G?.status!==409||G.data?.code!=="SFTP_UPLOAD_CONFLICT"?null:G.data}function be(z,G=L){const se=h.current;h.current=null,C(kt),M(!1),se?.({action:z,applyToAll:G})}function Ie(z,G){return M(!1),C({visible:!0,fileName:z.fileName,fileType:z.conflictType,canOverwrite:z.canOverwrite,queueId:G,message:z.message}),new Promise(se=>{h.current=se})}async function Ue(z,G){W(null);try{const se=xe(a,z.name),ge=await Ii(c.id,se,G);W(ge.data.message),setTimeout(()=>W(null),4e3),await he()}catch(se){W(os(se,"压缩失败"))}}async function ye(z){W(null);try{const G=xe(a,z.name),se=await Bi(c.id,G);W(se.data.message),setTimeout(()=>W(null),4e3),await he()}catch(G){W(os(G,"解压失败"))}}async function qe(){const z=g.filter(G=>_.includes(G.name));await Promise.all(z.map(G=>ss(c.id,xe(a,G.name),G.directory))),await he()}async function we(z){await Ri(c.id,xe(a,z)),await he()}async function Ee(z,G,se,ge){const Me=(await Ts(c.id,G,z,{overwrite:ge})).data.taskId;pe(se,de=>({...de,remoteTaskId:Me,status:"running",message:ge?"正在覆盖上传...":"正在上传..."}));const Ke=As(Me,de=>{pe(se,Le=>({...Le,remoteTaskId:de.taskId,status:de.status,progress:de.progress,transferredBytes:de.transferredBytes,totalBytes:de.totalBytes,message:de.error||(de.status==="success"?"上传完成":"正在上传...")})),de.status==="success"&&he(),(de.status==="success"||de.status==="error")&&(o.current.get(Me)?.(),o.current.delete(Me))});o.current.set(Me,Ke)}async function le(z){if(z.length===0)return;if(p.current){l("当前上传批次仍在处理中,请先完成冲突选择。");return}const G=a,se={applyToAll:!1,action:null};p.current=!0,M(!1),l(`已开始上传到 ${G}`);try{for(const ge of z){const ke=Se(ge);let Me=se.applyToAll&&se.action==="overwrite";for(;;)try{await Ee(ge,G,ke,Me);break}catch(Ke){const de=je(Ke);if(!de){const ve=Ke.response?.data?.message||Ke.response?.data?.error||"上传失败";pe(ke,at=>({...at,status:"error",message:ve}));break}pe(ke,ve=>({...ve,status:"queued",message:de.canOverwrite?"等待冲突处理":"检测到同名文件夹,等待处理"}));let Le;if(se.applyToAll&&se.action&&(se.action!=="overwrite"||de.canOverwrite)?Le={action:se.action,applyToAll:!0}:Le=await Ie(de,ke),Le.action==="cancel"){se.applyToAll=!1,se.action=null,pe(ke,ve=>({...ve,status:"cancelled",message:"已取消上传"})),l("已取消当前上传批次,剩余文件未开始上传。");return}if(Le.applyToAll?(se.applyToAll=!0,se.action=Le.action):(se.applyToAll=!1,se.action=null),Le.action==="skip"){pe(ke,ve=>({...ve,status:"skipped",message:"已跳过冲突文件"}));break}Me=!0,pe(ke,ve=>({...ve,status:"queued",message:"准备覆盖上传"}))}}}finally{p.current=!1,M(!1)}}function Xe(){T(!1),l("后端暂未支持文件夹上传,后续实现。")}function nt(z,G){const se=G.relatedTarget;se instanceof Node&&G.currentTarget.contains(se)||I(ge=>ge===z?null:ge)}function et(z){if(z===j){Y(G=>G==="asc"?"desc":"asc");return}$(z),Y(z==="mtime"?"desc":"asc")}function ot(z){return j!==z?"none":V==="asc"?"ascending":"descending"}function He(){y(z=>z.filter(G=>G.status==="queued"||G.status==="running"))}return n.jsxs("div",{className:"relative flex h-full flex-col bg-surface-app",children:[n.jsx("input",{ref:A,type:"file",multiple:!0,className:"hidden",onChange:z=>{const G=Array.from(z.target.files??[]);le(G),z.currentTarget.value=""}}),n.jsxs("div",{className:"flex min-h-14 flex-nowrap items-center gap-2 border-b border-border-main bg-surface-panel px-3 py-2",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[n.jsx("button",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main disabled:cursor-not-allowed disabled:opacity-40",onClick:()=>{if(a==="/")return;const z=a.split("/").slice(0,-1).join("/")||"/";he(z)},disabled:a==="/",title:"返回上级目录","aria-label":"返回上级目录",children:n.jsx(xs,{className:"rotate-180",size:16})}),n.jsxs("div",{className:Pe,onFocusCapture:()=>I("path"),onBlurCapture:z=>nt("path",z),children:[n.jsx(Qe,{size:14,className:"mr-2 shrink-0 text-blue-400 transition-colors group-focus-within:text-blue-300"}),n.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-content-dim",value:a,onChange:z=>f(z.target.value),onKeyDown:z=>{z.key==="Enter"&&he(a)}})]}),n.jsxs("div",{className:We,onFocusCapture:()=>I("search"),onBlurCapture:z=>nt("search",z),children:[n.jsx(ks,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-content-dim transition-colors group-focus-within:text-blue-400"}),n.jsx("input",{type:"text",placeholder:"搜索文件...",value:u,onChange:z=>x(z.target.value),className:"h-full w-full min-w-0 bg-transparent py-2 pl-9 pr-8 text-xs text-content-main outline-none placeholder:text-content-dim"}),u?n.jsx("button",{onClick:()=>x(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1 text-content-dim transition hover:bg-surface-muted hover:text-content-muted",title:"清空搜索","aria-label":"清空搜索",children:n.jsx(At,{size:12})}):null]})]}),n.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 rounded-2xl border border-border-subtle bg-surface-control p-1",children:[n.jsxs("div",{className:"relative",ref:r,children:[n.jsxs("button",{className:ue("relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",S||ce>0?"border-blue-500/50 bg-blue-500/10 text-blue-200":void 0),onClick:()=>T(z=>!z),title:"上传","aria-label":re,"aria-haspopup":"menu","aria-controls":Ae,"aria-expanded":S,children:[n.jsx(ft,{size:16}),n.jsx(ut,{size:11,"aria-hidden":"true",className:ue("absolute bottom-1 right-1 text-content-dim transition",S||ce>0?"text-blue-200":"text-content-dim",S&&"rotate-180")}),ce>0?n.jsx("span",{"aria-hidden":"true",className:"absolute -right-1 -top-1 rounded-full bg-blue-500/20 px-1.5 py-0.5 text-[10px] leading-none text-blue-100",children:ce}):null]}),S?n.jsxs("div",{id:Ae,role:"menu",className:"absolute right-0 top-[calc(100%+8px)] z-20 w-44 overflow-hidden rounded-2xl border border-border-main bg-surface-card shadow-2xl shadow-black/40",children:[n.jsxs("button",{role:"menuitem",className:"flex w-full items-center gap-2 px-4 py-3 text-left text-sm text-content-main transition hover:bg-surface-muted",onClick:()=>{T(!1),A.current?.click()},children:[n.jsx(ft,{size:14,className:"text-blue-400"}),"上传文件..."]}),n.jsxs("button",{role:"menuitem",className:"flex w-full items-center gap-2 border-t border-border-subtle px-4 py-3 text-left text-sm text-content-main transition hover:bg-surface-muted",onClick:Xe,children:[n.jsx(Qe,{size:14,className:"text-amber-400"}),"上传文件夹..."]})]}):null]}),n.jsx("button",{className:"relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",onClick:()=>{he()},title:"刷新目录","aria-label":"刷新目录",children:n.jsx(it,{size:16})}),n.jsx("button",{className:ue("relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",b?"border-blue-500/50 bg-blue-500/10 text-blue-200":void 0),onClick:()=>d(z=>!z),title:b?"关闭隐藏文件显示":"显示隐藏文件","aria-label":b?"关闭隐藏文件显示":"显示隐藏文件","aria-pressed":b,children:b?n.jsx(Nr,{size:16}):n.jsx(Ar,{size:16})}),n.jsx("button",{className:"relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border-subtle bg-surface-panel text-content-muted transition hover:border-border-main hover:bg-surface-muted hover:text-content-main",onClick:()=>D(!0),title:"新建目录","aria-label":"新建目录",children:n.jsx(Fr,{size:16})})]})]}),i?n.jsx("div",{className:"border-b border-blue-900/30 bg-blue-950/20 px-4 py-2 text-sm text-blue-200",children:i}):null,_.length>0?n.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-blue-900/50 bg-blue-900/15 px-4 text-sm",children:[n.jsxs("span",{className:"text-blue-300",children:["已选择 ",_.length," 项"]}),n.jsxs("div",{className:"flex items-center gap-3 text-content-muted",children:[n.jsxs("button",{onClick:()=>g.filter(z=>_.includes(z.name)).forEach(z=>{ts(c.id,xe(a,z.name),z.name)}),className:"flex items-center gap-1 hover:text-content-main",children:[n.jsx(Yt,{size:14}),"下载"]}),n.jsxs("button",{onClick:()=>{qe()},className:"flex items-center gap-1 hover:text-red-400",children:[n.jsx(gt,{size:14}),"删除"]})]})]}):null,n.jsx("div",{className:"flex-1 overflow-auto isolate",children:n.jsxs("table",{className:"min-w-[48rem] w-full text-left text-sm text-content-muted",children:[n.jsx("thead",{className:"text-xs text-content-dim",children:n.jsxs("tr",{children:[n.jsx("th",{className:"sticky top-0 z-20 w-10 border-b border-border-main bg-surface-panel px-4 py-3",children:n.jsx("input",{type:"checkbox",checked:_e,onChange:()=>w(_e?_.filter(z=>!ee.some(G=>G.name===z)):Array.from(new Set([..._,...ee.map(z=>z.name)])))})}),n.jsx("th",{className:"sticky top-0 z-20 border-b border-border-main bg-surface-panel px-2 py-3","aria-sort":ot("name"),children:n.jsxs("button",{type:"button",className:ue("inline-flex items-center gap-1.5 rounded-md transition hover:text-content-main",j==="name"?"text-blue-400":void 0),onClick:()=>et("name"),title:j==="name"&&V==="asc"?"按文件名降序排序":"按文件名升序排序","aria-label":j==="name"&&V==="asc"?"按文件名降序排序":"按文件名升序排序",children:[n.jsx("span",{children:"文件名"}),j==="name"?n.jsx(ut,{size:13,className:ue("transition",V==="asc"?"rotate-180":void 0)}):n.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-content-dim",children:"⇅"})]})}),n.jsx("th",{className:"sticky top-0 z-20 w-24 border-b border-border-main bg-surface-panel px-4 py-3",children:"大小"}),n.jsx("th",{className:"sticky top-0 z-20 w-44 border-b border-border-main bg-surface-panel px-4 py-3","aria-sort":ot("mtime"),children:n.jsxs("button",{type:"button",className:ue("inline-flex items-center gap-1.5 rounded-md whitespace-nowrap transition hover:text-content-main",j==="mtime"?"text-blue-400":void 0),onClick:()=>et("mtime"),title:j==="mtime"&&V==="desc"?"按修改时间从旧到新排序":"按修改时间从新到旧排序","aria-label":j==="mtime"&&V==="desc"?"按修改时间从旧到新排序":"按修改时间从新到旧排序",children:[n.jsx("span",{children:"修改时间"}),j==="mtime"?n.jsx(ut,{size:13,className:ue("transition",V==="asc"?"rotate-180":void 0)}):n.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-content-dim",children:"⇅"})]})}),n.jsx("th",{className:"sticky top-0 z-20 w-28 border-b border-border-main bg-surface-panel px-4 py-3",children:"权限"})]})}),n.jsxs("tbody",{children:[m?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-content-dim",children:"正在加载目录..."})}):null,s?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-red-300",children:s})}):null,!m&&!s&&ee.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-16 text-center text-content-dim",children:n.jsxs("div",{className:"mx-auto flex max-w-sm flex-col items-center gap-3 rounded-[28px] border border-dashed border-border-subtle bg-surface-muted/40 px-6 py-8",children:[n.jsx(ft,{size:22,className:"text-blue-400"}),n.jsx("div",{className:"text-sm text-content-muted",children:g.length===0?"当前目录为空":U.length===0&&!q?"当前目录暂无可见文件":"未找到匹配文件"}),n.jsx("div",{className:"text-xs text-content-dim",children:g.length===0?"拖拽文件到这里,或使用上方“上传文件...”入口开始传输。":U.length===0&&!q?"当前目录内容均为隐藏文件,可点击上方眼睛按钮临时显示。":"尝试更换关键词,或清空搜索后查看当前目录全部内容。"})]})})}):null,!m&&!s?Q.map(z=>{const G=_.includes(z.name);return n.jsxs("tr",{className:`group border-b border-border-subtle ${G?"bg-blue-500/10":"hover:bg-surface-muted"}`,onDoubleClick:()=>{z.directory&&he(xe(a,z.name))},children:[n.jsx("td",{className:"px-4 py-3",children:n.jsx("input",{type:"checkbox",checked:G,onChange:()=>w(G?_.filter(se=>se!==z.name):[..._,z.name])})}),n.jsxs("td",{className:"relative px-2 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[z.directory?n.jsx(Qe,{size:16,className:"text-blue-400"}):n.jsx(Ir,{size:16,className:"text-content-dim"}),n.jsx("span",{className:"truncate text-content-main",children:z.name})]}),n.jsxs("div",{className:"absolute right-2 top-1/2 hidden -translate-y-1/2 gap-1 rounded-lg border border-border-subtle bg-surface-card p-1 group-hover:flex",children:[z.directory?n.jsx("button",{className:"p-1 text-content-dim hover:text-blue-400",onClick:()=>{Ue(z,"tar.gz")},title:`压缩 ${z.name}`,children:n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})}):n.jsx("button",{className:"p-1 text-content-dim hover:text-cyan-400",onClick:()=>ae(xe(a,z.name)),title:`编辑 ${z.name}`,children:n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),z.name.endsWith(".tar.gz")||z.name.endsWith(".zip")||z.name.endsWith(".tgz")?n.jsx("button",{className:"p-1 text-content-dim hover:text-amber-400",onClick:()=>{ye(z)},title:`解压 ${z.name}`,children:n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),n.jsx("polyline",{points:"17 6 23 6 23 12"})]})}):null,n.jsx("button",{className:"p-1 text-content-dim hover:text-blue-300",onClick:()=>{ts(c.id,xe(a,z.name),z.name)},title:`下载 ${z.name}`,children:n.jsx(Yt,{size:13})}),n.jsx("button",{className:"p-1 text-content-dim hover:text-red-400",onClick:()=>{ss(c.id,xe(a,z.name),z.directory).then(()=>he())},title:`删除 ${z.name}`,children:n.jsx(gt,{size:13})})]})]}),n.jsx("td",{className:"px-4 py-3 text-content-dim",children:z.directory?"-":st(z.size)}),n.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[11px] tabular-nums text-content-dim",children:pi(z.mtime)}),n.jsx("td",{className:"px-4 py-3 font-mono text-xs text-content-dim",children:gi(z)})]},z.name)}):null]})]})}),N.length>0?n.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-10 w-[min(360px,calc(100%-2rem))]",children:n.jsxs("div",{className:"pointer-events-auto overflow-hidden rounded-[28px] border border-border-main bg-surface-card shadow-2xl shadow-black/30 backdrop-blur",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle px-4 py-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-content-main",children:"上传队列"}),n.jsx("div",{className:"text-xs text-content-dim",children:"单文件上传已接入现有接口与进度流。"})]}),n.jsx("button",{className:"text-xs text-content-dim transition hover:text-content-main",onClick:He,children:"清空已完成"})]}),n.jsx("div",{className:"max-h-72 space-y-3 overflow-auto p-3",children:N.map(z=>n.jsxs("div",{className:"rounded-2xl border border-border-subtle bg-surface-panel p-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"truncate text-sm text-content-main",children:z.filename}),n.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-content-dim",children:[z.status==="running"||z.status==="queued"?n.jsx(ys,{size:12,className:"animate-spin text-blue-400"}):z.status==="success"?n.jsx(St,{size:12,className:"text-emerald-400"}):z.status==="skipped"||z.status==="cancelled"?n.jsx(At,{size:12,className:"text-content-dim"}):n.jsx(Mt,{size:12,className:"text-red-400"}),n.jsx("span",{children:z.message})]})]}),n.jsxs("span",{className:"text-xs text-content-dim",children:[z.progress,"%"]})]}),n.jsx("div",{className:"mt-3 h-2 rounded-full bg-surface-muted",children:n.jsx("div",{className:ue("h-2 rounded-full transition-all",z.status==="success"?"bg-emerald-500":z.status==="skipped"||z.status==="cancelled"?"bg-content-dim":z.status==="error"?"bg-red-500":"bg-blue-500"),style:{width:`${z.progress}%`}})}),n.jsxs("div",{className:"mt-2 text-[11px] text-content-dim",children:[st(z.transferredBytes)," / ",st(z.totalBytes)]})]},z.id))})]})}):null,P.visible?n.jsx(Ne,{title:"文件冲突",maxWidth:"max-w-lg",onClose:()=>be("cancel",!1),footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>be("cancel",!1),className:"rounded bg-surface-muted px-4 py-2 text-sm text-content-muted transition-colors hover:bg-surface-panel hover:text-content-main",children:"取消"}),n.jsx("button",{onClick:()=>be("skip"),className:"rounded bg-surface-muted px-4 py-2 text-sm text-content-muted transition-colors hover:bg-surface-panel hover:text-content-main",children:"跳过"}),n.jsx("button",{onClick:()=>be("overwrite"),disabled:!P.canOverwrite,className:ue("rounded px-4 py-2 text-sm transition-colors",P.canOverwrite?"bg-blue-600 text-white hover:bg-blue-500 shadow-lg shadow-blue-500/20":"cursor-not-allowed bg-surface-muted text-content-dim shadow-none"),children:"覆盖"})]}),children:n.jsxs("div",{className:"flex items-start gap-3 text-content-muted",children:[n.jsx(Mt,{className:"mt-0.5 shrink-0 text-yellow-500",size:24}),n.jsxs("div",{children:[n.jsxs("p",{className:"mb-2",children:["目标目录中已存在名为 ",n.jsx("strong",{className:"text-content-main",children:P.fileName})," 的",P.fileType==="dir"?"文件夹":"文件","。"]}),n.jsx("p",{className:"text-sm text-content-dim",children:P.message}),P.canOverwrite?n.jsx("p",{className:"mt-2 text-sm text-content-dim",children:"请选择要执行的操作:覆盖原有文件,或者跳过该传输任务。"}):n.jsx("p",{className:"mt-2 text-sm text-content-dim",children:"同名文件夹无法直接覆盖,请选择跳过该文件或取消当前批次。"}),n.jsxs("label",{className:"group mt-5 flex w-max cursor-pointer items-center gap-2",children:[n.jsx("input",{type:"checkbox",checked:L,onChange:z=>M(z.target.checked),className:"cursor-pointer rounded border-border-main bg-surface-control text-blue-500 transition-colors focus:ring-blue-500 focus:ring-offset-surface-app"}),n.jsx("span",{className:"text-sm text-content-muted transition-colors group-hover:text-content-main",children:"应用到之后的所有冲突文件"})]})]})]})}):null,n.jsx(nn,{open:E,currentPath:a,onClose:()=>D(!1),onSubmit:we}),k?n.jsx("div",{className:"absolute bottom-4 left-4 z-10 rounded-xl border border-blue-800/40 bg-blue-950/80 px-4 py-2 text-xs text-blue-200 shadow-xl backdrop-blur",children:k}):null,X&&n.jsx(rn,{open:!!X,connectionId:c.id,filePath:X,onClose:()=>ae(null)}),O?(()=>{const z=_.length===1?_[0]:null,G=z?xe(a,z):a;return n.jsx("div",{className:"shrink-0 border-t border-purple-900/50 bg-purple-950/30 px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-xs text-content-dim",children:z?"已选择文件/文件夹":"将选择当前目录"}),n.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-purple-400",children:G})]}),n.jsx("button",{className:"shrink-0 rounded-xl bg-purple-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-purple-500",onClick:()=>H?.(G),children:"确认选择"})]})})})():null]})}var Et={exports:{}},as;function on(){return as||(as=1,(function(c,_){(function(w,R){c.exports=R()})(self,(()=>(()=>{var w={};return(()=>{var R=w;Object.defineProperty(R,"__esModule",{value:!0}),R.FitAddon=void 0,R.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){const O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;const H=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(H._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const O=this._terminal._core,H=O._renderService.dimensions;if(H.css.cell.width===0||H.css.cell.height===0)return;const A=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),a=o-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),f=h-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-A;return{cols:Math.max(2,Math.floor(f/H.css.cell.width)),rows:Math.max(1,Math.floor(a/H.css.cell.height))}}}})(),w})()))})(Et)),Et.exports}var an=on();var ln=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(c){setTimeout(()=>{throw c.stack?ls.isErrorNoTelemetry(c)?new ls(c.message+` `+c.stack):new Error(c.message+` -`+c.stack):c},0)}}addListener(c){return this.listeners.push(c),()=>{this._removeListener(c)}}emit(c){this.listeners.forEach(_=>{_(c)})}_removeListener(c){this.listeners.splice(this.listeners.indexOf(c),1)}setUnexpectedErrorHandler(c){this.unexpectedErrorHandler=c}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(c){this.unexpectedErrorHandler(c),this.emit(c)}onUnexpectedExternalError(c){this.unexpectedErrorHandler(c)}},en=new Zi;function Lt(c){tn(c)||en.onUnexpectedError(c)}var Nt="Canceled";function tn(c){return c instanceof sn?!0:c instanceof Error&&c.name===Nt&&c.message===Nt}var sn=class extends Error{constructor(){super(Nt),this.name=this.message}},as=class It extends Error{constructor(_){super(_),this.name="CodeExpectedError"}static fromError(_){if(_ instanceof It)return _;let k=new It;return k.message=_.message,k.stack=_.stack,k}static isErrorNoTelemetry(_){return _.name==="CodeExpectedError"}},rn;(c=>{function _(H){return H<0}c.isLessThan=_;function k(H){return H<=0}c.isLessThanOrEqual=k;function T(H){return H>0}c.isGreaterThan=T;function O(H){return H===0}c.isNeitherLessOrGreaterThan=O,c.greaterThan=1,c.lessThan=-1,c.neitherLessOrGreaterThan=0})(rn||={});function nn(c,_){let k=this,T=!1,O;return function(){return T||(T=!0,_||(O=c.apply(k,arguments))),O}}var Ns;(c=>{function _(l){return l&&typeof l=="object"&&typeof l[Symbol.iterator]=="function"}c.is=_;let k=Object.freeze([]);function T(){return k}c.empty=T;function*O(l){yield l}c.single=O;function H(l){return _(l)?l:O(l)}c.wrap=H;function A(l){return l||k}c.from=A;function*r(l){for(let u=l.length-1;u>=0;u--)yield l[u]}c.reverse=r;function n(l){return!l||l[Symbol.iterator]().next().done===!0}c.isEmpty=n;function h(l){return l[Symbol.iterator]().next().value}c.first=h;function p(l,u){let b=0;for(let x of l)if(u(x,b++))return!0;return!1}c.some=p;function o(l,u){for(let b of l)if(u(b))return b}c.find=o;function*f(l,u){for(let b of l)u(b)&&(yield b)}c.filter=f;function*g(l,u){let b=0;for(let x of l)yield u(x,b++)}c.map=g;function*v(l,u){let b=0;for(let x of l)yield*u(x,b++)}c.flatMap=v;function*m(...l){for(let u of l)yield*u}c.concat=m;function e(l,u,b){let x=b;for(let d of l)x=u(x,d);return x}c.reduce=e;function*s(l,u,b=l.length){for(u<0&&(u+=l.length),b<0?b+=l.length:b>l.length&&(b=l.length);u1)throw new AggregateError(_,"Encountered errors while disposing of store");return Array.isArray(c)?[]:c}else if(c)return c.dispose(),c}function Is(...c){return Ze(()=>rt(c))}function Ze(c){return{dispose:nn(()=>{c()})}}var js=class Bs{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{rt(this._toDispose)}finally{this._toDispose.clear()}}add(_){if(!_)return _;if(_===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Bs.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(_),_}delete(_){if(_){if(_===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(_),_.dispose()}}deleteAndLeak(_){_&&this._toDispose.has(_)&&(this._toDispose.delete(_),void 0)}};js.DISABLE_DISPOSED_WARNING=!1;var Wt=js,Ke=class{constructor(){this._store=new Wt,this._store}dispose(){this._store.dispose()}_register(c){if(c===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(c)}};Ke.None=Object.freeze({dispose(){}});var gt=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let c=this._value;return this._value=void 0,c}},on=globalThis.performance&&typeof globalThis.performance.now=="function",an=class Os{static create(_){return new Os(_)}constructor(_){this._now=on&&_===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},$t;(c=>{c.None=()=>Ke.None;function _(y,E){return o(y,()=>{},0,void 0,!0,void 0,E)}c.defer=_;function k(y){return(E,D=null,B)=>{let j=!1,P;return P=y(C=>{if(!j)return P?P.dispose():j=!0,E.call(D,C)},null,B),j&&P.dispose(),P}}c.once=k;function T(y,E,D){return h((B,j=null,P)=>y(C=>B.call(j,E(C)),null,P),D)}c.map=T;function O(y,E,D){return h((B,j=null,P)=>y(C=>{E(C),B.call(j,C)},null,P),D)}c.forEach=O;function H(y,E,D){return h((B,j=null,P)=>y(C=>E(C)&&B.call(j,C),null,P),D)}c.filter=H;function A(y){return y}c.signal=A;function r(...y){return(E,D=null,B)=>{let j=Is(...y.map(P=>P(C=>E.call(D,C))));return p(j,B)}}c.any=r;function n(y,E,D,B){let j=D;return T(y,P=>(j=E(j,P),j),B)}c.reduce=n;function h(y,E){let D,B={onWillAddFirstListener(){D=y(j.fire,j)},onDidRemoveLastListener(){D?.dispose()}},j=new Pe(B);return E?.add(j),j.event}function p(y,E){return E instanceof Array?E.push(y):E&&E.add(y),y}function o(y,E,D=100,B=!1,j=!1,P,C){let L,M,I,z=0,K,Y={leakWarningThreshold:P,onWillAddFirstListener(){L=y(ne=>{z++,M=E(M,ne),B&&!I&&(X.fire(M),M=void 0),K=()=>{let w=M;M=void 0,I=void 0,(!B||z>1)&&X.fire(w),z=0},typeof D=="number"?(clearTimeout(I),I=setTimeout(K,D)):I===void 0&&(I=0,queueMicrotask(K))})},onWillRemoveListener(){j&&z>0&&K?.()},onDidRemoveLastListener(){K=void 0,L.dispose()}},X=new Pe(Y);return C?.add(X),X.event}c.debounce=o;function f(y,E=0,D){return c.debounce(y,(B,j)=>B?(B.push(j),B):[j],E,void 0,!0,void 0,D)}c.accumulate=f;function g(y,E=(B,j)=>B===j,D){let B=!0,j;return H(y,P=>{let C=B||!E(P,j);return B=!1,j=P,C},D)}c.latch=g;function v(y,E,D){return[c.filter(y,E,D),c.filter(y,B=>!E(B),D)]}c.split=v;function m(y,E=!1,D=[],B){let j=D.slice(),P=y(M=>{j?j.push(M):L.fire(M)});B&&B.add(P);let C=()=>{j?.forEach(M=>L.fire(M)),j=null},L=new Pe({onWillAddFirstListener(){P||(P=y(M=>L.fire(M)),B&&B.add(P))},onDidAddFirstListener(){j&&(E?setTimeout(C):C())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return B&&B.add(L),L.event}c.buffer=m;function e(y,E){return(D,B,j)=>{let P=E(new t);return y(function(C){let L=P.evaluate(C);L!==s&&D.call(B,L)},void 0,j)}}c.chain=e;let s=Symbol("HaltChainable");class t{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(D=>(E(D),D)),this}filter(E){return this.steps.push(D=>E(D)?D:s),this}reduce(E,D){let B=D;return this.steps.push(j=>(B=E(B,j),B)),this}latch(E=(D,B)=>D===B){let D=!0,B;return this.steps.push(j=>{let P=D||!E(j,B);return D=!1,B=j,P?j:s}),this}evaluate(E){for(let D of this.steps)if(E=D(E),E===s)break;return E}}function i(y,E,D=B=>B){let B=(...L)=>C.fire(D(...L)),j=()=>y.on(E,B),P=()=>y.removeListener(E,B),C=new Pe({onWillAddFirstListener:j,onDidRemoveLastListener:P});return C.event}c.fromNodeEventEmitter=i;function l(y,E,D=B=>B){let B=(...L)=>C.fire(D(...L)),j=()=>y.addEventListener(E,B),P=()=>y.removeEventListener(E,B),C=new Pe({onWillAddFirstListener:j,onDidRemoveLastListener:P});return C.event}c.fromDOMEventEmitter=l;function u(y){return new Promise(E=>k(y)(E))}c.toPromise=u;function b(y){let E=new Pe;return y.then(D=>{E.fire(D)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}c.fromPromise=b;function x(y,E){return y(D=>E.fire(D))}c.forward=x;function d(y,E,D){return E(D),y(B=>E(B))}c.runAndSubscribe=d;class S{constructor(E,D){this._observable=E,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new Pe(B),D&&D.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,D){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(y,E){return new S(y,E).emitter.event}c.fromObservable=R;function N(y){return(E,D,B)=>{let j=0,P=!1,C={beginUpdate(){j++},endUpdate(){j--,j===0&&(y.reportChanges(),P&&(P=!1,E.call(D)))},handlePossibleChange(){},handleChange(){P=!0}};y.addObserver(C),y.reportChanges();let L={dispose(){y.removeObserver(C)}};return B instanceof Wt?B.add(L):Array.isArray(B)&&B.push(L),L}}c.fromObservableLight=N})($t||={});var jt=class Bt{constructor(_){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${_}_${Bt._idPool++}`,Bt.all.add(this)}start(_){this._stopWatch=new an,this.listenerCount=_}stop(){if(this._stopWatch){let _=this._stopWatch.elapsed();this.durations.push(_),this.elapsedOverall+=_,this.invocationCount+=1,this._stopWatch=void 0}}};jt.all=new Set,jt._idPool=0;var ln=jt,cn=-1,Ps=class Hs{constructor(_,k,T=(Hs._idPool++).toString(16).padStart(3,"0")){this._errorHandler=_,this.threshold=k,this.name=T,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(_,k){let T=this.threshold;if(T<=0||k{let H=this._stacks.get(_.value)||0;this._stacks.set(_.value,H-1)}}getMostFrequentStack(){if(!this._stacks)return;let _,k=0;for(let[T,O]of this._stacks)(!_||k{this._removeListener(c)}}emit(c){this.listeners.forEach(_=>{_(c)})}_removeListener(c){this.listeners.splice(this.listeners.indexOf(c),1)}setUnexpectedErrorHandler(c){this.unexpectedErrorHandler=c}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(c){this.unexpectedErrorHandler(c),this.emit(c)}onUnexpectedExternalError(c){this.unexpectedErrorHandler(c)}},cn=new ln;function Lt(c){hn(c)||cn.onUnexpectedError(c)}var It="Canceled";function hn(c){return c instanceof dn?!0:c instanceof Error&&c.name===It&&c.message===It}var dn=class extends Error{constructor(){super(It),this.name=this.message}},ls=class Bt extends Error{constructor(_){super(_),this.name="CodeExpectedError"}static fromError(_){if(_ instanceof Bt)return _;let w=new Bt;return w.message=_.message,w.stack=_.stack,w}static isErrorNoTelemetry(_){return _.name==="CodeExpectedError"}},un;(c=>{function _(H){return H<0}c.isLessThan=_;function w(H){return H<=0}c.isLessThanOrEqual=w;function R(H){return H>0}c.isGreaterThan=R;function O(H){return H===0}c.isNeitherLessOrGreaterThan=O,c.greaterThan=1,c.lessThan=-1,c.neitherLessOrGreaterThan=0})(un||={});function fn(c,_){let w=this,R=!1,O;return function(){return R||(R=!0,_||(O=c.apply(w,arguments))),O}}var Is;(c=>{function _(l){return l&&typeof l=="object"&&typeof l[Symbol.iterator]=="function"}c.is=_;let w=Object.freeze([]);function R(){return w}c.empty=R;function*O(l){yield l}c.single=O;function H(l){return _(l)?l:O(l)}c.wrap=H;function A(l){return l||w}c.from=A;function*r(l){for(let u=l.length-1;u>=0;u--)yield l[u]}c.reverse=r;function o(l){return!l||l[Symbol.iterator]().next().done===!0}c.isEmpty=o;function h(l){return l[Symbol.iterator]().next().value}c.first=h;function p(l,u){let x=0;for(let b of l)if(u(b,x++))return!0;return!1}c.some=p;function a(l,u){for(let x of l)if(u(x))return x}c.find=a;function*f(l,u){for(let x of l)u(x)&&(yield x)}c.filter=f;function*g(l,u){let x=0;for(let b of l)yield u(b,x++)}c.map=g;function*v(l,u){let x=0;for(let b of l)yield*u(b,x++)}c.flatMap=v;function*m(...l){for(let u of l)yield*u}c.concat=m;function e(l,u,x){let b=x;for(let d of l)b=u(b,d);return b}c.reduce=e;function*s(l,u,x=l.length){for(u<0&&(u+=l.length),x<0?x+=l.length:x>l.length&&(x=l.length);u1)throw new AggregateError(_,"Encountered errors while disposing of store");return Array.isArray(c)?[]:c}else if(c)return c.dispose(),c}function Bs(...c){return Ze(()=>rt(c))}function Ze(c){return{dispose:fn(()=>{c()})}}var Os=class Ps{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{rt(this._toDispose)}finally{this._toDispose.clear()}}add(_){if(!_)return _;if(_===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Ps.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(_),_}delete(_){if(_){if(_===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(_),_.dispose()}}deleteAndLeak(_){_&&this._toDispose.has(_)&&(this._toDispose.delete(_),void 0)}};Os.DISABLE_DISPOSED_WARNING=!1;var $t=Os,$e=class{constructor(){this._store=new $t,this._store}dispose(){this._store.dispose()}_register(c){if(c===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(c)}};$e.None=Object.freeze({dispose(){}});var xt=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let c=this._value;return this._value=void 0,c}},_n=globalThis.performance&&typeof globalThis.performance.now=="function",mn=class Hs{static create(_){return new Hs(_)}constructor(_){this._now=_n&&_===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ut;(c=>{c.None=()=>$e.None;function _(y,E){return a(y,()=>{},0,void 0,!0,void 0,E)}c.defer=_;function w(y){return(E,D=null,B)=>{let I=!1,P;return P=y(C=>{if(!I)return P?P.dispose():I=!0,E.call(D,C)},null,B),I&&P.dispose(),P}}c.once=w;function R(y,E,D){return h((B,I=null,P)=>y(C=>B.call(I,E(C)),null,P),D)}c.map=R;function O(y,E,D){return h((B,I=null,P)=>y(C=>{E(C),B.call(I,C)},null,P),D)}c.forEach=O;function H(y,E,D){return h((B,I=null,P)=>y(C=>E(C)&&B.call(I,C),null,P),D)}c.filter=H;function A(y){return y}c.signal=A;function r(...y){return(E,D=null,B)=>{let I=Bs(...y.map(P=>P(C=>E.call(D,C))));return p(I,B)}}c.any=r;function o(y,E,D,B){let I=D;return R(y,P=>(I=E(I,P),I),B)}c.reduce=o;function h(y,E){let D,B={onWillAddFirstListener(){D=y(I.fire,I)},onDidRemoveLastListener(){D?.dispose()}},I=new Be(B);return E?.add(I),I.event}function p(y,E){return E instanceof Array?E.push(y):E&&E.add(y),y}function a(y,E,D=100,B=!1,I=!1,P,C){let L,M,j,$=0,V,Y={leakWarningThreshold:P,onWillAddFirstListener(){L=y(ae=>{$++,M=E(M,ae),B&&!j&&(X.fire(M),M=void 0),V=()=>{let k=M;M=void 0,j=void 0,(!B||$>1)&&X.fire(k),$=0},typeof D=="number"?(clearTimeout(j),j=setTimeout(V,D)):j===void 0&&(j=0,queueMicrotask(V))})},onWillRemoveListener(){I&&$>0&&V?.()},onDidRemoveLastListener(){V=void 0,L.dispose()}},X=new Be(Y);return C?.add(X),X.event}c.debounce=a;function f(y,E=0,D){return c.debounce(y,(B,I)=>B?(B.push(I),B):[I],E,void 0,!0,void 0,D)}c.accumulate=f;function g(y,E=(B,I)=>B===I,D){let B=!0,I;return H(y,P=>{let C=B||!E(P,I);return B=!1,I=P,C},D)}c.latch=g;function v(y,E,D){return[c.filter(y,E,D),c.filter(y,B=>!E(B),D)]}c.split=v;function m(y,E=!1,D=[],B){let I=D.slice(),P=y(M=>{I?I.push(M):L.fire(M)});B&&B.add(P);let C=()=>{I?.forEach(M=>L.fire(M)),I=null},L=new Be({onWillAddFirstListener(){P||(P=y(M=>L.fire(M)),B&&B.add(P))},onDidAddFirstListener(){I&&(E?setTimeout(C):C())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return B&&B.add(L),L.event}c.buffer=m;function e(y,E){return(D,B,I)=>{let P=E(new t);return y(function(C){let L=P.evaluate(C);L!==s&&D.call(B,L)},void 0,I)}}c.chain=e;let s=Symbol("HaltChainable");class t{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(D=>(E(D),D)),this}filter(E){return this.steps.push(D=>E(D)?D:s),this}reduce(E,D){let B=D;return this.steps.push(I=>(B=E(B,I),B)),this}latch(E=(D,B)=>D===B){let D=!0,B;return this.steps.push(I=>{let P=D||!E(I,B);return D=!1,B=I,P?I:s}),this}evaluate(E){for(let D of this.steps)if(E=D(E),E===s)break;return E}}function i(y,E,D=B=>B){let B=(...L)=>C.fire(D(...L)),I=()=>y.on(E,B),P=()=>y.removeListener(E,B),C=new Be({onWillAddFirstListener:I,onDidRemoveLastListener:P});return C.event}c.fromNodeEventEmitter=i;function l(y,E,D=B=>B){let B=(...L)=>C.fire(D(...L)),I=()=>y.addEventListener(E,B),P=()=>y.removeEventListener(E,B),C=new Be({onWillAddFirstListener:I,onDidRemoveLastListener:P});return C.event}c.fromDOMEventEmitter=l;function u(y){return new Promise(E=>w(y)(E))}c.toPromise=u;function x(y){let E=new Be;return y.then(D=>{E.fire(D)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}c.fromPromise=x;function b(y,E){return y(D=>E.fire(D))}c.forward=b;function d(y,E,D){return E(D),y(B=>E(B))}c.runAndSubscribe=d;class S{constructor(E,D){this._observable=E,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new Be(B),D&&D.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,D){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(y,E){return new S(y,E).emitter.event}c.fromObservable=T;function N(y){return(E,D,B)=>{let I=0,P=!1,C={beginUpdate(){I++},endUpdate(){I--,I===0&&(y.reportChanges(),P&&(P=!1,E.call(D)))},handlePossibleChange(){},handleChange(){P=!0}};y.addObserver(C),y.reportChanges();let L={dispose(){y.removeObserver(C)}};return B instanceof $t?B.add(L):Array.isArray(B)&&B.push(L),L}}c.fromObservableLight=N})(Ut||={});var Ot=class Pt{constructor(_){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${_}_${Pt._idPool++}`,Pt.all.add(this)}start(_){this._stopWatch=new mn,this.listenerCount=_}stop(){if(this._stopWatch){let _=this._stopWatch.elapsed();this.durations.push(_),this.elapsedOverall+=_,this.invocationCount+=1,this._stopWatch=void 0}}};Ot.all=new Set,Ot._idPool=0;var pn=Ot,gn=-1,Fs=class Ws{constructor(_,w,R=(Ws._idPool++).toString(16).padStart(3,"0")){this._errorHandler=_,this.threshold=w,this.name=R,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(_,w){let R=this.threshold;if(R<=0||w{let H=this._stacks.get(_.value)||0;this._stacks.set(_.value,H-1)}}getMostFrequentStack(){if(!this._stacks)return;let _,w=0;for(let[R,O]of this._stacks)(!_||w{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let A=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(A);let r=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new fn(`${A}. HINT: Stack shows most frequent listener (${r[1]}-times)`,r[0]);return(this._options?.onListenerError||Lt)(n),Ke.None}if(this._disposed)return Ke.None;_&&(c=c.bind(_));let T=new Dt(c),O;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(T.stack=dn.create(),O=this._leakageMon.check(T.stack,this._size+1)),this._listeners?this._listeners instanceof Dt?(this._deliveryQueue??=new vn,this._listeners=[this._listeners,T]):this._listeners.push(T):(this._options?.onWillAddFirstListener?.(this),this._listeners=T,this._options?.onDidAddFirstListener?.(this)),this._size++;let H=Ze(()=>{O?.(),this._removeListener(T)});return k instanceof Wt?k.add(H):Array.isArray(k)&&k.push(H),H},this._event}_removeListener(c){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let _=this._listeners,k=_.indexOf(c);if(k===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,_[k]=void 0;let T=this._deliveryQueue.current===this;if(this._size*mn<=_.length){let O=0;for(let H=0;H<_.length;H++)_[H]?_[O++]=_[H]:T&&(this._deliveryQueue.end--,O0}},vn=class{constructor(){this.i=-1,this.end=0}enqueue(c,_,k){this.i=0,this.end=k,this.current=c,this.value=_}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ws=Object.freeze(function(c,_){let k=setTimeout(c.bind(_),0);return{dispose(){clearTimeout(k)}}}),gn;(c=>{function _(k){return k===c.None||k===c.Cancelled||k instanceof bn?!0:!k||typeof k!="object"?!1:typeof k.isCancellationRequested=="boolean"&&typeof k.onCancellationRequested=="function"}c.isCancellationToken=_,c.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$t.None}),c.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ws})})(gn||={});var bn=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Ws:(this._emitter||(this._emitter=new Pe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Je="en",Rt=!1,at,ut=Je,ls=Je,xn,We,Xe=globalThis,Ee;typeof Xe.vscode<"u"&&typeof Xe.vscode.process<"u"?Ee=Xe.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ee=process);var Sn=typeof Ee?.versions?.electron=="string",Cn=Sn&&Ee?.type==="renderer";if(typeof Ee=="object"){Ee.platform,Ee.platform,Rt=Ee.platform==="linux",Rt&&Ee.env.SNAP&&Ee.env.SNAP_REVISION,Ee.env.CI||Ee.env.BUILD_ARTIFACTSTAGINGDIRECTORY,at=Je,ut=Je;let c=Ee.env.VSCODE_NLS_CONFIG;if(c)try{let _=JSON.parse(c);at=_.userLocale,ls=_.osLocale,ut=_.resolvedLanguage||Je,xn=_.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!Cn?(We=navigator.userAgent,We.indexOf("Windows")>=0,We.indexOf("Macintosh")>=0,(We.indexOf("Macintosh")>=0||We.indexOf("iPad")>=0||We.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Rt=We.indexOf("Linux")>=0,We?.indexOf("Mobi")>=0,ut=globalThis._VSCODE_NLS_LANGUAGE||Je,at=navigator.language.toLowerCase(),ls=at):console.error("Unable to resolve platform.");var He=We,qe=ut,yn;(c=>{function _(){return qe}c.value=_;function k(){return qe.length===2?qe==="en":qe.length>=3?qe[0]==="e"&&qe[1]==="n"&&qe[2]==="-":!1}c.isDefaultVariant=k;function T(){return qe==="en"}c.isDefault=T})(yn||={});var wn=typeof Xe.postMessage=="function"&&!Xe.importScripts;(()=>{if(wn){let c=[];Xe.addEventListener("message",k=>{if(k.data&&k.data.vscodeScheduleAsyncWork)for(let T=0,O=c.length;T{let T=++_;c.push({id:T,callback:k}),Xe.postMessage({vscodeScheduleAsyncWork:T},"*")}}return c=>setTimeout(c)})();var kn=!!(He&&He.indexOf("Chrome")>=0);He&&He.indexOf("Firefox")>=0;!kn&&He&&He.indexOf("Safari")>=0;He&&He.indexOf("Edg/")>=0;He&&He.indexOf("Android")>=0;function $s(c,_=0,k){let T=setTimeout(()=>{c()},_);return Ze(()=>{clearTimeout(T)})}var En;(c=>{async function _(T){let O,H=await Promise.all(T.map(A=>A.then(r=>r,r=>{O||(O=r)})));if(typeof O<"u")throw O;return H}c.settled=_;function k(T){return new Promise(async(O,H)=>{try{await T(O,H)}catch(A){H(A)}})}c.withAsyncBody=k})(En||={});var cs=class Te{static fromArray(_){return new Te(k=>{k.emitMany(_)})}static fromPromise(_){return new Te(async k=>{k.emitMany(await _)})}static fromPromises(_){return new Te(async k=>{await Promise.all(_.map(async T=>k.emitOne(await T)))})}static merge(_){return new Te(async k=>{await Promise.all(_.map(async T=>{for await(let O of T)k.emitOne(O)}))})}constructor(_,k){this._state=0,this._results=[],this._error=null,this._onReturn=k,this._onStateChanged=new Pe,queueMicrotask(async()=>{let T={emitOne:O=>this.emitOne(O),emitMany:O=>this.emitMany(O),reject:O=>this.reject(O)};try{await Promise.resolve(_(T)),this.resolve()}catch(O){this.reject(O)}finally{T.emitOne=void 0,T.emitMany=void 0,T.reject=void 0}})}[Symbol.asyncIterator](){let _=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(_(this._onReturn?.(),{done:!0,value:void 0})}}static map(_,k){return new Te(async T=>{for await(let O of _)T.emitOne(k(O))})}map(_){return Te.map(this,_)}static filter(_,k){return new Te(async T=>{for await(let O of _)k(O)&&T.emitOne(O)})}filter(_){return Te.filter(this,_)}static coalesce(_){return Te.filter(_,k=>!!k)}coalesce(){return Te.coalesce(this)}static async toPromise(_){let k=[];for await(let T of _)k.push(T);return k}toPromise(){return Te.toPromise(this)}emitOne(_){this._state===0&&(this._results.push(_),this._onStateChanged.fire())}emitMany(_){this._state===0&&(this._results=this._results.concat(_),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(_){this._state===0&&(this._state=2,this._error=_,this._onStateChanged.fire())}};cs.EMPTY=cs.fromArray([]);var Ln=class extends Ke{constructor(c){super(),this._terminal=c,this._linesCacheTimeout=this._register(new gt),this._linesCacheDisposables=this._register(new gt),this._register(Ze(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Is(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=$s(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(c){return this._linesCache?.[c]}setLineInCache(c,_){this._linesCache&&(this._linesCache[c]=_)}translateBufferLineToStringWithWrap(c,_){let k=[],T=[0],O=this._terminal.buffer.active.getLine(c);for(;O;){let H=this._terminal.buffer.active.getLine(c+1),A=H?H.isWrapped:!1,r=O.translateToString(!A&&_);if(A&&H){let n=O.getCell(O.length-1);n&&n.getCode()===0&&n.getWidth()===1&&H.getCell(0)?.getWidth()===2&&(r=r.slice(0,-1))}if(k.push(r),A)T.push(T[T.length-1]+r.length);else break;c++,O=H}return[k.join(""),T]}},Dn=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(c){this._cachedSearchTerm=c}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(c){this._lastSearchOptions=c}isValidSearchTerm(c){return!!(c&&c.length>0)}didOptionsChange(c){return this._lastSearchOptions?c?this._lastSearchOptions.caseSensitive!==c.caseSensitive||this._lastSearchOptions.regex!==c.regex||this._lastSearchOptions.wholeWord!==c.wholeWord:!1:!0}shouldUpdateHighlighting(c,_){return _?.decorations?this._cachedSearchTerm===void 0||c!==this._cachedSearchTerm||this.didOptionsChange(_):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Rn=class{constructor(c,_){this._terminal=c,this._lineCache=_}find(c,_,k,T){if(!c||c.length===0){this._terminal.clearSelection();return}if(k>this._terminal.cols)throw new Error(`Invalid col: ${k} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let O={startRow:_,startCol:k},H=this._findInLine(c,O,T);if(!H)for(let A=_+1;A=0&&(r.startRow=h,n=this._findInLine(c,r,_,A),!n);h--);}if(!n&&O!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=O&&(r.startRow=h,n=this._findInLine(c,r,_,A),!n);h--);return n}_isWholeWord(c,_,k){return(c===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(_[c-1]))&&(c+k.length===_.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(_[c+k.length]))}_findInLine(c,_,k={},T=!1){let O=_.startRow,H=_.startCol;if(this._terminal.buffer.active.getLine(O)?.isWrapped){if(T){_.startCol+=this._terminal.cols;return}return _.startRow--,_.startCol+=this._terminal.cols,this._findInLine(c,_,k)}let A=this._lineCache.getLineFromCache(O);A||(A=this._lineCache.translateBufferLineToStringWithWrap(O,!0),this._lineCache.setLineInCache(O,A));let[r,n]=A,h=this._bufferColsToStringOffset(O,H),p=c,o=r;k.regex||(p=k.caseSensitive?c:c.toLowerCase(),o=k.caseSensitive?r:r.toLowerCase());let f=-1;if(k.regex){let g=RegExp(p,k.caseSensitive?"g":"gi"),v;if(T)for(;v=g.exec(o.slice(0,h));)f=g.lastIndex-v[0].length,c=v[0],g.lastIndex-=c.length-1;else v=g.exec(o.slice(h)),v&&v[0].length>0&&(f=h+(g.lastIndex-v[0].length),c=v[0])}else T?h-p.length>=0&&(f=o.lastIndexOf(p,h-p.length)):f=o.indexOf(p,h);if(f>=0){if(k.wholeWord&&!this._isWholeWord(f,o,c))return;let g=0;for(;g=n[g+1];)g++;let v=g;for(;v=n[v+1];)v++;let m=f-n[g],e=f+c.length-n[v],s=this._stringLengthToBufferSize(O+g,m),t=this._stringLengthToBufferSize(O+v,e)-s+this._terminal.cols*(v-g);return{term:c,col:s,row:O+g,size:t}}}_stringLengthToBufferSize(c,_){let k=this._terminal.buffer.active.getLine(c);if(!k)return 0;for(let T=0;T<_;T++){let O=k.getCell(T);if(!O)break;let H=O.getChars();H.length>1&&(_-=H.length-1);let A=k.getCell(T+1);A&&A.getWidth()===0&&_++}return _}_bufferColsToStringOffset(c,_){let k=c,T=0,O=this._terminal.buffer.active.getLine(k);for(;_>0&&O;){for(let H=0;H<_&&Hthis.clearHighlightDecorations()))}createHighlightDecorations(c,_){this.clearHighlightDecorations();for(let k of c){let T=this._createResultDecorations(k,_,!1);if(T)for(let O of T)this._storeDecoration(O,k)}}createActiveDecoration(c,_){let k=this._createResultDecorations(c,_,!0);if(k)return{decorations:k,match:c,dispose(){rt(k)}}}clearHighlightDecorations(){rt(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(c,_){this._highlightedLines.add(c.marker.line),this._highlightDecorations.push({decoration:c,match:_,dispose(){c.dispose()}})}_applyStyles(c,_,k){c.classList.contains("xterm-find-result-decoration")||(c.classList.add("xterm-find-result-decoration"),_&&(c.style.outline=`1px solid ${_}`)),k&&c.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(c,_,k){let T=[],O=c.col,H=c.size,A=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+c.row;for(;H>0;){let n=Math.min(this._terminal.cols-O,H);T.push([A,O,n]),O=0,H-=n,A++}let r=[];for(let n of T){let h=this._terminal.registerMarker(n[0]),p=this._terminal.registerDecoration({marker:h,x:n[1],width:n[2],backgroundColor:k?_.activeMatchBackground:_.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:k?_.activeMatchColorOverviewRuler:_.matchOverviewRuler,position:"center"}});if(p){let o=[];o.push(h),o.push(p.onRender(f=>this._applyStyles(f,k?_.activeMatchBorder:_.matchBorder,!1))),o.push(p.onDispose(()=>rt(o))),r.push(p)}}return r.length===0?void 0:r}},An=class extends Ke{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Pe)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(c){this._selectedDecoration=c}updateResults(c,_){this._searchResults=c.slice(0,_)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(c){for(let _=0;_this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ze(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=$s(()=>{let c=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(c,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(c){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),c||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(c,_,k){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=_,this._state.shouldUpdateHighlighting(c,_)&&this._highlightAllMatches(c,_);let T=this._findNextAndSelect(c,_,k);return this._fireResults(_),this._state.cachedSearchTerm=c,T}_highlightAllMatches(c,_){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(c)){this.clearDecorations();return}this.clearDecorations(!0);let k=[],T,O=this._engine.find(c,0,0,_);for(;O&&(T?.row!==O.row||T?.col!==O.col)&&!(k.length>=this._highlightLimit);)T=O,k.push(T),O=this._engine.find(c,T.col+T.term.length>=this._terminal.cols?T.row+1:T.row,T.col+T.term.length>=this._terminal.cols?0:T.col+1,_);this._resultTracker.updateResults(k,this._highlightLimit),_.decorations&&this._decorationManager.createHighlightDecorations(k,_.decorations)}_findNextAndSelect(c,_,k){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(c))return this._terminal.clearSelection(),this.clearDecorations(),!1;let T=this._engine.findNextWithSelection(c,_,this._state.cachedSearchTerm);return this._selectResult(T,_?.decorations,k?.noScroll)}findPrevious(c,_,k){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=_,this._state.shouldUpdateHighlighting(c,_)&&this._highlightAllMatches(c,_);let T=this._findPreviousAndSelect(c,_,k);return this._fireResults(_),this._state.cachedSearchTerm=c,T}_fireResults(c){this._resultTracker.fireResultsChanged(!!c?.decorations)}_findPreviousAndSelect(c,_,k){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(c))return this._terminal.clearSelection(),this.clearDecorations(),!1;let T=this._engine.findPreviousWithSelection(c,_,this._state.cachedSearchTerm);return this._selectResult(T,_?.decorations,k?.noScroll)}_selectResult(c,_,k){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!c)return this._terminal.clearSelection(),!1;if(this._terminal.select(c.col,c.row,c.size),_){let T=this._decorationManager.createActiveDecoration(c,_);T&&(this._resultTracker.selectedDecoration=T)}if(!k&&(c.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||c.row(()=>{var k={4567:function(A,r,n){var h=this&&this.__decorate||function(i,l,u,b){var x,d=arguments.length,S=d<3?l:b===null?b=Object.getOwnPropertyDescriptor(l,u):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,l,u,b);else for(var R=i.length-1;R>=0;R--)(x=i[R])&&(S=(d<3?x(S):d>3?x(l,u,S):x(l,u))||S);return d>3&&S&&Object.defineProperty(l,u,S),S},p=this&&this.__param||function(i,l){return function(u,b){l(u,b,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=n(9042),f=n(6114),g=n(9924),v=n(844),m=n(5596),e=n(4725),s=n(3656);let t=r.AccessibilityManager=class extends v.Disposable{constructor(i,l){super(),this._terminal=i,this._renderService=l,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;uthis._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`))}},xn=class extends Error{constructor(c,_){super(c),this.name="ListenerLeakError",this.stack=_}},Sn=class extends Error{constructor(c,_){super(c),this.name="ListenerRefusalError",this.stack=_}},Cn=0,Dt=class{constructor(c){this.value=c,this.id=Cn++}},yn=2,wn,Be=class{constructor(c){this._size=0,this._options=c,this._leakageMon=this._options?.leakWarningThreshold?new vn(c?.onListenerError??Lt,this._options?.leakWarningThreshold??gn):void 0,this._perfMon=this._options?._profName?new pn(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(c,_,w)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let A=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(A);let r=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],o=new Sn(`${A}. HINT: Stack shows most frequent listener (${r[1]}-times)`,r[0]);return(this._options?.onListenerError||Lt)(o),$e.None}if(this._disposed)return $e.None;_&&(c=c.bind(_));let R=new Dt(c),O;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(R.stack=bn.create(),O=this._leakageMon.check(R.stack,this._size+1)),this._listeners?this._listeners instanceof Dt?(this._deliveryQueue??=new kn,this._listeners=[this._listeners,R]):this._listeners.push(R):(this._options?.onWillAddFirstListener?.(this),this._listeners=R,this._options?.onDidAddFirstListener?.(this)),this._size++;let H=Ze(()=>{O?.(),this._removeListener(R)});return w instanceof $t?w.add(H):Array.isArray(w)&&w.push(H),H},this._event}_removeListener(c){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let _=this._listeners,w=_.indexOf(c);if(w===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,_[w]=void 0;let R=this._deliveryQueue.current===this;if(this._size*yn<=_.length){let O=0;for(let H=0;H<_.length;H++)_[H]?_[O++]=_[H]:R&&(this._deliveryQueue.end--,O0}},kn=class{constructor(){this.i=-1,this.end=0}enqueue(c,_,w){this.i=0,this.end=w,this.current=c,this.value=_}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$s=Object.freeze(function(c,_){let w=setTimeout(c.bind(_),0);return{dispose(){clearTimeout(w)}}}),En;(c=>{function _(w){return w===c.None||w===c.Cancelled||w instanceof Ln?!0:!w||typeof w!="object"?!1:typeof w.isCancellationRequested=="boolean"&&typeof w.onCancellationRequested=="function"}c.isCancellationToken=_,c.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ut.None}),c.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$s})})(En||={});var Ln=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$s:(this._emitter||(this._emitter=new Be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Je="en",Rt=!1,ht,mt=Je,cs=Je,Dn,Fe,Ge=globalThis,De;typeof Ge.vscode<"u"&&typeof Ge.vscode.process<"u"?De=Ge.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(De=process);var Rn=typeof De?.versions?.electron=="string",Tn=Rn&&De?.type==="renderer";if(typeof De=="object"){De.platform,De.platform,Rt=De.platform==="linux",Rt&&De.env.SNAP&&De.env.SNAP_REVISION,De.env.CI||De.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ht=Je,mt=Je;let c=De.env.VSCODE_NLS_CONFIG;if(c)try{let _=JSON.parse(c);ht=_.userLocale,cs=_.osLocale,mt=_.resolvedLanguage||Je,Dn=_.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!Tn?(Fe=navigator.userAgent,Fe.indexOf("Windows")>=0,Fe.indexOf("Macintosh")>=0,(Fe.indexOf("Macintosh")>=0||Fe.indexOf("iPad")>=0||Fe.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Rt=Fe.indexOf("Linux")>=0,Fe?.indexOf("Mobi")>=0,mt=globalThis._VSCODE_NLS_LANGUAGE||Je,ht=navigator.language.toLowerCase(),cs=ht):console.error("Unable to resolve platform.");var Oe=Fe,ze=mt,An;(c=>{function _(){return ze}c.value=_;function w(){return ze.length===2?ze==="en":ze.length>=3?ze[0]==="e"&&ze[1]==="n"&&ze[2]==="-":!1}c.isDefaultVariant=w;function R(){return ze==="en"}c.isDefault=R})(An||={});var Mn=typeof Ge.postMessage=="function"&&!Ge.importScripts;(()=>{if(Mn){let c=[];Ge.addEventListener("message",w=>{if(w.data&&w.data.vscodeScheduleAsyncWork)for(let R=0,O=c.length;R{let R=++_;c.push({id:R,callback:w}),Ge.postMessage({vscodeScheduleAsyncWork:R},"*")}}return c=>setTimeout(c)})();var Nn=!!(Oe&&Oe.indexOf("Chrome")>=0);Oe&&Oe.indexOf("Firefox")>=0;!Nn&&Oe&&Oe.indexOf("Safari")>=0;Oe&&Oe.indexOf("Edg/")>=0;Oe&&Oe.indexOf("Android")>=0;function Us(c,_=0,w){let R=setTimeout(()=>{c()},_);return Ze(()=>{clearTimeout(R)})}var jn;(c=>{async function _(R){let O,H=await Promise.all(R.map(A=>A.then(r=>r,r=>{O||(O=r)})));if(typeof O<"u")throw O;return H}c.settled=_;function w(R){return new Promise(async(O,H)=>{try{await R(O,H)}catch(A){H(A)}})}c.withAsyncBody=w})(jn||={});var hs=class Te{static fromArray(_){return new Te(w=>{w.emitMany(_)})}static fromPromise(_){return new Te(async w=>{w.emitMany(await _)})}static fromPromises(_){return new Te(async w=>{await Promise.all(_.map(async R=>w.emitOne(await R)))})}static merge(_){return new Te(async w=>{await Promise.all(_.map(async R=>{for await(let O of R)w.emitOne(O)}))})}constructor(_,w){this._state=0,this._results=[],this._error=null,this._onReturn=w,this._onStateChanged=new Be,queueMicrotask(async()=>{let R={emitOne:O=>this.emitOne(O),emitMany:O=>this.emitMany(O),reject:O=>this.reject(O)};try{await Promise.resolve(_(R)),this.resolve()}catch(O){this.reject(O)}finally{R.emitOne=void 0,R.emitMany=void 0,R.reject=void 0}})}[Symbol.asyncIterator](){let _=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(_(this._onReturn?.(),{done:!0,value:void 0})}}static map(_,w){return new Te(async R=>{for await(let O of _)R.emitOne(w(O))})}map(_){return Te.map(this,_)}static filter(_,w){return new Te(async R=>{for await(let O of _)w(O)&&R.emitOne(O)})}filter(_){return Te.filter(this,_)}static coalesce(_){return Te.filter(_,w=>!!w)}coalesce(){return Te.coalesce(this)}static async toPromise(_){let w=[];for await(let R of _)w.push(R);return w}toPromise(){return Te.toPromise(this)}emitOne(_){this._state===0&&(this._results.push(_),this._onStateChanged.fire())}emitMany(_){this._state===0&&(this._results=this._results.concat(_),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(_){this._state===0&&(this._state=2,this._error=_,this._onStateChanged.fire())}};hs.EMPTY=hs.fromArray([]);var In=class extends $e{constructor(c){super(),this._terminal=c,this._linesCacheTimeout=this._register(new xt),this._linesCacheDisposables=this._register(new xt),this._register(Ze(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Bs(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Us(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(c){return this._linesCache?.[c]}setLineInCache(c,_){this._linesCache&&(this._linesCache[c]=_)}translateBufferLineToStringWithWrap(c,_){let w=[],R=[0],O=this._terminal.buffer.active.getLine(c);for(;O;){let H=this._terminal.buffer.active.getLine(c+1),A=H?H.isWrapped:!1,r=O.translateToString(!A&&_);if(A&&H){let o=O.getCell(O.length-1);o&&o.getCode()===0&&o.getWidth()===1&&H.getCell(0)?.getWidth()===2&&(r=r.slice(0,-1))}if(w.push(r),A)R.push(R[R.length-1]+r.length);else break;c++,O=H}return[w.join(""),R]}},Bn=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(c){this._cachedSearchTerm=c}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(c){this._lastSearchOptions=c}isValidSearchTerm(c){return!!(c&&c.length>0)}didOptionsChange(c){return this._lastSearchOptions?c?this._lastSearchOptions.caseSensitive!==c.caseSensitive||this._lastSearchOptions.regex!==c.regex||this._lastSearchOptions.wholeWord!==c.wholeWord:!1:!0}shouldUpdateHighlighting(c,_){return _?.decorations?this._cachedSearchTerm===void 0||c!==this._cachedSearchTerm||this.didOptionsChange(_):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},On=class{constructor(c,_){this._terminal=c,this._lineCache=_}find(c,_,w,R){if(!c||c.length===0){this._terminal.clearSelection();return}if(w>this._terminal.cols)throw new Error(`Invalid col: ${w} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let O={startRow:_,startCol:w},H=this._findInLine(c,O,R);if(!H)for(let A=_+1;A=0&&(r.startRow=h,o=this._findInLine(c,r,_,A),!o);h--);}if(!o&&O!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=O&&(r.startRow=h,o=this._findInLine(c,r,_,A),!o);h--);return o}_isWholeWord(c,_,w){return(c===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(_[c-1]))&&(c+w.length===_.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(_[c+w.length]))}_findInLine(c,_,w={},R=!1){let O=_.startRow,H=_.startCol;if(this._terminal.buffer.active.getLine(O)?.isWrapped){if(R){_.startCol+=this._terminal.cols;return}return _.startRow--,_.startCol+=this._terminal.cols,this._findInLine(c,_,w)}let A=this._lineCache.getLineFromCache(O);A||(A=this._lineCache.translateBufferLineToStringWithWrap(O,!0),this._lineCache.setLineInCache(O,A));let[r,o]=A,h=this._bufferColsToStringOffset(O,H),p=c,a=r;w.regex||(p=w.caseSensitive?c:c.toLowerCase(),a=w.caseSensitive?r:r.toLowerCase());let f=-1;if(w.regex){let g=RegExp(p,w.caseSensitive?"g":"gi"),v;if(R)for(;v=g.exec(a.slice(0,h));)f=g.lastIndex-v[0].length,c=v[0],g.lastIndex-=c.length-1;else v=g.exec(a.slice(h)),v&&v[0].length>0&&(f=h+(g.lastIndex-v[0].length),c=v[0])}else R?h-p.length>=0&&(f=a.lastIndexOf(p,h-p.length)):f=a.indexOf(p,h);if(f>=0){if(w.wholeWord&&!this._isWholeWord(f,a,c))return;let g=0;for(;g=o[g+1];)g++;let v=g;for(;v=o[v+1];)v++;let m=f-o[g],e=f+c.length-o[v],s=this._stringLengthToBufferSize(O+g,m),t=this._stringLengthToBufferSize(O+v,e)-s+this._terminal.cols*(v-g);return{term:c,col:s,row:O+g,size:t}}}_stringLengthToBufferSize(c,_){let w=this._terminal.buffer.active.getLine(c);if(!w)return 0;for(let R=0;R<_;R++){let O=w.getCell(R);if(!O)break;let H=O.getChars();H.length>1&&(_-=H.length-1);let A=w.getCell(R+1);A&&A.getWidth()===0&&_++}return _}_bufferColsToStringOffset(c,_){let w=c,R=0,O=this._terminal.buffer.active.getLine(w);for(;_>0&&O;){for(let H=0;H<_&&Hthis.clearHighlightDecorations()))}createHighlightDecorations(c,_){this.clearHighlightDecorations();for(let w of c){let R=this._createResultDecorations(w,_,!1);if(R)for(let O of R)this._storeDecoration(O,w)}}createActiveDecoration(c,_){let w=this._createResultDecorations(c,_,!0);if(w)return{decorations:w,match:c,dispose(){rt(w)}}}clearHighlightDecorations(){rt(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(c,_){this._highlightedLines.add(c.marker.line),this._highlightDecorations.push({decoration:c,match:_,dispose(){c.dispose()}})}_applyStyles(c,_,w){c.classList.contains("xterm-find-result-decoration")||(c.classList.add("xterm-find-result-decoration"),_&&(c.style.outline=`1px solid ${_}`)),w&&c.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(c,_,w){let R=[],O=c.col,H=c.size,A=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+c.row;for(;H>0;){let o=Math.min(this._terminal.cols-O,H);R.push([A,O,o]),O=0,H-=o,A++}let r=[];for(let o of R){let h=this._terminal.registerMarker(o[0]),p=this._terminal.registerDecoration({marker:h,x:o[1],width:o[2],backgroundColor:w?_.activeMatchBackground:_.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:w?_.activeMatchColorOverviewRuler:_.matchOverviewRuler,position:"center"}});if(p){let a=[];a.push(h),a.push(p.onRender(f=>this._applyStyles(f,w?_.activeMatchBorder:_.matchBorder,!1))),a.push(p.onDispose(()=>rt(a))),r.push(p)}}return r.length===0?void 0:r}},Hn=class extends $e{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Be)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(c){this._selectedDecoration=c}updateResults(c,_){this._searchResults=c.slice(0,_)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(c){for(let _=0;_this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ze(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Us(()=>{let c=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(c,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(c){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),c||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(c,_,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=_,this._state.shouldUpdateHighlighting(c,_)&&this._highlightAllMatches(c,_);let R=this._findNextAndSelect(c,_,w);return this._fireResults(_),this._state.cachedSearchTerm=c,R}_highlightAllMatches(c,_){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(c)){this.clearDecorations();return}this.clearDecorations(!0);let w=[],R,O=this._engine.find(c,0,0,_);for(;O&&(R?.row!==O.row||R?.col!==O.col)&&!(w.length>=this._highlightLimit);)R=O,w.push(R),O=this._engine.find(c,R.col+R.term.length>=this._terminal.cols?R.row+1:R.row,R.col+R.term.length>=this._terminal.cols?0:R.col+1,_);this._resultTracker.updateResults(w,this._highlightLimit),_.decorations&&this._decorationManager.createHighlightDecorations(w,_.decorations)}_findNextAndSelect(c,_,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(c))return this._terminal.clearSelection(),this.clearDecorations(),!1;let R=this._engine.findNextWithSelection(c,_,this._state.cachedSearchTerm);return this._selectResult(R,_?.decorations,w?.noScroll)}findPrevious(c,_,w){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=_,this._state.shouldUpdateHighlighting(c,_)&&this._highlightAllMatches(c,_);let R=this._findPreviousAndSelect(c,_,w);return this._fireResults(_),this._state.cachedSearchTerm=c,R}_fireResults(c){this._resultTracker.fireResultsChanged(!!c?.decorations)}_findPreviousAndSelect(c,_,w){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(c))return this._terminal.clearSelection(),this.clearDecorations(),!1;let R=this._engine.findPreviousWithSelection(c,_,this._state.cachedSearchTerm);return this._selectResult(R,_?.decorations,w?.noScroll)}_selectResult(c,_,w){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!c)return this._terminal.clearSelection(),!1;if(this._terminal.select(c.col,c.row,c.size),_){let R=this._decorationManager.createActiveDecoration(c,_);R&&(this._resultTracker.selectedDecoration=R)}if(!w&&(c.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||c.row(()=>{var w={4567:function(A,r,o){var h=this&&this.__decorate||function(i,l,u,x){var b,d=arguments.length,S=d<3?l:x===null?x=Object.getOwnPropertyDescriptor(l,u):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,l,u,x);else for(var T=i.length-1;T>=0;T--)(b=i[T])&&(S=(d<3?b(S):d>3?b(l,u,S):b(l,u))||S);return d>3&&S&&Object.defineProperty(l,u,S),S},p=this&&this.__param||function(i,l){return function(u,x){l(u,x,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const a=o(9042),f=o(6114),g=o(9924),v=o(844),m=o(5596),e=o(4725),s=o(3656);let t=r.AccessibilityManager=class extends v.Disposable{constructor(i,l){super(),this._terminal=i,this._renderService=l,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;uthis._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` `)))),this.register(this._terminal.onA11yTab((u=>this._handleTab(u)))),this.register(this._terminal.onKey((u=>this._handleKey(u.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new m.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,s.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let l=0;l0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)),f.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,f.isMac&&this._liveRegion.remove()}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,l){this._liveRegionDebouncer.refresh(i,l,this._terminal.rows)}_renderRows(i,l){const u=this._terminal.buffer,b=u.lines.length.toString();for(let x=i;x<=l;x++){const d=u.translateBufferLineToString(u.ydisp+x,!0),S=(u.ydisp+x+1).toString(),R=this._rowElements[x];R&&(d.length===0?R.innerText=" ":R.textContent=d,R.setAttribute("aria-posinset",S),R.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,l){const u=i.target,b=this._rowElements[l===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(l===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==b)return;let x,d;if(l===0?(x=u,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(x=this._rowElements.shift(),d=u,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),l===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(l===0?-1:1),this._rowElements[l===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let l=this._rowContainer.children.length;li;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=document.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i{function n(f){return f.replace(/\r?\n/g,"\r")}function h(f,g){return g?"\x1B[200~"+f+"\x1B[201~":f}function p(f,g,v,m){f=h(f=n(f),v.decPrivateModes.bracketedPasteMode&&m.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(f,!0),g.value=""}function o(f,g,v){const m=v.getBoundingClientRect(),e=f.clientX-m.left-10,s=f.clientY-m.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${s}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=n,r.bracketTextForPaste=h,r.copyHandler=function(f,g){f.clipboardData&&f.clipboardData.setData("text/plain",g.selectionText),f.preventDefault()},r.handlePasteEvent=function(f,g,v,m){f.stopPropagation(),f.clipboardData&&p(f.clipboardData.getData("text/plain"),g,v,m)},r.paste=p,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(f,g,v,m,e){o(f,g,v),e&&m.rightClickSelect(f),g.value=m.selectionText,g.select()}},7239:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const h=n(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(p,o,f){this._css.set(p,o,f)}getCss(p,o){return this._css.get(p,o)}setColor(p,o,f){this._color.set(p,o,f)}getColor(p,o){return this._color.get(p,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,h,p,o){n.addEventListener(h,p,o);let f=!1;return{dispose:()=>{f||(f=!0,n.removeEventListener(h,p,o))}}}},6465:function(A,r,n){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,b=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(e,s,t,i);else for(var x=e.length-1;x>=0;x--)(l=e[x])&&(b=(u<3?l(b):u>3?l(s,t,b):l(s,t))||b);return u>3&&b&&Object.defineProperty(s,t,b),b},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const o=n(3656),f=n(8460),g=n(844),v=n(2585);let m=r.Linkifier2=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i{u?.forEach((b=>{b.link.dispose&&b.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let l=!1;for(const[u,b]of this._linkProviders.entries())s?!((i=this._activeProviderReplies)===null||i===void 0)&&i.get(u)&&(l=this._checkLinkProviderResult(u,e,l)):b.provideLinks(e.y,(x=>{var d,S;if(this._isMouseOut)return;const R=x?.map((N=>({link:N})));(d=this._activeProviderReplies)===null||d===void 0||d.set(u,R),l=this._checkLinkProviderResult(u,e,l),((S=this._activeProviderReplies)===null||S===void 0?void 0:S.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;ie?this._bufferService.cols:b.link.range.end.x;for(let S=x;S<=d;S++){if(t.has(S)){l.splice(u--,1);break}t.add(S)}}}}_checkLinkProviderResult(e,s,t){var i;if(!this._activeProviderReplies)return t;const l=this._activeProviderReplies.get(e);let u=!1;for(let b=0;bthis._linkAtPosition(x.link,s)));b&&(t=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let b=0;bthis._linkAtPosition(d.link,s)));if(x){t=!0,this._handleNewLink(x);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,l;!((i=this._currentLink)===null||i===void 0)&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((l=this._element)===null||l===void 0||l.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,l,u;!((i=this._currentLink)===null||i===void 0)&&i.state&&((u=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||u===void 0?void 0:u.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(i,l),this._lastMouseEvent&&this._element)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}}))))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){const t=e.range,i=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,l=s.y*this._bufferService.cols+s.x;return t<=l&&l<=i}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,l){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:l}}};r.Linkifier2=m=h([p(0,v.IBufferService)],m)},9042:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(A,r,n){var h=this&&this.__decorate||function(m,e,s,t){var i,l=arguments.length,u=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,e,s,t);else for(var b=m.length-1;b>=0;b--)(i=m[b])&&(u=(l<3?i(u):l>3?i(e,s,u):i(e,s))||u);return l>3&&u&&Object.defineProperty(e,s,u),u},p=this&&this.__param||function(m,e){return function(s,t){e(s,t,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const o=n(511),f=n(2585);let g=r.OscLinkProvider=class{constructor(m,e,s){this._bufferService=m,this._optionsService=e,this._oscLinkService=s}provideLinks(m,e){var s;const t=this._bufferService.buffer.lines.get(m-1);if(!t)return void e(void 0);const i=[],l=this._optionsService.rawOptions.linkHandler,u=new o.CellData,b=t.getTrimmedLength();let x=-1,d=-1,S=!1;for(let R=0;Rl?l.activate(D,B,y):v(0,B),hover:(D,B)=>{var j;return(j=l?.hover)===null||j===void 0?void 0:j.call(l,D,B,y)},leave:(D,B)=>{var j;return(j=l?.leave)===null||j===void 0?void 0:j.call(l,D,B,y)}})}S=!1,u.hasExtendedAttrs()&&u.extended.urlId?(d=R,x=u.extended.urlId):(d=-1,x=-1)}}e(i)}};function v(m,e){if(confirm(`Do you want to navigate to ${e}? +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)),f.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,f.isMac&&this._liveRegion.remove()}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,l){this._liveRegionDebouncer.refresh(i,l,this._terminal.rows)}_renderRows(i,l){const u=this._terminal.buffer,x=u.lines.length.toString();for(let b=i;b<=l;b++){const d=u.translateBufferLineToString(u.ydisp+b,!0),S=(u.ydisp+b+1).toString(),T=this._rowElements[b];T&&(d.length===0?T.innerText=" ":T.textContent=d,T.setAttribute("aria-posinset",S),T.setAttribute("aria-setsize",x))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,l){const u=i.target,x=this._rowElements[l===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(l===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==x)return;let b,d;if(l===0?(b=u,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(b=this._rowElements.shift(),d=u,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),l===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(l===0?-1:1),this._rowElements[l===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let l=this._rowContainer.children.length;li;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=document.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i{function o(f){return f.replace(/\r?\n/g,"\r")}function h(f,g){return g?"\x1B[200~"+f+"\x1B[201~":f}function p(f,g,v,m){f=h(f=o(f),v.decPrivateModes.bracketedPasteMode&&m.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(f,!0),g.value=""}function a(f,g,v){const m=v.getBoundingClientRect(),e=f.clientX-m.left-10,s=f.clientY-m.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${s}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=h,r.copyHandler=function(f,g){f.clipboardData&&f.clipboardData.setData("text/plain",g.selectionText),f.preventDefault()},r.handlePasteEvent=function(f,g,v,m){f.stopPropagation(),f.clipboardData&&p(f.clipboardData.getData("text/plain"),g,v,m)},r.paste=p,r.moveTextAreaUnderMouseCursor=a,r.rightClickHandler=function(f,g,v,m,e){a(f,g,v),e&&m.rightClickSelect(f),g.value=m.selectionText,g.select()}},7239:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const h=o(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(p,a,f){this._css.set(p,a,f)}getCss(p,a){return this._css.get(p,a)}setColor(p,a,f){this._color.set(p,a,f)}getColor(p,a){return this._color.get(p,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,h,p,a){o.addEventListener(h,p,a);let f=!1;return{dispose:()=>{f||(f=!0,o.removeEventListener(h,p,a))}}}},6465:function(A,r,o){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,x=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(e,s,t,i);else for(var b=e.length-1;b>=0;b--)(l=e[b])&&(x=(u<3?l(x):u>3?l(s,t,x):l(s,t))||x);return u>3&&x&&Object.defineProperty(s,t,x),x},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const a=o(3656),f=o(8460),g=o(844),v=o(2585);let m=r.Linkifier2=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i{u?.forEach((x=>{x.link.dispose&&x.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let l=!1;for(const[u,x]of this._linkProviders.entries())s?!((i=this._activeProviderReplies)===null||i===void 0)&&i.get(u)&&(l=this._checkLinkProviderResult(u,e,l)):x.provideLinks(e.y,(b=>{var d,S;if(this._isMouseOut)return;const T=b?.map((N=>({link:N})));(d=this._activeProviderReplies)===null||d===void 0||d.set(u,T),l=this._checkLinkProviderResult(u,e,l),((S=this._activeProviderReplies)===null||S===void 0?void 0:S.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;ie?this._bufferService.cols:x.link.range.end.x;for(let S=b;S<=d;S++){if(t.has(S)){l.splice(u--,1);break}t.add(S)}}}}_checkLinkProviderResult(e,s,t){var i;if(!this._activeProviderReplies)return t;const l=this._activeProviderReplies.get(e);let u=!1;for(let x=0;xthis._linkAtPosition(b.link,s)));x&&(t=!0,this._handleNewLink(x))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let x=0;xthis._linkAtPosition(d.link,s)));if(b){t=!0,this._handleNewLink(b);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,l;!((i=this._currentLink)===null||i===void 0)&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((l=this._element)===null||l===void 0||l.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,l,u;!((i=this._currentLink)===null||i===void 0)&&i.state&&((u=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||u===void 0?void 0:u.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(i,l),this._lastMouseEvent&&this._element)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}}))))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){const t=e.range,i=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,l=s.y*this._bufferService.cols+s.x;return t<=l&&l<=i}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,l){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:l}}};r.Linkifier2=m=h([p(0,v.IBufferService)],m)},9042:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(A,r,o){var h=this&&this.__decorate||function(m,e,s,t){var i,l=arguments.length,u=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,e,s,t);else for(var x=m.length-1;x>=0;x--)(i=m[x])&&(u=(l<3?i(u):l>3?i(e,s,u):i(e,s))||u);return l>3&&u&&Object.defineProperty(e,s,u),u},p=this&&this.__param||function(m,e){return function(s,t){e(s,t,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const a=o(511),f=o(2585);let g=r.OscLinkProvider=class{constructor(m,e,s){this._bufferService=m,this._optionsService=e,this._oscLinkService=s}provideLinks(m,e){var s;const t=this._bufferService.buffer.lines.get(m-1);if(!t)return void e(void 0);const i=[],l=this._optionsService.rawOptions.linkHandler,u=new a.CellData,x=t.getTrimmedLength();let b=-1,d=-1,S=!1;for(let T=0;Tl?l.activate(D,B,y):v(0,B),hover:(D,B)=>{var I;return(I=l?.hover)===null||I===void 0?void 0:I.call(l,D,B,y)},leave:(D,B)=>{var I;return(I=l?.leave)===null||I===void 0?void 0:I.call(l,D,B,y)}})}S=!1,u.hasExtendedAttrs()&&u.extended.urlId?(d=T,b=u.extended.urlId):(d=-1,b=-1)}}e(i)}};function v(m,e){if(confirm(`Do you want to navigate to ${e}? -WARNING: This link could potentially be dangerous`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=g=h([p(0,f.IBufferService),p(1,f.IOptionsService),p(2,f.IOscLinkService)],g)},6193:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,h){this._parentWindow=n,this._renderCallback=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,h,p){this._rowCount=p,n=n!==void 0?n:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},5596:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const h=n(844);class p extends h.Disposable{constructor(f){super(),this._parentWindow=f,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,h.toDisposable)((()=>{this.clearListener()})))}setListener(f){this._listener&&this.clearListener(),this._listener=f,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var f;this._outerListener&&((f=this._resolutionMediaMatchList)===null||f===void 0||f.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=p},3236:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const h=n(3614),p=n(3656),o=n(6465),f=n(9042),g=n(3730),v=n(1680),m=n(3107),e=n(5744),s=n(2950),t=n(1296),i=n(428),l=n(4269),u=n(5114),b=n(8934),x=n(3230),d=n(9312),S=n(4725),R=n(6731),N=n(8055),y=n(8969),E=n(8460),D=n(844),B=n(6114),j=n(8437),P=n(2584),C=n(7399),L=n(5941),M=n(9074),I=n(2585),z=n(5435),K=n(4567),Y=typeof window<"u"?window.document:null;class X extends y.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(w={}){super(w),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new D.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(I.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,U)=>this.refresh(F,U)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,D.toDisposable)((()=>{var F,U;this._customKeyEventHandler=void 0,(U=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||U===void 0||U.removeChild(this.element)})))}_handleColorEvent(w){if(this._themeService)for(const F of w){let U,q="";switch(F.index){case 256:U="foreground",q="10";break;case 257:U="background",q="11";break;case 258:U="cursor",q="12";break;default:U="ansi",q="4;"+F.index}switch(F.type){case 0:const ee=N.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${P.C0.ESC}]${q};${(0,L.toRgbString)(ee)}${P.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors((J=>J.ansi[F.index]=N.rgba.toColor(...F.color)));else{const J=U;this._themeService.modifyColors((oe=>oe[J]=N.rgba.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(w){w?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(w){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[I"),this.updateCursorStyle(w),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var w;return(w=this.textarea)===null||w===void 0?void 0:w.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const w=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(w);if(!F)return;const U=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,ee=F.getWidth(U),J=this._renderService.dimensions.css.cell.width*ee,oe=this.buffer.y*this._renderService.dimensions.css.cell.height,ue=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ue+"px",this.textarea.style.top=oe+"px",this.textarea.style.width=J+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,h.copyHandler)(F,this._selectionService)})));const w=F=>(0,h.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",w)),this.register((0,p.addDisposableDomListener)(this.element,"paste",w)),B.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,h.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,h.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,h.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(w=>this._keyUp(w)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(w=>this._keyDown(w)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(w=>this._keyPress(w)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(w=>this._compositionHelper.compositionupdate(w)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(w=>this._inputEvent(w)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(w){var F;if(!w)throw new Error("Terminal requires a parent element.");w.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=w.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),w.appendChild(this.element);const U=Y.createDocumentFragment();this._viewportElement=Y.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=Y.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=Y.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=Y.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=Y.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(u.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(q=>this._handleTextAreaFocus(q)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((q=>this._onRender.fire(q)))),this.onResize((q=>this._renderService.resize(q.cols,q.rows))),this._compositionView=Y.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(v.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((q=>this.scrollLines(q.amount,q.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((q=>this.scrollLines(q.amount,q.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((q=>this._renderService.handleSelectionChanged(q.start,q.end,q.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((q=>{this.textarea.value=q,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((q=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(m.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(q=>this._selectionService.handleMouseDown(q)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(q=>this._handleScreenReaderModeOptionChange(q)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(q=>{!this._overviewRulerRenderer&&q&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const w=this,F=this.element;function U(J){const oe=w._mouseService.getMouseReportCoords(J,w.screenElement);if(!oe)return!1;let ue,he;switch(J.overrideType||J.type){case"mousemove":he=32,J.buttons===void 0?(ue=3,J.button!==void 0&&(ue=J.button<3?J.button:3)):ue=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":he=0,ue=J.button<3?J.button:3;break;case"mousedown":he=1,ue=J.button<3?J.button:3;break;case"wheel":if(w.viewport.getLinesScrolled(J)===0)return!1;he=J.deltaY<0?0:1,ue=4;break;default:return!1}return!(he===void 0||ue===void 0||ue>4)&&w.coreMouseService.triggerMouseEvent({col:oe.col,row:oe.row,x:oe.x,y:oe.y,button:ue,action:he,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}const q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ee={mouseup:J=>(U(J),J.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(J)),wheel:J=>(U(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&U(J)},mousemove:J=>{J.buttons||U(J)}};this.register(this.coreMouseService.onProtocolChange((J=>{J?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(J)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&J?q.mousemove||(F.addEventListener("mousemove",ee.mousemove),q.mousemove=ee.mousemove):(F.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&J?q.wheel||(F.addEventListener("wheel",ee.wheel,{passive:!1}),q.wheel=ee.wheel):(F.removeEventListener("wheel",q.wheel),q.wheel=null),2&J?q.mouseup||(F.addEventListener("mouseup",ee.mouseup),q.mouseup=ee.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),F.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&J?q.mousedrag||(q.mousedrag=ee.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(F,"mousedown",(J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return U(J),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(J)}))),this.register((0,p.addDisposableDomListener)(F,"wheel",(J=>{if(!q.wheel){if(!this.buffer.hasScrollback){const oe=this.viewport.getLinesScrolled(J);if(oe===0)return;const ue=P.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B");let he="";for(let xe=0;xe{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(F,"touchmove",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)}),{passive:!1}))}refresh(w,F){var U;(U=this._renderService)===null||U===void 0||U.refreshRows(w,F)}updateCursorStyle(w){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(w)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(w,F,U=0){var q;U===1?(super.scrollLines(w,F,U),this.refresh(0,this.rows-1)):(q=this.viewport)===null||q===void 0||q.scrollLines(w)}paste(w){(0,h.paste)(w,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(w){this._customKeyEventHandler=w}registerLinkProvider(w){return this.linkifier2.registerLinkProvider(w)}registerCharacterJoiner(w){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(w);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(w){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(w)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(w){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+w)}registerDecoration(w){return this._decorationService.registerDecoration(w)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(w,F,U){this._selectionService.setSelection(w,F,U)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var w;(w=this._selectionService)===null||w===void 0||w.clearSelection()}selectAll(){var w;(w=this._selectionService)===null||w===void 0||w.selectAll()}selectLines(w,F){var U;(U=this._selectionService)===null||U===void 0||U.selectLines(w,F)}_keyDown(w){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(w)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&w.altKey;if(!F&&!this._compositionHelper.keydown(w))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||w.key!=="Dead"&&w.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,C.evaluateKeyboardEvent)(w,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(w),U.type===3||U.type===2){const q=this.rows-1;return this.scrollLines(U.type===2?-q:q),this.cancel(w,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,w)||(U.cancel&&this.cancel(w,!0),!U.key||!!(w.key&&!w.ctrlKey&&!w.altKey&&!w.metaKey&&w.key.length===1&&w.key.charCodeAt(0)>=65&&w.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==P.C0.ETX&&U.key!==P.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:w}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||w.altKey||w.ctrlKey?this.cancel(w,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(w,F){const U=w.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||w.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||w.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?U:U&&(!F.keyCode||F.keyCode>47)}_keyUp(w){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(w)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(w)||this.focus(),this.updateCursorStyle(w),this._keyPressHandled=!1)}_keyPress(w){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(w)===!1)return!1;if(this.cancel(w),w.charCode)F=w.charCode;else if(w.which===null||w.which===void 0)F=w.keyCode;else{if(w.which===0||w.charCode===0)return!1;F=w.which}return!(!F||(w.altKey||w.ctrlKey||w.metaKey)&&!this._isThirdLevelShift(this.browser,w)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:w}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(w){if(w.data&&w.inputType==="insertText"&&(!w.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=w.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(w),!0}return!1}resize(w,F){w!==this.cols||F!==this.rows?super.resize(w,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(w,F){var U,q;(U=this._charSizeService)===null||U===void 0||U.measure(),(q=this.viewport)===null||q===void 0||q.syncScrollArea(!0)}clear(){var w;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let F=1;F{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,h=1e3){this._renderCallback=n,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,h,p){this._rowCount=p,n=n!==void 0?n:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){const f=o-this._lastRefreshMs,g=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const n=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,h)}}},1680:function(A,r,n){var h=this&&this.__decorate||function(s,t,i,l){var u,b=arguments.length,x=b<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,t,i,l);else for(var d=s.length-1;d>=0;d--)(u=s[d])&&(x=(b<3?u(x):b>3?u(t,i,x):u(t,i))||x);return b>3&&x&&Object.defineProperty(t,i,x),x},p=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const o=n(3656),f=n(4725),g=n(8460),v=n(844),m=n(2585);let e=r.Viewport=class extends v.Disposable{constructor(s,t,i,l,u,b,x,d){super(),this._viewportElement=s,this._scrollArea=t,this._bufferService=i,this._optionsService=l,this._charSizeService=u,this._renderService=b,this._coreBrowserService=x,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((S=>this._renderDimensions=S))),this._handleThemeChange(d.colors),this.register(d.onChangeColors((S=>this._handleThemeChange(S)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&i0&&(l=y),u=""}}return{bufferElements:b,cursorElement:l}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let t=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(s,t){const i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&t.altKey||i==="ctrl"&&t.ctrlKey||i==="shift"&&t.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const t=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(s,t))}};r.Viewport=e=h([p(2,m.IBufferService),p(3,m.IOptionsService),p(4,f.ICharSizeService),p(5,f.IRenderService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],e)},3107:function(A,r,n){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,b=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(e,s,t,i);else for(var x=e.length-1;x>=0;x--)(l=e[x])&&(b=(u<3?l(b):u>3?l(s,t,b):l(s,t))||b);return u>3&&b&&Object.defineProperty(s,t,b),b},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const o=n(3656),f=n(4725),g=n(844),v=n(2585);let m=r.BufferDecorationRenderer=class extends g.Disposable{constructor(e,s,t,i){super(),this._screenElement=e,this._bufferService=s,this._decorationService=t,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register((0,o.addDisposableDomListener)(window,"resize",(()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((l=>this._removeDecoration(l)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s,t;const i=document.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((s=e?.options)===null||s===void 0?void 0:s.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const l=(t=e.options.x)!==null&&t!==void 0?t:0;return l&&l>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){const s=e.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t),e.onDispose((()=>{this._decorationElements.delete(e),t.remove()}))),t.style.top=s*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,s=e.element){var t;if(!s)return;const i=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?s.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":s.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var s;(s=this._decorationElements.get(e))===null||s===void 0||s.remove(),this._decorationElements.delete(e),e.dispose()}};r.BufferDecorationRenderer=m=h([p(1,v.IBufferService),p(2,v.IDecorationService),p(3,f.IRenderService)],m)},5871:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(n){if(n.options.overviewRulerOptions){for(const h of this._zones)if(h.color===n.options.overviewRulerOptions.color&&h.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,n.marker.line))return;if(this._lineAdjacentToZone(h,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(h,n.marker.line)}if(this._zonePoolIndex=n.startBufferLine&&h<=n.endBufferLine}_lineAdjacentToZone(n,h,p){return h>=n.startBufferLine-this._linePadding[p||"full"]&&h<=n.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(n,h){n.startBufferLine=Math.min(n.startBufferLine,h),n.endBufferLine=Math.max(n.endBufferLine,h)}}},5744:function(A,r,n){var h=this&&this.__decorate||function(l,u,b,x){var d,S=arguments.length,R=S<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(l,u,b,x);else for(var N=l.length-1;N>=0;N--)(d=l[N])&&(R=(S<3?d(R):S>3?d(u,b,R):d(u,b))||R);return S>3&&R&&Object.defineProperty(u,b,R),R},p=this&&this.__param||function(l,u){return function(b,x){u(b,x,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const o=n(5871),f=n(3656),g=n(4725),v=n(844),m=n(2585),e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let i=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(l,u,b,x,d,S,R){var N;super(),this._viewportElement=l,this._screenElement=u,this._bufferService=b,this._decorationService=x,this._renderService=d,this._optionsService=S,this._coreBrowseService=R,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(N=this._viewportElement.parentElement)===null||N===void 0||N.insertBefore(this._canvas,this._viewportElement);const y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var E;(E=this._canvas)===null||E===void 0||E.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register((0,f.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const l=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=l,s.center=u,s.right=l,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=s.left,t.right=s.left+s.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const l=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(l,12),6)*this._coreBrowseService.dpr);e.left=u,e.center=u,e.right=u}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const l=this._colorZoneStore.zones;for(const u of l)u.position!=="full"&&this._renderColorZone(u);for(const u of l)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(l){this._ctx.fillStyle=l.color,this._ctx.fillRect(t[l.position||"full"],Math.round((this._canvas.height-1)*(l.startBufferLine/this._bufferService.buffers.active.lines.length)-e[l.position||"full"]/2),s[l.position||"full"],Math.round((this._canvas.height-1)*((l.endBufferLine-l.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[l.position||"full"]))}_queueRefresh(l,u){this._shouldUpdateDimensions=l||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=i=h([p(2,m.IBufferService),p(3,m.IDecorationService),p(4,g.IRenderService),p(5,m.IOptionsService),p(6,g.ICoreBrowserService)],i)},2950:function(A,r,n){var h=this&&this.__decorate||function(m,e,s,t){var i,l=arguments.length,u=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,e,s,t);else for(var b=m.length-1;b>=0;b--)(i=m[b])&&(u=(l<3?i(u):l>3?i(e,s,u):i(e,s))||u);return l>3&&u&&Object.defineProperty(e,s,u),u},p=this&&this.__param||function(m,e){return function(s,t){e(s,t,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const o=n(4725),f=n(2585),g=n(2584);let v=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(m,e,s,t,i,l){this._textarea=m,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(m){this._compositionView.textContent=m.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(m){if(this._isComposing||this._isSendingComposition){if(m.keyCode===229||m.keyCode===16||m.keyCode===17||m.keyCode===18)return!1;this._finalizeComposition(!1)}return m.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(m){if(this._compositionView.classList.remove("active"),this._isComposing=!1,m){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const m=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,s=e.replace(m,"");this._dataAlreadySent=s,e.length>m.length?this._coreService.triggerDataEvent(s,!0):e.lengththis.updateCompositionElements(!0)),0)}}};r.CompositionHelper=v=h([p(2,f.IBufferService),p(3,f.IOptionsService),p(4,f.ICoreService),p(5,o.IRenderService)],v)},9806:(A,r)=>{function n(h,p,o){const f=o.getBoundingClientRect(),g=h.getComputedStyle(o),v=parseInt(g.getPropertyValue("padding-left")),m=parseInt(g.getPropertyValue("padding-top"));return[p.clientX-f.left-v,p.clientY-f.top-m]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(h,p,o,f,g,v,m,e,s){if(!v)return;const t=n(h,p,o);return t?(t[0]=Math.ceil((t[0]+(s?m/2:0))/m),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),f+(s?1:0)),t[1]=Math.min(Math.max(t[1],1),g),t):void 0}},9504:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const h=n(2584);function p(e,s,t,i){const l=e-o(e,t),u=s-o(s,t),b=Math.abs(l-u)-(function(x,d,S){let R=0;const N=x-o(x,S),y=d-o(d,S);for(let E=0;E=0&&es?"A":"B"}function g(e,s,t,i,l,u){let b=e,x=s,d="";for(;b!==t||x!==i;)b+=l?1:-1,l&&b>u.cols-1?(d+=u.buffer.translateBufferLineToString(x,!1,e,b),b=0,e=0,x++):!l&&b<0&&(d+=u.buffer.translateBufferLineToString(x,!1,0,e+1),b=u.cols-1,e=b,x--);return d+u.buffer.translateBufferLineToString(x,!1,e,b)}function v(e,s){const t=s?"O":"[";return h.C0.ESC+t+e}function m(e,s){e=Math.floor(e);let t="";for(let i=0;i0?N-o(N,y):S;const B=N,j=(function(P,C,L,M,I,z){let K;return K=p(L,M,I,z).length>0?M-o(M,I):C,P=L&&Ke?"D":"C",m(Math.abs(l-e),v(b,i));b=u>s?"D":"C";const x=Math.abs(u-s);return m((function(d,S){return S.cols-d})(u>s?e:l,t)+(x-1)*t.cols+1+((u>s?l:e)-1),v(b,i))}},1296:function(A,r,n){var h=this&&this.__decorate||function(y,E,D,B){var j,P=arguments.length,C=P<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(y,E,D,B);else for(var L=y.length-1;L>=0;L--)(j=y[L])&&(C=(P<3?j(C):P>3?j(E,D,C):j(E,D))||C);return P>3&&C&&Object.defineProperty(E,D,C),C},p=this&&this.__param||function(y,E){return function(D,B){E(D,B,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const o=n(3787),f=n(2550),g=n(2223),v=n(6171),m=n(4725),e=n(8055),s=n(8460),t=n(844),i=n(2585),l="xterm-dom-renderer-owner-",u="xterm-rows",b="xterm-fg-",x="xterm-bg-",d="xterm-focus",S="xterm-selection";let R=1,N=r.DomRenderer=class extends t.Disposable{constructor(y,E,D,B,j,P,C,L,M,I){super(),this._element=y,this._screenElement=E,this._viewportElement=D,this._linkifier2=B,this._charSizeService=P,this._optionsService=C,this._bufferService=L,this._coreBrowserService=M,this._themeService=I,this._terminalClass=R++,this._rowElements=[],this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((z=>this._injectCss(z)))),this._injectCss(this._themeService.colors),this._rowFactory=j.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(l+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((z=>this._handleLinkHover(z)))),this.register(this._linkifier2.onHideLinkUnderline((z=>this._handleLinkLeave(z)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(l+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new f.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const y=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*y,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*y),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/y),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/y),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const D of this._rowElements)D.style.width=`${this.dimensions.css.canvas.width}px`,D.style.height=`${this.dimensions.css.cell.height}px`,D.style.lineHeight=`${this.dimensions.css.cell.height}px`,D.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const E=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=E,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(y){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let E=`${this._terminalSelector} .${u} { color: ${y.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;E+=`${this._terminalSelector} .${u} .xterm-dim { color: ${e.color.multiplyOpacity(y.foreground,.5).css};}`,E+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,E+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",E+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css}; } 50% { background-color: inherit; color: ${y.cursor.css}; }}`,E+=`${this._terminalSelector} .${u}.${d} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${u}.${d} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${y.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${y.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${y.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,E+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${y.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${y.selectionInactiveBackgroundOpaque.css};}`;for(const[D,B]of y.ansi.entries())E+=`${this._terminalSelector} .${b}${D} { color: ${B.css}; }${this._terminalSelector} .${b}${D}.xterm-dim { color: ${e.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${x}${D} { background-color: ${B.css}; }`;E+=`${this._terminalSelector} .${b}${g.INVERTED_DEFAULT_COLOR} { color: ${e.color.opaque(y.background).css}; }${this._terminalSelector} .${b}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${e.color.multiplyOpacity(e.color.opaque(y.background),.5).css}; }${this._terminalSelector} .${x}${g.INVERTED_DEFAULT_COLOR} { background-color: ${y.foreground.css}; }`,this._themeStyleElement.textContent=E}_setDefaultSpacing(){const y=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${y}px`,this._rowFactory.defaultSpacing=y}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(y,E){for(let D=this._rowElements.length;D<=E;D++){const B=document.createElement("div");this._rowContainer.appendChild(B),this._rowElements.push(B)}for(;this._rowElements.length>E;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(y,E){this._refreshRowElements(y,E),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(d)}handleFocus(){this._rowContainer.classList.add(d),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(y,E,D){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(y,E,D),this.renderRows(0,this._bufferService.rows-1),!y||!E)return;const B=y[1]-this._bufferService.buffer.ydisp,j=E[1]-this._bufferService.buffer.ydisp,P=Math.max(B,0),C=Math.min(j,this._bufferService.rows-1);if(P>=this._bufferService.rows||C<0)return;const L=document.createDocumentFragment();if(D){const M=y[0]>E[0];L.appendChild(this._createSelectionElement(P,M?E[0]:y[0],M?y[0]:E[0],C-P+1))}else{const M=B===P?y[0]:0,I=P===j?E[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(P,M,I));const z=C-P-1;if(L.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,z)),P!==C){const K=j===C?E[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,K))}}this._selectionContainer.appendChild(L)}_createSelectionElement(y,E,D,B=1){const j=document.createElement("div");return j.style.height=B*this.dimensions.css.cell.height+"px",j.style.top=y*this.dimensions.css.cell.height+"px",j.style.left=E*this.dimensions.css.cell.width+"px",j.style.width=this.dimensions.css.cell.width*(D-E)+"px",j}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const y of this._rowElements)y.replaceChildren()}renderRows(y,E){const D=this._bufferService.buffer,B=D.ybase+D.y,j=Math.min(D.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=y;M<=E;M++){const I=M+D.ydisp,z=this._rowElements[M],K=D.lines.get(I);if(!z||!K)break;z.replaceChildren(...this._rowFactory.createRow(K,I,I===B,C,L,j,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${l}${this._terminalClass}`}_handleLinkHover(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)}_handleLinkLeave(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)}_setCellUnderline(y,E,D,B,j,P){D<0&&(y=0),B<0&&(E=0);const C=this._bufferService.rows-1;D=Math.max(Math.min(D,C),0),B=Math.max(Math.min(B,C),0),j=Math.min(j,this._bufferService.cols);const L=this._bufferService.buffer,M=L.ybase+L.y,I=Math.min(L.x,j-1),z=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let X=D;X<=B;++X){const ne=X+L.ydisp,w=this._rowElements[X],F=L.lines.get(ne);if(!w||!F)break;w.replaceChildren(...this._rowFactory.createRow(F,ne,ne===M,K,Y,I,z,this.dimensions.css.cell.width,this._widthCache,P?X===D?y:0:-1,P?(X===B?E:j)-1:-1))}}};r.DomRenderer=N=h([p(4,i.IInstantiationService),p(5,m.ICharSizeService),p(6,i.IOptionsService),p(7,i.IBufferService),p(8,m.ICoreBrowserService),p(9,m.IThemeService)],N)},3787:function(A,r,n){var h=this&&this.__decorate||function(b,x,d,S){var R,N=arguments.length,y=N<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(b,x,d,S);else for(var E=b.length-1;E>=0;E--)(R=b[E])&&(y=(N<3?R(y):N>3?R(x,d,y):R(x,d))||y);return N>3&&y&&Object.defineProperty(x,d,y),y},p=this&&this.__param||function(b,x){return function(d,S){x(d,S,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const o=n(2223),f=n(643),g=n(511),v=n(2585),m=n(8055),e=n(4725),s=n(4269),t=n(6171),i=n(3734);let l=r.DomRendererRowFactory=class{constructor(b,x,d,S,R,N,y){this._document=b,this._characterJoinerService=x,this._optionsService=d,this._coreBrowserService=S,this._coreService=R,this._decorationService=N,this._themeService=y,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,x,d){this._selectionStart=b,this._selectionEnd=x,this._columnSelectMode=d}createRow(b,x,d,S,R,N,y,E,D,B,j){const P=[],C=this._characterJoinerService.getJoinedCharacters(x),L=this._themeService.colors;let M,I=b.getNoBgTrimmedLength();d&&I0&&oe===C[0][0]){he=!0;const le=C.shift();ie=new s.JoinedCellData(this._workCell,b.translateToString(!0,le[0],le[1]),le[1]-le[0]),xe=le[1]-1,ue=ie.getWidth()}const ye=this._isCellInSelection(oe,x),$e=d&&oe===N,me=J&&oe>=B&&oe<=j;let Se=!1;this._decorationService.forEachDecorationAtCell(oe,x,void 0,(le=>{Se=!0}));let we=ie.getChars()||f.WHITESPACE_CELL_CHAR;if(we===" "&&(ie.isUnderline()||ie.isOverline())&&(we=" "),q=ue*E-D.get(we,ie.isBold(),ie.isItalic()),M){if(z&&(ye&&U||!ye&&!U&&ie.bg===Y)&&(ye&&U&&L.selectionForeground||ie.fg===X)&&ie.extended.ext===ne&&me===w&&q===F&&!$e&&!he&&!Se){K+=we,z++;continue}z&&(M.textContent=K),M=this._document.createElement("span"),z=0,K=""}else M=this._document.createElement("span");if(Y=ie.bg,X=ie.fg,ne=ie.extended.ext,w=me,F=q,U=ye,he&&N>=oe&&N<=xe&&(N=oe),!this._coreService.isCursorHidden&&$e){if(ee.push("xterm-cursor"),this._coreBrowserService.isFocused)y&&ee.push("xterm-cursor-blink"),ee.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":ee.push("xterm-cursor-outline");break;case"block":ee.push("xterm-cursor-block");break;case"bar":ee.push("xterm-cursor-bar");break;case"underline":ee.push("xterm-cursor-underline")}}if(ie.isBold()&&ee.push("xterm-bold"),ie.isItalic()&&ee.push("xterm-italic"),ie.isDim()&&ee.push("xterm-dim"),K=ie.isInvisible()?f.WHITESPACE_CELL_CHAR:ie.getChars()||f.WHITESPACE_CELL_CHAR,ie.isUnderline()&&(ee.push(`xterm-underline-${ie.extended.underlineStyle}`),K===" "&&(K=" "),!ie.isUnderlineColorDefault()))if(ie.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(ie.getUnderlineColor()).join(",")})`;else{let le=ie.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ie.isBold()&&le<8&&(le+=8),M.style.textDecorationColor=L.ansi[le].css}ie.isOverline()&&(ee.push("xterm-overline"),K===" "&&(K=" ")),ie.isStrikethrough()&&ee.push("xterm-strikethrough"),me&&(M.style.textDecoration="underline");let Ce=ie.getFgColor(),Ae=ie.getFgColorMode(),pe=ie.getBgColor(),Me=ie.getBgColorMode();const Ne=!!ie.isInverse();if(Ne){const le=Ce;Ce=pe,pe=le;const Ie=Ae;Ae=Me,Me=Ie}let ke,ze,Le,Be=!1;switch(this._decorationService.forEachDecorationAtCell(oe,x,void 0,(le=>{le.options.layer!=="top"&&Be||(le.backgroundColorRGB&&(Me=50331648,pe=le.backgroundColorRGB.rgba>>8&16777215,ke=le.backgroundColorRGB),le.foregroundColorRGB&&(Ae=50331648,Ce=le.foregroundColorRGB.rgba>>8&16777215,ze=le.foregroundColorRGB),Be=le.options.layer==="top")})),!Be&&ye&&(ke=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,pe=ke.rgba>>8&16777215,Me=50331648,Be=!0,L.selectionForeground&&(Ae=50331648,Ce=L.selectionForeground.rgba>>8&16777215,ze=L.selectionForeground)),Be&&ee.push("xterm-decoration-top"),Me){case 16777216:case 33554432:Le=L.ansi[pe],ee.push(`xterm-bg-${pe}`);break;case 50331648:Le=m.rgba.toColor(pe>>16,pe>>8&255,255&pe),this._addStyle(M,`background-color:#${u((pe>>>0).toString(16),"0",6)}`);break;default:Ne?(Le=L.foreground,ee.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Le=L.background}switch(ke||ie.isDim()&&(ke=m.color.multiplyOpacity(Le,.5)),Ae){case 16777216:case 33554432:ie.isBold()&&Ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ce+=8),this._applyMinimumContrast(M,Le,L.ansi[Ce],ie,ke,void 0)||ee.push(`xterm-fg-${Ce}`);break;case 50331648:const le=m.rgba.toColor(Ce>>16&255,Ce>>8&255,255&Ce);this._applyMinimumContrast(M,Le,le,ie,ke,ze)||this._addStyle(M,`color:#${u(Ce.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,Le,L.foreground,ie,ke,void 0)||Ne&&ee.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}ee.length&&(M.className=ee.join(" "),ee.length=0),$e||he||Se?M.textContent=K:z++,q!==this.defaultSpacing&&(M.style.letterSpacing=`${q}px`),P.push(M),oe=xe}return M&&z&&(M.textContent=K),P}_applyMinimumContrast(b,x,d,S,R,N){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(S.getCode()))return!1;const y=this._getContrastCache(S);let E;if(R||N||(E=y.getColor(x.rgba,d.rgba)),E===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);E=m.color.ensureContrastRatio(R||x,N||d,D),y.setColor((R||x).rgba,(N||d).rgba,E??null)}return!!E&&(this._addStyle(b,`color:${E.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,x){b.setAttribute("style",`${b.getAttribute("style")||""}${x};`)}_isCellInSelection(b,x){const d=this._selectionStart,S=this._selectionEnd;return!(!d||!S)&&(this._columnSelectMode?d[0]<=S[0]?b>=d[0]&&x>=d[1]&&b=d[1]&&b>=S[0]&&x<=S[1]:x>d[1]&&x=d[0]&&b=d[0])}};function u(b,x,d){for(;b.length{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const h=n.createElement("span"),p=n.createElement("span");p.style.fontWeight="bold";const o=n.createElement("span");o.style.fontStyle="italic";const f=n.createElement("span");f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[h,p,o,f],this._container.appendChild(h),this._container.appendChild(p),this._container.appendChild(o),this._container.appendChild(f),n.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(n,h,p,o){n===this._font&&h===this._fontSize&&p===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=h,this._weight=p,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,h,p){let o=0;if(!h&&!p&&n.length===1&&(o=n.charCodeAt(0))<256)return this._flat[o]!==-9999?this._flat[o]:this._flat[o]=this._measure(n,0);let f=n;h&&(f+="B"),p&&(f+="I");let g=this._holey.get(f);if(g===void 0){let v=0;h&&(v|=1),p&&(v|=2),g=this._measure(n,v),this._holey.set(f,g)}return g}_measure(n,h){const p=this._measureElements[h];return p.textContent=n.repeat(32),p.offsetWidth/32}}},2223:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const h=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(A,r)=>{function n(h){return 57508<=h&&h<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(h){if(!h)throw new Error("value must not be falsy");return h},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(h){return 57520<=h&&h<=57527},r.excludeFromContrastRatioDemands=function(h){return n(h)||(function(p){return 9472<=p&&p<=9631})(h)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const n=this.selectionStart,h=this.selectionEnd;return!(!n||!h)&&(n[1]>h[1]||n[1]===h[1]&&n[0]>h[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(A,r,n){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,b=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(e,s,t,i);else for(var x=e.length-1;x>=0;x--)(l=e[x])&&(b=(u<3?l(b):u>3?l(s,t,b):l(s,t))||b);return u>3&&b&&Object.defineProperty(s,t,b),b},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const o=n(2585),f=n(8460),g=n(844);let v=r.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,t){super(),this._optionsService=t,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new m(e,s,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=v=h([p(2,o.IOptionsService)],v);class m{constructor(s,t,i){this._document=s,this._parentElement=t,this._optionsService=i,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const s={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return s.width!==0&&s.height!==0&&(this._result.width=s.width/32,this._result.height=Math.ceil(s.height)),this._result}}},4269:function(A,r,n){var h=this&&this.__decorate||function(s,t,i,l){var u,b=arguments.length,x=b<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,t,i,l);else for(var d=s.length-1;d>=0;d--)(u=s[d])&&(x=(b<3?u(x):b>3?u(t,i,x):u(t,i))||x);return b>3&&x&&Object.defineProperty(t,i,x),x},p=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const o=n(3734),f=n(643),g=n(511),v=n(2585);class m extends o.AttributeData{constructor(t,i,l){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=l}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=m;let e=r.CharacterJoinerService=class zs{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(t){const i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i1){const y=this._getJoinedRanges(u,d,x,i,b);for(let E=0;E1){const N=this._getJoinedRanges(u,d,x,i,b);for(let y=0;y{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(n,h){this._textarea=n,this.window=h,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}},8934:function(A,r,n){var h=this&&this.__decorate||function(v,m,e,s){var t,i=arguments.length,l=i<3?m:s===null?s=Object.getOwnPropertyDescriptor(m,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(v,m,e,s);else for(var u=v.length-1;u>=0;u--)(t=v[u])&&(l=(i<3?t(l):i>3?t(m,e,l):t(m,e))||l);return i>3&&l&&Object.defineProperty(m,e,l),l},p=this&&this.__param||function(v,m){return function(e,s){m(e,s,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const o=n(4725),f=n(9806);let g=r.MouseService=class{constructor(v,m){this._renderService=v,this._charSizeService=m}getCoords(v,m,e,s,t){return(0,f.getCoords)(window,v,m,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(v,m){const e=(0,f.getCoordsRelativeToElement)(window,v,m);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};r.MouseService=g=h([p(0,o.IRenderService),p(1,o.ICharSizeService)],g)},3230:function(A,r,n){var h=this&&this.__decorate||function(l,u,b,x){var d,S=arguments.length,R=S<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(l,u,b,x);else for(var N=l.length-1;N>=0;N--)(d=l[N])&&(R=(S<3?d(R):S>3?d(u,b,R):d(u,b))||R);return S>3&&R&&Object.defineProperty(u,b,R),R},p=this&&this.__param||function(l,u){return function(b,x){u(b,x,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const o=n(3656),f=n(6193),g=n(5596),v=n(4725),m=n(8460),e=n(844),s=n(7226),t=n(2585);let i=r.RenderService=class extends e.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,b,x,d,S,R,N){if(super(),this._rowCount=l,this._charSizeService=x,this._renderer=this.register(new e.MutableDisposable),this._pausedResizeTask=new s.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(R.window,((y,E)=>this._renderRows(y,E))),this.register(this._renderDebouncer),this._screenDprMonitor=new g.ScreenDprMonitor(R.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(S.onResize((()=>this._fullRefresh()))),this.register(S.buffers.onBufferActivate((()=>{var y;return(y=this._renderer.value)===null||y===void 0?void 0:y.clear()}))),this.register(b.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(d.onDecorationRegistered((()=>this._fullRefresh()))),this.register(d.onDecorationRemoved((()=>this._fullRefresh()))),this.register(b.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(S.cols,S.rows),this._fullRefresh()}))),this.register(b.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(S.buffer.y,S.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(R.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(N.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in R.window){const y=new R.window.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});y.observe(u),this.register({dispose:()=>y.disconnect()})}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(l,u,b=!1){this._isPaused?this._needsFullRefresh=!0:(b||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(l){this._renderer.value=l,this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,u;this._renderer.value&&((u=(l=this._renderer.value).clearTextureAtlas)===null||u===void 0||u.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)===null||l===void 0||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)===null||l===void 0||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)===null||l===void 0||l.handleFocus()}handleSelectionChanged(l,u,b){var x;this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=b,(x=this._renderer.value)===null||x===void 0||x.handleSelectionChanged(l,u,b)}handleCursorMove(){var l;(l=this._renderer.value)===null||l===void 0||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)===null||l===void 0||l.clear()}};r.RenderService=i=h([p(2,t.IOptionsService),p(3,v.ICharSizeService),p(4,t.IDecorationService),p(5,t.IBufferService),p(6,v.ICoreBrowserService),p(7,v.IThemeService)],i)},9312:function(A,r,n){var h=this&&this.__decorate||function(d,S,R,N){var y,E=arguments.length,D=E<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,R):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(d,S,R,N);else for(var B=d.length-1;B>=0;B--)(y=d[B])&&(D=(E<3?y(D):E>3?y(S,R,D):y(S,R))||D);return E>3&&D&&Object.defineProperty(S,R,D),D},p=this&&this.__param||function(d,S){return function(R,N){S(R,N,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const o=n(9806),f=n(9504),g=n(456),v=n(4725),m=n(8460),e=n(844),s=n(6114),t=n(4841),i=n(511),l=n(2585),u=" ",b=new RegExp(u,"g");let x=r.SelectionService=class extends e.Disposable{constructor(d,S,R,N,y,E,D,B,j){super(),this._element=d,this._screenElement=S,this._linkifier=R,this._bufferService=N,this._coreService=y,this._mouseService=E,this._optionsService=D,this._renderService=B,this._coreBrowserService=j,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new m.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new m.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new m.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=P=>this._handleMouseMove(P),this._mouseUpListener=P=>this._handleMouseUp(P),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((P=>this._handleTrim(P))),this.register(this._bufferService.buffers.onBufferActivate((P=>this._handleBufferActivate(P)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!d||!S||d[0]===S[0]&&d[1]===S[1])}get selectionText(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!d||!S)return"";const R=this._bufferService.buffer,N=[];if(this._activeSelectionMode===3){if(d[0]===S[0])return"";const y=d[0]y.replace(b," "))).join(s.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=g=h([p(0,f.IBufferService),p(1,f.IOptionsService),p(2,f.IOscLinkService)],g)},6193:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,h){this._parentWindow=o,this._renderCallback=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,h,p){this._rowCount=p,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},5596:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const h=o(844);class p extends h.Disposable{constructor(f){super(),this._parentWindow=f,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,h.toDisposable)((()=>{this.clearListener()})))}setListener(f){this._listener&&this.clearListener(),this._listener=f,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var f;this._outerListener&&((f=this._resolutionMediaMatchList)===null||f===void 0||f.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=p},3236:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const h=o(3614),p=o(3656),a=o(6465),f=o(9042),g=o(3730),v=o(1680),m=o(3107),e=o(5744),s=o(2950),t=o(1296),i=o(428),l=o(4269),u=o(5114),x=o(8934),b=o(3230),d=o(9312),S=o(4725),T=o(6731),N=o(8055),y=o(8969),E=o(8460),D=o(844),B=o(6114),I=o(8437),P=o(2584),C=o(7399),L=o(5941),M=o(9074),j=o(2585),$=o(5435),V=o(4567),Y=typeof window<"u"?window.document:null;class X extends y.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(k={}){super(k),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new D.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(a.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,q)=>this.refresh(W,q)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,D.toDisposable)((()=>{var W,q;this._customKeyEventHandler=void 0,(q=(W=this.element)===null||W===void 0?void 0:W.parentNode)===null||q===void 0||q.removeChild(this.element)})))}_handleColorEvent(k){if(this._themeService)for(const W of k){let q,U="";switch(W.index){case 256:q="foreground",U="10";break;case 257:q="background",U="11";break;case 258:q="cursor",U="12";break;default:q="ansi",U="4;"+W.index}switch(W.type){case 0:const ee=N.color.toColorRGB(q==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[q]);this.coreService.triggerDataEvent(`${P.C0.ESC}]${U};${(0,L.toRgbString)(ee)}${P.C1_ESCAPED.ST}`);break;case 1:if(q==="ansi")this._themeService.modifyColors((Q=>Q.ansi[W.index]=N.rgba.toColor(...W.color)));else{const Q=q;this._themeService.modifyColors((ne=>ne[Q]=N.rgba.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(k){k?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(k){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[I"),this.updateCursorStyle(k),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var k;return(k=this.textarea)===null||k===void 0?void 0:k.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const k=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(k);if(!W)return;const q=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,ee=W.getWidth(q),Q=this._renderService.dimensions.css.cell.width*ee,ne=this.buffer.y*this._renderService.dimensions.css.cell.height,_e=q*this._renderService.dimensions.css.cell.width;this.textarea.style.left=_e+"px",this.textarea.style.top=ne+"px",this.textarea.style.width=Q+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(W=>{this.hasSelection()&&(0,h.copyHandler)(W,this._selectionService)})));const k=W=>(0,h.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",k)),this.register((0,p.addDisposableDomListener)(this.element,"paste",k)),B.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,h.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,h.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,h.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(k=>this._keyUp(k)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(k=>this._keyDown(k)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(k=>this._keyPress(k)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(k=>this._compositionHelper.compositionupdate(k)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(k=>this._inputEvent(k)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(k){var W;if(!k)throw new Error("Terminal requires a parent element.");k.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=k.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),k.appendChild(this.element);const q=Y.createDocumentFragment();this._viewportElement=Y.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),q.appendChild(this._viewportElement),this._viewportScrollArea=Y.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=Y.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=Y.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),q.appendChild(this.screenElement),this.textarea=Y.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(u.CoreBrowserService,this.textarea,(W=this._document.defaultView)!==null&&W!==void 0?W:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(U=>this._handleTextAreaFocus(U)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(l.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((U=>this._onRender.fire(U)))),this.onResize((U=>this._renderService.resize(U.cols,U.rows))),this._compositionView=Y.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(v.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((U=>this.scrollLines(U.amount,U.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((U=>this.scrollLines(U.amount,U.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(m.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(U=>this._selectionService.handleMouseDown(U)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(U=>this._handleScreenReaderModeOptionChange(U)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const k=this,W=this.element;function q(Q){const ne=k._mouseService.getMouseReportCoords(Q,k.screenElement);if(!ne)return!1;let _e,ce;switch(Q.overrideType||Q.type){case"mousemove":ce=32,Q.buttons===void 0?(_e=3,Q.button!==void 0&&(_e=Q.button<3?Q.button:3)):_e=1&Q.buttons?0:4&Q.buttons?1:2&Q.buttons?2:3;break;case"mouseup":ce=0,_e=Q.button<3?Q.button:3;break;case"mousedown":ce=1,_e=Q.button<3?Q.button:3;break;case"wheel":if(k.viewport.getLinesScrolled(Q)===0)return!1;ce=Q.deltaY<0?0:1,_e=4;break;default:return!1}return!(ce===void 0||_e===void 0||_e>4)&&k.coreMouseService.triggerMouseEvent({col:ne.col,row:ne.row,x:ne.x,y:ne.y,button:_e,action:ce,ctrl:Q.ctrlKey,alt:Q.altKey,shift:Q.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ee={mouseup:Q=>(q(Q),Q.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(Q)),wheel:Q=>(q(Q),this.cancel(Q,!0)),mousedrag:Q=>{Q.buttons&&q(Q)},mousemove:Q=>{Q.buttons||q(Q)}};this.register(this.coreMouseService.onProtocolChange((Q=>{Q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Q?U.mousemove||(W.addEventListener("mousemove",ee.mousemove),U.mousemove=ee.mousemove):(W.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&Q?U.wheel||(W.addEventListener("wheel",ee.wheel,{passive:!1}),U.wheel=ee.wheel):(W.removeEventListener("wheel",U.wheel),U.wheel=null),2&Q?U.mouseup||(W.addEventListener("mouseup",ee.mouseup),U.mouseup=ee.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),W.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&Q?U.mousedrag||(U.mousedrag=ee.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(W,"mousedown",(Q=>{if(Q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Q))return q(Q),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(Q)}))),this.register((0,p.addDisposableDomListener)(W,"wheel",(Q=>{if(!U.wheel){if(!this.buffer.hasScrollback){const ne=this.viewport.getLinesScrolled(Q);if(ne===0)return;const _e=P.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Q.deltaY<0?"A":"B");let ce="";for(let Ae=0;Ae{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Q),this.cancel(Q)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(W,"touchmove",(Q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Q)?void 0:this.cancel(Q)}),{passive:!1}))}refresh(k,W){var q;(q=this._renderService)===null||q===void 0||q.refreshRows(k,W)}updateCursorStyle(k){var W;!((W=this._selectionService)===null||W===void 0)&&W.shouldColumnSelect(k)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(k,W,q=0){var U;q===1?(super.scrollLines(k,W,q),this.refresh(0,this.rows-1)):(U=this.viewport)===null||U===void 0||U.scrollLines(k)}paste(k){(0,h.paste)(k,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(k){this._customKeyEventHandler=k}registerLinkProvider(k){return this.linkifier2.registerLinkProvider(k)}registerCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(k);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(k)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(k){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+k)}registerDecoration(k){return this._decorationService.registerDecoration(k)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(k,W,q){this._selectionService.setSelection(k,W,q)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var k;(k=this._selectionService)===null||k===void 0||k.clearSelection()}selectAll(){var k;(k=this._selectionService)===null||k===void 0||k.selectAll()}selectLines(k,W){var q;(q=this._selectionService)===null||q===void 0||q.selectLines(k,W)}_keyDown(k){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&k.altKey;if(!W&&!this._compositionHelper.keydown(k))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||k.key!=="Dead"&&k.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const q=(0,C.evaluateKeyboardEvent)(k,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(k),q.type===3||q.type===2){const U=this.rows-1;return this.scrollLines(q.type===2?-U:U),this.cancel(k,!0)}return q.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,k)||(q.cancel&&this.cancel(k,!0),!q.key||!!(k.key&&!k.ctrlKey&&!k.altKey&&!k.metaKey&&k.key.length===1&&k.key.charCodeAt(0)>=65&&k.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(q.key!==P.C0.ETX&&q.key!==P.C0.CR||(this.textarea.value=""),this._onKey.fire({key:q.key,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(q.key,!0),!this.optionsService.rawOptions.screenReaderMode||k.altKey||k.ctrlKey?this.cancel(k,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(k,W){const q=k.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||k.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||k.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?q:q&&(!W.keyCode||W.keyCode>47)}_keyUp(k){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(k)||this.focus(),this.updateCursorStyle(k),this._keyPressHandled=!1)}_keyPress(k){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;if(this.cancel(k),k.charCode)W=k.charCode;else if(k.which===null||k.which===void 0)W=k.keyCode;else{if(k.which===0||k.charCode===0)return!1;W=k.which}return!(!W||(k.altKey||k.ctrlKey||k.metaKey)&&!this._isThirdLevelShift(this.browser,k)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(k){if(k.data&&k.inputType==="insertText"&&(!k.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=k.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(k),!0}return!1}resize(k,W){k!==this.cols||W!==this.rows?super.resize(k,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(k,W){var q,U;(q=this._charSizeService)===null||q===void 0||q.measure(),(U=this.viewport)===null||U===void 0||U.syncScrollArea(!0)}clear(){var k;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let W=1;W{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,h=1e3){this._renderCallback=o,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,h,p){this._rowCount=p,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){const f=a-this._lastRefreshMs,g=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h)}}},1680:function(A,r,o){var h=this&&this.__decorate||function(s,t,i,l){var u,x=arguments.length,b=x<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(s,t,i,l);else for(var d=s.length-1;d>=0;d--)(u=s[d])&&(b=(x<3?u(b):x>3?u(t,i,b):u(t,i))||b);return x>3&&b&&Object.defineProperty(t,i,b),b},p=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const a=o(3656),f=o(4725),g=o(8460),v=o(844),m=o(2585);let e=r.Viewport=class extends v.Disposable{constructor(s,t,i,l,u,x,b,d){super(),this._viewportElement=s,this._scrollArea=t,this._bufferService=i,this._optionsService=l,this._charSizeService=u,this._renderService=x,this._coreBrowserService=b,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((S=>this._renderDimensions=S))),this._handleThemeChange(d.colors),this.register(d.onChangeColors((S=>this._handleThemeChange(S)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&i0&&(l=y),u=""}}return{bufferElements:x,cursorElement:l}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let t=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(s,t){const i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&t.altKey||i==="ctrl"&&t.ctrlKey||i==="shift"&&t.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const t=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(s,t))}};r.Viewport=e=h([p(2,m.IBufferService),p(3,m.IOptionsService),p(4,f.ICharSizeService),p(5,f.IRenderService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],e)},3107:function(A,r,o){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,x=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(e,s,t,i);else for(var b=e.length-1;b>=0;b--)(l=e[b])&&(x=(u<3?l(x):u>3?l(s,t,x):l(s,t))||x);return u>3&&x&&Object.defineProperty(s,t,x),x},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const a=o(3656),f=o(4725),g=o(844),v=o(2585);let m=r.BufferDecorationRenderer=class extends g.Disposable{constructor(e,s,t,i){super(),this._screenElement=e,this._bufferService=s,this._decorationService=t,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register((0,a.addDisposableDomListener)(window,"resize",(()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((l=>this._removeDecoration(l)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s,t;const i=document.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((s=e?.options)===null||s===void 0?void 0:s.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const l=(t=e.options.x)!==null&&t!==void 0?t:0;return l&&l>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){const s=e.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t),e.onDispose((()=>{this._decorationElements.delete(e),t.remove()}))),t.style.top=s*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,s=e.element){var t;if(!s)return;const i=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?s.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":s.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var s;(s=this._decorationElements.get(e))===null||s===void 0||s.remove(),this._decorationElements.delete(e),e.dispose()}};r.BufferDecorationRenderer=m=h([p(1,v.IBufferService),p(2,v.IDecorationService),p(3,f.IRenderService)],m)},5871:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const h of this._zones)if(h.color===o.options.overviewRulerOptions.color&&h.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,o.marker.line))return;if(this._lineAdjacentToZone(h,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(h,o.marker.line)}if(this._zonePoolIndex=o.startBufferLine&&h<=o.endBufferLine}_lineAdjacentToZone(o,h,p){return h>=o.startBufferLine-this._linePadding[p||"full"]&&h<=o.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(o,h){o.startBufferLine=Math.min(o.startBufferLine,h),o.endBufferLine=Math.max(o.endBufferLine,h)}}},5744:function(A,r,o){var h=this&&this.__decorate||function(l,u,x,b){var d,S=arguments.length,T=S<3?u:b===null?b=Object.getOwnPropertyDescriptor(u,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(l,u,x,b);else for(var N=l.length-1;N>=0;N--)(d=l[N])&&(T=(S<3?d(T):S>3?d(u,x,T):d(u,x))||T);return S>3&&T&&Object.defineProperty(u,x,T),T},p=this&&this.__param||function(l,u){return function(x,b){u(x,b,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const a=o(5871),f=o(3656),g=o(4725),v=o(844),m=o(2585),e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let i=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(l,u,x,b,d,S,T){var N;super(),this._viewportElement=l,this._screenElement=u,this._bufferService=x,this._decorationService=b,this._renderService=d,this._optionsService=S,this._coreBrowseService=T,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(N=this._viewportElement.parentElement)===null||N===void 0||N.insertBefore(this._canvas,this._viewportElement);const y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var E;(E=this._canvas)===null||E===void 0||E.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register((0,f.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const l=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=l,s.center=u,s.right=l,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=s.left,t.right=s.left+s.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const l=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(l,12),6)*this._coreBrowseService.dpr);e.left=u,e.center=u,e.right=u}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const l=this._colorZoneStore.zones;for(const u of l)u.position!=="full"&&this._renderColorZone(u);for(const u of l)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(l){this._ctx.fillStyle=l.color,this._ctx.fillRect(t[l.position||"full"],Math.round((this._canvas.height-1)*(l.startBufferLine/this._bufferService.buffers.active.lines.length)-e[l.position||"full"]/2),s[l.position||"full"],Math.round((this._canvas.height-1)*((l.endBufferLine-l.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[l.position||"full"]))}_queueRefresh(l,u){this._shouldUpdateDimensions=l||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=i=h([p(2,m.IBufferService),p(3,m.IDecorationService),p(4,g.IRenderService),p(5,m.IOptionsService),p(6,g.ICoreBrowserService)],i)},2950:function(A,r,o){var h=this&&this.__decorate||function(m,e,s,t){var i,l=arguments.length,u=l<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,e,s,t);else for(var x=m.length-1;x>=0;x--)(i=m[x])&&(u=(l<3?i(u):l>3?i(e,s,u):i(e,s))||u);return l>3&&u&&Object.defineProperty(e,s,u),u},p=this&&this.__param||function(m,e){return function(s,t){e(s,t,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const a=o(4725),f=o(2585),g=o(2584);let v=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(m,e,s,t,i,l){this._textarea=m,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(m){this._compositionView.textContent=m.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(m){if(this._isComposing||this._isSendingComposition){if(m.keyCode===229||m.keyCode===16||m.keyCode===17||m.keyCode===18)return!1;this._finalizeComposition(!1)}return m.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(m){if(this._compositionView.classList.remove("active"),this._isComposing=!1,m){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const m=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,s=e.replace(m,"");this._dataAlreadySent=s,e.length>m.length?this._coreService.triggerDataEvent(s,!0):e.lengththis.updateCompositionElements(!0)),0)}}};r.CompositionHelper=v=h([p(2,f.IBufferService),p(3,f.IOptionsService),p(4,f.ICoreService),p(5,a.IRenderService)],v)},9806:(A,r)=>{function o(h,p,a){const f=a.getBoundingClientRect(),g=h.getComputedStyle(a),v=parseInt(g.getPropertyValue("padding-left")),m=parseInt(g.getPropertyValue("padding-top"));return[p.clientX-f.left-v,p.clientY-f.top-m]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(h,p,a,f,g,v,m,e,s){if(!v)return;const t=o(h,p,a);return t?(t[0]=Math.ceil((t[0]+(s?m/2:0))/m),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),f+(s?1:0)),t[1]=Math.min(Math.max(t[1],1),g),t):void 0}},9504:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const h=o(2584);function p(e,s,t,i){const l=e-a(e,t),u=s-a(s,t),x=Math.abs(l-u)-(function(b,d,S){let T=0;const N=b-a(b,S),y=d-a(d,S);for(let E=0;E=0&&es?"A":"B"}function g(e,s,t,i,l,u){let x=e,b=s,d="";for(;x!==t||b!==i;)x+=l?1:-1,l&&x>u.cols-1?(d+=u.buffer.translateBufferLineToString(b,!1,e,x),x=0,e=0,b++):!l&&x<0&&(d+=u.buffer.translateBufferLineToString(b,!1,0,e+1),x=u.cols-1,e=x,b--);return d+u.buffer.translateBufferLineToString(b,!1,e,x)}function v(e,s){const t=s?"O":"[";return h.C0.ESC+t+e}function m(e,s){e=Math.floor(e);let t="";for(let i=0;i0?N-a(N,y):S;const B=N,I=(function(P,C,L,M,j,$){let V;return V=p(L,M,j,$).length>0?M-a(M,j):C,P=L&&Ve?"D":"C",m(Math.abs(l-e),v(x,i));x=u>s?"D":"C";const b=Math.abs(u-s);return m((function(d,S){return S.cols-d})(u>s?e:l,t)+(b-1)*t.cols+1+((u>s?l:e)-1),v(x,i))}},1296:function(A,r,o){var h=this&&this.__decorate||function(y,E,D,B){var I,P=arguments.length,C=P<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(y,E,D,B);else for(var L=y.length-1;L>=0;L--)(I=y[L])&&(C=(P<3?I(C):P>3?I(E,D,C):I(E,D))||C);return P>3&&C&&Object.defineProperty(E,D,C),C},p=this&&this.__param||function(y,E){return function(D,B){E(D,B,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const a=o(3787),f=o(2550),g=o(2223),v=o(6171),m=o(4725),e=o(8055),s=o(8460),t=o(844),i=o(2585),l="xterm-dom-renderer-owner-",u="xterm-rows",x="xterm-fg-",b="xterm-bg-",d="xterm-focus",S="xterm-selection";let T=1,N=r.DomRenderer=class extends t.Disposable{constructor(y,E,D,B,I,P,C,L,M,j){super(),this._element=y,this._screenElement=E,this._viewportElement=D,this._linkifier2=B,this._charSizeService=P,this._optionsService=C,this._bufferService=L,this._coreBrowserService=M,this._themeService=j,this._terminalClass=T++,this._rowElements=[],this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=I.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(l+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(l+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new f.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const y=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*y,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*y),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/y),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/y),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const D of this._rowElements)D.style.width=`${this.dimensions.css.canvas.width}px`,D.style.height=`${this.dimensions.css.cell.height}px`,D.style.lineHeight=`${this.dimensions.css.cell.height}px`,D.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const E=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=E,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(y){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let E=`${this._terminalSelector} .${u} { color: ${y.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;E+=`${this._terminalSelector} .${u} .xterm-dim { color: ${e.color.multiplyOpacity(y.foreground,.5).css};}`,E+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,E+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",E+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css}; } 50% { background-color: inherit; color: ${y.cursor.css}; }}`,E+=`${this._terminalSelector} .${u}.${d} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${u}.${d} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${y.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${y.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${y.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,E+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${y.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${y.selectionInactiveBackgroundOpaque.css};}`;for(const[D,B]of y.ansi.entries())E+=`${this._terminalSelector} .${x}${D} { color: ${B.css}; }${this._terminalSelector} .${x}${D}.xterm-dim { color: ${e.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${b}${D} { background-color: ${B.css}; }`;E+=`${this._terminalSelector} .${x}${g.INVERTED_DEFAULT_COLOR} { color: ${e.color.opaque(y.background).css}; }${this._terminalSelector} .${x}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${e.color.multiplyOpacity(e.color.opaque(y.background),.5).css}; }${this._terminalSelector} .${b}${g.INVERTED_DEFAULT_COLOR} { background-color: ${y.foreground.css}; }`,this._themeStyleElement.textContent=E}_setDefaultSpacing(){const y=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${y}px`,this._rowFactory.defaultSpacing=y}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(y,E){for(let D=this._rowElements.length;D<=E;D++){const B=document.createElement("div");this._rowContainer.appendChild(B),this._rowElements.push(B)}for(;this._rowElements.length>E;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(y,E){this._refreshRowElements(y,E),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(d)}handleFocus(){this._rowContainer.classList.add(d),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(y,E,D){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(y,E,D),this.renderRows(0,this._bufferService.rows-1),!y||!E)return;const B=y[1]-this._bufferService.buffer.ydisp,I=E[1]-this._bufferService.buffer.ydisp,P=Math.max(B,0),C=Math.min(I,this._bufferService.rows-1);if(P>=this._bufferService.rows||C<0)return;const L=document.createDocumentFragment();if(D){const M=y[0]>E[0];L.appendChild(this._createSelectionElement(P,M?E[0]:y[0],M?y[0]:E[0],C-P+1))}else{const M=B===P?y[0]:0,j=P===I?E[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(P,M,j));const $=C-P-1;if(L.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,$)),P!==C){const V=I===C?E[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,V))}}this._selectionContainer.appendChild(L)}_createSelectionElement(y,E,D,B=1){const I=document.createElement("div");return I.style.height=B*this.dimensions.css.cell.height+"px",I.style.top=y*this.dimensions.css.cell.height+"px",I.style.left=E*this.dimensions.css.cell.width+"px",I.style.width=this.dimensions.css.cell.width*(D-E)+"px",I}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const y of this._rowElements)y.replaceChildren()}renderRows(y,E){const D=this._bufferService.buffer,B=D.ybase+D.y,I=Math.min(D.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=y;M<=E;M++){const j=M+D.ydisp,$=this._rowElements[M],V=D.lines.get(j);if(!$||!V)break;$.replaceChildren(...this._rowFactory.createRow(V,j,j===B,C,L,I,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${l}${this._terminalClass}`}_handleLinkHover(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)}_handleLinkLeave(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)}_setCellUnderline(y,E,D,B,I,P){D<0&&(y=0),B<0&&(E=0);const C=this._bufferService.rows-1;D=Math.max(Math.min(D,C),0),B=Math.max(Math.min(B,C),0),I=Math.min(I,this._bufferService.cols);const L=this._bufferService.buffer,M=L.ybase+L.y,j=Math.min(L.x,I-1),$=this._optionsService.rawOptions.cursorBlink,V=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let X=D;X<=B;++X){const ae=X+L.ydisp,k=this._rowElements[X],W=L.lines.get(ae);if(!k||!W)break;k.replaceChildren(...this._rowFactory.createRow(W,ae,ae===M,V,Y,j,$,this.dimensions.css.cell.width,this._widthCache,P?X===D?y:0:-1,P?(X===B?E:I)-1:-1))}}};r.DomRenderer=N=h([p(4,i.IInstantiationService),p(5,m.ICharSizeService),p(6,i.IOptionsService),p(7,i.IBufferService),p(8,m.ICoreBrowserService),p(9,m.IThemeService)],N)},3787:function(A,r,o){var h=this&&this.__decorate||function(x,b,d,S){var T,N=arguments.length,y=N<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(x,b,d,S);else for(var E=x.length-1;E>=0;E--)(T=x[E])&&(y=(N<3?T(y):N>3?T(b,d,y):T(b,d))||y);return N>3&&y&&Object.defineProperty(b,d,y),y},p=this&&this.__param||function(x,b){return function(d,S){b(d,S,x)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const a=o(2223),f=o(643),g=o(511),v=o(2585),m=o(8055),e=o(4725),s=o(4269),t=o(6171),i=o(3734);let l=r.DomRendererRowFactory=class{constructor(x,b,d,S,T,N,y){this._document=x,this._characterJoinerService=b,this._optionsService=d,this._coreBrowserService=S,this._coreService=T,this._decorationService=N,this._themeService=y,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,b,d){this._selectionStart=x,this._selectionEnd=b,this._columnSelectMode=d}createRow(x,b,d,S,T,N,y,E,D,B,I){const P=[],C=this._characterJoinerService.getJoinedCharacters(b),L=this._themeService.colors;let M,j=x.getNoBgTrimmedLength();d&&j0&&ne===C[0][0]){ce=!0;const le=C.shift();re=new s.JoinedCellData(this._workCell,x.translateToString(!0,le[0],le[1]),le[1]-le[0]),Ae=le[1]-1,_e=re.getWidth()}const Pe=this._isCellInSelection(ne,b),We=d&&ne===N,he=Q&&ne>=B&&ne<=I;let xe=!1;this._decorationService.forEachDecorationAtCell(ne,b,void 0,(le=>{xe=!0}));let pe=re.getChars()||f.WHITESPACE_CELL_CHAR;if(pe===" "&&(re.isUnderline()||re.isOverline())&&(pe=" "),U=_e*E-D.get(pe,re.isBold(),re.isItalic()),M){if($&&(Pe&&q||!Pe&&!q&&re.bg===Y)&&(Pe&&q&&L.selectionForeground||re.fg===X)&&re.extended.ext===ae&&he===k&&U===W&&!We&&!ce&&!xe){V+=pe,$++;continue}$&&(M.textContent=V),M=this._document.createElement("span"),$=0,V=""}else M=this._document.createElement("span");if(Y=re.bg,X=re.fg,ae=re.extended.ext,k=he,W=U,q=Pe,ce&&N>=ne&&N<=Ae&&(N=ne),!this._coreService.isCursorHidden&&We){if(ee.push("xterm-cursor"),this._coreBrowserService.isFocused)y&&ee.push("xterm-cursor-blink"),ee.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":ee.push("xterm-cursor-outline");break;case"block":ee.push("xterm-cursor-block");break;case"bar":ee.push("xterm-cursor-bar");break;case"underline":ee.push("xterm-cursor-underline")}}if(re.isBold()&&ee.push("xterm-bold"),re.isItalic()&&ee.push("xterm-italic"),re.isDim()&&ee.push("xterm-dim"),V=re.isInvisible()?f.WHITESPACE_CELL_CHAR:re.getChars()||f.WHITESPACE_CELL_CHAR,re.isUnderline()&&(ee.push(`xterm-underline-${re.extended.underlineStyle}`),V===" "&&(V=" "),!re.isUnderlineColorDefault()))if(re.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(re.getUnderlineColor()).join(",")})`;else{let le=re.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&re.isBold()&&le<8&&(le+=8),M.style.textDecorationColor=L.ansi[le].css}re.isOverline()&&(ee.push("xterm-overline"),V===" "&&(V=" ")),re.isStrikethrough()&&ee.push("xterm-strikethrough"),he&&(M.style.textDecoration="underline");let Se=re.getFgColor(),je=re.getFgColorMode(),be=re.getBgColor(),Ie=re.getBgColorMode();const Ue=!!re.isInverse();if(Ue){const le=Se;Se=be,be=le;const Xe=je;je=Ie,Ie=Xe}let ye,qe,we,Ee=!1;switch(this._decorationService.forEachDecorationAtCell(ne,b,void 0,(le=>{le.options.layer!=="top"&&Ee||(le.backgroundColorRGB&&(Ie=50331648,be=le.backgroundColorRGB.rgba>>8&16777215,ye=le.backgroundColorRGB),le.foregroundColorRGB&&(je=50331648,Se=le.foregroundColorRGB.rgba>>8&16777215,qe=le.foregroundColorRGB),Ee=le.options.layer==="top")})),!Ee&&Pe&&(ye=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,be=ye.rgba>>8&16777215,Ie=50331648,Ee=!0,L.selectionForeground&&(je=50331648,Se=L.selectionForeground.rgba>>8&16777215,qe=L.selectionForeground)),Ee&&ee.push("xterm-decoration-top"),Ie){case 16777216:case 33554432:we=L.ansi[be],ee.push(`xterm-bg-${be}`);break;case 50331648:we=m.rgba.toColor(be>>16,be>>8&255,255&be),this._addStyle(M,`background-color:#${u((be>>>0).toString(16),"0",6)}`);break;default:Ue?(we=L.foreground,ee.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):we=L.background}switch(ye||re.isDim()&&(ye=m.color.multiplyOpacity(we,.5)),je){case 16777216:case 33554432:re.isBold()&&Se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Se+=8),this._applyMinimumContrast(M,we,L.ansi[Se],re,ye,void 0)||ee.push(`xterm-fg-${Se}`);break;case 50331648:const le=m.rgba.toColor(Se>>16&255,Se>>8&255,255&Se);this._applyMinimumContrast(M,we,le,re,ye,qe)||this._addStyle(M,`color:#${u(Se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,we,L.foreground,re,ye,void 0)||Ue&&ee.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}ee.length&&(M.className=ee.join(" "),ee.length=0),We||ce||xe?M.textContent=V:$++,U!==this.defaultSpacing&&(M.style.letterSpacing=`${U}px`),P.push(M),ne=Ae}return M&&$&&(M.textContent=V),P}_applyMinimumContrast(x,b,d,S,T,N){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(S.getCode()))return!1;const y=this._getContrastCache(S);let E;if(T||N||(E=y.getColor(b.rgba,d.rgba)),E===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);E=m.color.ensureContrastRatio(T||b,N||d,D),y.setColor((T||b).rgba,(N||d).rgba,E??null)}return!!E&&(this._addStyle(x,`color:${E.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,b){x.setAttribute("style",`${x.getAttribute("style")||""}${b};`)}_isCellInSelection(x,b){const d=this._selectionStart,S=this._selectionEnd;return!(!d||!S)&&(this._columnSelectMode?d[0]<=S[0]?x>=d[0]&&b>=d[1]&&x=d[1]&&x>=S[0]&&b<=S[1]:b>d[1]&&b=d[0]&&x=d[0])}};function u(x,b,d){for(;x.length{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const h=o.createElement("span"),p=o.createElement("span");p.style.fontWeight="bold";const a=o.createElement("span");a.style.fontStyle="italic";const f=o.createElement("span");f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[h,p,a,f],this._container.appendChild(h),this._container.appendChild(p),this._container.appendChild(a),this._container.appendChild(f),o.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,h,p,a){o===this._font&&h===this._fontSize&&p===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=h,this._weight=p,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,h,p){let a=0;if(!h&&!p&&o.length===1&&(a=o.charCodeAt(0))<256)return this._flat[a]!==-9999?this._flat[a]:this._flat[a]=this._measure(o,0);let f=o;h&&(f+="B"),p&&(f+="I");let g=this._holey.get(f);if(g===void 0){let v=0;h&&(v|=1),p&&(v|=2),g=this._measure(o,v),this._holey.set(f,g)}return g}_measure(o,h){const p=this._measureElements[h];return p.textContent=o.repeat(32),p.offsetWidth/32}}},2223:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const h=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(A,r)=>{function o(h){return 57508<=h&&h<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(h){if(!h)throw new Error("value must not be falsy");return h},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(h){return 57520<=h&&h<=57527},r.excludeFromContrastRatioDemands=function(h){return o(h)||(function(p){return 9472<=p&&p<=9631})(h)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,h=this.selectionEnd;return!(!o||!h)&&(o[1]>h[1]||o[1]===h[1]&&o[0]>h[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(A,r,o){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,x=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(e,s,t,i);else for(var b=e.length-1;b>=0;b--)(l=e[b])&&(x=(u<3?l(x):u>3?l(s,t,x):l(s,t))||x);return u>3&&x&&Object.defineProperty(s,t,x),x},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const a=o(2585),f=o(8460),g=o(844);let v=r.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,t){super(),this._optionsService=t,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new m(e,s,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=v=h([p(2,a.IOptionsService)],v);class m{constructor(s,t,i){this._document=s,this._parentElement=t,this._optionsService=i,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const s={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return s.width!==0&&s.height!==0&&(this._result.width=s.width/32,this._result.height=Math.ceil(s.height)),this._result}}},4269:function(A,r,o){var h=this&&this.__decorate||function(s,t,i,l){var u,x=arguments.length,b=x<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,i):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(s,t,i,l);else for(var d=s.length-1;d>=0;d--)(u=s[d])&&(b=(x<3?u(b):x>3?u(t,i,b):u(t,i))||b);return x>3&&b&&Object.defineProperty(t,i,b),b},p=this&&this.__param||function(s,t){return function(i,l){t(i,l,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const a=o(3734),f=o(643),g=o(511),v=o(2585);class m extends a.AttributeData{constructor(t,i,l){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=l}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=m;let e=r.CharacterJoinerService=class qs{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(t){const i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i1){const y=this._getJoinedRanges(u,d,b,i,x);for(let E=0;E1){const N=this._getJoinedRanges(u,d,b,i,x);for(let y=0;y{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(o,h){this._textarea=o,this.window=h,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}},8934:function(A,r,o){var h=this&&this.__decorate||function(v,m,e,s){var t,i=arguments.length,l=i<3?m:s===null?s=Object.getOwnPropertyDescriptor(m,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(v,m,e,s);else for(var u=v.length-1;u>=0;u--)(t=v[u])&&(l=(i<3?t(l):i>3?t(m,e,l):t(m,e))||l);return i>3&&l&&Object.defineProperty(m,e,l),l},p=this&&this.__param||function(v,m){return function(e,s){m(e,s,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const a=o(4725),f=o(9806);let g=r.MouseService=class{constructor(v,m){this._renderService=v,this._charSizeService=m}getCoords(v,m,e,s,t){return(0,f.getCoords)(window,v,m,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(v,m){const e=(0,f.getCoordsRelativeToElement)(window,v,m);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};r.MouseService=g=h([p(0,a.IRenderService),p(1,a.ICharSizeService)],g)},3230:function(A,r,o){var h=this&&this.__decorate||function(l,u,x,b){var d,S=arguments.length,T=S<3?u:b===null?b=Object.getOwnPropertyDescriptor(u,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(l,u,x,b);else for(var N=l.length-1;N>=0;N--)(d=l[N])&&(T=(S<3?d(T):S>3?d(u,x,T):d(u,x))||T);return S>3&&T&&Object.defineProperty(u,x,T),T},p=this&&this.__param||function(l,u){return function(x,b){u(x,b,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const a=o(3656),f=o(6193),g=o(5596),v=o(4725),m=o(8460),e=o(844),s=o(7226),t=o(2585);let i=r.RenderService=class extends e.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,x,b,d,S,T,N){if(super(),this._rowCount=l,this._charSizeService=b,this._renderer=this.register(new e.MutableDisposable),this._pausedResizeTask=new s.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(T.window,((y,E)=>this._renderRows(y,E))),this.register(this._renderDebouncer),this._screenDprMonitor=new g.ScreenDprMonitor(T.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(S.onResize((()=>this._fullRefresh()))),this.register(S.buffers.onBufferActivate((()=>{var y;return(y=this._renderer.value)===null||y===void 0?void 0:y.clear()}))),this.register(x.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(d.onDecorationRegistered((()=>this._fullRefresh()))),this.register(d.onDecorationRemoved((()=>this._fullRefresh()))),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(S.cols,S.rows),this._fullRefresh()}))),this.register(x.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(S.buffer.y,S.buffer.y,!0)))),this.register((0,a.addDisposableDomListener)(T.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(N.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in T.window){const y=new T.window.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});y.observe(u),this.register({dispose:()=>y.disconnect()})}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(l,u,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(l){this._renderer.value=l,this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,u;this._renderer.value&&((u=(l=this._renderer.value).clearTextureAtlas)===null||u===void 0||u.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)===null||l===void 0||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)===null||l===void 0||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)===null||l===void 0||l.handleFocus()}handleSelectionChanged(l,u,x){var b;this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=x,(b=this._renderer.value)===null||b===void 0||b.handleSelectionChanged(l,u,x)}handleCursorMove(){var l;(l=this._renderer.value)===null||l===void 0||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)===null||l===void 0||l.clear()}};r.RenderService=i=h([p(2,t.IOptionsService),p(3,v.ICharSizeService),p(4,t.IDecorationService),p(5,t.IBufferService),p(6,v.ICoreBrowserService),p(7,v.IThemeService)],i)},9312:function(A,r,o){var h=this&&this.__decorate||function(d,S,T,N){var y,E=arguments.length,D=E<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(d,S,T,N);else for(var B=d.length-1;B>=0;B--)(y=d[B])&&(D=(E<3?y(D):E>3?y(S,T,D):y(S,T))||D);return E>3&&D&&Object.defineProperty(S,T,D),D},p=this&&this.__param||function(d,S){return function(T,N){S(T,N,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const a=o(9806),f=o(9504),g=o(456),v=o(4725),m=o(8460),e=o(844),s=o(6114),t=o(4841),i=o(511),l=o(2585),u=" ",x=new RegExp(u,"g");let b=r.SelectionService=class extends e.Disposable{constructor(d,S,T,N,y,E,D,B,I){super(),this._element=d,this._screenElement=S,this._linkifier=T,this._bufferService=N,this._coreService=y,this._mouseService=E,this._optionsService=D,this._renderService=B,this._coreBrowserService=I,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new m.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new m.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new m.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=P=>this._handleMouseMove(P),this._mouseUpListener=P=>this._handleMouseUp(P),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((P=>this._handleTrim(P))),this.register(this._bufferService.buffers.onBufferActivate((P=>this._handleBufferActivate(P)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!d||!S||d[0]===S[0]&&d[1]===S[1])}get selectionText(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!d||!S)return"";const T=this._bufferService.buffer,N=[];if(this._activeSelectionMode===3){if(d[0]===S[0])return"";const y=d[0]y.replace(x," "))).join(s.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&d&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(d){const S=this._getMouseBufferCoords(d),R=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!!(R&&N&&S)&&this._areCoordsInSelection(S,R,N)}isCellInSelection(d,S){const R=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!(!R||!N)&&this._areCoordsInSelection([d,S],R,N)}_areCoordsInSelection(d,S,R){return d[1]>S[1]&&d[1]=S[0]&&d[0]=S[0]}_selectWordAtCursor(d,S){var R,N;const y=(N=(R=this._linkifier.currentLink)===null||R===void 0?void 0:R.link)===null||N===void 0?void 0:N.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(d);return!!E&&(this._selectWordAt(E,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,S){this._model.clearSelection(),d=Math.max(d,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){const S=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(d){let S=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=R?0:(S>R&&(S-=R),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){const S=this._getMouseBufferCoords(d);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){const S=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const N=(0,f.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(N,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,R=!(!d||!S||d[0]===S[0]&&d[1]===S[1]);R?d&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,S,R)):this._oldHasSelection&&this._fireOnSelectionChange(d,S,R)}_fireOnSelectionChange(d,S,R){this._oldSelectionStart=d,this._oldSelectionEnd=S,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim((S=>this._handleTrim(S)))}_convertViewportColToCharacterIndex(d,S){let R=S;for(let N=0;S>=N;N++){const y=d.loadCell(N,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:y>1&&S!==N&&(R+=y-1)}return R}setSelection(d,S,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,S],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,S,R=!0,N=!0){if(d[0]>=this._bufferService.cols)return;const y=this._bufferService.buffer,E=y.lines.get(d[1]);if(!E)return;const D=y.translateBufferLineToString(d[1],!1);let B=this._convertViewportColToCharacterIndex(E,d[0]),j=B;const P=d[0]-B;let C=0,L=0,M=0,I=0;if(D.charAt(B)===" "){for(;B>0&&D.charAt(B-1)===" ";)B--;for(;j1&&(I+=ne-1,j+=ne-1);Y>0&&B>0&&!this._isCharWordSeparator(E.loadCell(Y-1,this._workCell));){E.loadCell(Y-1,this._workCell);const w=this._workCell.getChars().length;this._workCell.getWidth()===0?(C++,Y--):w>1&&(M+=w-1,B-=w-1),B--,Y--}for(;X1&&(I+=w-1,j+=w-1),j++,X++}}j++;let z=B+P-C+M,K=Math.min(this._bufferService.cols,j-B+C+L-M-I);if(S||D.slice(B,j).trim()!==""){if(R&&z===0&&E.getCodePoint(0)!==32){const Y=y.lines.get(d[1]-1);if(Y&&E.isWrapped&&Y.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(X){const ne=this._bufferService.cols-X.start;z-=ne,K+=ne}}}if(N&&z+K===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){const Y=y.lines.get(d[1]+1);if(Y?.isWrapped&&Y.getCodePoint(0)!==32){const X=this._getWordAt([0,d[1]+1],!1,!1,!0);X&&(K+=X.length)}}return{start:z,length:K}}}_selectWordAt(d,S){const R=this._getWordAt(d,S);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[R.start,d[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(d){const S=this._getWordAt(d,!0);if(S){let R=d[1];for(;S.start<0;)S.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,R]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){const S=this._bufferService.buffer.getWrappedRangeForLine(d),R={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(R,this._bufferService.cols)}};r.SelectionService=x=h([p(3,l.IBufferService),p(4,l.ICoreService),p(5,v.IMouseService),p(6,l.IOptionsService),p(7,v.IRenderService),p(8,v.ICoreBrowserService)],x)},4725:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const h=n(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService")},6731:function(A,r,n){var h=this&&this.__decorate||function(x,d,S,R){var N,y=arguments.length,E=y<3?d:R===null?R=Object.getOwnPropertyDescriptor(d,S):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(x,d,S,R);else for(var D=x.length-1;D>=0;D--)(N=x[D])&&(E=(y<3?N(E):y>3?N(d,S,E):N(d,S))||E);return y>3&&E&&Object.defineProperty(d,S,E),E},p=this&&this.__param||function(x,d){return function(S,R){d(S,R,x)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const o=n(7239),f=n(8055),g=n(8460),v=n(844),m=n(2585),e=f.css.toColor("#ffffff"),s=f.css.toColor("#000000"),t=f.css.toColor("#ffffff"),i=f.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const x=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],d=[0,95,135,175,215,255];for(let S=0;S<216;S++){const R=d[S/36%6|0],N=d[S/6%6|0],y=d[S%6];x.push({css:f.channels.toCss(R,N,y),rgba:f.channels.toRgba(R,N,y)})}for(let S=0;S<24;S++){const R=8+10*S;x.push({css:f.channels.toCss(R,R,R),rgba:f.channels.toRgba(R,R,R)})}return x})());let u=r.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(x){super(),this._optionsService=x,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:s,cursor:t,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:f.color.blend(s,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:f.color.blend(s,l),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(x={}){const d=this._colors;if(d.foreground=b(x.foreground,e),d.background=b(x.background,s),d.cursor=b(x.cursor,t),d.cursorAccent=b(x.cursorAccent,i),d.selectionBackgroundTransparent=b(x.selectionBackground,l),d.selectionBackgroundOpaque=f.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=b(x.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=f.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=x.selectionForeground?b(x.selectionForeground,f.NULL_COLOR):void 0,d.selectionForeground===f.NULL_COLOR&&(d.selectionForeground=void 0),f.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=f.color.opacity(d.selectionBackgroundTransparent,.3)),f.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=f.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=r.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=b(x.black,r.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=b(x.red,r.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=b(x.green,r.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=b(x.yellow,r.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=b(x.blue,r.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=b(x.magenta,r.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=b(x.cyan,r.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=b(x.white,r.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=b(x.brightBlack,r.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=b(x.brightRed,r.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=b(x.brightGreen,r.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=b(x.brightYellow,r.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=b(x.brightBlue,r.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=b(x.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=b(x.brightCyan,r.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=b(x.brightWhite,r.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){const S=Math.min(d.ansi.length-16,x.extendedAnsi.length);for(let R=0;R{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const h=n(8460),p=n(844);class o extends p.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(g){if(this._maxLength===g)return;const v=new Array(g);for(let m=0;mthis._length)for(let v=this._length;v=g;e--)this._array[this._getCyclicIndex(e+m.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;ethis._maxLength){const e=this._length+m.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=m.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,v,m){if(!(v<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+m<0)throw new Error("Cannot shift elements in list beyond index 0");if(m>0){for(let s=v-1;s>=0;s--)this.set(g+s+m,this.get(g+s));const e=g+v+m-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(h,p=5){if(typeof h!="object")return h;const o=Array.isArray(h)?[]:{};for(const f in h)o[f]=p<=1?h[f]:h[f]&&n(h[f],p-1);return o}},8055:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const h=n(6114);let p=0,o=0,f=0,g=0;var v,m,e,s,t;function i(u){const b=u.toString(16);return b.length<2?"0"+b:b}function l(u,b){return u>>0}})(v||(r.channels=v={})),(function(u){function b(x,d){return g=Math.round(255*d),[p,o,f]=t.toChannels(x.rgba),{css:v.toCss(p,o,f,g),rgba:v.toRgba(p,o,f,g)}}u.blend=function(x,d){if(g=(255&d.rgba)/255,g===1)return{css:d.css,rgba:d.rgba};const S=d.rgba>>24&255,R=d.rgba>>16&255,N=d.rgba>>8&255,y=x.rgba>>24&255,E=x.rgba>>16&255,D=x.rgba>>8&255;return p=y+Math.round((S-y)*g),o=E+Math.round((R-E)*g),f=D+Math.round((N-D)*g),{css:v.toCss(p,o,f),rgba:v.toRgba(p,o,f)}},u.isOpaque=function(x){return(255&x.rgba)==255},u.ensureContrastRatio=function(x,d,S){const R=t.ensureContrastRatio(x.rgba,d.rgba,S);if(R)return t.toColor(R>>24&255,R>>16&255,R>>8&255)},u.opaque=function(x){const d=(255|x.rgba)>>>0;return[p,o,f]=t.toChannels(d),{css:v.toCss(p,o,f),rgba:d}},u.opacity=b,u.multiplyOpacity=function(x,d){return g=255&x.rgba,b(x,g*d/255)},u.toColorRGB=function(x){return[x.rgba>>24&255,x.rgba>>16&255,x.rgba>>8&255]}})(m||(r.color=m={})),(function(u){let b,x;if(!h.isNode){const d=document.createElement("canvas");d.width=1,d.height=1;const S=d.getContext("2d",{willReadFrequently:!0});S&&(b=S,b.globalCompositeOperation="copy",x=b.createLinearGradient(0,0,1,1))}u.toColor=function(d){if(d.match(/#[\da-f]{3,8}/i))switch(d.length){case 4:return p=parseInt(d.slice(1,2).repeat(2),16),o=parseInt(d.slice(2,3).repeat(2),16),f=parseInt(d.slice(3,4).repeat(2),16),t.toColor(p,o,f);case 5:return p=parseInt(d.slice(1,2).repeat(2),16),o=parseInt(d.slice(2,3).repeat(2),16),f=parseInt(d.slice(3,4).repeat(2),16),g=parseInt(d.slice(4,5).repeat(2),16),t.toColor(p,o,f,g);case 7:return{css:d,rgba:(parseInt(d.slice(1),16)<<8|255)>>>0};case 9:return{css:d,rgba:parseInt(d.slice(1),16)>>>0}}const S=d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return p=parseInt(S[1]),o=parseInt(S[2]),f=parseInt(S[3]),g=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),t.toColor(p,o,f,g);if(!b||!x)throw new Error("css.toColor: Unsupported css format");if(b.fillStyle=x,b.fillStyle=d,typeof b.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(b.fillRect(0,0,1,1),[p,o,f,g]=b.getImageData(0,0,1,1).data,g!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(p,o,f,g),css:d}}})(e||(r.css=e={})),(function(u){function b(x,d,S){const R=x/255,N=d/255,y=S/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}u.relativeLuminance=function(x){return b(x>>16&255,x>>8&255,255&x)},u.relativeLuminance2=b})(s||(r.rgb=s={})),(function(u){function b(d,S,R){const N=d>>24&255,y=d>>16&255,E=d>>8&255;let D=S>>24&255,B=S>>16&255,j=S>>8&255,P=l(s.relativeLuminance2(D,B,j),s.relativeLuminance2(N,y,E));for(;P0||B>0||j>0);)D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),j-=Math.max(0,Math.ceil(.1*j)),P=l(s.relativeLuminance2(D,B,j),s.relativeLuminance2(N,y,E));return(D<<24|B<<16|j<<8|255)>>>0}function x(d,S,R){const N=d>>24&255,y=d>>16&255,E=d>>8&255;let D=S>>24&255,B=S>>16&255,j=S>>8&255,P=l(s.relativeLuminance2(D,B,j),s.relativeLuminance2(N,y,E));for(;P>>0}u.ensureContrastRatio=function(d,S,R){const N=s.relativeLuminance(d>>8),y=s.relativeLuminance(S>>8);if(l(N,y)>8));if(jl(N,s.relativeLuminance(P>>8))?B:P}return B}const E=x(d,S,R),D=l(N,s.relativeLuminance(E>>8));if(Dl(N,s.relativeLuminance(B>>8))?E:B}return E}},u.reduceLuminance=b,u.increaseLuminance=x,u.toChannels=function(d){return[d>>24&255,d>>16&255,d>>8&255,255&d]},u.toColor=function(d,S,R,N){return{css:v.toCss(d,S,R,N),rgba:v.toRgba(d,S,R,N)}}})(t||(r.rgba=t={})),r.toPaddedHex=i,r.contrastRatio=l},8969:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const h=n(844),p=n(2585),o=n(4348),f=n(7866),g=n(744),v=n(7302),m=n(6975),e=n(8460),s=n(1753),t=n(1480),i=n(7994),l=n(9282),u=n(5435),b=n(5981),x=n(2660);let d=!1;class S extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((N=>{var y;(y=this._onScrollApi)===null||y===void 0||y.fire(N.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(N){for(const y in N)this.optionsService.options[y]=N[y]}constructor(N){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new v.OptionsService(N)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(m.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new u.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new b.WriteBuffer(((y,E)=>this._inputHandler.parse(y,E)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(N,y){this._writeBuffer.write(N,y)}writeSync(N,y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!0),this._writeBuffer.writeSync(N,y)}resize(N,y){isNaN(N)||isNaN(y)||(N=Math.max(N,g.MINIMUM_COLS),y=Math.max(y,g.MINIMUM_ROWS),this._bufferService.resize(N,y))}scroll(N,y=!1){this._bufferService.scroll(N,y)}scrollLines(N,y,E){this._bufferService.scrollLines(N,y,E)}scrollPages(N){this.scrollLines(N*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(N){const y=N-this._bufferService.buffer.ydisp;y!==0&&this.scrollLines(y)}registerEscHandler(N,y){return this._inputHandler.registerEscHandler(N,y)}registerDcsHandler(N,y){return this._inputHandler.registerDcsHandler(N,y)}registerCsiHandler(N,y){return this._inputHandler.registerCsiHandler(N,y)}registerOscHandler(N,y){return this._inputHandler.registerOscHandler(N,y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let N=!1;const y=this.optionsService.rawOptions.windowsPty;y&&y.buildNumber!==void 0&&y.buildNumber!==void 0?N=y.backend==="conpty"&&y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(N=!0),N?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const N=[];N.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),N.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const y of N)y.dispose()}))}}}r.CoreTerminal=S},8460:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let h=0;hh.fire(p)))}},5435:function(A,r,n){var h=this&&this.__decorate||function(P,C,L,M){var I,z=arguments.length,K=z<3?C:M===null?M=Object.getOwnPropertyDescriptor(C,L):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(P,C,L,M);else for(var Y=P.length-1;Y>=0;Y--)(I=P[Y])&&(K=(z<3?I(K):z>3?I(C,L,K):I(C,L))||K);return z>3&&K&&Object.defineProperty(C,L,K),K},p=this&&this.__param||function(P,C){return function(L,M){C(L,M,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=n(2584),f=n(7116),g=n(2015),v=n(844),m=n(482),e=n(8437),s=n(8460),t=n(643),i=n(511),l=n(3734),u=n(2585),b=n(6242),x=n(6351),d=n(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function N(P,C){if(P>24)return C.setWinLines||!1;switch(P){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var y;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(y||(r.WindowsOptionsReportType=y={}));let E=0;class D extends v.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,M,I,z,K,Y,X,ne=new g.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=M,this._logService=I,this._optionsService=z,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=X,this._parser=ne,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new m.StringToUtf32,this._utf8Decoder=new m.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new B(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((w=>this._activeBuffer=w.activeBuffer))),this._parser.setCsiHandlerFallback(((w,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(w),params:F.toArray()})})),this._parser.setEscHandlerFallback((w=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(w)})})),this._parser.setExecuteHandlerFallback((w=>{this._logService.debug("Unknown EXECUTE code: ",{code:w})})),this._parser.setOscHandlerFallback(((w,F,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:w,action:F,data:U})})),this._parser.setDcsHandlerFallback(((w,F,U)=>{F==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(w),action:F,payload:U})})),this._parser.setPrintHandler(((w,F,U)=>this.print(w,F,U))),this._parser.registerCsiHandler({final:"@"},(w=>this.insertChars(w))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(w=>this.scrollLeft(w))),this._parser.registerCsiHandler({final:"A"},(w=>this.cursorUp(w))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(w=>this.scrollRight(w))),this._parser.registerCsiHandler({final:"B"},(w=>this.cursorDown(w))),this._parser.registerCsiHandler({final:"C"},(w=>this.cursorForward(w))),this._parser.registerCsiHandler({final:"D"},(w=>this.cursorBackward(w))),this._parser.registerCsiHandler({final:"E"},(w=>this.cursorNextLine(w))),this._parser.registerCsiHandler({final:"F"},(w=>this.cursorPrecedingLine(w))),this._parser.registerCsiHandler({final:"G"},(w=>this.cursorCharAbsolute(w))),this._parser.registerCsiHandler({final:"H"},(w=>this.cursorPosition(w))),this._parser.registerCsiHandler({final:"I"},(w=>this.cursorForwardTab(w))),this._parser.registerCsiHandler({final:"J"},(w=>this.eraseInDisplay(w,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(w=>this.eraseInDisplay(w,!0))),this._parser.registerCsiHandler({final:"K"},(w=>this.eraseInLine(w,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(w=>this.eraseInLine(w,!0))),this._parser.registerCsiHandler({final:"L"},(w=>this.insertLines(w))),this._parser.registerCsiHandler({final:"M"},(w=>this.deleteLines(w))),this._parser.registerCsiHandler({final:"P"},(w=>this.deleteChars(w))),this._parser.registerCsiHandler({final:"S"},(w=>this.scrollUp(w))),this._parser.registerCsiHandler({final:"T"},(w=>this.scrollDown(w))),this._parser.registerCsiHandler({final:"X"},(w=>this.eraseChars(w))),this._parser.registerCsiHandler({final:"Z"},(w=>this.cursorBackwardTab(w))),this._parser.registerCsiHandler({final:"`"},(w=>this.charPosAbsolute(w))),this._parser.registerCsiHandler({final:"a"},(w=>this.hPositionRelative(w))),this._parser.registerCsiHandler({final:"b"},(w=>this.repeatPrecedingCharacter(w))),this._parser.registerCsiHandler({final:"c"},(w=>this.sendDeviceAttributesPrimary(w))),this._parser.registerCsiHandler({prefix:">",final:"c"},(w=>this.sendDeviceAttributesSecondary(w))),this._parser.registerCsiHandler({final:"d"},(w=>this.linePosAbsolute(w))),this._parser.registerCsiHandler({final:"e"},(w=>this.vPositionRelative(w))),this._parser.registerCsiHandler({final:"f"},(w=>this.hVPosition(w))),this._parser.registerCsiHandler({final:"g"},(w=>this.tabClear(w))),this._parser.registerCsiHandler({final:"h"},(w=>this.setMode(w))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(w=>this.setModePrivate(w))),this._parser.registerCsiHandler({final:"l"},(w=>this.resetMode(w))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(w=>this.resetModePrivate(w))),this._parser.registerCsiHandler({final:"m"},(w=>this.charAttributes(w))),this._parser.registerCsiHandler({final:"n"},(w=>this.deviceStatus(w))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(w=>this.deviceStatusPrivate(w))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(w=>this.softReset(w))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(w=>this.setCursorStyle(w))),this._parser.registerCsiHandler({final:"r"},(w=>this.setScrollRegion(w))),this._parser.registerCsiHandler({final:"s"},(w=>this.saveCursor(w))),this._parser.registerCsiHandler({final:"t"},(w=>this.windowOptions(w))),this._parser.registerCsiHandler({final:"u"},(w=>this.restoreCursor(w))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(w=>this.insertColumns(w))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(w=>this.deleteColumns(w))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(w=>this.selectProtected(w))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(w=>this.requestMode(w,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(w=>this.requestMode(w,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new b.OscHandler((w=>(this.setTitle(w),this.setIconName(w),!0)))),this._parser.registerOscHandler(1,new b.OscHandler((w=>this.setIconName(w)))),this._parser.registerOscHandler(2,new b.OscHandler((w=>this.setTitle(w)))),this._parser.registerOscHandler(4,new b.OscHandler((w=>this.setOrReportIndexedColor(w)))),this._parser.registerOscHandler(8,new b.OscHandler((w=>this.setHyperlink(w)))),this._parser.registerOscHandler(10,new b.OscHandler((w=>this.setOrReportFgColor(w)))),this._parser.registerOscHandler(11,new b.OscHandler((w=>this.setOrReportBgColor(w)))),this._parser.registerOscHandler(12,new b.OscHandler((w=>this.setOrReportCursorColor(w)))),this._parser.registerOscHandler(104,new b.OscHandler((w=>this.restoreIndexedColor(w)))),this._parser.registerOscHandler(110,new b.OscHandler((w=>this.restoreFgColor(w)))),this._parser.registerOscHandler(111,new b.OscHandler((w=>this.restoreBgColor(w)))),this._parser.registerOscHandler(112,new b.OscHandler((w=>this.restoreCursorColor(w)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const w in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:w},(()=>this.selectCharset("("+w))),this._parser.registerEscHandler({intermediates:")",final:w},(()=>this.selectCharset(")"+w))),this._parser.registerEscHandler({intermediates:"*",final:w},(()=>this.selectCharset("*"+w))),this._parser.registerEscHandler({intermediates:"+",final:w},(()=>this.selectCharset("+"+w))),this._parser.registerEscHandler({intermediates:"-",final:w},(()=>this.selectCharset("-"+w))),this._parser.registerEscHandler({intermediates:".",final:w},(()=>this.selectCharset("."+w))),this._parser.registerEscHandler({intermediates:"/",final:w},(()=>this.selectCharset("/"+w)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((w=>(this._logService.error("Parsing error: ",w),w))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new x.DcsHandler(((w,F)=>this.requestStatusString(w,F))))}_preserveStack(C,L,M,I){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=M,this._parseStack.position=I}_logSlowResolvingAsync(C){this._logService.logLevel<=u.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,M)=>setTimeout((()=>M("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let M,I=this._activeBuffer.x,z=this._activeBuffer.y,K=0;const Y=this._parseStack.paused;if(Y){if(M=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(M),M;I=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>R&&(K=this._parseStack.position+R)}if(this._logService.logLevel<=u.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(X=>String.fromCharCode(X))).join("")}"`),typeof C=="string"?C.split("").map((X=>X.charCodeAt(0))):C),this._parseBuffer.lengthR)for(let X=K;X0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let q=L;q=X){if(ne){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=X-1,z===2)continue}if(w&&(U.insertCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(F),F),U.getWidth(X-1)===2&&U.setCellFromCodePoint(X-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),U.setCellFromCodePoint(this._activeBuffer.x++,I,z,F.fg,F.bg,F.extended),z>0)for(;--z;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else U.getWidth(this._activeBuffer.x-1)?U.addCodepointToCell(this._activeBuffer.x-1,I):U.addCodepointToCell(this._activeBuffer.x-2,I)}M-L>0&&(U.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(M=>!N(M.params[0],this._optionsService.rawOptions.windowOptions)||L(M)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new x.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new b.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||C===void 0)&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,M,I=!1,z=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);K.replaceCells(L,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),z),I&&(K.isWrapped=!1)}_resetBufferLine(C,L=!1){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);M&&(M.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),M.isWrapped=!1)}eraseInDisplay(C,L=!1){let M;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);M=this._bufferService.cols&&(this._activeBuffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowTracker.markDirty(M-1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 3:const I=this._activeBuffer.lines.length-this._bufferService.rows;I>0&&(this._activeBuffer.lines.trimStart(I),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-I,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-I,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;Loe?1:2,q=C.params[0];return ee=q,J=L?q===2?4:q===4?U(K.modes.insertMode):q===12?3:q===20?U(F.convertEol):0:q===1?U(M.applicationCursorKeys):q===3?F.windowOptions.setWinLines?X===80?2:X===132?1:0:0:q===6?U(M.origin):q===7?U(M.wraparound):q===8?3:q===9?U(I==="X10"):q===12?U(F.cursorBlink):q===25?U(!K.isCursorHidden):q===45?U(M.reverseWraparound):q===66?U(M.applicationKeypad):q===67?4:q===1e3?U(I==="VT200"):q===1002?U(I==="DRAG"):q===1003?U(I==="ANY"):q===1004?U(M.sendFocus):q===1005?4:q===1006?U(z==="SGR"):q===1015?4:q===1016?U(z==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?U(ne===w):q===2004?U(M.bracketedPasteMode):0,K.triggerDataEvent(`${o.C0.ESC}[${L?"":"?"}${ee};${J}$y`),!0;var ee,J}_updateAttrColor(C,L,M,I,z){return L===2?(C|=50331648,C&=-16777216,C|=l.AttributeData.fromColorRGB([M,I,z])):L===5&&(C&=-50331904,C|=33554432|255&M),C}_extractColor(C,L,M){const I=[0,0,-1,0,0,0];let z=0,K=0;do{if(I[K+z]=C.params[L+K],C.hasSubParams(L+K)){const Y=C.getSubParams(L+K);let X=0;do I[1]===5&&(z=1),I[K+X+1+z]=Y[X];while(++X=2||I[1]===2&&K+z>=5)break;I[1]&&(z=1)}while(++K+L5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=C.length;let M;const I=this._curAttrData;for(let z=0;z=30&&M<=37?(I.fg&=-50331904,I.fg|=16777216|M-30):M>=40&&M<=47?(I.bg&=-50331904,I.bg|=16777216|M-40):M>=90&&M<=97?(I.fg&=-50331904,I.fg|=16777224|M-90):M>=100&&M<=107?(I.bg&=-50331904,I.bg|=16777224|M-100):M===0?this._processSGR0(I):M===1?I.fg|=134217728:M===3?I.bg|=67108864:M===4?(I.fg|=268435456,this._processUnderline(C.hasSubParams(z)?C.getSubParams(z)[0]:1,I)):M===5?I.fg|=536870912:M===7?I.fg|=67108864:M===8?I.fg|=1073741824:M===9?I.fg|=2147483648:M===2?I.bg|=134217728:M===21?this._processUnderline(2,I):M===22?(I.fg&=-134217729,I.bg&=-134217729):M===23?I.bg&=-67108865:M===24?(I.fg&=-268435457,this._processUnderline(0,I)):M===25?I.fg&=-536870913:M===27?I.fg&=-67108865:M===28?I.fg&=-1073741825:M===29?I.fg&=2147483647:M===39?(I.fg&=-67108864,I.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):M===49?(I.bg&=-67108864,I.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?z+=this._extractColor(C,z,I):M===53?I.bg|=1073741824:M===55?I.bg&=-1073741825:M===59?(I.extended=I.extended.clone(),I.extended.underlineColor=-1,I.updateExtended()):M===100?(I.fg&=-67108864,I.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,I.bg&=-67108864,I.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${L};${M}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const L=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${L};${M}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const M=L%2==1;return this._optionsService.options.cursorBlink=M,!0}setScrollRegion(C){const L=C.params[0]||1;let M;return(C.length<2||(M=C.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=M-1,this._setCursor(0,0)),!0}windowOptions(C){if(!N(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const L=[],M=C.split(";");for(;M.length>1;){const I=M.shift(),z=M.shift();if(/^\d+$/.exec(I)){const K=parseInt(I);if(j(K))if(z==="?")L.push({type:0,index:K});else{const Y=(0,d.parseColor)(z);Y&&L.push({type:1,index:K,color:Y})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){const L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();const M=C.split(":");let I;const z=M.findIndex((K=>K.startsWith("id=")));return z!==-1&&(I=M[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:I,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){const M=C.split(";");for(let I=0;I=this._specialColors.length);++I,++L)if(M[I]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const z=(0,d.parseColor)(M[I]);z&&this._onColor.fire([{type:1,index:this._specialColors[L],color:z}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const L=[],M=C.split(";");for(let I=0;I=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new i.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${o.C0.ESC}${z}${o.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${M.scrollTop+1};${M.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[I.cursorStyle]-(I.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}r.InputHandler=D;let B=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){Pthis.end&&(this.end=P)}markRangeDirty(P,C){P>C&&(E=P,P=C,C=E),Pthis.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function j(P){return 0<=P&&P<256}B=h([p(0,u.IBufferService)],B)},844:(A,r)=>{function n(h){for(const p of h)p.dispose();h.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const p=this._disposables.indexOf(h);p!==-1&&this._disposables.splice(p,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var p;this._isDisposed||h===this._value||((p=this._value)===null||p===void 0||p.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)===null||h===void 0||h.dispose(),this._value=void 0}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=n,r.getDisposeArrayDisposable=function(h){return{dispose:()=>n(h)}}},1505:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(p,o,f){this._data[p]||(this._data[p]={}),this._data[p][o]=f}get(p,o){return this._data[p]?this._data[p][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(h,p,o,f,g){this._data.get(h,p)||this._data.set(h,p,new n),this._data.get(h,p).set(o,f,g)}get(h,p,o,f){var g;return(g=this._data.get(h,p))===null||g===void 0?void 0:g.get(o,f)}clear(){this._data.clear()}}},6114:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const n=r.isNode?"node":navigator.userAgent,h=r.isNode?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.getSafariVersion=function(){if(!r.isSafari)return 0;const p=n.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(n=this._search(this._getKey(h)),this._array.splice(n,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const p=this._getKey(h);if(p===void 0||(n=this._search(p),n===-1)||this._getKey(this._array[n])!==p)return!1;do if(this._array[n]===h)return this._array.splice(n,1),!0;while(++n=this._array.length)&&this._getKey(this._array[n])===h))do yield this._array[n];while(++n=this._array.length)&&this._getKey(this._array[n])===h))do p(this._array[n]);while(++n=p;){let f=p+o>>1;const g=this._getKey(this._array[f]);if(g>h)o=f-1;else{if(!(g0&&this._getKey(this._array[f-1])===h;)f--;return f}p=f+1}}return p}}},7226:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const h=n(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._is)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class o extends p{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const v=Date.now()+g;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const h=n(643);r.updateWindowsModeWrappedState=function(p){const o=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),f=o?.get(p.cols-1),g=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);g&&f&&(g.isWrapped=f[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&f[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){const o=new n;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=n;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}constructor(o=0,f=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=f}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const h=n(6349),p=n(7226),o=n(3734),f=n(8437),g=n(4634),v=n(511),m=n(643),e=n(4863),s=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,i,l){this._hasScrollback=t,this._optionsService=i,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,m.WHITESPACE_CELL_CHAR,m.WHITESPACE_CELL_WIDTH,m.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,i){return new f.BufferLine(this._bufferService.cols,this.getNullCell(t),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&tr.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=f.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,i){const l=this.getNullCell(f.DEFAULT_ATTR_DATA);let u=0;const b=this._getCorrectBufferLength(i);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+x+1?(this.ybase--,x++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(t,l)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=b}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,i-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(t,i),this._cols>t))for(let x=0;x.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let i=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,i){this._cols!==t&&(t>this._cols?this._reflowLarger(t,i):this._reflowSmaller(t,i))}_reflowLarger(t,i){const l=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(l.length>0){const u=(0,g.reflowLargerCreateNewLayout)(this.lines,l);(0,g.reflowLargerApplyNewLayout)(this.lines,u.layout),this._reflowLargerAdjustViewport(t,i,u.countRemoved)}}_reflowLargerAdjustViewport(t,i,l){const u=this.getNullCell(f.DEFAULT_ATTR_DATA);let b=l;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;x--){let d=this.lines.get(x);if(!d||!d.isWrapped&&d.getTrimmedLength()<=t)continue;const S=[d];for(;d.isWrapped&&x>0;)d=this.lines.get(--x),S.unshift(d);const R=this.ybase+this.y;if(R>=x&&R0&&(u.push({start:x+S.length+b,newLines:B}),b+=B.length),S.push(...B);let j=y.length-1,P=y[j];P===0&&(j--,P=y[j]);let C=S.length-E-1,L=N;for(;C>=0;){const I=Math.min(L,P);if(S[j]===void 0)break;if(S[j].copyCellsFrom(S[C],L-I,P-I,I,!0),P-=I,P===0&&(j--,P=y[j]),L-=I,L===0){C--;const z=Math.max(C,0);L=(0,g.getWrappedLineTrimmedLength)(S,z,this._cols)}}for(let I=0;I0;)this.ybase===0?this.y0){const x=[],d=[];for(let j=0;j=0;j--)if(y&&y.start>R+E){for(let P=y.newLines.length-1;P>=0;P--)this.lines.set(j--,y.newLines[P]);j++,x.push({index:R+1,amount:y.newLines.length}),E+=y.newLines.length,y=u[++N]}else this.lines.set(j,d[R--]);let D=0;for(let j=x.length-1;j>=0;j--)x[j].index+=D,this.lines.onInsertEmitter.fire(x[j]),D+=x[j].amount;const B=Math.max(0,S+b-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(t,i,l=0,u){const b=this.lines.get(t);return b?b.translateToString(i,l,u):""}getWrappedRangeForLine(t){let i=t,l=t;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;l+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let i=0;i{i.line-=l,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((l=>{i.line>=l.index&&(i.line+=l.amount)}))),i.register(this.lines.onDelete((l=>{i.line>=l.index&&i.linel.index&&(i.line-=l.amount)}))),i.register(i.onDispose((()=>this._removeMarker(i)))),i}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const h=n(3734),p=n(511),o=n(643),f=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let g=0;class v{constructor(e,s,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const i=s||p.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let l=0;l>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,s){this._data[3*e+1]=s[o.CHAR_DATA_ATTR_INDEX],s[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,f.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return g=3*e,s.content=this._data[g+0],s.fg=this._data[g+1],s.bg=this._data[g+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodePoint(e,s,t,i,l,u){268435456&l&&(this._extendedAttrs[e]=u),this._data[3*e+0]=s|t<<22,this._data[3*e+1]=i,this._data[3*e+2]=l}addCodepointToCell(e,s){let t=this._data[3*e+0];2097152&t?this._combined[e]+=(0,f.stringFromCodePoint)(s):(2097151&t?(this._combined[e]=(0,f.stringFromCodePoint)(2097151&t)+(0,f.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,this._data[3*e+0]=t)}insertCells(e,s,t,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,i?.fg||0,i?.bg||0,i?.extended||new h.ExtendedAttrs),s=0;--u)this.setCell(e+s+u,this.loadCell(e+u,l));for(let u=0;uthis.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const i=new Uint32Array(t);i.set(this._data),this._data=i}for(let i=this.length;i=e&&delete this._combined[b]}const l=Object.keys(this._extendedAttrs);for(let u=0;u=e&&delete this._extendedAttrs[b]}}return this.length=e,4*t*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,s,t,i,l){const u=e._data;if(l)for(let x=i-1;x>=0;x--){for(let d=0;d<3;d++)this._data[3*(t+x)+d]=u[3*(s+x)+d];268435456&u[3*(s+x)+2]&&(this._extendedAttrs[t+x]=e._extendedAttrs[s+x])}else for(let x=0;x=s&&(this._combined[d-s+t]=e._combined[d])}}translateToString(e=!1,s=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let i="";for(;s>22||1}return i}}r.BufferLine=v},4841:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,h){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return h*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(A,r)=>{function n(h,p,o){if(p===h.length-1)return h[p].getTrimmedLength();const f=!h[p].hasContent(o-1)&&h[p].getWidth(o-1)===1,g=h[p+1].getWidth(0)===2;return f&&g?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,p,o,f,g){const v=[];for(let m=0;m=m&&f0&&(d>i||t[d].getTrimmedLength()===0);d--)x++;x>0&&(v.push(m+t.length-x),v.push(x)),m+=t.length-1}return v},r.reflowLargerCreateNewLayout=function(h,p){const o=[];let f=0,g=p[f],v=0;for(let m=0;mn(h,t,p))).reduce(((s,t)=>s+t));let v=0,m=0,e=0;for(;es&&(v-=s,m++);const t=h[m].getWidth(v-1)===2;t&&v--;const i=t?o-1:o;f.push(i),e+=i}return f},r.getWrappedLineTrimmedLength=n},5295:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const h=n(8460),p=n(844),o=n(9092);class f extends p.Disposable{constructor(v,m){super(),this._optionsService=v,this._bufferService=m,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,m){this._normal.resize(v,m),this._alt.resize(v,m),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}r.BufferSet=f},511:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const h=n(482),p=n(643),o=n(3734);class f extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const m=new f;return m.setFromCharData(v),m}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let m=!1;if(v[p.CHAR_DATA_CHAR_INDEX].length>2)m=!0;else if(v[p.CHAR_DATA_CHAR_INDEX].length===2){const e=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[p.CHAR_DATA_WIDTH_INDEX]<<22:m=!0}else m=!0}else this.content=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[p.CHAR_DATA_WIDTH_INDEX]<<22;m&&(this.combinedData=v[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=f},643:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const h=n(8460),p=n(844);class o{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}r.Marker=o,o._nextId=1},7116:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(A,r)=>{var n,h,p;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=` -`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL=""})(n||(r.C0=n={})),(function(o){o.PAD="€",o.HOP="",o.BPH="‚",o.NBH="ƒ",o.IND="„",o.NEL="…",o.SSA="†",o.ESA="‡",o.HTS="ˆ",o.HTJ="‰",o.VTS="Š",o.PLD="‹",o.PLU="Œ",o.RI="",o.SS2="Ž",o.SS3="",o.DCS="",o.PU1="‘",o.PU2="’",o.STS="“",o.CCH="”",o.MW="•",o.SPA="–",o.EPA="—",o.SOS="˜",o.SGCI="™",o.SCI="š",o.CSI="›",o.ST="œ",o.OSC="",o.PM="ž",o.APC="Ÿ"})(h||(r.C1=h={})),(function(o){o.ST=`${n.ESC}\\`})(p||(r.C1_ESCAPED=p={}))},7399:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const h=n(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(o,f,g,v){const m={type:0,cancel:!1,key:void 0},e=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?m.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?m.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?m.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(m.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:if(o.altKey){m.key=h.C0.ESC+h.C0.DEL;break}m.key=h.C0.DEL;break;case 9:if(o.shiftKey){m.key=h.C0.ESC+"[Z";break}m.key=h.C0.HT,m.cancel=!0;break;case 13:m.key=o.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,m.cancel=!0;break;case 27:m.key=h.C0.ESC,o.altKey&&(m.key=h.C0.ESC+h.C0.ESC),m.cancel=!0;break;case 37:if(o.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"D",m.key===h.C0.ESC+"[1;3D"&&(m.key=h.C0.ESC+(g?"b":"[1;5D"))):m.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(o.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"C",m.key===h.C0.ESC+"[1;3C"&&(m.key=h.C0.ESC+(g?"f":"[1;5C"))):m.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(o.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"A",g||m.key!==h.C0.ESC+"[1;3A"||(m.key=h.C0.ESC+"[1;5A")):m.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(o.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"B",g||m.key!==h.C0.ESC+"[1;3B"||(m.key=h.C0.ESC+"[1;5B")):m.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(m.key=h.C0.ESC+"[2~");break;case 46:m.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:m.key=e?h.C0.ESC+"[1;"+(e+1)+"H":f?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:m.key=e?h.C0.ESC+"[1;"+(e+1)+"F":f?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:o.shiftKey?m.type=2:o.ctrlKey?m.key=h.C0.ESC+"[5;"+(e+1)+"~":m.key=h.C0.ESC+"[5~";break;case 34:o.shiftKey?m.type=3:o.ctrlKey?m.key=h.C0.ESC+"[6;"+(e+1)+"~":m.key=h.C0.ESC+"[6~";break;case 112:m.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:m.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:m.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:m.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:m.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:m.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:m.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:m.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:m.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:m.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:m.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:m.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(g&&!v||!o.altKey||o.metaKey)!g||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?m.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(m.key=h.C0.US),o.key==="@"&&(m.key=h.C0.NUL)):o.keyCode===65&&(m.type=1);else{const s=p[o.keyCode],t=s?.[o.shiftKey?1:0];if(t)m.key=h.C0.ESC+t;else if(o.keyCode>=65&&o.keyCode<=90){const i=o.ctrlKey?o.keyCode-64:o.keyCode+32;let l=String.fromCharCode(i);o.shiftKey&&(l=l.toUpperCase()),m.key=h.C0.ESC+l}else if(o.keyCode===32)m.key=h.C0.ESC+(o.ctrlKey?h.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let i=o.code.slice(3,4);o.shiftKey||(i=i.toLowerCase()),m.key=h.C0.ESC+i,m.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?m.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?m.key=h.C0.NUL:o.keyCode>=51&&o.keyCode<=55?m.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?m.key=h.C0.DEL:o.keyCode===219?m.key=h.C0.ESC:o.keyCode===220?m.key=h.C0.FS:o.keyCode===221&&(m.key=h.C0.GS)}return m}},482:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},r.utf32ToString=function(n,h=0,p=n.length){let o="";for(let f=h;f65535?(g-=65536,o+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):o+=String.fromCharCode(g)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,h){const p=n.length;if(!p)return 0;let o=0,f=0;if(this._interim){const g=n.charCodeAt(f++);56320<=g&&g<=57343?h[o++]=1024*(this._interim-55296)+g-56320+65536:(h[o++]=this._interim,h[o++]=g),this._interim=0}for(let g=f;g=p)return this._interim=v,o;const m=n.charCodeAt(g);56320<=m&&m<=57343?h[o++]=1024*(v-55296)+m-56320+65536:(h[o++]=v,h[o++]=m)}else v!==65279&&(h[o++]=v)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,h){const p=n.length;if(!p)return 0;let o,f,g,v,m=0,e=0,s=0;if(this.interim[0]){let l=!1,u=this.interim[0];u&=(224&u)==192?31:(240&u)==224?15:7;let b,x=0;for(;(b=63&this.interim[++x])&&x<4;)u<<=6,u|=b;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=d-x;for(;s=p)return 0;if(b=n[s++],(192&b)!=128){s--,l=!0;break}this.interim[x++]=b,u<<=6,u|=63&b}l||(d===2?u<128?s--:h[m++]=u:d===3?u<2048||u>=55296&&u<=57343||u===65279||(h[m++]=u):u<65536||u>1114111||(h[m++]=u)),this.interim.fill(0)}const t=p-4;let i=s;for(;i=p)return this.interim[0]=o,m;if(f=n[i++],(192&f)!=128){i--;continue}if(e=(31&o)<<6|63&f,e<128){i--;continue}h[m++]=e}else if((240&o)==224){if(i>=p)return this.interim[0]=o,m;if(f=n[i++],(192&f)!=128){i--;continue}if(i>=p)return this.interim[0]=o,this.interim[1]=f,m;if(g=n[i++],(192&g)!=128){i--;continue}if(e=(15&o)<<12|(63&f)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;h[m++]=e}else if((248&o)==240){if(i>=p)return this.interim[0]=o,m;if(f=n[i++],(192&f)!=128){i--;continue}if(i>=p)return this.interim[0]=o,this.interim[1]=f,m;if(g=n[i++],(192&g)!=128){i--;continue}if(i>=p)return this.interim[0]=o,this.interim[1]=f,this.interim[2]=g,m;if(v=n[i++],(192&v)!=128){i--;continue}if(e=(7&o)<<18|(63&f)<<12|(63&g)<<6|63&v,e<65536||e>1114111)continue;h[m++]=e}}return m}}},225:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const n=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;r.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let o=0;og[e][1])return!1;for(;e>=m;)if(v=m+e>>1,f>g[v][1])m=v+1;else{if(!(f=131072&&o<=196605||o>=196608&&o<=262141?2:1}}},5981:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const h=n(8460),p=n(844);class o extends p.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let m;for(this._isSyncWriting=!0;m=this._writeBuffer.shift();){this._action(m);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,v){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(v),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(v)}_innerWrite(g=0,v=!0){const m=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,v);if(s){const i=l=>Date.now()-m>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(m,l);return void s.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(i)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-m>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=o},5941:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function p(o,f){const g=o.toString(16),v=g.length<2?"0"+g:g;switch(f){case 4:return g[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}r.parseColor=function(o){if(!o)return;let f=o.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);const g=n.exec(f);if(g){const v=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/v*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/v*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/v*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),h.exec(f)&&[3,6,9,12].includes(f.length))){const g=f.length/3,v=[0,0,0];for(let m=0;m<3;++m){const e=parseInt(f.slice(g*m,g*m+g),16);v[m]=g===1?e<<4:g===2?e:g===3?e>>4:e>>8}return v}},r.toRgbString=function(o,f=16){const[g,v,m]=o;return`rgb:${p(g,f)}/${p(v,f)}/${p(m,f)}`}},5770:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const h=n(482),p=n(8742),o=n(5770),f=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(v,m){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(m),{dispose:()=>{const s=e.indexOf(m);s!==-1&&e.splice(s,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(v,m){if(this.reset(),this._ident=v,this._active=this._handlers[v]||f,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(m);else this._handlerFb(this._ident,"HOOK",m)}put(v,m,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(v,m,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,m,e))}unhook(v,m=!0){if(this._active.length){let e=!1,s=this._active.length-1,t=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=m,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;s>=0&&(e=this._active[s].unhook(v),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=f,this._ident=0}};const g=new p.Params;g.addParam(0),r.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=g,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():g,this._data="",this._hitLimit=!1}put(v,m,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,m,e),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let m=!1;if(this._hitLimit)m=!1;else if(v&&(m=this._handler(this._data,this._params),m instanceof Promise))return m.then((e=>(this._params=g,this._data="",this._hitLimit=!1,e)));return this._params=g,this._data="",this._hitLimit=!1,m}}},2015:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const h=n(844),p=n(8742),o=n(6242),f=n(6351);class g{constructor(s){this.table=new Uint8Array(s)}setDefault(s,t){this.table.fill(s<<4|t)}add(s,t,i,l){this.table[t<<8|s]=i<<4|l}addMany(s,t,i,l){for(let u=0;ud)),t=(x,d)=>s.slice(x,d),i=t(32,127),l=t(0,24);l.push(25),l.push.apply(l,t(28,32));const u=t(0,14);let b;for(b in e.setDefault(1,0),e.addMany(i,0,2,0),u)e.addMany([24,26,153,154],b,3,0),e.addMany(t(128,144),b,3,0),e.addMany(t(144,152),b,3,0),e.add(156,b,0,0),e.add(27,b,11,1),e.add(157,b,4,8),e.addMany([152,158,159],b,0,7),e.add(155,b,11,3),e.add(144,b,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(t(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(t(64,127),3,7,0),e.addMany(t(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(t(48,60),4,8,4),e.addMany(t(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(t(32,64),6,0,6),e.add(127,6,0,6),e.addMany(t(64,127),6,0,0),e.addMany(t(32,48),3,9,5),e.addMany(t(32,48),5,9,5),e.addMany(t(48,64),5,0,6),e.addMany(t(64,127),5,7,0),e.addMany(t(32,48),4,9,5),e.addMany(t(32,48),1,9,2),e.addMany(t(32,48),2,9,2),e.addMany(t(48,127),2,10,0),e.addMany(t(48,80),1,10,0),e.addMany(t(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(t(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(t(28,32),9,0,9),e.addMany(t(32,48),9,9,12),e.addMany(t(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(t(32,128),11,0,11),e.addMany(t(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(t(28,32),10,0,10),e.addMany(t(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(t(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(t(28,32),12,0,12),e.addMany(t(32,48),12,9,12),e.addMany(t(48,64),12,0,11),e.addMany(t(64,127),12,12,13),e.addMany(t(64,127),10,12,13),e.addMany(t(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e})();class m extends h.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(t,i,l)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,t=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let u=0;ub||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=b}}if(s.final.length!==1)throw new Error("final must be a single byte");const l=s.final.charCodeAt(0);if(t[0]>l||l>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=l,i}identToString(s){const t=[];for(;s;)t.push(String.fromCharCode(255&s)),s>>=8;return t.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,t){const i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);const l=this._escHandlers[i];return l.push(t),{dispose:()=>{const u=l.indexOf(t);u!==-1&&l.splice(u,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,t){this._executeHandlers[s.charCodeAt(0)]=t}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,t){const i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);const l=this._csiHandlers[i];return l.push(t),{dispose:()=>{const u=l.indexOf(t);u!==-1&&l.splice(u,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,t){return this._dcsParser.registerHandler(this._identifier(s),t)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,t){return this._oscParser.registerHandler(s,t)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,t,i,l,u){this._parseStack.state=s,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=l,this._parseStack.chunkPos=u}parse(s,t,i){let l,u=0,b=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const d=this._parseStack.handlers;let S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&S>-1){for(;S>=0&&(l=d[S](this._params),l!==!0);S--)if(l instanceof Promise)return this._parseStack.handlerPos=S,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&S>-1){for(;S>=0&&(l=d[S](),l!==!0);S--)if(l instanceof Promise)return this._parseStack.handlerPos=S,l}this._parseStack.handlers=[];break;case 6:if(u=s[this._parseStack.chunkPos],l=this._dcsParser.unhook(u!==24&&u!==26,i),l)return l;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(u=s[this._parseStack.chunkPos],l=this._oscParser.end(u!==24&&u!==26,i),l)return l;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,x=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let d=x;d>4){case 2:for(let E=d+1;;++E){if(E>=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=0&&(l=S[R](this._params),l!==!0);R--)if(l instanceof Promise)return this._preserveStack(3,S,R,b,d),l;R<0&&this._csiHandlerFb(this._collect<<8|u,this._params),this.precedingCodepoint=0;break;case 8:do switch(u){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(u-48)}while(++d47&&u<60);d--;break;case 9:this._collect<<=8,this._collect|=u;break;case 10:const N=this._escHandlers[this._collect<<8|u];let y=N?N.length-1:-1;for(;y>=0&&(l=N[y](),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(4,N,y,b,d),l;y<0&&this._escHandlerFb(this._collect<<8|u),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|u,this._params);break;case 13:for(let E=d+1;;++E)if(E>=t||(u=s[E])===24||u===26||u===27||u>127&&u=t||(u=s[E])<32||u>127&&u{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const h=n(5770),p=n(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,g){this._handlers[f]===void 0&&(this._handlers[f]=[]);const v=this._handlers[f];return v.push(g),{dispose:()=>{const m=v.indexOf(g);m!==-1&&v.splice(m,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,g,v){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(f,g,v);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(f,g,v))}start(){this.reset(),this._state=1}put(f,g,v){if(this._state!==3){if(this._state===1)for(;g0&&this._put(f,g,v)}}end(f,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,m=this._active.length-1,e=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,v=g,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;m>=0&&(v=this._active[m].end(f),v!==!0);m--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,v;m--}for(;m>=0;m--)if(v=this._active[m].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",f);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,g,v){this._hitLimit||(this._data+=(0,p.utf32ToString)(f,g,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let g=!1;if(this._hitLimit)g=!1;else if(f&&(g=this._handler(this._data),g instanceof Promise))return g.then((v=>(this._data="",this._hitLimit=!1,v)));return this._data="",this._hitLimit=!1,g}}},8742:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const n=2147483647;class h{static fromArray(o){const f=new h;if(!o.length)return f;for(let g=Array.isArray(o[0])?1:0;g256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const o=new h(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){const o=[];for(let f=0;f>8,v=255&this._subParamsIdx[f];v-g>0&&o.push(Array.prototype.slice.call(this._subParams,g,v))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>n?n:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>n?n:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){const f=this._subParamsIdx[o]>>8,g=255&this._subParamsIdx[o];return g-f>0?this._subParams.subarray(f,g):null}getSubParamsAll(){const o={};for(let f=0;f>8,v=255&this._subParamsIdx[f];v-g>0&&(o[f]=this._subParams.slice(g,v))}return o}addDigit(o){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,v=g[f-1];g[f-1]=~v?Math.min(10*v+o,n):o}}r.Params=h},5741:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,h){const p={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(p),h.dispose=()=>this._wrappedAddonDispose(p),h.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let h=-1;for(let p=0;p{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const h=n(3785),p=n(511);r.BufferApiView=class{constructor(o,f){this._buffer=o,this.type=f}init(o){return this._buffer=o,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(o){const f=this._buffer.lines.get(o);if(f)return new h.BufferLineApiView(f)}getNullCell(){return new p.CellData}}},3785:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const h=n(511);r.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,o){if(!(p<0||p>=this._line.length))return o?(this._line.loadCell(p,o),o):this._line.loadCell(p,new h.CellData)}translateToString(p,o,f){return this._line.translateToString(p,o,f)}}},8285:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const h=n(8771),p=n(8460),o=n(844);class f extends o.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=f},7975:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,h){return this._core.registerCsiHandler(n,(p=>h(p.toArray())))}addCsiHandler(n,h){return this.registerCsiHandler(n,h)}registerDcsHandler(n,h){return this._core.registerDcsHandler(n,((p,o)=>h(p,o.toArray())))}addDcsHandler(n,h){return this.registerDcsHandler(n,h)}registerEscHandler(n,h){return this._core.registerEscHandler(n,h)}addEscHandler(n,h){return this.registerEscHandler(n,h)}registerOscHandler(n,h){return this._core.registerOscHandler(n,h)}addOscHandler(n,h){return this.registerOscHandler(n,h)}}},7090:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(A,r,n){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,b=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(e,s,t,i);else for(var x=e.length-1;x>=0;x--)(l=e[x])&&(b=(u<3?l(b):u>3?l(s,t,b):l(s,t))||b);return u>3&&b&&Object.defineProperty(s,t,b),b},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const o=n(8460),f=n(844),g=n(5295),v=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let m=r.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(e,this))}resize(e,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const t=this.buffer;let i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=t.getBlankLine(e,s),this._cachedBlankLine=i),i.isWrapped=s;const l=t.ybase+t.scrollTop,u=t.ybase+t.scrollBottom;if(t.scrollTop===0){const b=t.lines.isFull;u===t.lines.length-1?b?t.lines.recycle().copyFrom(i):t.lines.push(i.clone()):t.lines.splice(u+1,0,i.clone()),b?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const b=u-l+1;t.lines.shiftElements(l+1,b-1,-1),t.lines.set(u,i.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,s,t){const i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const l=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),l!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=m=h([p(0,v.IOptionsService)],m)},7994:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,h){this._charsets[n]=h,this.glevel===n&&(this.charset=h)}}},1753:function(A,r,n){var h=this&&this.__decorate||function(i,l,u,b){var x,d=arguments.length,S=d<3?l:b===null?b=Object.getOwnPropertyDescriptor(l,u):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,l,u,b);else for(var R=i.length-1;R>=0;R--)(x=i[R])&&(S=(d<3?x(S):d>3?x(l,u,S):x(l,u))||S);return d>3&&S&&Object.defineProperty(l,u,S),S},p=this&&this.__param||function(i,l){return function(u,b){l(u,b,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const o=n(2585),f=n(8460),g=n(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function m(i,l){let u=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(u|=64,u|=i.action):(u|=3&i.button,4&i.button&&(u|=64),8&i.button&&(u|=128),i.action===32?u|=32:i.action!==0||l||(u|=3)),u}const e=String.fromCharCode,s={DEFAULT:i=>{const l=[m(i,!1)+32,i.col+32,i.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${e(l[0])}${e(l[1])}${e(l[2])}`},SGR:i=>{const l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${m(i,!0)};${i.col};${i.row}${l}`},SGR_PIXELS:i=>{const l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${m(i,!0)};${i.x};${i.y}${l}`}};let t=r.CoreMouseService=class extends g.Disposable{constructor(i,l){super(),this._bufferService=i,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const u of Object.keys(v))this.addProtocol(u,v[u]);for(const u of Object.keys(s))this.addEncoding(u,s[u]);this.reset()}addProtocol(i,l){this._protocols[i]=l}addEncoding(i,l){this._encodings[i]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;const l=this._encodings[this._activeEncoding](i);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,l,u){if(u){if(i.x!==l.x||i.y!==l.y)return!1}else if(i.col!==l.col||i.row!==l.row)return!1;return i.button===l.button&&i.action===l.action&&i.ctrl===l.ctrl&&i.alt===l.alt&&i.shift===l.shift}};r.CoreMouseService=t=h([p(0,o.IBufferService),p(1,o.ICoreService)],t)},6975:function(A,r,n){var h=this&&this.__decorate||function(t,i,l,u){var b,x=arguments.length,d=x<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(t,i,l,u);else for(var S=t.length-1;S>=0;S--)(b=t[S])&&(d=(x<3?b(d):x>3?b(i,l,d):b(i,l))||d);return x>3&&d&&Object.defineProperty(i,l,d),d},p=this&&this.__param||function(t,i){return function(l,u){i(l,u,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const o=n(1439),f=n(8460),g=n(844),v=n(2585),m=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let s=r.CoreService=class extends g.Disposable{constructor(t,i,l){super(),this._bufferService=t,this._logService=i,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(m),this.decPrivateModes=(0,o.clone)(e)}reset(){this.modes=(0,o.clone)(m),this.decPrivateModes=(0,o.clone)(e)}triggerDataEvent(t,i=!1){if(this._optionsService.rawOptions.disableStdin)return;const l=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,(()=>t.split("").map((u=>u.charCodeAt(0))))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,(()=>t.split("").map((i=>i.charCodeAt(0))))),this._onBinary.fire(t))}};r.CoreService=s=h([p(0,v.IBufferService),p(1,v.ILogService),p(2,v.IOptionsService)],s)},9074:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const h=n(8055),p=n(8460),o=n(844),f=n(6106);let g=0,v=0;class m extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList((t=>t?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(t){if(t.marker.isDisposed)return;const i=new e(t);if(i){const l=i.marker.onDispose((()=>i.dispose()));i.onDispose((()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),l.dispose())})),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,i,l){var u,b,x;let d=0,S=0;for(const R of this._decorations.getKeyIterator(i))d=(u=R.options.x)!==null&&u!==void 0?u:0,S=d+((b=R.options.width)!==null&&b!==void 0?b:1),t>=d&&t{var x,d,S;g=(x=b.options.x)!==null&&x!==void 0?x:0,v=g+((d=b.options.width)!==null&&d!==void 0?d:1),t>=g&&t{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const h=n(2585),p=n(8343);class o{constructor(...g){this._entries=new Map;for(const[v,m]of g)this.set(v,m)}set(g,v){const m=this._entries.get(g);return this._entries.set(g,v),m}forEach(g){for(const[v,m]of this._entries.entries())g(v,m)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(h.IInstantiationService,this)}setService(f,g){this._services.set(f,g)}getService(f){return this._services.get(f)}createInstance(f,...g){const v=(0,p.getServiceDependencies)(f).sort(((s,t)=>s.index-t.index)),m=[];for(const s of v){const t=this._services.get(s.id);if(!t)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);m.push(t)}const e=v.length>0?v[0].index:g.length;if(g.length!==e)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${e+1} conflicts with ${g.length} static arguments`);return new f(...g,...m)}}},7866:function(A,r,n){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,b=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(e,s,t,i);else for(var x=e.length-1;x>=0;x--)(l=e[x])&&(b=(u<3?l(b):u>3?l(s,t,b):l(s,t))||b);return u>3&&b&&Object.defineProperty(s,t,b),b},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const o=n(844),f=n(2585),g={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let v,m=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;sJSON.stringify(b))).join(", ")})`);const u=i.apply(this,l);return v.trace(`GlyphRenderer#${i.name} return`,u),u}}},7302:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const h=n(8460),p=n(844),o=n(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const f=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends p.Disposable{constructor(m){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e=Object.assign({},r.DEFAULT_OPTIONS);for(const s in m)if(s in e)try{const t=m[s];e[s]=this._sanitizeAndValidateOption(s,t)}catch(t){console.error(t)}this.rawOptions=e,this.options=Object.assign({},e),this._setupOptions()}onSpecificOptionChange(m,e){return this.onOptionChange((s=>{s===m&&e(this.rawOptions[m])}))}onMultipleOptionChange(m,e){return this.onOptionChange((s=>{m.indexOf(s)!==-1&&e()}))}_setupOptions(){const m=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},e=(s,t)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);t=this._sanitizeAndValidateOption(s,t),this.rawOptions[s]!==t&&(this.rawOptions[s]=t,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const t={get:m.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,t)}}_sanitizeAndValidateOption(m,e){switch(m){case"cursorStyle":if(e||(e=r.DEFAULT_OPTIONS[m]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${m}`);break;case"wordSeparator":e||(e=r.DEFAULT_OPTIONS[m]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=f.includes(e)?e:r.DEFAULT_OPTIONS[m];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${m} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${m} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${m} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${m} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}r.OptionsService=g},2660:function(A,r,n){var h=this&&this.__decorate||function(g,v,m,e){var s,t=arguments.length,i=t<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,m):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(g,v,m,e);else for(var l=g.length-1;l>=0;l--)(s=g[l])&&(i=(t<3?s(i):t>3?s(v,m,i):s(v,m))||i);return t>3&&i&&Object.defineProperty(v,m,i),i},p=this&&this.__param||function(g,v){return function(m,e){v(m,e,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const o=n(2585);let f=r.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const v=this._bufferService.buffer;if(g.id===void 0){const l=v.addMarker(v.ybase+v.y),u={data:g,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._dataByLinkId.set(u.id,u),u.id}const m=g,e=this._getEntryIdKey(m),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;const t=v.addMarker(v.ybase+v.y),i={id:this._nextId++,key:this._getEntryIdKey(m),data:m,lines:[t]};return t.onDispose((()=>this._removeMarkerFromLink(i,t))),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(g,v){const m=this._dataByLinkId.get(g);if(m&&m.lines.every((e=>e.line!==v))){const e=this._bufferService.buffer.addMarker(v);m.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(m,e)))}}getLinkData(g){var v;return(v=this._dataByLinkId.get(g))===null||v===void 0?void 0:v.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,v){const m=g.lines.indexOf(v);m!==-1&&(g.lines.splice(m,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};r.OscLinkService=f=h([p(0,o.IBufferService)],f)},8343:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const n="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(p){return p[h]||[]},r.createDecorator=function(p){if(r.serviceRegistry.has(p))return r.serviceRegistry.get(p);const o=function(f,g,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(m,e,s){e[n]===e?e[h].push({id:m,index:s}):(e[h]=[{id:m,index:s}],e[n]=e)})(o,f,v)};return o.toString=()=>p,r.serviceRegistry.set(p,o),o}},2585:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const h=n(8343);var p;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(p||(r.LogLevelEnum=p={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(A,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const h=n(8460),p=n(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const o=new p.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let f=0;const g=o.length;for(let v=0;v=g)return f+this.wcwidth(m);const e=o.charCodeAt(v);56320<=e&&e<=57343?m=1024*(m-55296)+e-56320+65536:f+=this.wcwidth(e)}f+=this.wcwidth(m)}return f}}}},T={};function O(A){var r=T[A];if(r!==void 0)return r.exports;var n=T[A]={exports:{}};return k[A].call(n.exports,n,n.exports,O),n.exports}var H={};return(()=>{var A=H;Object.defineProperty(A,"__esModule",{value:!0}),A.Terminal=void 0;const r=O(9042),n=O(3236),h=O(844),p=O(5741),o=O(8285),f=O(7975),g=O(7090),v=["cols","rows"];class m extends h.Disposable{constructor(s){super(),this._core=this.register(new n.Terminal(s)),this._addonManager=this.register(new p.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=l=>this._core.options[l],i=(l,u)=>{this._checkReadonlyOptions(l),this._core.options[l]=u};for(const l in this._core.options){const u={get:t.bind(this,l),set:i.bind(this,l)};Object.defineProperty(this._publicOptions,l,u)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const s=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const t in s)this._publicOptions[t]=s[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(s,t){this._verifyIntegers(s,t),this._core.resize(s,t)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){var t,i,l;return this._checkProposedApi(),this._verifyPositiveIntegers((t=s.x)!==null&&t!==void 0?t:0,(i=s.width)!==null&&i!==void 0?i:0,(l=s.height)!==null&&l!==void 0?l:0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,t,i){this._verifyIntegers(s,t,i),this._core.select(s,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,t){this._verifyIntegers(s,t),this._core.selectLines(s,t)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,t){this._core.write(s,t)}writeln(s,t){this._core.write(s),this._core.write(`\r -`,t)}paste(s){this._core.paste(s)}refresh(s,t){this._verifyIntegers(s,t),this._core.refresh(s,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return r}_verifyIntegers(...s){for(const t of s)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const t of s)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}A.Terminal=m})(),H})()))})(Tt)),Tt.exports}var In=Nn();const ds="__SSHMANAGER__:",jn=/^ssh\s+(\S+)@(\S+)\s*$/i,Bn=/^ssh\s+-p\s+(\d+)\s+(\S+)@(\S+)\s*$/i,On=/^ssh\s+(\S+)\s*$/i;function Pn({connection:c,visible:_,fontSize:k,fontFamily:T,onStatusChange:O,onQuickConnect:H,credentialToken:A}){const r=W.useRef(null),n=W.useRef(null),h=W.useRef(null),p=W.useRef(null),o=W.useRef(null),f=W.useRef(null),g=W.useRef(null),v=W.useRef(_),m=W.useRef(()=>{}),[e,s]=W.useState("connecting"),[t,i]=W.useState(!1),l=W.useRef(null),u=W.useRef(""),b=W.useRef(""),x=W.useRef(H);x.current=H;const d=W.useRef(A);d.current=A,v.current=_,m.current=()=>{if(!v.current)return;const N=n.current;if(!N)return;h.current?.fit();const y=o.current;!y||y.readyState!==WebSocket.OPEN||y.send(ds+JSON.stringify({type:"resize",cols:N.cols,rows:N.rows}))},W.useEffect(()=>{O?.(e)},[O,e]),W.useEffect(()=>{const N=n.current;if(!N)return;N.options.fontSize=k,N.options.fontFamily=T,h.current?.fit();const y=o.current;!y||y.readyState!==WebSocket.OPEN||y.send(ds+JSON.stringify({type:"resize",cols:N.cols,rows:N.rows}))},[k,T]);const S=W.useCallback(N=>{const y=p.current,E=u.current;!y||!E||(N==="next"?y.findNext(E,{caseSensitive:!1}):y.findPrevious(E,{caseSensitive:!1}))},[]),R=W.useCallback(N=>{if(u.current=N,!N){p.current?.clearActiveDecoration();return}p.current?.findNext(N,{caseSensitive:!1,highlightAll:!0})},[]);return W.useEffect(()=>{let N=!1;const y=new In.Terminal({cursorBlink:!0,fontSize:k,fontFamily:T,theme:{background:"#050816",foreground:"#dbeafe",cursor:"#67e8f9",selectionBackground:"rgba(103, 232, 249, 0.24)"}}),E=new Qi.FitAddon,D=new Mn;y.loadAddon(E),y.loadAddon(D),n.current=y,h.current=E,p.current=D,y.open(r.current),_&&(m.current(),y.focus());const B=y.onData(L=>{const M=b.current;if(L==="\r"||L===` -`){const I=M.trim();let z;if(z=I.match(Bn)){const K=parseInt(z[1]),Y=z[2],X=z[3];b.current="",x.current?.(X,Y,K);return}else if(z=I.match(jn)){const K=z[1],Y=z[2];b.current="",x.current?.(Y,K,22);return}else if(z=I.match(On)){const K=z[1];b.current="",x.current?.(K,"root",22);return}b.current=""}else L===""?b.current=M.slice(0,-1):L.length===1&&L>=" "&&(b.current=M+L);o.current?.readyState===WebSocket.OPEN&&o.current.send(L)}),j=y.onResize(()=>{m.current()});f.current=new ResizeObserver(()=>{m.current()}),f.current.observe(r.current);const P=y.onKey(L=>{L.domEvent.ctrlKey&&L.domEvent.key==="f"&&(L.domEvent.preventDefault(),i(!0),setTimeout(()=>l.current?.focus(),50)),L.domEvent.key==="Escape"&&t&&(i(!1),D.clearActiveDecoration(),y.focus())}),C=()=>{const L=localStorage.getItem("token");if(!L){s("error");return}s("connecting");const M=window.location.protocol==="https:"?"wss:":"ws:",I=d.current;let z=`${M}//${window.location.host}/ws/terminal?connectionId=${c.id}&token=${encodeURIComponent(L)}`;I&&(z+=`&credentialToken=${encodeURIComponent(I)}`);const K=new WebSocket(z);o.current=K,K.onopen=()=>{s("connected"),m.current()},K.onmessage=Y=>{y.write(typeof Y.data=="string"?Y.data:"")},K.onclose=()=>{N||(s("reconnecting"),g.current=window.setTimeout(C,2e3))},K.onerror=()=>{s("error")}};return C(),()=>{N=!0,g.current&&window.clearTimeout(g.current),f.current?.disconnect(),o.current?.close(),B.dispose(),j.dispose(),P.dispose(),y.dispose()}},[c.id]),W.useEffect(()=>{if(!_)return;const N=window.requestAnimationFrame(()=>{m.current(),n.current?.focus()});return()=>window.cancelAnimationFrame(N)},[_]),a.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-black",children:[t?a.jsxs("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 rounded-lg border border-border-main bg-surface-card px-2.5 py-1.5 shadow-xl animate-in",children:[a.jsx("input",{ref:l,type:"text",placeholder:"搜索...",className:"w-40 bg-transparent px-1.5 py-0.5 text-xs text-content-main outline-none placeholder:text-content-dim",onChange:N=>R(N.target.value),onKeyDown:N=>{N.key==="Enter"&&S("next"),N.key==="Escape"&&(i(!1),p.current?.clearActiveDecoration(),n.current?.focus())}}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("button",{className:"rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>S("prev"),title:"上一个",children:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m18 15-6-6-6 6"})})}),a.jsx("button",{className:"rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>S("next"),title:"下一个",children:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m6 9 6 6 6-6"})})}),a.jsx("button",{className:"ml-1 rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>{i(!1),p.current?.clearActiveDecoration(),n.current?.focus()},title:"关闭",children:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})]}):null,a.jsx("div",{ref:r,className:"h-full w-full overflow-hidden"})]})}function Hn({open:c,connection:_,onSelect:k,onClose:T}){const[O,H]=W.useState([]);return c?a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:A=>{A.target===A.currentTarget&&T()},children:a.jsxs("div",{className:"flex h-[80vh] w-[80vw] max-w-5xl flex-col overflow-hidden rounded-2xl border border-border-main bg-surface-app shadow-2xl shadow-black/60",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border-main bg-surface-panel px-5 py-3.5",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-content-main",children:"浏览远程文件"}),a.jsxs("p",{className:"mt-0.5 text-xs text-content-muted",children:["来源:",a.jsx("span",{className:"text-purple-400",children:_.name}),'· 单击选中,双击进入目录,点击底部"确认选择"完成']})]}),a.jsx("button",{className:"rounded-xl p-2 text-content-dim transition hover:bg-surface-muted hover:text-content-main",onClick:T,"aria-label":"关闭",children:a.jsx(At,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a.jsx(Ms,{connection:_,selectedFiles:O,onSelectedFilesChange:H,selectionMode:!0,onConfirmSelection:A=>{k(A),T()}})})]})}):null}function us(c){const _=c.length||1,k=Math.round(c.reduce((r,n)=>r+n.progress,0)/_),T=c.every(r=>["success","error","cancelled"].includes(r.status)),O=c.some(r=>r.status==="error"),A=c.some(r=>r.status==="running"||r.status==="queued")?"running":O?"error":T?"success":"queued";return{progress:k,status:A}}function fs({status:c}){return c==="online"?a.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-emerald-500",title:"在线"}):c==="offline"?a.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-red-500",title:"离线"}):c==="checking"?a.jsx("span",{className:"h-2 w-2 shrink-0 animate-pulse rounded-full bg-yellow-400",title:"检测中"}):a.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-content-dim",title:"未知"})}function Fn({open:c,connections:_,connectionStatuses:k,tasks:T,onClose:O,onTasksChange:H}){const[A,r]=W.useState("local"),[n,h]=W.useState(_.length?[_[0].id]:[]),[p,o]=W.useState(null),[f,g]=W.useState("/usr/local/nginx/html"),[v,m]=W.useState(_[0]?.id??0),[e,s]=W.useState("/opt/app/build.tar.gz"),[t,i]=W.useState("/data/deploy/"),[l,u]=W.useState(!1);W.useEffect(()=>{_.length!==0&&m(D=>{if(D>0&&_.some(B=>B.id===D)){const B=k[D];return B==="online"||!B?D:_.find(P=>k[P.id]==="online")?.id??D}return _.find(B=>k[B.id]==="online")?.id??_[0]?.id??0})},[_,k]);const b=W.useMemo(()=>_.find(D=>D.id===v)??null,[_,v]),x=v>0&&b!==null,d=x&&k[v]==="online",S=A==="remote"?n.filter(D=>D!==v):n,R=!x||!d||S.length===0||!e.trim();if(!c)return null;function N(D,B){H(j=>j.map(P=>P.id===D?B(P):P))}async function y(){if(!p?.length||n.length===0)return;const D=p[0],B=String(Date.now()),j={id:B,mode:"LOCAL_TO_MANY",title:`本地文件批量分发 · ${D.name}`,status:"running",progress:0,createdAt:new Date().toLocaleTimeString(),items:n.map(P=>({id:`${B}-${P}`,label:_.find(C=>C.id===P)?.name||String(P),status:"queued",progress:0,message:"等待上传"}))};H(P=>[j,...P]),n.forEach(async P=>{const L=(await Ds(P,f,D,{overwrite:!0})).data.taskId;N(B,I=>({...I,items:I.items.map(z=>z.label===_.find(K=>K.id===P)?.name?{...z,status:"running",message:"正在传输...",taskId:L}:z)}));const M=Rs(L,I=>{N(B,z=>{const K=z.items.map(X=>X.taskId===I.taskId?{...X,progress:I.progress,status:I.status,message:I.error||(I.status==="success"?"上传完成":I.status==="error"?"上传失败":"正在传输...")}:X),Y=us(K);return{...z,items:K,progress:Y.progress,status:Y.status}}),["success","error"].includes(I.status)&&M()})})}async function E(){const D=S;if(!x||!d||D.length===0||!e.trim())return;const B=String(Date.now()),j=e.trim().split("/").filter(Boolean).pop()||e.trim(),P={id:B,mode:"REMOTE_TO_MANY",title:`跨主机分发 · ${j}`,status:"running",progress:0,createdAt:new Date().toLocaleTimeString(),items:D.map(C=>({id:`${B}-${C}`,label:_.find(L=>L.id===C)?.name||String(C),status:"queued",progress:0,message:"等待创建任务"}))};H(C=>[P,...C]),D.forEach(async C=>{const M=(await Ci(v,e,C,t)).data.taskId;N(B,z=>({...z,items:z.items.map(K=>K.label===_.find(Y=>Y.id===C)?.name?{...K,status:"running",message:"正在跨服同步...",taskId:M}:K)}));const I=yi(M,z=>{N(B,K=>{const Y=K.items.map(ne=>ne.taskId===z.taskId?{...ne,progress:z.progress,status:z.status,message:z.error||(z.status==="success"?"同步完成":z.status==="error"?"同步失败":z.status==="cancelled"?"已取消":"正在同步...")}:ne),X=us(Y);return{...K,items:Y,progress:X.progress,status:X.status}}),["success","error","cancelled"].includes(z.status)&&I()})})}return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{title:"文件传输中心",onClose:O,maxWidth:"max-w-7xl",children:a.jsxs("div",{className:"flex h-[74vh] flex-col overflow-hidden rounded-2xl border border-border-main bg-surface-app",children:[a.jsxs("div",{className:"flex gap-8 border-b border-border-main bg-surface-panel px-6 pt-4",children:[a.jsx("button",{className:`border-b-2 pb-3 text-sm font-medium ${A==="local"?"border-blue-500 text-blue-400":"border-transparent text-content-muted"}`,onClick:()=>r("local"),children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(ft,{size:16}),"本地分发到多台"]})}),a.jsx("button",{className:`border-b-2 pb-3 text-sm font-medium ${A==="remote"?"border-purple-500 text-purple-400":"border-transparent text-content-muted"}`,onClick:()=>{r("remote"),u(!1)},children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Ot,{size:16}),"远程分发到多台"]})})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsx("div",{className:"flex flex-1 overflow-hidden border-r border-border-main bg-surface-panel/70 p-6",children:A==="local"?a.jsxs("div",{className:"flex h-full flex-1 gap-6 overflow-hidden",children:[a.jsxs("div",{className:"flex w-1/2 shrink-0 flex-col gap-4 overflow-y-auto border-r border-border-main pr-6",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[a.jsx(ft,{size:16}),"源配置"]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"选择本地文件"}),a.jsxs("label",{className:"group flex cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-border-main bg-surface-muted/30 px-6 py-8 transition-all hover:border-blue-500 hover:bg-blue-500/5",children:[a.jsx("div",{className:"mb-3 rounded-full bg-surface-muted p-3 shadow-sm transition-colors group-hover:bg-blue-600",children:a.jsx(Mt,{size:24,className:"text-content-muted transition-colors group-hover:text-content-main"})}),a.jsx("span",{className:"text-sm font-medium text-content-main transition-colors group-hover:text-blue-400",children:p&&p.length>0?"重新选择文件":"点击选择本地文件"}),a.jsx("span",{className:"mt-1 max-w-full truncate text-xs text-content-dim",children:p&&p.length>0?a.jsx("span",{className:"text-emerald-400",children:p.length===1?p[0].name:`已选择 ${p.length} 个文件`}):"支持多选文件/文件夹"}),a.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:D=>o(D.target.files)})]})]}),a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"目标路径"}),a.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-sm text-content-main outline-none focus:border-blue-500",value:f,onChange:D=>g(D.target.value)})]}),a.jsxs("div",{className:"mt-auto rounded-xl border border-border-main bg-surface-muted/50 px-4 py-3 text-xs text-content-dim",children:[a.jsx("p",{className:"font-medium text-content-muted",children:"⚡ 并发执行"}),a.jsx("p",{className:"mt-1",children:"分发任务将按浏览器任务并行执行。"})]})]}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-hidden",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[a.jsx(Yt,{size:16}),"目标配置"]}),a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"目标服务器"}),a.jsx("button",{className:"text-xs text-blue-400",onClick:()=>h(_.filter(D=>k[D.id]==="online").map(D=>D.id)),children:"全选在线"})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-2xl border border-border-main bg-surface-muted p-2",children:_.map(D=>{const B=k[D.id],j=B==="online";return a.jsxs("label",{className:`flex items-center gap-2 rounded-xl px-3 py-2 ${j?"cursor-pointer hover:bg-surface-panel":"cursor-not-allowed opacity-40"}`,children:[a.jsx("input",{type:"checkbox",disabled:!j,checked:n.includes(D.id),onChange:()=>h(P=>P.includes(D.id)?P.filter(C=>C!==D.id):[...P,D.id])}),a.jsx(fs,{status:B}),a.jsx("span",{className:"text-sm text-content-muted",children:D.name})]},D.id)})})]}),a.jsxs("button",{className:`flex w-full items-center justify-center gap-2 rounded-xl py-3 font-medium transition ${!p?.length||n.length===0?"cursor-not-allowed bg-surface-muted text-content-dim":"bg-blue-600 text-white hover:bg-blue-500"}`,disabled:!p?.length||n.length===0,onClick:()=>{y()},children:[a.jsx(ht,{size:18}),p?.length?n.length===0?"请选择目标服务器":"开始分发":"请选择本地文件"]})]})]}):a.jsxs("div",{className:"flex h-full flex-1 gap-6 overflow-hidden",children:[a.jsxs("div",{className:"flex w-1/2 shrink-0 flex-col gap-4 overflow-y-auto border-r border-border-main pr-6",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-purple-400",children:[a.jsx(Jt,{size:16}),"源配置"]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"源服务器"}),(()=>{const D=k[v];return D==="online"?a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-emerald-500/15 px-2 py-0.5 text-xs font-medium text-emerald-400",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"}),"在线"]}):D==="offline"?a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-red-500/15 px-2 py-0.5 text-xs font-medium text-red-400",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-400"}),"离线"]}):D==="checking"?a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-400",children:[a.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-yellow-400"}),"检测中"]}):a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-surface-muted/60 px-2 py-0.5 text-xs font-medium text-content-dim",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-content-dim"}),"未知"]})})()]}),a.jsxs("select",{className:`w-full rounded-xl border bg-surface-muted px-4 py-3 text-sm text-content-main outline-none ${d?"border-emerald-700":x&&k[v]==="offline"?"border-red-800":"border-border-main"}`,value:v,onChange:D=>{m(Number(D.target.value)),u(!1)},children:[!x&&a.jsx("option",{value:0,disabled:!0,children:"请选择源服务器"}),_.map(D=>{const B=k[D.id],j=B==="online",P=B==="online"||B==="offline"?"● ":B==="checking"?"◔ ":"◦ ";return a.jsxs("option",{value:D.id,disabled:!j,children:[P,D.name,j?"":B==="offline"?" (离线)":" (未知)"]},D.id)})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"源文件 / 文件夹路径"}),a.jsxs("button",{className:`flex items-center gap-1 rounded-lg px-2 py-1 text-xs transition ${l?"bg-purple-600 text-white":"border border-border-main text-content-muted hover:border-purple-500 hover:text-purple-400"}`,onClick:()=>u(D=>!D),children:[a.jsx(Tr,{size:12}),l?"收起":"浏览..."]})]}),a.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-content-main outline-none focus:border-blue-500",value:e,onChange:D=>s(D.target.value),placeholder:"/opt/app"})]}),a.jsxs("div",{className:"mt-auto rounded-xl border border-border-main bg-surface-muted/50 px-4 py-3 text-xs text-content-dim",children:[a.jsx("p",{className:"font-medium text-content-muted",children:"📁 支持文件夹传输"}),a.jsx("p",{className:"mt-1",children:"选择文件夹时,将在目标路径下创建同名子目录并递归传输所有内容。"})]})]}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-hidden",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[a.jsx(Yt,{size:16}),"目标配置"]}),a.jsxs("label",{className:"space-y-2",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"目标目录"}),a.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-sm text-content-main outline-none focus:border-blue-500",value:t,onChange:D=>i(D.target.value)})]}),a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[a.jsx("span",{className:"text-sm text-content-muted",children:"目标服务器"}),a.jsx("button",{className:"text-xs text-blue-400",onClick:()=>h(A==="remote"?_.filter(D=>D.id!==v&&k[D.id]==="online").map(D=>D.id):_.filter(D=>k[D.id]==="online").map(D=>D.id)),children:"全选在线"})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-2xl border border-border-main bg-surface-muted p-2",children:(A==="remote"?_.filter(D=>D.id!==v):_).map(D=>{const B=k[D.id],j=B==="online";return a.jsxs("label",{className:`flex items-center gap-2 rounded-xl px-3 py-2 ${j?"cursor-pointer hover:bg-surface-panel":"cursor-not-allowed opacity-40"}`,children:[a.jsx("input",{type:"checkbox",disabled:!j,checked:n.includes(D.id),onChange:()=>h(P=>P.includes(D.id)?P.filter(C=>C!==D.id):[...P,D.id])}),a.jsx(fs,{status:B}),a.jsx("span",{className:"text-sm text-content-muted",children:D.name})]},D.id)})})]}),a.jsxs("button",{className:`flex w-full items-center justify-center gap-2 rounded-xl py-3 font-medium transition ${R?"cursor-not-allowed bg-surface-muted text-content-dim":"bg-purple-600 text-white hover:bg-purple-500"}`,disabled:R,onClick:()=>{E()},children:[a.jsx(Jt,{size:18,fill:"currentColor"}),!x||!v?"请选择源服务器":d?e.trim()?S.length===0?"请选择目标服务器":"跨服同步分发":"请填写源路径":"源服务器未在线"]})]})]})}),a.jsxs("div",{className:"flex w-[360px] shrink-0 flex-col bg-surface-app border-l border-border-main",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border-main bg-surface-panel px-4 py-4",children:[a.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-content-main",children:[a.jsx(Ss,{size:16,className:"text-content-muted"}),"任务状态"]}),a.jsx("button",{className:"text-xs text-content-dim hover:text-content-muted",onClick:()=>H([]),children:"清空记录"})]}),a.jsx("div",{className:"flex-1 space-y-4 overflow-auto p-3",children:T.length===0?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-content-dim",children:[a.jsx(Mt,{size:32,className:"mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"暂无传输任务"})]}):T.map(D=>a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel",children:[a.jsxs("div",{className:"border-b border-border-subtle bg-surface-panel/90 p-3",children:[a.jsxs("div",{className:"mb-2 flex items-start justify-between",children:[a.jsx("span",{className:"pr-2 text-sm font-medium text-content-main",children:D.title}),D.status==="running"?a.jsx("button",{className:"shrink-0 text-xs text-red-400 hover:text-red-300",onClick:()=>{D.items.forEach(B=>{B.taskId&&wi(B.taskId)})},children:"取消"}):null]}),a.jsx("div",{className:"text-xs text-content-dim",children:D.createdAt})]}),a.jsx("div",{className:"max-h-48 space-y-1 overflow-auto bg-surface-app/60 p-2",children:D.items.map(B=>a.jsxs("div",{className:"rounded-xl p-2 hover:bg-surface-muted",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"truncate text-content-muted",children:B.label}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-content-dim",children:B.message}),a.jsxs("span",{className:B.status==="success"?"text-emerald-400":"text-blue-400",children:[B.progress,"%"]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsx("div",{className:"h-1 flex-1 rounded-full bg-surface-muted",children:a.jsx("div",{className:`h-1 rounded-full ${B.status==="success"?"bg-emerald-500":B.status==="error"?"bg-red-500":"bg-blue-400"}`,style:{width:`${B.progress}%`}})}),B.status==="success"?a.jsx(bt,{size:12,className:"text-emerald-500"}):B.status==="running"?a.jsx(pt,{size:12,className:"animate-spin text-blue-400"}):null]})]},B.id))})]},D.id))})]})]})]})}),l&&a.jsx(Hn,{open:l,connection:_.find(D=>D.id===v)??_[0],onSelect:D=>{s(D),u(!1)},onClose:()=>u(!1)})]})}const Wn={idle:{label:"终端未打开",tone:"text-content-muted",dot:"bg-content-muted"},connecting:{label:"WebSocket 连接中",tone:"text-amber-300",dot:"bg-amber-400"},connected:{label:"WebSocket 已连接",tone:"text-emerald-300",dot:"bg-emerald-400"},reconnecting:{label:"连接中断,重试中",tone:"text-amber-300",dot:"bg-amber-400"},error:{label:"WebSocket 连接异常",tone:"text-red-300",dot:"bg-red-400"}},_s={visible:!1,x:0,y:0,targetId:null,targetType:null};function ms(c,_,k){const O=k*36+8,H=8;return{x:Math.max(H,Math.min(c,window.innerWidth-176-H)),y:Math.max(H,Math.min(_,window.innerHeight-O-H))}}function ps(c,_){return Object.fromEntries(Object.entries(c).filter(([k])=>!_.has(Number(k))))}function vs(c){return`${c}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const $n={tabs:[],currentTabKey:null,terminalStatuses:{}};function zn(c,_){switch(_.type){case"ACTIVATE_TAB":return c.currentTabKey===_.tabId?c:{...c,currentTabKey:_.tabId};case"OPEN_CONNECTION":{const k=c.tabs.find(T=>T.connection.id===_.connection.id);return k?{...c,currentTabKey:k.tabId,tabs:c.tabs.map(T=>T.tabId===k.tabId?{...T,name:_.connection.name,connection:_.connection}:T)}:{tabs:[...c.tabs,{tabId:_.tabId,name:_.connection.name,connection:_.connection}],currentTabKey:_.tabId,terminalStatuses:{...c.terminalStatuses,[_.tabId]:"connecting"}}}case"CLOSE_TAB":{const k=c.tabs.filter(O=>O.tabId!==_.tabId),T={...c.terminalStatuses};return delete T[_.tabId],{tabs:k,currentTabKey:c.currentTabKey===_.tabId?k[k.length-1]?.tabId??null:c.currentTabKey,terminalStatuses:T}}case"CLOSE_ALL":return{tabs:[],currentTabKey:null,terminalStatuses:{}};case"DUPLICATE_TAB":{const k=c.tabs.findIndex(A=>A.tabId===_.tabId);if(k===-1)return c;const T=c.tabs[k],O={tabId:_.newTabId,name:T.name,connection:T.connection},H=[...c.tabs];return H.splice(k+1,0,O),{tabs:H,currentTabKey:_.newTabId,terminalStatuses:{...c.terminalStatuses,[_.newTabId]:"connecting"}}}case"UPDATE_CONNECTION":return{...c,tabs:c.tabs.map(k=>k.connection.id===_.connectionId?{...k,name:_.name,connection:_.connection}:k)};case"REMOVE_CONNECTIONS":{const k=c.tabs.filter(H=>!_.connectionIds.has(H.connection.id)),T=new Set(c.tabs.filter(H=>_.connectionIds.has(H.connection.id)).map(H=>H.tabId)),O={...c.terminalStatuses};for(const H of T)delete O[H];return{tabs:k,currentTabKey:c.currentTabKey!=null&&T.has(c.currentTabKey)?k[k.length-1]?.tabId??null:c.currentTabKey,terminalStatuses:O}}case"SET_TERMINAL_STATUS":return c.terminalStatuses[_.tabId]===_.status?c:{...c,terminalStatuses:{...c.terminalStatuses,[_.tabId]:_.status}};default:return c}}function Vn({initialTool:c,onLogout:_}){const{user:k,logout:T}=gs(),O=er(),[H,A]=W.useState([]),[r,n]=W.useState("split"),[h,p]=W.useState(null),[o,f]=W.useState(""),[g,v]=W.useReducer(zn,$n),{tabs:m,currentTabKey:e,terminalStatuses:s}=g,[t,i]=W.useState(null),[l,u]=W.useState([]),[b,x]=W.useState(!1),[d,S]=W.useState(!1),[R,N]=W.useState(null),[y,E]=W.useState(null),[D,B]=W.useState(!1),[j,P]=W.useState(c==="transfers"),[C,L]=W.useState(!1),[M,I]=W.useState({}),[z,K]=W.useState(!!k?.passwordChangeRequired),[Y,X]=W.useState([]),[ne,w]=W.useState({}),[F,U]=W.useState({}),[q,ee]=W.useState({}),[J,oe]=W.useState(null),[ue,he]=W.useState(!1),[xe,ie]=W.useState(_s),[ye,$e]=W.useState({visible:!1,x:0,y:0,targetTabId:null}),[me,Se]=wt("ssh-manager.terminal-font-size",14),[we,Ce]=wt("ssh-manager.terminal-font-family",'"IBM Plex Mono", ui-monospace, SFMono-Regular, monospace'),[Ae,pe]=wt("ssh-manager.dark-mode",!0),[Me,Ne]=W.useState(null),[ke,ze]=W.useState("");W.useEffect(()=>{document.documentElement.classList.toggle("dark",Ae)},[Ae]),W.useEffect(()=>{K(!!k?.passwordChangeRequired)},[k?.passwordChangeRequired]),W.useEffect(()=>{const V=new Set(H.map(Q=>Q.id));U(Q=>Object.fromEntries(Object.entries(Q).filter(([Z])=>V.has(Number(Z))))),ee(Q=>Object.fromEntries(Object.entries(Q).filter(([Z])=>V.has(Number(Z)))))},[H]),W.useEffect(()=>{let V=!1;return(async()=>{const Q=await Kt();if(V)return;const Z=Q.data;A(Z);try{const te=await Ti();if(V)return;const re=te.data.nodes.length?te.data:dt(Z),fe=Qt(re,Z);p(fe),JSON.stringify(te.data)!==JSON.stringify(fe)&&await ss(fe)}catch{if(V)return;p(dt(Z))}})(),()=>{V=!0}},[]);const Le=W.useMemo(()=>Ls(h,H),[h,H]),Be=W.useMemo(()=>ui(h,H),[h,H]),le=W.useMemo(()=>[...new Set(m.map(V=>V.connection.id))],[m]),Ie=m.find(V=>V.tabId===e)?.connection??null,it=Ie?s[e??""]??"connecting":"idle",Ve=h?.nodes.some(V=>V.type==="folder")??!1,et=h?.nodes.some(V=>V.type==="folder"&&V.expanded===!1)??!1,St=W.useMemo(()=>y?_i(h,y.id):Zt(h,t),[y,t,h]);W.useEffect(()=>{if(!Ie){w({});return}let V=!1;const Q=async()=>{try{const te=await nr(Ie.id);V||w(te.data)}catch{V||w({})}};Q();const Z=window.setInterval(Q,5e3);return()=>{V=!0,window.clearInterval(Z)}},[Ie?.id]),W.useEffect(()=>{H.length===0||H.some(Q=>{const Z=F[Q.id];return Z==="online"||Z==="offline"||Z==="checking"})||G({connectionList:H})},[H]);function $(V=H){return Qt(h??dt(V),V)}async function G(V){const Q=V?.connectionList??H;if(Q.length===0){U({}),ee({}),oe(null);return}he(!0),oe(null);const Z=Q.map(te=>te.id);U(te=>({...te,...Object.fromEntries(Z.map(re=>[re,"checking"]))}));try{const te=await sr(Z),re=Object.fromEntries(te.data.results.map(be=>[be.connectionId,be])),fe=Object.fromEntries(te.data.results.map(be=>[be.connectionId,be.status]));ee(be=>({...be,...re})),U(be=>({...be,...fe}))}catch(te){if(oe(te.response?.data?.message||"主机状态检测失败"),U(re=>({...re,...Object.fromEntries(Z.map(fe=>[fe,re[fe]==="online"||re[fe]==="offline"?re[fe]:"unknown"]))})),V?.throwOnError)throw te}finally{he(!1)}}async function se(){await G({throwOnError:!0})}async function ce(V){p(V),await ss(V)}function De(V){return h?.nodes.find(Q=>Q.id===V)??null}function ge(){ie(_s)}function Ue(V,Q){W.startTransition(()=>{v({type:"OPEN_CONNECTION",connection:V,tabId:vs(V.id)}),u([]),Q&&i(Q)})}async function ve(V){const Q=hi(h,V);Q&&await ce(Q)}async function Oe(){const V=$();if(!V.nodes.some(re=>re.type==="folder"))return;const Z=V.nodes.some(re=>re.type==="folder"&&re.expanded===!1),te=di(V,Z);te&&await ce(te)}async function je(V){const Q=$(),{layout:Z,nodeId:te}=mi(Q,V.name,V.parentId);i(te),await ce(Z)}async function Ct(V){if(!R)return;const Q=vi($(),R,V);Q&&await ce(Q)}function Us(V){const Q=ms(V.x,V.y,V.nodeType==="folder"?4:2);i(V.nodeId),tt(),ie({visible:!0,x:Q.x,y:Q.y,targetId:V.nodeId,targetType:V.nodeType})}function qs(V,Q,Z){const te=new Map(V.nodes.map(fe=>[fe.id,fe]));let re=te.get(Z)??null;for(;re?.parentId;){if(re.parentId===Q)return!0;re=te.get(re.parentId)??null}return!1}function zt(V,Q,Z){const te=new Set(Z);i(re=>re&&(te.has(re)||qs(V,re,Q)?null:re))}function Ut(V){if(V.length===0)return;const Q=new Set(V);A(Z=>Z.filter(te=>!Q.has(te.id))),v({type:"REMOVE_CONNECTIONS",connectionIds:Q}),u([]),U(Z=>ps(Z,Q)),ee(Z=>ps(Z,Q))}async function Ks(){const{targetId:V,targetType:Q}=xe;if(ge(),!V||!Q)return;if(Q==="folder"){const re=De(V);if(!re||re.type!=="folder")return;N(V);return}const Z=De(V);if(Z?.type!=="connection"||!Z.connectionId)return;const te=H.find(re=>re.id===Z.connectionId)??null;te&&(E(te),x(!0))}async function Vs(){const{targetId:V,targetType:Q}=xe;if(ge(),!V||!Q)return;const Z=$(),te=Z.nodes.find(be=>be.id===V);if(!te)return;const re=gi(Z,V);if(!re)return;if(Q==="connection"){if(te.type!=="connection"||!te.connectionId||!window.confirm("确认永久删除该 SSH 连接?"))return;await Vt(te.connectionId),await ce(re.layout),Ut([te.connectionId]),zt(Z,V,re.deletedNodeIds);return}window.confirm("确认删除该文件夹?将同时删除其下所有子文件夹与连接。")&&te.type==="folder"&&(re.deletedConnectionIds.length>0&&await Promise.all(re.deletedConnectionIds.map(be=>Vt(be))),await ce(re.layout),Ut(re.deletedConnectionIds),zt(Z,V,re.deletedNodeIds))}async function Gs(V){const Q=y,{targetFolderId:Z,...te}=V,fe=(Q?await or(Q.id,te):await ar(te)).data,Ge=(await Kt()).data,Re=Ge.find(Ye=>Ye.id===fe.id)??fe;A(Ge);const nt=pi($(Ge),Re,Z),ot=fi(nt,Re.id);if(await ce(nt),x(!1),E(null),Q){i(ot),v({type:"UPDATE_CONNECTION",connectionId:Re.id,name:Re.name,connection:Re}),ee(Ye=>Ye[Re.id]?{...Ye,[Re.id]:{...Ye[Re.id],connectionName:Re.name}}:Ye);return}Ue(Re,ot)}function Xs(V){v({type:"CLOSE_TAB",tabId:V})}function tt(){$e({visible:!1,x:0,y:0,targetTabId:null})}function Ys(){v({type:"CLOSE_ALL"}),u([]),tt()}function Js(V){const Q=m.find(Z=>Z.tabId===V);Q&&(v({type:"DUPLICATE_TAB",tabId:V,newTabId:vs(Q.connection.id)}),u([]),tt())}function Qs(V){const Q=m.find(Z=>Z.tabId===V);Q&&(Ne(V),ze(Q.name),tt())}function qt(){if(!Me||!ke.trim()){Ne(null);return}const V=m.find(Q=>Q.tabId===Me);if(!V){Ne(null);return}v({type:"UPDATE_CONNECTION",connectionId:V.connection.id,name:ke.trim(),connection:V.connection}),Ne(null)}async function Zs(V){try{const Q=await lr(V);A(Z=>Z.map(te=>te.id===V?{...te,pinned:Q.data.pinned}:te))}catch{}}const yt=Wn[it];return a.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface-app text-content-main",children:[a.jsxs("header",{className:"flex h-14 items-center justify-between border-b border-border-main bg-surface-panel px-4 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("div",{className:"flex items-center gap-2 text-lg font-semibold tracking-wide text-blue-400",children:[a.jsx(lt,{size:22}),a.jsxs("span",{children:["SSH",a.jsx("span",{className:"text-content-main",children:"Manager"})]})]}),a.jsx("div",{className:"h-6 w-px bg-border-main"}),a.jsxs("nav",{className:"flex items-center gap-1",children:[a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>O("/dashboard"),children:[a.jsx(ft,{size:16,className:"text-cyan-400"}),"仪表盘"]}),a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>B(!0),children:[a.jsx(xs,{size:16,className:"text-purple-400"}),"批量执行"]}),a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>P(!0),children:[a.jsx(Mt,{size:16,className:"text-blue-400"}),"传输中心"]}),a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:async()=>{try{const V=await Ri(),Q=new Blob([V.data],{type:"text/plain"}),Z=URL.createObjectURL(Q),te=document.createElement("a");te.href=Z,te.download="ssh-config.txt",document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(Z)}catch{}},title:"导出 SSH 配置",children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-amber-400",children:[a.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),a.jsx("polyline",{points:"7 10 12 15 17 10"}),a.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"导出配置"]}),k?.role==="ROLE_ADMIN"&&a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>O("/users"),children:[a.jsx(oi,{size:16,className:"text-emerald-400"}),"用户管理"]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{className:"rounded-full p-2 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>L(!0),children:a.jsx(Yr,{size:18})}),a.jsx("div",{className:"rounded-full border border-border-main bg-surface-app px-3 py-1.5 text-sm text-content-muted",children:k?.displayName||k?.username}),a.jsxs("button",{className:"flex items-center gap-2 rounded-md px-2 py-1 text-sm text-content-muted transition hover:text-red-400",onClick:()=>{T(),_()},children:[a.jsx(Wr,{size:16}),"退出"]})]})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsxs("aside",{className:"flex w-72 shrink-0 flex-col border-r border-border-main bg-surface-panel",children:[a.jsxs("div",{className:"flex flex-col gap-3 border-b border-border-main px-4 py-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("div",{className:"text-sm font-medium text-content-muted",children:"会话管理"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:de("rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",Ve?"":"cursor-not-allowed text-content-dim hover:bg-transparent hover:text-content-dim"),disabled:!Ve,onClick:()=>{Oe()},title:Ve?et?"全部展开":"全部折叠":"暂无文件夹","aria-label":Ve?et?"全部展开":"全部折叠":"暂无文件夹",children:a.jsx(Ss,{size:14})}),a.jsx("button",{type:"button",className:"rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ge(),S(!0)},title:"新建文件夹","aria-label":"新建文件夹",children:a.jsx(Qe,{size:14})}),a.jsx("button",{type:"button",className:"rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ge(),E(null),x(!0)},title:"新建连接","aria-label":"新建连接",children:a.jsx(mt,{size:14})})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ys,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-content-dim"}),a.jsx("input",{className:"w-full rounded-md border border-border-main bg-surface-control py-1.5 pl-8 pr-3 text-xs text-content-main outline-none transition-colors placeholder:text-content-dim focus:border-border-subtle focus:bg-surface-panel",placeholder:"搜索主机...",value:o,onChange:V=>f(V.target.value)})]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-2",onClick:V=>{V.target===V.currentTarget&&(ge(),i(null))},children:a.jsx(Wi,{nodes:Le,activeConnectionId:Ie?.id??null,connectionStatuses:F,openConnectionIds:le,selectedNodeId:t,search:o,onSelectNode:i,onToggleFolder:V=>{ve(V)},onOpenConnection:Ue,onContextMenu:Us,onTogglePin:Zs})})]}),a.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-surface-app",children:[a.jsxs("div",{className:"flex h-10 border-b border-border-main bg-surface-panel",children:[m.length===0?a.jsx("div",{className:"h-full flex-1"}):null,m.map(V=>{const Q=Me===V.tabId;return a.jsxs("button",{className:de("group flex h-full min-w-[160px] max-w-[220px] items-center gap-2 border-r border-border-main px-4 text-sm transition",e===V.tabId?"bg-surface-app text-content-main":"text-content-muted hover:bg-surface-muted hover:text-content-main"),onClick:()=>{Q||v({type:"ACTIVATE_TAB",tabId:V.tabId})},onContextMenu:Z=>{if(Z.preventDefault(),Q)return;ge();const te=ms(Z.clientX,Z.clientY,3);$e({visible:!0,x:te.x,y:te.y,targetTabId:V.tabId})},children:[a.jsx(lt,{size:14,className:e===V.tabId?"text-emerald-400":"text-content-dim"}),Q?a.jsx("input",{className:"flex-1 min-w-0 bg-transparent border-b border-cyan-400 text-sm text-content-main outline-none",value:ke,onChange:Z=>ze(Z.target.value),onBlur:qt,onKeyDown:Z=>{Z.key==="Enter"&&qt(),Z.key==="Escape"&&Ne(null)},onClick:Z=>Z.stopPropagation(),autoFocus:!0}):a.jsx("span",{className:"flex-1 truncate",children:V.name}),a.jsx("span",{className:"opacity-0 transition group-hover:opacity-100",onClick:Z=>{Z.stopPropagation(),Xs(V.tabId)},children:"×"})]},V.tabId)})]}),a.jsxs("div",{className:"flex h-11 items-center justify-between border-b border-border-main bg-surface-panel px-4",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-4 overflow-hidden text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[a.jsx(rr,{size:14,className:"text-emerald-400"}),"CPU: ",ne.cpuUsage??"-","%"]}),a.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[a.jsx(jr,{size:14,className:"text-blue-400"}),"MEM: ",st(ne.memUsed??null)," / ",st(ne.memTotal??null)]}),a.jsxs("div",{className:de("flex items-center gap-2 truncate",yt.tone),children:[a.jsx("span",{className:de("h-2 w-2 rounded-full",yt.dot)}),yt.label]})]}),a.jsxs("div",{className:"ml-3 flex items-center rounded-lg border border-border-subtle bg-surface-panel p-1",children:[a.jsx("button",{className:de("rounded-md p-2 transition",r==="terminal"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>n("terminal"),title:"终端",children:a.jsx(lt,{size:15})}),a.jsx("button",{className:de("rounded-md p-2 transition",r==="sftp"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>n("sftp"),title:"SFTP",children:a.jsx(Qe,{size:15})}),a.jsx("button",{className:de("rounded-md p-2 transition",r==="split"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>n(r==="split"?"terminal":"split"),title:r==="split"?"切换到终端":"分屏",children:a.jsx(Qr,{size:15})})]})]}),a.jsx("div",{className:"relative flex-1 overflow-hidden",children:Ie?a.jsxs("div",{className:`flex h-full min-w-0 ${r==="split"?"flex-row":"flex-col"}`,children:[a.jsx("div",{className:de("relative min-w-0 flex-1 overflow-hidden",r==="split"&&"w-1/2 border-r border-border-main",r==="terminal"&&"w-full",r==="sftp"&&"hidden"),children:m.map(V=>{const Q=V.tabId===e&&r!=="sftp";return a.jsx("div",{className:de("absolute inset-0",!Q&&"hidden"),children:a.jsx(Pn,{connection:V.connection,visible:Q,fontSize:me,fontFamily:we,credentialToken:M[V.connection.id],onStatusChange:Z=>{v({type:"SET_TERMINAL_STATUS",tabId:V.tabId,status:Z})},onQuickConnect:async(Z,te,re)=>{try{const fe=window.prompt(`输入 ${te}@${Z} 的密码:`);if(!fe)return;const be=await ir(Z,te,re,fe),{connection:Ge,credentialToken:Re}=be.data,nt=`${Ge.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;I(ot=>({...ot,[Ge.id]:Re})),v({type:"OPEN_CONNECTION",connection:Ge,tabId:nt})}catch(fe){console.error("Quick connect failed",fe)}}})},V.tabId)})}),(r==="split"||r==="sftp")&&a.jsx("div",{className:`${r==="split"?"min-w-0 w-1/2":"w-full"} overflow-hidden`,children:a.jsx(Ms,{connection:Ie,selectedFiles:l,onSelectedFilesChange:u})})]}):a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-content-dim",children:[a.jsx(ft,{size:64,className:"mb-4 text-surface-muted"}),a.jsx("h2",{className:"mb-2 text-xl font-medium text-content-muted",children:"欢迎使用 SSH Manager"}),a.jsx("p",{className:"text-sm",children:"请在左侧双击服务器节点建立连接,或先创建新的会话。"}),a.jsxs("button",{className:"mt-6 flex items-center gap-2 rounded-xl border border-blue-600/30 bg-blue-600/10 px-6 py-2 text-blue-300 transition hover:bg-blue-600/20",onClick:()=>{E(null),x(!0)},children:[a.jsx(mt,{size:16}),"创建新连接"]})]})})]})]}),a.jsx(Oi,{open:b,connection:y,folderOptions:Be,initialTargetFolderId:St,onClose:()=>{x(!1),E(null)},onSubmit:Gs}),a.jsx(Pi,{open:d,folderOptions:Be,initialParentId:Zt(h,t),onClose:()=>S(!1),onSubmit:je}),a.jsx(Hi,{open:!!R,initialName:R&&De(R)?.name||"",onClose:()=>N(null),onSubmit:Ct}),a.jsx(ji,{open:D,connections:H,connectionStatuses:F,connectionStatusDetails:q,statusError:J,statusLoading:ue,onRefreshStatuses:se,onClose:()=>B(!1)}),a.jsx(Fn,{open:j,connections:H,connectionStatuses:F,tasks:Y,onTasksChange:X,onClose:()=>P(!1)}),a.jsx(Gi,{open:C,onClose:()=>L(!1),terminalFontSize:me,terminalFontFamily:we,onFontSizeChange:Se,onFontFamilyChange:Ce,darkMode:Ae,onDarkModeChange:pe}),z?a.jsx(Bi,{force:!!k?.passwordChangeRequired,onClose:()=>K(!1)}):null,xe.visible?a.jsx("div",{className:"fixed inset-0 z-50",onClick:ge,children:a.jsxs("div",{className:"absolute min-w-44 rounded-xl border border-border-subtle bg-surface-panel p-1 shadow-2xl shadow-black/40",onClick:V=>V.stopPropagation(),style:{left:xe.x,top:xe.y},children:[xe.targetType==="folder"?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ge(),E(null),x(!0)},children:"新建连接"}),a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ge(),S(!0)},children:"新建文件夹"})]}):null,a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{Ks()},children:"编辑"}),a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-red-300 transition hover:bg-red-500/10 hover:text-red-200",onClick:()=>{Vs()},children:"删除"})]})}):null,ye.visible?a.jsx("div",{className:"fixed inset-0 z-50",onClick:tt,children:a.jsxs("div",{className:"absolute min-w-40 rounded-xl border border-border-subtle bg-surface-panel p-1 shadow-2xl shadow-black/40",onClick:V=>V.stopPropagation(),style:{left:ye.x,top:ye.y},children:[a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ye.targetTabId&&Qs(ye.targetTabId)},children:"重命名"}),a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ye.targetTabId&&Js(ye.targetTabId)},children:"复制标签"}),a.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:Ys,children:"关闭所有标签"})]})}):null]})}export{Vn as default}; +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.isLinux&&d&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(d){const S=this._getMouseBufferCoords(d),T=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!!(T&&N&&S)&&this._areCoordsInSelection(S,T,N)}isCellInSelection(d,S){const T=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!(!T||!N)&&this._areCoordsInSelection([d,S],T,N)}_areCoordsInSelection(d,S,T){return d[1]>S[1]&&d[1]=S[0]&&d[0]=S[0]}_selectWordAtCursor(d,S){var T,N;const y=(N=(T=this._linkifier.currentLink)===null||T===void 0?void 0:T.link)===null||N===void 0?void 0:N.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(d);return!!E&&(this._selectWordAt(E,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,S){this._model.clearSelection(),d=Math.max(d,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){const S=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(d){let S=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=T?0:(S>T&&(S-=T),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){const S=this._getMouseBufferCoords(d);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){const S=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const N=(0,f.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(N,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const d=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,T=!(!d||!S||d[0]===S[0]&&d[1]===S[1]);T?d&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,S,T)):this._oldHasSelection&&this._fireOnSelectionChange(d,S,T)}_fireOnSelectionChange(d,S,T){this._oldSelectionStart=d,this._oldSelectionEnd=S,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim((S=>this._handleTrim(S)))}_convertViewportColToCharacterIndex(d,S){let T=S;for(let N=0;S>=N;N++){const y=d.loadCell(N,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:y>1&&S!==N&&(T+=y-1)}return T}setSelection(d,S,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,S],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,S,T=!0,N=!0){if(d[0]>=this._bufferService.cols)return;const y=this._bufferService.buffer,E=y.lines.get(d[1]);if(!E)return;const D=y.translateBufferLineToString(d[1],!1);let B=this._convertViewportColToCharacterIndex(E,d[0]),I=B;const P=d[0]-B;let C=0,L=0,M=0,j=0;if(D.charAt(B)===" "){for(;B>0&&D.charAt(B-1)===" ";)B--;for(;I1&&(j+=ae-1,I+=ae-1);Y>0&&B>0&&!this._isCharWordSeparator(E.loadCell(Y-1,this._workCell));){E.loadCell(Y-1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===0?(C++,Y--):k>1&&(M+=k-1,B-=k-1),B--,Y--}for(;X1&&(j+=k-1,I+=k-1),I++,X++}}I++;let $=B+P-C+M,V=Math.min(this._bufferService.cols,I-B+C+L-M-j);if(S||D.slice(B,I).trim()!==""){if(T&&$===0&&E.getCodePoint(0)!==32){const Y=y.lines.get(d[1]-1);if(Y&&E.isWrapped&&Y.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(X){const ae=this._bufferService.cols-X.start;$-=ae,V+=ae}}}if(N&&$+V===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){const Y=y.lines.get(d[1]+1);if(Y?.isWrapped&&Y.getCodePoint(0)!==32){const X=this._getWordAt([0,d[1]+1],!1,!1,!0);X&&(V+=X.length)}}return{start:$,length:V}}}_selectWordAt(d,S){const T=this._getWordAt(d,S);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[T.start,d[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(d){const S=this._getWordAt(d,!0);if(S){let T=d[1];for(;S.start<0;)S.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,T]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){const S=this._bufferService.buffer.getWrappedRangeForLine(d),T={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(T,this._bufferService.cols)}};r.SelectionService=b=h([p(3,l.IBufferService),p(4,l.ICoreService),p(5,v.IMouseService),p(6,l.IOptionsService),p(7,v.IRenderService),p(8,v.ICoreBrowserService)],b)},4725:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const h=o(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService")},6731:function(A,r,o){var h=this&&this.__decorate||function(b,d,S,T){var N,y=arguments.length,E=y<3?d:T===null?T=Object.getOwnPropertyDescriptor(d,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,d,S,T);else for(var D=b.length-1;D>=0;D--)(N=b[D])&&(E=(y<3?N(E):y>3?N(d,S,E):N(d,S))||E);return y>3&&E&&Object.defineProperty(d,S,E),E},p=this&&this.__param||function(b,d){return function(S,T){d(S,T,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const a=o(7239),f=o(8055),g=o(8460),v=o(844),m=o(2585),e=f.css.toColor("#ffffff"),s=f.css.toColor("#000000"),t=f.css.toColor("#ffffff"),i=f.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],d=[0,95,135,175,215,255];for(let S=0;S<216;S++){const T=d[S/36%6|0],N=d[S/6%6|0],y=d[S%6];b.push({css:f.channels.toCss(T,N,y),rgba:f.channels.toRgba(T,N,y)})}for(let S=0;S<24;S++){const T=8+10*S;b.push({css:f.channels.toCss(T,T,T),rgba:f.channels.toRgba(T,T,T)})}return b})());let u=r.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:s,cursor:t,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:l,selectionBackgroundOpaque:f.color.blend(s,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:f.color.blend(s,l),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(b={}){const d=this._colors;if(d.foreground=x(b.foreground,e),d.background=x(b.background,s),d.cursor=x(b.cursor,t),d.cursorAccent=x(b.cursorAccent,i),d.selectionBackgroundTransparent=x(b.selectionBackground,l),d.selectionBackgroundOpaque=f.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=x(b.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=f.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=b.selectionForeground?x(b.selectionForeground,f.NULL_COLOR):void 0,d.selectionForeground===f.NULL_COLOR&&(d.selectionForeground=void 0),f.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=f.color.opacity(d.selectionBackgroundTransparent,.3)),f.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=f.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=r.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=x(b.black,r.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=x(b.red,r.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=x(b.green,r.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=x(b.yellow,r.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=x(b.blue,r.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=x(b.magenta,r.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=x(b.cyan,r.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=x(b.white,r.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=x(b.brightBlack,r.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=x(b.brightRed,r.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=x(b.brightGreen,r.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=x(b.brightYellow,r.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=x(b.brightBlue,r.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=x(b.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=x(b.brightCyan,r.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=x(b.brightWhite,r.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const S=Math.min(d.ansi.length-16,b.extendedAnsi.length);for(let T=0;T{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const h=o(8460),p=o(844);class a extends p.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(g){if(this._maxLength===g)return;const v=new Array(g);for(let m=0;mthis._length)for(let v=this._length;v=g;e--)this._array[this._getCyclicIndex(e+m.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;ethis._maxLength){const e=this._length+m.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=m.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,v,m){if(!(v<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+m<0)throw new Error("Cannot shift elements in list beyond index 0");if(m>0){for(let s=v-1;s>=0;s--)this.set(g+s+m,this.get(g+s));const e=g+v+m-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(h,p=5){if(typeof h!="object")return h;const a=Array.isArray(h)?[]:{};for(const f in h)a[f]=p<=1?h[f]:h[f]&&o(h[f],p-1);return a}},8055:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const h=o(6114);let p=0,a=0,f=0,g=0;var v,m,e,s,t;function i(u){const x=u.toString(16);return x.length<2?"0"+x:x}function l(u,x){return u>>0}})(v||(r.channels=v={})),(function(u){function x(b,d){return g=Math.round(255*d),[p,a,f]=t.toChannels(b.rgba),{css:v.toCss(p,a,f,g),rgba:v.toRgba(p,a,f,g)}}u.blend=function(b,d){if(g=(255&d.rgba)/255,g===1)return{css:d.css,rgba:d.rgba};const S=d.rgba>>24&255,T=d.rgba>>16&255,N=d.rgba>>8&255,y=b.rgba>>24&255,E=b.rgba>>16&255,D=b.rgba>>8&255;return p=y+Math.round((S-y)*g),a=E+Math.round((T-E)*g),f=D+Math.round((N-D)*g),{css:v.toCss(p,a,f),rgba:v.toRgba(p,a,f)}},u.isOpaque=function(b){return(255&b.rgba)==255},u.ensureContrastRatio=function(b,d,S){const T=t.ensureContrastRatio(b.rgba,d.rgba,S);if(T)return t.toColor(T>>24&255,T>>16&255,T>>8&255)},u.opaque=function(b){const d=(255|b.rgba)>>>0;return[p,a,f]=t.toChannels(d),{css:v.toCss(p,a,f),rgba:d}},u.opacity=x,u.multiplyOpacity=function(b,d){return g=255&b.rgba,x(b,g*d/255)},u.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}})(m||(r.color=m={})),(function(u){let x,b;if(!h.isNode){const d=document.createElement("canvas");d.width=1,d.height=1;const S=d.getContext("2d",{willReadFrequently:!0});S&&(x=S,x.globalCompositeOperation="copy",b=x.createLinearGradient(0,0,1,1))}u.toColor=function(d){if(d.match(/#[\da-f]{3,8}/i))switch(d.length){case 4:return p=parseInt(d.slice(1,2).repeat(2),16),a=parseInt(d.slice(2,3).repeat(2),16),f=parseInt(d.slice(3,4).repeat(2),16),t.toColor(p,a,f);case 5:return p=parseInt(d.slice(1,2).repeat(2),16),a=parseInt(d.slice(2,3).repeat(2),16),f=parseInt(d.slice(3,4).repeat(2),16),g=parseInt(d.slice(4,5).repeat(2),16),t.toColor(p,a,f,g);case 7:return{css:d,rgba:(parseInt(d.slice(1),16)<<8|255)>>>0};case 9:return{css:d,rgba:parseInt(d.slice(1),16)>>>0}}const S=d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(S)return p=parseInt(S[1]),a=parseInt(S[2]),f=parseInt(S[3]),g=Math.round(255*(S[5]===void 0?1:parseFloat(S[5]))),t.toColor(p,a,f,g);if(!x||!b)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=b,x.fillStyle=d,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[p,a,f,g]=x.getImageData(0,0,1,1).data,g!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(p,a,f,g),css:d}}})(e||(r.css=e={})),(function(u){function x(b,d,S){const T=b/255,N=d/255,y=S/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}u.relativeLuminance=function(b){return x(b>>16&255,b>>8&255,255&b)},u.relativeLuminance2=x})(s||(r.rgb=s={})),(function(u){function x(d,S,T){const N=d>>24&255,y=d>>16&255,E=d>>8&255;let D=S>>24&255,B=S>>16&255,I=S>>8&255,P=l(s.relativeLuminance2(D,B,I),s.relativeLuminance2(N,y,E));for(;P0||B>0||I>0);)D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),I-=Math.max(0,Math.ceil(.1*I)),P=l(s.relativeLuminance2(D,B,I),s.relativeLuminance2(N,y,E));return(D<<24|B<<16|I<<8|255)>>>0}function b(d,S,T){const N=d>>24&255,y=d>>16&255,E=d>>8&255;let D=S>>24&255,B=S>>16&255,I=S>>8&255,P=l(s.relativeLuminance2(D,B,I),s.relativeLuminance2(N,y,E));for(;P>>0}u.ensureContrastRatio=function(d,S,T){const N=s.relativeLuminance(d>>8),y=s.relativeLuminance(S>>8);if(l(N,y)>8));if(Il(N,s.relativeLuminance(P>>8))?B:P}return B}const E=b(d,S,T),D=l(N,s.relativeLuminance(E>>8));if(Dl(N,s.relativeLuminance(B>>8))?E:B}return E}},u.reduceLuminance=x,u.increaseLuminance=b,u.toChannels=function(d){return[d>>24&255,d>>16&255,d>>8&255,255&d]},u.toColor=function(d,S,T,N){return{css:v.toCss(d,S,T,N),rgba:v.toRgba(d,S,T,N)}}})(t||(r.rgba=t={})),r.toPaddedHex=i,r.contrastRatio=l},8969:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const h=o(844),p=o(2585),a=o(4348),f=o(7866),g=o(744),v=o(7302),m=o(6975),e=o(8460),s=o(1753),t=o(1480),i=o(7994),l=o(9282),u=o(5435),x=o(5981),b=o(2660);let d=!1;class S extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((N=>{var y;(y=this._onScrollApi)===null||y===void 0||y.fire(N.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(N){for(const y in N)this.optionsService.options[y]=N[y]}constructor(N){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new v.OptionsService(N)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(m.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new u.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new x.WriteBuffer(((y,E)=>this._inputHandler.parse(y,E)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(N,y){this._writeBuffer.write(N,y)}writeSync(N,y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!0),this._writeBuffer.writeSync(N,y)}resize(N,y){isNaN(N)||isNaN(y)||(N=Math.max(N,g.MINIMUM_COLS),y=Math.max(y,g.MINIMUM_ROWS),this._bufferService.resize(N,y))}scroll(N,y=!1){this._bufferService.scroll(N,y)}scrollLines(N,y,E){this._bufferService.scrollLines(N,y,E)}scrollPages(N){this.scrollLines(N*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(N){const y=N-this._bufferService.buffer.ydisp;y!==0&&this.scrollLines(y)}registerEscHandler(N,y){return this._inputHandler.registerEscHandler(N,y)}registerDcsHandler(N,y){return this._inputHandler.registerDcsHandler(N,y)}registerCsiHandler(N,y){return this._inputHandler.registerCsiHandler(N,y)}registerOscHandler(N,y){return this._inputHandler.registerOscHandler(N,y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let N=!1;const y=this.optionsService.rawOptions.windowsPty;y&&y.buildNumber!==void 0&&y.buildNumber!==void 0?N=y.backend==="conpty"&&y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(N=!0),N?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const N=[];N.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),N.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const y of N)y.dispose()}))}}}r.CoreTerminal=S},8460:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let h=0;hh.fire(p)))}},5435:function(A,r,o){var h=this&&this.__decorate||function(P,C,L,M){var j,$=arguments.length,V=$<3?C:M===null?M=Object.getOwnPropertyDescriptor(C,L):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(P,C,L,M);else for(var Y=P.length-1;Y>=0;Y--)(j=P[Y])&&(V=($<3?j(V):$>3?j(C,L,V):j(C,L))||V);return $>3&&V&&Object.defineProperty(C,L,V),V},p=this&&this.__param||function(P,C){return function(L,M){C(L,M,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const a=o(2584),f=o(7116),g=o(2015),v=o(844),m=o(482),e=o(8437),s=o(8460),t=o(643),i=o(511),l=o(3734),u=o(2585),x=o(6242),b=o(6351),d=o(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function N(P,C){if(P>24)return C.setWinLines||!1;switch(P){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var y;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(y||(r.WindowsOptionsReportType=y={}));let E=0;class D extends v.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,M,j,$,V,Y,X,ae=new g.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=M,this._logService=j,this._optionsService=$,this._oscLinkService=V,this._coreMouseService=Y,this._unicodeService=X,this._parser=ae,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new m.StringToUtf32,this._utf8Decoder=new m.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new B(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:W.toArray()})})),this._parser.setEscHandlerFallback((k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})})),this._parser.setExecuteHandlerFallback((k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})})),this._parser.setOscHandlerFallback(((k,W,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:W,data:q})})),this._parser.setDcsHandlerFallback(((k,W,q)=>{W==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:W,payload:q})})),this._parser.setPrintHandler(((k,W,q)=>this.print(k,W,q))),this._parser.registerCsiHandler({final:"@"},(k=>this.insertChars(k))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(k=>this.scrollLeft(k))),this._parser.registerCsiHandler({final:"A"},(k=>this.cursorUp(k))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(k=>this.scrollRight(k))),this._parser.registerCsiHandler({final:"B"},(k=>this.cursorDown(k))),this._parser.registerCsiHandler({final:"C"},(k=>this.cursorForward(k))),this._parser.registerCsiHandler({final:"D"},(k=>this.cursorBackward(k))),this._parser.registerCsiHandler({final:"E"},(k=>this.cursorNextLine(k))),this._parser.registerCsiHandler({final:"F"},(k=>this.cursorPrecedingLine(k))),this._parser.registerCsiHandler({final:"G"},(k=>this.cursorCharAbsolute(k))),this._parser.registerCsiHandler({final:"H"},(k=>this.cursorPosition(k))),this._parser.registerCsiHandler({final:"I"},(k=>this.cursorForwardTab(k))),this._parser.registerCsiHandler({final:"J"},(k=>this.eraseInDisplay(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(k=>this.eraseInDisplay(k,!0))),this._parser.registerCsiHandler({final:"K"},(k=>this.eraseInLine(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(k=>this.eraseInLine(k,!0))),this._parser.registerCsiHandler({final:"L"},(k=>this.insertLines(k))),this._parser.registerCsiHandler({final:"M"},(k=>this.deleteLines(k))),this._parser.registerCsiHandler({final:"P"},(k=>this.deleteChars(k))),this._parser.registerCsiHandler({final:"S"},(k=>this.scrollUp(k))),this._parser.registerCsiHandler({final:"T"},(k=>this.scrollDown(k))),this._parser.registerCsiHandler({final:"X"},(k=>this.eraseChars(k))),this._parser.registerCsiHandler({final:"Z"},(k=>this.cursorBackwardTab(k))),this._parser.registerCsiHandler({final:"`"},(k=>this.charPosAbsolute(k))),this._parser.registerCsiHandler({final:"a"},(k=>this.hPositionRelative(k))),this._parser.registerCsiHandler({final:"b"},(k=>this.repeatPrecedingCharacter(k))),this._parser.registerCsiHandler({final:"c"},(k=>this.sendDeviceAttributesPrimary(k))),this._parser.registerCsiHandler({prefix:">",final:"c"},(k=>this.sendDeviceAttributesSecondary(k))),this._parser.registerCsiHandler({final:"d"},(k=>this.linePosAbsolute(k))),this._parser.registerCsiHandler({final:"e"},(k=>this.vPositionRelative(k))),this._parser.registerCsiHandler({final:"f"},(k=>this.hVPosition(k))),this._parser.registerCsiHandler({final:"g"},(k=>this.tabClear(k))),this._parser.registerCsiHandler({final:"h"},(k=>this.setMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(k=>this.setModePrivate(k))),this._parser.registerCsiHandler({final:"l"},(k=>this.resetMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(k=>this.resetModePrivate(k))),this._parser.registerCsiHandler({final:"m"},(k=>this.charAttributes(k))),this._parser.registerCsiHandler({final:"n"},(k=>this.deviceStatus(k))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(k=>this.deviceStatusPrivate(k))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(k=>this.softReset(k))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(k=>this.setCursorStyle(k))),this._parser.registerCsiHandler({final:"r"},(k=>this.setScrollRegion(k))),this._parser.registerCsiHandler({final:"s"},(k=>this.saveCursor(k))),this._parser.registerCsiHandler({final:"t"},(k=>this.windowOptions(k))),this._parser.registerCsiHandler({final:"u"},(k=>this.restoreCursor(k))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(k=>this.insertColumns(k))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(k=>this.deleteColumns(k))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(k=>this.selectProtected(k))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(k=>this.requestMode(k,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(k=>this.requestMode(k,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new x.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new x.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new x.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new x.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new x.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new x.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new x.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new x.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new x.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new x.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new x.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new x.OscHandler((k=>this.restoreCursorColor(k)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const k in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler(((k,W)=>this.requestStatusString(k,W))))}_preserveStack(C,L,M,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=M,this._parseStack.position=j}_logSlowResolvingAsync(C){this._logService.logLevel<=u.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,M)=>setTimeout((()=>M("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let M,j=this._activeBuffer.x,$=this._activeBuffer.y,V=0;const Y=this._parseStack.paused;if(Y){if(M=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(M),M;j=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>T&&(V=this._parseStack.position+T)}if(this._logService.logLevel<=u.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(X=>String.fromCharCode(X))).join("")}"`),typeof C=="string"?C.split("").map((X=>X.charCodeAt(0))):C),this._parseBuffer.lengthT)for(let X=V;X0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodePoint(this._activeBuffer.x-1,0,1,W.fg,W.bg,W.extended);for(let U=L;U=X){if(ae){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=X-1,$===2)continue}if(k&&(q.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(W),W),q.getWidth(X-1)===2&&q.setCellFromCodePoint(X-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,W.fg,W.bg,W.extended)),q.setCellFromCodePoint(this._activeBuffer.x++,j,$,W.fg,W.bg,W.extended),$>0)for(;--$;)q.setCellFromCodePoint(this._activeBuffer.x++,0,0,W.fg,W.bg,W.extended)}else q.getWidth(this._activeBuffer.x-1)?q.addCodepointToCell(this._activeBuffer.x-1,j):q.addCodepointToCell(this._activeBuffer.x-2,j)}M-L>0&&(q.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodePoint(this._activeBuffer.x,0,1,W.fg,W.bg,W.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(M=>!N(M.params[0],this._optionsService.rawOptions.windowOptions)||L(M)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new b.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new x.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||C===void 0)&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,M,j=!1,$=!1){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);V.replaceCells(L,M,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),$),j&&(V.isWrapped=!1)}_resetBufferLine(C,L=!1){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);M&&(M.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),M.isWrapped=!1)}eraseInDisplay(C,L=!1){let M;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);M=this._bufferService.cols&&(this._activeBuffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowTracker.markDirty(M-1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 3:const j=this._activeBuffer.lines.length-this._bufferService.rows;j>0&&(this._activeBuffer.lines.trimStart(j),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-j,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-j,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;Lne?1:2,U=C.params[0];return ee=U,Q=L?U===2?4:U===4?q(V.modes.insertMode):U===12?3:U===20?q(W.convertEol):0:U===1?q(M.applicationCursorKeys):U===3?W.windowOptions.setWinLines?X===80?2:X===132?1:0:0:U===6?q(M.origin):U===7?q(M.wraparound):U===8?3:U===9?q(j==="X10"):U===12?q(W.cursorBlink):U===25?q(!V.isCursorHidden):U===45?q(M.reverseWraparound):U===66?q(M.applicationKeypad):U===67?4:U===1e3?q(j==="VT200"):U===1002?q(j==="DRAG"):U===1003?q(j==="ANY"):U===1004?q(M.sendFocus):U===1005?4:U===1006?q($==="SGR"):U===1015?4:U===1016?q($==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?q(ae===k):U===2004?q(M.bracketedPasteMode):0,V.triggerDataEvent(`${a.C0.ESC}[${L?"":"?"}${ee};${Q}$y`),!0;var ee,Q}_updateAttrColor(C,L,M,j,$){return L===2?(C|=50331648,C&=-16777216,C|=l.AttributeData.fromColorRGB([M,j,$])):L===5&&(C&=-50331904,C|=33554432|255&M),C}_extractColor(C,L,M){const j=[0,0,-1,0,0,0];let $=0,V=0;do{if(j[V+$]=C.params[L+V],C.hasSubParams(L+V)){const Y=C.getSubParams(L+V);let X=0;do j[1]===5&&($=1),j[V+X+1+$]=Y[X];while(++X=2||j[1]===2&&V+$>=5)break;j[1]&&($=1)}while(++V+L5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=C.length;let M;const j=this._curAttrData;for(let $=0;$=30&&M<=37?(j.fg&=-50331904,j.fg|=16777216|M-30):M>=40&&M<=47?(j.bg&=-50331904,j.bg|=16777216|M-40):M>=90&&M<=97?(j.fg&=-50331904,j.fg|=16777224|M-90):M>=100&&M<=107?(j.bg&=-50331904,j.bg|=16777224|M-100):M===0?this._processSGR0(j):M===1?j.fg|=134217728:M===3?j.bg|=67108864:M===4?(j.fg|=268435456,this._processUnderline(C.hasSubParams($)?C.getSubParams($)[0]:1,j)):M===5?j.fg|=536870912:M===7?j.fg|=67108864:M===8?j.fg|=1073741824:M===9?j.fg|=2147483648:M===2?j.bg|=134217728:M===21?this._processUnderline(2,j):M===22?(j.fg&=-134217729,j.bg&=-134217729):M===23?j.bg&=-67108865:M===24?(j.fg&=-268435457,this._processUnderline(0,j)):M===25?j.fg&=-536870913:M===27?j.fg&=-67108865:M===28?j.fg&=-1073741825:M===29?j.fg&=2147483647:M===39?(j.fg&=-67108864,j.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):M===49?(j.bg&=-67108864,j.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?$+=this._extractColor(C,$,j):M===53?j.bg|=1073741824:M===55?j.bg&=-1073741825:M===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):M===100?(j.fg&=-67108864,j.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${L};${M}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const L=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${L};${M}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const M=L%2==1;return this._optionsService.options.cursorBlink=M,!0}setScrollRegion(C){const L=C.params[0]||1;let M;return(C.length<2||(M=C.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=M-1,this._setCursor(0,0)),!0}windowOptions(C){if(!N(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const L=[],M=C.split(";");for(;M.length>1;){const j=M.shift(),$=M.shift();if(/^\d+$/.exec(j)){const V=parseInt(j);if(I(V))if($==="?")L.push({type:0,index:V});else{const Y=(0,d.parseColor)($);Y&&L.push({type:1,index:V,color:Y})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){const L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();const M=C.split(":");let j;const $=M.findIndex((V=>V.startsWith("id=")));return $!==-1&&(j=M[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:j,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){const M=C.split(";");for(let j=0;j=this._specialColors.length);++j,++L)if(M[j]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const $=(0,d.parseColor)(M[j]);$&&this._onColor.fire([{type:1,index:this._specialColors[L],color:$}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const L=[],M=C.split(";");for(let j=0;j=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new i.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${a.C0.ESC}${$}${a.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${M.scrollTop+1};${M.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[j.cursorStyle]-(j.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}r.InputHandler=D;let B=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){Pthis.end&&(this.end=P)}markRangeDirty(P,C){P>C&&(E=P,P=C,C=E),Pthis.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function I(P){return 0<=P&&P<256}B=h([p(0,u.IBufferService)],B)},844:(A,r)=>{function o(h){for(const p of h)p.dispose();h.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const p=this._disposables.indexOf(h);p!==-1&&this._disposables.splice(p,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var p;this._isDisposed||h===this._value||((p=this._value)===null||p===void 0||p.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)===null||h===void 0||h.dispose(),this._value=void 0}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=o,r.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},1505:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(p,a,f){this._data[p]||(this._data[p]={}),this._data[p][a]=f}get(p,a){return this._data[p]?this._data[p][a]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(h,p,a,f,g){this._data.get(h,p)||this._data.set(h,p,new o),this._data.get(h,p).set(a,f,g)}get(h,p,a,f){var g;return(g=this._data.get(h,p))===null||g===void 0?void 0:g.get(a,f)}clear(){this._data.clear()}}},6114:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const o=r.isNode?"node":navigator.userAgent,h=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(o=this._search(this._getKey(h)),this._array.splice(o,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const p=this._getKey(h);if(p===void 0||(o=this._search(p),o===-1)||this._getKey(this._array[o])!==p)return!1;do if(this._array[o]===h)return this._array.splice(o,1),!0;while(++o=this._array.length)&&this._getKey(this._array[o])===h))do yield this._array[o];while(++o=this._array.length)&&this._getKey(this._array[o])===h))do p(this._array[o]);while(++o=p;){let f=p+a>>1;const g=this._getKey(this._array[f]);if(g>h)a=f-1;else{if(!(g0&&this._getKey(this._array[f-1])===h;)f--;return f}p=f+1}}return p}}},7226:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const h=o(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._is)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class a extends p{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const v=Date.now()+g;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}r.PriorityTaskQueue=a,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:a,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const h=o(643);r.updateWindowsModeWrappedState=function(p){const a=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),f=a?.get(p.cols-1),g=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);g&&f&&(g.isWrapped=f[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&f[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){const a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}constructor(a=0,f=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=f}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const h=o(6349),p=o(7226),a=o(3734),f=o(8437),g=o(4634),v=o(511),m=o(643),e=o(4863),s=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,i,l){this._hasScrollback=t,this._optionsService=i,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,m.WHITESPACE_CELL_CHAR,m.WHITESPACE_CELL_WIDTH,m.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,i){return new f.BufferLine(this._bufferService.cols,this.getNullCell(t),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&tr.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=f.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,i){const l=this.getNullCell(f.DEFAULT_ATTR_DATA);let u=0;const x=this._getCorrectBufferLength(i);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(t,l)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=x}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,i-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(t,i),this._cols>t))for(let b=0;b.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let i=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,i){this._cols!==t&&(t>this._cols?this._reflowLarger(t,i):this._reflowSmaller(t,i))}_reflowLarger(t,i){const l=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(l.length>0){const u=(0,g.reflowLargerCreateNewLayout)(this.lines,l);(0,g.reflowLargerApplyNewLayout)(this.lines,u.layout),this._reflowLargerAdjustViewport(t,i,u.countRemoved)}}_reflowLargerAdjustViewport(t,i,l){const u=this.getNullCell(f.DEFAULT_ATTR_DATA);let x=l;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;b--){let d=this.lines.get(b);if(!d||!d.isWrapped&&d.getTrimmedLength()<=t)continue;const S=[d];for(;d.isWrapped&&b>0;)d=this.lines.get(--b),S.unshift(d);const T=this.ybase+this.y;if(T>=b&&T0&&(u.push({start:b+S.length+x,newLines:B}),x+=B.length),S.push(...B);let I=y.length-1,P=y[I];P===0&&(I--,P=y[I]);let C=S.length-E-1,L=N;for(;C>=0;){const j=Math.min(L,P);if(S[I]===void 0)break;if(S[I].copyCellsFrom(S[C],L-j,P-j,j,!0),P-=j,P===0&&(I--,P=y[I]),L-=j,L===0){C--;const $=Math.max(C,0);L=(0,g.getWrappedLineTrimmedLength)(S,$,this._cols)}}for(let j=0;j0;)this.ybase===0?this.y0){const b=[],d=[];for(let I=0;I=0;I--)if(y&&y.start>T+E){for(let P=y.newLines.length-1;P>=0;P--)this.lines.set(I--,y.newLines[P]);I++,b.push({index:T+1,amount:y.newLines.length}),E+=y.newLines.length,y=u[++N]}else this.lines.set(I,d[T--]);let D=0;for(let I=b.length-1;I>=0;I--)b[I].index+=D,this.lines.onInsertEmitter.fire(b[I]),D+=b[I].amount;const B=Math.max(0,S+x-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(t,i,l=0,u){const x=this.lines.get(t);return x?x.translateToString(i,l,u):""}getWrappedRangeForLine(t){let i=t,l=t;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;l+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let i=0;i{i.line-=l,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((l=>{i.line>=l.index&&(i.line+=l.amount)}))),i.register(this.lines.onDelete((l=>{i.line>=l.index&&i.linel.index&&(i.line-=l.amount)}))),i.register(i.onDispose((()=>this._removeMarker(i)))),i}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const h=o(3734),p=o(511),a=o(643),f=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let g=0;class v{constructor(e,s,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const i=s||p.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let l=0;l>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,s){this._data[3*e+1]=s[a.CHAR_DATA_ATTR_INDEX],s[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,f.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return g=3*e,s.content=this._data[g+0],s.fg=this._data[g+1],s.bg=this._data[g+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodePoint(e,s,t,i,l,u){268435456&l&&(this._extendedAttrs[e]=u),this._data[3*e+0]=s|t<<22,this._data[3*e+1]=i,this._data[3*e+2]=l}addCodepointToCell(e,s){let t=this._data[3*e+0];2097152&t?this._combined[e]+=(0,f.stringFromCodePoint)(s):(2097151&t?(this._combined[e]=(0,f.stringFromCodePoint)(2097151&t)+(0,f.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,this._data[3*e+0]=t)}insertCells(e,s,t,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,i?.fg||0,i?.bg||0,i?.extended||new h.ExtendedAttrs),s=0;--u)this.setCell(e+s+u,this.loadCell(e+u,l));for(let u=0;uthis.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const i=new Uint32Array(t);i.set(this._data),this._data=i}for(let i=this.length;i=e&&delete this._combined[x]}const l=Object.keys(this._extendedAttrs);for(let u=0;u=e&&delete this._extendedAttrs[x]}}return this.length=e,4*t*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,s,t,i,l){const u=e._data;if(l)for(let b=i-1;b>=0;b--){for(let d=0;d<3;d++)this._data[3*(t+b)+d]=u[3*(s+b)+d];268435456&u[3*(s+b)+2]&&(this._extendedAttrs[t+b]=e._extendedAttrs[s+b])}else for(let b=0;b=s&&(this._combined[d-s+t]=e._combined[d])}}translateToString(e=!1,s=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let i="";for(;s>22||1}return i}}r.BufferLine=v},4841:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,h){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return h*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(A,r)=>{function o(h,p,a){if(p===h.length-1)return h[p].getTrimmedLength();const f=!h[p].hasContent(a-1)&&h[p].getWidth(a-1)===1,g=h[p+1].getWidth(0)===2;return f&&g?a-1:a}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,p,a,f,g){const v=[];for(let m=0;m=m&&f0&&(d>i||t[d].getTrimmedLength()===0);d--)b++;b>0&&(v.push(m+t.length-b),v.push(b)),m+=t.length-1}return v},r.reflowLargerCreateNewLayout=function(h,p){const a=[];let f=0,g=p[f],v=0;for(let m=0;mo(h,t,p))).reduce(((s,t)=>s+t));let v=0,m=0,e=0;for(;es&&(v-=s,m++);const t=h[m].getWidth(v-1)===2;t&&v--;const i=t?a-1:a;f.push(i),e+=i}return f},r.getWrappedLineTrimmedLength=o},5295:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const h=o(8460),p=o(844),a=o(9092);class f extends p.Disposable{constructor(v,m){super(),this._optionsService=v,this._bufferService=m,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,m){this._normal.resize(v,m),this._alt.resize(v,m),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}r.BufferSet=f},511:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const h=o(482),p=o(643),a=o(3734);class f extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const m=new f;return m.setFromCharData(v),m}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let m=!1;if(v[p.CHAR_DATA_CHAR_INDEX].length>2)m=!0;else if(v[p.CHAR_DATA_CHAR_INDEX].length===2){const e=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[p.CHAR_DATA_WIDTH_INDEX]<<22:m=!0}else m=!0}else this.content=v[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[p.CHAR_DATA_WIDTH_INDEX]<<22;m&&(this.combinedData=v[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=f},643:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const h=o(8460),p=o(844);class a{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}r.Marker=a,a._nextId=1},7116:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(A,r)=>{var o,h,p;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=` +`,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL=""})(o||(r.C0=o={})),(function(a){a.PAD="€",a.HOP="",a.BPH="‚",a.NBH="ƒ",a.IND="„",a.NEL="…",a.SSA="†",a.ESA="‡",a.HTS="ˆ",a.HTJ="‰",a.VTS="Š",a.PLD="‹",a.PLU="Œ",a.RI="",a.SS2="Ž",a.SS3="",a.DCS="",a.PU1="‘",a.PU2="’",a.STS="“",a.CCH="”",a.MW="•",a.SPA="–",a.EPA="—",a.SOS="˜",a.SGCI="™",a.SCI="š",a.CSI="›",a.ST="œ",a.OSC="",a.PM="ž",a.APC="Ÿ"})(h||(r.C1=h={})),(function(a){a.ST=`${o.ESC}\\`})(p||(r.C1_ESCAPED=p={}))},7399:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const h=o(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(a,f,g,v){const m={type:0,cancel:!1,key:void 0},e=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?m.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?m.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?m.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(m.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:if(a.altKey){m.key=h.C0.ESC+h.C0.DEL;break}m.key=h.C0.DEL;break;case 9:if(a.shiftKey){m.key=h.C0.ESC+"[Z";break}m.key=h.C0.HT,m.cancel=!0;break;case 13:m.key=a.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,m.cancel=!0;break;case 27:m.key=h.C0.ESC,a.altKey&&(m.key=h.C0.ESC+h.C0.ESC),m.cancel=!0;break;case 37:if(a.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"D",m.key===h.C0.ESC+"[1;3D"&&(m.key=h.C0.ESC+(g?"b":"[1;5D"))):m.key=f?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(a.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"C",m.key===h.C0.ESC+"[1;3C"&&(m.key=h.C0.ESC+(g?"f":"[1;5C"))):m.key=f?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(a.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"A",g||m.key!==h.C0.ESC+"[1;3A"||(m.key=h.C0.ESC+"[1;5A")):m.key=f?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(a.metaKey)break;e?(m.key=h.C0.ESC+"[1;"+(e+1)+"B",g||m.key!==h.C0.ESC+"[1;3B"||(m.key=h.C0.ESC+"[1;5B")):m.key=f?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(m.key=h.C0.ESC+"[2~");break;case 46:m.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:m.key=e?h.C0.ESC+"[1;"+(e+1)+"H":f?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:m.key=e?h.C0.ESC+"[1;"+(e+1)+"F":f?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:a.shiftKey?m.type=2:a.ctrlKey?m.key=h.C0.ESC+"[5;"+(e+1)+"~":m.key=h.C0.ESC+"[5~";break;case 34:a.shiftKey?m.type=3:a.ctrlKey?m.key=h.C0.ESC+"[6;"+(e+1)+"~":m.key=h.C0.ESC+"[6~";break;case 112:m.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:m.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:m.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:m.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:m.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:m.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:m.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:m.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:m.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:m.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:m.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:m.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(g&&!v||!a.altKey||a.metaKey)!g||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?m.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(m.key=h.C0.US),a.key==="@"&&(m.key=h.C0.NUL)):a.keyCode===65&&(m.type=1);else{const s=p[a.keyCode],t=s?.[a.shiftKey?1:0];if(t)m.key=h.C0.ESC+t;else if(a.keyCode>=65&&a.keyCode<=90){const i=a.ctrlKey?a.keyCode-64:a.keyCode+32;let l=String.fromCharCode(i);a.shiftKey&&(l=l.toUpperCase()),m.key=h.C0.ESC+l}else if(a.keyCode===32)m.key=h.C0.ESC+(a.ctrlKey?h.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let i=a.code.slice(3,4);a.shiftKey||(i=i.toLowerCase()),m.key=h.C0.ESC+i,m.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?m.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?m.key=h.C0.NUL:a.keyCode>=51&&a.keyCode<=55?m.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?m.key=h.C0.DEL:a.keyCode===219?m.key=h.C0.ESC:a.keyCode===220?m.key=h.C0.FS:a.keyCode===221&&(m.key=h.C0.GS)}return m}},482:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,h=0,p=o.length){let a="";for(let f=h;f65535?(g-=65536,a+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):a+=String.fromCharCode(g)}return a},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const p=o.length;if(!p)return 0;let a=0,f=0;if(this._interim){const g=o.charCodeAt(f++);56320<=g&&g<=57343?h[a++]=1024*(this._interim-55296)+g-56320+65536:(h[a++]=this._interim,h[a++]=g),this._interim=0}for(let g=f;g=p)return this._interim=v,a;const m=o.charCodeAt(g);56320<=m&&m<=57343?h[a++]=1024*(v-55296)+m-56320+65536:(h[a++]=v,h[a++]=m)}else v!==65279&&(h[a++]=v)}return a}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const p=o.length;if(!p)return 0;let a,f,g,v,m=0,e=0,s=0;if(this.interim[0]){let l=!1,u=this.interim[0];u&=(224&u)==192?31:(240&u)==224?15:7;let x,b=0;for(;(x=63&this.interim[++b])&&b<4;)u<<=6,u|=x;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=d-b;for(;s=p)return 0;if(x=o[s++],(192&x)!=128){s--,l=!0;break}this.interim[b++]=x,u<<=6,u|=63&x}l||(d===2?u<128?s--:h[m++]=u:d===3?u<2048||u>=55296&&u<=57343||u===65279||(h[m++]=u):u<65536||u>1114111||(h[m++]=u)),this.interim.fill(0)}const t=p-4;let i=s;for(;i=p)return this.interim[0]=a,m;if(f=o[i++],(192&f)!=128){i--;continue}if(e=(31&a)<<6|63&f,e<128){i--;continue}h[m++]=e}else if((240&a)==224){if(i>=p)return this.interim[0]=a,m;if(f=o[i++],(192&f)!=128){i--;continue}if(i>=p)return this.interim[0]=a,this.interim[1]=f,m;if(g=o[i++],(192&g)!=128){i--;continue}if(e=(15&a)<<12|(63&f)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;h[m++]=e}else if((248&a)==240){if(i>=p)return this.interim[0]=a,m;if(f=o[i++],(192&f)!=128){i--;continue}if(i>=p)return this.interim[0]=a,this.interim[1]=f,m;if(g=o[i++],(192&g)!=128){i--;continue}if(i>=p)return this.interim[0]=a,this.interim[1]=f,this.interim[2]=g,m;if(v=o[i++],(192&v)!=128){i--;continue}if(e=(7&a)<<18|(63&f)<<12|(63&g)<<6|63&v,e<65536||e>1114111)continue;h[m++]=e}}return m}}},225:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;r.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let a=0;ag[e][1])return!1;for(;e>=m;)if(v=m+e>>1,f>g[v][1])m=v+1;else{if(!(f=131072&&a<=196605||a>=196608&&a<=262141?2:1}}},5981:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const h=o(8460),p=o(844);class a extends p.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let m;for(this._isSyncWriting=!0;m=this._writeBuffer.shift();){this._action(m);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,v){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(v),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(v)}_innerWrite(g=0,v=!0){const m=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,v);if(s){const i=l=>Date.now()-m>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(m,l);return void s.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(i)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-m>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=a},5941:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function p(a,f){const g=a.toString(16),v=g.length<2?"0"+g:g;switch(f){case 4:return g[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}r.parseColor=function(a){if(!a)return;let f=a.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);const g=o.exec(f);if(g){const v=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/v*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/v*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/v*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),h.exec(f)&&[3,6,9,12].includes(f.length))){const g=f.length/3,v=[0,0,0];for(let m=0;m<3;++m){const e=parseInt(f.slice(g*m,g*m+g),16);v[m]=g===1?e<<4:g===2?e:g===3?e>>4:e>>8}return v}},r.toRgbString=function(a,f=16){const[g,v,m]=a;return`rgb:${p(g,f)}/${p(v,f)}/${p(m,f)}`}},5770:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const h=o(482),p=o(8742),a=o(5770),f=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(v,m){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(m),{dispose:()=>{const s=e.indexOf(m);s!==-1&&e.splice(s,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(v,m){if(this.reset(),this._ident=v,this._active=this._handlers[v]||f,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(m);else this._handlerFb(this._ident,"HOOK",m)}put(v,m,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(v,m,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,m,e))}unhook(v,m=!0){if(this._active.length){let e=!1,s=this._active.length-1,t=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=m,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;s>=0&&(e=this._active[s].unhook(v),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=f,this._ident=0}};const g=new p.Params;g.addParam(0),r.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=g,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():g,this._data="",this._hitLimit=!1}put(v,m,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,m,e),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let m=!1;if(this._hitLimit)m=!1;else if(v&&(m=this._handler(this._data,this._params),m instanceof Promise))return m.then((e=>(this._params=g,this._data="",this._hitLimit=!1,e)));return this._params=g,this._data="",this._hitLimit=!1,m}}},2015:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const h=o(844),p=o(8742),a=o(6242),f=o(6351);class g{constructor(s){this.table=new Uint8Array(s)}setDefault(s,t){this.table.fill(s<<4|t)}add(s,t,i,l){this.table[t<<8|s]=i<<4|l}addMany(s,t,i,l){for(let u=0;ud)),t=(b,d)=>s.slice(b,d),i=t(32,127),l=t(0,24);l.push(25),l.push.apply(l,t(28,32));const u=t(0,14);let x;for(x in e.setDefault(1,0),e.addMany(i,0,2,0),u)e.addMany([24,26,153,154],x,3,0),e.addMany(t(128,144),x,3,0),e.addMany(t(144,152),x,3,0),e.add(156,x,0,0),e.add(27,x,11,1),e.add(157,x,4,8),e.addMany([152,158,159],x,0,7),e.add(155,x,11,3),e.add(144,x,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(t(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(t(64,127),3,7,0),e.addMany(t(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(t(48,60),4,8,4),e.addMany(t(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(t(32,64),6,0,6),e.add(127,6,0,6),e.addMany(t(64,127),6,0,0),e.addMany(t(32,48),3,9,5),e.addMany(t(32,48),5,9,5),e.addMany(t(48,64),5,0,6),e.addMany(t(64,127),5,7,0),e.addMany(t(32,48),4,9,5),e.addMany(t(32,48),1,9,2),e.addMany(t(32,48),2,9,2),e.addMany(t(48,127),2,10,0),e.addMany(t(48,80),1,10,0),e.addMany(t(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(t(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(t(28,32),9,0,9),e.addMany(t(32,48),9,9,12),e.addMany(t(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(t(32,128),11,0,11),e.addMany(t(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(t(28,32),10,0,10),e.addMany(t(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(t(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(t(28,32),12,0,12),e.addMany(t(32,48),12,9,12),e.addMany(t(48,64),12,0,11),e.addMany(t(64,127),12,12,13),e.addMany(t(64,127),10,12,13),e.addMany(t(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e})();class m extends h.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(t,i,l)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,t=[64,126]){let i=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=s.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let u=0;ux||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=x}}if(s.final.length!==1)throw new Error("final must be a single byte");const l=s.final.charCodeAt(0);if(t[0]>l||l>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=l,i}identToString(s){const t=[];for(;s;)t.push(String.fromCharCode(255&s)),s>>=8;return t.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,t){const i=this._identifier(s,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);const l=this._escHandlers[i];return l.push(t),{dispose:()=>{const u=l.indexOf(t);u!==-1&&l.splice(u,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,t){this._executeHandlers[s.charCodeAt(0)]=t}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,t){const i=this._identifier(s);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);const l=this._csiHandlers[i];return l.push(t),{dispose:()=>{const u=l.indexOf(t);u!==-1&&l.splice(u,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,t){return this._dcsParser.registerHandler(this._identifier(s),t)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,t){return this._oscParser.registerHandler(s,t)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,t,i,l,u){this._parseStack.state=s,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=l,this._parseStack.chunkPos=u}parse(s,t,i){let l,u=0,x=0,b=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,b=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const d=this._parseStack.handlers;let S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&S>-1){for(;S>=0&&(l=d[S](this._params),l!==!0);S--)if(l instanceof Promise)return this._parseStack.handlerPos=S,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&S>-1){for(;S>=0&&(l=d[S](),l!==!0);S--)if(l instanceof Promise)return this._parseStack.handlerPos=S,l}this._parseStack.handlers=[];break;case 6:if(u=s[this._parseStack.chunkPos],l=this._dcsParser.unhook(u!==24&&u!==26,i),l)return l;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(u=s[this._parseStack.chunkPos],l=this._oscParser.end(u!==24&&u!==26,i),l)return l;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,b=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let d=b;d>4){case 2:for(let E=d+1;;++E){if(E>=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=t||(u=s[E])<32||u>126&&u=0&&(l=S[T](this._params),l!==!0);T--)if(l instanceof Promise)return this._preserveStack(3,S,T,x,d),l;T<0&&this._csiHandlerFb(this._collect<<8|u,this._params),this.precedingCodepoint=0;break;case 8:do switch(u){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(u-48)}while(++d47&&u<60);d--;break;case 9:this._collect<<=8,this._collect|=u;break;case 10:const N=this._escHandlers[this._collect<<8|u];let y=N?N.length-1:-1;for(;y>=0&&(l=N[y](),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(4,N,y,x,d),l;y<0&&this._escHandlerFb(this._collect<<8|u),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|u,this._params);break;case 13:for(let E=d+1;;++E)if(E>=t||(u=s[E])===24||u===26||u===27||u>127&&u=t||(u=s[E])<32||u>127&&u{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const h=o(5770),p=o(482),a=[];r.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,g){this._handlers[f]===void 0&&(this._handlers[f]=[]);const v=this._handlers[f];return v.push(g),{dispose:()=>{const m=v.indexOf(g);m!==-1&&v.splice(m,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,g,v){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(f,g,v);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(f,g,v))}start(){this.reset(),this._state=1}put(f,g,v){if(this._state!==3){if(this._state===1)for(;g0&&this._put(f,g,v)}}end(f,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,m=this._active.length-1,e=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,v=g,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;m>=0&&(v=this._active[m].end(f),v!==!0);m--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,v;m--}for(;m>=0;m--)if(v=this._active[m].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",f);this._active=a,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,g,v){this._hitLimit||(this._data+=(0,p.utf32ToString)(f,g,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let g=!1;if(this._hitLimit)g=!1;else if(f&&(g=this._handler(this._data),g instanceof Promise))return g.then((v=>(this._data="",this._hitLimit=!1,v)));return this._data="",this._hitLimit=!1,g}}},8742:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class h{static fromArray(a){const f=new h;if(!a.length)return f;for(let g=Array.isArray(a[0])?1:0;g256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const a=new h(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){const a=[];for(let f=0;f>8,v=255&this._subParamsIdx[f];v-g>0&&a.push(Array.prototype.slice.call(this._subParams,g,v))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){const f=this._subParamsIdx[a]>>8,g=255&this._subParamsIdx[a];return g-f>0?this._subParams.subarray(f,g):null}getSubParamsAll(){const a={};for(let f=0;f>8,v=255&this._subParamsIdx[f];v-g>0&&(a[f]=this._subParams.slice(g,v))}return a}addDigit(a){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,v=g[f-1];g[f-1]=~v?Math.min(10*v+a,o):a}}r.Params=h},5741:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,h){const p={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(p),h.dispose=()=>this._wrappedAddonDispose(p),h.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let h=-1;for(let p=0;p{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const h=o(3785),p=o(511);r.BufferApiView=class{constructor(a,f){this._buffer=a,this.type=f}init(a){return this._buffer=a,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(a){const f=this._buffer.lines.get(a);if(f)return new h.BufferLineApiView(f)}getNullCell(){return new p.CellData}}},3785:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const h=o(511);r.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,a){if(!(p<0||p>=this._line.length))return a?(this._line.loadCell(p,a),a):this._line.loadCell(p,new h.CellData)}translateToString(p,a,f){return this._line.translateToString(p,a,f)}}},8285:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const h=o(8771),p=o(8460),a=o(844);class f extends a.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=f},7975:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,h){return this._core.registerCsiHandler(o,(p=>h(p.toArray())))}addCsiHandler(o,h){return this.registerCsiHandler(o,h)}registerDcsHandler(o,h){return this._core.registerDcsHandler(o,((p,a)=>h(p,a.toArray())))}addDcsHandler(o,h){return this.registerDcsHandler(o,h)}registerEscHandler(o,h){return this._core.registerEscHandler(o,h)}addEscHandler(o,h){return this.registerEscHandler(o,h)}registerOscHandler(o,h){return this._core.registerOscHandler(o,h)}addOscHandler(o,h){return this.registerOscHandler(o,h)}}},7090:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(A,r,o){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,x=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(e,s,t,i);else for(var b=e.length-1;b>=0;b--)(l=e[b])&&(x=(u<3?l(x):u>3?l(s,t,x):l(s,t))||x);return u>3&&x&&Object.defineProperty(s,t,x),x},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const a=o(8460),f=o(844),g=o(5295),v=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let m=r.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(e,this))}resize(e,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const t=this.buffer;let i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=t.getBlankLine(e,s),this._cachedBlankLine=i),i.isWrapped=s;const l=t.ybase+t.scrollTop,u=t.ybase+t.scrollBottom;if(t.scrollTop===0){const x=t.lines.isFull;u===t.lines.length-1?x?t.lines.recycle().copyFrom(i):t.lines.push(i.clone()):t.lines.splice(u+1,0,i.clone()),x?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const x=u-l+1;t.lines.shiftElements(l+1,x-1,-1),t.lines.set(u,i.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,s,t){const i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const l=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),l!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}};r.BufferService=m=h([p(0,v.IOptionsService)],m)},7994:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,h){this._charsets[o]=h,this.glevel===o&&(this.charset=h)}}},1753:function(A,r,o){var h=this&&this.__decorate||function(i,l,u,x){var b,d=arguments.length,S=d<3?l:x===null?x=Object.getOwnPropertyDescriptor(l,u):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,l,u,x);else for(var T=i.length-1;T>=0;T--)(b=i[T])&&(S=(d<3?b(S):d>3?b(l,u,S):b(l,u))||S);return d>3&&S&&Object.defineProperty(l,u,S),S},p=this&&this.__param||function(i,l){return function(u,x){l(u,x,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const a=o(2585),f=o(8460),g=o(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function m(i,l){let u=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(u|=64,u|=i.action):(u|=3&i.button,4&i.button&&(u|=64),8&i.button&&(u|=128),i.action===32?u|=32:i.action!==0||l||(u|=3)),u}const e=String.fromCharCode,s={DEFAULT:i=>{const l=[m(i,!1)+32,i.col+32,i.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${e(l[0])}${e(l[1])}${e(l[2])}`},SGR:i=>{const l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${m(i,!0)};${i.col};${i.row}${l}`},SGR_PIXELS:i=>{const l=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${m(i,!0)};${i.x};${i.y}${l}`}};let t=r.CoreMouseService=class extends g.Disposable{constructor(i,l){super(),this._bufferService=i,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const u of Object.keys(v))this.addProtocol(u,v[u]);for(const u of Object.keys(s))this.addEncoding(u,s[u]);this.reset()}addProtocol(i,l){this._protocols[i]=l}addEncoding(i,l){this._encodings[i]=l}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;const l=this._encodings[this._activeEncoding](i);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,l,u){if(u){if(i.x!==l.x||i.y!==l.y)return!1}else if(i.col!==l.col||i.row!==l.row)return!1;return i.button===l.button&&i.action===l.action&&i.ctrl===l.ctrl&&i.alt===l.alt&&i.shift===l.shift}};r.CoreMouseService=t=h([p(0,a.IBufferService),p(1,a.ICoreService)],t)},6975:function(A,r,o){var h=this&&this.__decorate||function(t,i,l,u){var x,b=arguments.length,d=b<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(t,i,l,u);else for(var S=t.length-1;S>=0;S--)(x=t[S])&&(d=(b<3?x(d):b>3?x(i,l,d):x(i,l))||d);return b>3&&d&&Object.defineProperty(i,l,d),d},p=this&&this.__param||function(t,i){return function(l,u){i(l,u,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const a=o(1439),f=o(8460),g=o(844),v=o(2585),m=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let s=r.CoreService=class extends g.Disposable{constructor(t,i,l){super(),this._bufferService=t,this._logService=i,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(m),this.decPrivateModes=(0,a.clone)(e)}reset(){this.modes=(0,a.clone)(m),this.decPrivateModes=(0,a.clone)(e)}triggerDataEvent(t,i=!1){if(this._optionsService.rawOptions.disableStdin)return;const l=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,(()=>t.split("").map((u=>u.charCodeAt(0))))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,(()=>t.split("").map((i=>i.charCodeAt(0))))),this._onBinary.fire(t))}};r.CoreService=s=h([p(0,v.IBufferService),p(1,v.ILogService),p(2,v.IOptionsService)],s)},9074:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const h=o(8055),p=o(8460),a=o(844),f=o(6106);let g=0,v=0;class m extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList((t=>t?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(t){if(t.marker.isDisposed)return;const i=new e(t);if(i){const l=i.marker.onDispose((()=>i.dispose()));i.onDispose((()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),l.dispose())})),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,i,l){var u,x,b;let d=0,S=0;for(const T of this._decorations.getKeyIterator(i))d=(u=T.options.x)!==null&&u!==void 0?u:0,S=d+((x=T.options.width)!==null&&x!==void 0?x:1),t>=d&&t{var b,d,S;g=(b=x.options.x)!==null&&b!==void 0?b:0,v=g+((d=x.options.width)!==null&&d!==void 0?d:1),t>=g&&t{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const h=o(2585),p=o(8343);class a{constructor(...g){this._entries=new Map;for(const[v,m]of g)this.set(v,m)}set(g,v){const m=this._entries.get(g);return this._entries.set(g,v),m}forEach(g){for(const[v,m]of this._entries.entries())g(v,m)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}r.ServiceCollection=a,r.InstantiationService=class{constructor(){this._services=new a,this._services.set(h.IInstantiationService,this)}setService(f,g){this._services.set(f,g)}getService(f){return this._services.get(f)}createInstance(f,...g){const v=(0,p.getServiceDependencies)(f).sort(((s,t)=>s.index-t.index)),m=[];for(const s of v){const t=this._services.get(s.id);if(!t)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);m.push(t)}const e=v.length>0?v[0].index:g.length;if(g.length!==e)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${e+1} conflicts with ${g.length} static arguments`);return new f(...g,...m)}}},7866:function(A,r,o){var h=this&&this.__decorate||function(e,s,t,i){var l,u=arguments.length,x=u<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(e,s,t,i);else for(var b=e.length-1;b>=0;b--)(l=e[b])&&(x=(u<3?l(x):u>3?l(s,t,x):l(s,t))||x);return u>3&&x&&Object.defineProperty(s,t,x),x},p=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const a=o(844),f=o(2585),g={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let v,m=r.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),v=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;sJSON.stringify(x))).join(", ")})`);const u=i.apply(this,l);return v.trace(`GlyphRenderer#${i.name} return`,u),u}}},7302:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const h=o(8460),p=o(844),a=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:a.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const f=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends p.Disposable{constructor(m){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e=Object.assign({},r.DEFAULT_OPTIONS);for(const s in m)if(s in e)try{const t=m[s];e[s]=this._sanitizeAndValidateOption(s,t)}catch(t){console.error(t)}this.rawOptions=e,this.options=Object.assign({},e),this._setupOptions()}onSpecificOptionChange(m,e){return this.onOptionChange((s=>{s===m&&e(this.rawOptions[m])}))}onMultipleOptionChange(m,e){return this.onOptionChange((s=>{m.indexOf(s)!==-1&&e()}))}_setupOptions(){const m=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},e=(s,t)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);t=this._sanitizeAndValidateOption(s,t),this.rawOptions[s]!==t&&(this.rawOptions[s]=t,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const t={get:m.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,t)}}_sanitizeAndValidateOption(m,e){switch(m){case"cursorStyle":if(e||(e=r.DEFAULT_OPTIONS[m]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${m}`);break;case"wordSeparator":e||(e=r.DEFAULT_OPTIONS[m]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=f.includes(e)?e:r.DEFAULT_OPTIONS[m];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${m} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${m} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${m} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${m} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}r.OptionsService=g},2660:function(A,r,o){var h=this&&this.__decorate||function(g,v,m,e){var s,t=arguments.length,i=t<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,m):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(g,v,m,e);else for(var l=g.length-1;l>=0;l--)(s=g[l])&&(i=(t<3?s(i):t>3?s(v,m,i):s(v,m))||i);return t>3&&i&&Object.defineProperty(v,m,i),i},p=this&&this.__param||function(g,v){return function(m,e){v(m,e,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const a=o(2585);let f=r.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const v=this._bufferService.buffer;if(g.id===void 0){const l=v.addMarker(v.ybase+v.y),u={data:g,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._dataByLinkId.set(u.id,u),u.id}const m=g,e=this._getEntryIdKey(m),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;const t=v.addMarker(v.ybase+v.y),i={id:this._nextId++,key:this._getEntryIdKey(m),data:m,lines:[t]};return t.onDispose((()=>this._removeMarkerFromLink(i,t))),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(g,v){const m=this._dataByLinkId.get(g);if(m&&m.lines.every((e=>e.line!==v))){const e=this._bufferService.buffer.addMarker(v);m.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(m,e)))}}getLinkData(g){var v;return(v=this._dataByLinkId.get(g))===null||v===void 0?void 0:v.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,v){const m=g.lines.indexOf(v);m!==-1&&(g.lines.splice(m,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};r.OscLinkService=f=h([p(0,a.IBufferService)],f)},8343:(A,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(p){return p[h]||[]},r.createDecorator=function(p){if(r.serviceRegistry.has(p))return r.serviceRegistry.get(p);const a=function(f,g,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(m,e,s){e[o]===e?e[h].push({id:m,index:s}):(e[h]=[{id:m,index:s}],e[o]=e)})(a,f,v)};return a.toString=()=>p,r.serviceRegistry.set(p,a),a}},2585:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const h=o(8343);var p;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.OFF=5]="OFF"})(p||(r.LogLevelEnum=p={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(A,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const h=o(8460),p=o(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const a=new p.UnicodeV6;this.register(a),this._active=a.version,this._activeProvider=a}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(a){if(!this._providers[a])throw new Error(`unknown Unicode version "${a}"`);this._active=a,this._activeProvider=this._providers[a],this._onChange.fire(a)}register(a){this._providers[a.version]=a}wcwidth(a){return this._activeProvider.wcwidth(a)}getStringCellWidth(a){let f=0;const g=a.length;for(let v=0;v=g)return f+this.wcwidth(m);const e=a.charCodeAt(v);56320<=e&&e<=57343?m=1024*(m-55296)+e-56320+65536:f+=this.wcwidth(e)}f+=this.wcwidth(m)}return f}}}},R={};function O(A){var r=R[A];if(r!==void 0)return r.exports;var o=R[A]={exports:{}};return w[A].call(o.exports,o,o.exports,O),o.exports}var H={};return(()=>{var A=H;Object.defineProperty(A,"__esModule",{value:!0}),A.Terminal=void 0;const r=O(9042),o=O(3236),h=O(844),p=O(5741),a=O(8285),f=O(7975),g=O(7090),v=["cols","rows"];class m extends h.Disposable{constructor(s){super(),this._core=this.register(new o.Terminal(s)),this._addonManager=this.register(new p.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=l=>this._core.options[l],i=(l,u)=>{this._checkReadonlyOptions(l),this._core.options[l]=u};for(const l in this._core.options){const u={get:t.bind(this,l),set:i.bind(this,l)};Object.defineProperty(this._publicOptions,l,u)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const s=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const t in s)this._publicOptions[t]=s[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(s,t){this._verifyIntegers(s,t),this._core.resize(s,t)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){var t,i,l;return this._checkProposedApi(),this._verifyPositiveIntegers((t=s.x)!==null&&t!==void 0?t:0,(i=s.width)!==null&&i!==void 0?i:0,(l=s.height)!==null&&l!==void 0?l:0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,t,i){this._verifyIntegers(s,t,i),this._core.select(s,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,t){this._verifyIntegers(s,t),this._core.selectLines(s,t)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,t){this._core.write(s,t)}writeln(s,t){this._core.write(s),this._core.write(`\r +`,t)}paste(s){this._core.paste(s)}refresh(s,t){this._verifyIntegers(s,t),this._core.refresh(s,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return r}_verifyIntegers(...s){for(const t of s)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const t of s)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}A.Terminal=m})(),H})()))})(Tt)),Tt.exports}var zn=Wn();const us="__SSHMANAGER__:",$n=/^ssh\s+(\S+)@(\S+)\s*$/i,Un=/^ssh\s+-p\s+(\d+)\s+(\S+)@(\S+)\s*$/i,qn=/^ssh\s+(\S+)\s*$/i;function Kn({connection:c,visible:_,fontSize:w,fontFamily:R,onStatusChange:O,onQuickConnect:H,credentialToken:A}){const r=F.useRef(null),o=F.useRef(null),h=F.useRef(null),p=F.useRef(null),a=F.useRef(null),f=F.useRef(null),g=F.useRef(null),v=F.useRef(_),m=F.useRef(()=>{}),[e,s]=F.useState("connecting"),[t,i]=F.useState(!1),l=F.useRef(null),u=F.useRef(""),x=F.useRef(""),b=F.useRef(H);b.current=H;const d=F.useRef(A);d.current=A,v.current=_,m.current=()=>{if(!v.current)return;const N=o.current;if(!N)return;h.current?.fit();const y=a.current;!y||y.readyState!==WebSocket.OPEN||y.send(us+JSON.stringify({type:"resize",cols:N.cols,rows:N.rows}))},F.useEffect(()=>{O?.(e)},[O,e]),F.useEffect(()=>{const N=o.current;if(!N)return;N.options.fontSize=w,N.options.fontFamily=R,h.current?.fit();const y=a.current;!y||y.readyState!==WebSocket.OPEN||y.send(us+JSON.stringify({type:"resize",cols:N.cols,rows:N.rows}))},[w,R]);const S=F.useCallback(N=>{const y=p.current,E=u.current;!y||!E||(N==="next"?y.findNext(E,{caseSensitive:!1}):y.findPrevious(E,{caseSensitive:!1}))},[]),T=F.useCallback(N=>{if(u.current=N,!N){p.current?.clearActiveDecoration();return}p.current?.findNext(N,{caseSensitive:!1,highlightAll:!0})},[]);return F.useEffect(()=>{let N=!1;const y=new zn.Terminal({cursorBlink:!0,fontSize:w,fontFamily:R,theme:{background:"#050816",foreground:"#dbeafe",cursor:"#67e8f9",selectionBackground:"rgba(103, 232, 249, 0.24)"}}),E=new an.FitAddon,D=new Fn;y.loadAddon(E),y.loadAddon(D),o.current=y,h.current=E,p.current=D,y.open(r.current),_&&(m.current(),y.focus());const B=y.onData(L=>{const M=x.current;if(L==="\r"||L===` +`){const j=M.trim();let $;if($=j.match(Un)){const V=parseInt($[1]),Y=$[2],X=$[3];x.current="",b.current?.(X,Y,V);return}else if($=j.match($n)){const V=$[1],Y=$[2];x.current="",b.current?.(Y,V,22);return}else if($=j.match(qn)){const V=$[1];x.current="",b.current?.(V,"root",22);return}x.current=""}else L===""?x.current=M.slice(0,-1):L.length===1&&L>=" "&&(x.current=M+L);a.current?.readyState===WebSocket.OPEN&&a.current.send(L)}),I=y.onResize(()=>{m.current()});f.current=new ResizeObserver(()=>{m.current()}),f.current.observe(r.current);const P=y.onKey(L=>{L.domEvent.ctrlKey&&L.domEvent.key==="f"&&(L.domEvent.preventDefault(),i(!0),setTimeout(()=>l.current?.focus(),50)),L.domEvent.key==="Escape"&&t&&(i(!1),D.clearActiveDecoration(),y.focus())}),C=()=>{const L=localStorage.getItem("token");if(!L){s("error");return}s("connecting");const M=window.location.protocol==="https:"?"wss:":"ws:",j=d.current;let $=`${M}//${window.location.host}/ws/terminal?connectionId=${c.id}&token=${encodeURIComponent(L)}`;j&&($+=`&credentialToken=${encodeURIComponent(j)}`);const V=new WebSocket($);a.current=V,V.onopen=()=>{s("connected"),m.current()},V.onmessage=Y=>{y.write(typeof Y.data=="string"?Y.data:"")},V.onclose=()=>{N||(s("reconnecting"),g.current=window.setTimeout(C,2e3))},V.onerror=()=>{s("error")}};return C(),()=>{N=!0,g.current&&window.clearTimeout(g.current),f.current?.disconnect(),a.current?.close(),B.dispose(),I.dispose(),P.dispose(),y.dispose()}},[c.id]),F.useEffect(()=>{if(!_)return;const N=window.requestAnimationFrame(()=>{m.current(),o.current?.focus()});return()=>window.cancelAnimationFrame(N)},[_]),n.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-black",children:[t?n.jsxs("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 rounded-lg border border-border-main bg-surface-card px-2.5 py-1.5 shadow-xl animate-in",children:[n.jsx("input",{ref:l,type:"text",placeholder:"搜索...",className:"w-40 bg-transparent px-1.5 py-0.5 text-xs text-content-main outline-none placeholder:text-content-dim",onChange:N=>T(N.target.value),onKeyDown:N=>{N.key==="Enter"&&S("next"),N.key==="Escape"&&(i(!1),p.current?.clearActiveDecoration(),o.current?.focus())}}),n.jsxs("div",{className:"flex items-center gap-0.5",children:[n.jsx("button",{className:"rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>S("prev"),title:"上一个",children:n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"m18 15-6-6-6 6"})})}),n.jsx("button",{className:"rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>S("next"),title:"下一个",children:n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"m6 9 6 6 6-6"})})}),n.jsx("button",{className:"ml-1 rounded p-1 text-content-dim hover:text-content-main transition",onClick:()=>{i(!1),p.current?.clearActiveDecoration(),o.current?.focus()},title:"关闭",children:n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})]}):null,n.jsx("div",{ref:r,className:"h-full w-full overflow-hidden"})]})}function Vn({open:c,connection:_,onSelect:w,onClose:R}){const[O,H]=F.useState([]);return c?n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:A=>{A.target===A.currentTarget&&R()},children:n.jsxs("div",{className:"flex h-[80vh] w-[80vw] max-w-5xl flex-col overflow-hidden rounded-2xl border border-border-main bg-surface-app shadow-2xl shadow-black/60",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border-main bg-surface-panel px-5 py-3.5",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-semibold text-content-main",children:"浏览远程文件"}),n.jsxs("p",{className:"mt-0.5 text-xs text-content-muted",children:["来源:",n.jsx("span",{className:"text-purple-400",children:_.name}),'· 单击选中,双击进入目录,点击底部"确认选择"完成']})]}),n.jsx("button",{className:"rounded-xl p-2 text-content-dim transition hover:bg-surface-muted hover:text-content-main",onClick:R,"aria-label":"关闭",children:n.jsx(At,{size:18})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(js,{connection:_,selectedFiles:O,onSelectedFilesChange:H,selectionMode:!0,onConfirmSelection:A=>{w(A),R()}})})]})}):null}function fs(c){const _=c.length||1,w=Math.round(c.reduce((r,o)=>r+o.progress,0)/_),R=c.every(r=>["success","error","cancelled"].includes(r.status)),O=c.some(r=>r.status==="error"),A=c.some(r=>r.status==="running"||r.status==="queued")?"running":O?"error":R?"success":"queued";return{progress:w,status:A}}function _s({status:c}){return c==="online"?n.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-emerald-500",title:"在线"}):c==="offline"?n.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-red-500",title:"离线"}):c==="checking"?n.jsx("span",{className:"h-2 w-2 shrink-0 animate-pulse rounded-full bg-yellow-400",title:"检测中"}):n.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-content-dim",title:"未知"})}function Gn({open:c,connections:_,connectionStatuses:w,tasks:R,onClose:O,onTasksChange:H}){const[A,r]=F.useState("local"),[o,h]=F.useState(_.length?[_[0].id]:[]),[p,a]=F.useState(null),[f,g]=F.useState("/usr/local/nginx/html"),[v,m]=F.useState(_[0]?.id??0),[e,s]=F.useState("/opt/app/build.tar.gz"),[t,i]=F.useState("/data/deploy/"),[l,u]=F.useState(!1);F.useEffect(()=>{_.length!==0&&m(D=>{if(D>0&&_.some(B=>B.id===D)){const B=w[D];return B==="online"||!B?D:_.find(P=>w[P.id]==="online")?.id??D}return _.find(B=>w[B.id]==="online")?.id??_[0]?.id??0})},[_,w]);const x=F.useMemo(()=>_.find(D=>D.id===v)??null,[_,v]),b=v>0&&x!==null,d=b&&w[v]==="online",S=A==="remote"?o.filter(D=>D!==v):o,T=!b||!d||S.length===0||!e.trim();if(!c)return null;function N(D,B){H(I=>I.map(P=>P.id===D?B(P):P))}async function y(){if(!p?.length||o.length===0)return;const D=p[0],B=String(Date.now()),I={id:B,mode:"LOCAL_TO_MANY",title:`本地文件批量分发 · ${D.name}`,status:"running",progress:0,createdAt:new Date().toLocaleTimeString(),items:o.map(P=>({id:`${B}-${P}`,label:_.find(C=>C.id===P)?.name||String(P),status:"queued",progress:0,message:"等待上传"}))};H(P=>[I,...P]),o.forEach(async P=>{const L=(await Ts(P,f,D,{overwrite:!0})).data.taskId;N(B,j=>({...j,items:j.items.map($=>$.label===_.find(V=>V.id===P)?.name?{...$,status:"running",message:"正在传输...",taskId:L}:$)}));const M=As(L,j=>{N(B,$=>{const V=$.items.map(X=>X.taskId===j.taskId?{...X,progress:j.progress,status:j.status,message:j.error||(j.status==="success"?"上传完成":j.status==="error"?"上传失败":"正在传输...")}:X),Y=fs(V);return{...$,items:V,progress:Y.progress,status:Y.status}}),["success","error"].includes(j.status)&&M()})})}async function E(){const D=S;if(!b||!d||D.length===0||!e.trim())return;const B=String(Date.now()),I=e.trim().split("/").filter(Boolean).pop()||e.trim(),P={id:B,mode:"REMOTE_TO_MANY",title:`跨主机分发 · ${I}`,status:"running",progress:0,createdAt:new Date().toLocaleTimeString(),items:D.map(C=>({id:`${B}-${C}`,label:_.find(L=>L.id===C)?.name||String(C),status:"queued",progress:0,message:"等待创建任务"}))};H(C=>[P,...C]),D.forEach(async C=>{const M=(await Ti(v,e,C,t)).data.taskId;N(B,$=>({...$,items:$.items.map(V=>V.label===_.find(Y=>Y.id===C)?.name?{...V,status:"running",message:"正在跨服同步...",taskId:M}:V)}));const j=Ai(M,$=>{N(B,V=>{const Y=V.items.map(ae=>ae.taskId===$.taskId?{...ae,progress:$.progress,status:$.status,message:$.error||($.status==="success"?"同步完成":$.status==="error"?"同步失败":$.status==="cancelled"?"已取消":"正在同步...")}:ae),X=fs(Y);return{...V,items:Y,progress:X.progress,status:X.status}}),["success","error","cancelled"].includes($.status)&&j()})})}return n.jsxs(n.Fragment,{children:[n.jsx(Ne,{title:"文件传输中心",onClose:O,maxWidth:"max-w-7xl",children:n.jsxs("div",{className:"flex h-[74vh] flex-col overflow-hidden rounded-2xl border border-border-main bg-surface-app",children:[n.jsxs("div",{className:"flex gap-8 border-b border-border-main bg-surface-panel px-6 pt-4",children:[n.jsx("button",{className:`border-b-2 pb-3 text-sm font-medium ${A==="local"?"border-blue-500 text-blue-400":"border-transparent text-content-muted"}`,onClick:()=>r("local"),children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(pt,{size:16}),"本地分发到多台"]})}),n.jsx("button",{className:`border-b-2 pb-3 text-sm font-medium ${A==="remote"?"border-purple-500 text-purple-400":"border-transparent text-content-muted"}`,onClick:()=>{r("remote"),u(!1)},children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Ht,{size:16}),"远程分发到多台"]})})]}),n.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[n.jsx("div",{className:"flex flex-1 overflow-hidden border-r border-border-main bg-surface-panel/70 p-6",children:A==="local"?n.jsxs("div",{className:"flex h-full flex-1 gap-6 overflow-hidden",children:[n.jsxs("div",{className:"flex w-1/2 shrink-0 flex-col gap-4 overflow-y-auto border-r border-border-main pr-6",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[n.jsx(pt,{size:16}),"源配置"]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"选择本地文件"}),n.jsxs("label",{className:"group flex cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-border-main bg-surface-muted/30 px-6 py-8 transition-all hover:border-blue-500 hover:bg-blue-500/5",children:[n.jsx("div",{className:"mb-3 rounded-full bg-surface-muted p-3 shadow-sm transition-colors group-hover:bg-blue-600",children:n.jsx(Nt,{size:24,className:"text-content-muted transition-colors group-hover:text-content-main"})}),n.jsx("span",{className:"text-sm font-medium text-content-main transition-colors group-hover:text-blue-400",children:p&&p.length>0?"重新选择文件":"点击选择本地文件"}),n.jsx("span",{className:"mt-1 max-w-full truncate text-xs text-content-dim",children:p&&p.length>0?n.jsx("span",{className:"text-emerald-400",children:p.length===1?p[0].name:`已选择 ${p.length} 个文件`}):"支持多选文件/文件夹"}),n.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:D=>a(D.target.files)})]})]}),n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"目标路径"}),n.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-sm text-content-main outline-none focus:border-blue-500",value:f,onChange:D=>g(D.target.value)})]}),n.jsxs("div",{className:"mt-auto rounded-xl border border-border-main bg-surface-muted/50 px-4 py-3 text-xs text-content-dim",children:[n.jsx("p",{className:"font-medium text-content-muted",children:"⚡ 并发执行"}),n.jsx("p",{className:"mt-1",children:"分发任务将按浏览器任务并行执行。"})]})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-hidden",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[n.jsx(Jt,{size:16}),"目标配置"]}),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-2",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"目标服务器"}),n.jsx("button",{className:"text-xs text-blue-400",onClick:()=>h(_.filter(D=>w[D.id]==="online").map(D=>D.id)),children:"全选在线"})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-2xl border border-border-main bg-surface-muted p-2",children:_.map(D=>{const B=w[D.id],I=B==="online";return n.jsxs("label",{className:`flex items-center gap-2 rounded-xl px-3 py-2 ${I?"cursor-pointer hover:bg-surface-panel":"cursor-not-allowed opacity-40"}`,children:[n.jsx("input",{type:"checkbox",disabled:!I,checked:o.includes(D.id),onChange:()=>h(P=>P.includes(D.id)?P.filter(C=>C!==D.id):[...P,D.id])}),n.jsx(_s,{status:B}),n.jsx("span",{className:"text-sm text-content-muted",children:D.name})]},D.id)})})]}),n.jsxs("button",{className:`flex w-full items-center justify-center gap-2 rounded-xl py-3 font-medium transition ${!p?.length||o.length===0?"cursor-not-allowed bg-surface-muted text-content-dim":"bg-blue-600 text-white hover:bg-blue-500"}`,disabled:!p?.length||o.length===0,onClick:()=>{y()},children:[n.jsx(ft,{size:18}),p?.length?o.length===0?"请选择目标服务器":"开始分发":"请选择本地文件"]})]})]}):n.jsxs("div",{className:"flex h-full flex-1 gap-6 overflow-hidden",children:[n.jsxs("div",{className:"flex w-1/2 shrink-0 flex-col gap-4 overflow-y-auto border-r border-border-main pr-6",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-purple-400",children:[n.jsx(Qt,{size:16}),"源配置"]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"源服务器"}),(()=>{const D=w[v];return D==="online"?n.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-emerald-500/15 px-2 py-0.5 text-xs font-medium text-emerald-400",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"}),"在线"]}):D==="offline"?n.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-red-500/15 px-2 py-0.5 text-xs font-medium text-red-400",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-400"}),"离线"]}):D==="checking"?n.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-400",children:[n.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-yellow-400"}),"检测中"]}):n.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-surface-muted/60 px-2 py-0.5 text-xs font-medium text-content-dim",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-content-dim"}),"未知"]})})()]}),n.jsxs("select",{className:`w-full rounded-xl border bg-surface-muted px-4 py-3 text-sm text-content-main outline-none ${d?"border-emerald-700":b&&w[v]==="offline"?"border-red-800":"border-border-main"}`,value:v,onChange:D=>{m(Number(D.target.value)),u(!1)},children:[!b&&n.jsx("option",{value:0,disabled:!0,children:"请选择源服务器"}),_.map(D=>{const B=w[D.id],I=B==="online",P=B==="online"||B==="offline"?"● ":B==="checking"?"◔ ":"◦ ";return n.jsxs("option",{value:D.id,disabled:!I,children:[P,D.name,I?"":B==="offline"?" (离线)":" (未知)"]},D.id)})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"源文件 / 文件夹路径"}),n.jsxs("button",{className:`flex items-center gap-1 rounded-lg px-2 py-1 text-xs transition ${l?"bg-purple-600 text-white":"border border-border-main text-content-muted hover:border-purple-500 hover:text-purple-400"}`,onClick:()=>u(D=>!D),children:[n.jsx(Pr,{size:12}),l?"收起":"浏览..."]})]}),n.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 font-mono text-sm text-content-main outline-none focus:border-blue-500",value:e,onChange:D=>s(D.target.value),placeholder:"/opt/app"})]}),n.jsxs("div",{className:"mt-auto rounded-xl border border-border-main bg-surface-muted/50 px-4 py-3 text-xs text-content-dim",children:[n.jsx("p",{className:"font-medium text-content-muted",children:"📁 支持文件夹传输"}),n.jsx("p",{className:"mt-1",children:"选择文件夹时,将在目标路径下创建同名子目录并递归传输所有内容。"})]})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-hidden",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-blue-400",children:[n.jsx(Jt,{size:16}),"目标配置"]}),n.jsxs("label",{className:"space-y-2",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"目标目录"}),n.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-muted px-4 py-3 text-sm text-content-main outline-none focus:border-blue-500",value:t,onChange:D=>i(D.target.value)})]}),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-2",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[n.jsx("span",{className:"text-sm text-content-muted",children:"目标服务器"}),n.jsx("button",{className:"text-xs text-blue-400",onClick:()=>h(A==="remote"?_.filter(D=>D.id!==v&&w[D.id]==="online").map(D=>D.id):_.filter(D=>w[D.id]==="online").map(D=>D.id)),children:"全选在线"})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-2xl border border-border-main bg-surface-muted p-2",children:(A==="remote"?_.filter(D=>D.id!==v):_).map(D=>{const B=w[D.id],I=B==="online";return n.jsxs("label",{className:`flex items-center gap-2 rounded-xl px-3 py-2 ${I?"cursor-pointer hover:bg-surface-panel":"cursor-not-allowed opacity-40"}`,children:[n.jsx("input",{type:"checkbox",disabled:!I,checked:o.includes(D.id),onChange:()=>h(P=>P.includes(D.id)?P.filter(C=>C!==D.id):[...P,D.id])}),n.jsx(_s,{status:B}),n.jsx("span",{className:"text-sm text-content-muted",children:D.name})]},D.id)})})]}),n.jsxs("button",{className:`flex w-full items-center justify-center gap-2 rounded-xl py-3 font-medium transition ${T?"cursor-not-allowed bg-surface-muted text-content-dim":"bg-purple-600 text-white hover:bg-purple-500"}`,disabled:T,onClick:()=>{E()},children:[n.jsx(Qt,{size:18,fill:"currentColor"}),!b||!v?"请选择源服务器":d?e.trim()?S.length===0?"请选择目标服务器":"跨服同步分发":"请填写源路径":"源服务器未在线"]})]})]})}),n.jsxs("div",{className:"flex w-[360px] shrink-0 flex-col bg-surface-app border-l border-border-main",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border-main bg-surface-panel px-4 py-4",children:[n.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-content-main",children:[n.jsx(Cs,{size:16,className:"text-content-muted"}),"任务状态"]}),n.jsx("button",{className:"text-xs text-content-dim hover:text-content-muted",onClick:()=>H([]),children:"清空记录"})]}),n.jsx("div",{className:"flex-1 space-y-4 overflow-auto p-3",children:R.length===0?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-content-dim",children:[n.jsx(Nt,{size:32,className:"mb-2 opacity-50"}),n.jsx("p",{className:"text-sm",children:"暂无传输任务"})]}):R.map(D=>n.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border-main bg-surface-panel",children:[n.jsxs("div",{className:"border-b border-border-subtle bg-surface-panel/90 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-start justify-between",children:[n.jsx("span",{className:"pr-2 text-sm font-medium text-content-main",children:D.title}),D.status==="running"?n.jsx("button",{className:"shrink-0 text-xs text-red-400 hover:text-red-300",onClick:()=>{D.items.forEach(B=>{B.taskId&&Mi(B.taskId)})},children:"取消"}):null]}),n.jsx("div",{className:"text-xs text-content-dim",children:D.createdAt})]}),n.jsx("div",{className:"max-h-48 space-y-1 overflow-auto bg-surface-app/60 p-2",children:D.items.map(B=>n.jsxs("div",{className:"rounded-xl p-2 hover:bg-surface-muted",children:[n.jsxs("div",{className:"flex justify-between text-xs",children:[n.jsx("span",{className:"truncate text-content-muted",children:B.label}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-content-dim",children:B.message}),n.jsxs("span",{className:B.status==="success"?"text-emerald-400":"text-blue-400",children:[B.progress,"%"]})]})]}),n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("div",{className:"h-1 flex-1 rounded-full bg-surface-muted",children:n.jsx("div",{className:`h-1 rounded-full ${B.status==="success"?"bg-emerald-500":B.status==="error"?"bg-red-500":"bg-blue-400"}`,style:{width:`${B.progress}%`}})}),B.status==="success"?n.jsx(St,{size:12,className:"text-emerald-500"}):B.status==="running"?n.jsx(it,{size:12,className:"animate-spin text-blue-400"}):null]})]},B.id))})]},D.id))})]})]})]})}),l&&n.jsx(Vn,{open:l,connection:_.find(D=>D.id===v)??_[0],onSelect:D=>{s(D),u(!1)},onClose:()=>u(!1)})]})}async function Xn(){return(await fe.get("/port-forwards")).data}async function Yn(c){try{return(await fe.post("/port-forwards",c)).data}catch(_){const w=_.response?.data?.error??_.message??"启动端口转发失败";throw new Error(w)}}async function Jn(c){try{await fe.delete(`/port-forwards/${c}`)}catch(_){const w=_.response?.data?.error??_.message??"停止端口转发失败";throw new Error(w)}}function Qn({open:c,connections:_,initialConnectionId:w,onClose:R}){const[O,H]=F.useState([]),[A,r]=F.useState(!1),[o,h]=F.useState(!1),[p,a]=F.useState(null),[f,g]=F.useState(0),[v,m]=F.useState(8080),[e,s]=F.useState("127.0.0.1"),[t,i]=F.useState(80),l=async(b=!0)=>{b&&r(!0),a(null);try{const d=await Xn();H(d)}catch(d){a(d.message??"获取端口转发列表失败")}finally{b&&r(!1)}};F.useEffect(()=>{c&&(l(!0),w?g(w):_.length>0&&g(_[0].id))},[c,w,_]);const u=async b=>{if(b.preventDefault(),!f){a("请选择 SSH 连接");return}a(null),h(!0);try{await Yn({connectionId:f,localPort:v,remoteHost:e.trim(),remotePort:t}),m(d=>d+1),await l(!1)}catch(d){a(d.message??"启动端口转发失败")}finally{h(!1)}},x=async b=>{a(null);try{await Jn(b),await l(!1)}catch(d){a(d.message??"停止端口转发失败")}};return c?n.jsx(Ne,{title:"端口转发管理",onClose:R,open:c,maxWidth:"max-w-5xl",children:n.jsxs("div",{className:"flex flex-col gap-6 md:flex-row",children:[n.jsxs("div",{className:"flex-1 rounded-2xl border border-border-main bg-surface-muted/30 p-5 md:max-w-xs lg:max-w-sm",children:[n.jsxs("h4",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-content-main",children:[n.jsx(ws,{size:16,className:"text-emerald-500"}),"新建端口转发通道"]}),n.jsxs("form",{onSubmit:u,className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-content-muted",children:"SSH 连接通道"}),n.jsx("select",{value:f,onChange:b=>g(Number(b.target.value)),className:"w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition",children:_.length===0?n.jsx("option",{value:0,children:"暂无可用连接"}):_.map(b=>n.jsxs("option",{value:b.id,children:[b.name," (",b.host,")"]},b.id))})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-content-muted",children:"本地侦听端口 (Local Port)"}),n.jsx("input",{type:"number",min:1,max:65535,value:v,onChange:b=>m(Number(b.target.value)),className:"w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition",required:!0})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[n.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-content-muted",children:"目标主机 (Remote Host)"}),n.jsx("input",{type:"text",value:e,onChange:b=>s(b.target.value),className:"w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition",required:!0})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs font-medium text-content-muted",children:"目标端口"}),n.jsx("input",{type:"number",min:1,max:65535,value:t,onChange:b=>i(Number(b.target.value)),className:"w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition",required:!0})]})]}),p&&n.jsxs("div",{className:"flex gap-2 rounded-xl bg-red-500/10 p-3 text-xs text-red-300 border border-red-500/20",children:[n.jsx(Mt,{size:16,className:"shrink-0 text-red-400"}),n.jsx("span",{children:p})]}),n.jsx("button",{type:"submit",disabled:o||_.length===0,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-emerald-600 py-2.5 text-sm font-semibold text-white transition hover:bg-emerald-500 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",children:o?"正在启动...":"启动转发"})]})]}),n.jsxs("div",{className:"flex-1 flex flex-col",children:[n.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[n.jsxs("h4",{className:"flex items-center gap-2 text-sm font-semibold text-content-main",children:[n.jsx(jt,{size:16,className:"text-blue-500 animate-pulse"}),"活动转发列表"]}),n.jsx("button",{onClick:()=>l(!0),disabled:A,className:"rounded-xl border border-border-main bg-surface-muted p-2 text-content-muted transition hover:text-content-main hover:bg-surface-panel",title:"刷新列表",children:n.jsx(it,{size:14,className:A?"animate-spin":""})})]}),n.jsx("div",{className:"flex-1 overflow-auto max-h-[400px] rounded-2xl border border-border-main bg-surface-panel/40 p-4",children:A&&O.length===0?n.jsx("div",{className:"flex h-48 items-center justify-center text-xs text-content-dim",children:"加载中..."}):O.length===0?n.jsxs("div",{className:"flex h-48 flex-col items-center justify-center text-content-dim",children:[n.jsx(jt,{size:36,className:"mb-2 text-content-dim/30"}),n.jsx("span",{className:"text-xs",children:"暂无活动的端口转发通道"})]}):n.jsx("div",{className:"space-y-3",children:O.map(b=>n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-border-subtle bg-surface-card p-3.5 transition hover:border-border-main",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-content-main",children:[n.jsx("span",{className:"max-w-[120px] truncate text-blue-400",children:b.connectionName}),n.jsx("span",{className:"text-content-dim font-normal",children:"|"}),n.jsxs("span",{className:"text-emerald-500 font-mono",children:[":",b.localPort]}),n.jsx("span",{className:"text-content-dim font-normal",children:"→"}),n.jsxs("span",{className:"text-content-muted font-mono",children:[b.remoteHost,":",b.remotePort]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-content-dim",children:[n.jsxs("span",{children:["启动时间: ",new Date(b.createdAt).toLocaleTimeString()]}),n.jsx("span",{className:"h-1 w-1 rounded-full bg-content-dim"}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${b.status==="running"?"bg-emerald-500 animate-pulse":b.status==="error"?"bg-red-500":"bg-content-muted"}`}),b.status==="running"?"运行中":b.status==="error"?"异常":"已停止"]})]})]}),n.jsxs("button",{onClick:()=>x(b.id),className:"self-end sm:self-center flex items-center gap-1 rounded-lg border border-red-500/20 bg-red-500/5 px-2 py-1 text-[11px] font-medium text-red-300 transition hover:bg-red-500/10 hover:text-red-200",children:[n.jsx(Sr,{size:12}),"停止"]})]},b.id))})})]})]})}):null}const Zn={idle:{label:"终端未打开",tone:"text-content-muted",dot:"bg-content-muted"},connecting:{label:"WebSocket 连接中",tone:"text-amber-300",dot:"bg-amber-400"},connected:{label:"WebSocket 已连接",tone:"text-emerald-300",dot:"bg-emerald-400"},reconnecting:{label:"连接中断,重试中",tone:"text-amber-300",dot:"bg-amber-400"},error:{label:"WebSocket 连接异常",tone:"text-red-300",dot:"bg-red-400"}},ms={visible:!1,x:0,y:0,targetId:null,targetType:null};function ps(c,_,w){const O=w*36+8,H=8;return{x:Math.max(H,Math.min(c,window.innerWidth-176-H)),y:Math.max(H,Math.min(_,window.innerHeight-O-H))}}function gs(c,_){return Object.fromEntries(Object.entries(c).filter(([w])=>!_.has(Number(w))))}function vs(c){return`${c}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const eo={tabs:[],currentTabKey:null,terminalStatuses:{}};function to(c,_){switch(_.type){case"ACTIVATE_TAB":return c.currentTabKey===_.tabId?c:{...c,currentTabKey:_.tabId};case"OPEN_CONNECTION":{const w=c.tabs.find(R=>R.connection.id===_.connection.id);return w?{...c,currentTabKey:w.tabId,tabs:c.tabs.map(R=>R.tabId===w.tabId?{...R,name:_.connection.name,connection:_.connection}:R)}:{tabs:[...c.tabs,{tabId:_.tabId,name:_.connection.name,connection:_.connection}],currentTabKey:_.tabId,terminalStatuses:{...c.terminalStatuses,[_.tabId]:"connecting"}}}case"CLOSE_TAB":{const w=c.tabs.filter(O=>O.tabId!==_.tabId),R={...c.terminalStatuses};return delete R[_.tabId],{tabs:w,currentTabKey:c.currentTabKey===_.tabId?w[w.length-1]?.tabId??null:c.currentTabKey,terminalStatuses:R}}case"CLOSE_ALL":return{tabs:[],currentTabKey:null,terminalStatuses:{}};case"DUPLICATE_TAB":{const w=c.tabs.findIndex(A=>A.tabId===_.tabId);if(w===-1)return c;const R=c.tabs[w],O={tabId:_.newTabId,name:R.name,connection:R.connection},H=[...c.tabs];return H.splice(w+1,0,O),{tabs:H,currentTabKey:_.newTabId,terminalStatuses:{...c.terminalStatuses,[_.newTabId]:"connecting"}}}case"UPDATE_CONNECTION":return{...c,tabs:c.tabs.map(w=>w.connection.id===_.connectionId?{...w,name:_.name,connection:_.connection}:w)};case"REMOVE_CONNECTIONS":{const w=c.tabs.filter(H=>!_.connectionIds.has(H.connection.id)),R=new Set(c.tabs.filter(H=>_.connectionIds.has(H.connection.id)).map(H=>H.tabId)),O={...c.terminalStatuses};for(const H of R)delete O[H];return{tabs:w,currentTabKey:c.currentTabKey!=null&&R.has(c.currentTabKey)?w[w.length-1]?.tabId??null:c.currentTabKey,terminalStatuses:O}}case"SET_TERMINAL_STATUS":return c.terminalStatuses[_.tabId]===_.status?c:{...c,terminalStatuses:{...c.terminalStatuses,[_.tabId]:_.status}};default:return c}}function no({initialTool:c,onLogout:_}){const{user:w,logout:R}=bs(),O=or(),[H,A]=F.useState([]),[r,o]=F.useState("split"),[h,p]=F.useState(null),[a,f]=F.useState(""),[g,v]=F.useReducer(to,eo),{tabs:m,currentTabKey:e,terminalStatuses:s}=g,[t,i]=F.useState(null),[l,u]=F.useState([]),[x,b]=F.useState(!1),[d,S]=F.useState(!1),[T,N]=F.useState(null),[y,E]=F.useState(null),[D,B]=F.useState(!1),[I,P]=F.useState(c==="transfers"),[C,L]=F.useState(!1),[M,j]=F.useState(!1),[$,V]=F.useState(null),[Y,X]=F.useState({}),[ae,k]=F.useState(!!w?.passwordChangeRequired),[W,q]=F.useState([]),[U,ee]=F.useState({}),[Q,ne]=F.useState({}),[_e,ce]=F.useState({}),[Ae,re]=F.useState(null),[Pe,We]=F.useState(!1),[he,xe]=F.useState(ms),[pe,Se]=F.useState({visible:!1,x:0,y:0,targetTabId:null}),[je,be]=wt("ssh-manager.terminal-font-size",14),[Ie,Ue]=wt("ssh-manager.terminal-font-family",'"IBM Plex Mono", ui-monospace, SFMono-Regular, monospace'),[ye,qe]=wt("ssh-manager.dark-mode",!0),[we,Ee]=F.useState(null),[le,Xe]=F.useState("");F.useEffect(()=>{document.documentElement.classList.toggle("dark",ye)},[ye]),F.useEffect(()=>{k(!!w?.passwordChangeRequired)},[w?.passwordChangeRequired]),F.useEffect(()=>{const K=new Set(H.map(J=>J.id));ne(J=>Object.fromEntries(Object.entries(J).filter(([Z])=>K.has(Number(Z))))),ce(J=>Object.fromEntries(Object.entries(J).filter(([Z])=>K.has(Number(Z)))))},[H]),F.useEffect(()=>{let K=!1;return(async()=>{const J=await Gt();if(K)return;const Z=J.data;A(Z);try{const te=await Pi();if(K)return;const ie=te.data.nodes.length?te.data:_t(Z),me=Zt(ie,Z);p(me),JSON.stringify(te.data)!==JSON.stringify(me)&&await rs(me)}catch{if(K)return;p(_t(Z))}})(),()=>{K=!0}},[]);const nt=F.useMemo(()=>Rs(h,H),[h,H]),et=F.useMemo(()=>xi(h,H),[h,H]),ot=F.useMemo(()=>[...new Set(m.map(K=>K.connection.id))],[m]),He=m.find(K=>K.tabId===e)?.connection??null,z=He?s[e??""]??"connecting":"idle",G=h?.nodes.some(K=>K.type==="folder")??!1,se=h?.nodes.some(K=>K.type==="folder"&&K.expanded===!1)??!1,ge=F.useMemo(()=>y?Ci(h,y.id):es(h,t),[y,t,h]);F.useEffect(()=>{if(!He){ee({});return}let K=!1;const J=async()=>{try{const te=await dr(He.id);K||ee(te.data)}catch{K||ee({})}};J();const Z=window.setInterval(J,5e3);return()=>{K=!0,window.clearInterval(Z)}},[He?.id]),F.useEffect(()=>{H.length===0||H.some(J=>{const Z=Q[J.id];return Z==="online"||Z==="offline"||Z==="checking"})||Me({connectionList:H})},[H]);function ke(K=H){return Zt(h??_t(K),K)}async function Me(K){const J=K?.connectionList??H;if(J.length===0){ne({}),ce({}),re(null);return}We(!0),re(null);const Z=J.map(te=>te.id);ne(te=>({...te,...Object.fromEntries(Z.map(ie=>[ie,"checking"]))}));try{const te=await lr(Z),ie=Object.fromEntries(te.data.results.map(Ce=>[Ce.connectionId,Ce])),me=Object.fromEntries(te.data.results.map(Ce=>[Ce.connectionId,Ce.status]));ce(Ce=>({...Ce,...ie})),ne(Ce=>({...Ce,...me}))}catch(te){if(re(te.response?.data?.message||"主机状态检测失败"),ne(ie=>({...ie,...Object.fromEntries(Z.map(me=>[me,ie[me]==="online"||ie[me]==="offline"?ie[me]:"unknown"]))})),K?.throwOnError)throw te}finally{We(!1)}}async function Ke(){await Me({throwOnError:!0})}async function de(K){p(K),await rs(K)}function Le(K){return h?.nodes.find(J=>J.id===K)??null}function ve(){xe(ms)}function at(K,J){F.startTransition(()=>{v({type:"OPEN_CONNECTION",connection:K,tabId:vs(K.id)}),u([]),J&&i(J)})}async function Ks(K){const J=vi(h,K);J&&await de(J)}async function Vs(){const K=ke();if(!K.nodes.some(ie=>ie.type==="folder"))return;const Z=K.nodes.some(ie=>ie.type==="folder"&&ie.expanded===!1),te=bi(K,Z);te&&await de(te)}async function Gs(K){const J=ke(),{layout:Z,nodeId:te}=yi(J,K.name,K.parentId);i(te),await de(Z)}async function Xs(K){if(!T)return;const J=ki(ke(),T,K);J&&await de(J)}function Ys(K){const J=ps(K.x,K.y,K.nodeType==="folder"?4:2);i(K.nodeId),tt(),xe({visible:!0,x:J.x,y:J.y,targetId:K.nodeId,targetType:K.nodeType})}function Js(K,J,Z){const te=new Map(K.nodes.map(me=>[me.id,me]));let ie=te.get(Z)??null;for(;ie?.parentId;){if(ie.parentId===J)return!0;ie=te.get(ie.parentId)??null}return!1}function qt(K,J,Z){const te=new Set(Z);i(ie=>ie&&(te.has(ie)||Js(K,ie,J)?null:ie))}function Kt(K){if(K.length===0)return;const J=new Set(K);A(Z=>Z.filter(te=>!J.has(te.id))),v({type:"REMOVE_CONNECTIONS",connectionIds:J}),u([]),ne(Z=>gs(Z,J)),ce(Z=>gs(Z,J))}async function Qs(){const{targetId:K,targetType:J}=he;if(ve(),!K||!J)return;if(J==="folder"){const ie=Le(K);if(!ie||ie.type!=="folder")return;N(K);return}const Z=Le(K);if(Z?.type!=="connection"||!Z.connectionId)return;const te=H.find(ie=>ie.id===Z.connectionId)??null;te&&(E(te),b(!0))}async function Zs(){const{targetId:K,targetType:J}=he;if(ve(),!K||!J)return;const Z=ke(),te=Z.nodes.find(Ce=>Ce.id===K);if(!te)return;const ie=Ei(Z,K);if(!ie)return;if(J==="connection"){if(te.type!=="connection"||!te.connectionId||!window.confirm("确认永久删除该 SSH 连接?"))return;await Xt(te.connectionId),await de(ie.layout),Kt([te.connectionId]),qt(Z,K,ie.deletedNodeIds);return}window.confirm("确认删除该文件夹?将同时删除其下所有子文件夹与连接。")&&te.type==="folder"&&(ie.deletedConnectionIds.length>0&&await Promise.all(ie.deletedConnectionIds.map(Ce=>Xt(Ce))),await de(ie.layout),Kt(ie.deletedConnectionIds),qt(Z,K,ie.deletedNodeIds))}async function er(K){const J=y,{targetFolderId:Z,...te}=K,me=(J?await ur(J.id,te):await fr(te)).data,Ve=(await Gt()).data,Re=Ve.find(Ye=>Ye.id===me.id)??me;A(Ve);const lt=wi(ke(Ve),Re,Z),ct=Si(lt,Re.id);if(await de(lt),b(!1),E(null),J){i(ct),v({type:"UPDATE_CONNECTION",connectionId:Re.id,name:Re.name,connection:Re}),ce(Ye=>Ye[Re.id]?{...Ye,[Re.id]:{...Ye[Re.id],connectionName:Re.name}}:Ye);return}at(Re,ct)}function tr(K){v({type:"CLOSE_TAB",tabId:K})}function tt(){Se({visible:!1,x:0,y:0,targetTabId:null})}function sr(){v({type:"CLOSE_ALL"}),u([]),tt()}function rr(K){const J=m.find(Z=>Z.tabId===K);J&&(v({type:"DUPLICATE_TAB",tabId:K,newTabId:vs(J.connection.id)}),u([]),tt())}function ir(K){const J=m.find(Z=>Z.tabId===K);J&&(Ee(K),Xe(J.name),tt())}function Vt(){if(!we||!le.trim()){Ee(null);return}const K=m.find(J=>J.tabId===we);if(!K){Ee(null);return}v({type:"UPDATE_CONNECTION",connectionId:K.connection.id,name:le.trim(),connection:K.connection}),Ee(null)}async function nr(K){try{const J=await _r(K);A(Z=>Z.map(te=>te.id===K?{...te,pinned:J.data.pinned}:te))}catch{}}const yt=Zn[z];return n.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface-app text-content-main",children:[n.jsxs("header",{className:"flex h-14 items-center justify-between border-b border-border-main bg-surface-panel px-4 shadow-sm",children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsxs("div",{className:"flex items-center gap-2 text-lg font-semibold tracking-wide text-blue-400",children:[n.jsx(dt,{size:22}),n.jsxs("span",{children:["SSH",n.jsx("span",{className:"text-content-main",children:"Manager"})]})]}),n.jsx("div",{className:"h-6 w-px bg-border-main"}),n.jsxs("nav",{className:"flex items-center gap-1",children:[n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>O("/dashboard"),children:[n.jsx(pt,{size:16,className:"text-cyan-400"}),"仪表盘"]}),n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>B(!0),children:[n.jsx(Ss,{size:16,className:"text-purple-400"}),"批量执行"]}),n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>P(!0),children:[n.jsx(Nt,{size:16,className:"text-blue-400"}),"传输中心"]}),n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{V(null),j(!0)},children:[n.jsx(jt,{size:16,className:"text-emerald-400"}),"端口转发"]}),n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:async()=>{try{const K=await Oi(),J=new Blob([K.data],{type:"text/plain"}),Z=URL.createObjectURL(J),te=document.createElement("a");te.href=Z,te.download="ssh-config.txt",document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(Z)}catch{}},title:"导出 SSH 配置",children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-amber-400",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"导出配置"]}),w?.role==="ROLE_ADMIN"&&n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>O("/users"),children:[n.jsx(_i,{size:16,className:"text-emerald-400"}),"用户管理"]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{className:"rounded-full p-2 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>L(!0),children:n.jsx(ii,{size:18})}),n.jsx("div",{className:"rounded-full border border-border-main bg-surface-app px-3 py-1.5 text-sm text-content-muted",children:w?.displayName||w?.username}),n.jsxs("button",{className:"flex items-center gap-2 rounded-md px-2 py-1 text-sm text-content-muted transition hover:text-red-400",onClick:()=>{R(),_()},children:[n.jsx(Xr,{size:16}),"退出"]})]})]}),n.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[n.jsxs("aside",{className:"flex w-72 shrink-0 flex-col border-r border-border-main bg-surface-panel",children:[n.jsxs("div",{className:"flex flex-col gap-3 border-b border-border-main px-4 py-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"text-sm font-medium text-content-muted",children:"会话管理"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",className:ue("rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",G?"":"cursor-not-allowed text-content-dim hover:bg-transparent hover:text-content-dim"),disabled:!G,onClick:()=>{Vs()},title:G?se?"全部展开":"全部折叠":"暂无文件夹","aria-label":G?se?"全部展开":"全部折叠":"暂无文件夹",children:n.jsx(Cs,{size:14})}),n.jsx("button",{type:"button",className:"rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ve(),S(!0)},title:"新建文件夹","aria-label":"新建文件夹",children:n.jsx(Qe,{size:14})}),n.jsx("button",{type:"button",className:"rounded-md p-1.5 text-content-muted transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ve(),E(null),b(!0)},title:"新建连接","aria-label":"新建连接",children:n.jsx(vt,{size:14})})]})]}),n.jsxs("div",{className:"relative",children:[n.jsx(ks,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-content-dim"}),n.jsx("input",{className:"w-full rounded-md border border-border-main bg-surface-control py-1.5 pl-8 pr-3 text-xs text-content-main outline-none transition-colors placeholder:text-content-dim focus:border-border-subtle focus:bg-surface-panel",placeholder:"搜索主机...",value:a,onChange:K=>f(K.target.value)})]})]}),n.jsx("div",{className:"flex-1 overflow-auto p-2",onClick:K=>{K.target===K.currentTarget&&(ve(),i(null))},children:n.jsx(Xi,{nodes:nt,activeConnectionId:He?.id??null,connectionStatuses:Q,openConnectionIds:ot,selectedNodeId:t,search:a,onSelectNode:i,onToggleFolder:K=>{Ks(K)},onOpenConnection:at,onContextMenu:Ys,onTogglePin:nr})})]}),n.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-surface-app",children:[n.jsxs("div",{className:"flex h-10 border-b border-border-main bg-surface-panel",children:[m.length===0?n.jsx("div",{className:"h-full flex-1"}):null,m.map(K=>{const J=we===K.tabId;return n.jsxs("button",{className:ue("group flex h-full min-w-[160px] max-w-[220px] items-center gap-2 border-r border-border-main px-4 text-sm transition",e===K.tabId?"bg-surface-app text-content-main":"text-content-muted hover:bg-surface-muted hover:text-content-main"),onClick:()=>{J||v({type:"ACTIVATE_TAB",tabId:K.tabId})},onContextMenu:Z=>{if(Z.preventDefault(),J)return;ve();const te=ps(Z.clientX,Z.clientY,3);Se({visible:!0,x:te.x,y:te.y,targetTabId:K.tabId})},children:[n.jsx(dt,{size:14,className:e===K.tabId?"text-emerald-400":"text-content-dim"}),J?n.jsx("input",{className:"flex-1 min-w-0 bg-transparent border-b border-cyan-400 text-sm text-content-main outline-none",value:le,onChange:Z=>Xe(Z.target.value),onBlur:Vt,onKeyDown:Z=>{Z.key==="Enter"&&Vt(),Z.key==="Escape"&&Ee(null)},onClick:Z=>Z.stopPropagation(),autoFocus:!0}):n.jsx("span",{className:"flex-1 truncate",children:K.name}),n.jsx("span",{className:"opacity-0 transition group-hover:opacity-100",onClick:Z=>{Z.stopPropagation(),tr(K.tabId)},children:"×"})]},K.tabId)})]}),n.jsxs("div",{className:"flex h-11 items-center justify-between border-b border-border-main bg-surface-panel px-4",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-4 overflow-hidden text-xs",children:[n.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[n.jsx(cr,{size:14,className:"text-emerald-400"}),"CPU: ",U.cpuUsage??"-","%"]}),n.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[n.jsx($r,{size:14,className:"text-blue-400"}),"MEM: ",st(U.memUsed??null)," / ",st(U.memTotal??null)]}),n.jsxs("div",{className:ue("flex items-center gap-2 truncate",yt.tone),children:[n.jsx("span",{className:ue("h-2 w-2 rounded-full",yt.dot)}),yt.label]})]}),n.jsxs("div",{className:"ml-3 flex items-center rounded-lg border border-border-subtle bg-surface-panel p-1",children:[n.jsx("button",{className:ue("rounded-md p-2 transition",r==="terminal"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>o("terminal"),title:"终端",children:n.jsx(dt,{size:15})}),n.jsx("button",{className:ue("rounded-md p-2 transition",r==="sftp"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>o("sftp"),title:"SFTP",children:n.jsx(Qe,{size:15})}),n.jsx("button",{className:ue("rounded-md p-2 transition",r==="split"?"bg-surface-muted text-content-main":"text-content-muted hover:text-content-main"),onClick:()=>o(r==="split"?"terminal":"split"),title:r==="split"?"切换到终端":"分屏",children:n.jsx(oi,{size:15})})]})]}),n.jsx("div",{className:"relative flex-1 overflow-hidden",children:He?n.jsxs("div",{className:`flex h-full min-w-0 ${r==="split"?"flex-row":"flex-col"}`,children:[n.jsx("div",{className:ue("relative min-w-0 flex-1 overflow-hidden",r==="split"&&"w-1/2 border-r border-border-main",r==="terminal"&&"w-full",r==="sftp"&&"hidden"),children:m.map(K=>{const J=K.tabId===e&&r!=="sftp";return n.jsx("div",{className:ue("absolute inset-0",!J&&"hidden"),children:n.jsx(Kn,{connection:K.connection,visible:J,fontSize:je,fontFamily:Ie,credentialToken:Y[K.connection.id],onStatusChange:Z=>{v({type:"SET_TERMINAL_STATUS",tabId:K.tabId,status:Z})},onQuickConnect:async(Z,te,ie)=>{try{const me=window.prompt(`输入 ${te}@${Z} 的密码:`);if(!me)return;const Ce=await hr(Z,te,ie,me),{connection:Ve,credentialToken:Re}=Ce.data,lt=`${Ve.id}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;X(ct=>({...ct,[Ve.id]:Re})),v({type:"OPEN_CONNECTION",connection:Ve,tabId:lt})}catch(me){console.error("Quick connect failed",me)}}})},K.tabId)})}),(r==="split"||r==="sftp")&&n.jsx("div",{className:`${r==="split"?"min-w-0 w-1/2":"w-full"} overflow-hidden`,children:n.jsx(js,{connection:He,selectedFiles:l,onSelectedFilesChange:u})})]}):n.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-content-dim",children:[n.jsx(pt,{size:64,className:"mb-4 text-surface-muted"}),n.jsx("h2",{className:"mb-2 text-xl font-medium text-content-muted",children:"欢迎使用 SSH Manager"}),n.jsx("p",{className:"text-sm",children:"请在左侧双击服务器节点建立连接,或先创建新的会话。"}),n.jsxs("button",{className:"mt-6 flex items-center gap-2 rounded-xl border border-blue-600/30 bg-blue-600/10 px-6 py-2 text-blue-300 transition hover:bg-blue-600/20",onClick:()=>{E(null),b(!0)},children:[n.jsx(vt,{size:16}),"创建新连接"]})]})})]})]}),n.jsx(qi,{open:x,connection:y,folderOptions:et,initialTargetFolderId:ge,onClose:()=>{b(!1),E(null)},onSubmit:er}),n.jsx(Ki,{open:d,folderOptions:et,initialParentId:es(h,t),onClose:()=>S(!1),onSubmit:Gs}),n.jsx(Vi,{open:!!T,initialName:T&&Le(T)?.name||"",onClose:()=>N(null),onSubmit:Xs}),n.jsx($i,{open:D,connections:H,connectionStatuses:Q,connectionStatusDetails:_e,statusError:Ae,statusLoading:Pe,onRefreshStatuses:Ke,onClose:()=>B(!1)}),n.jsx(Gn,{open:I,connections:H,connectionStatuses:Q,tasks:W,onTasksChange:q,onClose:()=>P(!1)}),n.jsx(sn,{open:C,onClose:()=>L(!1),terminalFontSize:je,terminalFontFamily:Ie,onFontSizeChange:be,onFontFamilyChange:Ue,darkMode:ye,onDarkModeChange:qe}),n.jsx(Qn,{open:M,connections:H,initialConnectionId:$,onClose:()=>j(!1)}),ae?n.jsx(Ui,{force:!!w?.passwordChangeRequired,onClose:()=>k(!1)}):null,he.visible?n.jsx("div",{className:"fixed inset-0 z-50",onClick:ve,children:n.jsxs("div",{className:"absolute min-w-44 rounded-xl border border-border-subtle bg-surface-panel p-1 shadow-2xl shadow-black/40",onClick:K=>K.stopPropagation(),style:{left:he.x,top:he.y},children:[he.targetType==="folder"?n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ve(),E(null),b(!0)},children:"新建连接"}),n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{ve(),S(!0)},children:"新建文件夹"})]}):n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{const K=he.targetId;if(ve(),!K)return;const J=Le(K);J&&J.type==="connection"&&J.connectionId&&(V(J.connectionId),j(!0))},children:"端口转发"}),n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{Qs()},children:"编辑"}),n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-red-300 transition hover:bg-red-500/10 hover:text-red-200",onClick:()=>{Zs()},children:"删除"})]})}):null,pe.visible?n.jsx("div",{className:"fixed inset-0 z-50",onClick:tt,children:n.jsxs("div",{className:"absolute min-w-40 rounded-xl border border-border-subtle bg-surface-panel p-1 shadow-2xl shadow-black/40",onClick:K=>K.stopPropagation(),style:{left:pe.x,top:pe.y},children:[n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{pe.targetTabId&&ir(pe.targetTabId)},children:"重命名"}),n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:()=>{pe.targetTabId&&rr(pe.targetTabId)},children:"复制标签"}),n.jsx("button",{className:"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-content-main transition hover:bg-surface-muted hover:text-content-main",onClick:sr,children:"关闭所有标签"})]})}):null]})}export{no as default}; diff --git a/backend/src/main/resources/static/assets/index-B4Duc4SL.css b/backend/src/main/resources/static/assets/index-B4Duc4SL.css deleted file mode 100644 index 90e5b9c..0000000 --- a/backend/src/main/resources/static/assets/index-B4Duc4SL.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--app-bg-0: #020617;--app-bg-1: #0a1626;--app-card: rgba(15, 23, 42, .72);--app-border: rgba(148, 163, 184, .16);--surface-app: #020617;--surface-panel: #0a1626;--surface-card: #0f172a;--surface-muted: rgba(30, 41, 59, .5);--surface-control: #020617;--border-main: rgba(148, 163, 184, .16);--border-subtle: rgba(148, 163, 184, .08);--text-main: #f1f5f9;--text-muted: #94a3b8;--text-dim: #64748b}html{color-scheme:dark;scrollbar-width:thin;scrollbar-color:rgba(103,232,249,.32) rgba(15,23,42,.72)}body{margin:0;min-width:320px;min-height:100vh;font-family:IBM Plex Sans,ui-sans-serif,system-ui,sans-serif;color:var(--text-main);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:radial-gradient(1200px 600px at 10% -10%,rgba(34,211,238,.16),transparent 60%),radial-gradient(900px 500px at 90% 0%,rgba(59,130,246,.1),transparent 55%),linear-gradient(180deg,var(--app-bg-0),var(--app-bg-1))}*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgba(103,232,249,.28) rgba(15,23,42,.4)}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:#0f172a73}*::-webkit-scrollbar-thumb{border:2px solid rgba(15,23,42,.4);border-radius:9999px;background:linear-gradient(180deg,#67e8f957,#22d3ee38)}code,kbd,samp,pre{font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Consolas,monospace}button,input,textarea,select{font:inherit}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-bottom-0\.5{bottom:-.125rem}.-right-0\.5{right:-.125rem}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-4{bottom:1rem}.bottom-\[14\%\]{bottom:14%}.left-1{left:.25rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-4{left:1rem}.left-\[12\%\]{left:12%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.right-\[10\%\]{right:10%}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-\[18\%\]{top:18%}.top-\[calc\(100\%\+8px\)\]{top:calc(100% + 8px)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[46px\]{height:46px}.h-\[60vh\]{height:60vh}.h-\[70vh\]{height:70vh}.h-\[74vh\]{height:74vh}.h-\[80vh\]{height:80vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-72{max-height:18rem}.max-h-\[92vh\]{max-height:92vh}.min-h-0{min-height:0px}.min-h-14{min-height:3.5rem}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-24{width:6rem}.w-28{width:7rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-56{width:14rem}.w-72{width:18rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[360px\]{width:360px}.w-\[80vw\]{width:80vw}.w-\[min\(360px\,calc\(100\%-2rem\)\)\]{width:min(360px,calc(100% - 2rem))}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-40{min-width:10rem}.min-w-44{min-width:11rem}.min-w-\[160px\]{min-width:160px}.min-w-\[48rem\]{min-width:48rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[220px\]{max-width:220px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow-\[21\]{flex-grow:21}.grow-\[29\]{flex-grow:29}.grow-\[3\]{flex-grow:3}.grow-\[4\]{flex-grow:4}.grow-\[6\]{flex-grow:6}.grow-\[7\]{flex-grow:7}.basis-\[30\%\]{flex-basis:30%}.basis-\[40\%\]{flex-basis:40%}.basis-\[42\%\]{flex-basis:42%}.basis-\[58\%\]{flex-basis:58%}.basis-\[60\%\]{flex-basis:60%}.basis-\[70\%\]{flex-basis:70%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[28px\]{border-radius:28px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/25{border-color:#3b82f640}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600\/30{border-color:#2563eb4d}.border-blue-800\/40{border-color:#1e40af66}.border-blue-900\/30{border-color:#1e3a8a4d}.border-blue-900\/50{border-color:#1e3a8a80}.border-border-main{border-color:var(--border-main)}.border-border-subtle{border-color:var(--border-subtle)}.border-cyan-400{--tw-border-opacity: 1;border-color:rgb(34 211 238 / var(--tw-border-opacity, 1))}.border-cyan-400\/30{border-color:#22d3ee4d}.border-cyan-500\/20{border-color:#06b6d433}.border-cyan-500\/40{border-color:#06b6d466}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-700{--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity, 1))}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-900\/50{border-color:#581c8780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/25{border-color:#ef444440}.border-red-800{--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.border-surface-app{border-color:var(--surface-app)}.border-surface-panel{border-color:var(--surface-panel)}.border-transparent{border-color:transparent}.border-t-border-main{border-top-color:var(--border-main)}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/70{background-color:#000000b3}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-600\/10{background-color:#2563eb1a}.bg-blue-600\/20{background-color:#2563eb33}.bg-blue-900\/15{background-color:#1e3a8a26}.bg-blue-950\/20{background-color:#17255433}.bg-blue-950\/80{background-color:#172554cc}.bg-border-main{background-color:var(--border-main)}.bg-content-dim{background-color:var(--text-dim)}.bg-content-muted{background-color:var(--text-muted)}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/5{background-color:#06b6d40d}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/5{background-color:#10b9810d}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/30{background-color:#3b07644d}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-surface-app{background-color:var(--surface-app)}.bg-surface-card{background-color:var(--surface-card)}.bg-surface-control{background-color:var(--surface-control)}.bg-surface-muted{background-color:var(--surface-muted)}.bg-surface-panel{background-color:var(--surface-panel)}.bg-transparent{background-color:transparent}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/15{background-color:#eab30826}.bg-\[radial-gradient\(circle_at_top\,rgba\(56\,189\,248\,0\.09\)\,transparent_35\%\)\]{background-image:radial-gradient(circle at top,rgba(56,189,248,.09),transparent 35%)}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-400{--tw-gradient-from: #22d3ee var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-500{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-orange-600{--tw-gradient-to: #ea580c var(--tw-gradient-to-position)}.to-teal-600{--tw-gradient-to: #0d9488 var(--tw-gradient-to-position)}.fill-amber-400{fill:#fbbf24}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-\[0\.24em\]{letter-spacing:.24em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-border-main{color:var(--border-main)}.text-content-dim{color:var(--text-dim)}.text-content-main{color:var(--text-main)}.text-content-muted{color:var(--text-muted)}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-cyan-500\/15{color:#06b6d426}.text-cyan-500\/30{color:#06b6d44d}.text-cyan-500\/70{color:#06b6d4b3}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/80{color:#10b981cc}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-500\/30{color:#ef44444d}.text-surface-muted{color:var(--surface-muted)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.accent-cyan-500{accent-color:#06b6d4}.accent-emerald-500{accent-color:#10b981}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_4px_rgba\(16\,185\,129\,0\.5\)\]{--tw-shadow: 0 0 4px rgba(16,185,129,.5);--tw-shadow-colored: 0 0 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_30px_80px_rgba\(2\,6\,23\,0\.3\)\]{--tw-shadow: 0 30px 80px rgba(2,6,23,.3);--tw-shadow-colored: 0 30px 80px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgba\(148\,163\,184\,0\.08\)\]{--tw-shadow: inset 0 1px 0 rgba(148,163,184,.08);--tw-shadow-colored: inset 0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-amber-900\/30{--tw-shadow-color: rgb(120 53 15 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/30{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-900\/20{--tw-shadow-color: rgb(30 58 138 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-cyan-900\/20{--tw-shadow-color: rgb(22 78 99 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-cyan-900\/30{--tw-shadow-color: rgb(22 78 99 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-900\/20{--tw-shadow-color: rgb(6 78 59 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-blue-500\/40{--tw-ring-color: rgb(59 130 246 / .4)}.ring-border-main{--tw-ring-color: var(--border-main)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[flex-grow\,flex-basis\,border-color\,box-shadow\]{transition-property:flex-grow,flex-basis,border-color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}html:not(.dark){color-scheme:light;--app-bg-0: #f1f5f9;--app-bg-1: #e2e8f0;--app-card: rgba(255, 255, 255, .85);--app-border: rgba(148, 163, 184, .25);--surface-app: #f8fafc;--surface-panel: #f1f5f9;--surface-card: #ffffff;--surface-muted: #e2e8f0;--surface-control: #ffffff;--border-main: rgba(148, 163, 184, .3);--border-subtle: rgba(148, 163, 184, .15);--text-main: #1e293b;--text-muted: #475569;--text-dim: #64748b}html:not(.dark) body{color:var(--text-main);background:radial-gradient(1400px 700px at 5% -15%,rgba(34,211,238,.05),transparent 65%),radial-gradient(1000px 600px at 95% 5%,rgba(59,130,246,.04),transparent 55%),linear-gradient(185deg,#f8fafc,#f1f5f9)}html:not(.dark) *{scrollbar-color:rgba(148,163,184,.4) rgba(226,232,240,.6)}html:not(.dark) *::-webkit-scrollbar-track{background:#e2e8f080}html:not(.dark) *::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#94a3b866,#cbd5e14d)}html:not(.dark) .glass-panel,html:not(.dark) .glass-panel-hover{background:#ffffffb3;border-color:#94a3b833}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}.placeholder\:text-content-dim::-moz-placeholder{color:var(--text-dim)}.placeholder\:text-content-dim::placeholder{color:var(--text-dim)}.focus-within\:border-blue-500\/60:focus-within{border-color:#3b82f699}.focus-within\:border-emerald-500\/40:focus-within{border-color:#10b98166}.focus-within\:bg-surface-muted:focus-within{background-color:var(--surface-muted)}.focus-within\:shadow-\[inset_0_1px_0_rgba\(96\,165\,250\,0\.18\)\]:focus-within{--tw-shadow: inset 0 1px 0 rgba(96,165,250,.18);--tw-shadow-colored: inset 0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-border-main:hover{border-color:var(--border-main)}.hover\:border-border-subtle:hover{border-color:var(--border-subtle)}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/5:hover{background-color:#3b82f60d}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-purple-500:hover{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500:hover{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-surface-muted:hover{background-color:var(--surface-muted)}.hover\:bg-surface-panel:hover{background-color:var(--surface-panel)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-cyan-400:hover{--tw-gradient-from: #22d3ee var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-emerald-400:hover{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-blue-500:hover{--tw-gradient-to: #3b82f6 var(--tw-gradient-to-position)}.hover\:to-orange-500:hover{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.hover\:to-teal-500:hover{--tw-gradient-to: #14b8a6 var(--tw-gradient-to-position)}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-content-dim:hover{color:var(--text-dim)}.hover\:text-content-main:hover{color:var(--text-main)}.hover\:text-content-muted:hover{color:var(--text-muted)}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-cyan-500:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-emerald-500:hover{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:brightness-150:hover{--tw-brightness: brightness(1.5);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-border-subtle:focus{border-color:var(--border-subtle)}.focus\:border-cyan-500:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:bg-surface-panel:focus{background-color:var(--surface-panel)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-cyan-500\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-cyan-500\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-offset-surface-app:focus{--tw-ring-offset-color: var(--surface-app)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-content-dim:disabled{color:var(--text-dim)}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.group:focus-within .group-focus-within\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:focus-within .group-focus-within\:text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:inline-block{display:inline-block}.group:hover .group-hover\:flex{display:flex}.group:hover .group-hover\:bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-content-main{color:var(--text-main)}.group:hover .group-hover\:opacity-100{opacity:1}.dark\:bg-\[linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.8\)\,rgba\(2\,6\,23\,1\)\)\]:is(.dark *){background-image:linear-gradient(135deg,#0f172acc,#020617)}.dark\:text-cyan-400:is(.dark *){--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}@media(min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-\[minmax\(0\,1\.4fr\)_120px_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.4fr) 120px minmax(0,1fr)}} diff --git a/backend/src/main/resources/static/assets/index-Z2D8CQl5.js b/backend/src/main/resources/static/assets/index-BQbRYAGj.js similarity index 99% rename from backend/src/main/resources/static/assets/index-Z2D8CQl5.js rename to backend/src/main/resources/static/assets/index-BQbRYAGj.js index 546e51a..84cf220 100644 --- a/backend/src/main/resources/static/assets/index-Z2D8CQl5.js +++ b/backend/src/main/resources/static/assets/index-BQbRYAGj.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePage-B8Ud6Ns4.js","assets/monitor-D01QXMh7.js","assets/Modal-DTj05goU.js","assets/WorkspacePage-DXOU9pbP.css","assets/UserManagementPage-CpLFrodx.js","assets/DashboardPage-BQqMAlQh.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePage-cbzo-ogN.js","assets/monitor-BOliCSBz.js","assets/Modal-B96Ao-J_.js","assets/WorkspacePage-DXOU9pbP.css","assets/UserManagementPage-3xCLOZtk.js","assets/DashboardPage-8WtAnohf.js"])))=>i.map(i=>d[i]); (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function f(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(o){if(o.ep)return;o.ep=!0;const d=f(o);fetch(o.href,d)}})();function xm(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var uf={exports:{}},Ka={};var Vh;function Gp(){if(Vh)return Ka;Vh=1;var u=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(r,o,d){var m=null;if(d!==void 0&&(m=""+d),o.key!==void 0&&(m=""+o.key),"key"in o){d={};for(var p in o)p!=="key"&&(d[p]=o[p])}else d=o;return o=d.ref,{$$typeof:u,type:r,key:m,ref:o!==void 0?o:null,props:d}}return Ka.Fragment=c,Ka.jsx=f,Ka.jsxs=f,Ka}var Zh;function Xp(){return Zh||(Zh=1,uf.exports=Gp()),uf.exports}var q=Xp(),cf={exports:{}},lt={};var Kh;function Qp(){if(Kh)return lt;Kh=1;var u=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),L=Symbol.iterator;function Y(E){return E===null||typeof E!="object"?null:(E=L&&E[L]||E["@@iterator"],typeof E=="function"?E:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,C={};function Q(E,B,X){this.props=E,this.context=B,this.refs=C,this.updater=X||_}Q.prototype.isReactComponent={},Q.prototype.setState=function(E,B){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,B,"setState")},Q.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function $(){}$.prototype=Q.prototype;function V(E,B,X){this.props=E,this.context=B,this.refs=C,this.updater=X||_}var I=V.prototype=new $;I.constructor=V,M(I,Q.prototype),I.isPureReactComponent=!0;var at=Array.isArray;function ht(){}var k={H:null,A:null,T:null,S:null},ut=Object.prototype.hasOwnProperty;function _t(E,B,X){var Z=X.ref;return{$$typeof:u,type:E,key:B,ref:Z!==void 0?Z:null,props:X}}function Jt(E,B){return _t(E.type,B,E.props)}function le(E){return typeof E=="object"&&E!==null&&E.$$typeof===u}function wt(E){var B={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(X){return B[X]})}var It=/\/+/g;function qt(E,B){return typeof E=="object"&&E!==null&&E.key!=null?wt(""+E.key):B.toString(36)}function Dt(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(ht,ht):(E.status="pending",E.then(function(B){E.status==="pending"&&(E.status="fulfilled",E.value=B)},function(B){E.status==="pending"&&(E.status="rejected",E.reason=B)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function U(E,B,X,Z,et){var ct=typeof E;(ct==="undefined"||ct==="boolean")&&(E=null);var gt=!1;if(E===null)gt=!0;else switch(ct){case"bigint":case"string":case"number":gt=!0;break;case"object":switch(E.$$typeof){case u:case c:gt=!0;break;case b:return gt=E._init,U(gt(E._payload),B,X,Z,et)}}if(gt)return et=et(E),gt=Z===""?"."+qt(E,0):Z,at(et)?(X="",gt!=null&&(X=gt.replace(It,"$&/")+"/"),U(et,B,X,"",function(In){return In})):et!=null&&(le(et)&&(et=Jt(et,X+(et.key==null||E&&E.key===et.key?"":(""+et.key).replace(It,"$&/")+"/")+gt)),B.push(et)),1;gt=0;var ne=Z===""?".":Z+":";if(at(E))for(var Ht=0;Ht>>1,bt=U[pt];if(0>>1;pto(X,F))Zo(et,X)?(U[pt]=et,U[Z]=F,pt=Z):(U[pt]=X,U[B]=F,pt=B);else if(Zo(et,F))U[pt]=et,U[Z]=F,pt=Z;else break t}}return G}function o(U,G){var F=U.sortIndex-G.sortIndex;return F!==0?F:U.id-G.id}if(u.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;u.unstable_now=function(){return d.now()}}else{var m=Date,p=m.now();u.unstable_now=function(){return m.now()-p}}var v=[],y=[],b=1,S=null,L=3,Y=!1,_=!1,M=!1,C=!1,Q=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function I(U){for(var G=f(y);G!==null;){if(G.callback===null)r(y);else if(G.startTime<=U)r(y),G.sortIndex=G.expirationTime,c(v,G);else break;G=f(y)}}function at(U){if(M=!1,I(U),!_)if(f(v)!==null)_=!0,ht||(ht=!0,wt());else{var G=f(y);G!==null&&Dt(at,G.startTime-U)}}var ht=!1,k=-1,ut=5,_t=-1;function Jt(){return C?!0:!(u.unstable_now()-_tU&&Jt());){var pt=S.callback;if(typeof pt=="function"){S.callback=null,L=S.priorityLevel;var bt=pt(S.expirationTime<=U);if(U=u.unstable_now(),typeof bt=="function"){S.callback=bt,I(U),G=!0;break e}S===f(v)&&r(v),I(U)}else r(v);S=f(v)}if(S!==null)G=!0;else{var E=f(y);E!==null&&Dt(at,E.startTime-U),G=!1}}break t}finally{S=null,L=F,Y=!1}G=void 0}}finally{G?wt():ht=!1}}}var wt;if(typeof V=="function")wt=function(){V(le)};else if(typeof MessageChannel<"u"){var It=new MessageChannel,qt=It.port2;It.port1.onmessage=le,wt=function(){qt.postMessage(null)}}else wt=function(){Q(le,0)};function Dt(U,G){k=Q(function(){U(u.unstable_now())},G)}u.unstable_IdlePriority=5,u.unstable_ImmediatePriority=1,u.unstable_LowPriority=4,u.unstable_NormalPriority=3,u.unstable_Profiling=null,u.unstable_UserBlockingPriority=2,u.unstable_cancelCallback=function(U){U.callback=null},u.unstable_forceFrameRate=function(U){0>U||125pt?(U.sortIndex=F,c(y,U),f(v)===null&&U===f(y)&&(M?($(k),k=-1):M=!0,Dt(at,F-pt))):(U.sortIndex=bt,c(v,U),_||Y||(_=!0,ht||(ht=!0,wt()))),U},u.unstable_shouldYield=Jt,u.unstable_wrapCallback=function(U){var G=L;return function(){var F=L;L=G;try{return U.apply(this,arguments)}finally{L=F}}}})(sf)),sf}var $h;function Kp(){return $h||($h=1,ff.exports=Zp()),ff.exports}var of={exports:{}},te={};var Fh;function Jp(){if(Fh)return te;Fh=1;var u=_f();function c(v){var y="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(c){console.error(c)}}return u(),of.exports=Jp(),of.exports}var Ph;function $p(){if(Ph)return Ja;Ph=1;var u=Kp(),c=_f(),f=kp();function r(t){var e="https://react.dev/errors/"+t;if(1bt||(t.current=pt[bt],pt[bt]=null,bt--)}function X(t,e){bt++,pt[bt]=t.current,t.current=e}var Z=E(null),et=E(null),ct=E(null),gt=E(null);function ne(t,e){switch(X(ct,e),X(et,t),X(Z,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?hh(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=hh(e),t=mh(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}B(Z),X(Z,t)}function Ht(){B(Z),B(et),B(ct)}function In(t){t.memoizedState!==null&&X(gt,t);var e=Z.current,l=mh(e,t.type);e!==l&&(X(et,t),X(Z,l))}function au(t){et.current===t&&(B(Z),B(et)),gt.current===t&&(B(gt),Xa._currentValue=F)}var Gi,Xf;function Ll(t){if(Gi===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);Gi=e&&e[1]||"",Xf=-1)":-1 to r.set(o)),r}static accessor(c){const r=(this[hm]=this[hm]={accessors:{}}).accessors,o=this.prototype;function d(m){const p=$a(m);r[p]||(Y1(o,m),r[p]=!0)}return N.isArray(c)?c.forEach(d):d(c),this}};he.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(he.prototype,({value:u},c)=>{let f=c[0].toUpperCase()+c.slice(1);return{get:()=>u,set(r){this[f]=r}}});N.freezeMethods(he);function vf(u,c){const f=this||lu,r=c||f,o=he.from(r.headers);let d=r.data;return N.forEach(u,function(p){d=p.call(f,d,o.normalize(),c?c.status:void 0)}),o.normalize(),d}function iy(u){return!!(u&&u.__CANCEL__)}let nu=class extends tt{constructor(c,f,r){super(c??"canceled",tt.ERR_CANCELED,f,r),this.name="CanceledError",this.__CANCEL__=!0}};function cy(u,c,f){const r=f.config.validateStatus;!f.status||!r||r(f.status)?u(f):c(new tt("Request failed with status code "+f.status,[tt.ERR_BAD_REQUEST,tt.ERR_BAD_RESPONSE][Math.floor(f.status/100)-4],f.config,f.request,f))}function G1(u){const c=/^([-+\w]{1,25})(:?\/\/|:)/.exec(u);return c&&c[1]||""}function X1(u,c){u=u||10;const f=new Array(u),r=new Array(u);let o=0,d=0,m;return c=c!==void 0?c:1e3,function(v){const y=Date.now(),b=r[d];m||(m=y),f[o]=v,r[o]=y;let S=d,L=0;for(;S!==o;)L+=f[S++],S=S%u;if(o=(o+1)%u,o===d&&(d=(d+1)%u),y-m{f=b,o=null,d&&(clearTimeout(d),d=null),u(...y)};return[(...y)=>{const b=Date.now(),S=b-f;S>=r?m(y,b):(o=y,d||(d=setTimeout(()=>{d=null,m(o)},r-S)))},()=>o&&m(o)]}const Di=(u,c,f=3)=>{let r=0;const o=X1(50,250);return Q1(d=>{const m=d.loaded,p=d.lengthComputable?d.total:void 0,v=m-r,y=o(v),b=m<=p;r=m;const S={loaded:m,total:p,progress:p?m/p:void 0,bytes:v,rate:y||void 0,estimated:y&&p&&b?(p-m)/y:void 0,event:d,lengthComputable:p!=null,[c?"download":"upload"]:!0};u(S)},f)},mm=(u,c)=>{const f=u!=null;return[r=>c[0]({lengthComputable:f,total:u,loaded:r}),c[1]]},ym=u=>(...c)=>N.asap(()=>u(...c)),V1=ee.hasStandardBrowserEnv?((u,c)=>f=>(f=new URL(f,ee.origin),u.protocol===f.protocol&&u.host===f.host&&(c||u.port===f.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,Z1=ee.hasStandardBrowserEnv?{write(u,c,f,r,o,d,m){if(typeof document>"u")return;const p=[`${u}=${encodeURIComponent(c)}`];N.isNumber(f)&&p.push(`expires=${new Date(f).toUTCString()}`),N.isString(r)&&p.push(`path=${r}`),N.isString(o)&&p.push(`domain=${o}`),d===!0&&p.push("secure"),N.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(u){if(typeof document>"u")return null;const c=document.cookie.match(new RegExp("(?:^|; )"+u+"=([^;]*)"));return c?decodeURIComponent(c[1]):null},remove(u){this.write(u,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function K1(u){return typeof u!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(u)}function J1(u,c){return c?u.replace(/\/?\/$/,"")+"/"+c.replace(/^\/+/,""):u}function ry(u,c,f){let r=!K1(c);return u&&(r||f==!1)?J1(u,c):c}const pm=u=>u instanceof he?{...u}:u;function rn(u,c){c=c||{};const f={};function r(y,b,S,L){return N.isPlainObject(y)&&N.isPlainObject(b)?N.merge.call({caseless:L},y,b):N.isPlainObject(b)?N.merge({},b):N.isArray(b)?b.slice():b}function o(y,b,S,L){if(N.isUndefined(b)){if(!N.isUndefined(y))return r(void 0,y,S,L)}else return r(y,b,S,L)}function d(y,b){if(!N.isUndefined(b))return r(void 0,b)}function m(y,b){if(N.isUndefined(b)){if(!N.isUndefined(y))return r(void 0,y)}else return r(void 0,b)}function p(y,b,S){if(S in c)return r(y,b);if(S in u)return r(void 0,y)}const v={url:d,method:d,data:d,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(y,b,S)=>o(pm(y),pm(b),S,!0)};return N.forEach(Object.keys({...u,...c}),function(b){if(b==="__proto__"||b==="constructor"||b==="prototype")return;const S=N.hasOwnProp(v,b)?v[b]:o,L=S(u[b],c[b],b);N.isUndefined(L)&&S!==p||(f[b]=L)}),f}const fy=u=>{const c=rn({},u);let{data:f,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:d,headers:m,auth:p}=c;if(c.headers=m=he.from(m),c.url=ay(ry(c.baseURL,c.url,c.allowAbsoluteUrls),u.params,u.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),N.isFormData(f)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(N.isFunction(f.getHeaders)){const v=f.getHeaders(),y=["content-type","content-length"];Object.entries(v).forEach(([b,S])=>{y.includes(b.toLowerCase())&&m.set(b,S)})}}if(ee.hasStandardBrowserEnv&&(r&&N.isFunction(r)&&(r=r(c)),r||r!==!1&&V1(c.url))){const v=o&&d&&Z1.read(d);v&&m.set(o,v)}return c},k1=typeof XMLHttpRequest<"u",$1=k1&&function(u){return new Promise(function(f,r){const o=fy(u);let d=o.data;const m=he.from(o.headers).normalize();let{responseType:p,onUploadProgress:v,onDownloadProgress:y}=o,b,S,L,Y,_;function M(){Y&&Y(),_&&_(),o.cancelToken&&o.cancelToken.unsubscribe(b),o.signal&&o.signal.removeEventListener("abort",b)}let C=new XMLHttpRequest;C.open(o.method.toUpperCase(),o.url,!0),C.timeout=o.timeout;function Q(){if(!C)return;const V=he.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),at={data:!p||p==="text"||p==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:V,config:u,request:C};cy(function(k){f(k),M()},function(k){r(k),M()},at),C=null}"onloadend"in C?C.onloadend=Q:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(Q)},C.onabort=function(){C&&(r(new tt("Request aborted",tt.ECONNABORTED,u,C)),C=null)},C.onerror=function(I){const at=I&&I.message?I.message:"Network Error",ht=new tt(at,tt.ERR_NETWORK,u,C);ht.event=I||null,r(ht),C=null},C.ontimeout=function(){let I=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const at=o.transitional||qf;o.timeoutErrorMessage&&(I=o.timeoutErrorMessage),r(new tt(I,at.clarifyTimeoutError?tt.ETIMEDOUT:tt.ECONNABORTED,u,C)),C=null},d===void 0&&m.setContentType(null),"setRequestHeader"in C&&N.forEach(m.toJSON(),function(I,at){C.setRequestHeader(at,I)}),N.isUndefined(o.withCredentials)||(C.withCredentials=!!o.withCredentials),p&&p!=="json"&&(C.responseType=o.responseType),y&&([L,_]=Di(y,!0),C.addEventListener("progress",L)),v&&C.upload&&([S,Y]=Di(v),C.upload.addEventListener("progress",S),C.upload.addEventListener("loadend",Y)),(o.cancelToken||o.signal)&&(b=V=>{C&&(r(!V||V.type?new nu(null,u,C):V),C.abort(),C=null)},o.cancelToken&&o.cancelToken.subscribe(b),o.signal&&(o.signal.aborted?b():o.signal.addEventListener("abort",b)));const $=G1(o.url);if($&&ee.protocols.indexOf($)===-1){r(new tt("Unsupported protocol "+$+":",tt.ERR_BAD_REQUEST,u));return}C.send(d||null)})},F1=(u,c)=>{const{length:f}=u=u?u.filter(Boolean):[];if(c||f){let r=new AbortController,o;const d=function(y){if(!o){o=!0,p();const b=y instanceof Error?y:this.reason;r.abort(b instanceof tt?b:new nu(b instanceof Error?b.message:b))}};let m=c&&setTimeout(()=>{m=null,d(new tt(`timeout of ${c}ms exceeded`,tt.ETIMEDOUT))},c);const p=()=>{u&&(m&&clearTimeout(m),m=null,u.forEach(y=>{y.unsubscribe?y.unsubscribe(d):y.removeEventListener("abort",d)}),u=null)};u.forEach(y=>y.addEventListener("abort",d));const{signal:v}=r;return v.unsubscribe=()=>N.asap(p),v}},W1=function*(u,c){let f=u.byteLength;if(f{const o=P1(u,c);let d=0,m,p=v=>{m||(m=!0,r&&r(v))};return new ReadableStream({async pull(v){try{const{done:y,value:b}=await o.next();if(y){p(),v.close();return}let S=b.byteLength;if(f){let L=d+=S;f(L)}v.enqueue(new Uint8Array(b))}catch(y){throw p(y),y}},cancel(v){return p(v),o.return()}},{highWaterMark:2})},gm=64*1024,{isFunction:Ti}=N,tb=(({Request:u,Response:c})=>({Request:u,Response:c}))(N.global),{ReadableStream:bm,TextEncoder:Sm}=N.global,Em=(u,...c)=>{try{return!!u(...c)}catch{return!1}},eb=u=>{u=N.merge.call({skipUndefined:!0},tb,u);const{fetch:c,Request:f,Response:r}=u,o=c?Ti(c):typeof fetch=="function",d=Ti(f),m=Ti(r);if(!o)return!1;const p=o&&Ti(bm),v=o&&(typeof Sm=="function"?(_=>M=>_.encode(M))(new Sm):async _=>new Uint8Array(await new f(_).arrayBuffer())),y=d&&p&&Em(()=>{let _=!1;const M=new f(ee.origin,{body:new bm,method:"POST",get duplex(){return _=!0,"half"}}).headers.has("Content-Type");return _&&!M}),b=m&&p&&Em(()=>N.isReadableStream(new r("").body)),S={stream:b&&(_=>_.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(_=>{!S[_]&&(S[_]=(M,C)=>{let Q=M&&M[_];if(Q)return Q.call(M);throw new tt(`Response type '${_}' is not supported`,tt.ERR_NOT_SUPPORT,C)})});const L=async _=>{if(_==null)return 0;if(N.isBlob(_))return _.size;if(N.isSpecCompliantForm(_))return(await new f(ee.origin,{method:"POST",body:_}).arrayBuffer()).byteLength;if(N.isArrayBufferView(_)||N.isArrayBuffer(_))return _.byteLength;if(N.isURLSearchParams(_)&&(_=_+""),N.isString(_))return(await v(_)).byteLength},Y=async(_,M)=>{const C=N.toFiniteNumber(_.getContentLength());return C??L(M)};return async _=>{let{url:M,method:C,data:Q,signal:$,cancelToken:V,timeout:I,onDownloadProgress:at,onUploadProgress:ht,responseType:k,headers:ut,withCredentials:_t="same-origin",fetchOptions:Jt}=fy(_),le=c||fetch;k=k?(k+"").toLowerCase():"text";let wt=F1([$,V&&V.toAbortSignal()],I),It=null;const qt=wt&&wt.unsubscribe&&(()=>{wt.unsubscribe()});let Dt;try{if(ht&&y&&C!=="get"&&C!=="head"&&(Dt=await Y(ut,Q))!==0){let E=new f(M,{method:"POST",body:Q,duplex:"half"}),B;if(N.isFormData(Q)&&(B=E.headers.get("content-type"))&&ut.setContentType(B),E.body){const[X,Z]=mm(Dt,Di(ym(ht)));Q=vm(E.body,gm,X,Z)}}N.isString(_t)||(_t=_t?"include":"omit");const U=d&&"credentials"in f.prototype,G={...Jt,signal:wt,method:C.toUpperCase(),headers:ut.normalize().toJSON(),body:Q,duplex:"half",credentials:U?_t:void 0};It=d&&new f(M,G);let F=await(d?le(It,Jt):le(M,G));const pt=b&&(k==="stream"||k==="response");if(b&&(at||pt&&qt)){const E={};["status","statusText","headers"].forEach(et=>{E[et]=F[et]});const B=N.toFiniteNumber(F.headers.get("content-length")),[X,Z]=at&&mm(B,Di(ym(at),!0))||[];F=new r(vm(F.body,gm,X,()=>{Z&&Z(),qt&&qt()}),E)}k=k||"text";let bt=await S[N.findKey(S,k)||"text"](F,_);return!pt&&qt&&qt(),await new Promise((E,B)=>{cy(E,B,{data:bt,headers:he.from(F.headers),status:F.status,statusText:F.statusText,config:_,request:It})})}catch(U){throw qt&&qt(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new tt("Network Error",tt.ERR_NETWORK,_,It,U&&U.response),{cause:U.cause||U}):tt.from(U,U&&U.code,_,It,U&&U.response)}}},lb=new Map,sy=u=>{let c=u&&u.env||{};const{fetch:f,Request:r,Response:o}=c,d=[r,o,f];let m=d.length,p=m,v,y,b=lb;for(;p--;)v=d[p],y=b.get(v),y===void 0&&b.set(v,y=p?new Map:eb(c)),b=y;return y};sy();const Gf={http:b1,xhr:$1,fetch:{get:sy}};N.forEach(Gf,(u,c)=>{if(u){try{Object.defineProperty(u,"name",{value:c})}catch{}Object.defineProperty(u,"adapterName",{value:c})}});const Rm=u=>`- ${u}`,nb=u=>N.isFunction(u)||u===null||u===!1;function ab(u,c){u=N.isArray(u)?u:[u];const{length:f}=u;let r,o;const d={};for(let m=0;m`adapter ${v} `+(y===!1?"is not supported by the environment":"is not available in the build"));let p=f?m.length>1?`since : `+m.map(Rm).join(` `):" "+Rm(m[0]):"as no adapter specified";throw new tt("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return o}const oy={getAdapter:ab,adapters:Gf};function gf(u){if(u.cancelToken&&u.cancelToken.throwIfRequested(),u.signal&&u.signal.aborted)throw new nu(null,u)}function Tm(u){return gf(u),u.headers=he.from(u.headers),u.data=vf.call(u,u.transformRequest),["post","put","patch"].indexOf(u.method)!==-1&&u.headers.setContentType("application/x-www-form-urlencoded",!1),oy.getAdapter(u.adapter||lu.adapter,u)(u).then(function(r){return gf(u),r.data=vf.call(u,u.transformResponse,r),r.headers=he.from(r.headers),r},function(r){return iy(r)||(gf(u),r&&r.response&&(r.response.data=vf.call(u,u.transformResponse,r.response),r.response.headers=he.from(r.response.headers))),Promise.reject(r)})}const dy="1.13.6",qi={};["object","boolean","number","function","string","symbol"].forEach((u,c)=>{qi[u]=function(r){return typeof r===u||"a"+(c<1?"n ":" ")+u}});const Am={};qi.transitional=function(c,f,r){function o(d,m){return"[Axios v"+dy+"] Transitional option '"+d+"'"+m+(r?". "+r:"")}return(d,m,p)=>{if(c===!1)throw new tt(o(m," has been removed"+(f?" in "+f:"")),tt.ERR_DEPRECATED);return f&&!Am[m]&&(Am[m]=!0,console.warn(o(m," has been deprecated since v"+f+" and will be removed in the near future"))),c?c(d,m,p):!0}};qi.spelling=function(c){return(f,r)=>(console.warn(`${r} is likely a misspelling of ${c}`),!0)};function ub(u,c,f){if(typeof u!="object")throw new tt("options must be an object",tt.ERR_BAD_OPTION_VALUE);const r=Object.keys(u);let o=r.length;for(;o-- >0;){const d=r[o],m=c[d];if(m){const p=u[d],v=p===void 0||m(p,d,u);if(v!==!0)throw new tt("option "+d+" must be "+v,tt.ERR_BAD_OPTION_VALUE);continue}if(f!==!0)throw new tt("Unknown option "+d,tt.ERR_BAD_OPTION)}}const zi={assertOptions:ub,validators:qi},He=zi.validators;let cn=class{constructor(c){this.defaults=c||{},this.interceptors={request:new dm,response:new dm}}async request(c,f){try{return await this._request(c,f)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const d=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?d&&!String(r.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+d):r.stack=d}catch{}}throw r}}_request(c,f){typeof c=="string"?(f=f||{},f.url=c):f=c||{},f=rn(this.defaults,f);const{transitional:r,paramsSerializer:o,headers:d}=f;r!==void 0&&zi.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean)},!1),o!=null&&(N.isFunction(o)?f.paramsSerializer={serialize:o}:zi.assertOptions(o,{encode:He.function,serialize:He.function},!0)),f.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?f.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:f.allowAbsoluteUrls=!0),zi.assertOptions(f,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),f.method=(f.method||this.defaults.method||"get").toLowerCase();let m=d&&N.merge(d.common,d[f.method]);d&&N.forEach(["delete","get","head","post","put","patch","common"],_=>{delete d[_]}),f.headers=he.concat(m,d);const p=[];let v=!0;this.interceptors.request.forEach(function(M){if(typeof M.runWhen=="function"&&M.runWhen(f)===!1)return;v=v&&M.synchronous;const C=f.transitional||qf;C&&C.legacyInterceptorReqResOrdering?p.unshift(M.fulfilled,M.rejected):p.push(M.fulfilled,M.rejected)});const y=[];this.interceptors.response.forEach(function(M){y.push(M.fulfilled,M.rejected)});let b,S=0,L;if(!v){const _=[Tm.bind(this),void 0];for(_.unshift(...p),_.push(...y),L=_.length,b=Promise.resolve(f);S{if(!r._listeners)return;let d=r._listeners.length;for(;d-- >0;)r._listeners[d](o);r._listeners=null}),this.promise.then=o=>{let d;const m=new Promise(p=>{r.subscribe(p),d=p}).then(o);return m.cancel=function(){r.unsubscribe(d)},m},c(function(d,m,p){r.reason||(r.reason=new nu(d,m,p),f(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(c){if(this.reason){c(this.reason);return}this._listeners?this._listeners.push(c):this._listeners=[c]}unsubscribe(c){if(!this._listeners)return;const f=this._listeners.indexOf(c);f!==-1&&this._listeners.splice(f,1)}toAbortSignal(){const c=new AbortController,f=r=>{c.abort(r)};return this.subscribe(f),c.signal.unsubscribe=()=>this.unsubscribe(f),c.signal}static source(){let c;return{token:new hy(function(o){c=o}),cancel:c}}};function cb(u){return function(f){return u.apply(null,f)}}function rb(u){return N.isObject(u)&&u.isAxiosError===!0}const Of={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Of).forEach(([u,c])=>{Of[c]=u});function my(u){const c=new cn(u),f=Jm(cn.prototype.request,c);return N.extend(f,cn.prototype,c,{allOwnKeys:!0}),N.extend(f,c,null,{allOwnKeys:!0}),f.create=function(o){return my(rn(u,o))},f}const Lt=my(lu);Lt.Axios=cn;Lt.CanceledError=nu;Lt.CancelToken=ib;Lt.isCancel=iy;Lt.VERSION=dy;Lt.toFormData=Li;Lt.AxiosError=tt;Lt.Cancel=Lt.CanceledError;Lt.all=function(c){return Promise.all(c)};Lt.spread=cb;Lt.isAxiosError=rb;Lt.mergeConfig=rn;Lt.AxiosHeaders=he;Lt.formToJSON=u=>uy(N.isHTMLForm(u)?new FormData(u):u);Lt.getAdapter=oy.getAdapter;Lt.HttpStatusCode=Of;Lt.default=Lt;const{Axios:Hb,AxiosError:Bb,CanceledError:jb,isCancel:Lb,CancelToken:qb,VERSION:Yb,all:Gb,Cancel:Xb,isAxiosError:Qb,spread:Vb,toFormData:Zb,AxiosHeaders:Kb,HttpStatusCode:Jb,formToJSON:kb,getAdapter:$b,mergeConfig:Fb}=Lt,Pn=Lt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});Pn.interceptors.request.use(u=>{const c=localStorage.getItem("token");if(c&&(u.headers.Authorization=`Bearer ${c}`),typeof FormData<"u"&&u.data instanceof FormData){const f=u.headers;f&&(delete f["Content-Type"],delete f["content-type"])}return u});Pn.interceptors.response.use(u=>u,u=>(u.response?.status===401&&localStorage.removeItem("token"),Promise.reject(u)));function fb(u,c){return Pn.post("/auth/login",{username:u,password:c})}function sb(u){return Pn.post("/auth/register",u)}function ob(){return Pn.get("/auth/me")}function db(u,c){return Pn.post("/auth/change-password",{currentPassword:u,newPassword:c})}const yy=x.createContext(null);function hb({children:u}){const[c,f]=x.useState(()=>localStorage.getItem("token")),[r,o]=x.useState(null),[d,m]=x.useState(!!c),p=x.useCallback(()=>{localStorage.removeItem("token"),f(null),o(null)},[]),v=x.useCallback(async()=>{if(!localStorage.getItem("token")){m(!1);return}try{const Y=await ob();o(Y.data)}catch{p()}finally{m(!1)}},[p]);x.useEffect(()=>{v()},[v]);const y=x.useCallback(async(Y,_)=>{const M=await fb(Y,_);return localStorage.setItem("token",M.data.token),f(M.data.token),o({username:M.data.username,displayName:M.data.displayName,role:M.data.role,passwordChangeRequired:M.data.passwordChangeRequired}),M.data},[]),b=x.useCallback(async Y=>{const _=await sb(Y);return localStorage.setItem("token",_.data.token),f(_.data.token),o({username:_.data.username,displayName:_.data.displayName,role:_.data.role,passwordChangeRequired:_.data.passwordChangeRequired}),_.data},[]),S=x.useCallback(async(Y,_)=>{await db(Y,_),o(M=>M&&{...M,passwordChangeRequired:!1})},[]),L=x.useMemo(()=>({token:c,user:r,loading:d,isAuthenticated:!!c,login:y,register:b,logout:p,refreshMe:v,changePassword:S}),[c,r,d,y,b,p,v,S]);return q.jsx(yy.Provider,{value:L,children:u})}function py(){const u=x.useContext(yy);if(!u)throw new Error("useAuth must be used within AuthProvider");return u}const vy=(...u)=>u.filter((c,f,r)=>!!c&&c.trim()!==""&&r.indexOf(c)===f).join(" ").trim();const mb=u=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const yb=u=>u.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,r)=>r?r.toUpperCase():f.toLowerCase());const Om=u=>{const c=yb(u);return c.charAt(0).toUpperCase()+c.slice(1)};var pb={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const vb=u=>{for(const c in u)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1};const gb=x.forwardRef(({color:u="currentColor",size:c=24,strokeWidth:f=2,absoluteStrokeWidth:r,className:o="",children:d,iconNode:m,...p},v)=>x.createElement("svg",{ref:v,...pb,width:c,height:c,stroke:u,strokeWidth:r?Number(f)*24/Number(c):f,className:vy("lucide",o),...!d&&!vb(p)&&{"aria-hidden":"true"},...p},[...m.map(([y,b])=>x.createElement(y,b)),...Array.isArray(d)?d:[d]]));const Yi=(u,c)=>{const f=x.forwardRef(({className:r,...o},d)=>x.createElement(gb,{ref:d,iconNode:c,className:vy(`lucide-${mb(Om(u))}`,`lucide-${u}`,r),...o}));return f.displayName=Om(u),f};const bb=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bf=Yi("lock",bb);const Sb=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Eb=Yi("terminal",Sb);const Rb=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Tb=Yi("user-plus",Rb);const Ab=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_m=Yi("user",Ab);function Ob({onSuccess:u}){const{login:c,register:f}=py(),[r,o]=x.useState("login"),[d,m]=x.useState(""),[p,v]=x.useState(""),[y,b]=x.useState(""),[S,L]=x.useState(""),[Y,_]=x.useState(""),[M,C]=x.useState(""),[Q,$]=x.useState(!1),[V,I]=x.useState(null);async function at(ut){ut.preventDefault(),$(!0),I(null);try{await c(d,p),u()}catch(_t){const Jt=_t.response?.data?.message||"登录失败,请检查用户名和密码";I(Jt)}finally{$(!1)}}async function ht(ut){if(ut.preventDefault(),I(null),Y.length<8){I("密码至少需要 8 个字符");return}if(Y!==M){I("两次输入的密码不一致");return}$(!0);try{await f({username:y.trim(),password:Y,displayName:S.trim()||void 0}),u()}catch(_t){const Jt=_t.response?.data?.message||"注册失败";I(Jt)}finally{$(!1)}}function k(){o(r==="login"?"register":"login"),I(null)}return q.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-surface-app p-4",children:[q.jsx("div",{className:"absolute left-[12%] top-[18%] h-80 w-80 rounded-full bg-cyan-500/10 blur-3xl"}),q.jsx("div",{className:"absolute bottom-[14%] right-[10%] h-96 w-96 rounded-full bg-blue-600/20 blur-3xl"}),q.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(56,189,248,0.09),transparent_35%)] dark:bg-[linear-gradient(135deg,rgba(15,23,42,0.8),rgba(2,6,23,1))]"}),q.jsxs("div",{className:"relative z-10 w-full max-w-md rounded-[28px] border border-border-main bg-surface-card/75 p-8 shadow-[0_30px_80px_rgba(2,6,23,0.3)] backdrop-blur-xl",children:[q.jsxs("div",{className:"mb-8 flex items-center justify-center gap-4",children:[q.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-gradient-to-br from-cyan-400 to-blue-600 shadow-lg shadow-blue-900/20",children:q.jsx(Eb,{size:28,className:"text-white"})}),q.jsxs("div",{children:[q.jsx("div",{className:"text-xs uppercase tracking-[0.4em] text-cyan-500/70",children:"Secure Control"}),q.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-content-main",children:"SSH Manager"})]})]}),r==="login"?q.jsxs("form",{className:"space-y-5",onSubmit:at,children:[q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"账号"}),q.jsxs("div",{className:"relative",children:[q.jsx(_m,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:d,onChange:ut=>m(ut.target.value),placeholder:"请输入账号"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"密码"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:p,onChange:ut=>v(ut.target.value),placeholder:"请输入密码"})]})]}),V?q.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-500",children:V}):null,q.jsx("button",{type:"submit",disabled:Q,className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-3 font-medium text-white shadow-lg shadow-cyan-900/20 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",children:Q?"登录中...":"登 录"}),q.jsx("div",{className:"text-center",children:q.jsxs("button",{type:"button",className:"text-sm text-content-dim transition hover:text-cyan-500",onClick:k,children:["没有账号?",q.jsx("span",{className:"font-medium text-cyan-600 dark:text-cyan-400",children:"注册账号"})]})})]}):q.jsxs("form",{className:"space-y-5",onSubmit:ht,children:[q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"用户名 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(_m,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:ut=>b(ut.target.value),placeholder:"登录使用的用户名"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"显示名(选填)"}),q.jsxs("div",{className:"relative",children:[q.jsx(Tb,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:S,onChange:ut=>L(ut.target.value),placeholder:"你希望别人看到的名称"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"密码 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:Y,onChange:ut=>_(ut.target.value),placeholder:"至少 8 个字符"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"确认密码 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:M,onChange:ut=>C(ut.target.value),placeholder:"再次输入密码"})]})]}),V?q.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-500",children:V}):null,q.jsx("button",{type:"submit",disabled:Q||!y.trim(),className:"w-full rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 px-4 py-3 font-medium text-white shadow-lg shadow-emerald-900/20 transition hover:from-emerald-400 hover:to-teal-500 disabled:cursor-not-allowed disabled:opacity-60",children:Q?"注册中...":"注 册"}),q.jsx("div",{className:"text-center",children:q.jsxs("button",{type:"button",className:"text-sm text-content-dim transition hover:text-cyan-500",onClick:k,children:["已有账号?",q.jsx("span",{className:"font-medium text-cyan-600 dark:text-cyan-400",children:"去登录"})]})})]}),r==="login"&&q.jsx("div",{className:"mt-6 text-center text-sm text-content-dim",children:"首次使用?注册一个新账号"})]})]})}const _b=x.lazy(()=>Bf(()=>import("./WorkspacePage-B8Ud6Ns4.js"),__vite__mapDeps([0,1,2,3]))),xb=x.lazy(()=>Bf(()=>import("./UserManagementPage-CpLFrodx.js"),__vite__mapDeps([4,2]))),zb=x.lazy(()=>Bf(()=>import("./DashboardPage-BQqMAlQh.js"),__vite__mapDeps([5,1])));function Cb(){return q.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-app",children:q.jsx("div",{className:"text-xs text-content-dim",children:"加载中..."})})}function Nb(){const{isAuthenticated:u,user:c,loading:f}=py(),r=Ge(),o=Cf(),d=c?.role==="ROLE_ADMIN";return f?q.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-app text-content-main",children:q.jsx("div",{className:"rounded-2xl border border-border-main bg-surface-panel/80 px-6 py-5 shadow-2xl",children:"正在加载工作台..."})}):q.jsx(x.Suspense,{fallback:q.jsx(Cb,{}),children:q.jsxs($v,{children:[q.jsx(an,{path:"/login",element:u?q.jsx(nn,{to:"/workspace",replace:!0}):q.jsx(Ob,{onSuccess:()=>o("/workspace")})}),q.jsx(an,{path:"/workspace",element:u?q.jsx(_b,{initialTool:new URLSearchParams(r.search).get("tool")??void 0,onLogout:()=>o("/login",{replace:!0})}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/dashboard",element:u?q.jsx(zb,{onBack:()=>o("/workspace")}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/users",element:u&&d?q.jsx(xb,{onBack:()=>o("/workspace")}):u?q.jsx(nn,{to:"/workspace",replace:!0}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/",element:q.jsx(nn,{to:u?"/workspace":"/login",replace:!0})}),q.jsx(an,{path:"*",element:q.jsx(nn,{to:"/",replace:!0})})]})})}function Db(){return q.jsx(hb,{children:q.jsx(Nb,{})})}Pp.createRoot(document.getElementById("app")).render(q.jsx(Vp.StrictMode,{children:q.jsx(bg,{children:q.jsx(Db,{})})}));export{Eb as T,Tb as U,Cf as a,Yi as c,Pn as h,q as j,x as r,py as u}; +`+d):r.stack=d}catch{}}throw r}}_request(c,f){typeof c=="string"?(f=f||{},f.url=c):f=c||{},f=rn(this.defaults,f);const{transitional:r,paramsSerializer:o,headers:d}=f;r!==void 0&&zi.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean)},!1),o!=null&&(N.isFunction(o)?f.paramsSerializer={serialize:o}:zi.assertOptions(o,{encode:He.function,serialize:He.function},!0)),f.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?f.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:f.allowAbsoluteUrls=!0),zi.assertOptions(f,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),f.method=(f.method||this.defaults.method||"get").toLowerCase();let m=d&&N.merge(d.common,d[f.method]);d&&N.forEach(["delete","get","head","post","put","patch","common"],_=>{delete d[_]}),f.headers=he.concat(m,d);const p=[];let v=!0;this.interceptors.request.forEach(function(M){if(typeof M.runWhen=="function"&&M.runWhen(f)===!1)return;v=v&&M.synchronous;const C=f.transitional||qf;C&&C.legacyInterceptorReqResOrdering?p.unshift(M.fulfilled,M.rejected):p.push(M.fulfilled,M.rejected)});const y=[];this.interceptors.response.forEach(function(M){y.push(M.fulfilled,M.rejected)});let b,S=0,L;if(!v){const _=[Tm.bind(this),void 0];for(_.unshift(...p),_.push(...y),L=_.length,b=Promise.resolve(f);S{if(!r._listeners)return;let d=r._listeners.length;for(;d-- >0;)r._listeners[d](o);r._listeners=null}),this.promise.then=o=>{let d;const m=new Promise(p=>{r.subscribe(p),d=p}).then(o);return m.cancel=function(){r.unsubscribe(d)},m},c(function(d,m,p){r.reason||(r.reason=new nu(d,m,p),f(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(c){if(this.reason){c(this.reason);return}this._listeners?this._listeners.push(c):this._listeners=[c]}unsubscribe(c){if(!this._listeners)return;const f=this._listeners.indexOf(c);f!==-1&&this._listeners.splice(f,1)}toAbortSignal(){const c=new AbortController,f=r=>{c.abort(r)};return this.subscribe(f),c.signal.unsubscribe=()=>this.unsubscribe(f),c.signal}static source(){let c;return{token:new hy(function(o){c=o}),cancel:c}}};function cb(u){return function(f){return u.apply(null,f)}}function rb(u){return N.isObject(u)&&u.isAxiosError===!0}const Of={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Of).forEach(([u,c])=>{Of[c]=u});function my(u){const c=new cn(u),f=Jm(cn.prototype.request,c);return N.extend(f,cn.prototype,c,{allOwnKeys:!0}),N.extend(f,c,null,{allOwnKeys:!0}),f.create=function(o){return my(rn(u,o))},f}const Lt=my(lu);Lt.Axios=cn;Lt.CanceledError=nu;Lt.CancelToken=ib;Lt.isCancel=iy;Lt.VERSION=dy;Lt.toFormData=Li;Lt.AxiosError=tt;Lt.Cancel=Lt.CanceledError;Lt.all=function(c){return Promise.all(c)};Lt.spread=cb;Lt.isAxiosError=rb;Lt.mergeConfig=rn;Lt.AxiosHeaders=he;Lt.formToJSON=u=>uy(N.isHTMLForm(u)?new FormData(u):u);Lt.getAdapter=oy.getAdapter;Lt.HttpStatusCode=Of;Lt.default=Lt;const{Axios:Hb,AxiosError:Bb,CanceledError:jb,isCancel:Lb,CancelToken:qb,VERSION:Yb,all:Gb,Cancel:Xb,isAxiosError:Qb,spread:Vb,toFormData:Zb,AxiosHeaders:Kb,HttpStatusCode:Jb,formToJSON:kb,getAdapter:$b,mergeConfig:Fb}=Lt,Pn=Lt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});Pn.interceptors.request.use(u=>{const c=localStorage.getItem("token");if(c&&(u.headers.Authorization=`Bearer ${c}`),typeof FormData<"u"&&u.data instanceof FormData){const f=u.headers;f&&(delete f["Content-Type"],delete f["content-type"])}return u});Pn.interceptors.response.use(u=>u,u=>(u.response?.status===401&&localStorage.removeItem("token"),Promise.reject(u)));function fb(u,c){return Pn.post("/auth/login",{username:u,password:c})}function sb(u){return Pn.post("/auth/register",u)}function ob(){return Pn.get("/auth/me")}function db(u,c){return Pn.post("/auth/change-password",{currentPassword:u,newPassword:c})}const yy=x.createContext(null);function hb({children:u}){const[c,f]=x.useState(()=>localStorage.getItem("token")),[r,o]=x.useState(null),[d,m]=x.useState(!!c),p=x.useCallback(()=>{localStorage.removeItem("token"),f(null),o(null)},[]),v=x.useCallback(async()=>{if(!localStorage.getItem("token")){m(!1);return}try{const Y=await ob();o(Y.data)}catch{p()}finally{m(!1)}},[p]);x.useEffect(()=>{v()},[v]);const y=x.useCallback(async(Y,_)=>{const M=await fb(Y,_);return localStorage.setItem("token",M.data.token),f(M.data.token),o({username:M.data.username,displayName:M.data.displayName,role:M.data.role,passwordChangeRequired:M.data.passwordChangeRequired}),M.data},[]),b=x.useCallback(async Y=>{const _=await sb(Y);return localStorage.setItem("token",_.data.token),f(_.data.token),o({username:_.data.username,displayName:_.data.displayName,role:_.data.role,passwordChangeRequired:_.data.passwordChangeRequired}),_.data},[]),S=x.useCallback(async(Y,_)=>{await db(Y,_),o(M=>M&&{...M,passwordChangeRequired:!1})},[]),L=x.useMemo(()=>({token:c,user:r,loading:d,isAuthenticated:!!c,login:y,register:b,logout:p,refreshMe:v,changePassword:S}),[c,r,d,y,b,p,v,S]);return q.jsx(yy.Provider,{value:L,children:u})}function py(){const u=x.useContext(yy);if(!u)throw new Error("useAuth must be used within AuthProvider");return u}const vy=(...u)=>u.filter((c,f,r)=>!!c&&c.trim()!==""&&r.indexOf(c)===f).join(" ").trim();const mb=u=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const yb=u=>u.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,r)=>r?r.toUpperCase():f.toLowerCase());const Om=u=>{const c=yb(u);return c.charAt(0).toUpperCase()+c.slice(1)};var pb={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const vb=u=>{for(const c in u)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1};const gb=x.forwardRef(({color:u="currentColor",size:c=24,strokeWidth:f=2,absoluteStrokeWidth:r,className:o="",children:d,iconNode:m,...p},v)=>x.createElement("svg",{ref:v,...pb,width:c,height:c,stroke:u,strokeWidth:r?Number(f)*24/Number(c):f,className:vy("lucide",o),...!d&&!vb(p)&&{"aria-hidden":"true"},...p},[...m.map(([y,b])=>x.createElement(y,b)),...Array.isArray(d)?d:[d]]));const Yi=(u,c)=>{const f=x.forwardRef(({className:r,...o},d)=>x.createElement(gb,{ref:d,iconNode:c,className:vy(`lucide-${mb(Om(u))}`,`lucide-${u}`,r),...o}));return f.displayName=Om(u),f};const bb=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bf=Yi("lock",bb);const Sb=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Eb=Yi("terminal",Sb);const Rb=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Tb=Yi("user-plus",Rb);const Ab=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_m=Yi("user",Ab);function Ob({onSuccess:u}){const{login:c,register:f}=py(),[r,o]=x.useState("login"),[d,m]=x.useState(""),[p,v]=x.useState(""),[y,b]=x.useState(""),[S,L]=x.useState(""),[Y,_]=x.useState(""),[M,C]=x.useState(""),[Q,$]=x.useState(!1),[V,I]=x.useState(null);async function at(ut){ut.preventDefault(),$(!0),I(null);try{await c(d,p),u()}catch(_t){const Jt=_t.response?.data?.message||"登录失败,请检查用户名和密码";I(Jt)}finally{$(!1)}}async function ht(ut){if(ut.preventDefault(),I(null),Y.length<8){I("密码至少需要 8 个字符");return}if(Y!==M){I("两次输入的密码不一致");return}$(!0);try{await f({username:y.trim(),password:Y,displayName:S.trim()||void 0}),u()}catch(_t){const Jt=_t.response?.data?.message||"注册失败";I(Jt)}finally{$(!1)}}function k(){o(r==="login"?"register":"login"),I(null)}return q.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-surface-app p-4",children:[q.jsx("div",{className:"absolute left-[12%] top-[18%] h-80 w-80 rounded-full bg-cyan-500/10 blur-3xl"}),q.jsx("div",{className:"absolute bottom-[14%] right-[10%] h-96 w-96 rounded-full bg-blue-600/20 blur-3xl"}),q.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(56,189,248,0.09),transparent_35%)] dark:bg-[linear-gradient(135deg,rgba(15,23,42,0.8),rgba(2,6,23,1))]"}),q.jsxs("div",{className:"relative z-10 w-full max-w-md rounded-[28px] border border-border-main bg-surface-card/75 p-8 shadow-[0_30px_80px_rgba(2,6,23,0.3)] backdrop-blur-xl",children:[q.jsxs("div",{className:"mb-8 flex items-center justify-center gap-4",children:[q.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-gradient-to-br from-cyan-400 to-blue-600 shadow-lg shadow-blue-900/20",children:q.jsx(Eb,{size:28,className:"text-white"})}),q.jsxs("div",{children:[q.jsx("div",{className:"text-xs uppercase tracking-[0.4em] text-cyan-500/70",children:"Secure Control"}),q.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-content-main",children:"SSH Manager"})]})]}),r==="login"?q.jsxs("form",{className:"space-y-5",onSubmit:at,children:[q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"账号"}),q.jsxs("div",{className:"relative",children:[q.jsx(_m,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:d,onChange:ut=>m(ut.target.value),placeholder:"请输入账号"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"密码"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:p,onChange:ut=>v(ut.target.value),placeholder:"请输入密码"})]})]}),V?q.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-500",children:V}):null,q.jsx("button",{type:"submit",disabled:Q,className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-3 font-medium text-white shadow-lg shadow-cyan-900/20 transition hover:from-cyan-400 hover:to-blue-500 disabled:cursor-not-allowed disabled:opacity-60",children:Q?"登录中...":"登 录"}),q.jsx("div",{className:"text-center",children:q.jsxs("button",{type:"button",className:"text-sm text-content-dim transition hover:text-cyan-500",onClick:k,children:["没有账号?",q.jsx("span",{className:"font-medium text-cyan-600 dark:text-cyan-400",children:"注册账号"})]})})]}):q.jsxs("form",{className:"space-y-5",onSubmit:ht,children:[q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"用户名 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(_m,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:y,onChange:ut=>b(ut.target.value),placeholder:"登录使用的用户名"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"显示名(选填)"}),q.jsxs("div",{className:"relative",children:[q.jsx(Tb,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:S,onChange:ut=>L(ut.target.value),placeholder:"你希望别人看到的名称"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"密码 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:Y,onChange:ut=>_(ut.target.value),placeholder:"至少 8 个字符"})]})]}),q.jsxs("label",{className:"block space-y-2",children:[q.jsx("span",{className:"text-sm text-content-muted",children:"确认密码 *"}),q.jsxs("div",{className:"relative",children:[q.jsx(bf,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-content-dim",size:18}),q.jsx("input",{type:"password",className:"w-full rounded-xl border border-border-main bg-surface-control px-10 py-3 text-content-main outline-none transition focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20",value:M,onChange:ut=>C(ut.target.value),placeholder:"再次输入密码"})]})]}),V?q.jsx("div",{className:"rounded-xl border border-red-500/25 bg-red-500/10 px-4 py-3 text-sm text-red-500",children:V}):null,q.jsx("button",{type:"submit",disabled:Q||!y.trim(),className:"w-full rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 px-4 py-3 font-medium text-white shadow-lg shadow-emerald-900/20 transition hover:from-emerald-400 hover:to-teal-500 disabled:cursor-not-allowed disabled:opacity-60",children:Q?"注册中...":"注 册"}),q.jsx("div",{className:"text-center",children:q.jsxs("button",{type:"button",className:"text-sm text-content-dim transition hover:text-cyan-500",onClick:k,children:["已有账号?",q.jsx("span",{className:"font-medium text-cyan-600 dark:text-cyan-400",children:"去登录"})]})})]}),r==="login"&&q.jsx("div",{className:"mt-6 text-center text-sm text-content-dim",children:"首次使用?注册一个新账号"})]})]})}const _b=x.lazy(()=>Bf(()=>import("./WorkspacePage-cbzo-ogN.js"),__vite__mapDeps([0,1,2,3]))),xb=x.lazy(()=>Bf(()=>import("./UserManagementPage-3xCLOZtk.js"),__vite__mapDeps([4,2]))),zb=x.lazy(()=>Bf(()=>import("./DashboardPage-8WtAnohf.js"),__vite__mapDeps([5,1])));function Cb(){return q.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-app",children:q.jsx("div",{className:"text-xs text-content-dim",children:"加载中..."})})}function Nb(){const{isAuthenticated:u,user:c,loading:f}=py(),r=Ge(),o=Cf(),d=c?.role==="ROLE_ADMIN";return f?q.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-app text-content-main",children:q.jsx("div",{className:"rounded-2xl border border-border-main bg-surface-panel/80 px-6 py-5 shadow-2xl",children:"正在加载工作台..."})}):q.jsx(x.Suspense,{fallback:q.jsx(Cb,{}),children:q.jsxs($v,{children:[q.jsx(an,{path:"/login",element:u?q.jsx(nn,{to:"/workspace",replace:!0}):q.jsx(Ob,{onSuccess:()=>o("/workspace")})}),q.jsx(an,{path:"/workspace",element:u?q.jsx(_b,{initialTool:new URLSearchParams(r.search).get("tool")??void 0,onLogout:()=>o("/login",{replace:!0})}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/dashboard",element:u?q.jsx(zb,{onBack:()=>o("/workspace")}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/users",element:u&&d?q.jsx(xb,{onBack:()=>o("/workspace")}):u?q.jsx(nn,{to:"/workspace",replace:!0}):q.jsx(nn,{to:"/login",replace:!0})}),q.jsx(an,{path:"/",element:q.jsx(nn,{to:u?"/workspace":"/login",replace:!0})}),q.jsx(an,{path:"*",element:q.jsx(nn,{to:"/",replace:!0})})]})})}function Db(){return q.jsx(hb,{children:q.jsx(Nb,{})})}Pp.createRoot(document.getElementById("app")).render(q.jsx(Vp.StrictMode,{children:q.jsx(bg,{children:q.jsx(Db,{})})}));export{Eb as T,Tb as U,Cf as a,Yi as c,Pn as h,q as j,x as r,py as u}; diff --git a/backend/src/main/resources/static/assets/index-CPovcnGC.css b/backend/src/main/resources/static/assets/index-CPovcnGC.css new file mode 100644 index 0000000..373ad96 --- /dev/null +++ b/backend/src/main/resources/static/assets/index-CPovcnGC.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--app-bg-0: #020617;--app-bg-1: #0a1626;--app-card: rgba(15, 23, 42, .72);--app-border: rgba(148, 163, 184, .16);--surface-app: #020617;--surface-panel: #0a1626;--surface-card: #0f172a;--surface-muted: rgba(30, 41, 59, .5);--surface-control: #020617;--border-main: rgba(148, 163, 184, .16);--border-subtle: rgba(148, 163, 184, .08);--text-main: #f1f5f9;--text-muted: #94a3b8;--text-dim: #64748b}html{color-scheme:dark;scrollbar-width:thin;scrollbar-color:rgba(103,232,249,.32) rgba(15,23,42,.72)}body{margin:0;min-width:320px;min-height:100vh;font-family:IBM Plex Sans,ui-sans-serif,system-ui,sans-serif;color:var(--text-main);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:radial-gradient(1200px 600px at 10% -10%,rgba(34,211,238,.16),transparent 60%),radial-gradient(900px 500px at 90% 0%,rgba(59,130,246,.1),transparent 55%),linear-gradient(180deg,var(--app-bg-0),var(--app-bg-1))}*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgba(103,232,249,.28) rgba(15,23,42,.4)}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:#0f172a73}*::-webkit-scrollbar-thumb{border:2px solid rgba(15,23,42,.4);border-radius:9999px;background:linear-gradient(180deg,#67e8f957,#22d3ee38)}code,kbd,samp,pre{font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Consolas,monospace}button,input,textarea,select{font:inherit}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-bottom-0\.5{bottom:-.125rem}.-right-0\.5{right:-.125rem}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-4{bottom:1rem}.bottom-\[14\%\]{bottom:14%}.left-1{left:.25rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-4{left:1rem}.left-\[12\%\]{left:12%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.right-\[10\%\]{right:10%}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-\[18\%\]{top:18%}.top-\[calc\(100\%\+8px\)\]{top:calc(100% + 8px)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.mx-auto{margin-left:auto;margin-right:auto}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-4{height:1rem}.h-48{height:12rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[46px\]{height:46px}.h-\[60vh\]{height:60vh}.h-\[70vh\]{height:70vh}.h-\[74vh\]{height:74vh}.h-\[80vh\]{height:80vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-72{max-height:18rem}.max-h-\[400px\]{max-height:400px}.max-h-\[92vh\]{max-height:92vh}.min-h-0{min-height:0px}.min-h-14{min-height:3.5rem}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-24{width:6rem}.w-28{width:7rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-56{width:14rem}.w-72{width:18rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[360px\]{width:360px}.w-\[80vw\]{width:80vw}.w-\[min\(360px\,calc\(100\%-2rem\)\)\]{width:min(360px,calc(100% - 2rem))}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-40{min-width:10rem}.min-w-44{min-width:11rem}.min-w-\[160px\]{min-width:160px}.min-w-\[48rem\]{min-width:48rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[120px\]{max-width:120px}.max-w-\[220px\]{max-width:220px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow-\[21\]{flex-grow:21}.grow-\[29\]{flex-grow:29}.grow-\[3\]{flex-grow:3}.grow-\[4\]{flex-grow:4}.grow-\[6\]{flex-grow:6}.grow-\[7\]{flex-grow:7}.basis-\[30\%\]{flex-basis:30%}.basis-\[40\%\]{flex-basis:40%}.basis-\[42\%\]{flex-basis:42%}.basis-\[58\%\]{flex-basis:58%}.basis-\[60\%\]{flex-basis:60%}.basis-\[70\%\]{flex-basis:70%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[28px\]{border-radius:28px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/25{border-color:#3b82f640}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600\/30{border-color:#2563eb4d}.border-blue-800\/40{border-color:#1e40af66}.border-blue-900\/30{border-color:#1e3a8a4d}.border-blue-900\/50{border-color:#1e3a8a80}.border-border-main{border-color:var(--border-main)}.border-border-subtle{border-color:var(--border-subtle)}.border-cyan-400{--tw-border-opacity: 1;border-color:rgb(34 211 238 / var(--tw-border-opacity, 1))}.border-cyan-400\/30{border-color:#22d3ee4d}.border-cyan-500\/20{border-color:#06b6d433}.border-cyan-500\/40{border-color:#06b6d466}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-700{--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity, 1))}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-900\/50{border-color:#581c8780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/25{border-color:#ef444440}.border-red-800{--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.border-surface-app{border-color:var(--surface-app)}.border-surface-panel{border-color:var(--surface-panel)}.border-transparent{border-color:transparent}.border-t-border-main{border-top-color:var(--border-main)}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/70{background-color:#000000b3}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-600\/10{background-color:#2563eb1a}.bg-blue-600\/20{background-color:#2563eb33}.bg-blue-900\/15{background-color:#1e3a8a26}.bg-blue-950\/20{background-color:#17255433}.bg-blue-950\/80{background-color:#172554cc}.bg-border-main{background-color:var(--border-main)}.bg-content-dim{background-color:var(--text-dim)}.bg-content-muted{background-color:var(--text-muted)}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/5{background-color:#06b6d40d}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/30{background-color:#3b07644d}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/5{background-color:#ef44440d}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-surface-app{background-color:var(--surface-app)}.bg-surface-card{background-color:var(--surface-card)}.bg-surface-control{background-color:var(--surface-control)}.bg-surface-muted{background-color:var(--surface-muted)}.bg-surface-panel{background-color:var(--surface-panel)}.bg-transparent{background-color:transparent}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/15{background-color:#eab30826}.bg-\[radial-gradient\(circle_at_top\,rgba\(56\,189\,248\,0\.09\)\,transparent_35\%\)\]{background-image:radial-gradient(circle at top,rgba(56,189,248,.09),transparent 35%)}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-400{--tw-gradient-from: #22d3ee var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-500{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500{--tw-gradient-from: #10b981 var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-orange-600{--tw-gradient-to: #ea580c var(--tw-gradient-to-position)}.to-teal-600{--tw-gradient-to: #0d9488 var(--tw-gradient-to-position)}.fill-amber-400{fill:#fbbf24}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-\[0\.24em\]{letter-spacing:.24em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-border-main{color:var(--border-main)}.text-content-dim{color:var(--text-dim)}.text-content-main{color:var(--text-main)}.text-content-muted{color:var(--text-muted)}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-cyan-500\/15{color:#06b6d426}.text-cyan-500\/30{color:#06b6d44d}.text-cyan-500\/70{color:#06b6d4b3}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/80{color:#10b981cc}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-500\/30{color:#ef44444d}.text-surface-muted{color:var(--surface-muted)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.accent-cyan-500{accent-color:#06b6d4}.accent-emerald-500{accent-color:#10b981}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_4px_rgba\(16\,185\,129\,0\.5\)\]{--tw-shadow: 0 0 4px rgba(16,185,129,.5);--tw-shadow-colored: 0 0 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_30px_80px_rgba\(2\,6\,23\,0\.3\)\]{--tw-shadow: 0 30px 80px rgba(2,6,23,.3);--tw-shadow-colored: 0 30px 80px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgba\(148\,163\,184\,0\.08\)\]{--tw-shadow: inset 0 1px 0 rgba(148,163,184,.08);--tw-shadow-colored: inset 0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-amber-900\/30{--tw-shadow-color: rgb(120 53 15 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/30{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-900\/20{--tw-shadow-color: rgb(30 58 138 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-cyan-900\/20{--tw-shadow-color: rgb(22 78 99 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-cyan-900\/30{--tw-shadow-color: rgb(22 78 99 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-900\/20{--tw-shadow-color: rgb(6 78 59 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-blue-500\/40{--tw-ring-color: rgb(59 130 246 / .4)}.ring-border-main{--tw-ring-color: var(--border-main)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[flex-grow\,flex-basis\,border-color\,box-shadow\]{transition-property:flex-grow,flex-basis,border-color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}html:not(.dark){color-scheme:light;--app-bg-0: #f1f5f9;--app-bg-1: #e2e8f0;--app-card: rgba(255, 255, 255, .85);--app-border: rgba(148, 163, 184, .25);--surface-app: #f8fafc;--surface-panel: #f1f5f9;--surface-card: #ffffff;--surface-muted: #e2e8f0;--surface-control: #ffffff;--border-main: rgba(148, 163, 184, .3);--border-subtle: rgba(148, 163, 184, .15);--text-main: #1e293b;--text-muted: #475569;--text-dim: #64748b}html:not(.dark) body{color:var(--text-main);background:radial-gradient(1400px 700px at 5% -15%,rgba(34,211,238,.05),transparent 65%),radial-gradient(1000px 600px at 95% 5%,rgba(59,130,246,.04),transparent 55%),linear-gradient(185deg,#f8fafc,#f1f5f9)}html:not(.dark) *{scrollbar-color:rgba(148,163,184,.4) rgba(226,232,240,.6)}html:not(.dark) *::-webkit-scrollbar-track{background:#e2e8f080}html:not(.dark) *::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#94a3b866,#cbd5e14d)}html:not(.dark) .glass-panel,html:not(.dark) .glass-panel-hover{background:#ffffffb3;border-color:#94a3b833}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}.placeholder\:text-content-dim::-moz-placeholder{color:var(--text-dim)}.placeholder\:text-content-dim::placeholder{color:var(--text-dim)}.focus-within\:border-blue-500\/60:focus-within{border-color:#3b82f699}.focus-within\:border-emerald-500\/40:focus-within{border-color:#10b98166}.focus-within\:bg-surface-muted:focus-within{background-color:var(--surface-muted)}.focus-within\:shadow-\[inset_0_1px_0_rgba\(96\,165\,250\,0\.18\)\]:focus-within{--tw-shadow: inset 0 1px 0 rgba(96,165,250,.18);--tw-shadow-colored: inset 0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-border-main:hover{border-color:var(--border-main)}.hover\:border-border-subtle:hover{border-color:var(--border-subtle)}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/5:hover{background-color:#3b82f60d}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500:hover{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500:hover{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-surface-muted:hover{background-color:var(--surface-muted)}.hover\:bg-surface-panel:hover{background-color:var(--surface-panel)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-cyan-400:hover{--tw-gradient-from: #22d3ee var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-emerald-400:hover{--tw-gradient-from: #34d399 var(--tw-gradient-from-position);--tw-gradient-to: rgb(52 211 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-blue-500:hover{--tw-gradient-to: #3b82f6 var(--tw-gradient-to-position)}.hover\:to-orange-500:hover{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.hover\:to-teal-500:hover{--tw-gradient-to: #14b8a6 var(--tw-gradient-to-position)}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-content-dim:hover{color:var(--text-dim)}.hover\:text-content-main:hover{color:var(--text-main)}.hover\:text-content-muted:hover{color:var(--text-muted)}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-cyan-500:hover{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.hover\:text-emerald-500:hover{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-200:hover{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:brightness-150:hover{--tw-brightness: brightness(1.5);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-border-subtle:focus{border-color:var(--border-subtle)}.focus\:border-cyan-500:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:bg-surface-panel:focus{background-color:var(--surface-panel)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-cyan-500\/20:focus{--tw-ring-color: rgb(6 182 212 / .2)}.focus\:ring-cyan-500\/30:focus{--tw-ring-color: rgb(6 182 212 / .3)}.focus\:ring-emerald-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-surface-app:focus{--tw-ring-offset-color: var(--surface-app)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-content-dim:disabled{color:var(--text-dim)}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.group:focus-within .group-focus-within\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:focus-within .group-focus-within\:text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:inline-block{display:inline-block}.group:hover .group-hover\:flex{display:flex}.group:hover .group-hover\:bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-content-main{color:var(--text-main)}.group:hover .group-hover\:opacity-100{opacity:1}.dark\:bg-\[linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.8\)\,rgba\(2\,6\,23\,1\)\)\]:is(.dark *){background-image:linear-gradient(135deg,#0f172acc,#020617)}.dark\:text-cyan-400:is(.dark *){--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-center{align-self:center}}@media(min-width:768px){.md\:max-w-xs{max-width:20rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-\[minmax\(0\,1\.4fr\)_120px_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.4fr) 120px minmax(0,1fr)}.md\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\:max-w-sm{max-width:24rem}} diff --git a/backend/src/main/resources/static/assets/monitor-D01QXMh7.js b/backend/src/main/resources/static/assets/monitor-BOliCSBz.js similarity index 95% rename from backend/src/main/resources/static/assets/monitor-D01QXMh7.js rename to backend/src/main/resources/static/assets/monitor-BOliCSBz.js index cb16a8b..161a00d 100644 --- a/backend/src/main/resources/static/assets/monitor-D01QXMh7.js +++ b/backend/src/main/resources/static/assets/monitor-BOliCSBz.js @@ -1 +1 @@ -import{c as o,h as t}from"./index-Z2D8CQl5.js";const s=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],y=o("activity",s);const r=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],h=o("monitor",r);const a=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],x=o("server",a);function d(){return t.get("/connections")}function k(n){return t.post("/connections",n)}function p(n,e){return t.put(`/connections/${n}`,e)}function g(n){return t.delete(`/connections/${n}`)}function l(n,e){return t.post("/connections/batch-command",{connectionIds:n,command:e})}function f(n){return t.post("/connections/status",{connectionIds:n})}function m(n){return t.put(`/connections/${n}/pin`)}function C(n,e,c,i){return t.post("/connections/quick-connect",{host:n,username:e,port:c,password:i})}function q(n){return t.get(`/monitor/${n}`)}export{y as A,h as M,x as S,k as a,f as c,g as d,l as e,q as g,d as l,C as q,m as t,p as u}; +import{c as o,h as t}from"./index-BQbRYAGj.js";const s=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],y=o("activity",s);const r=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],h=o("monitor",r);const a=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],x=o("server",a);function d(){return t.get("/connections")}function k(n){return t.post("/connections",n)}function p(n,e){return t.put(`/connections/${n}`,e)}function g(n){return t.delete(`/connections/${n}`)}function l(n,e){return t.post("/connections/batch-command",{connectionIds:n,command:e})}function f(n){return t.post("/connections/status",{connectionIds:n})}function m(n){return t.put(`/connections/${n}/pin`)}function C(n,e,c,i){return t.post("/connections/quick-connect",{host:n,username:e,port:c,password:i})}function q(n){return t.get(`/monitor/${n}`)}export{y as A,h as M,x as S,k as a,f as c,g as d,l as e,q as g,d as l,C as q,m as t,p as u}; diff --git a/backend/src/main/resources/static/index.html b/backend/src/main/resources/static/index.html index e27d80d..b7195b6 100644 --- a/backend/src/main/resources/static/index.html +++ b/backend/src/main/resources/static/index.html @@ -11,8 +11,8 @@ rel="stylesheet" /> SSH Manager - - + +

diff --git a/backend/src/test/java/com/sshmanager/controller/PortForwardControllerTest.java b/backend/src/test/java/com/sshmanager/controller/PortForwardControllerTest.java new file mode 100644 index 0000000..a72a394 --- /dev/null +++ b/backend/src/test/java/com/sshmanager/controller/PortForwardControllerTest.java @@ -0,0 +1,204 @@ +package com.sshmanager.controller; + +import com.sshmanager.entity.Connection; +import com.sshmanager.entity.User; +import com.sshmanager.exception.AccessDeniedException; +import com.sshmanager.exception.NotFoundException; +import com.sshmanager.repository.ConnectionRepository; +import com.sshmanager.repository.UserRepository; +import com.sshmanager.service.ConnectionService; +import com.sshmanager.service.PortForwardRegistry; +import com.sshmanager.service.PortForwardRegistry.TunnelEntry; +import com.sshmanager.service.PortForwardRegistry.TunnelStatus; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; + +import java.util.*; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * Unit tests for {@link PortForwardController}. + */ +@ExtendWith(MockitoExtension.class) +@SuppressWarnings("unchecked") +class PortForwardControllerTest { + + @Mock + private PortForwardRegistry portForwardRegistry; + @Mock + private ConnectionRepository connectionRepository; + @Mock + private ConnectionService connectionService; + @Mock + private UserRepository userRepository; + + @InjectMocks + private PortForwardController portForwardController; + + private Authentication authentication; + private User testUser; + private Connection connection; + + @BeforeEach + void setUp() { + authentication = mock(Authentication.class); + when(authentication.getName()).thenReturn("testuser"); + + testUser = new User(); + testUser.setId(100L); + testUser.setUsername("testuser"); + when(userRepository.findByUsername("testuser")).thenReturn(Optional.of(testUser)); + + connection = new Connection(); + connection.setId(1L); + connection.setUserId(100L); + connection.setName("test-conn"); + } + + @Test + void list_returnsActiveTunnels() { + TunnelEntry mockEntry = mock(TunnelEntry.class); + when(mockEntry.getId()).thenReturn("tunnel-id"); + when(mockEntry.getConnectionId()).thenReturn(1L); + when(mockEntry.getConnectionName()).thenReturn("test-conn"); + when(mockEntry.getLocalPort()).thenReturn(8080); + when(mockEntry.getRemoteHost()).thenReturn("127.0.0.1"); + when(mockEntry.getRemotePort()).thenReturn(3306); + when(mockEntry.getStatus()).thenReturn(TunnelStatus.RUNNING); + when(mockEntry.getCreatedAt()).thenReturn(java.time.Instant.now()); + + when(portForwardRegistry.listByUser(100L)).thenReturn(Collections.singletonList(mockEntry)); + + ResponseEntity>> response = (ResponseEntity>>) (Object) portForwardController.list(authentication); + + assertEquals(200, response.getStatusCode().value()); + List> body = response.getBody(); + assertNotNull(body); + assertEquals(1, body.size()); + assertEquals("tunnel-id", body.get(0).get("id")); + } + + @Test + void create_success() throws Exception { + Map body = new HashMap<>(); + body.put("connectionId", 1L); + body.put("localPort", 8080); + body.put("remoteHost", "127.0.0.1"); + body.put("remotePort", 3306); + + when(connectionRepository.findById(1L)).thenReturn(Optional.of(connection)); + when(connectionService.getDecryptedPassword(connection)).thenReturn("password"); + + TunnelEntry mockEntry = mock(TunnelEntry.class); + when(mockEntry.getId()).thenReturn("tunnel-id"); + when(mockEntry.getConnectionId()).thenReturn(1L); + when(mockEntry.getConnectionName()).thenReturn("test-conn"); + when(mockEntry.getLocalPort()).thenReturn(8080); + when(mockEntry.getRemoteHost()).thenReturn("127.0.0.1"); + when(mockEntry.getRemotePort()).thenReturn(3306); + when(mockEntry.getStatus()).thenReturn(TunnelStatus.RUNNING); + when(mockEntry.getCreatedAt()).thenReturn(java.time.Instant.now()); + + when(portForwardRegistry.create(eq(100L), eq(connection), eq("password"), any(), any(), eq(8080), eq("127.0.0.1"), eq(3306))) + .thenReturn(mockEntry); + + ResponseEntity response = portForwardController.create(body, authentication); + + assertEquals(200, response.getStatusCode().value()); + Map respBody = (Map) response.getBody(); + assertNotNull(respBody); + assertEquals("tunnel-id", respBody.get("id")); + } + + @Test + void create_invalidRequestBody() { + Map body = new HashMap<>(); + // missing connectionId and ports + + ResponseEntity response = portForwardController.create(body, authentication); + + assertEquals(400, response.getStatusCode().value()); + Map respBody = (Map) response.getBody(); + assertNotNull(respBody); + assertTrue(respBody.get("error").contains("Invalid request body")); + } + + @Test + void create_connectionNotFound() { + Map body = new HashMap<>(); + body.put("connectionId", 999L); + body.put("localPort", 8080); + body.put("remoteHost", "127.0.0.1"); + body.put("remotePort", 3306); + + when(connectionRepository.findById(999L)).thenReturn(Optional.empty()); + + assertThrows(NotFoundException.class, () -> + portForwardController.create(body, authentication)); + } + + @Test + void create_accessDenied() { + Map body = new HashMap<>(); + body.put("connectionId", 1L); + body.put("localPort", 8080); + body.put("remoteHost", "127.0.0.1"); + body.put("remotePort", 3306); + + Connection otherUserConnection = new Connection(); + otherUserConnection.setId(1L); + otherUserConnection.setUserId(200L); // different owner + + when(connectionRepository.findById(1L)).thenReturn(Optional.of(otherUserConnection)); + + assertThrows(AccessDeniedException.class, () -> + portForwardController.create(body, authentication)); + } + + @Test + void create_internalServerError() throws Exception { + Map body = new HashMap<>(); + body.put("connectionId", 1L); + body.put("localPort", 8080); + body.put("remoteHost", "127.0.0.1"); + body.put("remotePort", 3306); + + when(connectionRepository.findById(1L)).thenReturn(Optional.of(connection)); + when(portForwardRegistry.create(any(), any(), any(), any(), any(), anyInt(), anyString(), anyInt())) + .thenThrow(new RuntimeException("SSH failed")); + + ResponseEntity response = portForwardController.create(body, authentication); + + assertEquals(500, response.getStatusCode().value()); + Map respBody = (Map) response.getBody(); + assertNotNull(respBody); + assertEquals("Failed to create port-forward: SSH failed", respBody.get("error")); + } + + @Test + void stop_success() { + ResponseEntity> response = portForwardController.stop("tunnel-id", authentication); + + assertEquals(200, response.getStatusCode().value()); + verify(portForwardRegistry).stop("tunnel-id", 100L); + } + + @Test + void stop_throwsIllegalArgumentException() { + doThrow(new IllegalArgumentException("Tunnel not found")) + .when(portForwardRegistry).stop("nonexistent-id", 100L); + + ResponseEntity> response = portForwardController.stop("nonexistent-id", authentication); + + assertEquals(400, response.getStatusCode().value()); + assertEquals("Tunnel not found", response.getBody().get("error")); + } +} diff --git a/backend/src/test/java/com/sshmanager/controller/TerminalWebSocketHandlerTest.java b/backend/src/test/java/com/sshmanager/controller/TerminalWebSocketHandlerTest.java index ab69210..1bbc1e9 100644 --- a/backend/src/test/java/com/sshmanager/controller/TerminalWebSocketHandlerTest.java +++ b/backend/src/test/java/com/sshmanager/controller/TerminalWebSocketHandlerTest.java @@ -60,6 +60,56 @@ class TerminalWebSocketHandlerTest { verify(sshSession, never()).getInputStream(); } + @Test + @SuppressWarnings("unchecked") + void cleanupIdleSessionsClosesExpiredWebSockets() throws Exception { + ConnectionRepository connectionRepository = mock(ConnectionRepository.class); + UserRepository userRepository = mock(UserRepository.class); + ConnectionService connectionService = mock(ConnectionService.class); + SshService sshService = mock(SshService.class); + QuickConnectionRegistry quickConnections = mock(QuickConnectionRegistry.class); + QuickCredentialRegistry quickCredentials = mock(QuickCredentialRegistry.class); + ExecutorService executor = mock(ExecutorService.class); + + TerminalWebSocketHandler handler = new TerminalWebSocketHandler( + connectionRepository, + userRepository, + connectionService, + sshService, + quickConnections, + quickCredentials, + executor + ); + + Field wsSessionsField = TerminalWebSocketHandler.class.getDeclaredField("wsSessions"); + wsSessionsField.setAccessible(true); + Map wsSessions = (Map) wsSessionsField.get(handler); + + Field lastActivityField = TerminalWebSocketHandler.class.getDeclaredField("lastActivity"); + lastActivityField.setAccessible(true); + Map lastActivity = (Map) lastActivityField.get(handler); + + Field idleTimeoutField = TerminalWebSocketHandler.class.getDeclaredField("idleTimeoutMinutes"); + idleTimeoutField.setAccessible(true); + idleTimeoutField.set(handler, 30L); + + WebSocketSession ws1 = mock(WebSocketSession.class); + when(ws1.isOpen()).thenReturn(true); + + WebSocketSession ws2 = mock(WebSocketSession.class); + + wsSessions.put("ws1", ws1); + lastActivity.put("ws1", System.currentTimeMillis() - (31 * 60 * 1000L)); + + wsSessions.put("ws2", ws2); + lastActivity.put("ws2", System.currentTimeMillis() - (10 * 60 * 1000L)); + + handler.cleanupIdleSessions(); + + verify(ws1).close(org.springframework.web.socket.CloseStatus.GOING_AWAY); + verify(ws2, never()).close(org.springframework.web.socket.CloseStatus.GOING_AWAY); + } + @SuppressWarnings("unchecked") private Map sessionsMap(TerminalWebSocketHandler handler) throws Exception { Field f = TerminalWebSocketHandler.class.getDeclaredField("sessions"); diff --git a/backend/src/test/java/com/sshmanager/service/ConnectionStatusServiceTest.java b/backend/src/test/java/com/sshmanager/service/ConnectionStatusServiceTest.java index d705f09..45f2832 100644 --- a/backend/src/test/java/com/sshmanager/service/ConnectionStatusServiceTest.java +++ b/backend/src/test/java/com/sshmanager/service/ConnectionStatusServiceTest.java @@ -3,19 +3,20 @@ package com.sshmanager.service; import com.sshmanager.dto.ConnectionStatusCheckRequest; import com.sshmanager.dto.ConnectionStatusResponseDto; import com.sshmanager.entity.Connection; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Arrays; +import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.doReturn; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doThrow; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -24,49 +25,128 @@ class ConnectionStatusServiceTest { @Mock private ConnectionService connectionService; - @InjectMocks + @Mock + private TcpProbe tcpProbe; + private ConnectionStatusService connectionStatusService; - @Test - void checkStatusesAggregatesOnlineAndOfflineResults() { - Connection onlineConnection = new Connection(); - onlineConnection.setId(1L); - onlineConnection.setUserId(99L); - onlineConnection.setName("prod"); + @BeforeEach + void setUp() { + connectionStatusService = new ConnectionStatusService(connectionService, tcpProbe); + } - Connection offlineConnection = new Connection(); - offlineConnection.setId(2L); - offlineConnection.setUserId(99L); - offlineConnection.setName("test"); + @Test + void checkStatusesRejectsEmptyConnectionIds() { + ConnectionStatusCheckRequest request = new ConnectionStatusCheckRequest(); + IllegalArgumentException error = assertThrows( + IllegalArgumentException.class, + () -> connectionStatusService.checkStatuses(1L, request) + ); + assertEquals("At least one connection is required", error.getMessage()); + } + + @Test + void checkStatusesMarksReachableAsOnline() throws Exception { + Connection conn = new Connection(); + conn.setId(1L); + conn.setUserId(99L); + conn.setName("reachable-host"); + conn.setHost("10.0.0.1"); + conn.setPort(22); + + when(connectionService.getConnectionForSsh(1L, 99L)).thenReturn(conn); ConnectionStatusCheckRequest request = new ConnectionStatusCheckRequest(); - request.setConnectionIds(Arrays.asList(1L, 2L)); + request.setConnectionIds(Arrays.asList(1L)); - when(connectionService.getConnectionForSsh(1L, 99L)).thenReturn(onlineConnection); - when(connectionService.getConnectionForSsh(2L, 99L)).thenReturn(offlineConnection); - doReturn(onlineConnection).when(connectionService).testConnection(eq(onlineConnection), eq(null), eq(null), eq(null)); - doThrow(new RuntimeException("Connection refused")).when(connectionService).testConnection(eq(offlineConnection), eq(null), eq(null), eq(null)); + ConnectionStatusResponseDto response = connectionStatusService.checkStatuses(99L, request); + + assertEquals(1, response.getTotal()); + assertEquals(1, response.getOnlineCount()); + assertEquals(0, response.getOfflineCount()); + assertEquals("online", response.getResults().get(0).getStatus()); + assertEquals("TCP port reachable", response.getResults().get(0).getMessage()); + } + + @Test + void checkStatusesMarksUnreachableAsOffline() throws Exception { + Connection conn = new Connection(); + conn.setId(2L); + conn.setUserId(99L); + conn.setName("unreachable-host"); + conn.setHost("10.0.0.2"); + conn.setPort(22); + + when(connectionService.getConnectionForSsh(2L, 99L)).thenReturn(conn); + doAnswer(invocation -> { throw new RuntimeException("Connection refused"); }) + .when(tcpProbe).checkReachable(conn, 5); + + ConnectionStatusCheckRequest request = new ConnectionStatusCheckRequest(); + request.setConnectionIds(Arrays.asList(2L)); + + ConnectionStatusResponseDto response = connectionStatusService.checkStatuses(99L, request); + + assertEquals(1, response.getTotal()); + assertEquals(0, response.getOnlineCount()); + assertEquals(1, response.getOfflineCount()); + assertEquals("offline", response.getResults().get(0).getStatus()); + } + + @Test + void checkStatusesAggregatesMixedResults() throws Exception { + Connection online = new Connection(); + online.setId(10L); + online.setUserId(99L); + online.setName("server-a"); + online.setHost("10.0.0.1"); + online.setPort(22); + + Connection offline = new Connection(); + offline.setId(20L); + offline.setUserId(99L); + offline.setName("server-b"); + offline.setHost("10.0.0.2"); + offline.setPort(22); + + when(connectionService.getConnectionForSsh(10L, 99L)).thenReturn(online); + when(connectionService.getConnectionForSsh(20L, 99L)).thenReturn(offline); + // Answer with argument matching based on connection ID + doAnswer(invocation -> { + Connection c = invocation.getArgument(0); + if (c.getId() == 20L) throw new RuntimeException("Connection refused"); + return null; + }).when(tcpProbe).checkReachable(any(Connection.class), anyInt()); + + ConnectionStatusCheckRequest request = new ConnectionStatusCheckRequest(); + request.setConnectionIds(Arrays.asList(10L, 20L)); ConnectionStatusResponseDto response = connectionStatusService.checkStatuses(99L, request); assertEquals(2, response.getTotal()); assertEquals(1, response.getOnlineCount()); assertEquals(1, response.getOfflineCount()); - assertEquals("online", response.getResults().get(0).getStatus()); - assertEquals("offline", response.getResults().get(1).getStatus()); - assertEquals("prod", response.getResults().get(0).getConnectionName()); - assertEquals("Connection refused", response.getResults().get(1).getMessage()); } @Test - void checkStatusesRejectsEmptyConnectionIds() { + void checkStatusesHandlesAllOfflineGracefully() throws Exception { + Connection conn = new Connection(); + conn.setId(99L); + conn.setUserId(99L); + conn.setName("fail-host"); + conn.setHost("10.0.0.1"); + conn.setPort(22); + + when(connectionService.getConnectionForSsh(99L, 99L)).thenReturn(conn); + doAnswer(invocation -> { throw new RuntimeException("timeout"); }) + .when(tcpProbe).checkReachable(conn, 5); + ConnectionStatusCheckRequest request = new ConnectionStatusCheckRequest(); + request.setConnectionIds(Collections.singletonList(99L)); - IllegalArgumentException error = assertThrows( - IllegalArgumentException.class, - () -> connectionStatusService.checkStatuses(1L, request) - ); + ConnectionStatusResponseDto response = connectionStatusService.checkStatuses(99L, request); - assertEquals("At least one connection is required", error.getMessage()); + assertEquals(1, response.getTotal()); + assertEquals(0, response.getOnlineCount()); + assertEquals(1, response.getOfflineCount()); } } diff --git a/backend/src/test/java/com/sshmanager/service/PortForwardRegistryTest.java b/backend/src/test/java/com/sshmanager/service/PortForwardRegistryTest.java new file mode 100644 index 0000000..121d625 --- /dev/null +++ b/backend/src/test/java/com/sshmanager/service/PortForwardRegistryTest.java @@ -0,0 +1,191 @@ +package com.sshmanager.service; + +import com.jcraft.jsch.Session; +import com.sshmanager.entity.Connection; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * Unit tests for {@link PortForwardRegistry}. + * + *

The JSch {@link Session} is mocked so no real SSH connections are made. + * Reflection is used to inject mock tunnels into the registry. + */ +@ExtendWith(MockitoExtension.class) +class PortForwardRegistryTest { + + @Mock + private Session mockSession; + + @Mock + private SshSessionFactory sshSessionFactory; + + private PortForwardRegistry registry; + private Connection connection; + + @BeforeEach + void setUp() { + registry = new PortForwardRegistry(sshSessionFactory); + connection = new Connection(); + connection.setId(1L); + connection.setUserId(100L); + connection.setName("test-conn"); + connection.setHost("example.com"); + connection.setPort(22); + connection.setUsername("user"); + connection.setAuthType(Connection.AuthType.PASSWORD); + } + + @SuppressWarnings("unchecked") + private PortForwardRegistry.TunnelEntry addMockTunnel(Long userId, int localPort, + String remoteHost, int remotePort) + throws Exception { + String id = "test-id-" + localPort; + PortForwardRegistry.TunnelEntry entry = new PortForwardRegistry.TunnelEntry( + id, userId, connection.getId(), connection.getName(), + localPort, remoteHost, remotePort, mockSession); + + Map tunnels = + (Map) ReflectionTestUtils.getField(registry, "tunnels"); + if (tunnels != null) { + tunnels.put(id, entry); + } + return entry; + } + + // ── validation tests ───────────────────────────────────────────────────── + + @Test + void create_throwsOnInvalidLocalPort() { + assertThrows(IllegalArgumentException.class, () -> + registry.create(100L, connection, "pass", null, null, 0, "127.0.0.1", 3306)); + } + + @Test + void create_throwsOnPortAboveRange() { + assertThrows(IllegalArgumentException.class, () -> + registry.create(100L, connection, "pass", null, null, 70000, "127.0.0.1", 3306)); + } + + @Test + void create_throwsOnInvalidRemotePort() { + assertThrows(IllegalArgumentException.class, () -> + registry.create(100L, connection, "pass", null, null, 8080, "127.0.0.1", 0)); + } + + @Test + void create_throwsOnBlankRemoteHost() { + assertThrows(IllegalArgumentException.class, () -> + registry.create(100L, connection, "pass", null, null, 8080, " ", 3306)); + } + + @Test + void create_throwsOnNullRemoteHost() { + assertThrows(IllegalArgumentException.class, () -> + registry.create(100L, connection, "pass", null, null, 8080, null, 3306)); + } + + @Test + void create_success() throws Exception { + when(sshSessionFactory.createSession(any(), any(), any(), any())) + .thenReturn(mockSession); + when(mockSession.setPortForwardingL(anyInt(), anyString(), anyInt())).thenReturn(8080); + + PortForwardRegistry.TunnelEntry entry = registry.create(100L, connection, "pass", null, null, 8080, "127.0.0.1", 3306); + + assertNotNull(entry); + assertEquals(100L, entry.getUserId()); + assertEquals(8080, entry.getLocalPort()); + assertEquals("127.0.0.1", entry.getRemoteHost()); + assertEquals(3306, entry.getRemotePort()); + assertEquals(PortForwardRegistry.TunnelStatus.RUNNING, entry.getStatus()); + verify(mockSession).setPortForwardingL(8080, "127.0.0.1", 3306); + } + + // ── TunnelEntry model tests ─────────────────────────────────────────────── + + @Test + void tunnelEntry_initialStatusIsRunning() throws Exception { + PortForwardRegistry.TunnelEntry entry = addMockTunnel(100L, 8080, "127.0.0.1", 3306); + assertEquals(PortForwardRegistry.TunnelStatus.RUNNING, entry.getStatus()); + } + + @Test + void tunnelEntry_fieldsAreCorrectlySet() throws Exception { + PortForwardRegistry.TunnelEntry entry = addMockTunnel(100L, 8080, "db.internal", 5432); + assertEquals(100L, entry.getUserId()); + assertEquals(8080, entry.getLocalPort()); + assertEquals("db.internal", entry.getRemoteHost()); + assertEquals(5432, entry.getRemotePort()); + assertNotNull(entry.getCreatedAt()); + assertNotNull(entry.getId()); + } + + // ── stop tests ──────────────────────────────────────────────────────────── + + @Test + void stop_throwsOnUnknownId() { + assertThrows(IllegalArgumentException.class, () -> + registry.stop("nonexistent-id", 100L)); + } + + @Test + void stop_stopsActiveTunnel() throws Exception { + PortForwardRegistry.TunnelEntry entry = addMockTunnel(100L, 8080, "127.0.0.1", 3306); + when(mockSession.isConnected()).thenReturn(true); + + registry.stop(entry.getId(), 100L); + + verify(mockSession).delPortForwardingL(8080); + verify(mockSession).disconnect(); + assertEquals(PortForwardRegistry.TunnelStatus.STOPPED, entry.getStatus()); + assertTrue(registry.listByUser(100L).isEmpty()); + } + + @Test + void stop_throwsOnAccessDenied() throws Exception { + PortForwardRegistry.TunnelEntry entry = addMockTunnel(100L, 8080, "127.0.0.1", 3306); + + assertThrows(IllegalArgumentException.class, () -> + registry.stop(entry.getId(), 200L)); // wrong user + + assertEquals(PortForwardRegistry.TunnelStatus.RUNNING, entry.getStatus()); + verify(mockSession, never()).disconnect(); + } + + // ── listByUser ──────────────────────────────────────────────────────────── + + @Test + void listByUser_returnsEmptyWhenNone() { + List list = registry.listByUser(100L); + assertNotNull(list); + assertTrue(list.isEmpty()); + } + + @Test + void listByUser_returnsOnlyUserTunnels() throws Exception { + PortForwardRegistry.TunnelEntry e1 = addMockTunnel(100L, 8080, "127.0.0.1", 3306); + PortForwardRegistry.TunnelEntry e2 = addMockTunnel(100L, 8081, "127.0.0.1", 5432); + PortForwardRegistry.TunnelEntry e3 = addMockTunnel(200L, 8082, "127.0.0.1", 6379); + + List user100Tunnels = registry.listByUser(100L); + assertEquals(2, user100Tunnels.size()); + assertTrue(user100Tunnels.contains(e1)); + assertTrue(user100Tunnels.contains(e2)); + assertFalse(user100Tunnels.contains(e3)); + + List user200Tunnels = registry.listByUser(200L); + assertEquals(1, user200Tunnels.size()); + assertTrue(user200Tunnels.contains(e3)); + } +} diff --git a/backend/src/test/java/com/sshmanager/service/QuickConnectionRegistryTest.java b/backend/src/test/java/com/sshmanager/service/QuickConnectionRegistryTest.java new file mode 100644 index 0000000..75c9759 --- /dev/null +++ b/backend/src/test/java/com/sshmanager/service/QuickConnectionRegistryTest.java @@ -0,0 +1,137 @@ +package com.sshmanager.service; + +import com.sshmanager.entity.Connection; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Unit tests for {@link QuickConnectionRegistry}. + * + *

These tests exercise the core lifecycle (create / get / remove) and the TTL + * eviction logic without starting a Spring context. + */ +class QuickConnectionRegistryTest { + + private QuickConnectionRegistry registry; + + @BeforeEach + void setUp() { + registry = new QuickConnectionRegistry(); + // Default TTL: 30 minutes (not relevant for most tests — overridden where needed) + ReflectionTestUtils.setField(registry, "ttlMinutes", 30L); + } + + // ── basic lifecycle ─────────────────────────────────────────────────────── + + @Test + void create_returnsConnectionWithCorrectFields() { + Connection conn = registry.create("192.168.1.1", "admin", 22, 1L); + + assertNotNull(conn.getId()); + assertTrue(conn.getId() >= 10_000_001L, "ID should be in quick-connect namespace"); + assertEquals("192.168.1.1", conn.getHost()); + assertEquals("admin", conn.getUsername()); + assertEquals(22, conn.getPort()); + assertEquals(1L, conn.getUserId()); + assertEquals(Connection.AuthType.PASSWORD, conn.getAuthType()); + } + + @Test + void get_returnsConnectionAfterCreate() { + Connection conn = registry.create("host", "user", 22, 1L); + + Connection found = registry.get(conn.getId()); + assertNotNull(found); + assertEquals(conn.getId(), found.getId()); + } + + @Test + void get_returnsNullForUnknownId() { + assertNull(registry.get(999_999L)); + } + + @Test + void remove_deletesEntry() { + Connection conn = registry.create("host", "user", 22, 1L); + registry.remove(conn.getId()); + + assertNull(registry.get(conn.getId())); + assertEquals(0, registry.size()); + } + + @Test + void persistentConnections_areNotAffectedByRegistry() { + // Registry only holds quick connections; a regular DB ID (e.g. 1) is never stored here + assertNull(registry.get(1L)); + } + + @Test + void multipleEntries_areStoredIndependently() { + Connection a = registry.create("host-a", "ua", 22, 1L); + Connection b = registry.create("host-b", "ub", 2222, 2L); + + assertEquals(2, registry.size()); + assertNotNull(registry.get(a.getId())); + assertNotNull(registry.get(b.getId())); + } + + // ── TTL eviction ───────────────────────────────────────────────────────── + + @Test + void evictExpired_removesEntriesOlderThanTtl() throws Exception { + // Set a 0-minute TTL so every entry is immediately "expired" + ReflectionTestUtils.setField(registry, "ttlMinutes", 0L); + + registry.create("host", "user", 22, 1L); + assertEquals(1, registry.size()); + + // Small delay so lastAccessAt < now - ttl (ttl = 0 ms) + Thread.sleep(5); + registry.evictExpired(); + + assertEquals(0, registry.size()); + } + + @Test + void evictExpired_keepsRecentEntries() { + // TTL = 30 min — newly created entries should survive + registry.create("host", "user", 22, 1L); + registry.evictExpired(); + + assertEquals(1, registry.size()); + } + + @Test + void touch_preventsEviction() throws Exception { + // 1-ms TTL would normally evict immediately + ReflectionTestUtils.setField(registry, "ttlMinutes", 0L); + + Connection conn = registry.create("host", "user", 22, 1L); + + // Touch resets lastAccessAt to now — entry should survive one sweep cycle + // when the sweep happens within the same millisecond + registry.touch(conn.getId()); + + // We cannot guarantee sub-millisecond execution, so just verify touch + // doesn't throw and the entry is still accessible right after touch. + assertNotNull(registry.get(conn.getId())); + } + + @Test + void touch_onUnknownId_doesNotThrow() { + assertDoesNotThrow(() -> registry.touch(999_999L)); + } + + // ── id namespace ───────────────────────────────────────────────────────── + + @Test + void consecutiveCreates_produceIncreasingIds() { + Connection first = registry.create("h", "u", 22, 1L); + Connection second = registry.create("h", "u", 22, 1L); + + assertTrue(second.getId() > first.getId()); + } +} diff --git a/docker/Dockerfile b/docker/Dockerfile index 81ea178..aa70aec 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,10 +5,10 @@ FROM node:20-alpine AS frontend COPY docker/.npmrc /root/.npmrc WORKDIR /app -COPY frontend-v2/package.json frontend-v2/package-lock.json ./ +COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci --prefer-offline --no-audit -COPY frontend-v2/ ./ +COPY frontend/ ./ RUN npm run build # ========== 阶段二:后端构建(国内 Maven 源) ========== diff --git a/frontend/public/ssh-manager.svg b/frontend/public/ssh-manager.svg index b2338d0..4e64828 100644 --- a/frontend/public/ssh-manager.svg +++ b/frontend/public/ssh-manager.svg @@ -1,38 +1,101 @@ - + - + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + - - + + - - - + + - - - - + + + + + + + - - + + + + + + + ssh-session + + + + + + + + - - - - + + + + + + + + + + + + + diff --git a/frontend/src/components/PortForwardModal.tsx b/frontend/src/components/PortForwardModal.tsx new file mode 100644 index 0000000..f38cf5c --- /dev/null +++ b/frontend/src/components/PortForwardModal.tsx @@ -0,0 +1,293 @@ +import { useEffect, useState } from 'react' +import { + AlertCircle, + Network, + Play, + RefreshCw, + StopCircle, + Trash2, +} from 'lucide-react' +import Modal from './Modal' +import { + createPortForward, + listPortForwards, + stopPortForward, + type PortForwardTunnel, +} from '../services/portForwards' +import type { Connection } from '../types' + +interface PortForwardModalProps { + open: boolean + connections: Connection[] + initialConnectionId?: number | null + onClose: () => void +} + +export default function PortForwardModal({ + open, + connections, + initialConnectionId, + onClose, +}: PortForwardModalProps) { + const [tunnels, setTunnels] = useState([]) + const [loading, setLoading] = useState(false) + const [submitting, setSubmitting] = useState(false) + const [error, setError] = useState(null) + + // Form state + const [connectionId, setConnectionId] = useState(0) + const [localPort, setLocalPort] = useState(8080) + const [remoteHost, setRemoteHost] = useState('127.0.0.1') + const [remotePort, setRemotePort] = useState(80) + + // Load tunnels + const fetchTunnels = async (showLoading = true) => { + if (showLoading) setLoading(true) + setError(null) + try { + const data = await listPortForwards() + setTunnels(data) + } catch (err: any) { + setError(err.message ?? '获取端口转发列表失败') + } finally { + if (showLoading) setLoading(false) + } + } + + useEffect(() => { + if (open) { + fetchTunnels(true) + // Pre-select connection if provided + if (initialConnectionId) { + setConnectionId(initialConnectionId) + } else if (connections.length > 0) { + setConnectionId(connections[0].id) + } + } + }, [open, initialConnectionId, connections]) + + const handleStartTunnel = async (e: React.FormEvent) => { + e.preventDefault() + if (!connectionId) { + setError('请选择 SSH 连接') + return + } + setError(null) + setSubmitting(true) + try { + await createPortForward({ + connectionId, + localPort, + remoteHost: remoteHost.trim(), + remotePort, + }) + // Reset form options (keep connection, maybe increment local port) + setLocalPort((prev) => prev + 1) + await fetchTunnels(false) + } catch (err: any) { + setError(err.message ?? '启动端口转发失败') + } finally { + setSubmitting(false) + } + } + + const handleStopTunnel = async (id: string) => { + setError(null) + try { + await stopPortForward(id) + await fetchTunnels(false) + } catch (err: any) { + setError(err.message ?? '停止端口转发失败') + } + } + + if (!open) return null + + return ( + +

+ {/* Left Column: Form to create a new tunnel */} +
+

+ + 新建端口转发通道 +

+ +
+
+ + +
+ +
+ + setLocalPort(Number(e.target.value))} + className="w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition" + required + /> +
+ +
+
+ + setRemoteHost(e.target.value)} + className="w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition" + required + /> +
+ +
+ + setRemotePort(Number(e.target.value))} + className="w-full rounded-xl border border-border-main bg-surface-control px-3.5 py-2 text-sm text-content-main focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition" + required + /> +
+
+ + {error && ( +
+ + {error} +
+ )} + + +
+
+ + {/* Right Column: List of running tunnels */} +
+
+

+ + 活动转发列表 +

+ +
+ +
+ {loading && tunnels.length === 0 ? ( +
+ 加载中... +
+ ) : tunnels.length === 0 ? ( +
+ + 暂无活动的端口转发通道 +
+ ) : ( +
+ {tunnels.map((tunnel) => ( +
+
+
+ + {tunnel.connectionName} + + | + + :{tunnel.localPort} + + + + {tunnel.remoteHost}:{tunnel.remotePort} + +
+
+ + 启动时间: {new Date(tunnel.createdAt).toLocaleTimeString()} + + + + + {tunnel.status === 'running' + ? '运行中' + : tunnel.status === 'error' + ? '异常' + : '已停止'} + +
+
+ + +
+ ))} +
+ )} +
+
+
+ + ) +} diff --git a/frontend/src/pages/WorkspacePage.tsx b/frontend/src/pages/WorkspacePage.tsx index 55897de..ed658b7 100644 --- a/frontend/src/pages/WorkspacePage.tsx +++ b/frontend/src/pages/WorkspacePage.tsx @@ -10,6 +10,7 @@ import { Monitor, Plus, Search, + Network, Settings, SplitSquareHorizontal, Terminal, @@ -61,6 +62,7 @@ import SettingsModal from '../components/SettingsModal' import SftpPane from '../components/SftpPane' import TerminalPane from '../components/TerminalPane' import TransferCenterModal from '../components/TransferCenterModal' +import PortForwardModal from '../components/PortForwardModal' const terminalStatusCopy: Record = { idle: { label: '终端未打开', tone: 'text-content-muted', dot: 'bg-content-muted' }, @@ -254,6 +256,8 @@ export default function WorkspacePage({ const [showBatchModal, setShowBatchModal] = useState(false) const [showTransferModal, setShowTransferModal] = useState(initialTool === 'transfers') const [showSettingsModal, setShowSettingsModal] = useState(false) + const [showPortForwardModal, setShowPortForwardModal] = useState(false) + const [portForwardInitialConnId, setPortForwardInitialConnId] = useState(null) const [quickTokens, setQuickTokens] = useState>({}) const [showChangePassword, setShowChangePassword] = useState(!!user?.passwordChangeRequired) const [transferTasks, setTransferTasks] = useState([]) @@ -740,6 +744,16 @@ export default function WorkspacePage({ 传输中心 + - ) : null} + ) : ( + + )}