import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { RefreshCw } from "lucide-react";
import { useIndexStatus } from "./index/useIndexStatus";
import { IndexStatusCards } from "./index/IndexStatusCards";
import { EmbeddingProviderInfo } from "./index/EmbeddingProviderInfo";
import { QueueErrorsDisplay } from "./index/QueueErrorsDisplay";
import { CollectionWarningsDisplay } from "./index/CollectionWarningsDisplay";
import { RebuildIndexSection } from "./index/RebuildIndexSection";
import { RecentBatchesList } from "./index/RecentBatchesList";
import { LatestEmbeddingsList } from "./index/LatestEmbeddingsList";
import { AdvancedSettings } from "./index/AdvancedSettings";
/**
 * Main Index Overview component that displays index status and rebuild controls
 */
export function IndexOverview() {
    const { state, actions } = useIndexStatus();
    return (_jsx("div", { className: "flex min-h-full w-full items-stretch select-text", children: _jsxs("div", { className: "flex w-full flex-col gap-3 p-4", children: [state.error && (_jsx("div", { className: "rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: state.error })), state.isLoading && !state.indexStatus ? (_jsx("div", { className: "flex items-center justify-center py-8", children: _jsx(RefreshCw, { className: "h-6 w-6 animate-spin text-gray-400", strokeWidth: 1 }) })) : state.indexStatus ? (_jsxs(_Fragment, { children: [_jsx(IndexStatusCards, { indexStatus: state.indexStatus, onGoToSettings: actions.goToSettings }), !state.operationInProgress &&
                            state.queueStatus &&
                            state.queueStatus.errorCount > 0 &&
                            state.queueStatus.recentErrors &&
                            state.queueStatus.recentErrors.length > 0 && (_jsx(QueueErrorsDisplay, { queueStatus: state.queueStatus, showQueueErrors: state.showQueueErrors, onToggleErrors: () => actions.setShowQueueErrors(!state.showQueueErrors), onRetryFailed: actions.handleRetryFailed, isRetryingFailed: state.isRetryingFailed, retryFailedMessage: state.retryFailedMessage })), state.collectionStatus?.recentWarnings &&
                            state.collectionStatus.recentWarnings.length > 0 && (_jsx(CollectionWarningsDisplay, { warnings: state.collectionStatus.recentWarnings })), state.providerInfo && (_jsx(EmbeddingProviderInfo, { providerInfo: state.providerInfo })), _jsx(RebuildIndexSection, { indexStatus: state.indexStatus, collectionStatus: state.collectionStatus, importStatus: state.importStatus, centroidsStatus: state.centroidsStatus, queueStatus: state.queueStatus, providerInfo: state.providerInfo, stagingStats: state.stagingStats, stageResult: state.stageResult, debouncedCurrentItem: state.debouncedCurrentItem, isCollecting: state.isCollecting, isGenerating: state.isGenerating, isFinalizing: state.isFinalizing, isCancellingCollection: state.isCancellingCollection, forceRegenerate: state.forceRegenerate, onRebuild: actions.handleRebuild, onGenerateEmbeddings: actions.handleGenerateEmbeddings, onFinalize: actions.handleFinalize, onStopGeneration: actions.handleStopGeneration, onCancelCollection: actions.handleCancelCollection, onForceRegenerateChange: actions.setForceRegenerate, onClearStaging: actions.clearStaging }), state.indexStatus.batches &&
                            state.indexStatus.batches.length > 0 && (_jsx(RecentBatchesList, { batches: state.indexStatus.batches })), state.indexStatus.latestEmbeddedItems &&
                            state.indexStatus.latestEmbeddedItems.length > 0 && (_jsx(LatestEmbeddingsList, { items: state.indexStatus.latestEmbeddedItems })), _jsx(AdvancedSettings, { showAdvanced: state.showAdvanced, onToggle: () => actions.setShowAdvanced(!state.showAdvanced), kCentroids: state.kCentroids, onKCentroidsChange: actions.setKCentroids, onPopulateCentroids: actions.handlePopulateCentroids, isPopulating: state.isPopulating, centroidsStatus: state.centroidsStatus, onCleanup: actions.handleCleanup, isCleaning: state.isCleaning })] })) : null] }) }));
}
//# sourceMappingURL=IndexOverview.js.map