import { jsxs as _jsxs } from "react/jsx-runtime";
/**
 * Connection Status Component
 *
 * Displays daemon connection status indicator.
 */
import { useConnection } from "@ghostflow/ui-core";
import { Text } from "ink";
import { memo } from "react";
// ============================================================================
// Constants
// ============================================================================
/** Status indicator symbol (filled circle) */
const STATUS_SYMBOL = "\u25CF";
/** Text for connecting state */
const TEXT_CONNECTING = "Connecting...";
/** Text for connected state */
const TEXT_CONNECTED = "Connected";
/** Text for disconnected state */
const TEXT_DISCONNECTED = "Disconnected";
// ============================================================================
// Helpers
// ============================================================================
/** Render the pending (connecting) state */
const renderPendingState = () => (_jsxs(Text, { color: "yellow", children: [STATUS_SYMBOL, " ", TEXT_CONNECTING] }));
/** Render the connected state */
const renderConnectedState = () => (_jsxs(Text, { color: "green", children: [STATUS_SYMBOL, " ", TEXT_CONNECTED] }));
/** Render the disconnected state */
const renderDisconnectedState = () => (_jsxs(Text, { color: "red", children: [STATUS_SYMBOL, " ", TEXT_DISCONNECTED] }));
// ============================================================================
// Component
// ============================================================================
/**
 * Connection status indicator showing daemon connectivity.
 * Uses React Query's native error/success states.
 */
export const ConnectionStatus = memo(() => {
    const { isPending, isSuccess } = useConnection();
    if (isPending) {
        return renderPendingState();
    }
    return isSuccess ? renderConnectedState() : renderDisconnectedState();
});
ConnectionStatus.displayName = "ConnectionStatus";
//# sourceMappingURL=ConnectionStatus.js.map