From 27a301d436b86e2d7cd8603cba220de2b542e543 Mon Sep 17 00:00:00 2001 From: Yad Konrad Date: Fri, 3 Jul 2026 13:03:35 -0400 Subject: [PATCH] =?UTF-8?q?feat(sync):=20all-devices=20dashboard=20?= =?UTF-8?q?=E2=80=94=20beta=20Devices=20tab=20surfaces=20two-way=20sync=20?= =?UTF-8?q?(#100=20FE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/components/dashboard/DevicesTab.tsx | 481 ++++++++++++++++++ stackunderflow-ui/src/config/dashboardTabs.ts | 8 + .../src/pages/ProjectDashboard.tsx | 2 + stackunderflow-ui/src/services/sync.ts | 52 ++ stackunderflow-ui/src/types/api.ts | 125 +++++ stackunderflow-ui/tests/services/sync.test.ts | 254 +++++++++ ...sTab-BajlmbLz.js => AgentsTab-BmHrcPiL.js} | 2 +- ...b-Cor0cmyo.js => BookmarksTab-BGB20MYS.js} | 2 +- ...Tab-BjHaaUsj.js => BudgetsTab-BSGq7YYe.js} | 2 +- ...02yOcgC.js => CodingHealthTab-DZFACjUP.js} | 2 +- ...ab-DlkmMFl4.js => CommandsTab-CZ24GiGu.js} | 2 +- .../react/assets/CompareTab-D60fXyc4.js | 1 - .../react/assets/CompareTab-DoDHMMWv.js | 1 + ...P9t9_Y.js => ContextReplayTab-CgZm-FeZ.js} | 2 +- ...ostTab-DCJQfNNf.js => CostTab-FEEkQwUn.js} | 4 +- ...able-DCEy-2Es.js => DataTable-BHenS21h.js} | 2 +- .../react/assets/DevicesTab-BjyuCuvS.js | 1 + ...Ejf.js => EstimatedCostMarker-DsipcjDe.js} | 2 +- ...rBar-BS6lhcC1.js => FilterBar-CML9sBEu.js} | 2 +- ...ksTab-ryk22jFG.js => ForksTab-BBQyDQc2.js} | 2 +- ...y-Bf5MQINx.js => IconActivity-CtliCKZa.js} | 2 +- ...2zR9MWj.js => IconAlertCircle-DmtLevj2.js} | 2 +- ...lOOgkPXu.js => IconArrowRight-CEBy4AKU.js} | 2 +- ...Up-D8NJ3QQF.js => IconArrowUp-CqAnfuIE.js} | 2 +- ...nBolt-CWu2Wz0a.js => IconBolt-DgchZkn1.js} | 2 +- ...heck-BQLu3HFV.js => IconCheck-D_dgJKrH.js} | 2 +- ...eX-D7ABaoUn.js => IconCircleX-CZ-PNBqE.js} | 2 +- ...lock-CgB7iTL4.js => IconClock-BfNEbW3j.js} | 2 +- ...BUN27e3Z.js => IconClockHour4-B94dRT7a.js} | 2 +- ...nCode-nzK0btv1.js => IconCode-DFtqsCTV.js} | 2 +- ...nCopy-BOYWZx4M.js => IconCopy-Cl6jyttT.js} | 2 +- .../react/assets/IconDatabase-50ZWmnTz.js | 6 + ...t-ChD_eRqq.js => IconFileText-BfJ2drOF.js} | 2 +- ...nHash-cdeuBxnj.js => IconHash-Cw_3c3J-.js} | 2 +- ...> IconPlayerSkipForwardFilled-Ca9nBmoF.js} | 2 +- ...obot-DuCKb11z.js => IconRobot-DArBIG_E.js} | 2 +- ...ClYo.js => IconSortDescending-szhiy27L.js} | 2 +- ...D1iuYAG9.js => IconTrendingUp-CcTO0Xpf.js} | 2 +- ...nUser-IjRNaThB.js => IconUser-YF3ooIRT.js} | 2 +- .../static/react/assets/IconUsers-BhXPWMUX.js | 6 + .../{Live-BX6jEGZn.js => Live-TQJbKokL.js} | 2 +- ...ab-Dull7JZB.js => MessagesTab-C_f5Q-QT.js} | 2 +- .../{Modal-DkeyqO4J.js => Modal-CGY7raPC.js} | 2 +- ...rview-BqyHxuZ_.js => Overview-D7DJD716.js} | 2 +- ...ab-CSNvLBfV.js => OverviewTab-Bzn_KZlZ.js} | 6 +- ...ab-0L9gLEFP.js => PlaybackTab-B80zt3lK.js} | 2 +- .../react/assets/ProjectDashboard-CixMPUyA.js | 7 + .../react/assets/ProjectDashboard-DAsn11K-.js | 7 - ...p-baymKnS_.js => ProviderChip-Bd3LCPUs.js} | 2 +- .../{QATab-DUs6uRU9.js => QATab-BnX7j0t9.js} | 2 +- ...hTab-DsaZoPy9.js => SearchTab-D03-qVTk.js} | 2 +- ...ab-NrDPSNfB.js => SessionsTab-3DJNVHPg.js} | 11 +- ...tings-BSujxVUW.js => Settings-D4OLuWdJ.js} | 2 +- .../static/react/assets/TagsTab-CJJHkPnn.js | 1 + .../static/react/assets/TagsTab-DSK8Zu2d.js | 6 - ...Y.js => TokenCompositionDonut-DhTEtbxP.js} | 15 +- ...b-B65wyswE.js => WorktreesTab-By5aNgjx.js} | 2 +- ...ldTab-BbHHGYlL.js => YieldTab-CGWBiQ4I.js} | 4 +- ...-C5ecR5YO.js => dashboardTabs-BuoED77E.js} | 39 +- .../{index-DQluCO2S.js => index-0LeeVNek.js} | 4 +- .../static/react/assets/index-CQL5TeFe.css | 1 + .../static/react/assets/index-DL9ELn-S.css | 1 - stackunderflow/static/react/index.html | 4 +- 63 files changed, 1024 insertions(+), 99 deletions(-) create mode 100644 stackunderflow-ui/src/components/dashboard/DevicesTab.tsx create mode 100644 stackunderflow-ui/src/services/sync.ts create mode 100644 stackunderflow-ui/tests/services/sync.test.ts rename stackunderflow/static/react/assets/{AgentsTab-BajlmbLz.js => AgentsTab-BmHrcPiL.js} (94%) rename stackunderflow/static/react/assets/{BookmarksTab-Cor0cmyo.js => BookmarksTab-BGB20MYS.js} (96%) rename stackunderflow/static/react/assets/{BudgetsTab-BjHaaUsj.js => BudgetsTab-BSGq7YYe.js} (98%) rename stackunderflow/static/react/assets/{CodingHealthTab-B02yOcgC.js => CodingHealthTab-DZFACjUP.js} (97%) rename stackunderflow/static/react/assets/{CommandsTab-DlkmMFl4.js => CommandsTab-CZ24GiGu.js} (93%) delete mode 100644 stackunderflow/static/react/assets/CompareTab-D60fXyc4.js create mode 100644 stackunderflow/static/react/assets/CompareTab-DoDHMMWv.js rename stackunderflow/static/react/assets/{ContextReplayTab-ixP9t9_Y.js => ContextReplayTab-CgZm-FeZ.js} (98%) rename stackunderflow/static/react/assets/{CostTab-DCJQfNNf.js => CostTab-FEEkQwUn.js} (98%) rename stackunderflow/static/react/assets/{DataTable-DCEy-2Es.js => DataTable-BHenS21h.js} (95%) create mode 100644 stackunderflow/static/react/assets/DevicesTab-BjyuCuvS.js rename stackunderflow/static/react/assets/{EstimatedCostMarker-BpsBXEjf.js => EstimatedCostMarker-DsipcjDe.js} (90%) rename stackunderflow/static/react/assets/{FilterBar-BS6lhcC1.js => FilterBar-CML9sBEu.js} (98%) rename stackunderflow/static/react/assets/{ForksTab-ryk22jFG.js => ForksTab-BBQyDQc2.js} (95%) rename stackunderflow/static/react/assets/{IconActivity-Bf5MQINx.js => IconActivity-CtliCKZa.js} (86%) rename stackunderflow/static/react/assets/{IconAlertCircle-h2zR9MWj.js => IconAlertCircle-DmtLevj2.js} (89%) rename stackunderflow/static/react/assets/{IconArrowRight-lOOgkPXu.js => IconArrowRight-CEBy4AKU.js} (89%) rename stackunderflow/static/react/assets/{IconArrowUp-D8NJ3QQF.js => IconArrowUp-CqAnfuIE.js} (94%) rename stackunderflow/static/react/assets/{IconBolt-CWu2Wz0a.js => IconBolt-DgchZkn1.js} (86%) rename stackunderflow/static/react/assets/{IconCheck-BQLu3HFV.js => IconCheck-D_dgJKrH.js} (86%) rename stackunderflow/static/react/assets/{IconCircleX-D7ABaoUn.js => IconCircleX-CZ-PNBqE.js} (88%) rename stackunderflow/static/react/assets/{IconClock-CgB7iTL4.js => IconClock-BfNEbW3j.js} (88%) rename stackunderflow/static/react/assets/{IconClockHour4-BUN27e3Z.js => IconClockHour4-B94dRT7a.js} (89%) rename stackunderflow/static/react/assets/{IconCode-nzK0btv1.js => IconCode-DFtqsCTV.js} (88%) rename stackunderflow/static/react/assets/{IconCopy-BOYWZx4M.js => IconCopy-Cl6jyttT.js} (92%) create mode 100644 stackunderflow/static/react/assets/IconDatabase-50ZWmnTz.js rename stackunderflow/static/react/assets/{IconFileText-ChD_eRqq.js => IconFileText-BfJ2drOF.js} (91%) rename stackunderflow/static/react/assets/{IconHash-cdeuBxnj.js => IconHash-Cw_3c3J-.js} (89%) rename stackunderflow/static/react/assets/{IconPlayerSkipForwardFilled-DA8tH9T1.js => IconPlayerSkipForwardFilled-Ca9nBmoF.js} (95%) rename stackunderflow/static/react/assets/{IconRobot-DuCKb11z.js => IconRobot-DArBIG_E.js} (93%) rename stackunderflow/static/react/assets/{IconSortDescending-DunfClYo.js => IconSortDescending-szhiy27L.js} (90%) rename stackunderflow/static/react/assets/{IconTrendingUp-D1iuYAG9.js => IconTrendingUp-CcTO0Xpf.js} (88%) rename stackunderflow/static/react/assets/{IconUser-IjRNaThB.js => IconUser-YF3ooIRT.js} (94%) create mode 100644 stackunderflow/static/react/assets/IconUsers-BhXPWMUX.js rename stackunderflow/static/react/assets/{Live-BX6jEGZn.js => Live-TQJbKokL.js} (97%) rename stackunderflow/static/react/assets/{MessagesTab-Dull7JZB.js => MessagesTab-C_f5Q-QT.js} (96%) rename stackunderflow/static/react/assets/{Modal-DkeyqO4J.js => Modal-CGY7raPC.js} (94%) rename stackunderflow/static/react/assets/{Overview-BqyHxuZ_.js => Overview-D7DJD716.js} (98%) rename stackunderflow/static/react/assets/{OverviewTab-CSNvLBfV.js => OverviewTab-Bzn_KZlZ.js} (91%) rename stackunderflow/static/react/assets/{PlaybackTab-0L9gLEFP.js => PlaybackTab-B80zt3lK.js} (99%) create mode 100644 stackunderflow/static/react/assets/ProjectDashboard-CixMPUyA.js delete mode 100644 stackunderflow/static/react/assets/ProjectDashboard-DAsn11K-.js rename stackunderflow/static/react/assets/{ProviderChip-baymKnS_.js => ProviderChip-Bd3LCPUs.js} (70%) rename stackunderflow/static/react/assets/{QATab-DUs6uRU9.js => QATab-BnX7j0t9.js} (97%) rename stackunderflow/static/react/assets/{SearchTab-DsaZoPy9.js => SearchTab-D03-qVTk.js} (97%) rename stackunderflow/static/react/assets/{SessionsTab-NrDPSNfB.js => SessionsTab-3DJNVHPg.js} (79%) rename stackunderflow/static/react/assets/{Settings-BSujxVUW.js => Settings-D4OLuWdJ.js} (99%) create mode 100644 stackunderflow/static/react/assets/TagsTab-CJJHkPnn.js delete mode 100644 stackunderflow/static/react/assets/TagsTab-DSK8Zu2d.js rename stackunderflow/static/react/assets/{TokenCompositionDonut-DTEMWIwY.js => TokenCompositionDonut-DhTEtbxP.js} (82%) rename stackunderflow/static/react/assets/{WorktreesTab-B65wyswE.js => WorktreesTab-By5aNgjx.js} (98%) rename stackunderflow/static/react/assets/{YieldTab-BbHHGYlL.js => YieldTab-CGWBiQ4I.js} (85%) rename stackunderflow/static/react/assets/{dashboardTabs-C5ecR5YO.js => dashboardTabs-BuoED77E.js} (51%) rename stackunderflow/static/react/assets/{index-DQluCO2S.js => index-0LeeVNek.js} (98%) create mode 100644 stackunderflow/static/react/assets/index-CQL5TeFe.css delete mode 100644 stackunderflow/static/react/assets/index-DL9ELn-S.css diff --git a/stackunderflow-ui/src/components/dashboard/DevicesTab.tsx b/stackunderflow-ui/src/components/dashboard/DevicesTab.tsx new file mode 100644 index 0000000..953e731 --- /dev/null +++ b/stackunderflow-ui/src/components/dashboard/DevicesTab.tsx @@ -0,0 +1,481 @@ +import { useEffect, useMemo, useState, type ReactNode } from 'react' +import { useQuery } from '@tanstack/react-query' +import { + BarChart, + Bar, + XAxis, + YAxis, + CartesianGrid, + Tooltip, + ResponsiveContainer, +} from 'recharts' +import { + IconArrowsLeftRight, + IconAlertTriangle, + IconCurrencyDollar, + IconDatabase, + IconStack2, + IconUsers, + IconRefresh, +} from '@tabler/icons-react' + +import { getSyncOverview, getSyncStatus, type SyncScope } from '../../services/sync' +import type { SyncByProject, SyncOverviewMerged, SyncPeer, SyncStatus } from '../../types/api' +import { formatCost, formatNumber, formatTokens } from '../../services/format' +import { useCurrency } from '../../services/currency' +import LoadingSpinner from '../common/LoadingSpinner' +import EmptyState from '../common/EmptyState' +import Badge from '../common/Badge' +import { ChartCard, EmptyChartCard, useChartTheme, CHART_HEIGHT } from '../charts/chartTheme' + +// --------------------------------------------------------------------------- +// DevicesTab — the cross-device analytics overlay (#100 Phase 2). +// +// A dedicated beta tab (following the Worktrees / Context-Replay precedent) so +// the existing per-device Overview/Cost render paths stay byte-identical when +// sync is off. Gated entirely behind `/api/sync/status`: with sync unconfigured +// the tab shows a clean "not set up" empty state and no toggle. When configured, +// a This device ↔ All devices toggle flips between the local view and the +// merged `local UNION ALL _remote` roll-up (`/api/sync/overview`). +// +// Cost figures arrive pre-converted to the active currency (the route converts), +// so `formatCost` only needs the active symbol — same contract as the Cost tab. +// --------------------------------------------------------------------------- + +interface DevicesTabProps { + // Accepted for parity with the other project-scoped tabs and folded into the + // query keys so a project switch refetches. The sync surface itself is + // store-global (it merges every device's aggregates), so the value is not + // sent to the endpoints — it only namespaces the cache. + projectName: string +} + +/** First 10 chars of a device UUID — full ids are 32 hex chars and overflow. */ +function shortId(id: string, n = 10): string { + return id.length > n ? `${id.slice(0, n)}…` : id +} + +/** `2026-07-02T14:03:09.123Z` → `2026-07-02 14:03` (best-effort, null-safe). */ +function formatTs(ts: string | null | undefined): string { + if (!ts) return '—' + return ts.replace('T', ' ').slice(0, 16) +} + +/** Human project label — the merged display_name, falling back to the slug. */ +function projectLabel(p: SyncByProject): string { + const name = (p.display_name ?? '').trim() + return name || p.slug +} + +// Hoisted typed tuple — Recharts' `radius` wants [number,number,number,number], +// and an inline array literal infers as `number[]` (not the tuple). Same reason +// DailyCostChart hoists its radius constants. +const TOP_RADIUS: [number, number, number, number] = [4, 4, 0, 0] + +interface StatCardProps { + icon: ReactNode + title: string + value: string + sub?: string + color: string +} + +function StatCard({ icon, title, value, sub, color }: StatCardProps) { + return ( +
+
+ {icon} + {title} +
+
{value}
+ {sub &&
{sub}
} +
+ ) +} + +/** This device ↔ All devices segmented toggle. Only rendered when sync is + * configured (the caller gates it). */ +function ScopeToggle({ + scope, + onChange, +}: { + scope: SyncScope + onChange: (next: SyncScope) => void +}) { + const base = + 'px-3 py-1.5 text-xs font-medium transition-colors focus:outline-none focus:z-10' + const active = 'bg-indigo-500 text-white' + const idle = + 'bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800' + return ( +
+ + +
+ ) +} + +/** The merged all-devices body: headline totals, a per-day cost trend, the + * per-project breakdown, and the contributing-device list. */ +function MergedView({ merged, status }: { merged: SyncOverviewMerged; status: SyncStatus }) { + const { currency } = useCurrency() + const palette = useChartTheme() + + const costTickFormatter = useMemo(() => (v: number) => formatCost(v, currency), [currency]) + // Two-arg shape mirrors DailyCostChart's proven formatter (Recharts calls it + // with (value, name)); we don't use the series name here. + const costTooltipFormatter = useMemo( + () => + (value: number, _name: string) => + [formatCost(value, currency), 'Cost'] as [string, string], + [currency], + ) + + const totalTokens = merged.totals.input_tokens + merged.totals.output_tokens + const cachedTokens = merged.totals.cache_read + merged.totals.cache_create + + // Per-project rows, richest spenders first. Copy before sorting (never + // mutate the query cache). Cap the table so a large multi-device store + // doesn't render hundreds of rows. + const topProjects = useMemo( + () => [...merged.by_project].sort((a, b) => b.total_cost_usd - a.total_cost_usd).slice(0, 25), + [merged.by_project], + ) + + // Enrich the per-device breakdown with each peer's last-seen from status. + const peerByUuid = useMemo(() => { + const m = new Map() + for (const p of status.peers) m.set(p.remote_device_uuid, p) + return m + }, [status.peers]) + + return ( +
+ {/* headline totals */} +
+ } + title="Merged spend" + value={formatCost(merged.totals.cost_usd, currency)} + sub="across every device" + color="text-purple-500" + /> + } + title="Tokens" + value={formatTokens(totalTokens)} + sub={`${formatTokens(cachedTokens)} cached`} + color="text-indigo-500" + /> + } + title="Sessions" + value={formatNumber(merged.totals.session_count)} + sub={`${formatNumber(merged.totals.message_count)} messages`} + color="text-emerald-500" + /> + } + title="Devices" + value={formatNumber(merged.devices.length)} + sub={`${status.peer_count} known peer${status.peer_count === 1 ? '' : 's'}`} + color="text-blue-500" + /> +
+ + {/* per-day cost trend — house chart chrome */} + {merged.by_day.length > 0 ? ( + + + + + + + + + + + + ) : ( + + )} + + {/* per-project breakdown */} +
+

+ By project (all devices) +

+ {topProjects.length === 0 ? ( +
No projects merged yet.
+ ) : ( +
+ + + + + + + + + + + + {topProjects.map((p) => ( + + + + + + + + ))} + +
ProjectProviderSessionsMessagesCost
+ {projectLabel(p)} + {p.provider} + {formatNumber(p.total_sessions)} + + {formatNumber(p.total_messages)} + + {formatCost(p.total_cost_usd, currency)} +
+
+ )} +
+ + {/* contributing devices / peers */} +
+

+ Contributing devices +

+
+ + + + + + + + + + + {merged.devices.map((d) => { + const peer = d.is_local ? undefined : peerByUuid.get(d.device_uuid) + const name = d.is_local + ? 'This device' + : (d.alias ?? peer?.alias ?? shortId(d.device_uuid)) + return ( + + + + + + + ) + })} + +
DeviceLast seenProjectsCost
+ + {name} + {d.is_local && local} + + + {d.is_local ? '—' : formatTs(peer?.last_seen)} + + {formatNumber(d.projects)} + + {formatCost(d.cost_usd, currency)} +
+
+ {status.peer_count === 0 && ( +
+ No peers pulled yet — run stackunderflow sync pull on + this device after another machine has pushed. +
+ )} +
+
+ ) +} + +export default function DevicesTab({ projectName }: DevicesTabProps) { + // Local sync config + peers + availability. Pure local read; safe with sync + // off (returns enabled: false). + const statusQuery = useQuery({ + queryKey: ['syncStatus', projectName], + queryFn: getSyncStatus, + staleTime: 30_000, + }) + const status = statusQuery.data + + // Scope toggle. Auto-flip to all-devices once, when cross-device data exists, + // unless the user has already picked a side — the merged view is the point of + // this tab, so we show it by default when there's something to merge. + const [scope, setScope] = useState('this-device') + const [userPicked, setUserPicked] = useState(false) + useEffect(() => { + if (!userPicked && status?.all_devices_available) setScope('all-devices') + }, [userPicked, status?.all_devices_available]) + + const pickScope = (next: SyncScope) => { + setUserPicked(true) + setScope(next) + } + + const overviewQuery = useQuery({ + queryKey: ['syncOverview', projectName, scope], + queryFn: () => getSyncOverview(scope), + // Only the merged path hits the union query; the this-device stub carries + // no data worth fetching, so we render a local placeholder instead. + enabled: status?.enabled === true && scope === 'all-devices', + staleTime: 30_000, + }) + const overview = overviewQuery.data + const merged = overview && overview.merged ? overview : null + + // ── status still loading / failed ────────────────────────────────────── + if (statusQuery.isLoading) { + return + } + if (statusQuery.error || !status) { + return ( +
+ Failed to load sync status:{' '} + {statusQuery.error instanceof Error ? statusQuery.error.message : 'Unknown error'} +
+ ) + } + + // ── sync unconfigured — clean empty state, no toggle ─────────────────── + if (!status.enabled) { + return ( +
+ } + title="Multi-device sync isn't set up" + description="Sync merges your coding analytics across machines — end-to-end encrypted, opt-in, and read-only on pull. Set it up on this device to unlock the all-devices view." + /> +
+ + stackunderflow sync init + +
+
+ ) + } + + // ── configured ───────────────────────────────────────────────────────── + return ( +
+
+
+ +

Devices

+ merged analytics across your machines + {merged && merged.merge_warnings > 0 && ( + + + + {merged.merge_warnings} merge warning{merged.merge_warnings === 1 ? '' : 's'} + + + )} +
+
+ {(merged?.generated_at || status.scanned_at) && ( + + {formatTs(merged?.generated_at ?? status.scanned_at)} + + )} + + +
+
+ + {scope === 'this-device' ? ( +
+

Showing this device only.

+

+ Per-device analytics live in the Overview and Cost tabs. Switch to{' '} + All devices to merge{' '} + {status.peer_count > 0 + ? `${status.peer_count} peer${status.peer_count === 1 ? '' : 's'}` + : 'other machines'}{' '} + into one cross-device view. + {!status.all_devices_available && + ' No peer data has been pulled yet — run `stackunderflow sync pull` first.'} +

+
+ ) : overviewQuery.isLoading ? ( + + ) : overviewQuery.error ? ( +
+ Failed to merge devices:{' '} + {overviewQuery.error instanceof Error ? overviewQuery.error.message : 'Unknown error'} +
+ ) : merged ? ( + + ) : ( + } + title="No merged data" + description="Sync is configured but nothing has been merged yet. Push from another device, then run stackunderflow sync pull here." + /> + )} +
+ ) +} diff --git a/stackunderflow-ui/src/config/dashboardTabs.ts b/stackunderflow-ui/src/config/dashboardTabs.ts index 3c56080..62472a6 100644 --- a/stackunderflow-ui/src/config/dashboardTabs.ts +++ b/stackunderflow-ui/src/config/dashboardTabs.ts @@ -29,6 +29,7 @@ import { IconWallet, IconActivityHeartbeat, IconBinaryTree2, + IconArrowsLeftRight, } from '@tabler/icons-react' export type Tab = { @@ -79,6 +80,13 @@ export const TABS: readonly Tab[] = [ // copyable prune-command PREVIEWS (the tool never runs them). Calls the // dedicated /api/worktrees route. Beta while the verdict heuristics settle. { id: 'worktrees', label: 'Worktrees', icon: IconBinaryTree2, isBeta: true }, + // Multi-device sync overlay (#100 Phase 2) — the cross-device analytics view. + // Gated behind sync being configured (via /api/sync/status): with sync off the + // tab shows a clean "not set up" empty state and never touches the per-device + // Overview/Cost render paths. A This device ↔ All devices toggle flips to the + // merged `local UNION ALL _remote` roll-up (/api/sync/overview). Beta + // while the union overlay settles. + { id: 'devices', label: 'Devices', icon: IconArrowsLeftRight, isBeta: true }, { id: 'commands', label: 'Commands', icon: IconTerminal2 }, { id: 'messages', label: 'Messages', icon: IconMessageCircle }, { id: 'search', label: 'Search', icon: IconSearch }, diff --git a/stackunderflow-ui/src/pages/ProjectDashboard.tsx b/stackunderflow-ui/src/pages/ProjectDashboard.tsx index f9c0b40..ae10307 100644 --- a/stackunderflow-ui/src/pages/ProjectDashboard.tsx +++ b/stackunderflow-ui/src/pages/ProjectDashboard.tsx @@ -40,6 +40,7 @@ const YieldTab = lazy(() => import('../components/dashboard/YieldTab')) const ForksTab = lazy(() => import('../components/dashboard/ForksTab')) const CodingHealthTab = lazy(() => import('../components/dashboard/CodingHealthTab')) const WorktreesTab = lazy(() => import('../components/dashboard/WorktreesTab')) +const DevicesTab = lazy(() => import('../components/dashboard/DevicesTab')) import { useBetaFeatures, BETA_ENABLED_KEY, @@ -392,6 +393,7 @@ export default function ProjectDashboard() { {activeTab === 'forks' && } {activeTab === 'health' && } {activeTab === 'worktrees' && } + {activeTab === 'devices' && } {activeTab === 'commands' && } {activeTab === 'messages' && } {activeTab === 'search' && } diff --git a/stackunderflow-ui/src/services/sync.ts b/stackunderflow-ui/src/services/sync.ts new file mode 100644 index 0000000..db45320 --- /dev/null +++ b/stackunderflow-ui/src/services/sync.ts @@ -0,0 +1,52 @@ +// --------------------------------------------------------------------------- +// Multi-device sync client — `GET /api/sync/status` + `GET /api/sync/overview` +// (#100 Phase 2, the union read overlay). +// +// Its own module (not `api.ts`): same isolation rationale as `worktrees.ts` / +// `patterns.ts` — the sync surface is an additive, self-contained unit, so a +// disjoint client keeps it file-separate from parallel work on the main API +// client. The fetch helper mirrors `api.ts::fetchJson` exactly. +// +// Both endpoints are read-only. `getSyncStatus` is a pure local read (safe with +// sync off). `getSyncOverview` only runs the cross-device union on the opt-in +// `?scope=all-devices` path — the default `this-device` returns a tiny stub. +// --------------------------------------------------------------------------- + +import type { SyncOverview, SyncStatus } from '../types/api' + +const BASE = '/api' + +async function fetchJson(url: string, init?: RequestInit): Promise { + const res = await fetch(url, init) + if (!res.ok) { + const text = await res.text().catch(() => '') + throw new Error(`${res.status} ${res.statusText}${text ? `: ${text}` : ''}`) + } + return res.json() +} + +/** Scope selector for {@link getSyncOverview}. `this-device` (the default) is + * the cheap stub path; `all-devices` triggers the union roll-up. */ +export type SyncScope = 'this-device' | 'all-devices' + +/** + * Local sync config + known peers + whether any cross-device data has been + * pulled. Pure local read — never hits the network or a bucket, and works + * whether sync is configured or not (returns `enabled: false` when it isn't). + */ +export async function getSyncStatus(): Promise { + return fetchJson(`${BASE}/sync/status`) +} + +/** + * The cross-device overview. Defaults to `this-device`, which returns a tiny + * not-merged stub and runs no union (so a store with sync off behaves as if the + * feature were absent). Only `scope='all-devices'` (with sync enabled) computes + * the `local UNION ALL _remote` roll-up; its cost fields arrive + * pre-converted to the active currency (same contract as /api/forks, + * /api/worktrees). The response is discriminated on `merged`. + */ +export async function getSyncOverview(scope: SyncScope = 'this-device'): Promise { + const params = new URLSearchParams({ scope }) + return fetchJson(`${BASE}/sync/overview?${params.toString()}`) +} diff --git a/stackunderflow-ui/src/types/api.ts b/stackunderflow-ui/src/types/api.ts index 5a4ee51..1d374b8 100644 --- a/stackunderflow-ui/src/types/api.ts +++ b/stackunderflow-ui/src/types/api.ts @@ -1599,3 +1599,128 @@ export interface WorktreesResponse { export interface WorktreeAttributeResponse { updated: number } + +// ── Multi-device sync (#100 Phase 2 — the union read overlay) ─────────────── +// Shapes mirror `stackunderflow/routes/sync.py` exactly. Both endpoints are +// read-only and safe on a core install: `/api/sync/status` is a pure local +// read, and `/api/sync/overview` only runs the cross-device union on the opt-in +// `?scope=all-devices` path (the default returns a tiny not-merged stub). + +/** One peer device from `sync_remote_devices` (empty until the first pull). + * Nullable columns are typed defensively — `alias`/`key_fingerprint` are set + * to NULL on first sight and populated later; timestamps come from upserts. */ +export interface SyncPeer { + remote_device_uuid: string + alias: string | null + key_fingerprint: string | null + first_seen: string | null + last_seen: string | null + last_generation: number +} + +/** GET /api/sync/status — local sync config + known peers + availability. + * Works whether sync is on or off; never touches the network. */ +export interface SyncStatus { + enabled: boolean + device_uuid: string | null + fingerprint: string | null + bucket_url: string | null + endpoint_url: string | null + shard_count: number + pending: string[] + pending_count: number + last_push_ts: string | null + peers: SyncPeer[] + peer_count: number + /** Total rows landed across every `_remote` table (0 ⇒ nothing pulled). */ + remote_rows: number + /** True only when sync is enabled AND cross-device rows exist — the FE gates + * the all-devices view on this flag. */ + all_devices_available: boolean + scanned_at: string +} + +/** Merged totals across every contributing device (cost pre-converted). */ +export interface SyncTotals { + cost_usd: number + input_tokens: number + output_tokens: number + cache_read: number + cache_create: number + message_count: number + /** Deduped unique sessions across devices (a session never spans machines). */ + session_count: number +} + +/** One point on the merged per-day cost/token/message trend. */ +export interface SyncByDay { + day: string + cost_usd: number + input_tokens: number + output_tokens: number + message_count: number +} + +/** Merged per-project totals at the stable `(provider, slug)` grain. */ +export interface SyncByProject { + provider: string + slug: string + display_name: string | null + first_ts: string | null + last_ts: string | null + total_messages: number + total_sessions: number + total_input_tokens: number + total_output_tokens: number + total_cache_read: number + total_cache_create: number + total_cost_usd: number +} + +/** Merged per-provider-day roll-up (additive measures are exact). */ +export interface SyncByProviderDay { + day: string + provider: string + cost_usd: number + message_count: number + session_count: number + project_count: number +} + +/** Per-contributing-device breakdown (this device + each pulled peer). */ +export interface SyncDevice { + device_uuid: string + alias: string | null + is_local: boolean + projects: number + cost_usd: number +} + +/** GET /api/sync/overview default / sync-off — a minimal not-merged stub; no + * union query runs. Discriminated from the merged payload by `merged: false`. */ +export interface SyncOverviewStub { + scope: 'this-device' + merged: false + sync_enabled: boolean + hint: string +} + +/** GET /api/sync/overview?scope=all-devices (sync enabled) — the + * `local UNION ALL _remote` roll-up. Cost figures are pre-converted into + * the active currency, matching every other cost endpoint's contract. */ +export interface SyncOverviewMerged { + scope: 'all-devices' + merged: true + sync_enabled: true + totals: SyncTotals + by_day: SyncByDay[] + by_project: SyncByProject[] + by_provider_day: SyncByProviderDay[] + devices: SyncDevice[] + merge_warnings: number + currency: CurrencyInfo + generated_at: string +} + +/** GET /api/sync/overview — discriminated on `merged`. */ +export type SyncOverview = SyncOverviewStub | SyncOverviewMerged diff --git a/stackunderflow-ui/tests/services/sync.test.ts b/stackunderflow-ui/tests/services/sync.test.ts new file mode 100644 index 0000000..1ce29ab --- /dev/null +++ b/stackunderflow-ui/tests/services/sync.test.ts @@ -0,0 +1,254 @@ +// Run with: node --test tests/services/sync.test.ts +// (Node 22+ strips TypeScript types automatically; matches the runner used by +// tests/services/format.test.ts and tests/services/etl-status.test.ts.) +// +// Coverage for the multi-device sync client (#100 Phase 2). The DevicesTab +// component isn't render-tested (no DOM runner in this project); here we lock +// the endpoint URLs, the scope query param, and the data-shape contract of both +// `/api/sync/status` and `/api/sync/overview` (stub vs. merged discriminant). + +import { test } from 'node:test' +import assert from 'node:assert/strict' + +import { getSyncOverview, getSyncStatus } from '../../src/services/sync.ts' +import type { SyncOverview, SyncStatus } from '../../src/types/api.ts' + +// --------------------------------------------------------------------------- +// Minimal `fetch` stub — swap globalThis.fetch per test, restore afterwards. +// Same pattern as tests/services/etl-status.test.ts (no msw / fetch-mock dep). +// --------------------------------------------------------------------------- + +interface MockResponse { + ok: boolean + status: number + statusText: string + json: () => Promise + text: () => Promise +} + +function mockResponse(body: unknown, status = 200): MockResponse { + return { + ok: status >= 200 && status < 300, + status, + statusText: status === 200 ? 'OK' : status === 404 ? 'Not Found' : 'Error', + json: async () => body, + text: async () => (typeof body === 'string' ? body : JSON.stringify(body)), + } +} + +function withFetch(impl: (input: string, init?: RequestInit) => Promise): () => void { + const original = (globalThis as { fetch?: unknown }).fetch + ;(globalThis as { fetch: unknown }).fetch = impl as unknown as typeof fetch + return () => { + ;(globalThis as { fetch: unknown }).fetch = original as typeof fetch + } +} + +// --------------------------------------------------------------------------- +// Sample payloads mirroring stackunderflow/routes/sync.py. +// --------------------------------------------------------------------------- + +const configuredStatus: SyncStatus = { + enabled: true, + device_uuid: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + fingerprint: 'SHA256:abcd', + bucket_url: 's3://my-bucket', + endpoint_url: null, + shard_count: 4, + pending: ['daily/2026-07'], + pending_count: 1, + last_push_ts: '2026-07-02T10:00:00+00:00', + peers: [ + { + remote_device_uuid: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + alias: 'laptop', + key_fingerprint: 'SHA256:abcd', + first_seen: '2026-07-01T09:00:00+00:00', + last_seen: '2026-07-02T09:30:00+00:00', + last_generation: 3, + }, + ], + peer_count: 1, + remote_rows: 42, + all_devices_available: true, + scanned_at: '2026-07-02T12:00:00+00:00', +} + +const disabledStatus: SyncStatus = { + enabled: false, + device_uuid: null, + fingerprint: null, + bucket_url: null, + endpoint_url: null, + shard_count: 0, + pending: [], + pending_count: 0, + last_push_ts: null, + peers: [], + peer_count: 0, + remote_rows: 0, + all_devices_available: false, + scanned_at: '2026-07-02T12:00:00+00:00', +} + +const stubOverview: SyncOverview = { + scope: 'this-device', + merged: false, + sync_enabled: true, + hint: 'pass ?scope=all-devices to union pulled peers', +} + +const mergedOverview: SyncOverview = { + scope: 'all-devices', + merged: true, + sync_enabled: true, + totals: { + cost_usd: 123.45, + input_tokens: 1000, + output_tokens: 2000, + cache_read: 500, + cache_create: 250, + message_count: 88, + session_count: 12, + }, + by_day: [ + { day: '2026-07-01', cost_usd: 60.0, input_tokens: 400, output_tokens: 800, message_count: 40 }, + { day: '2026-07-02', cost_usd: 63.45, input_tokens: 600, output_tokens: 1200, message_count: 48 }, + ], + by_project: [ + { + provider: 'claude', + slug: 'my-app', + display_name: 'My App', + first_ts: '2026-06-01T00:00:00+00:00', + last_ts: '2026-07-02T00:00:00+00:00', + total_messages: 88, + total_sessions: 12, + total_input_tokens: 1000, + total_output_tokens: 2000, + total_cache_read: 500, + total_cache_create: 250, + total_cost_usd: 123.45, + }, + ], + by_provider_day: [ + { day: '2026-07-02', provider: 'claude', cost_usd: 63.45, message_count: 48, session_count: 6, project_count: 1 }, + ], + devices: [ + { device_uuid: '(local)', alias: null, is_local: true, projects: 1, cost_usd: 80.0 }, + { device_uuid: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', alias: 'laptop', is_local: false, projects: 1, cost_usd: 43.45 }, + ], + merge_warnings: 2, + currency: { code: 'USD', symbol: '$', rate_from_usd: 1.0, warning: null }, + generated_at: '2026-07-02T12:00:01+00:00', +} + +// --------------------------------------------------------------------------- +// getSyncStatus +// --------------------------------------------------------------------------- + +test('getSyncStatus GETs /api/sync/status and parses the configured shape', async () => { + const restore = withFetch(async (url) => { + assert.equal(url, '/api/sync/status') + return mockResponse(configuredStatus) + }) + try { + const data = await getSyncStatus() + assert.equal(data.enabled, true) + assert.equal(data.all_devices_available, true) + assert.equal(data.peer_count, 1) + assert.equal(data.remote_rows, 42) + assert.equal(data.peers[0]!.alias, 'laptop') + assert.equal(data.peers[0]!.last_seen, '2026-07-02T09:30:00+00:00') + } finally { + restore() + } +}) + +test('getSyncStatus round-trips the sync-off shape (nulls + empties)', async () => { + const restore = withFetch(async () => mockResponse(disabledStatus)) + try { + const data = await getSyncStatus() + assert.equal(data.enabled, false) + assert.equal(data.all_devices_available, false) + assert.equal(data.device_uuid, null) + assert.deepEqual(data.peers, []) + } finally { + restore() + } +}) + +test('getSyncStatus throws a status-bearing Error on a non-ok response', async () => { + const restore = withFetch(async () => mockResponse('boom', 500)) + try { + await assert.rejects(getSyncStatus, (err) => { + assert.ok(err instanceof Error) + assert.match(err.message, /500/) + return true + }) + } finally { + restore() + } +}) + +// --------------------------------------------------------------------------- +// getSyncOverview — scope query param + the merged/stub discriminant. +// --------------------------------------------------------------------------- + +test('getSyncOverview defaults to scope=this-device and parses the stub', async () => { + const restore = withFetch(async (url) => { + assert.equal(url, '/api/sync/overview?scope=this-device') + return mockResponse(stubOverview) + }) + try { + const data = await getSyncOverview() + assert.equal(data.merged, false) + assert.equal(data.scope, 'this-device') + // Narrowing on the discriminant: the stub has no `totals`. + if (!data.merged) { + assert.equal(data.hint, 'pass ?scope=all-devices to union pulled peers') + } else { + assert.fail('stub should narrow to merged: false') + } + } finally { + restore() + } +}) + +test('getSyncOverview passes scope=all-devices and parses the merged roll-up', async () => { + const restore = withFetch(async (url) => { + assert.equal(url, '/api/sync/overview?scope=all-devices') + return mockResponse(mergedOverview) + }) + try { + const data = await getSyncOverview('all-devices') + assert.equal(data.merged, true) + // Narrowing on the discriminant exposes the merged fields. + if (data.merged) { + assert.equal(data.totals.cost_usd, 123.45) + assert.equal(data.totals.session_count, 12) + assert.equal(data.by_day.length, 2) + assert.equal(data.by_project[0]!.display_name, 'My App') + assert.equal(data.devices[0]!.is_local, true) + assert.equal(data.merge_warnings, 2) + assert.equal(data.currency.symbol, '$') + } else { + assert.fail('merged payload should narrow to merged: true') + } + } finally { + restore() + } +}) + +test('getSyncOverview surfaces a non-ok response as an Error', async () => { + const restore = withFetch(async () => mockResponse('nope', 503)) + try { + await assert.rejects(() => getSyncOverview('all-devices'), (err) => { + assert.ok(err instanceof Error) + assert.match(err.message, /503/) + return true + }) + } finally { + restore() + } +}) diff --git a/stackunderflow/static/react/assets/AgentsTab-BajlmbLz.js b/stackunderflow/static/react/assets/AgentsTab-BmHrcPiL.js similarity index 94% rename from stackunderflow/static/react/assets/AgentsTab-BajlmbLz.js rename to stackunderflow/static/react/assets/AgentsTab-BmHrcPiL.js index 0dbaf85..a8c583b 100644 --- a/stackunderflow/static/react/assets/AgentsTab-BajlmbLz.js +++ b/stackunderflow/static/react/assets/AgentsTab-BmHrcPiL.js @@ -1 +1 @@ -import{r as l,u as b,j as e}from"./react-vendor-B7v2HPaI.js";import{a5 as R,a6 as z,L as N,j as T,a7 as M,a8 as U}from"./index-DQluCO2S.js";import{c as j,b as L,f as F}from"./format-Co_unrac.js";import{E as S}from"./EmptyState-o0gibvhZ.js";import{h as D}from"./dashboardTabs-C5ecR5YO.js";import{I as A}from"./IconRobot-DuCKb11z.js";import{a as P,I as q}from"./IconUser-IjRNaThB.js";import{I as K}from"./IconHash-cdeuBxnj.js";import{I as C}from"./IconClock-CgB7iTL4.js";function _(t){if(!t)return"—";try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function p(t,a=8){return t?t.length>a?`${t.slice(0,a)}…`:t:"—"}function Z({projectName:t}={}){var v;const a=R(typeof window<"u"?window.location.search:""),[r,u]=l.useState(a.session),[i,h]=l.useState(a.agent);l.useEffect(()=>{if(typeof window>"u")return;z(window.location.search,{session:r,agent:i});const s=new URL(window.location.href),d=new URLSearchParams(s.search);r?d.set("session",r):d.delete("session"),i?d.set("agent",i):d.delete("agent");const o=d.toString(),c=`${s.pathname}${o?`?${o}`:""}${s.hash}`,y=`${window.location.pathname}${window.location.search}${window.location.hash}`;c!==y&&window.history.replaceState({},"",c)},[r,i]);const x=b({queryKey:["agent-teams","list",t??"__all__"],queryFn:()=>M(50,t??null)}),g=b({queryKey:["agent-teams","graph",r],queryFn:()=>U(r),enabled:!!r}),m=((v=x.data)==null?void 0:v.teams)??[],n=g.data??null;l.useEffect(()=>{!r&&m.length>0&&u(m[0].session_id)},[m,r]);const w=l.useMemo(()=>n?i?n.agents.find(s=>s.session_id===i)??n.lead:n.lead:null,[n,i]),$=l.useRef(null),E=l.useCallback(s=>{if(!n)return;const d=[n.lead,...n.agents],o=d.findIndex(k=>i?k.session_id===i:k.is_lead);if(o<0)return;let c=o;if(s.key==="j"||s.key==="ArrowDown")c=Math.min(d.length-1,o+1);else if(s.key==="k"||s.key==="ArrowUp")c=Math.max(0,o-1);else return;s.preventDefault();const y=d[c];h(y.is_lead?null:y.session_id)},[n,i]);return x.isLoading?e.jsx(N,{message:"Loading agent teams..."}):x.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load agent teams:"," ",x.error instanceof Error?x.error.message:"Unknown error"]}):m.length===0?e.jsx(S,{icon:e.jsx(D,{size:40}),title:"No agent teams yet",description:"When Claude Code spawns parallel sub-agents (via the TeamCreate tool), the dependency graph will show up here."}):e.jsxs("div",{ref:$,onKeyDown:E,tabIndex:0,className:"grid grid-cols-1 lg:grid-cols-12 gap-4 outline-none","data-testid":"agents-tab",children:[e.jsxs("aside",{className:"lg:col-span-5 xl:col-span-4 space-y-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 px-1",children:"Recent agent teams"}),e.jsx("div",{className:"space-y-1",children:m.map(s=>{const d=s.session_id===r;return e.jsxs("button",{onClick:()=>{u(s.session_id),h(null)},className:`w-full text-left px-3 py-2 rounded-md border transition-colors ${d?"border-indigo-400 bg-indigo-50 dark:bg-indigo-900/20":"border-gray-200 dark:border-gray-800 hover:border-gray-300 dark:hover:border-gray-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm text-gray-800 dark:text-gray-200 truncate",children:s.team_name??s.project_display_name}),e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1 flex-shrink-0",children:[e.jsx(A,{size:12}),s.agent_count]})]}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5 truncate",children:["Lead ",p(s.session_id)," · ",_(s.last_ts)]}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[j(s.lead_message_count)," lead msgs ·"," ",j(s.sub_agent_message_count)," sub msgs"]})]},s.session_id)})}),r&&n&&e.jsxs("div",{className:"pt-2",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 px-1",children:["Agents (",n.agents.length+1,")"]}),e.jsxs("div",{className:"mt-2 space-y-1",role:"tree",children:[e.jsx(I,{member:n.lead,isSelected:!i,indent:0,onClick:()=>h(null)}),n.agents.map(s=>e.jsx(I,{member:s,isSelected:i===s.session_id,indent:1,onClick:()=>h(s.session_id)},s.session_id))]})]}),r&&g.isLoading&&e.jsx("div",{className:"text-xs text-gray-500 px-1",children:"Loading graph…"})]}),e.jsx("section",{className:"lg:col-span-7 xl:col-span-8",children:r?g.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load team graph:"," ",g.error instanceof Error?g.error.message:"Unknown error"]}):n?e.jsx(Q,{graph:n,member:w,onOpenTranscript:()=>{if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("tab","sessions"),s.searchParams.set("session",w.session_id),window.history.pushState({},"",`${s.pathname}${s.search}`),window.dispatchEvent(new CustomEvent("stackunderflow:nav",{detail:{tab:"sessions",session:w.session_id}}))}}):e.jsx(N,{message:"Loading dependency graph..."}):e.jsx(S,{title:"Pick a team on the left",description:"Each team is a top-level Claude Code session that spawned parallel sub-agents."})})]})}function I({member:t,isSelected:a,indent:r,onClick:u}){return e.jsxs("button",{onClick:u,role:"treeitem","aria-selected":a,className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-md border transition-colors ${a?"border-indigo-400 bg-indigo-50 dark:bg-indigo-900/20":"border-transparent hover:bg-gray-100 dark:hover:bg-gray-800/50"}`,style:{paddingLeft:`${.75+r*1}rem`},"data-agent-id":t.session_id,children:[r>0&&e.jsx(T,{size:12,className:"text-gray-400 flex-shrink-0"}),t.is_lead?e.jsx(P,{size:14,className:"text-indigo-500 flex-shrink-0"}):e.jsx(A,{size:14,className:"text-gray-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:t.is_lead?"team-lead":t.agent_name??p(t.agent_id)}),e.jsxs("div",{className:"text-xs text-gray-500 truncate",children:[j(t.message_count)," msgs · ",L(t.cost_usd)]})]})]})}function Q({graph:t,member:a,onOpenTranscript:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 border-b border-gray-200 dark:border-gray-800 pb-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-gray-500",children:[t.team_name??"Untitled team"," · ",t.project_display_name]}),e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:a.is_lead?"Team lead":a.agent_name??p(a.agent_id)}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:["session ",p(a.session_id,12),a.parent_session_id&&e.jsxs(e.Fragment,{children:[" · spawned by ",p(a.parent_session_id,12)]})]})]}),e.jsx("button",{onClick:r,className:"flex-shrink-0 text-xs px-3 py-1.5 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600",children:"Open full transcript →"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[e.jsx(f,{icon:e.jsx(q,{size:14}),label:"Messages",value:j(a.message_count)}),e.jsx(f,{icon:e.jsx(K,{size:14}),label:"Model",value:a.model?F(a.model):"—"}),e.jsx(f,{icon:e.jsx(C,{size:14}),label:"First seen",value:_(a.first_ts)}),e.jsx(f,{icon:e.jsx(C,{size:14}),label:"Last seen",value:_(a.last_ts)})]}),a.spawn_prompt&&e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Spawn prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:a.spawn_prompt})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"First user prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:a.first_user_prompt??e.jsx("span",{className:"italic text-gray-500",children:"(no user message recorded)"})})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Cost"}),e.jsxs("div",{className:"text-sm text-gray-800 dark:text-gray-200",children:[L(a.cost_usd)," (computed from per-message tokens)"]})]})]})}function f({icon:t,label:a,value:r}){return e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[t,a]}),e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 mt-0.5 truncate",children:r})]})}export{Z as default}; +import{r as l,u as b,j as e}from"./react-vendor-B7v2HPaI.js";import{a5 as R,a6 as z,L as N,j as T,a7 as M,a8 as U}from"./index-0LeeVNek.js";import{c as j,b as L,f as F}from"./format-Co_unrac.js";import{E as S}from"./EmptyState-o0gibvhZ.js";import{i as D}from"./dashboardTabs-BuoED77E.js";import{I as A}from"./IconRobot-DArBIG_E.js";import{a as P,I as q}from"./IconUser-YF3ooIRT.js";import{I as K}from"./IconHash-Cw_3c3J-.js";import{I as C}from"./IconClock-BfNEbW3j.js";function _(t){if(!t)return"—";try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function p(t,a=8){return t?t.length>a?`${t.slice(0,a)}…`:t:"—"}function Z({projectName:t}={}){var v;const a=R(typeof window<"u"?window.location.search:""),[r,u]=l.useState(a.session),[i,h]=l.useState(a.agent);l.useEffect(()=>{if(typeof window>"u")return;z(window.location.search,{session:r,agent:i});const s=new URL(window.location.href),d=new URLSearchParams(s.search);r?d.set("session",r):d.delete("session"),i?d.set("agent",i):d.delete("agent");const o=d.toString(),c=`${s.pathname}${o?`?${o}`:""}${s.hash}`,y=`${window.location.pathname}${window.location.search}${window.location.hash}`;c!==y&&window.history.replaceState({},"",c)},[r,i]);const x=b({queryKey:["agent-teams","list",t??"__all__"],queryFn:()=>M(50,t??null)}),g=b({queryKey:["agent-teams","graph",r],queryFn:()=>U(r),enabled:!!r}),m=((v=x.data)==null?void 0:v.teams)??[],n=g.data??null;l.useEffect(()=>{!r&&m.length>0&&u(m[0].session_id)},[m,r]);const w=l.useMemo(()=>n?i?n.agents.find(s=>s.session_id===i)??n.lead:n.lead:null,[n,i]),$=l.useRef(null),E=l.useCallback(s=>{if(!n)return;const d=[n.lead,...n.agents],o=d.findIndex(k=>i?k.session_id===i:k.is_lead);if(o<0)return;let c=o;if(s.key==="j"||s.key==="ArrowDown")c=Math.min(d.length-1,o+1);else if(s.key==="k"||s.key==="ArrowUp")c=Math.max(0,o-1);else return;s.preventDefault();const y=d[c];h(y.is_lead?null:y.session_id)},[n,i]);return x.isLoading?e.jsx(N,{message:"Loading agent teams..."}):x.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load agent teams:"," ",x.error instanceof Error?x.error.message:"Unknown error"]}):m.length===0?e.jsx(S,{icon:e.jsx(D,{size:40}),title:"No agent teams yet",description:"When Claude Code spawns parallel sub-agents (via the TeamCreate tool), the dependency graph will show up here."}):e.jsxs("div",{ref:$,onKeyDown:E,tabIndex:0,className:"grid grid-cols-1 lg:grid-cols-12 gap-4 outline-none","data-testid":"agents-tab",children:[e.jsxs("aside",{className:"lg:col-span-5 xl:col-span-4 space-y-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 px-1",children:"Recent agent teams"}),e.jsx("div",{className:"space-y-1",children:m.map(s=>{const d=s.session_id===r;return e.jsxs("button",{onClick:()=>{u(s.session_id),h(null)},className:`w-full text-left px-3 py-2 rounded-md border transition-colors ${d?"border-indigo-400 bg-indigo-50 dark:bg-indigo-900/20":"border-gray-200 dark:border-gray-800 hover:border-gray-300 dark:hover:border-gray-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm text-gray-800 dark:text-gray-200 truncate",children:s.team_name??s.project_display_name}),e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1 flex-shrink-0",children:[e.jsx(A,{size:12}),s.agent_count]})]}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5 truncate",children:["Lead ",p(s.session_id)," · ",_(s.last_ts)]}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[j(s.lead_message_count)," lead msgs ·"," ",j(s.sub_agent_message_count)," sub msgs"]})]},s.session_id)})}),r&&n&&e.jsxs("div",{className:"pt-2",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 px-1",children:["Agents (",n.agents.length+1,")"]}),e.jsxs("div",{className:"mt-2 space-y-1",role:"tree",children:[e.jsx(I,{member:n.lead,isSelected:!i,indent:0,onClick:()=>h(null)}),n.agents.map(s=>e.jsx(I,{member:s,isSelected:i===s.session_id,indent:1,onClick:()=>h(s.session_id)},s.session_id))]})]}),r&&g.isLoading&&e.jsx("div",{className:"text-xs text-gray-500 px-1",children:"Loading graph…"})]}),e.jsx("section",{className:"lg:col-span-7 xl:col-span-8",children:r?g.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load team graph:"," ",g.error instanceof Error?g.error.message:"Unknown error"]}):n?e.jsx(Q,{graph:n,member:w,onOpenTranscript:()=>{if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("tab","sessions"),s.searchParams.set("session",w.session_id),window.history.pushState({},"",`${s.pathname}${s.search}`),window.dispatchEvent(new CustomEvent("stackunderflow:nav",{detail:{tab:"sessions",session:w.session_id}}))}}):e.jsx(N,{message:"Loading dependency graph..."}):e.jsx(S,{title:"Pick a team on the left",description:"Each team is a top-level Claude Code session that spawned parallel sub-agents."})})]})}function I({member:t,isSelected:a,indent:r,onClick:u}){return e.jsxs("button",{onClick:u,role:"treeitem","aria-selected":a,className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-md border transition-colors ${a?"border-indigo-400 bg-indigo-50 dark:bg-indigo-900/20":"border-transparent hover:bg-gray-100 dark:hover:bg-gray-800/50"}`,style:{paddingLeft:`${.75+r*1}rem`},"data-agent-id":t.session_id,children:[r>0&&e.jsx(T,{size:12,className:"text-gray-400 flex-shrink-0"}),t.is_lead?e.jsx(P,{size:14,className:"text-indigo-500 flex-shrink-0"}):e.jsx(A,{size:14,className:"text-gray-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:t.is_lead?"team-lead":t.agent_name??p(t.agent_id)}),e.jsxs("div",{className:"text-xs text-gray-500 truncate",children:[j(t.message_count)," msgs · ",L(t.cost_usd)]})]})]})}function Q({graph:t,member:a,onOpenTranscript:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 border-b border-gray-200 dark:border-gray-800 pb-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-gray-500",children:[t.team_name??"Untitled team"," · ",t.project_display_name]}),e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:a.is_lead?"Team lead":a.agent_name??p(a.agent_id)}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:["session ",p(a.session_id,12),a.parent_session_id&&e.jsxs(e.Fragment,{children:[" · spawned by ",p(a.parent_session_id,12)]})]})]}),e.jsx("button",{onClick:r,className:"flex-shrink-0 text-xs px-3 py-1.5 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600",children:"Open full transcript →"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[e.jsx(f,{icon:e.jsx(q,{size:14}),label:"Messages",value:j(a.message_count)}),e.jsx(f,{icon:e.jsx(K,{size:14}),label:"Model",value:a.model?F(a.model):"—"}),e.jsx(f,{icon:e.jsx(C,{size:14}),label:"First seen",value:_(a.first_ts)}),e.jsx(f,{icon:e.jsx(C,{size:14}),label:"Last seen",value:_(a.last_ts)})]}),a.spawn_prompt&&e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Spawn prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:a.spawn_prompt})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"First user prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:a.first_user_prompt??e.jsx("span",{className:"italic text-gray-500",children:"(no user message recorded)"})})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Cost"}),e.jsxs("div",{className:"text-sm text-gray-800 dark:text-gray-200",children:[L(a.cost_usd)," (computed from per-message tokens)"]})]})]})}function f({icon:t,label:a,value:r}){return e.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[t,a]}),e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 mt-0.5 truncate",children:r})]})}export{Z as default}; diff --git a/stackunderflow/static/react/assets/BookmarksTab-Cor0cmyo.js b/stackunderflow/static/react/assets/BookmarksTab-BGB20MYS.js similarity index 96% rename from stackunderflow/static/react/assets/BookmarksTab-Cor0cmyo.js rename to stackunderflow/static/react/assets/BookmarksTab-BGB20MYS.js index 1fb2703..03d33fd 100644 --- a/stackunderflow/static/react/assets/BookmarksTab-Cor0cmyo.js +++ b/stackunderflow/static/react/assets/BookmarksTab-BGB20MYS.js @@ -1,4 +1,4 @@ -import{j as e,d as v,r as g,u as j,e as y}from"./react-vendor-B7v2HPaI.js";import{h as N,Z as C,_ as w,L as S,z as B,$ as I}from"./index-DQluCO2S.js";import{E}from"./EmptyState-o0gibvhZ.js";import{I as k,a as T}from"./FilterBar-BS6lhcC1.js";import{M as z}from"./Modal-DkeyqO4J.js";import{T as M}from"./TimeAgo-BNE6wf6R.js";import{I as q}from"./IconSortDescending-DunfClYo.js";import{f as D}from"./dashboardTabs-C5ecR5YO.js";import{I as _}from"./IconCheck-BQLu3HFV.js";import"./format-Co_unrac.js";/** +import{j as e,d as v,r as g,u as j,e as y}from"./react-vendor-B7v2HPaI.js";import{h as N,Z as C,_ as w,L as S,z as B,$ as I}from"./index-0LeeVNek.js";import{E}from"./EmptyState-o0gibvhZ.js";import{I as k,a as T}from"./FilterBar-CML9sBEu.js";import{M as z}from"./Modal-CGY7raPC.js";import{T as M}from"./TimeAgo-BNE6wf6R.js";import{I as q}from"./IconSortDescending-szhiy27L.js";import{f as D}from"./dashboardTabs-BuoED77E.js";import{I as _}from"./IconCheck-D_dgJKrH.js";import"./format-Co_unrac.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/BudgetsTab-BjHaaUsj.js b/stackunderflow/static/react/assets/BudgetsTab-BSGq7YYe.js similarity index 98% rename from stackunderflow/static/react/assets/BudgetsTab-BjHaaUsj.js rename to stackunderflow/static/react/assets/BudgetsTab-BSGq7YYe.js index 539a522..b4d7940 100644 --- a/stackunderflow/static/react/assets/BudgetsTab-BjHaaUsj.js +++ b/stackunderflow/static/react/assets/BudgetsTab-BSGq7YYe.js @@ -1,4 +1,4 @@ -import{r as g,j as e,d as S,u as N,e as v}from"./react-vendor-B7v2HPaI.js";import{h as B,p as M,G as z,z as D,B as E,u as I,ag as R,ah as L,L as w,ai as T,aj as $}from"./index-DQluCO2S.js";import{E as Q}from"./EmptyState-o0gibvhZ.js";import{b as c,a as q,f as K}from"./format-Co_unrac.js";import{k as _}from"./dashboardTabs-C5ecR5YO.js";import{I as P}from"./IconCheck-BQLu3HFV.js";import{R as U,B as W,C as G,X as V,Y as X,T as Y,j as H,b as J,d as O}from"./recharts-C8DDeE7E.js";/** +import{r as g,j as e,d as S,u as N,e as v}from"./react-vendor-B7v2HPaI.js";import{h as B,p as M,G as z,z as D,B as E,u as I,ag as R,ah as L,L as w,ai as T,aj as $}from"./index-0LeeVNek.js";import{E as Q}from"./EmptyState-o0gibvhZ.js";import{b as c,a as q,f as K}from"./format-Co_unrac.js";import{l as _}from"./dashboardTabs-BuoED77E.js";import{I as P}from"./IconCheck-D_dgJKrH.js";import{R as U,B as W,C as G,X as V,Y as X,T as Y,j as H,b as J,d as O}from"./recharts-C8DDeE7E.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/CodingHealthTab-B02yOcgC.js b/stackunderflow/static/react/assets/CodingHealthTab-DZFACjUP.js similarity index 97% rename from stackunderflow/static/react/assets/CodingHealthTab-B02yOcgC.js rename to stackunderflow/static/react/assets/CodingHealthTab-DZFACjUP.js index 9f37a46..657ed20 100644 --- a/stackunderflow/static/react/assets/CodingHealthTab-B02yOcgC.js +++ b/stackunderflow/static/react/assets/CodingHealthTab-DZFACjUP.js @@ -1,4 +1,4 @@ -import{r as g,u as S,j as e,e as C}from"./react-vendor-B7v2HPaI.js";import{h as z,L,p as b,I as h,B as m,G as T}from"./index-DQluCO2S.js";import{E as I}from"./EmptyState-o0gibvhZ.js";import{e as w,j as F}from"./dashboardTabs-C5ecR5YO.js";import{I as k}from"./IconFileText-ChD_eRqq.js";import{I as A}from"./IconBolt-CWu2Wz0a.js";import{I as R}from"./FilterBar-BS6lhcC1.js";import"./format-Co_unrac.js";/** +import{r as g,u as S,j as e,e as C}from"./react-vendor-B7v2HPaI.js";import{h as z,L,p as b,I as h,B as m,G as T}from"./index-0LeeVNek.js";import{E as I}from"./EmptyState-o0gibvhZ.js";import{e as w,k as F}from"./dashboardTabs-BuoED77E.js";import{I as k}from"./IconFileText-BfJ2drOF.js";import{I as A}from"./IconBolt-DgchZkn1.js";import{I as R}from"./FilterBar-CML9sBEu.js";import"./format-Co_unrac.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/CommandsTab-DlkmMFl4.js b/stackunderflow/static/react/assets/CommandsTab-CZ24GiGu.js similarity index 93% rename from stackunderflow/static/react/assets/CommandsTab-DlkmMFl4.js rename to stackunderflow/static/react/assets/CommandsTab-CZ24GiGu.js index 941e2d7..e6fac37 100644 --- a/stackunderflow/static/react/assets/CommandsTab-DlkmMFl4.js +++ b/stackunderflow/static/react/assets/CommandsTab-CZ24GiGu.js @@ -1,3 +1,3 @@ -import{r as h,j as t}from"./react-vendor-B7v2HPaI.js";import{D as y}from"./DataTable-DCEy-2Es.js";import{i as f,j,B as k}from"./index-DQluCO2S.js";import{f as u}from"./format-Co_unrac.js";import"./ProjectDashboard-DAsn11K-.js";import"./EmptyState-o0gibvhZ.js";import"./FilterBar-BS6lhcC1.js";import"./dashboardTabs-C5ecR5YO.js";import"./IconArrowUp-D8NJ3QQF.js";function b(a){const r=[];let c=1;for(let d=0;db(d),[d]),o=h.useMemo(()=>[{key:"index",label:"#",width:"50px",align:"right",render:e=>t.jsx("span",{className:"text-gray-500 text-xs",children:e.index}),sortValue:e=>e.index},{key:"command",label:"Command",render:e=>t.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[r===e.groupKey?t.jsx(f,{size:14,className:"text-gray-500 mt-0.5 shrink-0"}):t.jsx(j,{size:14,className:"text-gray-500 mt-0.5 shrink-0"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words min-w-0",children:e.command.content.length>400?e.command.content.slice(0,400)+"…":e.command.content})]})},{key:"timestamp",label:"Timestamp",width:"140px",render:e=>t.jsx("span",{className:"text-gray-600 dark:text-gray-400 text-xs whitespace-nowrap",children:N(e.timestamp)}),sortValue:e=>new Date(e.timestamp).getTime()},{key:"model",label:"Model",width:"160px",render:e=>e.model?t.jsx("span",{className:"text-gray-600 dark:text-gray-400 text-xs",title:e.model,children:u(e.model)}):t.jsx("span",{className:"text-gray-500 text-xs",children:"-"})},{key:"tools",label:"Tools Used",width:"200px",render:e=>e.toolsUsed.length>0?t.jsx("div",{className:"flex flex-wrap gap-1",children:e.toolsUsed.map(s=>t.jsx(k,{color:"purple",size:"sm",children:s},s))}):t.jsx("span",{className:"text-gray-500 text-xs",children:"-"}),sortValue:e=>e.toolsUsed.length},{key:"tokens",label:"Tokens",width:"80px",align:"right",render:e=>{const s=e.command.tokens;if(s){const l=s.input+s.output;return t.jsx("span",{className:"text-gray-600 dark:text-gray-400 text-xs",title:`In: ${s.input} / Out: ${s.output}`,children:l.toLocaleString()})}return t.jsx("span",{className:"text-gray-500 text-xs",children:"-"})}}],[r]),x=e=>{c(s=>s===e.groupKey?null:e.groupKey)},g=e=>{const l=[["#","Command","Timestamp","Model","Tools Used"].join(",")];for(const i of e)l.push([String(i.index),p(i.command.content),p(i.timestamp),p(i.model??""),p(i.toolsUsed.join("; "))].join(","));return l.join(` `)};return t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:["User Commands",t.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:[n.length," command",n.length!==1?"s":""]})]})}),t.jsx(y,{columns:o,data:n,keyFn:e=>e.groupKey,searchable:!0,searchPlaceholder:"Filter commands...",searchFn:(e,s)=>{var l;return e.command.content.toLowerCase().includes(s)||(((l=e.model)==null?void 0:l.toLowerCase().includes(s))??!1)||e.toolsUsed.some(i=>i.toLowerCase().includes(s))},onRowClick:x,perPageOptions:[25,50,100,200],defaultPerPage:25,exportFilename:"commands.csv",exportFn:g,emptyMessage:"No user commands found"}),r&&(()=>{const e=n.find(s=>s.groupKey===r);return e?t.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4 text-sm",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 font-medium uppercase tracking-wider",children:"Full Command Text"}),t.jsx("button",{onClick:()=>c(null),className:"text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:"Close"})]}),t.jsx("pre",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed max-h-96 overflow-y-auto",children:e.command.content}),t.jsx("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:t.jsxs("span",{className:"text-xs text-gray-500",children:["Session: ",e.command.session_id,e.model&&t.jsxs(t.Fragment,{children:[" | Model: ",t.jsx("span",{title:e.model,children:u(e.model)})]}),e.toolsUsed.length>0&&t.jsxs(t.Fragment,{children:[" | Tools: ",e.toolsUsed.join(", ")]})]})})]}):null})()]})}export{K as default}; diff --git a/stackunderflow/static/react/assets/CompareTab-D60fXyc4.js b/stackunderflow/static/react/assets/CompareTab-D60fXyc4.js deleted file mode 100644 index 470eeb8..0000000 --- a/stackunderflow/static/react/assets/CompareTab-D60fXyc4.js +++ /dev/null @@ -1 +0,0 @@ -import{r as p,u as w,j as e}from"./react-vendor-B7v2HPaI.js";import{u as C,L as S,ak as P,a as E,al as F}from"./index-DQluCO2S.js";import{E as $}from"./EmptyState-o0gibvhZ.js";import{P as z}from"./ProviderChip-baymKnS_.js";import{b as y,f as R,c as N}from"./format-Co_unrac.js";import{l as m}from"./dashboardTabs-C5ecR5YO.js";import{I as A}from"./IconAlertCircle-h2zR9MWj.js";const I=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function h(t){return t==null||!Number.isFinite(t)?"—":`${(t*100).toFixed(0)}%`}const v={high:"bg-green-500/10 text-green-600 dark:text-green-400",medium:"bg-blue-500/10 text-blue-600 dark:text-blue-400",low:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",none:"bg-gray-500/10 text-gray-500 dark:text-gray-400"},T={clear:"bg-green-500/10 text-green-600 dark:text-green-400",weak:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400","insufficient evidence":"bg-gray-500/10 text-gray-500 dark:text-gray-400"};function k({label:t,className:r}){return e.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium ${r}`,children:t})}function q({report:t}){const r=t.coverage;return e.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md p-3 text-blue-800 dark:text-blue-300 text-xs",children:[e.jsx(A,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsxs("span",{children:["Based on ",r.sessions_total.toLocaleString()," sessions you already ran — a natural experiment, not a controlled trial. Success measured on"," ",r.sessions_scored.toLocaleString(),"/",r.sessions_total.toLocaleString()," ","sessions · grade coverage ",h(r.grade_coverage),". Weights: success"," ",t.weights.success,", cost ",t.weights.cost,", effort"," ",t.weights.effort," · ",Math.round(t.ci_level*100),"% CI."]})]})}function B({report:t,currency:r}){const o=t.verdict;return o.winning_model?e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(m,{size:16,className:"text-yellow-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:o.headline}),e.jsx(k,{label:o.confidence,className:v[o.confidence]})]}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-2 tabular-nums",children:[o.cost_per_outcome_usd!==null&&e.jsxs("span",{children:[y(o.cost_per_outcome_usd,r)," / successful outcome"]}),o.runner_up&&e.jsxs("span",{children:[" · runner-up ",o.runner_up]})]})]}):e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{label:"insufficient evidence",className:v.none}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No cross-task winner yet"})]}),o.caveats[0]&&e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:o.caveats[0]})]})}function O({row:t,isWinner:r,currency:o}){const s=t.success_rate.ci_wilson,a=t.cost_per_outcome.point,l=t.qualified?"":"opacity-50";return e.jsxs("tr",{className:`border-t border-gray-200 dark:border-gray-800 ${l}`,children:[e.jsxs("td",{className:"px-3 py-2 text-xs font-medium text-gray-900 dark:text-gray-100 whitespace-nowrap",children:[r&&e.jsx(m,{size:12,className:"inline mr-1 text-yellow-500"}),t.model,!t.qualified&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-400",children:"insufficient evidence"})]}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums",children:t.n}),e.jsxs("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:[h(t.success_rate.point),s&&e.jsxs("span",{className:"text-gray-400",children:[" ","[",h(s[0]),"–",h(s[1]),"]"]})]}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:a!==null?`${y(a,o)}/outcome`:"—"}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums",children:h(t.coverage)}),e.jsx("td",{className:"px-3 py-2 text-xs font-medium text-gray-900 dark:text-gray-100 text-right tabular-nums",children:t.composite.toFixed(2)})]})}function D({stratum:t,currency:r}){return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/60",children:[e.jsxs("span",{className:"text-xs font-semibold text-gray-800 dark:text-gray-200",children:[t.intent," × ",t.size_band]}),e.jsx(k,{label:t.cell_verdict,className:T[t.cell_verdict]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Model"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"n"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Success (90% CI)"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost / outcome"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Coverage"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Composite"})]})}),e.jsx("tbody",{children:t.models.map(o=>e.jsx(O,{row:o,isWinner:o.model===t.winner,currency:r},o.model))})]})})]})}function W(){const{currency:t}=C(),[r,o]=p.useState("all"),{data:s,isLoading:a,error:l}=w({queryKey:["benchmark",r],queryFn:()=>P(r),staleTime:6e4}),i=s==null?void 0:s.report;return e.jsxs("section",{className:"space-y-3 pt-2 border-t border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Which model wins"}),e.jsx("span",{className:"text-xs text-gray-500",children:"cost per successful outcome, per task type — from your own history"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Benchmark period",children:I.map(d=>e.jsx("button",{type:"button",onClick:()=>o(d.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${d.id===r?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:d.label},d.id))})]}),a&&e.jsx(S,{message:"Analyzing your model history..."}),l&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load benchmark: ",l instanceof Error?l.message:"Unknown error"]}),!a&&!l&&i&&i.coverage.sessions_total===0&&e.jsx($,{icon:e.jsx(m,{size:28}),title:"Not enough history to compare models yet",description:"Once you've run a few sessions across more than one model, this panel compares them by task type — honestly."}),!a&&!l&&i&&i.coverage.sessions_total>0&&e.jsxs(e.Fragment,{children:[e.jsx(q,{report:i}),e.jsx(B,{report:i,currency:t}),i.strata.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"Per task type (intent × size)"}),i.strata.map(d=>e.jsx(D,{stratum:d,currency:t},`${d.intent}:${d.size_band}`))]})]})]})}const G=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function _(t){return Number.isFinite(t)?`${(t>1?t:t*100).toFixed(1)}%`:"—"}function c({label:t,align:r="left",hint:o}){return e.jsx("th",{className:`px-3 py-2 text-[10px] uppercase tracking-wider text-gray-500 font-medium ${r==="right"?"text-right":"text-left"}`,title:o,children:t})}function K({row:t,showProviderChip:r,currency:o,onSelect:s}){const a=!!s;return e.jsxs("tr",{onClick:s?()=>s(t):void 0,className:`border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40 ${a?"cursor-pointer":""}`,title:a?"Click to filter the dashboard to this (provider, model)":void 0,children:[e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"inline-flex items-center gap-2 min-w-0",children:[r&&e.jsx(z,{provider:t.provider}),e.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-200 truncate",title:t.model,children:R(t.model)})]})}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:N(t.sessions)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:N(t.calls)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.one_shot_pct)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.retry_rate)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.cache_hit_rate)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:y(t.cost_per_call,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:y(t.cost_per_session,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums font-medium text-gray-900 dark:text-gray-100",children:y(t.total_cost,o)})]})}function U(t){const r=new Map;for(const s of t){const a=r.get(s.model)??{sessions:0,calls:0,one_shot_sessions:0,assistant_msgs:0,cache_read_proxy:0,cache_total_proxy:0,total_cost:0,total_tokens:0};a.sessions+=s.sessions,a.calls+=s.calls,a.total_cost+=s.total_cost,a.total_tokens+=s.total_tokens,a.one_shot_sessions+=(s.one_shot_pct??0)*s.sessions,a.assistant_msgs+=(1+(s.retry_rate??0))*s.sessions,a.cache_read_proxy+=(s.cache_hit_rate??0)*s.calls,a.cache_total_proxy+=s.calls,r.set(s.model,a)}const o=[];for(const[s,a]of r){const l=a.sessions,i=a.calls;o.push({model:s,provider:"(combined)",sessions:l,calls:i,one_shot_pct:l?a.one_shot_sessions/l:0,retry_rate:l?a.assistant_msgs/l-1:0,cache_hit_rate:a.cache_total_proxy?a.cache_read_proxy/a.cache_total_proxy:0,cost_per_call:i?a.total_cost/i:0,cost_per_session:l?a.total_cost/l:0,total_cost:a.total_cost,total_tokens:a.total_tokens})}return o.sort((s,a)=>a.total_cost-s.total_cost),o}function V({mode:t,onChange:r}){const o=[{id:"agent_model",label:"Agent × Model",hint:"One row per (provider, model) — same model under different agents shown separately."},{id:"model_only",label:"Model only",hint:"Sum across providers for the same model id."}];return e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Compare grouping",children:o.map(s=>e.jsx("button",{type:"button",onClick:()=>r(s.id),"aria-pressed":s.id===t,title:s.hint,className:`px-3 py-1.5 text-xs font-medium transition-colors ${s.id===t?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:s.label},s.id))})}function te(){const{currency:t}=C(),{filters:r,setProviders:o,setModels:s}=E(),[a,l]=p.useState("month"),[i,d]=p.useState("agent_model"),{data:x,isLoading:u,error:g}=w({queryKey:["compare",a,r.providers,r.models],queryFn:()=>F(a,{providers:r.providers,models:r.models}),staleTime:6e4}),b=p.useMemo(()=>{if(!x)return[];let n=x.models;if(r.providers.length>0){const f=new Set(r.providers);n=n.filter(j=>f.has((j.provider??"").toLowerCase()))}if(r.models.length>0){const f=new Set(r.models);n=n.filter(j=>f.has((j.model??"").toLowerCase()))}return n},[x,r]),M=p.useMemo(()=>i==="agent_model"?b:U(b),[b,i]),L=n=>{n.provider&&n.provider!=="(combined)"&&o([n.provider]),n.model&&s([n.model])};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Per-model comparison"}),e.jsx("span",{className:"text-xs text-gray-500",children:"sessions, retry, cache, and unit economics side-by-side"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(V,{mode:i,onChange:d}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Compare period",children:G.map(n=>e.jsx("button",{type:"button",onClick:()=>l(n.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${n.id===a?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:n.label},n.id))})]})]}),u&&e.jsx(S,{message:"Loading compare data..."}),g&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load compare data: ",g instanceof Error?g.message:"Unknown error"]}),!u&&!g&&x&&x.models.length===0&&e.jsx($,{icon:e.jsx(m,{size:28}),title:"No sessions in window",description:"Try a wider period, or run a session in this window to populate the comparison."}),!u&&!g&&x&&x.models.length>0&&e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx(c,{label:i==="agent_model"?"Agent × Model":"Model",hint:i==="agent_model"?"Provider chip + model id. Same model under different providers renders as distinct rows.":"Aggregated across all providers per model id."}),e.jsx(c,{label:"Sessions",align:"right"}),e.jsx(c,{label:"Calls",align:"right"}),e.jsx(c,{label:"1-shot %",align:"right",hint:"Sessions resolved in a single user/assistant exchange"}),e.jsx(c,{label:"Retry",align:"right",hint:"(assistant_messages / sessions) − 1"}),e.jsx(c,{label:"Cache %",align:"right",hint:"cache_read / (cache_read + input)"}),e.jsx(c,{label:"$/call",align:"right"}),e.jsx(c,{label:"$/session",align:"right"}),e.jsx(c,{label:"Total",align:"right"})]})}),e.jsx("tbody",{children:M.map(n=>e.jsx(K,{row:n,showProviderChip:i==="agent_model",currency:t,onSelect:i==="agent_model"?L:void 0},i==="agent_model"?`${n.model}|${n.provider}`:`model|${n.model}`))})]})}),e.jsx(W,{})]})}export{U as aggregateByModel,te as default}; diff --git a/stackunderflow/static/react/assets/CompareTab-DoDHMMWv.js b/stackunderflow/static/react/assets/CompareTab-DoDHMMWv.js new file mode 100644 index 0000000..b33ddae --- /dev/null +++ b/stackunderflow/static/react/assets/CompareTab-DoDHMMWv.js @@ -0,0 +1 @@ +import{r as p,u as w,j as e}from"./react-vendor-B7v2HPaI.js";import{u as C,L as S,ak as P,a as E,al as F}from"./index-0LeeVNek.js";import{E as $}from"./EmptyState-o0gibvhZ.js";import{P as z}from"./ProviderChip-Bd3LCPUs.js";import{b as y,f as R,c as N}from"./format-Co_unrac.js";import{m}from"./dashboardTabs-BuoED77E.js";import{I as A}from"./IconAlertCircle-DmtLevj2.js";const I=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function h(t){return t==null||!Number.isFinite(t)?"—":`${(t*100).toFixed(0)}%`}const v={high:"bg-green-500/10 text-green-600 dark:text-green-400",medium:"bg-blue-500/10 text-blue-600 dark:text-blue-400",low:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",none:"bg-gray-500/10 text-gray-500 dark:text-gray-400"},T={clear:"bg-green-500/10 text-green-600 dark:text-green-400",weak:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400","insufficient evidence":"bg-gray-500/10 text-gray-500 dark:text-gray-400"};function k({label:t,className:r}){return e.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium ${r}`,children:t})}function q({report:t}){const r=t.coverage;return e.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md p-3 text-blue-800 dark:text-blue-300 text-xs",children:[e.jsx(A,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsxs("span",{children:["Based on ",r.sessions_total.toLocaleString()," sessions you already ran — a natural experiment, not a controlled trial. Success measured on"," ",r.sessions_scored.toLocaleString(),"/",r.sessions_total.toLocaleString()," ","sessions · grade coverage ",h(r.grade_coverage),". Weights: success"," ",t.weights.success,", cost ",t.weights.cost,", effort"," ",t.weights.effort," · ",Math.round(t.ci_level*100),"% CI."]})]})}function B({report:t,currency:r}){const o=t.verdict;return o.winning_model?e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(m,{size:16,className:"text-yellow-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:o.headline}),e.jsx(k,{label:o.confidence,className:v[o.confidence]})]}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-2 tabular-nums",children:[o.cost_per_outcome_usd!==null&&e.jsxs("span",{children:[y(o.cost_per_outcome_usd,r)," / successful outcome"]}),o.runner_up&&e.jsxs("span",{children:[" · runner-up ",o.runner_up]})]})]}):e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{label:"insufficient evidence",className:v.none}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No cross-task winner yet"})]}),o.caveats[0]&&e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:o.caveats[0]})]})}function O({row:t,isWinner:r,currency:o}){const s=t.success_rate.ci_wilson,a=t.cost_per_outcome.point,l=t.qualified?"":"opacity-50";return e.jsxs("tr",{className:`border-t border-gray-200 dark:border-gray-800 ${l}`,children:[e.jsxs("td",{className:"px-3 py-2 text-xs font-medium text-gray-900 dark:text-gray-100 whitespace-nowrap",children:[r&&e.jsx(m,{size:12,className:"inline mr-1 text-yellow-500"}),t.model,!t.qualified&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-400",children:"insufficient evidence"})]}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums",children:t.n}),e.jsxs("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:[h(t.success_rate.point),s&&e.jsxs("span",{className:"text-gray-400",children:[" ","[",h(s[0]),"–",h(s[1]),"]"]})]}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:a!==null?`${y(a,o)}/outcome`:"—"}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums",children:h(t.coverage)}),e.jsx("td",{className:"px-3 py-2 text-xs font-medium text-gray-900 dark:text-gray-100 text-right tabular-nums",children:t.composite.toFixed(2)})]})}function D({stratum:t,currency:r}){return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/60",children:[e.jsxs("span",{className:"text-xs font-semibold text-gray-800 dark:text-gray-200",children:[t.intent," × ",t.size_band]}),e.jsx(k,{label:t.cell_verdict,className:T[t.cell_verdict]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-1.5 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Model"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"n"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Success (90% CI)"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost / outcome"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Coverage"}),e.jsx("th",{className:"px-3 py-1.5 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Composite"})]})}),e.jsx("tbody",{children:t.models.map(o=>e.jsx(O,{row:o,isWinner:o.model===t.winner,currency:r},o.model))})]})})]})}function W(){const{currency:t}=C(),[r,o]=p.useState("all"),{data:s,isLoading:a,error:l}=w({queryKey:["benchmark",r],queryFn:()=>P(r),staleTime:6e4}),i=s==null?void 0:s.report;return e.jsxs("section",{className:"space-y-3 pt-2 border-t border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Which model wins"}),e.jsx("span",{className:"text-xs text-gray-500",children:"cost per successful outcome, per task type — from your own history"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Benchmark period",children:I.map(d=>e.jsx("button",{type:"button",onClick:()=>o(d.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${d.id===r?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:d.label},d.id))})]}),a&&e.jsx(S,{message:"Analyzing your model history..."}),l&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load benchmark: ",l instanceof Error?l.message:"Unknown error"]}),!a&&!l&&i&&i.coverage.sessions_total===0&&e.jsx($,{icon:e.jsx(m,{size:28}),title:"Not enough history to compare models yet",description:"Once you've run a few sessions across more than one model, this panel compares them by task type — honestly."}),!a&&!l&&i&&i.coverage.sessions_total>0&&e.jsxs(e.Fragment,{children:[e.jsx(q,{report:i}),e.jsx(B,{report:i,currency:t}),i.strata.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"Per task type (intent × size)"}),i.strata.map(d=>e.jsx(D,{stratum:d,currency:t},`${d.intent}:${d.size_band}`))]})]})]})}const G=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function _(t){return Number.isFinite(t)?`${(t>1?t:t*100).toFixed(1)}%`:"—"}function c({label:t,align:r="left",hint:o}){return e.jsx("th",{className:`px-3 py-2 text-[10px] uppercase tracking-wider text-gray-500 font-medium ${r==="right"?"text-right":"text-left"}`,title:o,children:t})}function K({row:t,showProviderChip:r,currency:o,onSelect:s}){const a=!!s;return e.jsxs("tr",{onClick:s?()=>s(t):void 0,className:`border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40 ${a?"cursor-pointer":""}`,title:a?"Click to filter the dashboard to this (provider, model)":void 0,children:[e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"inline-flex items-center gap-2 min-w-0",children:[r&&e.jsx(z,{provider:t.provider}),e.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-200 truncate",title:t.model,children:R(t.model)})]})}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:N(t.sessions)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:N(t.calls)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.one_shot_pct)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.retry_rate)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:_(t.cache_hit_rate)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:y(t.cost_per_call,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300",children:y(t.cost_per_session,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-sm tabular-nums font-medium text-gray-900 dark:text-gray-100",children:y(t.total_cost,o)})]})}function U(t){const r=new Map;for(const s of t){const a=r.get(s.model)??{sessions:0,calls:0,one_shot_sessions:0,assistant_msgs:0,cache_read_proxy:0,cache_total_proxy:0,total_cost:0,total_tokens:0};a.sessions+=s.sessions,a.calls+=s.calls,a.total_cost+=s.total_cost,a.total_tokens+=s.total_tokens,a.one_shot_sessions+=(s.one_shot_pct??0)*s.sessions,a.assistant_msgs+=(1+(s.retry_rate??0))*s.sessions,a.cache_read_proxy+=(s.cache_hit_rate??0)*s.calls,a.cache_total_proxy+=s.calls,r.set(s.model,a)}const o=[];for(const[s,a]of r){const l=a.sessions,i=a.calls;o.push({model:s,provider:"(combined)",sessions:l,calls:i,one_shot_pct:l?a.one_shot_sessions/l:0,retry_rate:l?a.assistant_msgs/l-1:0,cache_hit_rate:a.cache_total_proxy?a.cache_read_proxy/a.cache_total_proxy:0,cost_per_call:i?a.total_cost/i:0,cost_per_session:l?a.total_cost/l:0,total_cost:a.total_cost,total_tokens:a.total_tokens})}return o.sort((s,a)=>a.total_cost-s.total_cost),o}function V({mode:t,onChange:r}){const o=[{id:"agent_model",label:"Agent × Model",hint:"One row per (provider, model) — same model under different agents shown separately."},{id:"model_only",label:"Model only",hint:"Sum across providers for the same model id."}];return e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Compare grouping",children:o.map(s=>e.jsx("button",{type:"button",onClick:()=>r(s.id),"aria-pressed":s.id===t,title:s.hint,className:`px-3 py-1.5 text-xs font-medium transition-colors ${s.id===t?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:s.label},s.id))})}function te(){const{currency:t}=C(),{filters:r,setProviders:o,setModels:s}=E(),[a,l]=p.useState("month"),[i,d]=p.useState("agent_model"),{data:x,isLoading:u,error:g}=w({queryKey:["compare",a,r.providers,r.models],queryFn:()=>F(a,{providers:r.providers,models:r.models}),staleTime:6e4}),b=p.useMemo(()=>{if(!x)return[];let n=x.models;if(r.providers.length>0){const f=new Set(r.providers);n=n.filter(j=>f.has((j.provider??"").toLowerCase()))}if(r.models.length>0){const f=new Set(r.models);n=n.filter(j=>f.has((j.model??"").toLowerCase()))}return n},[x,r]),M=p.useMemo(()=>i==="agent_model"?b:U(b),[b,i]),L=n=>{n.provider&&n.provider!=="(combined)"&&o([n.provider]),n.model&&s([n.model])};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Per-model comparison"}),e.jsx("span",{className:"text-xs text-gray-500",children:"sessions, retry, cache, and unit economics side-by-side"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(V,{mode:i,onChange:d}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Compare period",children:G.map(n=>e.jsx("button",{type:"button",onClick:()=>l(n.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${n.id===a?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:n.label},n.id))})]})]}),u&&e.jsx(S,{message:"Loading compare data..."}),g&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load compare data: ",g instanceof Error?g.message:"Unknown error"]}),!u&&!g&&x&&x.models.length===0&&e.jsx($,{icon:e.jsx(m,{size:28}),title:"No sessions in window",description:"Try a wider period, or run a session in this window to populate the comparison."}),!u&&!g&&x&&x.models.length>0&&e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx(c,{label:i==="agent_model"?"Agent × Model":"Model",hint:i==="agent_model"?"Provider chip + model id. Same model under different providers renders as distinct rows.":"Aggregated across all providers per model id."}),e.jsx(c,{label:"Sessions",align:"right"}),e.jsx(c,{label:"Calls",align:"right"}),e.jsx(c,{label:"1-shot %",align:"right",hint:"Sessions resolved in a single user/assistant exchange"}),e.jsx(c,{label:"Retry",align:"right",hint:"(assistant_messages / sessions) − 1"}),e.jsx(c,{label:"Cache %",align:"right",hint:"cache_read / (cache_read + input)"}),e.jsx(c,{label:"$/call",align:"right"}),e.jsx(c,{label:"$/session",align:"right"}),e.jsx(c,{label:"Total",align:"right"})]})}),e.jsx("tbody",{children:M.map(n=>e.jsx(K,{row:n,showProviderChip:i==="agent_model",currency:t,onSelect:i==="agent_model"?L:void 0},i==="agent_model"?`${n.model}|${n.provider}`:`model|${n.model}`))})]})}),e.jsx(W,{})]})}export{U as aggregateByModel,te as default}; diff --git a/stackunderflow/static/react/assets/ContextReplayTab-ixP9t9_Y.js b/stackunderflow/static/react/assets/ContextReplayTab-CgZm-FeZ.js similarity index 98% rename from stackunderflow/static/react/assets/ContextReplayTab-ixP9t9_Y.js rename to stackunderflow/static/react/assets/ContextReplayTab-CgZm-FeZ.js index 3079dc1..4f1c4fb 100644 --- a/stackunderflow/static/react/assets/ContextReplayTab-ixP9t9_Y.js +++ b/stackunderflow/static/react/assets/ContextReplayTab-CgZm-FeZ.js @@ -1 +1 @@ -import{r as d,u as F,j as e}from"./react-vendor-B7v2HPaI.js";import{ab as R,L as T,M as I,T as _,j as z,a3 as P,ad as U}from"./index-DQluCO2S.js";import{E as M}from"./EmptyState-o0gibvhZ.js";import{a as k}from"./format-Co_unrac.js";import{I as J,a as Q}from"./IconPlayerSkipForwardFilled-DA8tH9T1.js";function b(a){return a.endsWith(".jsonl")?a.slice(0,-6):a}function E(a,i=12){return a.length>i?`${a.slice(0,i)}…`:a}function K(a){const i=b(a.name),n=(a.title||"").trim();return n?`${n.slice(0,60)} — ${E(i)}`:E(i)}function B(a){return a==="user"?"border-emerald-400 dark:border-emerald-500 text-emerald-700 dark:text-emerald-300":a==="assistant"?"border-indigo-400 dark:border-indigo-500 text-indigo-700 dark:text-indigo-300":"border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400"}function H({projectName:a}){var C,q,$;const i=R(typeof window<"u"?window.location.search:""),[n,j]=d.useState(i.session),[h,y]=d.useState(null),c=F({queryKey:["contextreplay","sessions",a],queryFn:()=>P(a)}),g=d.useMemo(()=>{var r;return(((r=c.data)==null?void 0:r.files)??[]).slice().sort((x,p)=>(p.modified??0)-(x.modified??0))},[c.data]);d.useEffect(()=>{if(g.length===0)return;const t=new Set(g.map(r=>b(r.name)));(!n||!t.has(n))&&(j(b(g[0].name)),y(null))},[g,n]);const l=F({queryKey:["contextreplay","events",n],queryFn:()=>U(n),enabled:!!n}),s=((C=l.data)==null?void 0:C.events)??[],f=((q=l.data)==null?void 0:q.total_tokens)??0,w=(($=l.data)==null?void 0:$.warnings)??[];d.useEffect(()=>{if(s.length===0||h!==null||i.seq===null)return;const t=s.findIndex(r=>r.seq===i.seq);t>=0&&y(t)},[s,h,i.seq]);const o=d.useMemo(()=>s.length===0?-1:h===null?s.length-1:Math.min(s.length-1,Math.max(0,h)),[s.length,h]),u=o>=0?s[o]??null:null,v=o>=0?s.slice(0,o+1):[],N=(u==null?void 0:u.cumulative_tokens)??0,S=f>0?Math.min(100,Math.round(N/f*100)):0;d.useEffect(()=>{if(typeof window>"u")return;const t=new URL(window.location.href),r=new URLSearchParams(t.search);n?r.set("session",n):r.delete("session"),u?r.set("seq",String(u.seq)):r.delete("seq");const x=r.toString(),p=`${t.pathname}${x?`?${x}`:""}${t.hash}`,L=`${window.location.pathname}${window.location.search}${window.location.hash}`;p!==L&&window.history.replaceState({},"",p)},[n,u]);const m=t=>{s.length!==0&&y(Math.min(s.length-1,Math.max(0,t)))};return c.isLoading?e.jsx(T,{message:"Loading sessions..."}):c.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load sessions:"," ",c.error instanceof Error?c.error.message:"Unknown error"]}):g.length===0?e.jsx(M,{icon:e.jsx(I,{size:40}),title:"No sessions yet in this project",description:"Once a Claude Code session runs here, you'll be able to scrub through the context the model saw at each turn."}):e.jsxs("div",{className:"space-y-4","data-testid":"context-replay-tab",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-3",children:[e.jsx("select",{value:n??"",onChange:t=>{j(t.target.value||null),y(null)},className:"text-sm rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 px-2 py-1.5 min-w-0 max-w-md flex-shrink","aria-label":"Session to replay context for",children:g.map(t=>{const r=b(t.name);return e.jsx("option",{value:r,children:K(t)},r)})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>m(0),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0,"aria-label":"Jump to first turn",children:e.jsx(J,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(o-1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0||o<=0,"aria-label":"Previous turn",children:e.jsx(_,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(o+1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0||o>=s.length-1,"aria-label":"Next turn",children:e.jsx(z,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(s.length-1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0,"aria-label":"Jump to last turn (full context)",children:e.jsx(Q,{size:14})}),s.length>0&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2 tabular-nums",children:["turn ",o+1," of ",s.length]})]})]}),l.isLoading?e.jsx("div",{className:"h-14 flex items-center text-xs text-gray-500",children:"Reconstructing context…"}):l.error?e.jsxs("div",{className:"p-3 text-sm text-red-600 dark:text-red-400",children:["Failed to reconstruct context:"," ",l.error instanceof Error?l.error.message:"Unknown error"]}):s.length===0?e.jsx(M,{icon:e.jsx(I,{size:36}),title:"No messages in this session",description:w.length>0?w.join(" · "):"This session has no recorded messages — pick another from the dropdown above."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-gray-600 dark:text-gray-300 tabular-nums",children:["≈ ",k(N)," / ",k(f)," context tokens",e.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[" (",S,"%)"]})]}),e.jsx("span",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:"estimate · chars/4 of each turn's text + tool payload"})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-indigo-500 dark:bg-indigo-400 transition-all",style:{width:`${S}%`}})}),e.jsx("input",{type:"range",min:0,max:Math.max(0,s.length-1),value:o<0?0:o,onChange:t=>m(Number(t.target.value)),className:"w-full accent-indigo-500 dark:accent-indigo-400","aria-label":"Context cutoff (seq)"})]}),e.jsx("ul",{className:"space-y-1.5","data-testid":"context-replay-events",children:v.map((t,r)=>{const x=r===v.length-1;return e.jsxs("li",{className:`rounded-md border-l-2 pl-3 pr-2 py-1.5 ${B(t.role)} ${x?"bg-indigo-50/70 dark:bg-indigo-900/20":"bg-gray-50 dark:bg-gray-800/40"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsxs("span",{className:"font-medium tabular-nums",children:["#",t.seq," ",e.jsx("span",{className:"uppercase tracking-wide",children:t.role})]}),e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[k(t.cumulative_tokens)," tok"]})]}),t.tool_calls.length>0&&e.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-500 dark:text-gray-400 truncate",children:["tools: ",t.tool_calls.join(", ")]}),t.content_preview&&e.jsx("div",{className:"mt-0.5 text-xs text-gray-700 dark:text-gray-300 line-clamp-2 whitespace-pre-wrap break-words",children:t.content_preview})]},t.seq)})})]})]})}export{H as default}; +import{r as d,u as F,j as e}from"./react-vendor-B7v2HPaI.js";import{ab as R,L as T,M as I,T as _,j as z,a3 as P,ad as U}from"./index-0LeeVNek.js";import{E as M}from"./EmptyState-o0gibvhZ.js";import{a as k}from"./format-Co_unrac.js";import{I as J,a as Q}from"./IconPlayerSkipForwardFilled-Ca9nBmoF.js";function b(a){return a.endsWith(".jsonl")?a.slice(0,-6):a}function E(a,i=12){return a.length>i?`${a.slice(0,i)}…`:a}function K(a){const i=b(a.name),n=(a.title||"").trim();return n?`${n.slice(0,60)} — ${E(i)}`:E(i)}function B(a){return a==="user"?"border-emerald-400 dark:border-emerald-500 text-emerald-700 dark:text-emerald-300":a==="assistant"?"border-indigo-400 dark:border-indigo-500 text-indigo-700 dark:text-indigo-300":"border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400"}function H({projectName:a}){var C,q,$;const i=R(typeof window<"u"?window.location.search:""),[n,j]=d.useState(i.session),[h,y]=d.useState(null),c=F({queryKey:["contextreplay","sessions",a],queryFn:()=>P(a)}),g=d.useMemo(()=>{var r;return(((r=c.data)==null?void 0:r.files)??[]).slice().sort((x,p)=>(p.modified??0)-(x.modified??0))},[c.data]);d.useEffect(()=>{if(g.length===0)return;const t=new Set(g.map(r=>b(r.name)));(!n||!t.has(n))&&(j(b(g[0].name)),y(null))},[g,n]);const l=F({queryKey:["contextreplay","events",n],queryFn:()=>U(n),enabled:!!n}),s=((C=l.data)==null?void 0:C.events)??[],f=((q=l.data)==null?void 0:q.total_tokens)??0,w=(($=l.data)==null?void 0:$.warnings)??[];d.useEffect(()=>{if(s.length===0||h!==null||i.seq===null)return;const t=s.findIndex(r=>r.seq===i.seq);t>=0&&y(t)},[s,h,i.seq]);const o=d.useMemo(()=>s.length===0?-1:h===null?s.length-1:Math.min(s.length-1,Math.max(0,h)),[s.length,h]),u=o>=0?s[o]??null:null,v=o>=0?s.slice(0,o+1):[],N=(u==null?void 0:u.cumulative_tokens)??0,S=f>0?Math.min(100,Math.round(N/f*100)):0;d.useEffect(()=>{if(typeof window>"u")return;const t=new URL(window.location.href),r=new URLSearchParams(t.search);n?r.set("session",n):r.delete("session"),u?r.set("seq",String(u.seq)):r.delete("seq");const x=r.toString(),p=`${t.pathname}${x?`?${x}`:""}${t.hash}`,L=`${window.location.pathname}${window.location.search}${window.location.hash}`;p!==L&&window.history.replaceState({},"",p)},[n,u]);const m=t=>{s.length!==0&&y(Math.min(s.length-1,Math.max(0,t)))};return c.isLoading?e.jsx(T,{message:"Loading sessions..."}):c.error?e.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load sessions:"," ",c.error instanceof Error?c.error.message:"Unknown error"]}):g.length===0?e.jsx(M,{icon:e.jsx(I,{size:40}),title:"No sessions yet in this project",description:"Once a Claude Code session runs here, you'll be able to scrub through the context the model saw at each turn."}):e.jsxs("div",{className:"space-y-4","data-testid":"context-replay-tab",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-3",children:[e.jsx("select",{value:n??"",onChange:t=>{j(t.target.value||null),y(null)},className:"text-sm rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 px-2 py-1.5 min-w-0 max-w-md flex-shrink","aria-label":"Session to replay context for",children:g.map(t=>{const r=b(t.name);return e.jsx("option",{value:r,children:K(t)},r)})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>m(0),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0,"aria-label":"Jump to first turn",children:e.jsx(J,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(o-1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0||o<=0,"aria-label":"Previous turn",children:e.jsx(_,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(o+1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0||o>=s.length-1,"aria-label":"Next turn",children:e.jsx(z,{size:14})}),e.jsx("button",{type:"button",onClick:()=>m(s.length-1),className:"p-1.5 rounded border border-gray-300 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",disabled:s.length===0,"aria-label":"Jump to last turn (full context)",children:e.jsx(Q,{size:14})}),s.length>0&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2 tabular-nums",children:["turn ",o+1," of ",s.length]})]})]}),l.isLoading?e.jsx("div",{className:"h-14 flex items-center text-xs text-gray-500",children:"Reconstructing context…"}):l.error?e.jsxs("div",{className:"p-3 text-sm text-red-600 dark:text-red-400",children:["Failed to reconstruct context:"," ",l.error instanceof Error?l.error.message:"Unknown error"]}):s.length===0?e.jsx(M,{icon:e.jsx(I,{size:36}),title:"No messages in this session",description:w.length>0?w.join(" · "):"This session has no recorded messages — pick another from the dropdown above."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"text-gray-600 dark:text-gray-300 tabular-nums",children:["≈ ",k(N)," / ",k(f)," context tokens",e.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[" (",S,"%)"]})]}),e.jsx("span",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:"estimate · chars/4 of each turn's text + tool payload"})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-indigo-500 dark:bg-indigo-400 transition-all",style:{width:`${S}%`}})}),e.jsx("input",{type:"range",min:0,max:Math.max(0,s.length-1),value:o<0?0:o,onChange:t=>m(Number(t.target.value)),className:"w-full accent-indigo-500 dark:accent-indigo-400","aria-label":"Context cutoff (seq)"})]}),e.jsx("ul",{className:"space-y-1.5","data-testid":"context-replay-events",children:v.map((t,r)=>{const x=r===v.length-1;return e.jsxs("li",{className:`rounded-md border-l-2 pl-3 pr-2 py-1.5 ${B(t.role)} ${x?"bg-indigo-50/70 dark:bg-indigo-900/20":"bg-gray-50 dark:bg-gray-800/40"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[e.jsxs("span",{className:"font-medium tabular-nums",children:["#",t.seq," ",e.jsx("span",{className:"uppercase tracking-wide",children:t.role})]}),e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[k(t.cumulative_tokens)," tok"]})]}),t.tool_calls.length>0&&e.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-500 dark:text-gray-400 truncate",children:["tools: ",t.tool_calls.join(", ")]}),t.content_preview&&e.jsx("div",{className:"mt-0.5 text-xs text-gray-700 dark:text-gray-300 line-clamp-2 whitespace-pre-wrap break-words",children:t.content_preview})]},t.seq)})})]})]})}export{H as default}; diff --git a/stackunderflow/static/react/assets/CostTab-DCJQfNNf.js b/stackunderflow/static/react/assets/CostTab-FEEkQwUn.js similarity index 98% rename from stackunderflow/static/react/assets/CostTab-DCJQfNNf.js rename to stackunderflow/static/react/assets/CostTab-FEEkQwUn.js index 1bcb173..6427881 100644 --- a/stackunderflow/static/react/assets/CostTab-DCJQfNNf.js +++ b/stackunderflow/static/react/assets/CostTab-FEEkQwUn.js @@ -1,4 +1,4 @@ -import{r as p,u as pe,j as e,m as Oe}from"./react-vendor-B7v2HPaI.js";import{a as U,o as he,g as ne}from"./ProjectDashboard-DAsn11K-.js";import{h as Pe,u as O,a as Be,L as Je,m as ie,B as xe,n as ze,ae as et,p as z,i as X,j as Ie,N as Ae,I as Ke,af as tt}from"./index-DQluCO2S.js";import{b as S,c as R,a as B,f as H}from"./format-Co_unrac.js";import{I as rt,T as st,C as at,c as ot,d as nt}from"./TokenCompositionDonut-DTEMWIwY.js";import{I as ge,E as me}from"./EstimatedCostMarker-BpsBXEjf.js";import{u as Q,E as le,C as it,a as Ne}from"./chartTheme-GpkpBpop.js";import{R as Z,B as J,C as ee,X as te,Y as re,T as se,b as ae,d as Ue,g as He,L as lt}from"./recharts-C8DDeE7E.js";import{I as dt,a as ct}from"./IconArrowUp-D8NJ3QQF.js";import{a as xt,I as ve}from"./FilterBar-BS6lhcC1.js";import"./EmptyState-o0gibvhZ.js";import"./dashboardTabs-C5ecR5YO.js";import"./IconHash-cdeuBxnj.js";import"./IconTrendingUp-D1iuYAG9.js";/** +import{r as p,u as pe,j as e,m as Oe}from"./react-vendor-B7v2HPaI.js";import{a as U,o as he,g as ne}from"./ProjectDashboard-CixMPUyA.js";import{h as Pe,u as O,a as Be,L as Je,m as ie,B as xe,n as ze,ae as et,p as z,i as X,j as Ie,N as Ae,I as Ke,af as tt}from"./index-0LeeVNek.js";import{b as S,c as R,a as B,f as H}from"./format-Co_unrac.js";import{I as rt,T as st,C as at,b as ot,c as nt}from"./TokenCompositionDonut-DhTEtbxP.js";import{I as ge,E as me}from"./EstimatedCostMarker-DsipcjDe.js";import{u as Q,E as le,C as it,a as Ne}from"./chartTheme-GpkpBpop.js";import{R as Z,B as J,C as ee,X as te,Y as re,T as se,b as ae,d as Ue,g as He,L as lt}from"./recharts-C8DDeE7E.js";import{I as dt,a as ct}from"./IconArrowUp-CqAnfuIE.js";import{a as xt,I as ve}from"./FilterBar-CML9sBEu.js";import"./EmptyState-o0gibvhZ.js";import"./dashboardTabs-BuoED77E.js";import"./IconHash-Cw_3c3J-.js";import"./IconTrendingUp-CcTO0Xpf.js";import"./IconDatabase-50ZWmnTz.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. @@ -9,4 +9,4 @@ import{r as p,u as pe,j as e,m as Oe}from"./react-vendor-B7v2HPaI.js";import{a a * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. */const ut=[["path",{d:"M10 13a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M8 21v-1a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v1",key:"svg-1"}],["path",{d:"M15 5a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-2"}],["path",{d:"M17 10h2a2 2 0 0 1 2 2v1",key:"svg-3"}],["path",{d:"M5 5a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-4"}],["path",{d:"M3 13v-1a2 2 0 0 1 2 -2h2",key:"svg-5"}]],pt=Pe("outline","users-group","UsersGroup",ut),ht=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}],we={blue:"bg-blue-500 dark:bg-blue-400",green:"bg-emerald-500 dark:bg-emerald-400",yellow:"bg-yellow-500 dark:bg-yellow-400",red:"bg-rose-500 dark:bg-rose-400",purple:"bg-purple-500 dark:bg-purple-400",orange:"bg-orange-500 dark:bg-orange-400",gray:"bg-gray-400 dark:bg-gray-500"};function Ce(t){return we[ze(t)]??we.gray}function yt({initialPeriod:t="month"}){const{currency:r}=O(),{filters:a,setProviders:s}=Be(),[o,c]=p.useState(t),{data:n,isLoading:g,error:i}=pe({queryKey:["costByProvider",o,a.providers],queryFn:()=>et(o,{providers:a.providers}),staleTime:6e4}),d=m=>{s([m])},b=(n==null?void 0:n.rows)??[],h=b.reduce((m,x)=>m+(x.cost_usd??0),0);return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900/40 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(pt,{size:16,className:"text-gray-500"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Spend by agent"}),e.jsx("span",{className:"text-xs text-gray-500 truncate",children:"who's billing for the active window"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Cost-by-provider period",children:ht.map(m=>e.jsx("button",{type:"button",onClick:()=>c(m.id),"aria-pressed":m.id===o,className:`px-2.5 py-1 text-[11px] font-medium transition-colors ${m.id===o?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:m.label},m.id))})]}),g&&e.jsx(Je,{message:"Loading cost-by-provider..."}),i&&e.jsxs("div",{className:"text-xs text-red-700 dark:text-red-400",children:["Failed to load: ",i instanceof Error?i.message:String(i)]}),!g&&!i&&b.length===0&&e.jsx("div",{className:"text-xs text-gray-500",children:"No spend in this window."}),!g&&!i&&b.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex h-3 w-full rounded-full overflow-hidden bg-gray-100 dark:bg-gray-800",children:b.map(m=>{const x=h>0?m.cost_usd/h*100:0;return x<=0?null:e.jsx("button",{type:"button",onClick:()=>d(m.provider),className:`${Ce(m.provider)} hover:brightness-110 transition`,style:{width:`${x}%`},title:`Click to filter dashboard to ${ie(m.provider)} — ${S(m.cost_usd,r)} (${x.toFixed(1)}%)`,"aria-label":`Filter to ${ie(m.provider)}`},m.provider)})}),e.jsx("ul",{className:"space-y-1.5",children:b.map(m=>{const x=h>0?m.cost_usd/h*100:0;return e.jsxs("li",{className:"flex items-center gap-3 text-xs","data-testid":`cost-by-provider-row-${m.provider}`,children:[e.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full shrink-0 ${Ce(m.provider)}`}),e.jsx(xe,{color:ze(m.provider),size:"sm",children:ie(m.provider)}),e.jsxs("span",{className:"text-gray-500 tabular-nums shrink-0 w-12 text-right",children:[x.toFixed(1),"%"]}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:S(m.cost_usd,r)}),e.jsxs("span",{className:"text-gray-500 tabular-nums",children:["· ",R(m.session_count)," sessions"]}),e.jsxs("span",{className:"text-gray-500 tabular-nums",children:["· ",R(m.message_count)," msgs"]})]},m.provider)})})]})]})}const _e=6;function bt(t,r=64){return t?t.length>r?`${t.slice(0,r-1).trimEnd()}…`:t:""}function ft({rows:t,maxCount:r,scrollable:a=!1}){const s=a?"space-y-1.5 max-h-[300px] overflow-y-auto pr-1":"space-y-1.5";return e.jsx("div",{className:s,children:t.map(([o,c])=>{const n=r>0?c/r*100:0;return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-24 text-gray-700 dark:text-gray-300 truncate",title:o,children:o}),e.jsx("div",{className:"flex-1 h-1.5 bg-white dark:bg-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-red-500/70",style:{width:`${n}%`}})}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 tabular-nums w-10 text-right",children:c})]},o)})})}function kt({cmd:t}){const{currency:r}=O(),a=t.tool_count??0,s=t.cost??0;return e.jsxs("button",{type:"button",onClick:()=>U(t.interaction_id),className:"w-full flex items-start gap-2 px-2 py-1.5 rounded hover:bg-red-100 dark:hover:bg-red-900/20 focus:outline-none focus:bg-red-100 dark:focus:bg-red-900/20 text-left transition-colors group",title:"Open in Messages",children:[e.jsx(mt,{size:12,className:"text-gray-500 group-hover:text-red-300 mt-1 flex-shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"flex-1 text-xs text-gray-700 dark:text-gray-300 truncate",title:t.prompt_preview??"",children:bt(t.prompt_preview??"(no prompt)",72)}),e.jsxs("span",{className:"text-[10px] text-red-700 dark:text-red-300 tabular-nums whitespace-nowrap",children:[a," err"]}),e.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400 tabular-nums whitespace-nowrap w-14 text-right",children:S(s,r)})]})}function jt({errorCost:t}){const{currency:r}=O(),[a,s]=p.useState(!1),[o,c]=p.useState(!1);if(!t||t.total_errors===0)return e.jsxs("div",{className:"bg-gradient-to-br from-red-900/20 to-gray-50/50 dark:to-gray-900/30 rounded-lg p-6 border border-red-900/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{size:18,className:"text-red-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Error Cost"})]}),e.jsx("div",{className:"text-gray-500 text-sm",children:"No errors recorded."})]});const n=t.total_errors??0,g=t.estimated_retry_cost??0,i=t.estimated_retry_tokens??0,d=Object.entries(t.errors_by_tool??{}).filter(([,w])=>w>0).sort((w,$)=>$[1]-w[1]),b=d.slice(0,_e),h=Math.max(0,d.length-_e),m=d.length>0?Math.max(...d.map(([,w])=>w)):0,x=d.length,l=t.top_error_commands??[],v=l.slice(0,3),k=Math.max(0,l.length-3);return e.jsxs("div",{className:"bg-gradient-to-br from-red-900/30 to-gray-50/60 dark:to-gray-900/40 rounded-lg p-6 border border-red-900/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{size:18,className:"text-red-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Error Cost"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-4xl font-bold text-red-700 dark:text-red-300 leading-none tabular-nums",children:S(g,r)}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-2",children:["wasted on"," ",e.jsx("span",{className:"text-red-700 dark:text-red-200 font-medium",children:n.toLocaleString()})," error",n===1?"":"s"," across"," ",e.jsx("span",{className:"text-red-700 dark:text-red-200 font-medium",children:x})," tool",x===1?"":"s"]}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-1 tabular-nums",children:["≈ ",B(i)," retry tokens"]})]}),d.length>0&&e.jsxs("div",{className:"mt-5 pt-4 border-t border-red-900/30",children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-2",children:"Errors by tool"}),e.jsx(ft,{rows:a?d:b,maxCount:m,scrollable:a}),(h>0||a)&&e.jsx("button",{type:"button",onClick:()=>s(w=>!w),className:"mt-2 inline-flex items-center gap-1 text-[11px] text-red-700/80 dark:text-red-300/80 hover:text-red-800 dark:hover:text-red-200 focus:outline-none","aria-expanded":a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(ge,{size:12,"aria-hidden":"true"}),"Show fewer"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Show all ",d.length," tools"]})})]}),l.length>0&&e.jsxs("div",{className:"mt-5 pt-4 border-t border-red-900/30",children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-2",children:"Top error commands"}),e.jsx("div",{className:"space-y-0.5",children:(o?l:v).map(w=>e.jsx(kt,{cmd:w},w.interaction_id))}),(k>0||o)&&e.jsx("button",{type:"button",onClick:()=>c(w=>!w),className:"mt-2 inline-flex items-center gap-1 text-[11px] text-red-700/80 dark:text-red-300/80 hover:text-red-800 dark:hover:text-red-200 focus:outline-none","aria-expanded":o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(ge,{size:12,"aria-hidden":"true"}),"Show fewer"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Show all ",l.length," commands"]})})]})]})}const Se=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#2DD4BF","#FCD34D"];function Nt(t){return t.length>8?t.slice(0,8):t}function vt(t){if(!Number.isFinite(t)||t<0)return"0:00:00";const r=Math.floor(t),a=Math.floor(r/3600),s=Math.floor(r%3600/60),o=r%60;return`${a}:${s.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}function P({label:t,value:r,valueClass:a}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:t}),e.jsx("span",{className:a??"text-gray-900 dark:text-gray-100",children:r})]})}function wt({active:t,payload:r,currency:a}){var h;if(!t||!r||r.length===0)return null;const s=(h=r[0])==null?void 0:h.payload;if(!s)return null;const o=s.tokens??{},c=Number(o.input??0),n=Number(o.output??0),g=Number(o.cache_read??0),i=Number(o.cache_creation??0),d=s.preview||"",b=d.length>140?d.slice(0,140)+"…":d;return e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md text-xs max-w-[360px] px-2.5 py-2 text-gray-700 dark:text-gray-300 shadow-lg",children:[e.jsx("div",{className:"font-mono text-gray-900 dark:text-gray-100 mb-1",children:s.short_id}),b&&e.jsx("div",{className:"text-gray-500 dark:text-gray-400 mb-1.5 italic",children:b}),e.jsx(P,{label:"Cost",value:S(s.cost,a),valueClass:"text-gray-900 dark:text-gray-100 font-semibold"}),e.jsx(P,{label:"Duration",value:vt(s.duration_s)}),e.jsx(P,{label:"Commands",value:s.commands.toLocaleString()}),s.errors>0&&e.jsx(P,{label:"Errors",value:s.errors.toLocaleString(),valueClass:"text-red-600 dark:text-red-400"}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 mt-1.5 pt-1.5",children:[e.jsx("div",{className:"text-[11px] mb-0.5 text-gray-400 dark:text-gray-500",children:"Tokens"}),e.jsx(P,{label:"Input",value:B(c)}),e.jsx(P,{label:"Output",value:B(n)}),e.jsx(P,{label:"Cache read",value:B(g)}),e.jsx(P,{label:"Cache creation",value:B(i)})]}),s.models_used&&s.models_used.length>0&&e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 mt-1.5 pt-1.5",children:[e.jsx("div",{className:"text-[11px] mb-0.5 text-gray-400 dark:text-gray-500",children:"Models"}),e.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-300 whitespace-normal break-words",title:s.models_used.join(", "),children:s.models_used.map(H).join(", ")})]})]})}function Ct({data:t,onSelect:r}){const{currency:a}=O(),s=Q();if(!t||t.length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Top Sessions by Cost"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No session cost data yet"})]});const o=[...t].sort((i,d)=>d.cost-i.cost).slice(0,10).map(i=>{const d=Nt(i.session_id),b=(i.first_prompt_preview??"").replace(/\s+/g," ").trim(),h=b.length>36?b.slice(0,36)+"…":b;return{session_id:i.session_id,short_id:d,label:h?`${d} · ${h}`:d,cost:i.cost,commands:i.commands,errors:i.errors,messages:i.messages,duration_s:i.duration_s,models_used:i.models_used??[],tokens:i.tokens??{},preview:i.first_prompt_preview}}),c=o.reduce((i,d)=>d.cost>i?d.cost:i,0);if(c<=0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Top Sessions by Cost"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No cost recorded for these sessions"})]});const n=c*.1,g=i=>{const d=i==null?void 0:i.session_id;if(d){if(r){r(d);return}he(d)}};return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Top Sessions by Cost",e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:["top ",o.length]})]}),e.jsx(Z,{width:"100%",height:Math.max(260,o.length*32),children:e.jsxs(J,{data:o,layout:"vertical",margin:{left:10,right:20},children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx(te,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:i=>S(i,a)}),e.jsx(re,{type:"category",dataKey:"label",tick:{fontSize:11,fill:s.tick.fill},tickLine:s.axisLine,axisLine:s.axisLine,width:320,interval:0}),e.jsx(se,{content:e.jsx(wt,{currency:a}),cursor:{fill:"rgba(75, 85, 99, 0.15)"}}),e.jsxs(ae,{dataKey:"cost",radius:[0,4,4,0],cursor:"pointer",onClick:g,children:[o.map((i,d)=>e.jsx(Ue,{fill:Se[d%Se.length]},d)),e.jsx(He,{dataKey:"cost",position:"insideRight",fill:"#F9FAFB",fontSize:10,fontWeight:600,formatter:i=>{const d=typeof i=="number"?i:Number(i);return!Number.isFinite(d)||d<=n?"":S(d,a)}})]})]})})]})}const _t={cost:"cost",tokens:"tokens",tools:"tools",steps:"steps",when:"when"};function qe(t){return t?(t.input??0)+(t.output??0)+(t.cache_read??0)+(t.cache_creation??0):0}function Ge(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Te(t,r){switch(r){case"cost":return t.cost??0;case"tokens":return qe(t.tokens);case"tools":return t.tools_used??0;case"steps":return t.steps??0;case"when":return t.timestamp??""}}function St(t,r,a){const s=t===""||t==null,o=r===""||r==null;if(s&&o)return 0;if(s)return 1;if(o)return-1;if(typeof t=="number"&&typeof r=="number")return a==="asc"?t-r:r-t;const c=String(t),n=String(r);return a==="asc"?c.localeCompare(n):n.localeCompare(c)}function Tt(t){if(t.length===0)return 0;const r=[...t].sort((s,o)=>s-o),a=Math.floor(r.length/2);return r.length%2===0?((r[a-1]??0)+(r[a]??0))/2:r[a]??0}function Ft(t,r){if(t.length===0)return 0;const a=[...t].sort((c,n)=>c-n),s=Math.ceil(r/100*a.length),o=Math.min(Math.max(s-1,0),a.length-1);return a[o]??0}function $t(t,r,a){const[s,o]=p.useState(r),[c,n]=p.useState(a),g=p.useMemo(()=>{const d=[...t];return d.sort((b,h)=>St(Te(b,s),Te(h,s),c)),d},[t,s,c]),i=p.useCallback(d=>{o(b=>b===d?(n(h=>h==="asc"?"desc":"asc"),b):(n("desc"),d))},[]);return{sorted:g,sortKey:s,sortDir:c,setSort:i}}function K({label:t,sortKey:r,activeKey:a,dir:s,onSort:o,align:c="right",className:n}){const g=r===a;return e.jsx("th",{scope:"col",className:`px-3 py-2 cursor-pointer select-none hover:text-gray-800 dark:hover:text-gray-200 ${c==="right"?"text-right":"text-left"} ${n??""}`,onClick:()=>o(r),"aria-sort":g?s==="asc"?"ascending":"descending":"none","data-testid":`ccl-sort-${r}`,children:e.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[t,g&&(s==="asc"?e.jsx(dt,{size:11,className:"inline"}):e.jsx(ct,{size:11,className:"inline"}))]})})}function Lt({row:t,colSpan:r}){return e.jsx("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 bg-gray-50/60 dark:bg-gray-900/40","data-testid":"ccl-expanded",children:e.jsx("td",{colSpan:r,className:"px-3 py-3",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:"Prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:t.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[t.had_error&&e.jsxs(xe,{color:"red",children:[e.jsx(z,{size:10,className:"mr-1"}),"had error"]}),(t.models_used??[]).map(a=>e.jsx("span",{title:a,children:e.jsx(xe,{color:"purple",children:H(a)})},a)),(t.models_used==null||t.models_used.length===0)&&e.jsx("span",{className:"text-[10px] text-gray-500",children:"no model recorded"}),e.jsxs("span",{className:"text-[10px] text-gray-500 ml-auto font-mono",children:["session ",t.session_id.slice(0,8)," · ",Ge(t.timestamp)]})]})]})})})}function Mt({data:t,onOpen:r,initialSort:a}){const{currency:s}=O(),o=t??[],{sorted:c,sortKey:n,sortDir:g,setSort:i}=$t(o,(a==null?void 0:a.key)??"cost",(a==null?void 0:a.dir)??"desc"),[d,b]=p.useState(()=>new Set),[h,m]=p.useState(1),[x,l]=p.useState(10),v=Math.max(1,Math.ceil(c.length/x)),k=Math.min(h,v),w=p.useMemo(()=>c.slice((k-1)*x,k*x),[c,k,x]),$=p.useMemo(()=>o.reduce((y,N)=>y+(N.cost??0),0),[o]),M=p.useMemo(()=>{const y=o.map(N=>N.cost??0);return{sum:y.reduce((N,_)=>N+_,0),median:Tt(y),p95:Ft(y,95)}},[o]),L=p.useCallback(y=>{b(N=>{const _=new Set(N);return _.has(y)?_.delete(y):_.add(y),_})},[]),j=p.useCallback(y=>{if(r){r(y);return}U(y)},[r]);if(!t||t.length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"ccl-root-empty",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Most Expensive Commands"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No command cost data yet"})]});const C=8;return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"ccl-root",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3 gap-3 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Most Expensive Commands"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-gray-500","data-testid":"ccl-caption",children:c.length===0?"no rows":`${(k-1)*x+1}–${Math.min(k*x,c.length)} of ${c.length}, sorted by ${_t[n]} (${g})`}),e.jsx("select",{value:x,onChange:y=>{l(Number(y.target.value)),m(1)},"aria-label":"Rows per page",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1 text-xs text-gray-700 dark:text-gray-300",children:[10,25,50,100].map(y=>e.jsxs("option",{value:y,children:[y,"/page"]},y))})]})]}),e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{scope:"col",className:"w-8","aria-label":"expand"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-left",children:"Prompt"}),e.jsx(K,{label:"When",sortKey:"when",activeKey:n,dir:g,onSort:i,align:"left",className:"w-28"}),e.jsx(K,{label:"Cost",sortKey:"cost",activeKey:n,dir:g,onSort:i,className:"w-20"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-right w-20",children:"%Total"}),e.jsx(K,{label:"Tokens",sortKey:"tokens",activeKey:n,dir:g,onSort:i,className:"w-20"}),e.jsx(K,{label:"Tools",sortKey:"tools",activeKey:n,dir:g,onSort:i,className:"w-20"}),e.jsx(K,{label:"Steps",sortKey:"steps",activeKey:n,dir:g,onSort:i,className:"w-20"})]})}),e.jsx("tbody",{children:w.map(y=>{const N=qe(y.tokens),_=$>0?y.cost/$*100:0,f=d.has(y.interaction_id);return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer",onClick:()=>j(y.interaction_id),"data-testid":"ccl-row",children:[e.jsx("td",{className:"px-2 py-2 text-gray-500 w-8",children:e.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),L(y.interaction_id)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),L(y.interaction_id))},className:"p-0.5 rounded hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200/70 dark:hover:bg-gray-700/50 focus:outline-none focus:ring-1 focus:ring-indigo-500","aria-expanded":f,"aria-label":f?"Collapse row":"Expand row","data-testid":"ccl-expand-toggle",children:f?e.jsx(X,{size:14}):e.jsx(Ie,{size:14})})}),e.jsx("td",{className:"px-3 py-2 text-gray-800 dark:text-gray-200 max-w-md",children:e.jsxs("div",{className:"flex items-start gap-1.5",children:[y.had_error&&e.jsx(z,{size:12,className:"text-red-400 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"truncate block",title:y.prompt_preview,children:y.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})]})}),e.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs whitespace-nowrap",children:Ge(y.timestamp)}),e.jsxs("td",{className:"px-3 py-2 text-right text-gray-900 dark:text-gray-100 font-medium tabular-nums",children:[e.jsx(me,{costSource:y.cost_source}),S(y.cost,s)]}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-500 tabular-nums text-xs",children:_>=.1?`${_.toFixed(1)}%`:"—"}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:B(N)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:y.tools_used}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:y.steps})]}),f&&e.jsx(Lt,{row:y,colSpan:C})]},y.interaction_id)})}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"border-t border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 text-xs bg-gray-100/60 dark:bg-gray-800/40","data-testid":"ccl-footer",children:[e.jsx("td",{colSpan:3,className:"px-3 py-2 text-left uppercase tracking-wider text-gray-500",children:"Cost aggregates"}),e.jsxs("td",{className:"px-3 py-2 text-right font-medium tabular-nums",title:"Sum",children:["Σ ",S(M.sum,s)]}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-500 tabular-nums",children:"100%"}),e.jsxs("td",{colSpan:3,className:"px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums text-[11px]",children:["median ",S(M.median,s)," · p95 ",S(M.p95,s)]})]})})]})})}),v>1&&e.jsxs("div",{className:"flex items-center justify-between mt-3 text-xs text-gray-600 dark:text-gray-400","data-testid":"ccl-pagination",children:[e.jsxs("span",{children:["Page ",k," of ",v]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>m(y=>Math.max(1,y-1)),disabled:k<=1,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Prev"}),e.jsx("button",{type:"button",onClick:()=>m(y=>Math.min(v,y+1)),disabled:k>=v,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}const Fe=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#2DD4BF","#FCD34D"],G=[{key:"cost",label:"Cost"},{key:"calls",label:"Calls"},{key:"tokens",label:"Tokens"}];function $e(t){return!isFinite(t)||t<=0?"—":t<.1?"<0.1%":t<10?`${t.toFixed(1)}%`:`${t.toFixed(0)}%`}function Et({data:t,onToolClick:r}){var M,L;const{currency:a}=O(),s=Q(),[o,c]=p.useState("cost"),n=p.useMemo(()=>!!t&&Object.values(t).some(j=>((j==null?void 0:j.cache_read_tokens)??0)>0||((j==null?void 0:j.cache_creation_tokens)??0)>0),[t]),g=p.useMemo(()=>n?G:G.filter(j=>j.key!=="tokens"),[n]),i=o==="tokens"&&!n?"cost":o,d=p.useMemo(()=>{if(!t)return[];const j=Object.entries(t).map(([N,_])=>{const f=_.input_tokens??0,u=_.output_tokens??0,E=_.cache_read_tokens??0,T=_.cache_creation_tokens??0;return{name:N,cost:_.cost??0,calls:_.calls??0,tokens:f+u+E+T,input:f,output:u,cacheRead:E,cacheCreation:T}}).filter(N=>N.cost>0||N.calls>0||N.tokens>0),C=j.reduce((N,_)=>N+(_[i]||0),0);return[...j].sort((N,_)=>(_[i]||0)-(N[i]||0)).slice(0,12).map(N=>{const _=N[i]||0,f=C>0?_/C*100:0,u=i==="cost"?S(N.cost,a):R(_);return{...N,pctOfTotal:f,label:`${u} · ${$e(f)}`}})},[t,i,a]),b=d.length>0,h=`Tools by ${((M=G.find(j=>j.key===i))==null?void 0:M.label)??"Cost"}`,m=e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-3",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:h}),e.jsx("div",{role:"tablist","aria-label":"Sort tools",className:"inline-flex items-center rounded-md border border-gray-300 dark:border-gray-700 bg-gray-50/80 dark:bg-gray-900/60 p-0.5 text-[11px]",children:g.map(j=>{const C=j.key===i;return e.jsx("button",{role:"tab","aria-selected":C,type:"button",onClick:()=>c(j.key),className:["px-2.5 py-1 rounded transition-colors",C?"bg-indigo-500/25 text-indigo-200":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"].join(" "),children:j.label},j.key)})})]});if(!t||Object.keys(t).length===0||!b)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[m,e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No tool cost data yet"})]});const x=i,l=Math.max(...d.map(j=>j.name.length)),v=Math.min(l*6,160),k=j=>{var y;let C;if(j&&typeof j=="object"){const N=j;C=N.name??((y=N.payload)==null?void 0:y.name)}C&&(r&&r(C),typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("stackunderflow:filter-tool",{detail:{tool:C}})))},w=i==="cost"?j=>S(j,a):j=>R(j),$=(((L=G.find(j=>j.key===i))==null?void 0:L.label)??"cost").toLowerCase();return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[m,e.jsx(Z,{width:"100%",height:Math.max(260,d.length*32),children:e.jsxs(J,{data:d,layout:"vertical",margin:{left:20,right:88},children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx(te,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:w}),e.jsx(re,{type:"category",dataKey:"name",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,width:v}),e.jsx(se,{cursor:{fill:"rgba(129, 140, 248, 0.08)"},contentStyle:{...s.tooltipContent,whiteSpace:"pre-line"},labelStyle:s.tooltipLabel,formatter:(j,C,y)=>{const N=y==null?void 0:y.payload;if(!N)return["",""];const f=[`${i==="cost"?S(N.cost,a):R(N[i])} · ${$e(N.pctOfTotal)} of ${$}`];return i!=="cost"&&f.push(`cost: ${S(N.cost,a)}`),f.push(`calls: ${R(N.calls)}`),f.push(`input: ${R(N.input)} · output: ${R(N.output)}`),n&&f.push(`cache read: ${R(N.cacheRead)} · cache creation: ${R(N.cacheCreation)}`),[f.join(` -`),"Details"]}}),e.jsxs(ae,{dataKey:x,radius:[0,4,4,0],cursor:"pointer",onClick:k,children:[d.map((j,C)=>e.jsx(Ue,{fill:Fe[C%Fe.length]},C)),e.jsx(He,{dataKey:"label",position:"right",style:{fill:s.tick.fill,fontSize:10}})]})]})}),e.jsxs("p",{className:"mt-2 text-[10px] text-gray-500",children:["Click a bar to filter by that tool. % is share of total ",$," across all tools."]})]})}const W=[{key:"input",color:"#818CF8",label:"Input"},{key:"output",color:"#34D399",label:"Output"},{key:"cache_read",color:"#F59E0B",label:"Cache Read"},{key:"cache_creation",color:"#FB923C",label:"Cache Creation"}],Dt=1440*60*1e3,Rt=[{key:"7d",label:"7d"},{key:"30d",label:"30d"},{key:"all",label:"All"}];function Ot({active:t,label:r,payload:a}){var c;if(!t||!a||a.length===0)return null;const s=(c=a[0])==null?void 0:c.payload;if(!s)return null;const o=(s.input??0)+(s.output??0)+(s.cache_read??0)+(s.cache_creation??0);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-md p-2.5 text-xs shadow-lg","data-testid":"token-stack-tooltip",children:[e.jsx("div",{className:"text-gray-800 dark:text-gray-200 font-medium mb-1.5",children:r}),e.jsx("div",{className:"space-y-1",children:W.map(n=>{const g=s[n.key]??0,i=o>0?g/o*100:0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:n.color}}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 flex-1",children:n.label}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 tabular-nums",children:g.toLocaleString()}),e.jsxs("span",{className:"text-gray-500 tabular-nums w-10 text-right",children:[i.toFixed(1),"%"]})]},n.key)})}),e.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-gray-300 dark:border-gray-700 flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Total"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100 font-medium tabular-nums",children:o.toLocaleString()})]})]})}function Pt({daily:t,range:r}){const a=Q(),s=r!==void 0,[o,c]=p.useState("all"),n=r??o,[g,i]=p.useState(null),d=p.useMemo(()=>t?Object.entries(t).map(([x,l])=>({date:x,input:l.input??0,output:l.output??0,cache_read:l.cache_read??0,cache_creation:l.cache_creation??0})).sort((x,l)=>x.date.localeCompare(l.date)):[],[t]),b=p.useMemo(()=>{if(n==="all")return d;const x=d.map(w=>Date.parse(w.date)).filter(w=>!Number.isNaN(w));if(x.length===0)return d;const k=Math.max(...x)-(n==="7d"?7:30)*Dt;return d.filter(w=>{const $=Date.parse(w.date);return Number.isNaN($)?!0:$>=k})},[d,n]);if(!t||Object.keys(t).length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-stack",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Daily Token Composition"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No daily token data yet"})]});const h=g?W.filter(x=>x.key===g):W,m=x=>{i(l=>l===x?null:x)};return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-stack",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Daily Token Composition"}),!s&&e.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Date range filter","data-testid":"token-stack-range",children:Rt.map(x=>{const l=n===x.key;return e.jsx("button",{type:"button",onClick:()=>c(x.key),"data-testid":`token-stack-range-${x.key}`,"aria-pressed":l,className:`inline-flex items-center px-2 py-0.5 text-[11px] font-medium rounded-full border transition-colors ${l?"bg-indigo-100 text-indigo-800 border-indigo-300 dark:bg-indigo-900/50 dark:text-indigo-200 dark:border-indigo-700":"bg-gray-100/90 dark:bg-gray-800/80 text-gray-600 dark:text-gray-400 border-gray-300 dark:border-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"}`,children:x.label},x.key)})})]}),b.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No data in this range"}):e.jsx(Z,{width:"100%",height:260,children:e.jsxs(J,{data:b,children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:a.grid}),e.jsx(te,{dataKey:"date",tick:a.tick,tickLine:a.axisLine,axisLine:a.axisLine}),e.jsx(re,{tick:a.tick,tickLine:a.axisLine,axisLine:a.axisLine,tickFormatter:B}),e.jsx(se,{cursor:{fill:"rgba(99, 102, 241, 0.08)"},content:e.jsx(Ot,{})}),h.map((x,l)=>e.jsx(ae,{dataKey:x.key,stackId:"tokens",fill:x.color,name:x.key,radius:l===h.length-1?[4,4,0,0]:[0,0,0,0]},x.key))]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-center gap-3 flex-wrap",role:"group","aria-label":"Series legend — click to isolate","data-testid":"token-stack-legend",children:[W.map(x=>{const l=g!==null&&g!==x.key;return e.jsxs("button",{type:"button",onClick:()=>m(x.key),"data-testid":`token-stack-legend-${x.key}`,"aria-pressed":g===x.key,title:g===x.key?"Click to show all series":`Click to isolate ${x.label}`,className:`inline-flex items-center gap-1.5 text-[11px] transition-opacity ${l?"opacity-40 hover:opacity-70":"opacity-100"} text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200`,children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:x.color}}),e.jsx("span",{children:x.label})]},x.key)}),g!==null&&e.jsx("button",{type:"button",onClick:()=>i(null),"data-testid":"token-stack-legend-reset",className:"text-[11px] text-indigo-700 dark:text-indigo-300 hover:text-indigo-800 dark:hover:text-indigo-200 underline underline-offset-2",children:"reset"})]})]})}const V="Daily Cost by Model",Bt=1e-9,Le=8,Me="__other__",Ee=["#818CF8","#34D399","#F59E0B","#FB923C","#F472B6","#22D3EE","#A78BFA","#4ADE80"],zt="#9CA3AF",It=[0,0,0,0],At=[4,4,0,0];async function Kt(t){const r=await fetch(`/api/cost-data/by-model?period=${encodeURIComponent(t)}`);if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`${r.status} ${r.statusText}${a?`: ${a}`:""}`)}return r.json()}function Ut({models:t}){if(t.length===0)return null;const r=t.reduce((o,c)=>o+c.messages,0),a=t.slice(0,3).map(o=>H(o.model)).join(", "),s=t.length>3?` +${t.length-3} more`:"";return e.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-amber-200 dark:border-amber-900/50 bg-amber-50 dark:bg-amber-900/20 px-3 py-2 text-[11px] text-amber-800 dark:text-amber-300",children:[e.jsx(z,{size:13,className:"mt-0.5 shrink-0"}),e.jsxs("span",{className:"leading-snug",children:[e.jsxs("span",{className:"font-semibold",children:[t.length," ",t.length===1?"model":"models"," unpriced"]})," — ",R(r)," ",r===1?"message":"messages"," from ",a,s," ",t.length===1?"has":"have"," no rate card, so ",t.length===1?"its":"their"," ","spend isn’t reflected in this chart."]})]})}function Ht(t){const r=(t==null?void 0:t.models)??[],a=(t==null?void 0:t.currency)??null,s=[],o=[];for(const x of r)if(x.total_cost>Bt)s.push(x);else{const l=x.daily.reduce((v,k)=>v+(k.message_count??0),0);l>0&&o.push({model:x.model,messages:l})}const c=s.slice(0,Le),n=s.slice(Le),g=c.map((x,l)=>({key:x.model,label:H(x.model),color:Ee[l%Ee.length]}));n.length>0&&g.push({key:Me,label:`Other (${n.length})`,color:zt});const i=new Map,d=x=>{let l=i.get(x);return l||(l={date:x},i.set(x,l)),l},b=(x,l,v)=>{const k=d(x);k[l]=(k[l]??0)+v};for(const x of c)for(const l of x.daily)b(l.date,x.model,l.cost_usd);for(const x of n)for(const l of x.daily)b(l.date,Me,l.cost_usd);const h=Array.from(i.values()).sort((x,l)=>x.date.localeCompare(l.date)),m=s.reduce((x,l)=>x+l.total_cost,0);return{rows:h,series:g,unpriced:o,totalPriced:m,currency:a}}function qt({period:t}){const r=Q(),{name:a}=Oe(),{currency:s}=O(),{data:o,isLoading:c,error:n}=pe({queryKey:["costByModel",a??null,t,(s==null?void 0:s.code)??null],queryFn:()=>Kt(t),staleTime:6e4}),g=p.useMemo(()=>Ht(o),[o]),{rows:i,series:d,unpriced:b,totalPriced:h,currency:m}=g,x=p.useMemo(()=>k=>S(k,m),[m]),l=p.useMemo(()=>(k,w)=>[S(k,m),w],[m]);if(c)return e.jsx(le,{title:V,message:"Loading…"});if(n)return e.jsx(le,{title:V,message:n instanceof Error?n.message:"Failed to load by-model spend"});if(i.length===0&&b.length===0)return e.jsx(le,{title:V});const v=i.length>0?e.jsx("span",{className:"ml-2 text-xs font-normal text-gray-400 dark:text-gray-500 tabular-nums",children:S(h,m)}):void 0;return e.jsxs(it,{title:V,titleAccessory:v,children:[e.jsx(Ut,{models:b}),i.length===0?e.jsx("div",{className:"flex items-center justify-center text-xs text-gray-400 dark:text-gray-600",style:{height:Ne},children:"No priced model spend in this window"}):e.jsx(Z,{width:"100%",height:Ne,children:e.jsxs(J,{data:i,children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:r.grid}),e.jsx(te,{dataKey:"date",tick:r.tick,tickLine:r.axisLine,axisLine:r.axisLine}),e.jsx(re,{tick:r.tick,tickLine:r.axisLine,axisLine:r.axisLine,tickFormatter:x}),e.jsx(se,{contentStyle:r.tooltipContent,labelStyle:r.tooltipLabel,itemStyle:r.tooltipItem,formatter:l}),e.jsx(lt,{wrapperStyle:r.legend}),d.map((k,w)=>e.jsx(ae,{dataKey:k.key,stackId:"model",fill:k.color,name:k.label,radius:w===d.length-1?At:It,isAnimationActive:!1},k.key))]})})]})}const Gt=p.memo(qt);function ue(t){return t==null||typeof t=="number"&&Number.isNaN(t)}function Vt(t,r,a){const s=ue(t),o=ue(r);if(s&&o)return 0;if(s)return 1;if(o)return-1;let c=0;if(typeof t=="number"&&typeof r=="number")c=t-r;else{const n=String(t),g=String(r);if(/^\d{4}-\d{2}-\d{2}/.test(n)&&/^\d{4}-\d{2}-\d{2}/.test(g)){const i=Date.parse(n),d=Date.parse(g);!Number.isNaN(i)&&!Number.isNaN(d)?c=i-d:c=n.localeCompare(g)}else c=n.localeCompare(g,void 0,{numeric:!0,sensitivity:"base"})}return a==="asc"?c:-c}function Wt(t,r){const[a,s]=p.useState(r.key),[o,c]=p.useState(r.dir),n=p.useCallback(i=>{if(i===a){c(h=>h==="asc"?"desc":"asc");return}s(i);const d=t.find(h=>!ue(h[i])),b=d?d[i]:void 0;c(typeof b=="number"?"desc":"asc")},[a,t]);return{sorted:p.useMemo(()=>{const i=t.slice();return i.sort((d,b)=>Vt(d[a],b[a],o)),i},[t,a,o]),sortKey:a,sortDir:o,setSort:n}}function de({label:t,sortKey:r,activeKey:a,dir:s,onClick:o,align:c="left",className:n}){const g=r===a,d=["cursor-pointer select-none px-3 py-2",c==="right"?"text-right":"text-left",n??""].filter(Boolean).join(" "),b=["inline-flex items-center gap-1",c==="right"?"w-full justify-end":""].filter(Boolean).join(" "),h=g?s==="asc"?ge:X:null;return p.createElement("th",{onClick:o,className:d,"data-sort-key":r,"aria-sort":g?s==="asc"?"ascending":"descending":"none",role:"columnheader",scope:"col",tabIndex:0,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o())}},p.createElement("span",{className:b},p.createElement("span",null,t),h?p.createElement(h,{size:12,stroke:2.5,"aria-hidden":!0}):null))}function Yt({expanded:t,onToggle:r,columns:a,children:s,detail:o,rowClassName:c,detailClassName:n,"data-testid":g}){const i=c??"border-b border-gray-200/50 dark:border-gray-800/50 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer focus:outline-none focus:bg-gray-100/70 dark:focus:bg-gray-800/50",d=n??"bg-gray-50/80 dark:bg-gray-900/60 text-gray-700 dark:text-gray-300 px-6 py-3 border-b border-gray-200 dark:border-gray-800",b=h=>{(h.key==="Enter"||h.key===" "||h.key==="Spacebar")&&(h.preventDefault(),r())};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:i,role:"button",tabIndex:0,"aria-expanded":t,onClick:r,onKeyDown:b,"data-testid":g,children:[e.jsx("td",{className:"w-6 px-2 py-2 text-gray-500 align-middle",children:e.jsx(Ie,{size:14,className:`transition-transform duration-150 ease-out ${t?"rotate-90":""}`,"aria-hidden":"true"})}),s]}),t&&e.jsx("tr",{"data-testid":g?`${g}-detail`:void 0,children:e.jsx("td",{colSpan:a,className:d,children:o})})]})}function Xt(t){const r=t.filter(o=>typeof o=="number"&&!Number.isNaN(o));if(r.length===0)return 0;const a=[...r].sort((o,c)=>o-c),s=Math.floor(a.length/2);return a.length%2===0?((a[s-1]??0)+(a[s]??0))/2:a[s]??0}function Qt(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Zt=10;function De({title:t,icon:r,rows:a,countKey:s,countLabel:o,empty:c,testIdPrefix:n,onOpenInteraction:g,onOpenSession:i}){const{currency:d}=O(),{sorted:b,sortDir:h,sortKey:m,setSort:x}=Wt(a,{key:s,dir:"desc"}),[l,v]=p.useState(1),[k,w]=p.useState(Zt),[$,M]=p.useState(null),L=b.length,j=Math.max(1,Math.ceil(L/k)),C=Math.min(l,j),y=p.useMemo(()=>b.slice((C-1)*k,C*k),[b,C,k]),N=p.useMemo(()=>Xt(a.map(u=>u.cost)),[a]),_=5,f=String(m);return e.jsxs("div",{"data-testid":`${n}-section`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[e.jsx("span",{className:"text-gray-500",children:r}),e.jsx("span",{className:"font-medium uppercase tracking-wider",children:t}),e.jsxs("span",{className:"text-gray-500",children:["(",a.length,")"]})]}),a.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-4 px-3 bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800",children:c}):e.jsxs("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":`${n}-table`,children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"w-6 px-2 py-2","aria-hidden":"true"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Prompt"}),e.jsx(de,{label:"When",sortKey:"timestamp",activeKey:f,dir:h,onClick:()=>x("timestamp"),className:"w-32"}),e.jsx(de,{label:o,sortKey:s,activeKey:f,dir:h,onClick:()=>x(s),align:"right",className:"w-20"}),e.jsx(de,{label:"Cost",sortKey:"cost",activeKey:f,dir:h,onClick:()=>x("cost"),align:"right",className:"w-24"})]})}),e.jsx("tbody",{children:y.map(u=>{const E=$===u.interaction_id;return e.jsxs(Yt,{expanded:E,onToggle:()=>{M(E?null:u.interaction_id),g(u.interaction_id)},columns:_,"data-testid":`${n}-row-${u.interaction_id}`,detail:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:u.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-xs text-gray-600 dark:text-gray-400",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Tool calls:"})," ",e.jsx("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:u.tool_count})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Assistant steps:"})," ",e.jsx("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:u.step_count})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Cost:"})," ",e.jsxs("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:[e.jsx(me,{costSource:u.cost_source}),S(u.cost,d)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Session:"})," ",e.jsx("button",{type:"button",className:"text-blue-400 hover:text-blue-300 hover:underline font-mono text-xs",onClick:T=>{T.stopPropagation(),i(u.session_id)},children:u.session_id})]})]})]}),children:[e.jsx("td",{className:"px-3 py-2 text-gray-800 dark:text-gray-200 max-w-md",children:e.jsx("span",{className:"truncate block",title:u.prompt_preview,children:u.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})}),e.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs whitespace-nowrap",children:Qt(u.timestamp)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-900 dark:text-gray-100 font-medium tabular-nums",children:u[s]}),e.jsxs("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:[e.jsx(me,{costSource:u.cost_source}),S(u.cost,d)]})]},u.interaction_id)})}),e.jsx("tfoot",{className:"border-t border-gray-200 dark:border-gray-800 bg-gray-100/60 dark:bg-gray-800/40 text-xs","data-testid":`${n}-footer`,children:e.jsxs("tr",{children:[e.jsx("td",{className:"w-6 px-2 py-2","aria-hidden":"true"}),e.jsxs("td",{className:"px-3 py-2 font-medium text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:[L," ",L===1?"command":"commands",j>1?e.jsxs("span",{className:"text-gray-500 normal-case ml-2",children:["(page ",C," of ",j,")"]}):null]}),e.jsx("td",{className:"px-3 py-2"}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-500 uppercase tracking-wider",children:"median"}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:S(N,d)})]})})]})}),j>1&&e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-800 px-3 py-2 bg-gray-100/40 dark:bg-gray-800/20 flex items-center justify-between text-xs text-gray-600 dark:text-gray-400","data-testid":`${n}-pagination`,children:[e.jsxs("span",{children:[(C-1)*k+1,"–",Math.min(C*k,L)," of ",L]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:k,onChange:u=>{w(Number(u.target.value)),v(1)},"aria-label":"Rows per page",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-0.5 text-xs",children:[10,25,50,100].map(u=>e.jsxs("option",{value:u,children:[u,"/page"]},u))}),e.jsx("button",{type:"button",onClick:()=>v(u=>Math.max(1,u-1)),disabled:C<=1,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Prev"}),e.jsxs("span",{children:[C,"/",j]}),e.jsx("button",{type:"button",onClick:()=>v(u=>Math.min(j,u+1)),disabled:C>=j,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]})}function Jt({outliers:t,onOpen:r}){const a=(t==null?void 0:t.high_tool_commands)??[],s=(t==null?void 0:t.high_step_commands)??[],o=p.useCallback(n=>{r?r(n):U(n)},[r]),c=p.useCallback(n=>{he(n)},[]);return!t||a.length===0&&s.length===0?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"outlier-commands-table",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Outlier Commands"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No outlier commands — nothing exceeded the thresholds."})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"outlier-commands-table",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Outlier Commands",e.jsx("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:"tool-count > 20 · step-count > 15"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(De,{title:"High tool count",icon:e.jsx(Ae,{size:12}),rows:a,countKey:"tool_count",countLabel:"Tools",empty:"No commands exceeded 20 tool calls.",testIdPrefix:"outlier-high-tool",onOpenInteraction:o,onOpenSession:c}),e.jsx(De,{title:"High step count",icon:e.jsx(rt,{size:12}),rows:s,countKey:"step_count",countLabel:"Steps",empty:"No commands exceeded 15 assistant steps.",testIdPrefix:"outlier-high-step",onOpenInteraction:o,onOpenSession:c})]})]})}function er(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function tr(t){return t.consecutive_failures>=3?"red":"amber"}const rr={red:{wrapper:"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-800/60",icon:"text-red-600 dark:text-red-400",label:"text-red-700 dark:text-red-300"},amber:{wrapper:"bg-amber-50 dark:bg-amber-900/20 border-amber-300 dark:border-amber-800/60",icon:"text-amber-600 dark:text-amber-400",label:"text-amber-700 dark:text-amber-300"}},Re=[{id:"all",label:"All",predicate:()=>!0},{id:"ge2",label:"≥2 failures",predicate:t=>t.consecutive_failures>=2},{id:"ge3",label:"≥3 failures",predicate:t=>t.consecutive_failures>=3}];function sr({signals:t}){const{currency:r}=O(),[a,s]=p.useState("all"),[o,c]=p.useState(1),[n,g]=p.useState(10),i=p.useMemo(()=>!t||t.length===0?[]:[...t].sort((l,v)=>v.estimated_wasted_cost-l.estimated_wasted_cost||v.consecutive_failures-l.consecutive_failures),[t]),d=p.useMemo(()=>{var v;const l=((v=Re.find(k=>k.id===a))==null?void 0:v.predicate)??(()=>!0);return i.filter(l)},[i,a]),b=p.useMemo(()=>d.reduce((l,v)=>l+(v.estimated_wasted_cost??0),0),[d]),h=Math.max(1,Math.ceil(d.length/n)),m=Math.min(o,h),x=p.useMemo(()=>d.slice((m-1)*n,m*n),[d,m,n]);return!t||t.length===0?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"retry-alerts-panel",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Retry Alerts"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No retry storms detected — nice."})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"retry-alerts-panel",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3 gap-2 flex-wrap",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300","data-testid":"retry-alerts-summary",children:[d.length," retr",d.length===1?"y":"ies"," wasted"," ",e.jsx("span",{className:"tabular-nums",children:S(b,r)})," total"]}),e.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Severity filter","data-testid":"retry-alerts-filters",children:Re.map(l=>{const v=a===l.id;return e.jsx("button",{type:"button",onClick:()=>{s(l.id),c(1)},"aria-pressed":v,"data-testid":`retry-alerts-filter-${l.id}`,className:"text-[11px] px-2 py-0.5 rounded-full border transition-colors "+(v?"bg-indigo-500/20 border-indigo-500/60 text-indigo-200":"bg-gray-100/90 dark:bg-gray-800/80 border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"),children:l.label},l.id)})})]}),d.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center","data-testid":"retry-alerts-empty-filtered",children:"No signals match this severity filter."}):e.jsx("div",{className:"space-y-2","data-testid":"retry-alerts-list",children:x.map((l,v)=>{const k=rr[tr(l)];return e.jsxs("button",{type:"button",onClick:()=>U(l.interaction_id),"data-testid":"retry-alerts-row",className:`w-full text-left flex items-start gap-3 p-3 rounded border transition-colors ${k.wrapper} hover:brightness-125 focus:outline-none focus:ring-2 focus:ring-indigo-500/60`,children:[e.jsx(z,{size:16,className:`${k.icon} mt-0.5 flex-shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:`text-sm font-medium ${k.label}`,children:l.tool}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-gray-600 dark:text-gray-400 bg-gray-100/90 dark:bg-gray-800/80 border border-gray-300 dark:border-gray-700 rounded-full px-2 py-0.5",children:[e.jsx(Ke,{size:10}),l.consecutive_failures,"× failed · ",l.total_invocations," total"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:er(l.timestamp)})]}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 tabular-nums",children:["~",B(l.estimated_wasted_tokens)," wasted tokens ·"," ",S(l.estimated_wasted_cost,r)," wasted cost"]})]})]},`${l.interaction_id}-${l.tool}-${v}`)})}),h>1&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between text-xs text-gray-600 dark:text-gray-400","data-testid":"retry-alerts-pagination",children:[e.jsxs("span",{children:[(m-1)*n+1,"–",Math.min(m*n,d.length)," of ",d.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:n,onChange:l=>{g(Number(l.target.value)),c(1)},"aria-label":"Rows per page",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-0.5 text-xs",children:[10,25,50,100].map(l=>e.jsxs("option",{value:l,children:[l,"/page"]},l))}),e.jsx("button",{type:"button",onClick:()=>c(l=>Math.max(1,l-1)),disabled:m<=1,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Prev"}),e.jsxs("span",{children:[m,"/",h]}),e.jsx("button",{type:"button",onClick:()=>c(l=>Math.min(h,l+1)),disabled:m>=h,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}async function ar(t,r){const a=await fetch(`/api/cost-data${tt(t,r)}`);if(!a.ok){const s=await a.text().catch(()=>"");throw new Error(`${a.status} ${a.statusText}${s?`: ${s}`:""}`)}return a.json()}function Y(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?null:r}function or(t){return t==="7d"||t==="30d"||t==="all"?t:"all"}function nr(t,r,a){if(typeof window>"u"||typeof window.history>"u")return;const s=new URL(window.location.href);t==="all"?s.searchParams.delete("range"):s.searchParams.set("range",t),r?s.searchParams.set("session",r):s.searchParams.delete("session"),a?s.searchParams.set("tool",a):s.searchParams.delete("tool");const o=`${s.pathname}${s.search}${s.hash}`,c=`${window.location.pathname}${window.location.search}${window.location.hash}`;o!==c&&window.history.replaceState({},"",o)}function ir(t,r,a){if(t==="all")return null;const s=[];for(const n of r){const g=Y(n.ended_at)??Y(n.started_at);g!==null&&s.push(g)}for(const n of a){const g=Y(n.timestamp);g!==null&&s.push(g)}return(s.length?Math.max(...s):Date.now())-(t==="7d"?7:30)*24*60*60*1e3}function ce({filter:t,onRangeChange:r,onClearSession:a,onClearTool:s}){const o=[{key:"7d",label:"Last 7 days"},{key:"30d",label:"Last 30 days"},{key:"all",label:"All time"}];return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-100/40 dark:bg-gray-800/40 border border-gray-200 dark:border-gray-800 rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500",children:[e.jsx(xt,{size:13}),e.jsx("span",{className:"text-[11px] uppercase tracking-wider",children:"Filter"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(nt,{size:12,className:"text-gray-500"}),o.map(c=>e.jsx("button",{onClick:()=>r(c.key),className:`px-2 py-0.5 rounded text-[11px] transition-colors ${t.range===c.key?"bg-indigo-500/20 text-indigo-300 border border-indigo-500/40":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 border border-transparent"}`,children:c.label},c.key))]}),t.sessionFilter&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 text-[11px] px-2 py-0.5 rounded bg-amber-500/15 text-amber-300 border border-amber-500/30 hover:bg-amber-500/25",title:"Clear session filter",children:["Session: ",e.jsx("span",{className:"font-mono",children:t.sessionFilter.slice(0,8)}),e.jsx(ve,{size:11})]}),t.toolFilter&&e.jsxs("button",{onClick:s,className:"flex items-center gap-1 text-[11px] px-2 py-0.5 rounded bg-purple-500/15 text-purple-300 border border-purple-500/30 hover:bg-purple-500/25",title:"Clear tool filter",children:[e.jsx(Ae,{size:11})," ",t.toolFilter,e.jsx(ve,{size:11})]})]})}function lr(){const t="bg-gray-100/40 dark:bg-gray-800/40 rounded-lg border border-gray-200 dark:border-gray-800 animate-pulse";return e.jsxs("div",{className:"space-y-6","aria-busy":"true","aria-label":"Loading cost analytics",children:[e.jsx("div",{className:`${t} h-20`}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:`${t} h-40`}),e.jsx("div",{className:`${t} h-40`})]}),e.jsx("div",{className:`${t} h-64`}),e.jsx("div",{className:`${t} h-80`}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:`${t} h-64`}),e.jsx("div",{className:`${t} h-64`})]}),e.jsx("div",{className:`${t} h-48`}),e.jsx("div",{className:`${t} h-40`})]})}function dr({message:t,onRetry:r}){return e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx(z,{size:16,className:"text-red-600 dark:text-red-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:"Failed to load cost analytics"}),e.jsx("div",{className:"text-xs text-red-700/80 dark:text-red-400/80 truncate",children:t})]})]}),e.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-800 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-700 shrink-0",children:[e.jsx(Ke,{size:12})," Retry"]})]})}function wr({stats:t}){const{name:r}=Oe(),{filters:a}=Be(),s=a.models,[o,c]=p.useState(()=>({range:or(ne("range")),sessionFilter:ne("session"),toolFilter:ne("tool")})),{data:n,isLoading:g,error:i,refetch:d}=pe({queryKey:["costData",r??null,s,o.range],queryFn:()=>ar(s,o.range),staleTime:3e4}),b=i instanceof Error?i.message:i?String(i):null,h=p.useCallback(()=>{d()},[d]);p.useEffect(()=>{nr(o.range,o.sessionFilter,o.toolFilter)},[o.range,o.sessionFilter,o.toolFilter]),p.useEffect(()=>{const f=E=>{const T=E.detail;(T==null?void 0:T.window)==="current-week"?c(D=>({...D,range:"7d"})):(T==null?void 0:T.window)==="prior-week"&&c(D=>({...D,range:"30d"}))},u=E=>{const T=E.detail;T!=null&&T.tool&&c(D=>({...D,toolFilter:T.tool}))};return window.addEventListener("stackunderflow:filter-window",f),window.addEventListener("stackunderflow:filter-tool",u),()=>{window.removeEventListener("stackunderflow:filter-window",f),window.removeEventListener("stackunderflow:filter-tool",u)}},[]);const m=p.useMemo(()=>{var fe;if(!n)return null;const f=n.session_costs??[],u=n.command_costs??[],E=n.retry_signals??[],T=ir(o.range,f,u),D=F=>{if(T===null)return!0;const q=Y(F);return q===null?!0:q>=T},oe=F=>!o.sessionFilter||F===o.sessionFilter,ye=f.filter(F=>D(F.ended_at??F.started_at)&&oe(F.session_id)),Ve=u.filter(F=>D(F.timestamp)&&oe(F.session_id)),We=E.filter(F=>D(F.timestamp)&&oe(F.session_id)&&(!o.toolFilter||F.tool===o.toolFilter)),Ye=o.toolFilter?n.tool_costs&&o.toolFilter in n.tool_costs?{[o.toolFilter]:n.tool_costs[o.toolFilter]}:{}:n.tool_costs??{},I=n.token_composition,A=(fe=t==null?void 0:t.overview)==null?void 0:fe.total_tokens,Xe=(I==null?void 0:I.totals)??(A?{input:A.input??0,output:A.output??0,cache_read:A.cache_read??0,cache_creation:A.cache_creation??0}:{}),Qe=o.range!=="all"||!!o.sessionFilter;let be=Xe;if(Qe&&(I!=null&&I.per_session)){const F={};for(const q of ye){const ke=I.per_session[q.session_id];if(ke)for(const[je,Ze]of Object.entries(ke))F[je]=(F[je]??0)+(Ze??0)}be=F}return{sessions:ye,commands:Ve,retries:We,tools:Ye,tokenTotals:be}},[n,o,t]),x=p.useMemo(()=>{var E;const f=(E=n==null?void 0:n.token_composition)==null?void 0:E.daily;if(!f)return;const u={};for(const[T,D]of Object.entries(f))u[T]={tokens:D};return u},[n]),l=p.useCallback(f=>{U(f)},[]),v=p.useCallback(f=>{he(f)},[]),k=f=>c(u=>({...u,range:f})),w=()=>c(f=>({...f,sessionFilter:null})),$=()=>c(f=>({...f,toolFilter:null}));if(g)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(lr,{})]});if(b||!n)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(dr,{message:b??"No data returned from /api/cost-data",onRetry:h})]});const M=m,L=n.token_composition,j=M.tokenTotals,C=n.trends??void 0,y=n.error_cost??void 0,N=n.outliers??void 0,_=o.range==="7d"?"week":o.range==="30d"?"month":"all";return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(yt,{initialPeriod:o.range==="7d"?"week":o.range==="30d"?"month":"all"}),e.jsx(st,{trends:C}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(at,{cache:n.cache??(t==null?void 0:t.cache)??void 0,sessionCosts:n.session_costs,dailyStats:x}),e.jsx(jt,{errorCost:y})]}),e.jsx(Ct,{data:M.sessions,onSelect:f=>{c(u=>({...u,sessionFilter:f})),v(f)}}),e.jsx(Mt,{data:M.commands,onOpen:l}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[(()=>{const f=o.range!=="all"&&!n.tool_costs_windowed,u=s.length>0;return!f&&!u?null:e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400",children:[e.jsx(z,{size:11}),e.jsxs("span",{children:["Tool costs are"," ",e.jsx("span",{className:"font-semibold",children:[f?"all-time":null,u?"all-models":null].filter(Boolean).join(" · ")})," ","— the ",f&&u?"date-range and model filters aren’t":f?"date-range filter isn’t":"model filter isn’t"," applied here yet."]})]})})(),e.jsx(Et,{data:M.tools})]}),e.jsxs("div",{children:[s.length>0&&e.jsxs("div",{className:"mb-1.5 text-[10px] text-gray-500",children:["Token composition scoped to"," ",e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:s.map(H).join(", ")})]}),e.jsx(ot,{totals:j})]})]}),e.jsx(Pt,{daily:(L==null?void 0:L.daily)??{},range:o.range}),e.jsx(Gt,{period:_}),e.jsx(Jt,{outliers:N,onOpen:l}),e.jsx(sr,{signals:M.retries})]})}export{wr as default}; +`),"Details"]}}),e.jsxs(ae,{dataKey:x,radius:[0,4,4,0],cursor:"pointer",onClick:k,children:[d.map((j,C)=>e.jsx(Ue,{fill:Fe[C%Fe.length]},C)),e.jsx(He,{dataKey:"label",position:"right",style:{fill:s.tick.fill,fontSize:10}})]})]})}),e.jsxs("p",{className:"mt-2 text-[10px] text-gray-500",children:["Click a bar to filter by that tool. % is share of total ",$," across all tools."]})]})}const W=[{key:"input",color:"#818CF8",label:"Input"},{key:"output",color:"#34D399",label:"Output"},{key:"cache_read",color:"#F59E0B",label:"Cache Read"},{key:"cache_creation",color:"#FB923C",label:"Cache Creation"}],Dt=1440*60*1e3,Rt=[{key:"7d",label:"7d"},{key:"30d",label:"30d"},{key:"all",label:"All"}];function Ot({active:t,label:r,payload:a}){var c;if(!t||!a||a.length===0)return null;const s=(c=a[0])==null?void 0:c.payload;if(!s)return null;const o=(s.input??0)+(s.output??0)+(s.cache_read??0)+(s.cache_creation??0);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-md p-2.5 text-xs shadow-lg","data-testid":"token-stack-tooltip",children:[e.jsx("div",{className:"text-gray-800 dark:text-gray-200 font-medium mb-1.5",children:r}),e.jsx("div",{className:"space-y-1",children:W.map(n=>{const g=s[n.key]??0,i=o>0?g/o*100:0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:n.color}}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 flex-1",children:n.label}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 tabular-nums",children:g.toLocaleString()}),e.jsxs("span",{className:"text-gray-500 tabular-nums w-10 text-right",children:[i.toFixed(1),"%"]})]},n.key)})}),e.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-gray-300 dark:border-gray-700 flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Total"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100 font-medium tabular-nums",children:o.toLocaleString()})]})]})}function Pt({daily:t,range:r}){const a=Q(),s=r!==void 0,[o,c]=p.useState("all"),n=r??o,[g,i]=p.useState(null),d=p.useMemo(()=>t?Object.entries(t).map(([x,l])=>({date:x,input:l.input??0,output:l.output??0,cache_read:l.cache_read??0,cache_creation:l.cache_creation??0})).sort((x,l)=>x.date.localeCompare(l.date)):[],[t]),b=p.useMemo(()=>{if(n==="all")return d;const x=d.map(w=>Date.parse(w.date)).filter(w=>!Number.isNaN(w));if(x.length===0)return d;const k=Math.max(...x)-(n==="7d"?7:30)*Dt;return d.filter(w=>{const $=Date.parse(w.date);return Number.isNaN($)?!0:$>=k})},[d,n]);if(!t||Object.keys(t).length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-stack",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Daily Token Composition"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No daily token data yet"})]});const h=g?W.filter(x=>x.key===g):W,m=x=>{i(l=>l===x?null:x)};return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-stack",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Daily Token Composition"}),!s&&e.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Date range filter","data-testid":"token-stack-range",children:Rt.map(x=>{const l=n===x.key;return e.jsx("button",{type:"button",onClick:()=>c(x.key),"data-testid":`token-stack-range-${x.key}`,"aria-pressed":l,className:`inline-flex items-center px-2 py-0.5 text-[11px] font-medium rounded-full border transition-colors ${l?"bg-indigo-100 text-indigo-800 border-indigo-300 dark:bg-indigo-900/50 dark:text-indigo-200 dark:border-indigo-700":"bg-gray-100/90 dark:bg-gray-800/80 text-gray-600 dark:text-gray-400 border-gray-300 dark:border-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"}`,children:x.label},x.key)})})]}),b.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No data in this range"}):e.jsx(Z,{width:"100%",height:260,children:e.jsxs(J,{data:b,children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:a.grid}),e.jsx(te,{dataKey:"date",tick:a.tick,tickLine:a.axisLine,axisLine:a.axisLine}),e.jsx(re,{tick:a.tick,tickLine:a.axisLine,axisLine:a.axisLine,tickFormatter:B}),e.jsx(se,{cursor:{fill:"rgba(99, 102, 241, 0.08)"},content:e.jsx(Ot,{})}),h.map((x,l)=>e.jsx(ae,{dataKey:x.key,stackId:"tokens",fill:x.color,name:x.key,radius:l===h.length-1?[4,4,0,0]:[0,0,0,0]},x.key))]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-center gap-3 flex-wrap",role:"group","aria-label":"Series legend — click to isolate","data-testid":"token-stack-legend",children:[W.map(x=>{const l=g!==null&&g!==x.key;return e.jsxs("button",{type:"button",onClick:()=>m(x.key),"data-testid":`token-stack-legend-${x.key}`,"aria-pressed":g===x.key,title:g===x.key?"Click to show all series":`Click to isolate ${x.label}`,className:`inline-flex items-center gap-1.5 text-[11px] transition-opacity ${l?"opacity-40 hover:opacity-70":"opacity-100"} text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200`,children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:x.color}}),e.jsx("span",{children:x.label})]},x.key)}),g!==null&&e.jsx("button",{type:"button",onClick:()=>i(null),"data-testid":"token-stack-legend-reset",className:"text-[11px] text-indigo-700 dark:text-indigo-300 hover:text-indigo-800 dark:hover:text-indigo-200 underline underline-offset-2",children:"reset"})]})]})}const V="Daily Cost by Model",Bt=1e-9,Le=8,Me="__other__",Ee=["#818CF8","#34D399","#F59E0B","#FB923C","#F472B6","#22D3EE","#A78BFA","#4ADE80"],zt="#9CA3AF",It=[0,0,0,0],At=[4,4,0,0];async function Kt(t){const r=await fetch(`/api/cost-data/by-model?period=${encodeURIComponent(t)}`);if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`${r.status} ${r.statusText}${a?`: ${a}`:""}`)}return r.json()}function Ut({models:t}){if(t.length===0)return null;const r=t.reduce((o,c)=>o+c.messages,0),a=t.slice(0,3).map(o=>H(o.model)).join(", "),s=t.length>3?` +${t.length-3} more`:"";return e.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-amber-200 dark:border-amber-900/50 bg-amber-50 dark:bg-amber-900/20 px-3 py-2 text-[11px] text-amber-800 dark:text-amber-300",children:[e.jsx(z,{size:13,className:"mt-0.5 shrink-0"}),e.jsxs("span",{className:"leading-snug",children:[e.jsxs("span",{className:"font-semibold",children:[t.length," ",t.length===1?"model":"models"," unpriced"]})," — ",R(r)," ",r===1?"message":"messages"," from ",a,s," ",t.length===1?"has":"have"," no rate card, so ",t.length===1?"its":"their"," ","spend isn’t reflected in this chart."]})]})}function Ht(t){const r=(t==null?void 0:t.models)??[],a=(t==null?void 0:t.currency)??null,s=[],o=[];for(const x of r)if(x.total_cost>Bt)s.push(x);else{const l=x.daily.reduce((v,k)=>v+(k.message_count??0),0);l>0&&o.push({model:x.model,messages:l})}const c=s.slice(0,Le),n=s.slice(Le),g=c.map((x,l)=>({key:x.model,label:H(x.model),color:Ee[l%Ee.length]}));n.length>0&&g.push({key:Me,label:`Other (${n.length})`,color:zt});const i=new Map,d=x=>{let l=i.get(x);return l||(l={date:x},i.set(x,l)),l},b=(x,l,v)=>{const k=d(x);k[l]=(k[l]??0)+v};for(const x of c)for(const l of x.daily)b(l.date,x.model,l.cost_usd);for(const x of n)for(const l of x.daily)b(l.date,Me,l.cost_usd);const h=Array.from(i.values()).sort((x,l)=>x.date.localeCompare(l.date)),m=s.reduce((x,l)=>x+l.total_cost,0);return{rows:h,series:g,unpriced:o,totalPriced:m,currency:a}}function qt({period:t}){const r=Q(),{name:a}=Oe(),{currency:s}=O(),{data:o,isLoading:c,error:n}=pe({queryKey:["costByModel",a??null,t,(s==null?void 0:s.code)??null],queryFn:()=>Kt(t),staleTime:6e4}),g=p.useMemo(()=>Ht(o),[o]),{rows:i,series:d,unpriced:b,totalPriced:h,currency:m}=g,x=p.useMemo(()=>k=>S(k,m),[m]),l=p.useMemo(()=>(k,w)=>[S(k,m),w],[m]);if(c)return e.jsx(le,{title:V,message:"Loading…"});if(n)return e.jsx(le,{title:V,message:n instanceof Error?n.message:"Failed to load by-model spend"});if(i.length===0&&b.length===0)return e.jsx(le,{title:V});const v=i.length>0?e.jsx("span",{className:"ml-2 text-xs font-normal text-gray-400 dark:text-gray-500 tabular-nums",children:S(h,m)}):void 0;return e.jsxs(it,{title:V,titleAccessory:v,children:[e.jsx(Ut,{models:b}),i.length===0?e.jsx("div",{className:"flex items-center justify-center text-xs text-gray-400 dark:text-gray-600",style:{height:Ne},children:"No priced model spend in this window"}):e.jsx(Z,{width:"100%",height:Ne,children:e.jsxs(J,{data:i,children:[e.jsx(ee,{strokeDasharray:"3 3",stroke:r.grid}),e.jsx(te,{dataKey:"date",tick:r.tick,tickLine:r.axisLine,axisLine:r.axisLine}),e.jsx(re,{tick:r.tick,tickLine:r.axisLine,axisLine:r.axisLine,tickFormatter:x}),e.jsx(se,{contentStyle:r.tooltipContent,labelStyle:r.tooltipLabel,itemStyle:r.tooltipItem,formatter:l}),e.jsx(lt,{wrapperStyle:r.legend}),d.map((k,w)=>e.jsx(ae,{dataKey:k.key,stackId:"model",fill:k.color,name:k.label,radius:w===d.length-1?At:It,isAnimationActive:!1},k.key))]})})]})}const Gt=p.memo(qt);function ue(t){return t==null||typeof t=="number"&&Number.isNaN(t)}function Vt(t,r,a){const s=ue(t),o=ue(r);if(s&&o)return 0;if(s)return 1;if(o)return-1;let c=0;if(typeof t=="number"&&typeof r=="number")c=t-r;else{const n=String(t),g=String(r);if(/^\d{4}-\d{2}-\d{2}/.test(n)&&/^\d{4}-\d{2}-\d{2}/.test(g)){const i=Date.parse(n),d=Date.parse(g);!Number.isNaN(i)&&!Number.isNaN(d)?c=i-d:c=n.localeCompare(g)}else c=n.localeCompare(g,void 0,{numeric:!0,sensitivity:"base"})}return a==="asc"?c:-c}function Wt(t,r){const[a,s]=p.useState(r.key),[o,c]=p.useState(r.dir),n=p.useCallback(i=>{if(i===a){c(h=>h==="asc"?"desc":"asc");return}s(i);const d=t.find(h=>!ue(h[i])),b=d?d[i]:void 0;c(typeof b=="number"?"desc":"asc")},[a,t]);return{sorted:p.useMemo(()=>{const i=t.slice();return i.sort((d,b)=>Vt(d[a],b[a],o)),i},[t,a,o]),sortKey:a,sortDir:o,setSort:n}}function de({label:t,sortKey:r,activeKey:a,dir:s,onClick:o,align:c="left",className:n}){const g=r===a,d=["cursor-pointer select-none px-3 py-2",c==="right"?"text-right":"text-left",n??""].filter(Boolean).join(" "),b=["inline-flex items-center gap-1",c==="right"?"w-full justify-end":""].filter(Boolean).join(" "),h=g?s==="asc"?ge:X:null;return p.createElement("th",{onClick:o,className:d,"data-sort-key":r,"aria-sort":g?s==="asc"?"ascending":"descending":"none",role:"columnheader",scope:"col",tabIndex:0,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o())}},p.createElement("span",{className:b},p.createElement("span",null,t),h?p.createElement(h,{size:12,stroke:2.5,"aria-hidden":!0}):null))}function Yt({expanded:t,onToggle:r,columns:a,children:s,detail:o,rowClassName:c,detailClassName:n,"data-testid":g}){const i=c??"border-b border-gray-200/50 dark:border-gray-800/50 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer focus:outline-none focus:bg-gray-100/70 dark:focus:bg-gray-800/50",d=n??"bg-gray-50/80 dark:bg-gray-900/60 text-gray-700 dark:text-gray-300 px-6 py-3 border-b border-gray-200 dark:border-gray-800",b=h=>{(h.key==="Enter"||h.key===" "||h.key==="Spacebar")&&(h.preventDefault(),r())};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:i,role:"button",tabIndex:0,"aria-expanded":t,onClick:r,onKeyDown:b,"data-testid":g,children:[e.jsx("td",{className:"w-6 px-2 py-2 text-gray-500 align-middle",children:e.jsx(Ie,{size:14,className:`transition-transform duration-150 ease-out ${t?"rotate-90":""}`,"aria-hidden":"true"})}),s]}),t&&e.jsx("tr",{"data-testid":g?`${g}-detail`:void 0,children:e.jsx("td",{colSpan:a,className:d,children:o})})]})}function Xt(t){const r=t.filter(o=>typeof o=="number"&&!Number.isNaN(o));if(r.length===0)return 0;const a=[...r].sort((o,c)=>o-c),s=Math.floor(a.length/2);return a.length%2===0?((a[s-1]??0)+(a[s]??0))/2:a[s]??0}function Qt(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Zt=10;function De({title:t,icon:r,rows:a,countKey:s,countLabel:o,empty:c,testIdPrefix:n,onOpenInteraction:g,onOpenSession:i}){const{currency:d}=O(),{sorted:b,sortDir:h,sortKey:m,setSort:x}=Wt(a,{key:s,dir:"desc"}),[l,v]=p.useState(1),[k,w]=p.useState(Zt),[$,M]=p.useState(null),L=b.length,j=Math.max(1,Math.ceil(L/k)),C=Math.min(l,j),y=p.useMemo(()=>b.slice((C-1)*k,C*k),[b,C,k]),N=p.useMemo(()=>Xt(a.map(u=>u.cost)),[a]),_=5,f=String(m);return e.jsxs("div",{"data-testid":`${n}-section`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[e.jsx("span",{className:"text-gray-500",children:r}),e.jsx("span",{className:"font-medium uppercase tracking-wider",children:t}),e.jsxs("span",{className:"text-gray-500",children:["(",a.length,")"]})]}),a.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-4 px-3 bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800",children:c}):e.jsxs("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":`${n}-table`,children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"w-6 px-2 py-2","aria-hidden":"true"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Prompt"}),e.jsx(de,{label:"When",sortKey:"timestamp",activeKey:f,dir:h,onClick:()=>x("timestamp"),className:"w-32"}),e.jsx(de,{label:o,sortKey:s,activeKey:f,dir:h,onClick:()=>x(s),align:"right",className:"w-20"}),e.jsx(de,{label:"Cost",sortKey:"cost",activeKey:f,dir:h,onClick:()=>x("cost"),align:"right",className:"w-24"})]})}),e.jsx("tbody",{children:y.map(u=>{const E=$===u.interaction_id;return e.jsxs(Yt,{expanded:E,onToggle:()=>{M(E?null:u.interaction_id),g(u.interaction_id)},columns:_,"data-testid":`${n}-row-${u.interaction_id}`,detail:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-gray-500 mb-1",children:"Prompt"}),e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:u.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-xs text-gray-600 dark:text-gray-400",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Tool calls:"})," ",e.jsx("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:u.tool_count})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Assistant steps:"})," ",e.jsx("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:u.step_count})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Cost:"})," ",e.jsxs("span",{className:"tabular-nums text-gray-800 dark:text-gray-200",children:[e.jsx(me,{costSource:u.cost_source}),S(u.cost,d)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Session:"})," ",e.jsx("button",{type:"button",className:"text-blue-400 hover:text-blue-300 hover:underline font-mono text-xs",onClick:T=>{T.stopPropagation(),i(u.session_id)},children:u.session_id})]})]})]}),children:[e.jsx("td",{className:"px-3 py-2 text-gray-800 dark:text-gray-200 max-w-md",children:e.jsx("span",{className:"truncate block",title:u.prompt_preview,children:u.prompt_preview||e.jsx("span",{className:"text-gray-500 italic",children:"(empty prompt)"})})}),e.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs whitespace-nowrap",children:Qt(u.timestamp)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-900 dark:text-gray-100 font-medium tabular-nums",children:u[s]}),e.jsxs("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:[e.jsx(me,{costSource:u.cost_source}),S(u.cost,d)]})]},u.interaction_id)})}),e.jsx("tfoot",{className:"border-t border-gray-200 dark:border-gray-800 bg-gray-100/60 dark:bg-gray-800/40 text-xs","data-testid":`${n}-footer`,children:e.jsxs("tr",{children:[e.jsx("td",{className:"w-6 px-2 py-2","aria-hidden":"true"}),e.jsxs("td",{className:"px-3 py-2 font-medium text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:[L," ",L===1?"command":"commands",j>1?e.jsxs("span",{className:"text-gray-500 normal-case ml-2",children:["(page ",C," of ",j,")"]}):null]}),e.jsx("td",{className:"px-3 py-2"}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-500 uppercase tracking-wider",children:"median"}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:S(N,d)})]})})]})}),j>1&&e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-800 px-3 py-2 bg-gray-100/40 dark:bg-gray-800/20 flex items-center justify-between text-xs text-gray-600 dark:text-gray-400","data-testid":`${n}-pagination`,children:[e.jsxs("span",{children:[(C-1)*k+1,"–",Math.min(C*k,L)," of ",L]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:k,onChange:u=>{w(Number(u.target.value)),v(1)},"aria-label":"Rows per page",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-0.5 text-xs",children:[10,25,50,100].map(u=>e.jsxs("option",{value:u,children:[u,"/page"]},u))}),e.jsx("button",{type:"button",onClick:()=>v(u=>Math.max(1,u-1)),disabled:C<=1,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Prev"}),e.jsxs("span",{children:[C,"/",j]}),e.jsx("button",{type:"button",onClick:()=>v(u=>Math.min(j,u+1)),disabled:C>=j,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]})}function Jt({outliers:t,onOpen:r}){const a=(t==null?void 0:t.high_tool_commands)??[],s=(t==null?void 0:t.high_step_commands)??[],o=p.useCallback(n=>{r?r(n):U(n)},[r]),c=p.useCallback(n=>{he(n)},[]);return!t||a.length===0&&s.length===0?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"outlier-commands-table",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Outlier Commands"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No outlier commands — nothing exceeded the thresholds."})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"outlier-commands-table",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Outlier Commands",e.jsx("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:"tool-count > 20 · step-count > 15"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(De,{title:"High tool count",icon:e.jsx(Ae,{size:12}),rows:a,countKey:"tool_count",countLabel:"Tools",empty:"No commands exceeded 20 tool calls.",testIdPrefix:"outlier-high-tool",onOpenInteraction:o,onOpenSession:c}),e.jsx(De,{title:"High step count",icon:e.jsx(rt,{size:12}),rows:s,countKey:"step_count",countLabel:"Steps",empty:"No commands exceeded 15 assistant steps.",testIdPrefix:"outlier-high-step",onOpenInteraction:o,onOpenSession:c})]})]})}function er(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function tr(t){return t.consecutive_failures>=3?"red":"amber"}const rr={red:{wrapper:"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-800/60",icon:"text-red-600 dark:text-red-400",label:"text-red-700 dark:text-red-300"},amber:{wrapper:"bg-amber-50 dark:bg-amber-900/20 border-amber-300 dark:border-amber-800/60",icon:"text-amber-600 dark:text-amber-400",label:"text-amber-700 dark:text-amber-300"}},Re=[{id:"all",label:"All",predicate:()=>!0},{id:"ge2",label:"≥2 failures",predicate:t=>t.consecutive_failures>=2},{id:"ge3",label:"≥3 failures",predicate:t=>t.consecutive_failures>=3}];function sr({signals:t}){const{currency:r}=O(),[a,s]=p.useState("all"),[o,c]=p.useState(1),[n,g]=p.useState(10),i=p.useMemo(()=>!t||t.length===0?[]:[...t].sort((l,v)=>v.estimated_wasted_cost-l.estimated_wasted_cost||v.consecutive_failures-l.consecutive_failures),[t]),d=p.useMemo(()=>{var v;const l=((v=Re.find(k=>k.id===a))==null?void 0:v.predicate)??(()=>!0);return i.filter(l)},[i,a]),b=p.useMemo(()=>d.reduce((l,v)=>l+(v.estimated_wasted_cost??0),0),[d]),h=Math.max(1,Math.ceil(d.length/n)),m=Math.min(o,h),x=p.useMemo(()=>d.slice((m-1)*n,m*n),[d,m,n]);return!t||t.length===0?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"retry-alerts-panel",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Retry Alerts"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No retry storms detected — nice."})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"retry-alerts-panel",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3 gap-2 flex-wrap",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300","data-testid":"retry-alerts-summary",children:[d.length," retr",d.length===1?"y":"ies"," wasted"," ",e.jsx("span",{className:"tabular-nums",children:S(b,r)})," total"]}),e.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Severity filter","data-testid":"retry-alerts-filters",children:Re.map(l=>{const v=a===l.id;return e.jsx("button",{type:"button",onClick:()=>{s(l.id),c(1)},"aria-pressed":v,"data-testid":`retry-alerts-filter-${l.id}`,className:"text-[11px] px-2 py-0.5 rounded-full border transition-colors "+(v?"bg-indigo-500/20 border-indigo-500/60 text-indigo-200":"bg-gray-100/90 dark:bg-gray-800/80 border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"),children:l.label},l.id)})})]}),d.length===0?e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center","data-testid":"retry-alerts-empty-filtered",children:"No signals match this severity filter."}):e.jsx("div",{className:"space-y-2","data-testid":"retry-alerts-list",children:x.map((l,v)=>{const k=rr[tr(l)];return e.jsxs("button",{type:"button",onClick:()=>U(l.interaction_id),"data-testid":"retry-alerts-row",className:`w-full text-left flex items-start gap-3 p-3 rounded border transition-colors ${k.wrapper} hover:brightness-125 focus:outline-none focus:ring-2 focus:ring-indigo-500/60`,children:[e.jsx(z,{size:16,className:`${k.icon} mt-0.5 flex-shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:`text-sm font-medium ${k.label}`,children:l.tool}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-gray-600 dark:text-gray-400 bg-gray-100/90 dark:bg-gray-800/80 border border-gray-300 dark:border-gray-700 rounded-full px-2 py-0.5",children:[e.jsx(Ke,{size:10}),l.consecutive_failures,"× failed · ",l.total_invocations," total"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:er(l.timestamp)})]}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 tabular-nums",children:["~",B(l.estimated_wasted_tokens)," wasted tokens ·"," ",S(l.estimated_wasted_cost,r)," wasted cost"]})]})]},`${l.interaction_id}-${l.tool}-${v}`)})}),h>1&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between text-xs text-gray-600 dark:text-gray-400","data-testid":"retry-alerts-pagination",children:[e.jsxs("span",{children:[(m-1)*n+1,"–",Math.min(m*n,d.length)," of ",d.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:n,onChange:l=>{g(Number(l.target.value)),c(1)},"aria-label":"Rows per page",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-0.5 text-xs",children:[10,25,50,100].map(l=>e.jsxs("option",{value:l,children:[l,"/page"]},l))}),e.jsx("button",{type:"button",onClick:()=>c(l=>Math.max(1,l-1)),disabled:m<=1,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Prev"}),e.jsxs("span",{children:[m,"/",h]}),e.jsx("button",{type:"button",onClick:()=>c(l=>Math.min(h,l+1)),disabled:m>=h,className:"px-2 py-0.5 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}async function ar(t,r){const a=await fetch(`/api/cost-data${tt(t,r)}`);if(!a.ok){const s=await a.text().catch(()=>"");throw new Error(`${a.status} ${a.statusText}${s?`: ${s}`:""}`)}return a.json()}function Y(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?null:r}function or(t){return t==="7d"||t==="30d"||t==="all"?t:"all"}function nr(t,r,a){if(typeof window>"u"||typeof window.history>"u")return;const s=new URL(window.location.href);t==="all"?s.searchParams.delete("range"):s.searchParams.set("range",t),r?s.searchParams.set("session",r):s.searchParams.delete("session"),a?s.searchParams.set("tool",a):s.searchParams.delete("tool");const o=`${s.pathname}${s.search}${s.hash}`,c=`${window.location.pathname}${window.location.search}${window.location.hash}`;o!==c&&window.history.replaceState({},"",o)}function ir(t,r,a){if(t==="all")return null;const s=[];for(const n of r){const g=Y(n.ended_at)??Y(n.started_at);g!==null&&s.push(g)}for(const n of a){const g=Y(n.timestamp);g!==null&&s.push(g)}return(s.length?Math.max(...s):Date.now())-(t==="7d"?7:30)*24*60*60*1e3}function ce({filter:t,onRangeChange:r,onClearSession:a,onClearTool:s}){const o=[{key:"7d",label:"Last 7 days"},{key:"30d",label:"Last 30 days"},{key:"all",label:"All time"}];return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-100/40 dark:bg-gray-800/40 border border-gray-200 dark:border-gray-800 rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500",children:[e.jsx(xt,{size:13}),e.jsx("span",{className:"text-[11px] uppercase tracking-wider",children:"Filter"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(nt,{size:12,className:"text-gray-500"}),o.map(c=>e.jsx("button",{onClick:()=>r(c.key),className:`px-2 py-0.5 rounded text-[11px] transition-colors ${t.range===c.key?"bg-indigo-500/20 text-indigo-300 border border-indigo-500/40":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 border border-transparent"}`,children:c.label},c.key))]}),t.sessionFilter&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 text-[11px] px-2 py-0.5 rounded bg-amber-500/15 text-amber-300 border border-amber-500/30 hover:bg-amber-500/25",title:"Clear session filter",children:["Session: ",e.jsx("span",{className:"font-mono",children:t.sessionFilter.slice(0,8)}),e.jsx(ve,{size:11})]}),t.toolFilter&&e.jsxs("button",{onClick:s,className:"flex items-center gap-1 text-[11px] px-2 py-0.5 rounded bg-purple-500/15 text-purple-300 border border-purple-500/30 hover:bg-purple-500/25",title:"Clear tool filter",children:[e.jsx(Ae,{size:11})," ",t.toolFilter,e.jsx(ve,{size:11})]})]})}function lr(){const t="bg-gray-100/40 dark:bg-gray-800/40 rounded-lg border border-gray-200 dark:border-gray-800 animate-pulse";return e.jsxs("div",{className:"space-y-6","aria-busy":"true","aria-label":"Loading cost analytics",children:[e.jsx("div",{className:`${t} h-20`}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:`${t} h-40`}),e.jsx("div",{className:`${t} h-40`})]}),e.jsx("div",{className:`${t} h-64`}),e.jsx("div",{className:`${t} h-80`}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:`${t} h-64`}),e.jsx("div",{className:`${t} h-64`})]}),e.jsx("div",{className:`${t} h-48`}),e.jsx("div",{className:`${t} h-40`})]})}function dr({message:t,onRetry:r}){return e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx(z,{size:16,className:"text-red-600 dark:text-red-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:"Failed to load cost analytics"}),e.jsx("div",{className:"text-xs text-red-700/80 dark:text-red-400/80 truncate",children:t})]})]}),e.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-800 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-700 shrink-0",children:[e.jsx(Ke,{size:12})," Retry"]})]})}function Cr({stats:t}){const{name:r}=Oe(),{filters:a}=Be(),s=a.models,[o,c]=p.useState(()=>({range:or(ne("range")),sessionFilter:ne("session"),toolFilter:ne("tool")})),{data:n,isLoading:g,error:i,refetch:d}=pe({queryKey:["costData",r??null,s,o.range],queryFn:()=>ar(s,o.range),staleTime:3e4}),b=i instanceof Error?i.message:i?String(i):null,h=p.useCallback(()=>{d()},[d]);p.useEffect(()=>{nr(o.range,o.sessionFilter,o.toolFilter)},[o.range,o.sessionFilter,o.toolFilter]),p.useEffect(()=>{const f=E=>{const T=E.detail;(T==null?void 0:T.window)==="current-week"?c(D=>({...D,range:"7d"})):(T==null?void 0:T.window)==="prior-week"&&c(D=>({...D,range:"30d"}))},u=E=>{const T=E.detail;T!=null&&T.tool&&c(D=>({...D,toolFilter:T.tool}))};return window.addEventListener("stackunderflow:filter-window",f),window.addEventListener("stackunderflow:filter-tool",u),()=>{window.removeEventListener("stackunderflow:filter-window",f),window.removeEventListener("stackunderflow:filter-tool",u)}},[]);const m=p.useMemo(()=>{var fe;if(!n)return null;const f=n.session_costs??[],u=n.command_costs??[],E=n.retry_signals??[],T=ir(o.range,f,u),D=F=>{if(T===null)return!0;const q=Y(F);return q===null?!0:q>=T},oe=F=>!o.sessionFilter||F===o.sessionFilter,ye=f.filter(F=>D(F.ended_at??F.started_at)&&oe(F.session_id)),Ve=u.filter(F=>D(F.timestamp)&&oe(F.session_id)),We=E.filter(F=>D(F.timestamp)&&oe(F.session_id)&&(!o.toolFilter||F.tool===o.toolFilter)),Ye=o.toolFilter?n.tool_costs&&o.toolFilter in n.tool_costs?{[o.toolFilter]:n.tool_costs[o.toolFilter]}:{}:n.tool_costs??{},I=n.token_composition,A=(fe=t==null?void 0:t.overview)==null?void 0:fe.total_tokens,Xe=(I==null?void 0:I.totals)??(A?{input:A.input??0,output:A.output??0,cache_read:A.cache_read??0,cache_creation:A.cache_creation??0}:{}),Qe=o.range!=="all"||!!o.sessionFilter;let be=Xe;if(Qe&&(I!=null&&I.per_session)){const F={};for(const q of ye){const ke=I.per_session[q.session_id];if(ke)for(const[je,Ze]of Object.entries(ke))F[je]=(F[je]??0)+(Ze??0)}be=F}return{sessions:ye,commands:Ve,retries:We,tools:Ye,tokenTotals:be}},[n,o,t]),x=p.useMemo(()=>{var E;const f=(E=n==null?void 0:n.token_composition)==null?void 0:E.daily;if(!f)return;const u={};for(const[T,D]of Object.entries(f))u[T]={tokens:D};return u},[n]),l=p.useCallback(f=>{U(f)},[]),v=p.useCallback(f=>{he(f)},[]),k=f=>c(u=>({...u,range:f})),w=()=>c(f=>({...f,sessionFilter:null})),$=()=>c(f=>({...f,toolFilter:null}));if(g)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(lr,{})]});if(b||!n)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(dr,{message:b??"No data returned from /api/cost-data",onRetry:h})]});const M=m,L=n.token_composition,j=M.tokenTotals,C=n.trends??void 0,y=n.error_cost??void 0,N=n.outliers??void 0,_=o.range==="7d"?"week":o.range==="30d"?"month":"all";return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{filter:o,onRangeChange:k,onClearSession:w,onClearTool:$}),e.jsx(yt,{initialPeriod:o.range==="7d"?"week":o.range==="30d"?"month":"all"}),e.jsx(st,{trends:C}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(at,{cache:n.cache??(t==null?void 0:t.cache)??void 0,sessionCosts:n.session_costs,dailyStats:x}),e.jsx(jt,{errorCost:y})]}),e.jsx(Ct,{data:M.sessions,onSelect:f=>{c(u=>({...u,sessionFilter:f})),v(f)}}),e.jsx(Mt,{data:M.commands,onOpen:l}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[(()=>{const f=o.range!=="all"&&!n.tool_costs_windowed,u=s.length>0;return!f&&!u?null:e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400",children:[e.jsx(z,{size:11}),e.jsxs("span",{children:["Tool costs are"," ",e.jsx("span",{className:"font-semibold",children:[f?"all-time":null,u?"all-models":null].filter(Boolean).join(" · ")})," ","— the ",f&&u?"date-range and model filters aren’t":f?"date-range filter isn’t":"model filter isn’t"," applied here yet."]})]})})(),e.jsx(Et,{data:M.tools})]}),e.jsxs("div",{children:[s.length>0&&e.jsxs("div",{className:"mb-1.5 text-[10px] text-gray-500",children:["Token composition scoped to"," ",e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:s.map(H).join(", ")})]}),e.jsx(ot,{totals:j})]})]}),e.jsx(Pt,{daily:(L==null?void 0:L.daily)??{},range:o.range}),e.jsx(Gt,{period:_}),e.jsx(Jt,{outliers:N,onOpen:l}),e.jsx(sr,{signals:M.retries})]})}export{Cr as default}; diff --git a/stackunderflow/static/react/assets/DataTable-DCEy-2Es.js b/stackunderflow/static/react/assets/DataTable-BHenS21h.js similarity index 95% rename from stackunderflow/static/react/assets/DataTable-DCEy-2Es.js rename to stackunderflow/static/react/assets/DataTable-BHenS21h.js index 582f37e..3ab78ba 100644 --- a/stackunderflow/static/react/assets/DataTable-DCEy-2Es.js +++ b/stackunderflow/static/react/assets/DataTable-BHenS21h.js @@ -1 +1 @@ -import{r as o,j as r}from"./react-vendor-B7v2HPaI.js";import{b as $}from"./index-DQluCO2S.js";import{I as A}from"./ProjectDashboard-DAsn11K-.js";import{I as K,a as O}from"./IconArrowUp-D8NJ3QQF.js";function H({columns:d,data:f,keyFn:w,searchable:S,searchPlaceholder:D,searchFn:p,onRowClick:x,perPageOptions:I=[25,50,100],defaultPerPage:P=25,exportFilename:u,exportFn:m,emptyMessage:V="No data"}){const[y,L]=o.useState(""),[i,M]=o.useState(null),[b,j]=o.useState("desc"),[s,l]=o.useState(1),[n,U]=o.useState(P),c=o.useMemo(()=>{let e=f;if(y&&p){const t=y.toLowerCase();e=e.filter(a=>p(a,t))}if(i){const t=d.find(a=>a.key===i);if(t!=null&&t.sortValue){const a=t.sortValue;e=[...e].sort((g,E)=>{const k=a(g),N=a(E);return kN?b==="asc"?1:-1:0})}}return e},[f,y,p,i,b,d]),h=Math.ceil(c.length/n),v=c.slice((s-1)*n,s*n),z=e=>{const t=d.find(a=>a.key===e);t!=null&&t.sortValue&&(i===e?j(a=>a==="asc"?"desc":"asc"):(M(e),j("desc")),l(1))},C=()=>{if(!m||!u)return;const e=m(c),t=new Blob([e],{type:"text/csv"}),a=URL.createObjectURL(t),g=document.createElement("a");g.href=a,g.download=u,g.click(),URL.revokeObjectURL(a)};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[S&&r.jsxs("div",{className:"relative flex-1 max-w-xs",children:[r.jsx($,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),r.jsx("input",{type:"text",value:y,onChange:e=>{L(e.target.value),l(1)},placeholder:D??"Search...",className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded pl-8 pr-3 py-1.5 text-sm text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("select",{value:n,onChange:e=>{U(Number(e.target.value)),l(1)},className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1.5 text-xs text-gray-700 dark:text-gray-300",children:I.map(e=>r.jsx("option",{value:e,children:e},e))}),m&&u&&r.jsxs("button",{onClick:C,className:"flex items-center gap-1 px-2 py-1.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:border-gray-400 dark:hover:border-gray-600",children:[r.jsx(A,{size:14})," CSV"]})]}),r.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsx("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider",children:d.map(e=>r.jsxs("th",{className:`px-4 py-2.5 ${e.align==="right"?"text-right":e.align==="center"?"text-center":"text-left"} ${e.sortValue?"cursor-pointer hover:text-gray-800 dark:hover:text-gray-200":""}`,style:e.width?{width:e.width}:void 0,onClick:()=>e.sortValue&&z(e.key),children:[e.label,i===e.key&&(b==="asc"?r.jsx(K,{size:12,className:"inline ml-0.5"}):r.jsx(O,{size:12,className:"inline ml-0.5"}))]},e.key))})}),r.jsx("tbody",{children:v.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:d.length,className:"px-4 py-8 text-center text-gray-500",children:V})}):v.map(e=>r.jsx("tr",{className:`border-b border-gray-200/50 dark:border-gray-800/50 ${x?"hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer":""}`,onClick:()=>x==null?void 0:x(e),children:d.map(t=>r.jsx("td",{className:`px-4 py-2.5 ${t.align==="right"?"text-right":t.align==="center"?"text-center":"text-left"}`,children:t.render(e)},t.key))},w(e)))})]})})}),h>1&&r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-400",children:[r.jsxs("span",{children:[(s-1)*n+1,"-",Math.min(s*n,c.length)," of ",c.length]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>l(e=>Math.max(1,e-1)),disabled:s<=1,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50",children:"Prev"}),r.jsxs("span",{children:[s,"/",h]}),r.jsx("button",{onClick:()=>l(e=>Math.min(h,e+1)),disabled:s>=h,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50",children:"Next"})]})]})]})}export{H as D}; +import{r as o,j as r}from"./react-vendor-B7v2HPaI.js";import{b as $}from"./index-0LeeVNek.js";import{I as A}from"./ProjectDashboard-CixMPUyA.js";import{I as K,a as O}from"./IconArrowUp-CqAnfuIE.js";function H({columns:d,data:f,keyFn:w,searchable:S,searchPlaceholder:D,searchFn:p,onRowClick:x,perPageOptions:I=[25,50,100],defaultPerPage:P=25,exportFilename:u,exportFn:m,emptyMessage:V="No data"}){const[y,L]=o.useState(""),[i,M]=o.useState(null),[b,j]=o.useState("desc"),[s,l]=o.useState(1),[n,U]=o.useState(P),c=o.useMemo(()=>{let e=f;if(y&&p){const t=y.toLowerCase();e=e.filter(a=>p(a,t))}if(i){const t=d.find(a=>a.key===i);if(t!=null&&t.sortValue){const a=t.sortValue;e=[...e].sort((g,E)=>{const k=a(g),N=a(E);return kN?b==="asc"?1:-1:0})}}return e},[f,y,p,i,b,d]),h=Math.ceil(c.length/n),v=c.slice((s-1)*n,s*n),z=e=>{const t=d.find(a=>a.key===e);t!=null&&t.sortValue&&(i===e?j(a=>a==="asc"?"desc":"asc"):(M(e),j("desc")),l(1))},C=()=>{if(!m||!u)return;const e=m(c),t=new Blob([e],{type:"text/csv"}),a=URL.createObjectURL(t),g=document.createElement("a");g.href=a,g.download=u,g.click(),URL.revokeObjectURL(a)};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[S&&r.jsxs("div",{className:"relative flex-1 max-w-xs",children:[r.jsx($,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),r.jsx("input",{type:"text",value:y,onChange:e=>{L(e.target.value),l(1)},placeholder:D??"Search...",className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded pl-8 pr-3 py-1.5 text-sm text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("select",{value:n,onChange:e=>{U(Number(e.target.value)),l(1)},className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1.5 text-xs text-gray-700 dark:text-gray-300",children:I.map(e=>r.jsx("option",{value:e,children:e},e))}),m&&u&&r.jsxs("button",{onClick:C,className:"flex items-center gap-1 px-2 py-1.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:border-gray-400 dark:hover:border-gray-600",children:[r.jsx(A,{size:14})," CSV"]})]}),r.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsx("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider",children:d.map(e=>r.jsxs("th",{className:`px-4 py-2.5 ${e.align==="right"?"text-right":e.align==="center"?"text-center":"text-left"} ${e.sortValue?"cursor-pointer hover:text-gray-800 dark:hover:text-gray-200":""}`,style:e.width?{width:e.width}:void 0,onClick:()=>e.sortValue&&z(e.key),children:[e.label,i===e.key&&(b==="asc"?r.jsx(K,{size:12,className:"inline ml-0.5"}):r.jsx(O,{size:12,className:"inline ml-0.5"}))]},e.key))})}),r.jsx("tbody",{children:v.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:d.length,className:"px-4 py-8 text-center text-gray-500",children:V})}):v.map(e=>r.jsx("tr",{className:`border-b border-gray-200/50 dark:border-gray-800/50 ${x?"hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer":""}`,onClick:()=>x==null?void 0:x(e),children:d.map(t=>r.jsx("td",{className:`px-4 py-2.5 ${t.align==="right"?"text-right":t.align==="center"?"text-center":"text-left"}`,children:t.render(e)},t.key))},w(e)))})]})})}),h>1&&r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-400",children:[r.jsxs("span",{children:[(s-1)*n+1,"-",Math.min(s*n,c.length)," of ",c.length]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>l(e=>Math.max(1,e-1)),disabled:s<=1,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50",children:"Prev"}),r.jsxs("span",{children:[s,"/",h]}),r.jsx("button",{onClick:()=>l(e=>Math.min(h,e+1)),disabled:s>=h,className:"px-2 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 disabled:opacity-50",children:"Next"})]})]})]})}export{H as D}; diff --git a/stackunderflow/static/react/assets/DevicesTab-BjyuCuvS.js b/stackunderflow/static/react/assets/DevicesTab-BjyuCuvS.js new file mode 100644 index 0000000..2eaf80c --- /dev/null +++ b/stackunderflow/static/react/assets/DevicesTab-BjyuCuvS.js @@ -0,0 +1 @@ +import{u as h,r as d,j as e}from"./react-vendor-B7v2HPaI.js";import{b as g,a as b,c as l}from"./format-Co_unrac.js";import{L as j,B as k,p as T,I as $,u as L,M as I}from"./index-0LeeVNek.js";import{E as v}from"./EmptyState-o0gibvhZ.js";import{u as M,C as z,a as A,E}from"./chartTheme-GpkpBpop.js";import{h as f,b as F}from"./dashboardTabs-BuoED77E.js";import{I as w}from"./IconUsers-BhXPWMUX.js";import{I as P}from"./IconDatabase-50ZWmnTz.js";import{R,B,C as D,X as U,Y as q,T as K,b as O}from"./recharts-C8DDeE7E.js";const N="/api";async function _(s,a){const r=await fetch(s,a);if(!r.ok){const i=await r.text().catch(()=>"");throw new Error(`${r.status} ${r.statusText}${i?`: ${i}`:""}`)}return r.json()}async function H(){return _(`${N}/sync/status`)}async function Q(s="this-device"){const a=new URLSearchParams({scope:s});return _(`${N}/sync/overview?${a.toString()}`)}function G(s,a=10){return s.length>a?`${s.slice(0,a)}…`:s}function C(s){return s?s.replace("T"," ").slice(0,16):"—"}function X(s){return(s.display_name??"").trim()||s.slug}const Y=[4,4,0,0];function p({icon:s,title:a,value:r,sub:i,color:o}){return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:o,children:s}),e.jsx("span",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:a})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 tabular-nums",children:r}),i&&e.jsx("div",{className:"text-xs text-gray-500 mt-1 tabular-nums",children:i})]})}function J({scope:s,onChange:a}){const r="px-3 py-1.5 text-xs font-medium transition-colors focus:outline-none focus:z-10",i="bg-indigo-500 text-white",o="bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800";return e.jsxs("div",{className:"inline-flex rounded-md border border-gray-300 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Analytics scope",children:[e.jsx("button",{type:"button",onClick:()=>a("this-device"),"aria-pressed":s==="this-device",className:`${r} ${s==="this-device"?i:o} border-r border-gray-300 dark:border-gray-700`,children:"This device"}),e.jsx("button",{type:"button",onClick:()=>a("all-devices"),"aria-pressed":s==="all-devices",className:`${r} ${s==="all-devices"?i:o}`,children:"All devices"})]})}function V({merged:s,status:a}){const{currency:r}=L(),i=M(),o=d.useMemo(()=>t=>g(t,r),[r]),m=d.useMemo(()=>(t,n)=>[g(t,r),"Cost"],[r]),u=s.totals.input_tokens+s.totals.output_tokens,y=s.totals.cache_read+s.totals.cache_create,c=d.useMemo(()=>[...s.by_project].sort((t,n)=>n.total_cost_usd-t.total_cost_usd).slice(0,25),[s.by_project]),x=d.useMemo(()=>{const t=new Map;for(const n of a.peers)t.set(n.remote_device_uuid,n);return t},[a.peers]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(p,{icon:e.jsx(F,{size:16}),title:"Merged spend",value:g(s.totals.cost_usd,r),sub:"across every device",color:"text-purple-500"}),e.jsx(p,{icon:e.jsx(P,{size:16}),title:"Tokens",value:b(u),sub:`${b(y)} cached`,color:"text-indigo-500"}),e.jsx(p,{icon:e.jsx(I,{size:16}),title:"Sessions",value:l(s.totals.session_count),sub:`${l(s.totals.message_count)} messages`,color:"text-emerald-500"}),e.jsx(p,{icon:e.jsx(w,{size:16}),title:"Devices",value:l(s.devices.length),sub:`${a.peer_count} known peer${a.peer_count===1?"":"s"}`,color:"text-blue-500"})]}),s.by_day.length>0?e.jsx(z,{title:"Merged daily cost",children:e.jsx(R,{width:"100%",height:A,children:e.jsxs(B,{data:s.by_day,children:[e.jsx(D,{strokeDasharray:"3 3",stroke:i.grid}),e.jsx(U,{dataKey:"day",tick:i.tick,tickLine:i.axisLine,axisLine:i.axisLine}),e.jsx(q,{tick:i.tick,tickLine:i.axisLine,axisLine:i.axisLine,tickFormatter:o}),e.jsx(K,{contentStyle:i.tooltipContent,labelStyle:i.tooltipLabel,formatter:m}),e.jsx(O,{dataKey:"cost_usd",fill:"#818CF8",radius:Y,isAnimationActive:!1})]})})}):e.jsx(E,{title:"Merged daily cost",message:"No daily data yet"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"By project (all devices)"}),c.length===0?e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 px-1",children:"No projects merged yet."}):e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Project"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Provider"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Sessions"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Messages"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs text-gray-800 dark:text-gray-200 max-w-[20rem]",children:e.jsx("span",{title:t.slug,className:"block truncate",children:X(t)})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap",children:t.provider}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:l(t.total_sessions)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:l(t.total_messages)}),e.jsx("td",{className:"px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-medium text-right tabular-nums whitespace-nowrap",children:g(t.total_cost_usd,r)})]},`${t.provider}/${t.slug}`))})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"Contributing devices"}),e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Device"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Last seen"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Projects"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:s.devices.map(t=>{const n=t.is_local?void 0:x.get(t.device_uuid),S=t.is_local?"This device":t.alias??(n==null?void 0:n.alias)??G(t.device_uuid);return e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs text-gray-800 dark:text-gray-200 whitespace-nowrap",children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[S,t.is_local&&e.jsx(k,{color:"blue",size:"sm",children:"local"})]})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400 tabular-nums whitespace-nowrap",children:t.is_local?"—":C(n==null?void 0:n.last_seen)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:l(t.projects)}),e.jsx("td",{className:"px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-medium text-right tabular-nums whitespace-nowrap",children:g(t.cost_usd,r)})]},t.device_uuid)})})]})}),a.peer_count===0&&e.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 px-1",children:["No peers pulled yet — run ",e.jsx("code",{className:"font-mono",children:"stackunderflow sync pull"})," on this device after another machine has pushed."]})]})]})}function ce({projectName:s}){const a=h({queryKey:["syncStatus",s],queryFn:H,staleTime:3e4}),r=a.data,[i,o]=d.useState("this-device"),[m,u]=d.useState(!1);d.useEffect(()=>{!m&&(r!=null&&r.all_devices_available)&&o("all-devices")},[m,r==null?void 0:r.all_devices_available]);const y=n=>{u(!0),o(n)},c=h({queryKey:["syncOverview",s,i],queryFn:()=>Q(i),enabled:(r==null?void 0:r.enabled)===!0&&i==="all-devices",staleTime:3e4}),x=c.data,t=x&&x.merged?x:null;return a.isLoading?e.jsx(j,{message:"Checking sync status..."}):a.error||!r?e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load sync status:"," ",a.error instanceof Error?a.error.message:"Unknown error"]}):r.enabled?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Devices"}),e.jsx("span",{className:"text-xs text-gray-500",children:"merged analytics across your machines"}),t&&t.merge_warnings>0&&e.jsx("span",{title:`${t.merge_warnings} duplicate session${t.merge_warnings===1?"":"s"} seen on more than one device were counted once (local-then-lowest-device tiebreak).`,children:e.jsxs(k,{color:"yellow",size:"sm",children:[e.jsx(T,{size:11,className:"mr-1"}),t.merge_warnings," merge warning",t.merge_warnings===1?"":"s"]})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[((t==null?void 0:t.generated_at)||r.scanned_at)&&e.jsx("span",{className:"text-[11px] text-gray-400 dark:text-gray-500 tabular-nums whitespace-nowrap",children:C((t==null?void 0:t.generated_at)??r.scanned_at)}),e.jsxs("button",{type:"button",onClick:()=>{a.refetch(),i==="all-devices"&&c.refetch()},disabled:a.isFetching||c.isFetching,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 disabled:opacity-50",children:[e.jsx($,{size:12,className:a.isFetching||c.isFetching?"animate-spin":""}),"Refresh"]}),e.jsx(J,{scope:i,onChange:y})]})]}),i==="this-device"?e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50/60 dark:bg-gray-800/20 p-4 text-sm text-gray-600 dark:text-gray-300 space-y-1",children:[e.jsx("p",{className:"font-medium text-gray-700 dark:text-gray-200",children:"Showing this device only."}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Per-device analytics live in the Overview and Cost tabs. Switch to"," ",e.jsx("span",{className:"font-medium",children:"All devices"})," to merge"," ",r.peer_count>0?`${r.peer_count} peer${r.peer_count===1?"":"s"}`:"other machines"," ","into one cross-device view.",!r.all_devices_available&&" No peer data has been pulled yet — run `stackunderflow sync pull` first."]})]}):c.isLoading?e.jsx(j,{message:"Merging devices..."}):c.error?e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to merge devices:"," ",c.error instanceof Error?c.error.message:"Unknown error"]}):t?e.jsx(V,{merged:t,status:r}):e.jsx(v,{icon:e.jsx(w,{size:28}),title:"No merged data",description:"Sync is configured but nothing has been merged yet. Push from another device, then run stackunderflow sync pull here."})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(v,{icon:e.jsx(f,{size:28}),title:"Multi-device sync isn't set up",description:"Sync merges your coding analytics across machines — end-to-end encrypted, opt-in, and read-only on pull. Set it up on this device to unlock the all-devices view."}),e.jsx("div",{className:"flex justify-center",children:e.jsx("code",{className:"font-mono text-xs bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 rounded px-2.5 py-1.5 border border-gray-200 dark:border-gray-700",children:"stackunderflow sync init"})})]})}export{ce as default}; diff --git a/stackunderflow/static/react/assets/EstimatedCostMarker-BpsBXEjf.js b/stackunderflow/static/react/assets/EstimatedCostMarker-DsipcjDe.js similarity index 90% rename from stackunderflow/static/react/assets/EstimatedCostMarker-BpsBXEjf.js rename to stackunderflow/static/react/assets/EstimatedCostMarker-DsipcjDe.js index fbe321c..ed003b9 100644 --- a/stackunderflow/static/react/assets/EstimatedCostMarker-BpsBXEjf.js +++ b/stackunderflow/static/react/assets/EstimatedCostMarker-DsipcjDe.js @@ -1,4 +1,4 @@ -import{h as r}from"./index-DQluCO2S.js";import{j as o}from"./react-vendor-B7v2HPaI.js";/** +import{h as r}from"./index-0LeeVNek.js";import{j as o}from"./react-vendor-B7v2HPaI.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/FilterBar-BS6lhcC1.js b/stackunderflow/static/react/assets/FilterBar-CML9sBEu.js similarity index 98% rename from stackunderflow/static/react/assets/FilterBar-BS6lhcC1.js rename to stackunderflow/static/react/assets/FilterBar-CML9sBEu.js index 301a857..97af731 100644 --- a/stackunderflow/static/react/assets/FilterBar-BS6lhcC1.js +++ b/stackunderflow/static/react/assets/FilterBar-CML9sBEu.js @@ -1,4 +1,4 @@ -import{u as $,r as M,j as r}from"./react-vendor-B7v2HPaI.js";import{h as v,a as F,m as h,n as P,B,o as I}from"./index-DQluCO2S.js";import{f as b}from"./format-Co_unrac.js";/** +import{u as $,r as M,j as r}from"./react-vendor-B7v2HPaI.js";import{h as v,a as F,m as h,n as P,B,o as I}from"./index-0LeeVNek.js";import{f as b}from"./format-Co_unrac.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/ForksTab-ryk22jFG.js b/stackunderflow/static/react/assets/ForksTab-BBQyDQc2.js similarity index 95% rename from stackunderflow/static/react/assets/ForksTab-ryk22jFG.js rename to stackunderflow/static/react/assets/ForksTab-BBQyDQc2.js index 9985a50..d7881b5 100644 --- a/stackunderflow/static/react/assets/ForksTab-ryk22jFG.js +++ b/stackunderflow/static/react/assets/ForksTab-BBQyDQc2.js @@ -1 +1 @@ -import{r as y,u as b,j as e}from"./react-vendor-B7v2HPaI.js";import{u as f,L as j,z as k,p as w,B as p,an as N}from"./index-DQluCO2S.js";import{E as _}from"./EmptyState-o0gibvhZ.js";import{b as c,a as u}from"./format-Co_unrac.js";import{n as g,m as v}from"./dashboardTabs-C5ecR5YO.js";import{I as m}from"./IconRobot-DuCKb11z.js";const $=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function h(t){return Number.isFinite(t)?`${(t*100).toFixed(1)}%`:"0%"}function F(t){return t===null||!Number.isFinite(t)?"—":t>=86400?`${(t/86400).toFixed(1)}d`:t>=3600?`${(t/3600).toFixed(1)}h`:t>=60?`${Math.round(t/60)}m`:`${Math.round(t)}s`}function x({icon:t,title:s,value:d,sub:o,color:a}){return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:a,children:t}),e.jsx("span",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:s})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 tabular-nums",children:d}),o&&e.jsx("div",{className:"text-xs text-gray-500 mt-1 tabular-nums",children:o})]})}function S({warning:t}){return e.jsxs("div",{className:"flex items-start gap-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md p-3 text-yellow-800 dark:text-yellow-300 text-xs",children:[e.jsx(w,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsx("span",{children:t})]})}function z({branch:t,currency:s}){return e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.session_id.slice(0,8)}),e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-600 dark:text-gray-400 whitespace-nowrap",children:t.branch_head_uuid.slice(0,8)}),e.jsx("td",{className:"px-3 py-2",children:t.sidechain?e.jsx(p,{color:"purple",size:"sm",children:"sidechain"}):e.jsx(p,{color:"gray",size:"sm",children:"branch"})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:t.message_count}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:u(t.token_total)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:F(t.gap_seconds)}),e.jsx("td",{className:"px-3 py-2 text-sm tabular-nums text-gray-900 dark:text-gray-100 font-medium text-right whitespace-nowrap",children:c(t.cost_usd,s)})]})}function A({projectName:t}){const{currency:s}=f(),[d,o]=y.useState("all"),{data:a,isLoading:l,error:i}=b({queryKey:["forks",t,d],queryFn:()=>N(d),staleTime:6e4}),r=a==null?void 0:a.report;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Forks & Sidechains"}),e.jsx("span",{className:"text-xs text-gray-500",children:"subagent spend + branches you started then dropped"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Forks period",children:$.map(n=>e.jsx("button",{type:"button",onClick:()=>o(n.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${n.id===d?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:n.label},n.id))})]}),(a==null?void 0:a.warning)&&e.jsx(S,{warning:a.warning}),l&&e.jsx(j,{message:"Analyzing forks..."}),i&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load forks: ",i instanceof Error?i.message:"Unknown error"]}),!l&&!i&&r&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(x,{icon:e.jsx(m,{size:16}),title:"Sidechain cost",value:c(r.sidechain_cost_usd,s),sub:`${h(r.sidechain_cost_share)} of ${c(r.total_cost_usd,s)} · ${r.sidechain_message_count.toLocaleString()} msgs`,color:"text-purple-500"}),e.jsx(x,{icon:e.jsx(m,{size:16}),title:"Sidechain tokens",value:u(r.sidechain_token_total),sub:`${h(r.sidechain_token_share)} of all tokens`,color:"text-purple-500"}),e.jsx(x,{icon:e.jsx(v,{size:16}),title:"Fork points",value:r.fork_point_count.toLocaleString(),sub:"conversation branched here",color:"text-blue-500"}),e.jsx(x,{icon:e.jsx(k,{size:16}),title:"Abandoned spend",value:c(r.abandoned_cost_usd,s),sub:`${r.abandoned_branch_count.toLocaleString()} dropped ${r.abandoned_branch_count===1?"branch":"branches"}`,color:"text-yellow-500"})]}),!l&&!i&&r&&r.abandoned_branches.length===0&&e.jsx(_,{icon:e.jsx(g,{size:28}),title:"No abandoned branches in window",description:"Nothing was branched and dropped in this period — or the sunk cost was below the noise floor. Try a wider period."}),!l&&!i&&r&&r.abandoned_branches.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"Top abandoned branches"}),e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Session"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Branch"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Kind"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Msgs"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Tokens"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Dropped before end"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:r.abandoned_branches.map(n=>e.jsx(z,{branch:n,currency:s},`${n.session_id}:${n.branch_head_uuid}`))})]})})]})]})}export{A as default}; +import{r as y,u as b,j as e}from"./react-vendor-B7v2HPaI.js";import{u as f,L as j,z as k,p as w,B as p,an as N}from"./index-0LeeVNek.js";import{E as _}from"./EmptyState-o0gibvhZ.js";import{b as c,a as u}from"./format-Co_unrac.js";import{o as g,n as v}from"./dashboardTabs-BuoED77E.js";import{I as m}from"./IconRobot-DArBIG_E.js";const $=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}];function h(t){return Number.isFinite(t)?`${(t*100).toFixed(1)}%`:"0%"}function F(t){return t===null||!Number.isFinite(t)?"—":t>=86400?`${(t/86400).toFixed(1)}d`:t>=3600?`${(t/3600).toFixed(1)}h`:t>=60?`${Math.round(t/60)}m`:`${Math.round(t)}s`}function x({icon:t,title:s,value:d,sub:o,color:a}){return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:a,children:t}),e.jsx("span",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:s})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 tabular-nums",children:d}),o&&e.jsx("div",{className:"text-xs text-gray-500 mt-1 tabular-nums",children:o})]})}function S({warning:t}){return e.jsxs("div",{className:"flex items-start gap-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md p-3 text-yellow-800 dark:text-yellow-300 text-xs",children:[e.jsx(w,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsx("span",{children:t})]})}function z({branch:t,currency:s}){return e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.session_id.slice(0,8)}),e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-600 dark:text-gray-400 whitespace-nowrap",children:t.branch_head_uuid.slice(0,8)}),e.jsx("td",{className:"px-3 py-2",children:t.sidechain?e.jsx(p,{color:"purple",size:"sm",children:"sidechain"}):e.jsx(p,{color:"gray",size:"sm",children:"branch"})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:t.message_count}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:u(t.token_total)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:F(t.gap_seconds)}),e.jsx("td",{className:"px-3 py-2 text-sm tabular-nums text-gray-900 dark:text-gray-100 font-medium text-right whitespace-nowrap",children:c(t.cost_usd,s)})]})}function A({projectName:t}){const{currency:s}=f(),[d,o]=y.useState("all"),{data:a,isLoading:l,error:i}=b({queryKey:["forks",t,d],queryFn:()=>N(d),staleTime:6e4}),r=a==null?void 0:a.report;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Forks & Sidechains"}),e.jsx("span",{className:"text-xs text-gray-500",children:"subagent spend + branches you started then dropped"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Forks period",children:$.map(n=>e.jsx("button",{type:"button",onClick:()=>o(n.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${n.id===d?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:n.label},n.id))})]}),(a==null?void 0:a.warning)&&e.jsx(S,{warning:a.warning}),l&&e.jsx(j,{message:"Analyzing forks..."}),i&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load forks: ",i instanceof Error?i.message:"Unknown error"]}),!l&&!i&&r&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(x,{icon:e.jsx(m,{size:16}),title:"Sidechain cost",value:c(r.sidechain_cost_usd,s),sub:`${h(r.sidechain_cost_share)} of ${c(r.total_cost_usd,s)} · ${r.sidechain_message_count.toLocaleString()} msgs`,color:"text-purple-500"}),e.jsx(x,{icon:e.jsx(m,{size:16}),title:"Sidechain tokens",value:u(r.sidechain_token_total),sub:`${h(r.sidechain_token_share)} of all tokens`,color:"text-purple-500"}),e.jsx(x,{icon:e.jsx(v,{size:16}),title:"Fork points",value:r.fork_point_count.toLocaleString(),sub:"conversation branched here",color:"text-blue-500"}),e.jsx(x,{icon:e.jsx(k,{size:16}),title:"Abandoned spend",value:c(r.abandoned_cost_usd,s),sub:`${r.abandoned_branch_count.toLocaleString()} dropped ${r.abandoned_branch_count===1?"branch":"branches"}`,color:"text-yellow-500"})]}),!l&&!i&&r&&r.abandoned_branches.length===0&&e.jsx(_,{icon:e.jsx(g,{size:28}),title:"No abandoned branches in window",description:"Nothing was branched and dropped in this period — or the sunk cost was below the noise floor. Try a wider period."}),!l&&!i&&r&&r.abandoned_branches.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:"Top abandoned branches"}),e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Session"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Branch"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Kind"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Msgs"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Tokens"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Dropped before end"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:r.abandoned_branches.map(n=>e.jsx(z,{branch:n,currency:s},`${n.session_id}:${n.branch_head_uuid}`))})]})})]})]})}export{A as default}; diff --git a/stackunderflow/static/react/assets/IconActivity-Bf5MQINx.js b/stackunderflow/static/react/assets/IconActivity-CtliCKZa.js similarity index 86% rename from stackunderflow/static/react/assets/IconActivity-Bf5MQINx.js rename to stackunderflow/static/react/assets/IconActivity-CtliCKZa.js index 48b7ed1..3b1d7c2 100644 --- a/stackunderflow/static/react/assets/IconActivity-Bf5MQINx.js +++ b/stackunderflow/static/react/assets/IconActivity-CtliCKZa.js @@ -1,4 +1,4 @@ -import{h as t}from"./index-DQluCO2S.js";/** +import{h as t}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconAlertCircle-h2zR9MWj.js b/stackunderflow/static/react/assets/IconAlertCircle-DmtLevj2.js similarity index 89% rename from stackunderflow/static/react/assets/IconAlertCircle-h2zR9MWj.js rename to stackunderflow/static/react/assets/IconAlertCircle-DmtLevj2.js index 3546d5d..caf4e62 100644 --- a/stackunderflow/static/react/assets/IconAlertCircle-h2zR9MWj.js +++ b/stackunderflow/static/react/assets/IconAlertCircle-DmtLevj2.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconArrowRight-lOOgkPXu.js b/stackunderflow/static/react/assets/IconArrowRight-CEBy4AKU.js similarity index 89% rename from stackunderflow/static/react/assets/IconArrowRight-lOOgkPXu.js rename to stackunderflow/static/react/assets/IconArrowRight-CEBy4AKU.js index d4e5f5b..14788d6 100644 --- a/stackunderflow/static/react/assets/IconArrowRight-lOOgkPXu.js +++ b/stackunderflow/static/react/assets/IconArrowRight-CEBy4AKU.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconArrowUp-D8NJ3QQF.js b/stackunderflow/static/react/assets/IconArrowUp-CqAnfuIE.js similarity index 94% rename from stackunderflow/static/react/assets/IconArrowUp-D8NJ3QQF.js rename to stackunderflow/static/react/assets/IconArrowUp-CqAnfuIE.js index dd700cc..b7013e7 100644 --- a/stackunderflow/static/react/assets/IconArrowUp-D8NJ3QQF.js +++ b/stackunderflow/static/react/assets/IconArrowUp-CqAnfuIE.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconBolt-CWu2Wz0a.js b/stackunderflow/static/react/assets/IconBolt-DgchZkn1.js similarity index 86% rename from stackunderflow/static/react/assets/IconBolt-CWu2Wz0a.js rename to stackunderflow/static/react/assets/IconBolt-DgchZkn1.js index d96faf9..b2a8985 100644 --- a/stackunderflow/static/react/assets/IconBolt-CWu2Wz0a.js +++ b/stackunderflow/static/react/assets/IconBolt-DgchZkn1.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconCheck-BQLu3HFV.js b/stackunderflow/static/react/assets/IconCheck-D_dgJKrH.js similarity index 86% rename from stackunderflow/static/react/assets/IconCheck-BQLu3HFV.js rename to stackunderflow/static/react/assets/IconCheck-D_dgJKrH.js index 3aa2499..f9d1b33 100644 --- a/stackunderflow/static/react/assets/IconCheck-BQLu3HFV.js +++ b/stackunderflow/static/react/assets/IconCheck-D_dgJKrH.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconCircleX-D7ABaoUn.js b/stackunderflow/static/react/assets/IconCircleX-CZ-PNBqE.js similarity index 88% rename from stackunderflow/static/react/assets/IconCircleX-D7ABaoUn.js rename to stackunderflow/static/react/assets/IconCircleX-CZ-PNBqE.js index 7a4316f..baae36f 100644 --- a/stackunderflow/static/react/assets/IconCircleX-D7ABaoUn.js +++ b/stackunderflow/static/react/assets/IconCircleX-CZ-PNBqE.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconClock-CgB7iTL4.js b/stackunderflow/static/react/assets/IconClock-BfNEbW3j.js similarity index 88% rename from stackunderflow/static/react/assets/IconClock-CgB7iTL4.js rename to stackunderflow/static/react/assets/IconClock-BfNEbW3j.js index 05f5e65..fbaca8f 100644 --- a/stackunderflow/static/react/assets/IconClock-CgB7iTL4.js +++ b/stackunderflow/static/react/assets/IconClock-BfNEbW3j.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconClockHour4-BUN27e3Z.js b/stackunderflow/static/react/assets/IconClockHour4-B94dRT7a.js similarity index 89% rename from stackunderflow/static/react/assets/IconClockHour4-BUN27e3Z.js rename to stackunderflow/static/react/assets/IconClockHour4-B94dRT7a.js index f4d7367..ed75931 100644 --- a/stackunderflow/static/react/assets/IconClockHour4-BUN27e3Z.js +++ b/stackunderflow/static/react/assets/IconClockHour4-B94dRT7a.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconCode-nzK0btv1.js b/stackunderflow/static/react/assets/IconCode-DFtqsCTV.js similarity index 88% rename from stackunderflow/static/react/assets/IconCode-nzK0btv1.js rename to stackunderflow/static/react/assets/IconCode-DFtqsCTV.js index 35c3536..c096406 100644 --- a/stackunderflow/static/react/assets/IconCode-nzK0btv1.js +++ b/stackunderflow/static/react/assets/IconCode-DFtqsCTV.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconCopy-BOYWZx4M.js b/stackunderflow/static/react/assets/IconCopy-Cl6jyttT.js similarity index 92% rename from stackunderflow/static/react/assets/IconCopy-BOYWZx4M.js rename to stackunderflow/static/react/assets/IconCopy-Cl6jyttT.js index fadf25c..cf472b0 100644 --- a/stackunderflow/static/react/assets/IconCopy-BOYWZx4M.js +++ b/stackunderflow/static/react/assets/IconCopy-Cl6jyttT.js @@ -1,4 +1,4 @@ -import{h as o}from"./index-DQluCO2S.js";/** +import{h as o}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconDatabase-50ZWmnTz.js b/stackunderflow/static/react/assets/IconDatabase-50ZWmnTz.js new file mode 100644 index 0000000..fb30b1f --- /dev/null +++ b/stackunderflow/static/react/assets/IconDatabase-50ZWmnTz.js @@ -0,0 +1,6 @@ +import{h as a}from"./index-0LeeVNek.js";/** + * @license @tabler/icons-react v3.36.1 - MIT + * + * This source code is licensed under the MIT license. + * See the LICENSE file in the root directory of this source tree. + */const t=[["path",{d:"M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]],o=a("outline","database","Database",t);export{o as I}; diff --git a/stackunderflow/static/react/assets/IconFileText-ChD_eRqq.js b/stackunderflow/static/react/assets/IconFileText-BfJ2drOF.js similarity index 91% rename from stackunderflow/static/react/assets/IconFileText-ChD_eRqq.js rename to stackunderflow/static/react/assets/IconFileText-BfJ2drOF.js index 6c61a93..aa056be 100644 --- a/stackunderflow/static/react/assets/IconFileText-ChD_eRqq.js +++ b/stackunderflow/static/react/assets/IconFileText-BfJ2drOF.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconHash-cdeuBxnj.js b/stackunderflow/static/react/assets/IconHash-Cw_3c3J-.js similarity index 89% rename from stackunderflow/static/react/assets/IconHash-cdeuBxnj.js rename to stackunderflow/static/react/assets/IconHash-Cw_3c3J-.js index a43146d..cf5ff10 100644 --- a/stackunderflow/static/react/assets/IconHash-cdeuBxnj.js +++ b/stackunderflow/static/react/assets/IconHash-Cw_3c3J-.js @@ -1,4 +1,4 @@ -import{h as t}from"./index-DQluCO2S.js";/** +import{h as t}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-DA8tH9T1.js b/stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-Ca9nBmoF.js similarity index 95% rename from stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-DA8tH9T1.js rename to stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-Ca9nBmoF.js index d455075..3e55200 100644 --- a/stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-DA8tH9T1.js +++ b/stackunderflow/static/react/assets/IconPlayerSkipForwardFilled-Ca9nBmoF.js @@ -1,4 +1,4 @@ -import{h as a}from"./index-DQluCO2S.js";/** +import{h as a}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconRobot-DuCKb11z.js b/stackunderflow/static/react/assets/IconRobot-DArBIG_E.js similarity index 93% rename from stackunderflow/static/react/assets/IconRobot-DuCKb11z.js rename to stackunderflow/static/react/assets/IconRobot-DArBIG_E.js index 9da9179..08c82f0 100644 --- a/stackunderflow/static/react/assets/IconRobot-DuCKb11z.js +++ b/stackunderflow/static/react/assets/IconRobot-DArBIG_E.js @@ -1,4 +1,4 @@ -import{h as t}from"./index-DQluCO2S.js";/** +import{h as t}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconSortDescending-DunfClYo.js b/stackunderflow/static/react/assets/IconSortDescending-szhiy27L.js similarity index 90% rename from stackunderflow/static/react/assets/IconSortDescending-DunfClYo.js rename to stackunderflow/static/react/assets/IconSortDescending-szhiy27L.js index 5b788d4..166e67b 100644 --- a/stackunderflow/static/react/assets/IconSortDescending-DunfClYo.js +++ b/stackunderflow/static/react/assets/IconSortDescending-szhiy27L.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconTrendingUp-D1iuYAG9.js b/stackunderflow/static/react/assets/IconTrendingUp-CcTO0Xpf.js similarity index 88% rename from stackunderflow/static/react/assets/IconTrendingUp-D1iuYAG9.js rename to stackunderflow/static/react/assets/IconTrendingUp-CcTO0Xpf.js index 9d21fde..c5c3960 100644 --- a/stackunderflow/static/react/assets/IconTrendingUp-D1iuYAG9.js +++ b/stackunderflow/static/react/assets/IconTrendingUp-CcTO0Xpf.js @@ -1,4 +1,4 @@ -import{h as n}from"./index-DQluCO2S.js";/** +import{h as n}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconUser-IjRNaThB.js b/stackunderflow/static/react/assets/IconUser-YF3ooIRT.js similarity index 94% rename from stackunderflow/static/react/assets/IconUser-IjRNaThB.js rename to stackunderflow/static/react/assets/IconUser-YF3ooIRT.js index 79f2813..9312d0a 100644 --- a/stackunderflow/static/react/assets/IconUser-IjRNaThB.js +++ b/stackunderflow/static/react/assets/IconUser-YF3ooIRT.js @@ -1,4 +1,4 @@ -import{h as e}from"./index-DQluCO2S.js";/** +import{h as e}from"./index-0LeeVNek.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/IconUsers-BhXPWMUX.js b/stackunderflow/static/react/assets/IconUsers-BhXPWMUX.js new file mode 100644 index 0000000..3ba68aa --- /dev/null +++ b/stackunderflow/static/react/assets/IconUsers-BhXPWMUX.js @@ -0,0 +1,6 @@ +import{h as a}from"./index-0LeeVNek.js";/** + * @license @tabler/icons-react v3.36.1 - MIT + * + * This source code is licensed under the MIT license. + * See the LICENSE file in the root directory of this source tree. + */const e=[["path",{d:"M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]],t=a("outline","users","Users",e);export{t as I}; diff --git a/stackunderflow/static/react/assets/Live-BX6jEGZn.js b/stackunderflow/static/react/assets/Live-TQJbKokL.js similarity index 97% rename from stackunderflow/static/react/assets/Live-BX6jEGZn.js rename to stackunderflow/static/react/assets/Live-TQJbKokL.js index 8aef493..8252b53 100644 --- a/stackunderflow/static/react/assets/Live-BX6jEGZn.js +++ b/stackunderflow/static/react/assets/Live-TQJbKokL.js @@ -1 +1 @@ -import{r as f,u as E,j as e}from"./react-vendor-B7v2HPaI.js";import{b as u,c as L}from"./format-Co_unrac.js";import{u as $,L as C,p as T}from"./index-DQluCO2S.js";import{E as S}from"./EmptyState-o0gibvhZ.js";import{I}from"./IconBolt-CWu2Wz0a.js";import{I as F}from"./IconClockHour4-BUN27e3Z.js";import{I as v}from"./IconActivity-Bf5MQINx.js";const _="/api";async function R(){const t=await fetch(`${_}/live/stats`);if(!t.ok){const a=await t.text().catch(()=>"");throw new Error(`${t.status} ${t.statusText}${a?`: ${a}`:""}`)}return t.json()}function P(t,a=`${_}/live/stream`){const o=new EventSource(a),n=(s,i,d)=>{if(!s)return;let c={};try{c=JSON.parse(i.data)}catch{return}c.payload!==void 0&&(d?s(c.payload,c.ts??""):s(c.payload))};o.addEventListener("ready",s=>n(t.onReady,s,!1)),o.addEventListener("event",s=>n(t.onEvent,s,!0)),o.addEventListener("tool_call",s=>n(t.onToolCall,s,!0)),o.addEventListener("burn_tick",s=>n(t.onBurnTick,s,!0)),t.onError&&o.addEventListener("error",t.onError);let l=!1;return{source:o,close:()=>{l||(l=!0,o.close())}}}const N=100,k={connected:!1,events:[],toolCalls:[],burn:null,watcher:null,errorCount:0};function B(t=!0){const[a,o]=f.useState(k),n=f.useRef(k);return f.useEffect(()=>{if(!t||typeof EventSource>"u")return;const l=P({onReady:s=>{o(i=>{const d={...i,connected:!0,watcher:s.watcher};return n.current=d,d})},onEvent:s=>{o(i=>{const d=[s,...i.events].slice(0,N),c={...i,events:d};return n.current=c,c})},onToolCall:s=>{o(i=>{const d=[s,...i.toolCalls].slice(0,N),c={...i,toolCalls:d};return n.current=c,c})},onBurnTick:s=>{o(i=>{const d={...i,burn:s};return n.current=d,d})},onError:()=>{o(s=>{const i={...s,errorCount:s.errorCount+1};return n.current=i,i})}});return()=>l.close()},[t]),a}function b(t){return!Number.isFinite(t)||t<0?"-":t<1?`${(t*1e3).toFixed(0)}ms`:t<60?`${t.toFixed(1)}s`:t<3600?`${(t/60).toFixed(1)}m`:`${(t/3600).toFixed(1)}h`}function z(t){const a=new Date(t);return Number.isNaN(a.getTime())?t:a.toLocaleTimeString(void 0,{hour12:!1})}function H(){var w;const{currency:t}=$(),{data:a,isLoading:o}=E({queryKey:["liveStats"],queryFn:R,refetchInterval:3e4,refetchOnWindowFocus:!0}),n=B(!0),l=n.burn??(a==null?void 0:a.burn)??null,s=(a==null?void 0:a.tool_latency)??[],d=(((w=n.watcher)==null?void 0:w.running)??(a==null?void 0:a.watcher.running)??"unknown")!==!0,c=f.useMemo(()=>{const{events:r,toolCalls:j}=n,m=[];let g=0,h=0;for(;m.length<100&&(g=x.ts))m.push({kind:"event",ts:p.ts,row:p}),g++;else if(x)m.push({kind:"tool_call",ts:x.ts,row:x}),h++;else break}return m},[n.events,n.toolCalls]);return o&&!n.connected?e.jsx(C,{message:"Loading live snapshot..."}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Live"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:["Real-time across all active sessions.",n.connected?e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"streaming"]}):e.jsx("span",{className:"ml-2 text-gray-500",children:"connecting…"})]})]})}),d&&e.jsxs("div",{role:"alert","data-testid":"watcher-down-banner",className:"flex items-start gap-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-lg p-4 text-yellow-800 dark:text-yellow-300",children:[e.jsx(T,{size:20,className:"shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Filesystem watcher is not running."}),e.jsxs("p",{children:["The live stream depends on the watcher to ingest new sessions sub-second. Restart the server without ",e.jsx("code",{className:"px-1 py-0.5 bg-yellow-100 dark:bg-yellow-900/40 rounded text-xs",children:"--no-watcher"})," to resume real-time updates. Burn rate and tool latency below reflect data already in the store."]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(y,{label:"Per minute",value:l?u(l.per_minute,t):"-",icon:e.jsx(I,{size:18}),subtle:l?`${l.window_minutes}-min rolling avg`:""}),e.jsx(y,{label:"Per hour",value:l?u(l.per_hour,t):"-",icon:e.jsx(F,{size:18}),subtle:l?`${u(l.window_cost,t)} in window`:""}),e.jsx(y,{label:"Today",value:l?u(l.today_cost,t):"-",icon:e.jsx(v,{size:18}),subtle:l?`MTD ${u(l.month_to_date,t)}`:""}),e.jsx(y,{label:"Projected month-end",value:l?u(l.projected_month_end,t):"-",icon:e.jsx(v,{size:18}),subtle:"straight-line extrapolation"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Event stream"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[c.length," of last 100"]})]}),e.jsx("div",{className:"space-y-1 overflow-y-auto max-h-[500px] font-mono text-xs","data-testid":"live-event-stream",children:c.length===0?e.jsx(S,{title:"Waiting for activity",description:d?"Watcher is not running — start it to see live events.":"Run a Claude / Codex session and events will land here in real time."}):c.map(r=>e.jsxs("div",{className:"flex items-baseline gap-3 py-1 border-b border-gray-200/50 dark:border-gray-800/50",children:[e.jsx("span",{className:"text-gray-500 tabular-nums w-20 shrink-0",children:z(r.ts)}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide shrink-0 ${r.kind==="tool_call"?"bg-indigo-500/15 text-indigo-700 dark:text-indigo-300":"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300"}`,children:r.kind==="tool_call"?r.row.tool_name:"event"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 truncate",children:r.kind==="tool_call"?e.jsxs(e.Fragment,{children:[r.row.project_name??r.row.project_slug??`project ${r.row.project_id}`,r.row.file_path?e.jsxs("span",{className:"text-gray-500",children:[" · ",r.row.file_path]}):null,r.row.byte_count!=null?e.jsxs("span",{className:"text-gray-500",children:[" · ",L(r.row.byte_count),"b"]}):null]}):e.jsxs(e.Fragment,{children:[r.row.project_name??r.row.project_slug??`project ${r.row.project_id}`,e.jsxs("span",{className:"text-gray-500",children:[" · ",r.row.model]}),e.jsxs("span",{className:"text-gray-500",children:[" · ",u(r.row.cost_usd,t)]})]})})]},`${r.kind}-${r.row.id}`))})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Tool latency (P50 / P95 / P99)"}),s.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:"No tool-call samples in the last 24h."}):e.jsx("div",{className:"space-y-2",children:s.map(r=>e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-xs","data-testid":"latency-row",children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300 truncate",children:r.tool_name}),e.jsxs("div",{className:"flex items-baseline gap-3 tabular-nums shrink-0",children:[e.jsxs("span",{className:"text-gray-500",title:`${r.samples} samples`,children:[r.samples,"n"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",title:"P50",children:b(r.p50)}),e.jsx("span",{className:"text-indigo-600 dark:text-indigo-400",title:"P95",children:b(r.p95)}),e.jsx("span",{className:"text-rose-600 dark:text-rose-400",title:"P99",children:b(r.p99)})]})]},r.tool_name))}),e.jsxs("p",{className:"mt-3 text-[10px] text-gray-500 leading-snug",children:["Latency derived from ",e.jsx("code",{children:"messages.timestamp"})," deltas between a tool_use and the next message in the same session — coarse, only as fine as the source-file write cadence."]})]})]})]})}function y({label:t,value:a,icon:o,subtle:n}){return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 uppercase tracking-wider",children:[e.jsx("span",{children:t}),e.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:o})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1 tabular-nums",children:a}),n&&e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:n})]})}export{H as default}; +import{r as f,u as E,j as e}from"./react-vendor-B7v2HPaI.js";import{b as u,c as L}from"./format-Co_unrac.js";import{u as $,L as C,p as T}from"./index-0LeeVNek.js";import{E as S}from"./EmptyState-o0gibvhZ.js";import{I}from"./IconBolt-DgchZkn1.js";import{I as F}from"./IconClockHour4-B94dRT7a.js";import{I as v}from"./IconActivity-CtliCKZa.js";const _="/api";async function R(){const t=await fetch(`${_}/live/stats`);if(!t.ok){const a=await t.text().catch(()=>"");throw new Error(`${t.status} ${t.statusText}${a?`: ${a}`:""}`)}return t.json()}function P(t,a=`${_}/live/stream`){const o=new EventSource(a),n=(s,i,d)=>{if(!s)return;let c={};try{c=JSON.parse(i.data)}catch{return}c.payload!==void 0&&(d?s(c.payload,c.ts??""):s(c.payload))};o.addEventListener("ready",s=>n(t.onReady,s,!1)),o.addEventListener("event",s=>n(t.onEvent,s,!0)),o.addEventListener("tool_call",s=>n(t.onToolCall,s,!0)),o.addEventListener("burn_tick",s=>n(t.onBurnTick,s,!0)),t.onError&&o.addEventListener("error",t.onError);let l=!1;return{source:o,close:()=>{l||(l=!0,o.close())}}}const N=100,k={connected:!1,events:[],toolCalls:[],burn:null,watcher:null,errorCount:0};function B(t=!0){const[a,o]=f.useState(k),n=f.useRef(k);return f.useEffect(()=>{if(!t||typeof EventSource>"u")return;const l=P({onReady:s=>{o(i=>{const d={...i,connected:!0,watcher:s.watcher};return n.current=d,d})},onEvent:s=>{o(i=>{const d=[s,...i.events].slice(0,N),c={...i,events:d};return n.current=c,c})},onToolCall:s=>{o(i=>{const d=[s,...i.toolCalls].slice(0,N),c={...i,toolCalls:d};return n.current=c,c})},onBurnTick:s=>{o(i=>{const d={...i,burn:s};return n.current=d,d})},onError:()=>{o(s=>{const i={...s,errorCount:s.errorCount+1};return n.current=i,i})}});return()=>l.close()},[t]),a}function b(t){return!Number.isFinite(t)||t<0?"-":t<1?`${(t*1e3).toFixed(0)}ms`:t<60?`${t.toFixed(1)}s`:t<3600?`${(t/60).toFixed(1)}m`:`${(t/3600).toFixed(1)}h`}function z(t){const a=new Date(t);return Number.isNaN(a.getTime())?t:a.toLocaleTimeString(void 0,{hour12:!1})}function H(){var w;const{currency:t}=$(),{data:a,isLoading:o}=E({queryKey:["liveStats"],queryFn:R,refetchInterval:3e4,refetchOnWindowFocus:!0}),n=B(!0),l=n.burn??(a==null?void 0:a.burn)??null,s=(a==null?void 0:a.tool_latency)??[],d=(((w=n.watcher)==null?void 0:w.running)??(a==null?void 0:a.watcher.running)??"unknown")!==!0,c=f.useMemo(()=>{const{events:r,toolCalls:j}=n,m=[];let g=0,h=0;for(;m.length<100&&(g=x.ts))m.push({kind:"event",ts:p.ts,row:p}),g++;else if(x)m.push({kind:"tool_call",ts:x.ts,row:x}),h++;else break}return m},[n.events,n.toolCalls]);return o&&!n.connected?e.jsx(C,{message:"Loading live snapshot..."}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Live"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:["Real-time across all active sessions.",n.connected?e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"streaming"]}):e.jsx("span",{className:"ml-2 text-gray-500",children:"connecting…"})]})]})}),d&&e.jsxs("div",{role:"alert","data-testid":"watcher-down-banner",className:"flex items-start gap-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-lg p-4 text-yellow-800 dark:text-yellow-300",children:[e.jsx(T,{size:20,className:"shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Filesystem watcher is not running."}),e.jsxs("p",{children:["The live stream depends on the watcher to ingest new sessions sub-second. Restart the server without ",e.jsx("code",{className:"px-1 py-0.5 bg-yellow-100 dark:bg-yellow-900/40 rounded text-xs",children:"--no-watcher"})," to resume real-time updates. Burn rate and tool latency below reflect data already in the store."]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(y,{label:"Per minute",value:l?u(l.per_minute,t):"-",icon:e.jsx(I,{size:18}),subtle:l?`${l.window_minutes}-min rolling avg`:""}),e.jsx(y,{label:"Per hour",value:l?u(l.per_hour,t):"-",icon:e.jsx(F,{size:18}),subtle:l?`${u(l.window_cost,t)} in window`:""}),e.jsx(y,{label:"Today",value:l?u(l.today_cost,t):"-",icon:e.jsx(v,{size:18}),subtle:l?`MTD ${u(l.month_to_date,t)}`:""}),e.jsx(y,{label:"Projected month-end",value:l?u(l.projected_month_end,t):"-",icon:e.jsx(v,{size:18}),subtle:"straight-line extrapolation"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Event stream"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[c.length," of last 100"]})]}),e.jsx("div",{className:"space-y-1 overflow-y-auto max-h-[500px] font-mono text-xs","data-testid":"live-event-stream",children:c.length===0?e.jsx(S,{title:"Waiting for activity",description:d?"Watcher is not running — start it to see live events.":"Run a Claude / Codex session and events will land here in real time."}):c.map(r=>e.jsxs("div",{className:"flex items-baseline gap-3 py-1 border-b border-gray-200/50 dark:border-gray-800/50",children:[e.jsx("span",{className:"text-gray-500 tabular-nums w-20 shrink-0",children:z(r.ts)}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide shrink-0 ${r.kind==="tool_call"?"bg-indigo-500/15 text-indigo-700 dark:text-indigo-300":"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300"}`,children:r.kind==="tool_call"?r.row.tool_name:"event"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 truncate",children:r.kind==="tool_call"?e.jsxs(e.Fragment,{children:[r.row.project_name??r.row.project_slug??`project ${r.row.project_id}`,r.row.file_path?e.jsxs("span",{className:"text-gray-500",children:[" · ",r.row.file_path]}):null,r.row.byte_count!=null?e.jsxs("span",{className:"text-gray-500",children:[" · ",L(r.row.byte_count),"b"]}):null]}):e.jsxs(e.Fragment,{children:[r.row.project_name??r.row.project_slug??`project ${r.row.project_id}`,e.jsxs("span",{className:"text-gray-500",children:[" · ",r.row.model]}),e.jsxs("span",{className:"text-gray-500",children:[" · ",u(r.row.cost_usd,t)]})]})})]},`${r.kind}-${r.row.id}`))})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Tool latency (P50 / P95 / P99)"}),s.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:"No tool-call samples in the last 24h."}):e.jsx("div",{className:"space-y-2",children:s.map(r=>e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-xs","data-testid":"latency-row",children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300 truncate",children:r.tool_name}),e.jsxs("div",{className:"flex items-baseline gap-3 tabular-nums shrink-0",children:[e.jsxs("span",{className:"text-gray-500",title:`${r.samples} samples`,children:[r.samples,"n"]}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",title:"P50",children:b(r.p50)}),e.jsx("span",{className:"text-indigo-600 dark:text-indigo-400",title:"P95",children:b(r.p95)}),e.jsx("span",{className:"text-rose-600 dark:text-rose-400",title:"P99",children:b(r.p99)})]})]},r.tool_name))}),e.jsxs("p",{className:"mt-3 text-[10px] text-gray-500 leading-snug",children:["Latency derived from ",e.jsx("code",{children:"messages.timestamp"})," deltas between a tool_use and the next message in the same session — coarse, only as fine as the source-file write cadence."]})]})]})]})}function y({label:t,value:a,icon:o,subtle:n}){return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 uppercase tracking-wider",children:[e.jsx("span",{children:t}),e.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:o})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1 tabular-nums",children:a}),n&&e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:n})]})}export{H as default}; diff --git a/stackunderflow/static/react/assets/MessagesTab-Dull7JZB.js b/stackunderflow/static/react/assets/MessagesTab-C_f5Q-QT.js similarity index 96% rename from stackunderflow/static/react/assets/MessagesTab-Dull7JZB.js rename to stackunderflow/static/react/assets/MessagesTab-C_f5Q-QT.js index b24a8b0..3db4342 100644 --- a/stackunderflow/static/react/assets/MessagesTab-Dull7JZB.js +++ b/stackunderflow/static/react/assets/MessagesTab-C_f5Q-QT.js @@ -1,4 +1,4 @@ -import{r as o,u as Q,j as e,n as J}from"./react-vendor-B7v2HPaI.js";import{D as W}from"./DataTable-DCEy-2Es.js";import{a as ee,B as y,S as D,T as se,j as te,c as re,U as ae}from"./index-DQluCO2S.js";import{M as ne}from"./Modal-DkeyqO4J.js";import oe from"./Markdown-Be0CkqQs.js";import{P as K}from"./ProviderChip-baymKnS_.js";import{g as ie,N as q}from"./ProjectDashboard-DAsn11K-.js";import{f as N}from"./format-Co_unrac.js";import{I as le}from"./FilterBar-BS6lhcC1.js";import"./IconArrowUp-D8NJ3QQF.js";import"./syntax-highlighter-BYF-y4SB.js";import"./markdown-DgJRk3H5.js";import"./EmptyState-o0gibvhZ.js";import"./dashboardTabs-C5ecR5YO.js";const de={user:"blue",assistant:"green",tool_use:"purple",tool_result:"yellow",system:"gray",error:"red"};function P(t){return de[t]??"gray"}function v(t){try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}}function F(t){return t.length<=12?t:t.slice(0,8)+"..."}function ce(t){return t.error===!0||t.type==="error"}function h(t){return t.includes(",")||t.includes('"')||t.includes(` +import{r as o,u as Q,j as e,n as J}from"./react-vendor-B7v2HPaI.js";import{D as W}from"./DataTable-BHenS21h.js";import{a as ee,B as y,S as D,T as se,j as te,c as re,U as ae}from"./index-0LeeVNek.js";import{M as ne}from"./Modal-CGY7raPC.js";import oe from"./Markdown-Be0CkqQs.js";import{P as K}from"./ProviderChip-Bd3LCPUs.js";import{g as ie,N as q}from"./ProjectDashboard-CixMPUyA.js";import{f as N}from"./format-Co_unrac.js";import{I as le}from"./FilterBar-CML9sBEu.js";import"./IconArrowUp-CqAnfuIE.js";import"./syntax-highlighter-BYF-y4SB.js";import"./markdown-DgJRk3H5.js";import"./EmptyState-o0gibvhZ.js";import"./dashboardTabs-BuoED77E.js";const de={user:"blue",assistant:"green",tool_use:"purple",tool_result:"yellow",system:"gray",error:"red"};function P(t){return de[t]??"gray"}function v(t){try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}}function F(t){return t.length<=12?t:t.slice(0,8)+"..."}function ce(t){return t.error===!0||t.type==="error"}function h(t){return t.includes(",")||t.includes('"')||t.includes(` `)?`"${t.replace(/"/g,'""')}"`:t}function xe(t,n){for(const l of t)if(l.message_id===n||l.uuid===n)return l;return null}async function pe(t){const n=await fetch(`/api/interaction/${encodeURIComponent(t)}`);if(!n.ok){const l=await n.text().catch(()=>"");throw new Error(`${n.status} ${n.statusText}${l?`: ${l}`:""}`)}return n.json()}function Pe({data:t,projectName:n}){var A,U,B;const[l,_]=o.useState("all"),[f,G]=o.useState(!1),[r,L]=o.useState(null),[x,j]=o.useState(null),[H,I]=o.useState(!1),R=o.useRef(null),m=o.useRef(null),C=(U=(A=Q({queryKey:["projectsList"],queryFn:()=>re(!1),staleTime:6e4}).data)==null?void 0:A.projects.find(s=>s.dir_name===n||s.url_slug===n))==null?void 0:U.provider,z=((B=t.messages_page)==null?void 0:B.messages)??[],{filters:g}=ee(),V=500,[b,S]=o.useState(1);o.useEffect(()=>{S(1)},[g.providers,g.models]);const{data:d,isLoading:T,error:M}=Q({queryKey:["messagesPage",n,b,V,g.providers,g.models],queryFn:()=>ae({page:b,perPage:V},{providers:g.providers,models:g.models}),placeholderData:J}),p=(d==null?void 0:d.messages)??z,$=(d==null?void 0:d.total)??z.length,k=(d==null?void 0:d.total_pages)??1,O=o.useMemo(()=>{let s=p;return l!=="all"&&(s=s.filter(a=>a.type===l)),f&&(s=s.filter(ce)),s},[p,l,f]),E=o.useCallback(async s=>{if(!s)return;const a=xe(p,s);if(a)j({kind:"loaded",interactionId:s,message:a});else{j({kind:"loading",interactionId:s});try{const i=await pe(s);j({kind:"fetched",interactionId:s,data:i})}catch(i){j({kind:"error",interactionId:s,message:i instanceof Error?i.message:"Unknown error"})}}m.current!==null&&window.clearTimeout(m.current),I(!0),m.current=window.setTimeout(()=>{I(!1),m.current=null},2e3)},[p]);o.useEffect(()=>{const s=ie("interaction");s&&E(s)},[d]),o.useEffect(()=>{function s(a){const c=a.detail;if(!c||c.tab!=="messages")return;const u=c.interaction;u&&E(u)}return window.addEventListener(q,s),()=>window.removeEventListener(q,s)},[E]),o.useEffect(()=>{var s;x&&((s=R.current)==null||s.scrollIntoView({behavior:"smooth",block:"start"}))},[x==null?void 0:x.interactionId,x==null?void 0:x.kind]),o.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const X=o.useMemo(()=>[{key:"type",label:"Type",width:"100px",render:s=>e.jsx(y,{color:P(s.type),size:"sm",children:s.type}),sortValue:s=>s.type},{key:"content",label:"Content",render:s=>e.jsx("span",{className:"text-gray-700 dark:text-gray-300 text-xs whitespace-pre-wrap break-words block",children:s.content.length>300?s.content.slice(0,300)+"…":s.content})},{key:"timestamp",label:"Timestamp",width:"160px",render:s=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400 text-xs whitespace-nowrap",children:v(s.timestamp)}),sortValue:s=>new Date(s.timestamp).getTime()},{key:"model",label:"Model",width:"200px",render:s=>s.model?e.jsxs("span",{className:"inline-flex items-center gap-1.5 min-w-0",children:[e.jsx(K,{provider:C}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 text-xs truncate",title:s.model,children:N(s.model)})]}):e.jsx("span",{className:"text-gray-500 text-xs",children:"-"})},{key:"session",label:"Session",width:"100px",render:s=>e.jsx("span",{className:"text-gray-500 text-xs font-mono",title:s.session_id,children:F(s.session_id)})},{key:"tools",label:"Tools",width:"160px",render:s=>s.tools&&s.tools.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:s.tools.map(a=>{const i=typeof a=="string"?a:a.name;return e.jsx(y,{color:"purple",size:"sm",children:i},i)})}):e.jsx("span",{className:"text-gray-500 text-xs",children:"-"})}],[C]),Y=s=>{L(s)},Z=s=>{const i=[["Type","Content","Timestamp","Model","Session","Tools"].join(",")];for(const c of s)i.push([h(c.type),h(c.content),h(c.timestamp),h(c.model??""),h(c.session_id),h((c.tools??[]).map(u=>typeof u=="string"?u:u.name).join("; "))].join(","));return i.join(` `)},w=o.useMemo(()=>{const s={};for(const a of p)s[a.type]=(s[a.type]??0)+1;return s},[p]);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("style",{children:` @keyframes su-msg-pulse { diff --git a/stackunderflow/static/react/assets/Modal-DkeyqO4J.js b/stackunderflow/static/react/assets/Modal-CGY7raPC.js similarity index 94% rename from stackunderflow/static/react/assets/Modal-DkeyqO4J.js rename to stackunderflow/static/react/assets/Modal-CGY7raPC.js index 1a21660..7925fcb 100644 --- a/stackunderflow/static/react/assets/Modal-DkeyqO4J.js +++ b/stackunderflow/static/react/assets/Modal-CGY7raPC.js @@ -1 +1 @@ -import{r as s,j as e}from"./react-vendor-B7v2HPaI.js";import{I as i}from"./FilterBar-BS6lhcC1.js";function x({isOpen:a,onClose:r,title:d,children:o}){const t=s.useCallback(l=>{l.key==="Escape"&&r()},[r]);return s.useEffect(()=>{if(a)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a,t]),a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-lg mx-4 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-300 dark:border-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:d}),e.jsx("button",{onClick:r,className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors p-0.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700","aria-label":"Close modal",children:e.jsx(i,{size:16})})]}),e.jsx("div",{className:"p-4",children:o})]})]}):null}export{x as M}; +import{r as s,j as e}from"./react-vendor-B7v2HPaI.js";import{I as i}from"./FilterBar-CML9sBEu.js";function x({isOpen:a,onClose:r,title:d,children:o}){const t=s.useCallback(l=>{l.key==="Escape"&&r()},[r]);return s.useEffect(()=>{if(a)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a,t]),a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-lg mx-4 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-300 dark:border-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:d}),e.jsx("button",{onClick:r,className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors p-0.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700","aria-label":"Close modal",children:e.jsx(i,{size:16})})]}),e.jsx("div",{className:"p-4",children:o})]})]}):null}export{x as M}; diff --git a/stackunderflow/static/react/assets/Overview-BqyHxuZ_.js b/stackunderflow/static/react/assets/Overview-D7DJD716.js similarity index 98% rename from stackunderflow/static/react/assets/Overview-BqyHxuZ_.js rename to stackunderflow/static/react/assets/Overview-D7DJD716.js index 7f345a1..8d404bc 100644 --- a/stackunderflow/static/react/assets/Overview-BqyHxuZ_.js +++ b/stackunderflow/static/react/assets/Overview-D7DJD716.js @@ -1,2 +1,2 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewTokenChart-D0W5mYxH.js","assets/react-vendor-B7v2HPaI.js","assets/format-Co_unrac.js","assets/chartTheme-GpkpBpop.js","assets/recharts-C8DDeE7E.js","assets/OverviewCostChart-COSvBbQ2.js"])))=>i.map(i=>d[i]); -import{a as Ee,d as Fe,r as a,l as ze,u as de,e as $e,j as e,_ as xe}from"./react-vendor-B7v2HPaI.js";import{u as Ie,a as Ae,g as Oe,L as qe,I as ne,b as Re,s as Ke,f as Qe,r as Ue,c as We,d as Be,e as Ge}from"./index-DQluCO2S.js";import{E as Ve}from"./EmptyState-o0gibvhZ.js";import{P as le}from"./ProviderChip-baymKnS_.js";import{f as He,a as w,b as ie}from"./format-Co_unrac.js";import{F as Je}from"./FilterBar-BS6lhcC1.js";import{I as Ze,a as Xe}from"./IconArrowUp-D8NJ3QQF.js";const Ye=a.lazy(()=>xe(()=>import("./OverviewTokenChart-D0W5mYxH.js"),__vite__mapDeps([0,1,2,3,4]))),et=a.lazy(()=>xe(()=>import("./OverviewCostChart-COSvBbQ2.js"),__vite__mapDeps([5,1,2,3,4]))),tt=[{key:"name",label:"Name"},{key:"path",label:"Path"},{key:"anon",label:"Anon"}],ge=[{key:"7d",label:"7 days"},{key:"30d",label:"30 days"},{key:"90d",label:"90 days"},{key:"all",label:"All time"}],ce=100;function U(o){const c=new Date;return c.setDate(c.getDate()-o),c.setHours(0,0,0,0),c}function rt(o){return o==="7d"?U(7):o==="30d"?U(30):o==="90d"?U(90):null}function at(o){return new Date(o*1e3).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function st(o,c){if(!o||!c)return"-";const u=new Date(c).getTime()-new Date(o).getTime(),g=Math.floor(u/(1e3*60*60*24));if(g<1)return"<1d";if(g<30)return`${g}d`;const f=Math.floor(g/30),N=g%30;return f<12?N>0?`${f}mo ${N}d`:`${f}mo`:`${Math.floor(f/12)}y ${f%12}mo`}function W(o,c){if(o==="all"&&c)return`Since ${new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}`;const u=ge.find(g=>g.key===o);return u?`Last ${u.label}`:""}function ot(o,c){const[u,g]=a.useState(o);return a.useEffect(()=>{const f=setTimeout(()=>g(o),c);return()=>clearTimeout(f)},[o,c]),u}function mt(){var Y,ee,te;const o=Ee(),c=Fe(),{currency:u}=Ie(),[g,f]=a.useState(""),[N,me]=a.useState("last_modified"),[D,B]=a.useState("desc"),[k,R]=a.useState(1),[h,ye]=a.useState(20),[m,ue]=a.useState("30d"),{filters:he}=Ae(),M=he.models[0]??"all",j=M!=="all"?He(M):null,[G,pe]=a.useState(Oe()),be=t=>{pe(t),Ke(t)},$=ot(g,200),{data:p,isLoading:fe,isError:ke,refetch:je,fetchNextPage:ve,hasNextPage:Ne,isFetchingNextPage:V}=ze({queryKey:["projects",!0],queryFn:({pageParam:t})=>We(!0,void 0,{limit:ce,offset:t}),initialPageParam:0,getNextPageParam:t=>{if(!t.has_more)return;const r=(t.offset??0)+(t.limit??ce);return rGe()}),De=fe||we,Me=ke||Ce,K=$e({mutationFn:()=>Ue(new Date().getTimezoneOffset()),onSuccess:()=>{c.invalidateQueries({queryKey:["projects"]}),c.invalidateQueries({queryKey:["globalStats"]})}}),C=a.useMemo(()=>(p==null?void 0:p.pages.flatMap(t=>t.projects))??[],[p]),H=((Y=p==null?void 0:p.pages[0])==null?void 0:Y.total_count)??C.length,s=_e,S=s==null?void 0:s.first_use_date;s==null||s.last_use_date;const Q=(s==null?void 0:s.daily_token_usage)??[],J=(s==null?void 0:s.daily_costs)??[],A=(s==null?void 0:s.models)??{},Se=a.useMemo(()=>{const t=Object.keys(A).filter(r=>r!=="");return t.sort((r,d)=>{var l,n;return(((l=A[d])==null?void 0:l.cost)??0)-(((n=A[r])==null?void 0:n.cost)??0)}),t},[A]),Le=(t,r)=>Qe(t.dir_name,r,G),y=a.useMemo(()=>rt(m),[m]),L=a.useMemo(()=>(y?Q.filter(r=>new Date(r.date)>=y):Q).map(r=>({...r,ts:new Date(`${r.date}T00:00:00`).getTime()})),[Q,y]),O=a.useMemo(()=>{let t=J;return y&&(t=t.filter(r=>new Date(r.date)>=y)),M!=="all"?t.map(r=>{var d;return{...r,cost:((d=r.by_model)==null?void 0:d[M])??0}}):t},[J,y,M]),P=a.useMemo(()=>{if(!y)return C;const t=y.getTime()/1e3;return C.filter(r=>r.last_modified>=t)},[C,y]),Z=(s==null?void 0:s.total_cache_read_tokens)??0,X=(s==null?void 0:s.total_cache_write_tokens)??0,b=a.useMemo(()=>{const t=L.reduce((i,x)=>i+x.input,0),r=L.reduce((i,x)=>i+x.output,0),d=O.reduce((i,x)=>i+(x.cost??0),0),l=(I==null?void 0:I.daily)??[];let n,v;l.length>0?(n=l.filter(i=>!y||new Date(`${i.date}T00:00:00`)>=y).reduce((i,x)=>i+(x.commands??0),0),v=!0):(n=P.reduce((i,x)=>{var z;return i+(((z=x.stats)==null?void 0:z.total_commands)??0)},0),v=!1);const _=m==="all"?Z+X:0;return{totalTokens:t+r,inputTokens:t,outputTokens:r,cacheTokens:_,totalCost:d,totalCommands:n,commandsWindowed:v,projectCount:P.length}},[L,O,P,m,Z,X,I,y]),T=a.useMemo(()=>{let t=P;if($){const r=$.toLowerCase();t=t.filter(d=>d.display_name.toLowerCase().includes(r)||d.dir_name.toLowerCase().includes(r))}return t=[...t].sort((r,d)=>{var v,_,i,x;let l,n;switch(N){case"display_name":l=r.display_name.toLowerCase(),n=d.display_name.toLowerCase();break;case"last_modified":l=r.last_modified,n=d.last_modified;break;case"total_cost":l=((v=r.stats)==null?void 0:v.total_cost)??0,n=((_=d.stats)==null?void 0:_.total_cost)??0;break;case"total_commands":l=((i=r.stats)==null?void 0:i.total_commands)??0,n=((x=d.stats)==null?void 0:x.total_commands)??0;break;case"total_size_mb":l=r.total_size_mb,n=d.total_size_mb;break;default:l=0,n=0}return ln?D==="asc"?1:-1:0}),t},[P,$,N,D]),q=a.useMemo(()=>Math.ceil(T.length/h),[T.length,h]),Pe=a.useMemo(()=>T.slice((k-1)*h,k*h),[T,k,h]);a.useEffect(()=>{R(1)},[$,N,D,h,m]);const E=t=>{N===t?B(r=>r==="asc"?"desc":"asc"):(me(t),B("desc"))},F=({field:t})=>N!==t?null:D==="asc"?e.jsx(Ze,{size:12,className:"inline ml-0.5"}):e.jsx(Xe,{size:12,className:"inline ml-0.5"});return De?e.jsx(qe,{message:"Loading projects..."}):Me?e.jsx("div",{className:"max-w-7xl mx-auto p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx("h3",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Couldn't load dashboard data"}),e.jsx("p",{className:"text-gray-500 text-xs max-w-sm",children:"The projects or global-stats request failed. Make sure the StackUnderflow server is running, then retry."}),e.jsxs("button",{onClick:()=>{je(),Te()},className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600",children:[e.jsx(ne,{size:14}),"Retry"]})]})}):C.length===0?e.jsx(Ve,{title:"No projects found",description:"Make sure you have Claude Code sessions in ~/.claude/projects/"}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[e.jsx(Je,{modelOptions:Se}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Projects Overview"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:[b.projectCount," projects ",m!=="all"?`active in last ${m.replace("d"," days")}`:"analyzed",m==="all"&&S&&e.jsxs(e.Fragment,{children:[" · since ",new Date(S).toLocaleDateString(void 0,{month:"short",year:"numeric"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("div",{className:"flex items-center bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 overflow-hidden",children:ge.map(({key:t,label:r})=>e.jsx("button",{onClick:()=>ue(t),className:`px-3 py-1.5 text-xs font-medium transition-colors ${m===t?"bg-indigo-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:r},t))}),e.jsxs("button",{onClick:()=>K.mutate(),disabled:K.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:[e.jsx(ne,{size:14,className:K.isPending?"animate-spin":""}),"Refresh"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Projects"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:b.projectCount})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Total Tokens"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:w(b.totalTokens)}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-0.5",children:["In: ",w(b.inputTokens)," / Out: ",w(b.outputTokens),b.cacheTokens>0&&e.jsxs(e.Fragment,{children:[" / Cache: ",w(b.cacheTokens)," (lifetime)"]})]}),e.jsxs("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:["Input + output · ",W(m,S),j?" · all models":""]})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Est. API Cost"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:ie(b.totalCost,u)}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-0.5",children:[W(m,S),j?` · ${j}`:""]}),e.jsx("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:"pay-per-token equivalent"})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Commands"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:b.totalCommands.toLocaleString()}),e.jsxs("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:[b.commandsWindowed?W(m,S):"lifetime",j?" · all models":""]})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Cached"}),e.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:[((te=(ee=p==null?void 0:p.pages[0])==null?void 0:ee.cache_status)==null?void 0:te.cached_count)??0,"/",H]})]})]}),L.length>0&&e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Token Usage Over Time",j?" · all models":""]}),e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"h-[280px] rounded bg-gray-200/40 dark:bg-gray-800/40 animate-pulse"}),children:e.jsx(Ye,{data:L})})]}),O.length>0&&e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Daily Cost",j?` · ${j}`:""]}),e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"h-[200px] rounded bg-gray-200/40 dark:bg-gray-800/40 animate-pulse"}),children:e.jsx(et,{data:O,currency:u})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 max-w-xs",children:[e.jsx(Re,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:g,onChange:t=>f(t.target.value),placeholder:"Filter projects...",className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded pl-8 pr-3 py-1.5 text-sm text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),e.jsx("div",{className:"flex items-center bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 overflow-hidden",children:tt.map(({key:t,label:r})=>e.jsx("button",{onClick:()=>be(t),className:`px-2.5 py-1.5 text-xs font-medium transition-colors ${G===t?"bg-violet-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:r},t))}),e.jsxs("select",{value:h,onChange:t=>ye(Number(t.target.value)),className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1.5 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:20,children:"20"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Per-project values below are lifetime totals; the date range filters which projects appear (by last activity)",j?e.jsxs(e.Fragment,{children:[" · the ",e.jsx("span",{className:"font-medium",children:j})," model filter applies to cost only"]}):null,"."]}),e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider",children:[e.jsxs("th",{className:"text-left px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("display_name"),children:["Project ",e.jsx(F,{field:"display_name"})]}),e.jsxs("th",{className:"text-left px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("last_modified"),children:["Last Active ",e.jsx(F,{field:"last_modified"})]}),e.jsx("th",{className:"text-right px-4 py-3",children:"Span"}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_commands"),children:["Commands ",e.jsx(F,{field:"total_commands"})]}),e.jsx("th",{className:"text-right px-4 py-3",children:"Tokens"}),e.jsx("th",{className:"text-right px-4 py-3",children:"Steps/Cmd"}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_cost"),children:["Est. Cost ",e.jsx(F,{field:"total_cost"})]}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_size_mb"),children:["Size ",e.jsx(F,{field:"total_size_mb"})]})]})}),e.jsx("tbody",{children:Pe.map((t,r)=>{var l,n,v,_,i,x,z,re,ae,se;const d=(((l=t.stats)==null?void 0:l.total_input_tokens)??0)+(((n=t.stats)==null?void 0:n.total_output_tokens)??0);return e.jsxs("tr",{onClick:()=>o(`/project/${encodeURIComponent(t.dir_name)}`),className:"border-b border-gray-200/50 dark:border-gray-800/50 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-medium",children:Le(t,(k-1)*h+r)}),(t.provider??"").split(",").filter(Boolean).map(oe=>e.jsx(le,{provider:oe.trim()},oe)),!t.provider&&e.jsx(le,{provider:void 0})]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[t.file_count," sessions"]})]}),e.jsx("td",{className:"px-4 py-3 text-gray-600 dark:text-gray-400 text-xs",children:at(t.last_modified)}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-500 text-xs",children:st(((v=t.stats)==null?void 0:v.first_message_date)??void 0,((_=t.stats)==null?void 0:_.last_message_date)??void 0)}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-700 dark:text-gray-300",children:((x=(i=t.stats)==null?void 0:i.total_commands)==null?void 0:x.toLocaleString())??"-"}),e.jsxs("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:[e.jsx("div",{children:d>0?w(d):"-"}),d>0&&e.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-600",children:[w(((z=t.stats)==null?void 0:z.total_input_tokens)??0)," in / ",w(((re=t.stats)==null?void 0:re.total_output_tokens)??0)," out"]})]}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:(ae=t.stats)!=null&&ae.avg_steps_per_command?t.stats.avg_steps_per_command.toFixed(1):"-"}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-700 dark:text-gray-300",children:((se=t.stats)==null?void 0:se.total_cost)!=null?ie(t.stats.total_cost,u):"-"}),e.jsxs("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:[t.total_size_mb.toFixed(1)," MB"]})]},t.dir_name)})})]})})}),Ne&&e.jsxs("div",{className:"flex items-center justify-center gap-3 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:[C.length," of ",H," projects loaded"]}),e.jsx("button",{onClick:()=>ve(),disabled:V,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:V?"Loading…":"Load more"})]}),q>1&&e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Showing ",(k-1)*h+1,"-",Math.min(k*h,T.length)," of ",T.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>R(t=>Math.max(1,t-1)),disabled:k<=1,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:"Prev"}),e.jsxs("span",{children:["Page ",k," of ",q]}),e.jsx("button",{onClick:()=>R(t=>Math.min(q,t+1)),disabled:k>=q,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:"Next"})]})]})]})}export{mt as default}; +import{a as Ee,d as Fe,r as a,l as ze,u as de,e as $e,j as e,_ as xe}from"./react-vendor-B7v2HPaI.js";import{u as Ie,a as Ae,g as Oe,L as qe,I as ne,b as Re,s as Ke,f as Qe,r as Ue,c as We,d as Be,e as Ge}from"./index-0LeeVNek.js";import{E as Ve}from"./EmptyState-o0gibvhZ.js";import{P as le}from"./ProviderChip-Bd3LCPUs.js";import{f as He,a as w,b as ie}from"./format-Co_unrac.js";import{F as Je}from"./FilterBar-CML9sBEu.js";import{I as Ze,a as Xe}from"./IconArrowUp-CqAnfuIE.js";const Ye=a.lazy(()=>xe(()=>import("./OverviewTokenChart-D0W5mYxH.js"),__vite__mapDeps([0,1,2,3,4]))),et=a.lazy(()=>xe(()=>import("./OverviewCostChart-COSvBbQ2.js"),__vite__mapDeps([5,1,2,3,4]))),tt=[{key:"name",label:"Name"},{key:"path",label:"Path"},{key:"anon",label:"Anon"}],ge=[{key:"7d",label:"7 days"},{key:"30d",label:"30 days"},{key:"90d",label:"90 days"},{key:"all",label:"All time"}],ce=100;function U(o){const c=new Date;return c.setDate(c.getDate()-o),c.setHours(0,0,0,0),c}function rt(o){return o==="7d"?U(7):o==="30d"?U(30):o==="90d"?U(90):null}function at(o){return new Date(o*1e3).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function st(o,c){if(!o||!c)return"-";const u=new Date(c).getTime()-new Date(o).getTime(),g=Math.floor(u/(1e3*60*60*24));if(g<1)return"<1d";if(g<30)return`${g}d`;const f=Math.floor(g/30),N=g%30;return f<12?N>0?`${f}mo ${N}d`:`${f}mo`:`${Math.floor(f/12)}y ${f%12}mo`}function W(o,c){if(o==="all"&&c)return`Since ${new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}`;const u=ge.find(g=>g.key===o);return u?`Last ${u.label}`:""}function ot(o,c){const[u,g]=a.useState(o);return a.useEffect(()=>{const f=setTimeout(()=>g(o),c);return()=>clearTimeout(f)},[o,c]),u}function mt(){var Y,ee,te;const o=Ee(),c=Fe(),{currency:u}=Ie(),[g,f]=a.useState(""),[N,me]=a.useState("last_modified"),[D,B]=a.useState("desc"),[k,R]=a.useState(1),[h,ye]=a.useState(20),[m,ue]=a.useState("30d"),{filters:he}=Ae(),M=he.models[0]??"all",j=M!=="all"?He(M):null,[G,pe]=a.useState(Oe()),be=t=>{pe(t),Ke(t)},$=ot(g,200),{data:p,isLoading:fe,isError:ke,refetch:je,fetchNextPage:ve,hasNextPage:Ne,isFetchingNextPage:V}=ze({queryKey:["projects",!0],queryFn:({pageParam:t})=>We(!0,void 0,{limit:ce,offset:t}),initialPageParam:0,getNextPageParam:t=>{if(!t.has_more)return;const r=(t.offset??0)+(t.limit??ce);return rGe()}),De=fe||we,Me=ke||Ce,K=$e({mutationFn:()=>Ue(new Date().getTimezoneOffset()),onSuccess:()=>{c.invalidateQueries({queryKey:["projects"]}),c.invalidateQueries({queryKey:["globalStats"]})}}),C=a.useMemo(()=>(p==null?void 0:p.pages.flatMap(t=>t.projects))??[],[p]),H=((Y=p==null?void 0:p.pages[0])==null?void 0:Y.total_count)??C.length,s=_e,S=s==null?void 0:s.first_use_date;s==null||s.last_use_date;const Q=(s==null?void 0:s.daily_token_usage)??[],J=(s==null?void 0:s.daily_costs)??[],A=(s==null?void 0:s.models)??{},Se=a.useMemo(()=>{const t=Object.keys(A).filter(r=>r!=="");return t.sort((r,d)=>{var l,n;return(((l=A[d])==null?void 0:l.cost)??0)-(((n=A[r])==null?void 0:n.cost)??0)}),t},[A]),Le=(t,r)=>Qe(t.dir_name,r,G),y=a.useMemo(()=>rt(m),[m]),L=a.useMemo(()=>(y?Q.filter(r=>new Date(r.date)>=y):Q).map(r=>({...r,ts:new Date(`${r.date}T00:00:00`).getTime()})),[Q,y]),O=a.useMemo(()=>{let t=J;return y&&(t=t.filter(r=>new Date(r.date)>=y)),M!=="all"?t.map(r=>{var d;return{...r,cost:((d=r.by_model)==null?void 0:d[M])??0}}):t},[J,y,M]),P=a.useMemo(()=>{if(!y)return C;const t=y.getTime()/1e3;return C.filter(r=>r.last_modified>=t)},[C,y]),Z=(s==null?void 0:s.total_cache_read_tokens)??0,X=(s==null?void 0:s.total_cache_write_tokens)??0,b=a.useMemo(()=>{const t=L.reduce((i,x)=>i+x.input,0),r=L.reduce((i,x)=>i+x.output,0),d=O.reduce((i,x)=>i+(x.cost??0),0),l=(I==null?void 0:I.daily)??[];let n,v;l.length>0?(n=l.filter(i=>!y||new Date(`${i.date}T00:00:00`)>=y).reduce((i,x)=>i+(x.commands??0),0),v=!0):(n=P.reduce((i,x)=>{var z;return i+(((z=x.stats)==null?void 0:z.total_commands)??0)},0),v=!1);const _=m==="all"?Z+X:0;return{totalTokens:t+r,inputTokens:t,outputTokens:r,cacheTokens:_,totalCost:d,totalCommands:n,commandsWindowed:v,projectCount:P.length}},[L,O,P,m,Z,X,I,y]),T=a.useMemo(()=>{let t=P;if($){const r=$.toLowerCase();t=t.filter(d=>d.display_name.toLowerCase().includes(r)||d.dir_name.toLowerCase().includes(r))}return t=[...t].sort((r,d)=>{var v,_,i,x;let l,n;switch(N){case"display_name":l=r.display_name.toLowerCase(),n=d.display_name.toLowerCase();break;case"last_modified":l=r.last_modified,n=d.last_modified;break;case"total_cost":l=((v=r.stats)==null?void 0:v.total_cost)??0,n=((_=d.stats)==null?void 0:_.total_cost)??0;break;case"total_commands":l=((i=r.stats)==null?void 0:i.total_commands)??0,n=((x=d.stats)==null?void 0:x.total_commands)??0;break;case"total_size_mb":l=r.total_size_mb,n=d.total_size_mb;break;default:l=0,n=0}return ln?D==="asc"?1:-1:0}),t},[P,$,N,D]),q=a.useMemo(()=>Math.ceil(T.length/h),[T.length,h]),Pe=a.useMemo(()=>T.slice((k-1)*h,k*h),[T,k,h]);a.useEffect(()=>{R(1)},[$,N,D,h,m]);const E=t=>{N===t?B(r=>r==="asc"?"desc":"asc"):(me(t),B("desc"))},F=({field:t})=>N!==t?null:D==="asc"?e.jsx(Ze,{size:12,className:"inline ml-0.5"}):e.jsx(Xe,{size:12,className:"inline ml-0.5"});return De?e.jsx(qe,{message:"Loading projects..."}):Me?e.jsx("div",{className:"max-w-7xl mx-auto p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx("h3",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Couldn't load dashboard data"}),e.jsx("p",{className:"text-gray-500 text-xs max-w-sm",children:"The projects or global-stats request failed. Make sure the StackUnderflow server is running, then retry."}),e.jsxs("button",{onClick:()=>{je(),Te()},className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600",children:[e.jsx(ne,{size:14}),"Retry"]})]})}):C.length===0?e.jsx(Ve,{title:"No projects found",description:"Make sure you have Claude Code sessions in ~/.claude/projects/"}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[e.jsx(Je,{modelOptions:Se}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Projects Overview"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:[b.projectCount," projects ",m!=="all"?`active in last ${m.replace("d"," days")}`:"analyzed",m==="all"&&S&&e.jsxs(e.Fragment,{children:[" · since ",new Date(S).toLocaleDateString(void 0,{month:"short",year:"numeric"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("div",{className:"flex items-center bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 overflow-hidden",children:ge.map(({key:t,label:r})=>e.jsx("button",{onClick:()=>ue(t),className:`px-3 py-1.5 text-xs font-medium transition-colors ${m===t?"bg-indigo-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:r},t))}),e.jsxs("button",{onClick:()=>K.mutate(),disabled:K.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:[e.jsx(ne,{size:14,className:K.isPending?"animate-spin":""}),"Refresh"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Projects"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:b.projectCount})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Total Tokens"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:w(b.totalTokens)}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-0.5",children:["In: ",w(b.inputTokens)," / Out: ",w(b.outputTokens),b.cacheTokens>0&&e.jsxs(e.Fragment,{children:[" / Cache: ",w(b.cacheTokens)," (lifetime)"]})]}),e.jsxs("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:["Input + output · ",W(m,S),j?" · all models":""]})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Est. API Cost"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:ie(b.totalCost,u)}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-0.5",children:[W(m,S),j?` · ${j}`:""]}),e.jsx("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:"pay-per-token equivalent"})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Commands"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:b.totalCommands.toLocaleString()}),e.jsxs("div",{className:"text-[9px] text-gray-400 dark:text-gray-600 mt-0.5",children:[b.commandsWindowed?W(m,S):"lifetime",j?" · all models":""]})]}),e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Cached"}),e.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1",children:[((te=(ee=p==null?void 0:p.pages[0])==null?void 0:ee.cache_status)==null?void 0:te.cached_count)??0,"/",H]})]})]}),L.length>0&&e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Token Usage Over Time",j?" · all models":""]}),e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"h-[280px] rounded bg-gray-200/40 dark:bg-gray-800/40 animate-pulse"}),children:e.jsx(Ye,{data:L})})]}),O.length>0&&e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Daily Cost",j?` · ${j}`:""]}),e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"h-[200px] rounded bg-gray-200/40 dark:bg-gray-800/40 animate-pulse"}),children:e.jsx(et,{data:O,currency:u})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 max-w-xs",children:[e.jsx(Re,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:g,onChange:t=>f(t.target.value),placeholder:"Filter projects...",className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded pl-8 pr-3 py-1.5 text-sm text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),e.jsx("div",{className:"flex items-center bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 overflow-hidden",children:tt.map(({key:t,label:r})=>e.jsx("button",{onClick:()=>be(t),className:`px-2.5 py-1.5 text-xs font-medium transition-colors ${G===t?"bg-violet-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:r},t))}),e.jsxs("select",{value:h,onChange:t=>ye(Number(t.target.value)),className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1.5 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:20,children:"20"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Per-project values below are lifetime totals; the date range filters which projects appear (by last activity)",j?e.jsxs(e.Fragment,{children:[" · the ",e.jsx("span",{className:"font-medium",children:j})," model filter applies to cost only"]}):null,"."]}),e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider",children:[e.jsxs("th",{className:"text-left px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("display_name"),children:["Project ",e.jsx(F,{field:"display_name"})]}),e.jsxs("th",{className:"text-left px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("last_modified"),children:["Last Active ",e.jsx(F,{field:"last_modified"})]}),e.jsx("th",{className:"text-right px-4 py-3",children:"Span"}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_commands"),children:["Commands ",e.jsx(F,{field:"total_commands"})]}),e.jsx("th",{className:"text-right px-4 py-3",children:"Tokens"}),e.jsx("th",{className:"text-right px-4 py-3",children:"Steps/Cmd"}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_cost"),children:["Est. Cost ",e.jsx(F,{field:"total_cost"})]}),e.jsxs("th",{className:"text-right px-4 py-3 cursor-pointer hover:text-gray-800 dark:hover:text-gray-200",onClick:()=>E("total_size_mb"),children:["Size ",e.jsx(F,{field:"total_size_mb"})]})]})}),e.jsx("tbody",{children:Pe.map((t,r)=>{var l,n,v,_,i,x,z,re,ae,se;const d=(((l=t.stats)==null?void 0:l.total_input_tokens)??0)+(((n=t.stats)==null?void 0:n.total_output_tokens)??0);return e.jsxs("tr",{onClick:()=>o(`/project/${encodeURIComponent(t.dir_name)}`),className:"border-b border-gray-200/50 dark:border-gray-800/50 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 cursor-pointer",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-medium",children:Le(t,(k-1)*h+r)}),(t.provider??"").split(",").filter(Boolean).map(oe=>e.jsx(le,{provider:oe.trim()},oe)),!t.provider&&e.jsx(le,{provider:void 0})]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[t.file_count," sessions"]})]}),e.jsx("td",{className:"px-4 py-3 text-gray-600 dark:text-gray-400 text-xs",children:at(t.last_modified)}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-500 text-xs",children:st(((v=t.stats)==null?void 0:v.first_message_date)??void 0,((_=t.stats)==null?void 0:_.last_message_date)??void 0)}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-700 dark:text-gray-300",children:((x=(i=t.stats)==null?void 0:i.total_commands)==null?void 0:x.toLocaleString())??"-"}),e.jsxs("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:[e.jsx("div",{children:d>0?w(d):"-"}),d>0&&e.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-600",children:[w(((z=t.stats)==null?void 0:z.total_input_tokens)??0)," in / ",w(((re=t.stats)==null?void 0:re.total_output_tokens)??0)," out"]})]}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:(ae=t.stats)!=null&&ae.avg_steps_per_command?t.stats.avg_steps_per_command.toFixed(1):"-"}),e.jsx("td",{className:"px-4 py-3 text-right text-gray-700 dark:text-gray-300",children:((se=t.stats)==null?void 0:se.total_cost)!=null?ie(t.stats.total_cost,u):"-"}),e.jsxs("td",{className:"px-4 py-3 text-right text-gray-600 dark:text-gray-400",children:[t.total_size_mb.toFixed(1)," MB"]})]},t.dir_name)})})]})})}),Ne&&e.jsxs("div",{className:"flex items-center justify-center gap-3 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:[C.length," of ",H," projects loaded"]}),e.jsx("button",{onClick:()=>ve(),disabled:V,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:V?"Loading…":"Load more"})]}),q>1&&e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Showing ",(k-1)*h+1,"-",Math.min(k*h,T.length)," of ",T.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>R(t=>Math.max(1,t-1)),disabled:k<=1,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:"Prev"}),e.jsxs("span",{children:["Page ",k," of ",q]}),e.jsx("button",{onClick:()=>R(t=>Math.min(q,t+1)),disabled:k>=q,className:"px-3 py-1 bg-white dark:bg-gray-800 rounded border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:"Next"})]})]})]})}export{mt as default}; diff --git a/stackunderflow/static/react/assets/OverviewTab-CSNvLBfV.js b/stackunderflow/static/react/assets/OverviewTab-Bzn_KZlZ.js similarity index 91% rename from stackunderflow/static/react/assets/OverviewTab-CSNvLBfV.js rename to stackunderflow/static/react/assets/OverviewTab-Bzn_KZlZ.js index 12b5dd5..37eb952 100644 --- a/stackunderflow/static/react/assets/OverviewTab-CSNvLBfV.js +++ b/stackunderflow/static/react/assets/OverviewTab-Bzn_KZlZ.js @@ -1,4 +1,4 @@ -import{u as B,j as e,r as c}from"./react-vendor-B7v2HPaI.js";import{h as R,u as P,N as he,p as pe,O as we,B as H,P as Fe,i as ye,j as je,Q as Te,a as J,R as ke}from"./index-DQluCO2S.js";import{c as m,b as u,f as Z,a as fe}from"./format-Co_unrac.js";import{I as be}from"./IconHash-cdeuBxnj.js";import{b as _e,c as ve,d as Ce,e as Ie}from"./dashboardTabs-C5ecR5YO.js";import{I as $e,a as Me,b as Re,T as Oe,C as Se,c as De,d as ze}from"./TokenCompositionDonut-DTEMWIwY.js";import{u as v,E as C,C as N,a as T}from"./chartTheme-GpkpBpop.js";import{R as L,A as Be,C as I,X as $,Y as j,T as A,L as S,a as U,B as q,b as p,P as Ee,c as Ue,d as W,e as ee,f as te}from"./recharts-C8DDeE7E.js";import{I as Ke}from"./IconTrendingUp-D1iuYAG9.js";import{I as Pe}from"./IconArrowRight-lOOgkPXu.js";import{I as He}from"./IconFileText-ChD_eRqq.js";import{I as qe,s as We}from"./ProjectDashboard-DAsn11K-.js";import{I as Ye}from"./IconCheck-BQLu3HFV.js";import{I as Ge}from"./IconCopy-BOYWZx4M.js";import{I as Ne,a as Ve}from"./IconUser-IjRNaThB.js";import{I as Qe}from"./IconClockHour4-BUN27e3Z.js";import{I as Xe}from"./IconRobot-DuCKb11z.js";import"./EmptyState-o0gibvhZ.js";import"./FilterBar-BS6lhcC1.js";/** +import{u as B,j as e,r as c}from"./react-vendor-B7v2HPaI.js";import{h as R,u as P,N as he,p as pe,O as we,B as H,P as Fe,i as ye,j as je,Q as Te,a as J,R as fe}from"./index-0LeeVNek.js";import{c as m,b as u,f as Z,a as ke}from"./format-Co_unrac.js";import{I as be}from"./IconHash-Cw_3c3J-.js";import{b as _e,c as ve,d as Ce,e as Ie}from"./dashboardTabs-BuoED77E.js";import{I as $e,a as Me,T as Re,C as Oe,b as Se,c as De}from"./TokenCompositionDonut-DhTEtbxP.js";import{I as ze}from"./IconDatabase-50ZWmnTz.js";import{u as v,E as C,C as N,a as T}from"./chartTheme-GpkpBpop.js";import{R as L,A as Be,C as I,X as $,Y as j,T as A,L as S,a as U,B as q,b as p,P as Ee,c as Ue,d as W,e as ee,f as te}from"./recharts-C8DDeE7E.js";import{I as Ke}from"./IconTrendingUp-CcTO0Xpf.js";import{I as Pe}from"./IconArrowRight-CEBy4AKU.js";import{I as He}from"./IconFileText-BfJ2drOF.js";import{I as qe,s as We}from"./ProjectDashboard-CixMPUyA.js";import{I as Ye}from"./IconCheck-D_dgJKrH.js";import{I as Ge}from"./IconCopy-Cl6jyttT.js";import{I as Ne,a as Ve}from"./IconUser-YF3ooIRT.js";import{I as Qe}from"./IconClockHour4-B94dRT7a.js";import{I as Xe}from"./IconRobot-DArBIG_E.js";import"./EmptyState-o0gibvhZ.js";import"./FilterBar-CML9sBEu.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. @@ -33,5 +33,5 @@ import{u as B,j as e,r as c}from"./react-vendor-B7v2HPaI.js";import{h as R,u as * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const ct=[["path",{d:"M6 19v-16h4.5a4.5 4.5 0 1 1 0 9h-4.5",key:"svg-0"}],["path",{d:"M19 21l-9 -9",key:"svg-1"}],["path",{d:"M13 21l6 -6",key:"svg-2"}]],dt=R("outline","prescription","Prescription",ct);function K(t){return Number.isFinite(t)?`${t.toFixed(1)}%`:"0.0%"}function xt(t){if(!t)return null;const s=new Date(t).getTime();if(Number.isNaN(s))return null;const n=Date.now()-s;return Math.max(0,Math.floor(n/(1e3*60*60*24)))}function F({icon:t,label:s,value:n,sublabel:r,badge:a}){return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:s}),a]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:n}),r&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:r})]})}function mt({stats:t}){const{currency:s}=P(),{data:n}=B({queryKey:["pricing"],queryFn:we,staleTime:3600*1e3,retry:!1});if(!(t!=null&&t.overview))return null;const r=t.overview.total_tokens??{input:0,output:0,cache_read:0,cache_creation:0},a=r.input+r.output+r.cache_read+r.cache_creation,i=t.user_interactions??{user_commands_analyzed:0,avg_tools_per_command:0,total_assistant_steps:0,percentage_requiring_tools:0},o=t.overview.date_range??{start:"",end:""},l=t.models?Object.keys(t.models).length:0,d=(n==null?void 0:n.is_stale)===!0,x=xt(n==null?void 0:n.timestamp),b=x!=null?`Pricing data is ${x} day${x===1?"":"s"} old — last refresh may have failed`:"Pricing data could not be refreshed — costs may be out of date",y=d?e.jsxs("span",{title:b,className:"inline-flex items-center gap-1 ml-auto text-[10px] text-amber-400 bg-amber-500/10 border border-amber-500/30 rounded px-1.5 py-0.5",children:[e.jsx(pe,{size:10}),"stale"]}):null,_=d?`${o.start} - ${o.end} · pricing may be outdated`:`${o.start} - ${o.end}`,D=t.daily_stats?Object.values(t.daily_stats):[],w=D.reduce((O,g)=>O+(g.user_commands??0),0),E=D.reduce((O,g)=>O+(g.interrupted_commands??0),0),Y=w>0?E/w*100:0,G=i.user_commands_analyzed>0?i.total_assistant_steps/i.user_commands_analyzed:0,V=t.cache??{hit_rate:0},z=t.errors??{rate:0};return e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(F,{icon:e.jsx(be,{size:18}),label:"Total Tokens",value:m(a),sublabel:`In: ${m(r.input)} / Out: ${m(r.output)}`}),e.jsx(F,{icon:e.jsx(_e,{size:18}),label:"Total Cost",value:u(t.overview.total_cost??0,s),sublabel:_,badge:y}),e.jsx(F,{icon:e.jsx(ve,{size:18}),label:"Commands",value:m(i.user_commands_analyzed),sublabel:`Avg ${(i.avg_tools_per_command??0).toFixed(1)} tools/cmd`}),e.jsx(F,{icon:e.jsx(Ce,{size:18}),label:"Models Used",value:String(l),sublabel:Object.keys(t.models??{}).slice(0,2).map(Z).join(", ")}),e.jsx(F,{icon:e.jsx(lt,{size:18}),label:"Interruption Rate",value:K(Y),sublabel:`${E} of ${w} commands`}),e.jsx(F,{icon:e.jsx($e,{size:18}),label:"Steps / Command",value:G.toFixed(1),sublabel:`${m(i.total_assistant_steps)} total steps`}),e.jsx(F,{icon:e.jsx(he,{size:18}),label:"Tool Use Rate",value:K(i.percentage_requiring_tools??0),sublabel:`${m(i.commands_requiring_tools??0)} cmds with tools`}),e.jsx(F,{icon:e.jsx(Me,{size:18}),label:"Cache Hit Rate",value:K(V.hit_rate??0),sublabel:z.rate!=null?`Error rate: ${K(z.rate)}`:void 0})]})}const se=t=>fe(t),ut=(t,s)=>[t.toLocaleString(),s];function gt({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,input:a.tokens.input,output:a.tokens.output,cache_read:a.tokens.cache_read,cache_creation:a.tokens.cache_creation})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Daily Token Usage"}):e.jsx(N,{title:"Daily Token Usage",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(Be,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"io",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:se}),e.jsx(j,{yAxisId:"cache",orientation:"right",tick:s.tickMuted,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:se}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,itemStyle:s.tooltipItem,formatter:ut}),e.jsx(S,{wrapperStyle:s.legend}),e.jsx(U,{yAxisId:"io",type:"monotone",dataKey:"input",stackId:"io",stroke:"#818CF8",fill:"#818CF8",fillOpacity:.4,name:"Input Tokens",isAnimationActive:!1}),e.jsx(U,{yAxisId:"io",type:"monotone",dataKey:"output",stackId:"io",stroke:"#34D399",fill:"#34D399",fillOpacity:.4,name:"Output Tokens",isAnimationActive:!1}),e.jsx(U,{yAxisId:"cache",type:"monotone",dataKey:"cache_read",stackId:"cache",stroke:"#F59E0B",fill:"#F59E0B",fillOpacity:.25,name:"Cache Read",isAnimationActive:!1}),e.jsx(U,{yAxisId:"cache",type:"monotone",dataKey:"cache_creation",stackId:"cache",stroke:"#FB923C",fill:"#FB923C",fillOpacity:.25,name:"Cache Creation",isAnimationActive:!1})]})})})}const ht=c.memo(gt),pt={input_cost:"Input Cost",output_cost:"Output Cost",cache_cost:"Cache Cost"},yt={input_cost:"Input",output_cost:"Output",cache_cost:"Cache"},ae=[0,0,0,0],jt=[4,4,0,0],kt=t=>yt[t]??t;function ft({dailyStats:t}){const s=v(),{currency:n}=P(),r=c.useMemo(()=>o=>u(o,n),[n]),a=c.useMemo(()=>(o,l)=>[u(o,n),pt[l]??l],[n]),i=c.useMemo(()=>t?Object.entries(t).map(([o,l])=>{let d=0,x=0,b=0;if(l.cost.by_model)for(const y of Object.values(l.cost.by_model))d+=y.input_cost,x+=y.output_cost,b+=y.cache_creation_cost+y.cache_read_cost;return{date:o,input_cost:d,output_cost:x,cache_cost:b}}).sort((o,l)=>o.date.localeCompare(l.date)):[],[t]);return i.length===0?e.jsx(C,{title:"Daily Cost"}):e.jsx(N,{title:"Daily Cost",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:i,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:r}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:a}),e.jsx(S,{wrapperStyle:s.legend,formatter:kt}),e.jsx(p,{dataKey:"input_cost",stackId:"cost",fill:"#818CF8",radius:ae,name:"input_cost",isAnimationActive:!1}),e.jsx(p,{dataKey:"output_cost",stackId:"cost",fill:"#34D399",radius:ae,name:"output_cost",isAnimationActive:!1}),e.jsx(p,{dataKey:"cache_cost",stackId:"cost",fill:"#F59E0B",radius:jt,name:"cache_cost",isAnimationActive:!1})]})})})}const bt=c.memo(ft),re=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#4ADE80","#FBBF24","#2DD4BF","#F472B6"],_t="#9CA3AF",ne="__other__",Q=9,vt=t=>[t.toLocaleString(),"Tokens"];function Ct({modelStats:t}){const s=v(),n=c.useMemo(()=>{if(!t)return[];const r=Object.entries(t).map(([o,l])=>({name:Z(o),fullName:o,value:l.input_tokens+l.output_tokens+l.cache_read_tokens+l.cache_creation_tokens})).sort((o,l)=>l.value-o.value);if(r.length<=Q)return r;const a=r.slice(0,Q),i=r.slice(Q).reduce((o,l)=>o+l.value,0);return i>0&&a.push({name:"Other",fullName:ne,value:i}),a},[t]);return n.length===0?e.jsx(C,{title:"Token Distribution by Model"}):e.jsx(N,{title:"Token Distribution by Model",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(Ee,{children:[e.jsx(Ue,{data:n,cx:"50%",cy:"50%",innerRadius:55,outerRadius:90,paddingAngle:2,dataKey:"value",isAnimationActive:!1,children:n.map((r,a)=>e.jsx(W,{fill:r.fullName===ne?_t:re[a%re.length]},r.fullName))}),e.jsx(A,{contentStyle:s.tooltipContent,formatter:vt}),e.jsx(S,{wrapperStyle:s.legend,formatter:r=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r})})]})})})}const Nt=c.memo(Ct),Ae={input:"Input Tokens",output:"Output Tokens",cache_read:"Cache Read",cache_creation:"Cache Creation",messages:"Messages"},X=[0,0,0,0],Lt=[2,2,0,0],At=t=>fe(t),wt=(t,s)=>[t.toLocaleString(),Ae[s]??s],Ft=t=>Ae[t]??t;function Tt({hourlyPattern:t}){const s=v(),n=c.useMemo(()=>!(t!=null&&t.tokens)||Object.keys(t.tokens).length===0?[]:Array.from({length:24},(r,a)=>{var l;const i=String(a),o=t.tokens[i];return{hour:a,label:`${a}:00`,input:(o==null?void 0:o.input)??0,output:(o==null?void 0:o.output)??0,cache_read:(o==null?void 0:o.cache_read)??0,cache_creation:(o==null?void 0:o.cache_creation)??0,messages:((l=t.messages)==null?void 0:l[i])??0}}),[t]);return n.length===0?e.jsx(C,{title:"Hourly Token Pattern"}):e.jsx(N,{title:"Hourly Token Pattern",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"label",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,interval:2}),e.jsx(j,{yAxisId:"tokens",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:At}),e.jsx(j,{yAxisId:"messages",orientation:"right",tick:s.tickMuted,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:wt}),e.jsx(S,{wrapperStyle:s.legend,formatter:Ft}),e.jsx(p,{yAxisId:"tokens",dataKey:"input",stackId:"tokens",fill:"#818CF8",fillOpacity:.8,radius:X,name:"input",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"output",stackId:"tokens",fill:"#34D399",fillOpacity:.8,radius:X,name:"output",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"cache_read",stackId:"tokens",fill:"#F59E0B",fillOpacity:.8,radius:X,name:"cache_read",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"cache_creation",stackId:"tokens",fill:"#FB923C",fillOpacity:.8,radius:Lt,name:"cache_creation",isAnimationActive:!1}),e.jsx(te,{yAxisId:"messages",type:"monotone",dataKey:"messages",stroke:s.neutralLine,strokeWidth:1.5,strokeDasharray:"4 2",dot:!1,name:"messages",isAnimationActive:!1})]})})})}const It=c.memo(Tt),ie=["#F87171","#FB923C","#FBBF24","#A78BFA","#818CF8","#38BDF8","#34D399","#F472B6","#6B7280","#E879F9"],$t={left:20},Mt=[0,4,4,0];function Rt({errorCategories:t}){const s=v(),{data:n,total:r}=c.useMemo(()=>{if(!t)return{data:[],total:0};const i=Object.entries(t).filter(([,o])=>o>0).map(([o,l])=>({category:o,count:l})).sort((o,l)=>l.count-o.count);return{data:i,total:i.reduce((o,l)=>o+l.count,0)}},[t]);if(n.length===0)return e.jsx(C,{title:"Error Categories"});const a=i=>[`${i.toLocaleString()} (${(i/r*100).toFixed(1)}%)`,"Errors"];return e.jsx(N,{title:"Error Categories",titleAccessory:e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:[r," total"]}),children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:n,layout:"vertical",margin:$t,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx($,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{type:"category",dataKey:"category",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,width:130}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:a}),e.jsx(p,{dataKey:"count",radius:Mt,isAnimationActive:!1,children:n.map((i,o)=>e.jsx(W,{fill:ie[o%ie.length]},i.category))})]})})})}const Ot=c.memo(Rt),oe=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#2DD4BF","#FCD34D"],St={left:20},Dt=[0,4,4,0],zt=t=>m(t),Bt=t=>[t.toLocaleString(),"Uses"];function Et({toolStats:t}){const s=v(),{data:n,leftMargin:r}=c.useMemo(()=>{if(!t)return{data:[],leftMargin:20};const a=Object.entries(t).map(([o,l])=>({name:o,count:l})).sort((o,l)=>l.count-o.count).slice(0,10),i=a.length?Math.max(...a.map(o=>o.name.length)):0;return{data:a,leftMargin:Math.min(i*6,160)}},[t]);return n.length===0?e.jsx(C,{title:"Top Tools by Usage"}):e.jsx(N,{title:"Top Tools by Usage",children:e.jsx(L,{width:"100%",height:Math.min(420,Math.max(280,n.length*28)),children:e.jsxs(q,{data:n,layout:"vertical",margin:St,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx($,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:zt}),e.jsx(j,{type:"category",dataKey:"name",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,width:r}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:Bt}),e.jsx(p,{dataKey:"count",radius:Dt,isAnimationActive:!1,children:n.map((a,i)=>e.jsx(W,{fill:oe[i%oe.length]},a.name))})]})})})}const Ut=c.memo(Et),le=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8"],Kt=[4,4,0,0],Pt=t=>`${t}%`,Ht=t=>`${t} tool${t==="1"?"":"s"}`,qt=(t,s,n)=>{const{percentage:r,count:a}=(n==null?void 0:n.payload)??{};return[`${r??t}% (${(a??0).toLocaleString()} commands)`,"Share"]};function Wt({toolCountDist:t}){const s=v(),n=c.useMemo(()=>{if(!t||Object.keys(t).length===0)return[];const r={0:0,1:0,2:0,3:0,4:0,"5+":0};for(const[i,o]of Object.entries(t)){const l=parseInt(i,10);if(!isNaN(l))if(l>=5)r["5+"]=(r["5+"]??0)+o;else{const d=String(l);r[d]=(r[d]??0)+o}}const a=Object.values(r).reduce((i,o)=>i+o,0);return a===0?[]:Object.entries(r).map(([i,o])=>({tools:i,count:o,percentage:parseFloat((o/a*100).toFixed(1))}))},[t]);return n.length===0?e.jsx(C,{title:"Commands by Tool Count"}):e.jsx(N,{title:"Commands by Tool Count",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"tools",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,label:{value:"Tools Used",position:"insideBottom",offset:-2,style:{fontSize:10,fill:s.tickMuted.fill}}}),e.jsx(j,{tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Pt,domain:[0,"auto"]}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,labelFormatter:Ht,formatter:qt}),e.jsx(p,{dataKey:"percentage",radius:Kt,isAnimationActive:!1,children:n.map((r,a)=>e.jsx(W,{fill:le[a%le.length]},r.tools))})]})})})}const Yt=c.memo(Wt),ce=[2,2,0,0],Gt={r:5},Vt={r:3,fill:"#F59E0B"},Qt=t=>`${t}%`,Xt=t=>m(t),Jt=(t,s)=>s==="Interruption Rate"?[`${t}%`,s]:[t.toLocaleString(),s],Zt=t=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t});function es({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,interruption_rate:parseFloat(a.interruption_rate.toFixed(1)),user_commands:a.user_commands,interrupted_commands:a.interrupted_commands})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Interruption Rate Over Time"}):e.jsx(N,{title:"Interruption Rate Over Time",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"left",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Qt,domain:[0,"auto"]}),e.jsx(j,{yAxisId:"right",orientation:"right",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Xt}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:Jt}),e.jsx(S,{wrapperStyle:s.legend,formatter:Zt}),e.jsx(p,{yAxisId:"right",dataKey:"user_commands",name:"User Commands",fill:"#818CF8",fillOpacity:.5,radius:ce,isAnimationActive:!1}),e.jsx(p,{yAxisId:"right",dataKey:"interrupted_commands",name:"Interrupted",fill:"#F87171",fillOpacity:.7,radius:ce,isAnimationActive:!1}),e.jsx(te,{yAxisId:"left",type:"monotone",dataKey:"interruption_rate",name:"Interruption Rate",stroke:"#F59E0B",strokeWidth:2,dot:Vt,activeDot:Gt,isAnimationActive:!1})]})})})}const ts=c.memo(es),de=[2,2,0,0],ss={r:5},as={r:3,fill:"#F59E0B"},rs=t=>`${t}%`,ns=t=>m(t),is=(t,s)=>s==="Error Rate"?[`${t}%`,s]:[t.toLocaleString(),s],os=t=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t});function ls({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,error_rate:parseFloat(a.error_rate.toFixed(1)),errors:a.errors,messages:a.messages})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Error Rate Over Time"}):e.jsx(N,{title:"Error Rate Over Time",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"left",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:rs,domain:[0,"auto"]}),e.jsx(j,{yAxisId:"right",orientation:"right",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:ns}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:is}),e.jsx(S,{wrapperStyle:s.legend,formatter:os}),e.jsx(p,{yAxisId:"right",dataKey:"messages",name:"Messages",fill:"#818CF8",fillOpacity:.4,radius:de,isAnimationActive:!1}),e.jsx(p,{yAxisId:"right",dataKey:"errors",name:"Errors",fill:"#F87171",fillOpacity:.7,radius:de,isAnimationActive:!1}),e.jsx(te,{yAxisId:"left",type:"monotone",dataKey:"error_rate",name:"Error Rate",stroke:"#F59E0B",strokeWidth:2,dot:as,activeDot:ss,isAnimationActive:!1})]})})})}const cs=c.memo(ls),ds={ok:"green",warn:"yellow",over:"red"};function xs(t){return t==="over"?"bg-red-500":t==="warn"?"bg-yellow-500":"bg-green-500"}function ms(t,s){return t==="over"||(s.crossed_threshold??0)>=100?{bg:"bg-red-50 dark:bg-red-950/30",text:"text-red-800 dark:text-red-300",border:"border-red-200 dark:border-red-900"}:{bg:"bg-amber-50 dark:bg-amber-950/30",text:"text-amber-800 dark:text-amber-300",border:"border-amber-200 dark:border-amber-900"}}function xe(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function us(){const{currency:t}=P(),{data:s,isLoading:n}=B({queryKey:["plan"],queryFn:Fe,staleTime:5*6e4});if(n||!s||!s.plan||!s.usage)return null;const{plan:r,usage:a}=s,i=s.projection??null,o=Math.min(100,Math.max(0,a.pct)),l=(i==null?void 0:i.projected_month_end_usd)??a.projected,d=i!=null&&i.alert?ms(a.status,i):null;return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(it,{size:16,className:"text-gray-500 flex-shrink-0"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate",children:r.name}),e.jsx(H,{color:ds[a.status],size:"sm",children:a.status==="ok"?"on track":a.status==="warn"?"warning":"over budget"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[e.jsx(Le,{size:12}),e.jsxs("span",{children:[xe(a.period_start)," — ",xe(a.period_end)]}),e.jsx("span",{className:"text-gray-400",children:"·"}),e.jsxs("span",{children:["day ",a.days_so_far,"/",a.days_in_period]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-2 bg-gray-200 dark:bg-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${xs(a.status)} transition-all`,style:{width:`${o}%`},"aria-label":`${a.pct.toFixed(1)}% of budget used`})}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:u(a.used,t)})," ","of ",u(a.budget,t)]}),e.jsxs("span",{className:"tabular-nums",children:[a.pct.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-4 pt-3 border-t border-gray-100 dark:border-gray-800",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Remaining"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(a.remaining,t)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Projected"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(l,t)}),i&&e.jsx("div",{className:"text-[10px] text-gray-400 mt-0.5",children:i.projection_method==="weighted-7d"?"weighted 7d":"linear"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Budget"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(r.monthly_usd,t)})]})]}),i&&(i.daily_burn_usd>0||i.days_to_limit!==null)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-800 flex items-center justify-between text-xs text-gray-500",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300 tabular-nums",children:u(i.daily_burn_usd,t)})," ","/ day burn"]}),i.days_to_limit!==null&&e.jsxs("span",{className:"tabular-nums",children:["~",i.days_to_limit," day",i.days_to_limit===1?"":"s"," to limit"]})]}),(i==null?void 0:i.alert)&&d&&e.jsxs("div",{className:`mt-3 px-3 py-2 rounded-md border text-xs flex items-center gap-2 ${d.bg} ${d.text} ${d.border}`,role:"status",children:[e.jsx(pe,{size:14,className:"flex-shrink-0"}),e.jsx("span",{children:i.alert})]})]})}function gs({rec:t,currency:s}){const n=t.estimated_monthly_delta_usd,r=(n??t.window_delta_usd)<0;return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r?e.jsx(Re,{size:16,className:"flex-shrink-0 text-emerald-600 dark:text-emerald-400"}):e.jsx(Ke,{size:16,className:"flex-shrink-0 text-amber-600 dark:text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:t.work_type}),e.jsx(H,{color:r?"green":"orange",size:"sm",children:r?"saving":"quality investment"})]}),n!==null&&e.jsxs("span",{className:`text-sm font-semibold tabular-nums flex-shrink-0 ${r?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"}`,children:[r?"−":"+",u(Math.abs(n),s),"/mo"]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 font-mono",children:[e.jsx("span",{className:"truncate",children:t.from_model}),e.jsx(Pe,{size:12,className:"flex-shrink-0 text-gray-400"}),e.jsx("span",{className:"truncate font-semibold",children:t.to_label})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:t.rationale}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-500 tabular-nums",children:[e.jsxs("span",{children:["window: ",u(t.window_cost_usd,s)," →"," ",u(t.candidate_window_cost_usd,s)]}),e.jsxs("span",{children:[m(t.evidence.events)," events"]}),e.jsxs("span",{children:[m(t.evidence.sessions)," sessions"]}),t.evidence.reasoning_tokens>0&&e.jsxs("span",{children:[(t.evidence.reasoning_share*100).toFixed(1),"% reasoning"]}),t.evidence.avg_quality_score!==null&&e.jsxs("span",{children:["quality ",t.evidence.avg_quality_score.toFixed(1),"/5 (n=",t.evidence.graded_sessions,")"]})]}),t.caveats.length>0&&e.jsx("ul",{className:"mt-2 space-y-0.5",children:t.caveats.map((a,i)=>e.jsxs("li",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:["⚠ ",a]},i))})]})}function hs(t){return t.startsWith("+++")||t.startsWith("---")?"text-gray-500 dark:text-gray-400 font-semibold":t.startsWith("@@")?"text-indigo-600 dark:text-indigo-400":t.startsWith("+")?"text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20":t.startsWith("-")?"text-rose-700 dark:text-rose-400 bg-rose-50 dark:bg-rose-900/20":"text-gray-600 dark:text-gray-400"}function me({text:t,label:s}){const[n,r]=c.useState(!1),a=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return e.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800",children:[n?e.jsx(Ye,{size:12,className:"text-emerald-500"}):e.jsx(Ge,{size:12}),n?"Copied":s]})}function ps(t,s){const n=new Blob([s],{type:"text/markdown"}),r=URL.createObjectURL(n),a=document.createElement("a");a.href=r,a.download=t,a.click(),URL.revokeObjectURL(r)}function ys({preview:t,currency:s}){const[n,r]=c.useState(!1),a=t.preview_diff.split(` -`);return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[e.jsxs("div",{className:"px-4 py-3 flex items-start justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(He,{size:16,className:"flex-shrink-0 text-gray-500"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:["Slimmer ",t.source_path??t.file_label]}),e.jsxs("div",{className:"text-[11px] text-gray-500 tabular-nums",children:["~",m(t.original_tokens)," → ~",m(t.slimmed_tokens)," ","tokens · saves ~",m(t.tokens_saved)," tokens/session"]})]})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-sm font-semibold text-emerald-600 dark:text-emerald-400 tabular-nums",children:["~",u(t.estimated_savings_usd_monthly,s),"/mo"]}),e.jsxs("div",{className:"text-[11px] text-gray-500",children:["at ",t.sessions_per_month," sessions/mo (estimate)"]})]})]}),t.rationale.length>0&&e.jsx("ul",{className:"px-4 pb-2 space-y-1",children:t.rationale.map((i,o)=>e.jsxs("li",{className:"text-xs text-gray-600 dark:text-gray-400 flex gap-2",children:[e.jsxs("span",{className:"text-gray-400 tabular-nums flex-shrink-0 w-24 text-right",children:["−",m(i.tokens_saved)," tok"]}),e.jsx("span",{children:i.summary})]},`${i.rule}-${o}`))}),e.jsxs("div",{className:"px-4 py-2.5 border-t border-gray-100 dark:border-gray-800 flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",onClick:()=>r(!n),className:"inline-flex items-center gap-1 text-[11px] text-indigo-600 dark:text-indigo-400 hover:underline","aria-expanded":n,children:[n?e.jsx(ye,{size:12}):e.jsx(je,{size:12}),n?"Hide diff":"Show diff"]}),e.jsx("div",{className:"flex-1"}),e.jsx(me,{text:t.slimmed_text,label:"Copy slimmed CLAUDE.md"}),e.jsx(me,{text:t.preview_diff,label:"Copy diff"}),e.jsxs("button",{type:"button",onClick:()=>ps("CLAUDE.slim.md",t.slimmed_text),className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800",children:[e.jsx(qe,{size:12}),"Download"]})]}),n&&e.jsx("pre",{className:"mx-4 mb-3 p-3 rounded bg-gray-50 dark:bg-gray-950 border border-gray-100 dark:border-gray-800 overflow-x-auto text-[11px] leading-relaxed",children:a.map((i,o)=>e.jsx("div",{className:hs(i),children:i||" "},o))}),e.jsx("div",{className:"px-4 pb-3 text-[11px] text-gray-400 dark:text-gray-500",children:"Preview only — nothing is written for you. Review, then copy or download to apply."})]})}function js(){var o,l;const{data:t,isLoading:s,error:n}=B({queryKey:["optimize","prescriptions"],queryFn:()=>Te(),staleTime:3e5});if(s||n||!t)return null;const r=((o=t.routing)==null?void 0:o.recommendations)??[],a=t.claudemd_previews??[];if(r.length===0&&a.length===0)return null;const i=((l=t.routing)==null?void 0:l.caveats)??[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{size:16,className:"text-gray-500"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Prescriptions"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.length+a.length," suggested action",r.length+a.length===1?"":"s"," · ",t.scope]})]}),r.length>0&&e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:r.map((d,x)=>e.jsx(gs,{rec:d,currency:t.currency},`${d.rec_id}-${d.from_model}-${x}`))}),a.map((d,x)=>e.jsx(ys,{preview:d,currency:t.currency},`${d.file_label}-${x}`)),r.length>0&&i.length>0&&e.jsx("ul",{className:"space-y-0.5",children:i.map((d,x)=>e.jsx("li",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:d},x))})]})}const ue=5,ks={high:"red",medium:"yellow",low:"gray"};function fs({finding:t}){return e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 dark:border-gray-800 flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 pt-0.5",children:e.jsx(H,{color:ks[t.severity],size:"sm",children:t.severity})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t.title}),e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums",children:[t.affected_count," affected"]}),t.estimated_waste_usd!==null&&t.estimated_waste_usd>0&&e.jsxs("span",{className:"text-[11px] font-medium text-rose-600 dark:text-rose-400 tabular-nums",children:["· ~",u(t.estimated_waste_usd)," wasted"]}),t.estimated_waste_tokens!==null&&t.estimated_waste_tokens>0&&e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums",children:["· ~",m(t.estimated_waste_tokens)," tokens"]})]}),t.description&&e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:t.description}),t.suggested_fix&&e.jsxs("p",{className:"text-xs text-gray-700 dark:text-gray-300 mt-1.5 flex items-start gap-1.5",children:[e.jsx(tt,{size:12,className:"flex-shrink-0 text-yellow-500 mt-0.5"}),e.jsx("span",{children:t.suggested_fix})]})]})]})}function bs(){return e.jsxs(e.Fragment,{children:[e.jsx(_s,{}),e.jsx(js,{})]})}function _s(){const[t,s]=c.useState(!1),{filters:n}=J(),{data:r,isLoading:a,error:i}=B({queryKey:["optimize","month",n.providers,n.models],queryFn:()=>ke("month",{providers:n.providers,models:n.models}),staleTime:5*6e4});if(a||i||!r)return null;const o=r.patterns??[],l=o.length,d=t?o:o.slice(0,ue),x=Math.max(0,l-ue),b=r.total_waste_usd??0;return l===0?null:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>s(!t),className:"w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-800/40","aria-expanded":t,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t?e.jsx(ye,{size:14,className:"text-gray-500"}):e.jsx(je,{size:14,className:"text-gray-500"}),e.jsx(Ze,{size:16,className:"text-gray-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Optimization findings"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[l," pattern",l===1?"":"s"," detected · ",r.scope]})]}),b>0&&e.jsxs("span",{className:"text-xs font-semibold text-rose-600 dark:text-rose-400 tabular-nums",children:["~",u(b)," identified"]})]}),e.jsx("div",{children:d.map((y,_)=>e.jsx(fs,{finding:y},`${y.pattern_id}-${_}`))}),x>0&&e.jsx("button",{type:"button",onClick:()=>s(!0),disabled:t,className:"w-full px-4 py-2.5 text-xs text-indigo-600 dark:text-indigo-400 hover:bg-gray-50 dark:hover:bg-gray-800/40 border-t border-gray-100 dark:border-gray-800 disabled:text-gray-400 disabled:cursor-default",children:t?`Showing all ${l}`:`View all ${l} findings`})]})}const vs=6;function Cs({anomaly:t}){var i;const s=t.kind==="day",n=s?Le:Ne,r=s?t.key:`${t.key.slice(0,8)}…`,a=typeof((i=t.details)==null?void 0:i.model)=="string"?t.details.model:null;return e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 dark:border-gray-800 flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 pt-0.5 text-gray-400",children:e.jsx(n,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:r}),e.jsx(H,{color:"red",size:"sm",children:u(t.cost_usd)}),t.ratio!==null&&t.ratio>=1.5&&e.jsxs("span",{className:"text-[11px] text-rose-600 dark:text-rose-400 tabular-nums",children:[t.ratio.toFixed(1),"× baseline"]}),a&&e.jsx("span",{className:"text-[11px] text-gray-500 truncate max-w-[40%]",children:a})]}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:t.reason})]})]})}function Ns(){var l,d;const{filters:t}=J(),{data:s,isLoading:n,error:r}=B({queryKey:["optimize","month",t.providers,t.models],queryFn:()=>ke("month",{providers:t.providers,models:t.models}),staleTime:5*6e4});if(n||r||!s)return null;const a=((l=s.anomalies)==null?void 0:l.anomalies)??[];if(a.length===0)return null;const i=a.slice(0,vs),o=((d=s.anomalies)==null?void 0:d.day_count)??0;return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"w-full flex items-center justify-between gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{size:16,className:"text-rose-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Cost anomalies"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[a.length," outlier",a.length===1?"":"s"," · ",s.scope]})]}),o>0&&e.jsxs("span",{className:"text-[11px] text-gray-400 tabular-nums",children:["vs ",o,"-day baseline"]})]}),e.jsx("div",{children:i.map(x=>e.jsx(Cs,{anomaly:x},`${x.kind}-${x.key}`))})]})}const Ls=c.memo(Ns);function ge(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const M={},As={messages:{},tokens:{}};function k({icon:t,label:s,value:n,sublabel:r,color:a="text-gray-600 dark:text-gray-400"}){return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-3 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:a,children:t}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:s})]}),e.jsx("div",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:n}),r&&e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:r})]})}function Ys({stats:t}){var z,O;const{currency:s}=P(),{queryString:n}=J(),[r,a]=c.useState(t.trends??null),[i,o]=c.useState({});c.useEffect(()=>{if(t.trends){a(t.trends);return}let g=!1;return fetch("/api/cost-data").then(f=>f.ok?f.json():null).then(f=>{if(g||!f)return;const h=f.trends;h&&h.current_week&&h.prior_week&&h.delta_pct&&a(h)}).catch(()=>{}),()=>{g=!0}},[t.trends]),c.useEffect(()=>{let g=!1;const f=n?`?${n.slice(1)}`:"";return fetch(`/api/tool-distribution${f}`).then(h=>h.ok?h.json():null).then(h=>{g||!h||o(h.tool_count_distribution??{})}).catch(()=>{}),()=>{g=!0}},[n]);const l=c.useCallback(()=>{We("cost")},[]),d=c.useMemo(()=>{var f,h;const g=((f=t.overview)==null?void 0:f.total_tokens)??{input:0,output:0,cache_read:0,cache_creation:0};return((h=t.token_composition)==null?void 0:h.totals)??{input:g.input,output:g.output,cache_read:g.cache_read,cache_creation:g.cache_creation}},[t.token_composition,t.overview]);if(!(t!=null&&t.overview))return null;const x=t.overview.total_tokens??{input:0,output:0,cache_read:0,cache_creation:0},b=x.input+x.output+x.cache_read+x.cache_creation,y=t.user_interactions??{user_commands_analyzed:0,avg_tools_per_command:0},_=t.overview.date_range??{start:"",end:""},D=t.models??{},w=t.overview.message_types??{},E=w.user??0,Y=w.assistant??0,G=w.tool_use??0,V=w.tool_result??0;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(us,{}),e.jsx(Oe,{trends:r,endDate:_.end||void 0,onTileClick:l}),e.jsx(mt,{stats:t}),e.jsx(bs,{}),e.jsx(Ls,{}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(Se,{cache:t.cache,dailyStats:t.daily_stats}),e.jsx(De,{totals:d})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",children:[e.jsx(k,{icon:e.jsx(be,{size:14}),label:"Total Tokens",value:m(b),color:"text-gray-600 dark:text-gray-400"}),e.jsx(k,{icon:e.jsx(_e,{size:14}),label:"Total Cost",value:u(t.overview.total_cost??0,s),color:"text-green-400"}),e.jsx(k,{icon:e.jsx(ve,{size:14}),label:"Commands Analyzed",value:m(y.user_commands_analyzed),color:"text-cyan-400"}),e.jsx(k,{icon:e.jsx(Ce,{size:14}),label:"Total Messages",value:m(t.overview.total_messages??0),color:"text-violet-400"}),e.jsx(k,{icon:e.jsx(Qe,{size:14}),label:"Avg Tools/Cmd",value:(y.avg_tools_per_command??0).toFixed(1),color:"text-blue-400"}),e.jsx(k,{icon:e.jsx(rt,{size:14}),label:"Models Used",value:String(Object.keys(D).length),sublabel:Object.keys(D).slice(0,2).map(Z).join(", "),color:"text-pink-400"}),e.jsx(k,{icon:e.jsx(Ve,{size:14}),label:"User Messages",value:m(E),color:"text-indigo-400"}),e.jsx(k,{icon:e.jsx(Xe,{size:14}),label:"Assistant Messages",value:m(Y),color:"text-emerald-400"}),e.jsx(k,{icon:e.jsx(he,{size:14}),label:"Tool Use",value:m(G),color:"text-amber-400"}),e.jsx(k,{icon:e.jsx(Ne,{size:14}),label:"Tool Results",value:m(V),color:"text-cyan-400"}),e.jsx(k,{icon:e.jsx(ze,{size:14}),label:"Date Range",value:_.start?ge(_.start):"N/A",sublabel:_.end?`to ${ge(_.end)}`:"",color:"text-gray-600 dark:text-gray-400"})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[e.jsx(ht,{dailyStats:t.daily_stats??M}),e.jsx(bt,{dailyStats:t.daily_stats??M}),e.jsx(Ut,{toolStats:((z=t.tools)==null?void 0:z.usage_counts)??M}),e.jsx(Nt,{modelStats:t.models??M}),e.jsx(It,{hourlyPattern:t.hourly_pattern??As}),e.jsx(Yt,{toolCountDist:i}),e.jsx(ts,{dailyStats:t.daily_stats??M}),e.jsx(Ot,{errorCategories:((O=t.errors)==null?void 0:O.by_category)??M}),e.jsx(cs,{dailyStats:t.daily_stats??M})]})]})}export{Ys as default}; + */const ct=[["path",{d:"M6 19v-16h4.5a4.5 4.5 0 1 1 0 9h-4.5",key:"svg-0"}],["path",{d:"M19 21l-9 -9",key:"svg-1"}],["path",{d:"M13 21l6 -6",key:"svg-2"}]],dt=R("outline","prescription","Prescription",ct);function K(t){return Number.isFinite(t)?`${t.toFixed(1)}%`:"0.0%"}function xt(t){if(!t)return null;const s=new Date(t).getTime();if(Number.isNaN(s))return null;const n=Date.now()-s;return Math.max(0,Math.floor(n/(1e3*60*60*24)))}function F({icon:t,label:s,value:n,sublabel:r,badge:a}){return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:s}),a]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:n}),r&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:r})]})}function mt({stats:t}){const{currency:s}=P(),{data:n}=B({queryKey:["pricing"],queryFn:we,staleTime:3600*1e3,retry:!1});if(!(t!=null&&t.overview))return null;const r=t.overview.total_tokens??{input:0,output:0,cache_read:0,cache_creation:0},a=r.input+r.output+r.cache_read+r.cache_creation,i=t.user_interactions??{user_commands_analyzed:0,avg_tools_per_command:0,total_assistant_steps:0,percentage_requiring_tools:0},o=t.overview.date_range??{start:"",end:""},l=t.models?Object.keys(t.models).length:0,d=(n==null?void 0:n.is_stale)===!0,x=xt(n==null?void 0:n.timestamp),b=x!=null?`Pricing data is ${x} day${x===1?"":"s"} old — last refresh may have failed`:"Pricing data could not be refreshed — costs may be out of date",y=d?e.jsxs("span",{title:b,className:"inline-flex items-center gap-1 ml-auto text-[10px] text-amber-400 bg-amber-500/10 border border-amber-500/30 rounded px-1.5 py-0.5",children:[e.jsx(pe,{size:10}),"stale"]}):null,_=d?`${o.start} - ${o.end} · pricing may be outdated`:`${o.start} - ${o.end}`,D=t.daily_stats?Object.values(t.daily_stats):[],w=D.reduce((O,g)=>O+(g.user_commands??0),0),E=D.reduce((O,g)=>O+(g.interrupted_commands??0),0),Y=w>0?E/w*100:0,G=i.user_commands_analyzed>0?i.total_assistant_steps/i.user_commands_analyzed:0,V=t.cache??{hit_rate:0},z=t.errors??{rate:0};return e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(F,{icon:e.jsx(be,{size:18}),label:"Total Tokens",value:m(a),sublabel:`In: ${m(r.input)} / Out: ${m(r.output)}`}),e.jsx(F,{icon:e.jsx(_e,{size:18}),label:"Total Cost",value:u(t.overview.total_cost??0,s),sublabel:_,badge:y}),e.jsx(F,{icon:e.jsx(ve,{size:18}),label:"Commands",value:m(i.user_commands_analyzed),sublabel:`Avg ${(i.avg_tools_per_command??0).toFixed(1)} tools/cmd`}),e.jsx(F,{icon:e.jsx(Ce,{size:18}),label:"Models Used",value:String(l),sublabel:Object.keys(t.models??{}).slice(0,2).map(Z).join(", ")}),e.jsx(F,{icon:e.jsx(lt,{size:18}),label:"Interruption Rate",value:K(Y),sublabel:`${E} of ${w} commands`}),e.jsx(F,{icon:e.jsx($e,{size:18}),label:"Steps / Command",value:G.toFixed(1),sublabel:`${m(i.total_assistant_steps)} total steps`}),e.jsx(F,{icon:e.jsx(he,{size:18}),label:"Tool Use Rate",value:K(i.percentage_requiring_tools??0),sublabel:`${m(i.commands_requiring_tools??0)} cmds with tools`}),e.jsx(F,{icon:e.jsx(ze,{size:18}),label:"Cache Hit Rate",value:K(V.hit_rate??0),sublabel:z.rate!=null?`Error rate: ${K(z.rate)}`:void 0})]})}const se=t=>ke(t),ut=(t,s)=>[t.toLocaleString(),s];function gt({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,input:a.tokens.input,output:a.tokens.output,cache_read:a.tokens.cache_read,cache_creation:a.tokens.cache_creation})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Daily Token Usage"}):e.jsx(N,{title:"Daily Token Usage",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(Be,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"io",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:se}),e.jsx(j,{yAxisId:"cache",orientation:"right",tick:s.tickMuted,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:se}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,itemStyle:s.tooltipItem,formatter:ut}),e.jsx(S,{wrapperStyle:s.legend}),e.jsx(U,{yAxisId:"io",type:"monotone",dataKey:"input",stackId:"io",stroke:"#818CF8",fill:"#818CF8",fillOpacity:.4,name:"Input Tokens",isAnimationActive:!1}),e.jsx(U,{yAxisId:"io",type:"monotone",dataKey:"output",stackId:"io",stroke:"#34D399",fill:"#34D399",fillOpacity:.4,name:"Output Tokens",isAnimationActive:!1}),e.jsx(U,{yAxisId:"cache",type:"monotone",dataKey:"cache_read",stackId:"cache",stroke:"#F59E0B",fill:"#F59E0B",fillOpacity:.25,name:"Cache Read",isAnimationActive:!1}),e.jsx(U,{yAxisId:"cache",type:"monotone",dataKey:"cache_creation",stackId:"cache",stroke:"#FB923C",fill:"#FB923C",fillOpacity:.25,name:"Cache Creation",isAnimationActive:!1})]})})})}const ht=c.memo(gt),pt={input_cost:"Input Cost",output_cost:"Output Cost",cache_cost:"Cache Cost"},yt={input_cost:"Input",output_cost:"Output",cache_cost:"Cache"},ae=[0,0,0,0],jt=[4,4,0,0],ft=t=>yt[t]??t;function kt({dailyStats:t}){const s=v(),{currency:n}=P(),r=c.useMemo(()=>o=>u(o,n),[n]),a=c.useMemo(()=>(o,l)=>[u(o,n),pt[l]??l],[n]),i=c.useMemo(()=>t?Object.entries(t).map(([o,l])=>{let d=0,x=0,b=0;if(l.cost.by_model)for(const y of Object.values(l.cost.by_model))d+=y.input_cost,x+=y.output_cost,b+=y.cache_creation_cost+y.cache_read_cost;return{date:o,input_cost:d,output_cost:x,cache_cost:b}}).sort((o,l)=>o.date.localeCompare(l.date)):[],[t]);return i.length===0?e.jsx(C,{title:"Daily Cost"}):e.jsx(N,{title:"Daily Cost",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:i,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:r}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:a}),e.jsx(S,{wrapperStyle:s.legend,formatter:ft}),e.jsx(p,{dataKey:"input_cost",stackId:"cost",fill:"#818CF8",radius:ae,name:"input_cost",isAnimationActive:!1}),e.jsx(p,{dataKey:"output_cost",stackId:"cost",fill:"#34D399",radius:ae,name:"output_cost",isAnimationActive:!1}),e.jsx(p,{dataKey:"cache_cost",stackId:"cost",fill:"#F59E0B",radius:jt,name:"cache_cost",isAnimationActive:!1})]})})})}const bt=c.memo(kt),re=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#4ADE80","#FBBF24","#2DD4BF","#F472B6"],_t="#9CA3AF",ne="__other__",Q=9,vt=t=>[t.toLocaleString(),"Tokens"];function Ct({modelStats:t}){const s=v(),n=c.useMemo(()=>{if(!t)return[];const r=Object.entries(t).map(([o,l])=>({name:Z(o),fullName:o,value:l.input_tokens+l.output_tokens+l.cache_read_tokens+l.cache_creation_tokens})).sort((o,l)=>l.value-o.value);if(r.length<=Q)return r;const a=r.slice(0,Q),i=r.slice(Q).reduce((o,l)=>o+l.value,0);return i>0&&a.push({name:"Other",fullName:ne,value:i}),a},[t]);return n.length===0?e.jsx(C,{title:"Token Distribution by Model"}):e.jsx(N,{title:"Token Distribution by Model",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(Ee,{children:[e.jsx(Ue,{data:n,cx:"50%",cy:"50%",innerRadius:55,outerRadius:90,paddingAngle:2,dataKey:"value",isAnimationActive:!1,children:n.map((r,a)=>e.jsx(W,{fill:r.fullName===ne?_t:re[a%re.length]},r.fullName))}),e.jsx(A,{contentStyle:s.tooltipContent,formatter:vt}),e.jsx(S,{wrapperStyle:s.legend,formatter:r=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r})})]})})})}const Nt=c.memo(Ct),Ae={input:"Input Tokens",output:"Output Tokens",cache_read:"Cache Read",cache_creation:"Cache Creation",messages:"Messages"},X=[0,0,0,0],Lt=[2,2,0,0],At=t=>ke(t),wt=(t,s)=>[t.toLocaleString(),Ae[s]??s],Ft=t=>Ae[t]??t;function Tt({hourlyPattern:t}){const s=v(),n=c.useMemo(()=>!(t!=null&&t.tokens)||Object.keys(t.tokens).length===0?[]:Array.from({length:24},(r,a)=>{var l;const i=String(a),o=t.tokens[i];return{hour:a,label:`${a}:00`,input:(o==null?void 0:o.input)??0,output:(o==null?void 0:o.output)??0,cache_read:(o==null?void 0:o.cache_read)??0,cache_creation:(o==null?void 0:o.cache_creation)??0,messages:((l=t.messages)==null?void 0:l[i])??0}}),[t]);return n.length===0?e.jsx(C,{title:"Hourly Token Pattern"}):e.jsx(N,{title:"Hourly Token Pattern",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"label",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,interval:2}),e.jsx(j,{yAxisId:"tokens",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:At}),e.jsx(j,{yAxisId:"messages",orientation:"right",tick:s.tickMuted,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:wt}),e.jsx(S,{wrapperStyle:s.legend,formatter:Ft}),e.jsx(p,{yAxisId:"tokens",dataKey:"input",stackId:"tokens",fill:"#818CF8",fillOpacity:.8,radius:X,name:"input",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"output",stackId:"tokens",fill:"#34D399",fillOpacity:.8,radius:X,name:"output",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"cache_read",stackId:"tokens",fill:"#F59E0B",fillOpacity:.8,radius:X,name:"cache_read",isAnimationActive:!1}),e.jsx(p,{yAxisId:"tokens",dataKey:"cache_creation",stackId:"tokens",fill:"#FB923C",fillOpacity:.8,radius:Lt,name:"cache_creation",isAnimationActive:!1}),e.jsx(te,{yAxisId:"messages",type:"monotone",dataKey:"messages",stroke:s.neutralLine,strokeWidth:1.5,strokeDasharray:"4 2",dot:!1,name:"messages",isAnimationActive:!1})]})})})}const It=c.memo(Tt),ie=["#F87171","#FB923C","#FBBF24","#A78BFA","#818CF8","#38BDF8","#34D399","#F472B6","#6B7280","#E879F9"],$t={left:20},Mt=[0,4,4,0];function Rt({errorCategories:t}){const s=v(),{data:n,total:r}=c.useMemo(()=>{if(!t)return{data:[],total:0};const i=Object.entries(t).filter(([,o])=>o>0).map(([o,l])=>({category:o,count:l})).sort((o,l)=>l.count-o.count);return{data:i,total:i.reduce((o,l)=>o+l.count,0)}},[t]);if(n.length===0)return e.jsx(C,{title:"Error Categories"});const a=i=>[`${i.toLocaleString()} (${(i/r*100).toFixed(1)}%)`,"Errors"];return e.jsx(N,{title:"Error Categories",titleAccessory:e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:[r," total"]}),children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:n,layout:"vertical",margin:$t,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx($,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{type:"category",dataKey:"category",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,width:130}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:a}),e.jsx(p,{dataKey:"count",radius:Mt,isAnimationActive:!1,children:n.map((i,o)=>e.jsx(W,{fill:ie[o%ie.length]},i.category))})]})})})}const Ot=c.memo(Rt),oe=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8","#FB923C","#E879F9","#2DD4BF","#FCD34D"],St={left:20},Dt=[0,4,4,0],zt=t=>m(t),Bt=t=>[t.toLocaleString(),"Uses"];function Et({toolStats:t}){const s=v(),{data:n,leftMargin:r}=c.useMemo(()=>{if(!t)return{data:[],leftMargin:20};const a=Object.entries(t).map(([o,l])=>({name:o,count:l})).sort((o,l)=>l.count-o.count).slice(0,10),i=a.length?Math.max(...a.map(o=>o.name.length)):0;return{data:a,leftMargin:Math.min(i*6,160)}},[t]);return n.length===0?e.jsx(C,{title:"Top Tools by Usage"}):e.jsx(N,{title:"Top Tools by Usage",children:e.jsx(L,{width:"100%",height:Math.min(420,Math.max(280,n.length*28)),children:e.jsxs(q,{data:n,layout:"vertical",margin:St,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid,horizontal:!1}),e.jsx($,{type:"number",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:zt}),e.jsx(j,{type:"category",dataKey:"name",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,width:r}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:Bt}),e.jsx(p,{dataKey:"count",radius:Dt,isAnimationActive:!1,children:n.map((a,i)=>e.jsx(W,{fill:oe[i%oe.length]},a.name))})]})})})}const Ut=c.memo(Et),le=["#818CF8","#34D399","#F59E0B","#F87171","#A78BFA","#38BDF8"],Kt=[4,4,0,0],Pt=t=>`${t}%`,Ht=t=>`${t} tool${t==="1"?"":"s"}`,qt=(t,s,n)=>{const{percentage:r,count:a}=(n==null?void 0:n.payload)??{};return[`${r??t}% (${(a??0).toLocaleString()} commands)`,"Share"]};function Wt({toolCountDist:t}){const s=v(),n=c.useMemo(()=>{if(!t||Object.keys(t).length===0)return[];const r={0:0,1:0,2:0,3:0,4:0,"5+":0};for(const[i,o]of Object.entries(t)){const l=parseInt(i,10);if(!isNaN(l))if(l>=5)r["5+"]=(r["5+"]??0)+o;else{const d=String(l);r[d]=(r[d]??0)+o}}const a=Object.values(r).reduce((i,o)=>i+o,0);return a===0?[]:Object.entries(r).map(([i,o])=>({tools:i,count:o,percentage:parseFloat((o/a*100).toFixed(1))}))},[t]);return n.length===0?e.jsx(C,{title:"Commands by Tool Count"}):e.jsx(N,{title:"Commands by Tool Count",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(q,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"tools",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,label:{value:"Tools Used",position:"insideBottom",offset:-2,style:{fontSize:10,fill:s.tickMuted.fill}}}),e.jsx(j,{tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Pt,domain:[0,"auto"]}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,labelFormatter:Ht,formatter:qt}),e.jsx(p,{dataKey:"percentage",radius:Kt,isAnimationActive:!1,children:n.map((r,a)=>e.jsx(W,{fill:le[a%le.length]},r.tools))})]})})})}const Yt=c.memo(Wt),ce=[2,2,0,0],Gt={r:5},Vt={r:3,fill:"#F59E0B"},Qt=t=>`${t}%`,Xt=t=>m(t),Jt=(t,s)=>s==="Interruption Rate"?[`${t}%`,s]:[t.toLocaleString(),s],Zt=t=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t});function es({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,interruption_rate:parseFloat(a.interruption_rate.toFixed(1)),user_commands:a.user_commands,interrupted_commands:a.interrupted_commands})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Interruption Rate Over Time"}):e.jsx(N,{title:"Interruption Rate Over Time",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"left",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Qt,domain:[0,"auto"]}),e.jsx(j,{yAxisId:"right",orientation:"right",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:Xt}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:Jt}),e.jsx(S,{wrapperStyle:s.legend,formatter:Zt}),e.jsx(p,{yAxisId:"right",dataKey:"user_commands",name:"User Commands",fill:"#818CF8",fillOpacity:.5,radius:ce,isAnimationActive:!1}),e.jsx(p,{yAxisId:"right",dataKey:"interrupted_commands",name:"Interrupted",fill:"#F87171",fillOpacity:.7,radius:ce,isAnimationActive:!1}),e.jsx(te,{yAxisId:"left",type:"monotone",dataKey:"interruption_rate",name:"Interruption Rate",stroke:"#F59E0B",strokeWidth:2,dot:Vt,activeDot:Gt,isAnimationActive:!1})]})})})}const ts=c.memo(es),de=[2,2,0,0],ss={r:5},as={r:3,fill:"#F59E0B"},rs=t=>`${t}%`,ns=t=>m(t),is=(t,s)=>s==="Error Rate"?[`${t}%`,s]:[t.toLocaleString(),s],os=t=>e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:t});function ls({dailyStats:t}){const s=v(),n=c.useMemo(()=>t?Object.entries(t).map(([r,a])=>({date:r,error_rate:parseFloat(a.error_rate.toFixed(1)),errors:a.errors,messages:a.messages})).sort((r,a)=>r.date.localeCompare(a.date)):[],[t]);return n.length===0?e.jsx(C,{title:"Error Rate Over Time"}):e.jsx(N,{title:"Error Rate Over Time",children:e.jsx(L,{width:"100%",height:T,children:e.jsxs(ee,{data:n,children:[e.jsx(I,{strokeDasharray:"3 3",stroke:s.grid}),e.jsx($,{dataKey:"date",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine}),e.jsx(j,{yAxisId:"left",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:rs,domain:[0,"auto"]}),e.jsx(j,{yAxisId:"right",orientation:"right",tick:s.tick,tickLine:s.axisLine,axisLine:s.axisLine,tickFormatter:ns}),e.jsx(A,{contentStyle:s.tooltipContent,labelStyle:s.tooltipLabel,formatter:is}),e.jsx(S,{wrapperStyle:s.legend,formatter:os}),e.jsx(p,{yAxisId:"right",dataKey:"messages",name:"Messages",fill:"#818CF8",fillOpacity:.4,radius:de,isAnimationActive:!1}),e.jsx(p,{yAxisId:"right",dataKey:"errors",name:"Errors",fill:"#F87171",fillOpacity:.7,radius:de,isAnimationActive:!1}),e.jsx(te,{yAxisId:"left",type:"monotone",dataKey:"error_rate",name:"Error Rate",stroke:"#F59E0B",strokeWidth:2,dot:as,activeDot:ss,isAnimationActive:!1})]})})})}const cs=c.memo(ls),ds={ok:"green",warn:"yellow",over:"red"};function xs(t){return t==="over"?"bg-red-500":t==="warn"?"bg-yellow-500":"bg-green-500"}function ms(t,s){return t==="over"||(s.crossed_threshold??0)>=100?{bg:"bg-red-50 dark:bg-red-950/30",text:"text-red-800 dark:text-red-300",border:"border-red-200 dark:border-red-900"}:{bg:"bg-amber-50 dark:bg-amber-950/30",text:"text-amber-800 dark:text-amber-300",border:"border-amber-200 dark:border-amber-900"}}function xe(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function us(){const{currency:t}=P(),{data:s,isLoading:n}=B({queryKey:["plan"],queryFn:Fe,staleTime:5*6e4});if(n||!s||!s.plan||!s.usage)return null;const{plan:r,usage:a}=s,i=s.projection??null,o=Math.min(100,Math.max(0,a.pct)),l=(i==null?void 0:i.projected_month_end_usd)??a.projected,d=i!=null&&i.alert?ms(a.status,i):null;return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(it,{size:16,className:"text-gray-500 flex-shrink-0"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate",children:r.name}),e.jsx(H,{color:ds[a.status],size:"sm",children:a.status==="ok"?"on track":a.status==="warn"?"warning":"over budget"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[e.jsx(Le,{size:12}),e.jsxs("span",{children:[xe(a.period_start)," — ",xe(a.period_end)]}),e.jsx("span",{className:"text-gray-400",children:"·"}),e.jsxs("span",{children:["day ",a.days_so_far,"/",a.days_in_period]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-2 bg-gray-200 dark:bg-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${xs(a.status)} transition-all`,style:{width:`${o}%`},"aria-label":`${a.pct.toFixed(1)}% of budget used`})}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:u(a.used,t)})," ","of ",u(a.budget,t)]}),e.jsxs("span",{className:"tabular-nums",children:[a.pct.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-4 pt-3 border-t border-gray-100 dark:border-gray-800",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Remaining"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(a.remaining,t)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Projected"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(l,t)}),i&&e.jsx("div",{className:"text-[10px] text-gray-400 mt-0.5",children:i.projection_method==="weighted-7d"?"weighted 7d":"linear"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500",children:"Budget"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:u(r.monthly_usd,t)})]})]}),i&&(i.daily_burn_usd>0||i.days_to_limit!==null)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-800 flex items-center justify-between text-xs text-gray-500",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300 tabular-nums",children:u(i.daily_burn_usd,t)})," ","/ day burn"]}),i.days_to_limit!==null&&e.jsxs("span",{className:"tabular-nums",children:["~",i.days_to_limit," day",i.days_to_limit===1?"":"s"," to limit"]})]}),(i==null?void 0:i.alert)&&d&&e.jsxs("div",{className:`mt-3 px-3 py-2 rounded-md border text-xs flex items-center gap-2 ${d.bg} ${d.text} ${d.border}`,role:"status",children:[e.jsx(pe,{size:14,className:"flex-shrink-0"}),e.jsx("span",{children:i.alert})]})]})}function gs({rec:t,currency:s}){const n=t.estimated_monthly_delta_usd,r=(n??t.window_delta_usd)<0;return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r?e.jsx(Me,{size:16,className:"flex-shrink-0 text-emerald-600 dark:text-emerald-400"}):e.jsx(Ke,{size:16,className:"flex-shrink-0 text-amber-600 dark:text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:t.work_type}),e.jsx(H,{color:r?"green":"orange",size:"sm",children:r?"saving":"quality investment"})]}),n!==null&&e.jsxs("span",{className:`text-sm font-semibold tabular-nums flex-shrink-0 ${r?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"}`,children:[r?"−":"+",u(Math.abs(n),s),"/mo"]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 font-mono",children:[e.jsx("span",{className:"truncate",children:t.from_model}),e.jsx(Pe,{size:12,className:"flex-shrink-0 text-gray-400"}),e.jsx("span",{className:"truncate font-semibold",children:t.to_label})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:t.rationale}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-500 tabular-nums",children:[e.jsxs("span",{children:["window: ",u(t.window_cost_usd,s)," →"," ",u(t.candidate_window_cost_usd,s)]}),e.jsxs("span",{children:[m(t.evidence.events)," events"]}),e.jsxs("span",{children:[m(t.evidence.sessions)," sessions"]}),t.evidence.reasoning_tokens>0&&e.jsxs("span",{children:[(t.evidence.reasoning_share*100).toFixed(1),"% reasoning"]}),t.evidence.avg_quality_score!==null&&e.jsxs("span",{children:["quality ",t.evidence.avg_quality_score.toFixed(1),"/5 (n=",t.evidence.graded_sessions,")"]})]}),t.caveats.length>0&&e.jsx("ul",{className:"mt-2 space-y-0.5",children:t.caveats.map((a,i)=>e.jsxs("li",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:["⚠ ",a]},i))})]})}function hs(t){return t.startsWith("+++")||t.startsWith("---")?"text-gray-500 dark:text-gray-400 font-semibold":t.startsWith("@@")?"text-indigo-600 dark:text-indigo-400":t.startsWith("+")?"text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20":t.startsWith("-")?"text-rose-700 dark:text-rose-400 bg-rose-50 dark:bg-rose-900/20":"text-gray-600 dark:text-gray-400"}function me({text:t,label:s}){const[n,r]=c.useState(!1),a=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return e.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800",children:[n?e.jsx(Ye,{size:12,className:"text-emerald-500"}):e.jsx(Ge,{size:12}),n?"Copied":s]})}function ps(t,s){const n=new Blob([s],{type:"text/markdown"}),r=URL.createObjectURL(n),a=document.createElement("a");a.href=r,a.download=t,a.click(),URL.revokeObjectURL(r)}function ys({preview:t,currency:s}){const[n,r]=c.useState(!1),a=t.preview_diff.split(` +`);return e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[e.jsxs("div",{className:"px-4 py-3 flex items-start justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(He,{size:16,className:"flex-shrink-0 text-gray-500"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:["Slimmer ",t.source_path??t.file_label]}),e.jsxs("div",{className:"text-[11px] text-gray-500 tabular-nums",children:["~",m(t.original_tokens)," → ~",m(t.slimmed_tokens)," ","tokens · saves ~",m(t.tokens_saved)," tokens/session"]})]})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-sm font-semibold text-emerald-600 dark:text-emerald-400 tabular-nums",children:["~",u(t.estimated_savings_usd_monthly,s),"/mo"]}),e.jsxs("div",{className:"text-[11px] text-gray-500",children:["at ",t.sessions_per_month," sessions/mo (estimate)"]})]})]}),t.rationale.length>0&&e.jsx("ul",{className:"px-4 pb-2 space-y-1",children:t.rationale.map((i,o)=>e.jsxs("li",{className:"text-xs text-gray-600 dark:text-gray-400 flex gap-2",children:[e.jsxs("span",{className:"text-gray-400 tabular-nums flex-shrink-0 w-24 text-right",children:["−",m(i.tokens_saved)," tok"]}),e.jsx("span",{children:i.summary})]},`${i.rule}-${o}`))}),e.jsxs("div",{className:"px-4 py-2.5 border-t border-gray-100 dark:border-gray-800 flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",onClick:()=>r(!n),className:"inline-flex items-center gap-1 text-[11px] text-indigo-600 dark:text-indigo-400 hover:underline","aria-expanded":n,children:[n?e.jsx(ye,{size:12}):e.jsx(je,{size:12}),n?"Hide diff":"Show diff"]}),e.jsx("div",{className:"flex-1"}),e.jsx(me,{text:t.slimmed_text,label:"Copy slimmed CLAUDE.md"}),e.jsx(me,{text:t.preview_diff,label:"Copy diff"}),e.jsxs("button",{type:"button",onClick:()=>ps("CLAUDE.slim.md",t.slimmed_text),className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800",children:[e.jsx(qe,{size:12}),"Download"]})]}),n&&e.jsx("pre",{className:"mx-4 mb-3 p-3 rounded bg-gray-50 dark:bg-gray-950 border border-gray-100 dark:border-gray-800 overflow-x-auto text-[11px] leading-relaxed",children:a.map((i,o)=>e.jsx("div",{className:hs(i),children:i||" "},o))}),e.jsx("div",{className:"px-4 pb-3 text-[11px] text-gray-400 dark:text-gray-500",children:"Preview only — nothing is written for you. Review, then copy or download to apply."})]})}function js(){var o,l;const{data:t,isLoading:s,error:n}=B({queryKey:["optimize","prescriptions"],queryFn:()=>Te(),staleTime:3e5});if(s||n||!t)return null;const r=((o=t.routing)==null?void 0:o.recommendations)??[],a=t.claudemd_previews??[];if(r.length===0&&a.length===0)return null;const i=((l=t.routing)==null?void 0:l.caveats)??[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{size:16,className:"text-gray-500"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Prescriptions"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.length+a.length," suggested action",r.length+a.length===1?"":"s"," · ",t.scope]})]}),r.length>0&&e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:r.map((d,x)=>e.jsx(gs,{rec:d,currency:t.currency},`${d.rec_id}-${d.from_model}-${x}`))}),a.map((d,x)=>e.jsx(ys,{preview:d,currency:t.currency},`${d.file_label}-${x}`)),r.length>0&&i.length>0&&e.jsx("ul",{className:"space-y-0.5",children:i.map((d,x)=>e.jsx("li",{className:"text-[11px] text-gray-400 dark:text-gray-500",children:d},x))})]})}const ue=5,fs={high:"red",medium:"yellow",low:"gray"};function ks({finding:t}){return e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 dark:border-gray-800 flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 pt-0.5",children:e.jsx(H,{color:fs[t.severity],size:"sm",children:t.severity})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t.title}),e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums",children:[t.affected_count," affected"]}),t.estimated_waste_usd!==null&&t.estimated_waste_usd>0&&e.jsxs("span",{className:"text-[11px] font-medium text-rose-600 dark:text-rose-400 tabular-nums",children:["· ~",u(t.estimated_waste_usd)," wasted"]}),t.estimated_waste_tokens!==null&&t.estimated_waste_tokens>0&&e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums",children:["· ~",m(t.estimated_waste_tokens)," tokens"]})]}),t.description&&e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:t.description}),t.suggested_fix&&e.jsxs("p",{className:"text-xs text-gray-700 dark:text-gray-300 mt-1.5 flex items-start gap-1.5",children:[e.jsx(tt,{size:12,className:"flex-shrink-0 text-yellow-500 mt-0.5"}),e.jsx("span",{children:t.suggested_fix})]})]})]})}function bs(){return e.jsxs(e.Fragment,{children:[e.jsx(_s,{}),e.jsx(js,{})]})}function _s(){const[t,s]=c.useState(!1),{filters:n}=J(),{data:r,isLoading:a,error:i}=B({queryKey:["optimize","month",n.providers,n.models],queryFn:()=>fe("month",{providers:n.providers,models:n.models}),staleTime:5*6e4});if(a||i||!r)return null;const o=r.patterns??[],l=o.length,d=t?o:o.slice(0,ue),x=Math.max(0,l-ue),b=r.total_waste_usd??0;return l===0?null:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>s(!t),className:"w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-800/40","aria-expanded":t,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t?e.jsx(ye,{size:14,className:"text-gray-500"}):e.jsx(je,{size:14,className:"text-gray-500"}),e.jsx(Ze,{size:16,className:"text-gray-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Optimization findings"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[l," pattern",l===1?"":"s"," detected · ",r.scope]})]}),b>0&&e.jsxs("span",{className:"text-xs font-semibold text-rose-600 dark:text-rose-400 tabular-nums",children:["~",u(b)," identified"]})]}),e.jsx("div",{children:d.map((y,_)=>e.jsx(ks,{finding:y},`${y.pattern_id}-${_}`))}),x>0&&e.jsx("button",{type:"button",onClick:()=>s(!0),disabled:t,className:"w-full px-4 py-2.5 text-xs text-indigo-600 dark:text-indigo-400 hover:bg-gray-50 dark:hover:bg-gray-800/40 border-t border-gray-100 dark:border-gray-800 disabled:text-gray-400 disabled:cursor-default",children:t?`Showing all ${l}`:`View all ${l} findings`})]})}const vs=6;function Cs({anomaly:t}){var i;const s=t.kind==="day",n=s?Le:Ne,r=s?t.key:`${t.key.slice(0,8)}…`,a=typeof((i=t.details)==null?void 0:i.model)=="string"?t.details.model:null;return e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 dark:border-gray-800 flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 pt-0.5 text-gray-400",children:e.jsx(n,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 tabular-nums",children:r}),e.jsx(H,{color:"red",size:"sm",children:u(t.cost_usd)}),t.ratio!==null&&t.ratio>=1.5&&e.jsxs("span",{className:"text-[11px] text-rose-600 dark:text-rose-400 tabular-nums",children:[t.ratio.toFixed(1),"× baseline"]}),a&&e.jsx("span",{className:"text-[11px] text-gray-500 truncate max-w-[40%]",children:a})]}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:t.reason})]})]})}function Ns(){var l,d;const{filters:t}=J(),{data:s,isLoading:n,error:r}=B({queryKey:["optimize","month",t.providers,t.models],queryFn:()=>fe("month",{providers:t.providers,models:t.models}),staleTime:5*6e4});if(n||r||!s)return null;const a=((l=s.anomalies)==null?void 0:l.anomalies)??[];if(a.length===0)return null;const i=a.slice(0,vs),o=((d=s.anomalies)==null?void 0:d.day_count)??0;return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"w-full flex items-center justify-between gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{size:16,className:"text-rose-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Cost anomalies"}),e.jsxs("span",{className:"text-xs text-gray-500",children:[a.length," outlier",a.length===1?"":"s"," · ",s.scope]})]}),o>0&&e.jsxs("span",{className:"text-[11px] text-gray-400 tabular-nums",children:["vs ",o,"-day baseline"]})]}),e.jsx("div",{children:i.map(x=>e.jsx(Cs,{anomaly:x},`${x.kind}-${x.key}`))})]})}const Ls=c.memo(Ns);function ge(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const M={},As={messages:{},tokens:{}};function f({icon:t,label:s,value:n,sublabel:r,color:a="text-gray-600 dark:text-gray-400"}){return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-3 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:a,children:t}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:s})]}),e.jsx("div",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:n}),r&&e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:r})]})}function Gs({stats:t}){var z,O;const{currency:s}=P(),{queryString:n}=J(),[r,a]=c.useState(t.trends??null),[i,o]=c.useState({});c.useEffect(()=>{if(t.trends){a(t.trends);return}let g=!1;return fetch("/api/cost-data").then(k=>k.ok?k.json():null).then(k=>{if(g||!k)return;const h=k.trends;h&&h.current_week&&h.prior_week&&h.delta_pct&&a(h)}).catch(()=>{}),()=>{g=!0}},[t.trends]),c.useEffect(()=>{let g=!1;const k=n?`?${n.slice(1)}`:"";return fetch(`/api/tool-distribution${k}`).then(h=>h.ok?h.json():null).then(h=>{g||!h||o(h.tool_count_distribution??{})}).catch(()=>{}),()=>{g=!0}},[n]);const l=c.useCallback(()=>{We("cost")},[]),d=c.useMemo(()=>{var k,h;const g=((k=t.overview)==null?void 0:k.total_tokens)??{input:0,output:0,cache_read:0,cache_creation:0};return((h=t.token_composition)==null?void 0:h.totals)??{input:g.input,output:g.output,cache_read:g.cache_read,cache_creation:g.cache_creation}},[t.token_composition,t.overview]);if(!(t!=null&&t.overview))return null;const x=t.overview.total_tokens??{input:0,output:0,cache_read:0,cache_creation:0},b=x.input+x.output+x.cache_read+x.cache_creation,y=t.user_interactions??{user_commands_analyzed:0,avg_tools_per_command:0},_=t.overview.date_range??{start:"",end:""},D=t.models??{},w=t.overview.message_types??{},E=w.user??0,Y=w.assistant??0,G=w.tool_use??0,V=w.tool_result??0;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(us,{}),e.jsx(Re,{trends:r,endDate:_.end||void 0,onTileClick:l}),e.jsx(mt,{stats:t}),e.jsx(bs,{}),e.jsx(Ls,{}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(Oe,{cache:t.cache,dailyStats:t.daily_stats}),e.jsx(Se,{totals:d})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",children:[e.jsx(f,{icon:e.jsx(be,{size:14}),label:"Total Tokens",value:m(b),color:"text-gray-600 dark:text-gray-400"}),e.jsx(f,{icon:e.jsx(_e,{size:14}),label:"Total Cost",value:u(t.overview.total_cost??0,s),color:"text-green-400"}),e.jsx(f,{icon:e.jsx(ve,{size:14}),label:"Commands Analyzed",value:m(y.user_commands_analyzed),color:"text-cyan-400"}),e.jsx(f,{icon:e.jsx(Ce,{size:14}),label:"Total Messages",value:m(t.overview.total_messages??0),color:"text-violet-400"}),e.jsx(f,{icon:e.jsx(Qe,{size:14}),label:"Avg Tools/Cmd",value:(y.avg_tools_per_command??0).toFixed(1),color:"text-blue-400"}),e.jsx(f,{icon:e.jsx(rt,{size:14}),label:"Models Used",value:String(Object.keys(D).length),sublabel:Object.keys(D).slice(0,2).map(Z).join(", "),color:"text-pink-400"}),e.jsx(f,{icon:e.jsx(Ve,{size:14}),label:"User Messages",value:m(E),color:"text-indigo-400"}),e.jsx(f,{icon:e.jsx(Xe,{size:14}),label:"Assistant Messages",value:m(Y),color:"text-emerald-400"}),e.jsx(f,{icon:e.jsx(he,{size:14}),label:"Tool Use",value:m(G),color:"text-amber-400"}),e.jsx(f,{icon:e.jsx(Ne,{size:14}),label:"Tool Results",value:m(V),color:"text-cyan-400"}),e.jsx(f,{icon:e.jsx(De,{size:14}),label:"Date Range",value:_.start?ge(_.start):"N/A",sublabel:_.end?`to ${ge(_.end)}`:"",color:"text-gray-600 dark:text-gray-400"})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[e.jsx(ht,{dailyStats:t.daily_stats??M}),e.jsx(bt,{dailyStats:t.daily_stats??M}),e.jsx(Ut,{toolStats:((z=t.tools)==null?void 0:z.usage_counts)??M}),e.jsx(Nt,{modelStats:t.models??M}),e.jsx(It,{hourlyPattern:t.hourly_pattern??As}),e.jsx(Yt,{toolCountDist:i}),e.jsx(ts,{dailyStats:t.daily_stats??M}),e.jsx(Ot,{errorCategories:((O=t.errors)==null?void 0:O.by_category)??M}),e.jsx(cs,{dailyStats:t.daily_stats??M})]})]})}export{Gs as default}; diff --git a/stackunderflow/static/react/assets/PlaybackTab-0L9gLEFP.js b/stackunderflow/static/react/assets/PlaybackTab-B80zt3lK.js similarity index 99% rename from stackunderflow/static/react/assets/PlaybackTab-0L9gLEFP.js rename to stackunderflow/static/react/assets/PlaybackTab-B80zt3lK.js index 4abe4fd..3ae493a 100644 --- a/stackunderflow/static/react/assets/PlaybackTab-0L9gLEFP.js +++ b/stackunderflow/static/react/assets/PlaybackTab-B80zt3lK.js @@ -1,4 +1,4 @@ -import{r as l,j as e,u as A}from"./react-vendor-B7v2HPaI.js";import{h as M,p as z,G as V,a9 as O,aa as re,i as ae,j as X,ab as se,L as ne,T as ie,a3 as le,ac as oe}from"./index-DQluCO2S.js";import{E as K}from"./EmptyState-o0gibvhZ.js";import{I as U}from"./IconClock-CgB7iTL4.js";import{I as de}from"./IconFileText-ChD_eRqq.js";import{i as ce,j as H}from"./dashboardTabs-C5ecR5YO.js";import{I as xe,a as ge}from"./IconPlayerSkipForwardFilled-DA8tH9T1.js";/** +import{r as l,j as e,u as A}from"./react-vendor-B7v2HPaI.js";import{h as M,p as z,G as V,a9 as O,aa as re,i as ae,j as X,ab as se,L as ne,T as ie,a3 as le,ac as oe}from"./index-0LeeVNek.js";import{E as K}from"./EmptyState-o0gibvhZ.js";import{I as U}from"./IconClock-BfNEbW3j.js";import{I as de}from"./IconFileText-BfJ2drOF.js";import{j as ce,k as H}from"./dashboardTabs-BuoED77E.js";import{I as xe,a as ge}from"./IconPlayerSkipForwardFilled-Ca9nBmoF.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/ProjectDashboard-CixMPUyA.js b/stackunderflow/static/react/assets/ProjectDashboard-CixMPUyA.js new file mode 100644 index 0000000..2d3d507 --- /dev/null +++ b/stackunderflow/static/react/assets/ProjectDashboard-CixMPUyA.js @@ -0,0 +1,7 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewTab-Bzn_KZlZ.js","assets/react-vendor-B7v2HPaI.js","assets/index-0LeeVNek.js","assets/index-CQL5TeFe.css","assets/format-Co_unrac.js","assets/IconHash-Cw_3c3J-.js","assets/dashboardTabs-BuoED77E.js","assets/TokenCompositionDonut-DhTEtbxP.js","assets/IconTrendingUp-CcTO0Xpf.js","assets/chartTheme-GpkpBpop.js","assets/IconDatabase-50ZWmnTz.js","assets/recharts-C8DDeE7E.js","assets/IconArrowRight-CEBy4AKU.js","assets/IconFileText-BfJ2drOF.js","assets/IconCheck-D_dgJKrH.js","assets/IconCopy-Cl6jyttT.js","assets/IconUser-YF3ooIRT.js","assets/IconClockHour4-B94dRT7a.js","assets/IconRobot-DArBIG_E.js","assets/EmptyState-o0gibvhZ.js","assets/FilterBar-CML9sBEu.js","assets/CommandsTab-CZ24GiGu.js","assets/DataTable-BHenS21h.js","assets/IconArrowUp-CqAnfuIE.js","assets/MessagesTab-C_f5Q-QT.js","assets/Modal-CGY7raPC.js","assets/Markdown-Be0CkqQs.js","assets/syntax-highlighter-BYF-y4SB.js","assets/markdown-DgJRk3H5.js","assets/ProviderChip-Bd3LCPUs.js","assets/SearchTab-D03-qVTk.js","assets/TimeAgo-BNE6wf6R.js","assets/IconAlertCircle-DmtLevj2.js","assets/QATab-BnX7j0t9.js","assets/IconSortDescending-szhiy27L.js","assets/IconCode-DFtqsCTV.js","assets/BookmarksTab-BGB20MYS.js","assets/TagsTab-CJJHkPnn.js","assets/IconUsers-BhXPWMUX.js","assets/SessionsTab-3DJNVHPg.js","assets/EstimatedCostMarker-DsipcjDe.js","assets/IconClock-BfNEbW3j.js","assets/AgentsTab-BmHrcPiL.js","assets/PlaybackTab-B80zt3lK.js","assets/IconPlayerSkipForwardFilled-Ca9nBmoF.js","assets/ContextReplayTab-CgZm-FeZ.js","assets/CostTab-FEEkQwUn.js","assets/BudgetsTab-BSGq7YYe.js","assets/CompareTab-DoDHMMWv.js","assets/YieldTab-CGWBiQ4I.js","assets/IconCircleX-CZ-PNBqE.js","assets/ForksTab-BBQyDQc2.js","assets/CodingHealthTab-DZFACjUP.js","assets/IconBolt-DgchZkn1.js","assets/WorktreesTab-By5aNgjx.js","assets/IconActivity-CtliCKZa.js","assets/DevicesTab-BjyuCuvS.js"])))=>i.map(i=>d[i]); +import{r,j as e,m as H,d as X,u as F,e as Z,_ as c}from"./react-vendor-B7v2HPaI.js";import{h as ee,i as te,j as ae,a as re,f as se,g as oe,L as U,I as M,E as ne,r as ie,k as de,l as ce}from"./index-0LeeVNek.js";import{E as le}from"./EmptyState-o0gibvhZ.js";import{F as ue}from"./FilterBar-CML9sBEu.js";import{I as xe,u as me,T as P,B as pe,a as q,D as ge}from"./dashboardTabs-BuoED77E.js";/** + * @license @tabler/icons-react v3.36.1 - MIT + * + * This source code is licensed under the MIT license. + * See the LICENSE file in the root directory of this source tree. + */const be=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],K=ee("outline","download","Download",be),D="stackunderflow:nav";function f(){return typeof window<"u"&&typeof window.history<"u"}function R(t){f()&&window.dispatchEvent(new CustomEvent(D,{detail:t}))}function S(t,n=[]){if(!f())return"";const s=new URL(window.location.href);for(const b of n)s.searchParams.delete(b);for(const[b,y]of Object.entries(t))s.searchParams.set(b,y);const a=`${s.pathname}${s.search}${s.hash}`,x=`${window.location.pathname}${window.location.search}${window.location.hash}`;return a!==x&&window.history.pushState({},"",a),s.search}function He(t){S({tab:"messages",interaction:t},["session"]),R({tab:"messages",interaction:t})}function Xe(t){S({tab:"sessions",session:t},["interaction"]),R({tab:"sessions",session:t})}function ye(t,n){const s={tab:t,...n??{}};S(s,["session","interaction"]),R(s)}function Q(){return f()?new URLSearchParams(window.location.search).get("tab"):null}function L(t){return f()?new URLSearchParams(window.location.search).get(t):null}function J(t){if(!f())return;const n=new URL(window.location.href);if(!n.searchParams.has(t))return;n.searchParams.delete(t);const s=`${n.pathname}${n.search}${n.hash}`;window.history.replaceState({},"",s)}const he=[{value:"today",label:"Today"},{value:"week",label:"Last 7 days"},{value:"month",label:"Last 30 days"},{value:"all",label:"All time"}],fe=[{value:"csv",label:"CSV"},{value:"json",label:"JSON"}];function we({tab:t,className:n}){const[s,a]=r.useState(!1),[x,b]=r.useState("csv"),[y,w]=r.useState("week"),h=r.useRef(null);r.useEffect(()=>{if(!s)return;const i=u=>{h.current&&(h.current.contains(u.target)||a(!1))},p=u=>{u.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",p)}},[s]);const v=()=>{const p=`/api/export?${new URLSearchParams({format:x,period:y}).toString()}`,u=document.createElement("a");u.href=p,u.rel="noopener",u.download="",document.body.appendChild(u),u.click(),document.body.removeChild(u),a(!1)};return e.jsxs("div",{ref:h,className:`relative ${n??""}`,children:[e.jsxs("button",{type:"button",onClick:()=>a(i=>!i),"aria-haspopup":"menu","aria-expanded":s,title:`Export ${t} data`,"data-testid":`export-button-${t}`,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 hover:border-gray-400 dark:hover:border-gray-600 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(K,{size:13}),"Export",e.jsx(te,{size:11,className:s?"rotate-180 transition-transform":"transition-transform"})]}),s&&e.jsxs("div",{role:"menu",className:"absolute right-0 top-full mt-1 z-20 w-56 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-md shadow-lg p-3 space-y-3","data-testid":`export-popover-${t}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Format"}),e.jsx("div",{className:"flex gap-1",children:fe.map(i=>{const p=x===i.value;return e.jsx("button",{type:"button",onClick:()=>b(i.value),"aria-pressed":p,className:"flex-1 text-xs px-2 py-1 rounded border transition-colors "+(p?"bg-indigo-500/20 border-indigo-500/60 text-indigo-700 dark:text-indigo-200":"bg-gray-50 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:border-gray-400 dark:hover:border-gray-600"),children:i.label},i.value)})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Period"}),e.jsx("select",{value:y,onChange:i=>w(i.target.value),className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1 text-xs text-gray-700 dark:text-gray-300 focus:outline-none focus:border-indigo-500","aria-label":"Period",children:he.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),e.jsxs("button",{type:"button",onClick:v,className:"w-full inline-flex items-center justify-center gap-1.5 px-2 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium rounded","data-testid":`export-download-${t}`,children:[e.jsx(K,{size:13}),"Download"]})]})]})}function ve({trail:t}){return t.length===0?null:e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center text-xs text-gray-600 dark:text-gray-400",children:e.jsx("ol",{className:"flex items-center flex-wrap gap-1",children:t.map((n,s)=>{const a=s===t.length-1,x=!a&&typeof n.onClick=="function";return e.jsxs(r.Fragment,{children:[e.jsx("li",{className:"flex items-center",children:x?e.jsx("button",{type:"button",onClick:n.onClick,className:"text-gray-600 dark:text-gray-400 hover:text-indigo-400 focus:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400 rounded px-0.5",children:n.label}):e.jsx("span",{className:a?"text-gray-800 dark:text-gray-200 font-medium":"text-gray-600 dark:text-gray-400","aria-current":a?"page":void 0,children:n.label})}),!a&&e.jsx("li",{"aria-hidden":"true",className:"flex items-center text-gray-400 dark:text-gray-600",children:e.jsx(ae,{size:12})})]},`${s}-${n.label}`)})})})}function _e(){return e.jsxs("button",{type:"button","aria-label":"Go back",onClick:()=>{typeof window<"u"&&window.history.back()},className:"inline-flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 rounded focus:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400",children:[e.jsx(xe,{size:12}),"Back"]})}const je=r.lazy(()=>c(()=>import("./OverviewTab-Bzn_KZlZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),ke=r.lazy(()=>c(()=>import("./CommandsTab-CZ24GiGu.js"),__vite__mapDeps([21,1,22,2,3,23,4,19,20,6]))),Ee=r.lazy(()=>c(()=>import("./MessagesTab-C_f5Q-QT.js"),__vite__mapDeps([24,1,22,2,3,23,25,20,4,26,27,28,29,19,6]))),Te=r.lazy(()=>c(()=>import("./SearchTab-D03-qVTk.js"),__vite__mapDeps([30,1,2,3,19,31,4,32]))),Ne=r.lazy(()=>c(()=>import("./QATab-BnX7j0t9.js"),__vite__mapDeps([33,1,2,3,19,31,4,34,35]))),Le=r.lazy(()=>c(()=>import("./BookmarksTab-BGB20MYS.js"),__vite__mapDeps([36,1,2,3,19,20,4,25,31,34,6,14]))),Pe=r.lazy(()=>c(()=>import("./TagsTab-CJJHkPnn.js"),__vite__mapDeps([37,1,2,3,19,5,38,6]))),De=r.lazy(()=>c(()=>import("./SessionsTab-3DJNVHPg.js"),__vite__mapDeps([39,1,2,3,19,26,27,28,29,40,4,6,20,5,16,18,41,35]))),Re=r.lazy(()=>c(()=>import("./AgentsTab-BmHrcPiL.js"),__vite__mapDeps([42,1,2,3,4,19,6,18,16,5,41]))),Se=r.lazy(()=>c(()=>import("./PlaybackTab-B80zt3lK.js"),__vite__mapDeps([43,1,2,3,19,41,13,6,44]))),Ae=r.lazy(()=>c(()=>import("./ContextReplayTab-CgZm-FeZ.js"),__vite__mapDeps([45,1,2,3,19,4,44]))),Ie=r.lazy(()=>c(()=>import("./CostTab-FEEkQwUn.js"),__vite__mapDeps([46,1,2,3,4,7,6,5,8,9,10,11,40,23,20,19]))),Oe=r.lazy(()=>c(()=>import("./BudgetsTab-BSGq7YYe.js"),__vite__mapDeps([47,1,2,3,19,4,6,14,11]))),ze=r.lazy(()=>c(()=>import("./CompareTab-DoDHMMWv.js"),__vite__mapDeps([48,1,2,3,19,29,4,6,32]))),Ce=r.lazy(()=>c(()=>import("./YieldTab-CGWBiQ4I.js"),__vite__mapDeps([49,1,2,3,19,4,6,50,8]))),$e=r.lazy(()=>c(()=>import("./ForksTab-BBQyDQc2.js"),__vite__mapDeps([51,1,2,3,19,4,6,18]))),Be=r.lazy(()=>c(()=>import("./CodingHealthTab-DZFACjUP.js"),__vite__mapDeps([52,1,2,3,19,6,13,53,20,4]))),Ve=r.lazy(()=>c(()=>import("./WorktreesTab-By5aNgjx.js"),__vite__mapDeps([54,1,2,3,19,4,6,55,14,15]))),Fe=r.lazy(()=>c(()=>import("./DevicesTab-BjyuCuvS.js"),__vite__mapDeps([56,1,4,2,3,19,9,6,38,10,11]))),Ue=P.map(t=>t.id);function W(t){return!!t&&Ue.includes(t)}function Me(){const t=Q();return W(t)?t:"overview"}function qe(t){if(!t)return[];const n=Object.entries(t).filter(([s])=>s!==""&&s.toLowerCase()!=="unknown").map(([s,a])=>({model:s,count:typeof(a==null?void 0:a.count)=="number"?a.count:0}));return n.sort((s,a)=>a.count-s.count),n.slice(0,6).map(s=>s.model)}function Ke(){var $,B;const{name:t}=H(),n=X(),{filters:s}=re(),[a,x]=r.useState(Me),[b,y]=r.useState(0),{isTabVisible:w,betaEnabled:h,setBetaEnabled:v}=me(),i=r.useMemo(()=>P.filter(o=>w(o.id,o.isBeta??!1)),[w]);r.useEffect(()=>{if(typeof window>"u")return;const o=d=>{if(d.key!==null&&d.key!==q)return;let l=ge;try{const k=window.localStorage.getItem(q);if(k!==null){const V=JSON.parse(k);typeof V=="boolean"&&(l=V)}}catch{}l!==h&&v(l)};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[h,v]),r.useEffect(()=>{i.some(o=>o.id===a)||x("overview")},[i,a]);const{isLoading:p,error:u}=F({queryKey:["setProject",t],queryFn:()=>de(t),enabled:!!t,staleTime:6e4}),{data:g,isLoading:_,isFetching:E,error:T}=F({queryKey:["dashboardData",t,s.providers,s.models],queryFn:()=>ce(new Date().getTimezoneOffset(),{providers:s.providers,models:s.models}),enabled:!!t&&!p,placeholderData:(o,d)=>{var l;return((l=d==null?void 0:d.queryKey)==null?void 0:l[1])===t?o:void 0}}),N=Z({mutationFn:()=>ie(new Date().getTimezoneOffset()),onSuccess:()=>{n.invalidateQueries({queryKey:["dashboardData",t]})}}),Y=r.useCallback(o=>{if(x(o),typeof window>"u")return;const d=new URL(window.location.href);d.searchParams.set("tab",o);const l=`${d.pathname}${d.search}${d.hash}`,k=`${window.location.pathname}${window.location.search}${window.location.hash}`;l!==k&&window.history.replaceState({},"",l)},[]),A=r.useCallback((o,d)=>{x(o),ye(o,d)},[]);r.useEffect(()=>{if(!(typeof window>"u"))return window.__suSwitchTab=A,()=>{delete window.__suSwitchTab}},[A]),r.useEffect(()=>{if(typeof window>"u")return;const o=()=>{const d=Q();W(d)&&x(l=>l===d?l:d),y(l=>l+1)};return window.addEventListener(D,o),window.addEventListener("popstate",o),()=>{window.removeEventListener(D,o),window.removeEventListener("popstate",o)}},[]);const I=t?se(t,void 0,oe()):"";if(p||_)return e.jsx(U,{message:`Loading ${I}...`});if(u||T&&!g){const o=u||T;return e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400 text-sm",children:["Failed to load project: ",o instanceof Error?o.message:"Unknown error"]})})}if(!g)return e.jsx(le,{title:"No data",description:"No dashboard data available"});const m=g.statistics,G=L("q")??"",O=L("session"),z=L("interaction"),C=(($=P.find(o=>o.id===a))==null?void 0:$.label)??a;let j=null;return O?j=[{label:C,onClick:()=>J("session")},{label:`Session · ${O}`}]:z&&(j=[{label:C,onClick:()=>J("interaction")},{label:`Interaction · ${z}`}]),e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:I}),((B=m==null?void 0:m.overview)==null?void 0:B.date_range)&&e.jsxs("p",{className:"text-xs text-gray-500",children:[m.overview.date_range.start," — ",m.overview.date_range.end]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E&&!_&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-gray-500","aria-live":"polite",children:[e.jsx(M,{size:12,className:"animate-spin"}),"Updating…"]}),T&&g&&e.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",role:"status",children:"Refresh failed"}),g.is_reindexing&&e.jsx("span",{className:"text-xs text-yellow-700 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-900/20 px-2 py-1 rounded",children:"Reindexing..."}),e.jsxs("button",{onClick:()=>N.mutate(),disabled:N.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:[e.jsx(M,{size:14,className:N.isPending?"animate-spin":""}),"Refresh"]})]})]}),e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-800 flex items-center justify-between gap-3",children:[e.jsx("nav",{className:"flex gap-0 -mb-px overflow-x-auto flex-1 min-w-0","data-testid":"dashboard-tabs",children:i.map(o=>{const d=o.icon;return e.jsxs("button",{onClick:()=>Y(o.id),"data-tab":o.id,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium whitespace-nowrap border-b-2 ${a===o.id?"text-indigo-400 border-indigo-400":"text-gray-600 dark:text-gray-400 border-transparent hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"}`,children:[e.jsx(d,{size:14}),o.label,o.isBeta===!0&&e.jsx(pe,{className:"ml-1.5"})]},o.id)})}),e.jsx("div",{className:"pb-1.5 flex-shrink-0",children:e.jsx(we,{tab:a})})]}),e.jsx(ue,{modelOptions:qe(m==null?void 0:m.models)}),j&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_e,{}),e.jsx(ve,{trail:j})]}),e.jsx("div",{"aria-busy":E&&!_,className:`transition-opacity duration-200 ${E&&!_?"opacity-60":""}`,children:e.jsx(ne,{children:e.jsxs(r.Suspense,{fallback:e.jsx(U,{size:"md",message:"Loading..."}),children:[a==="overview"&&e.jsx(je,{stats:m}),a==="cost"&&e.jsx(Ie,{stats:m}),a==="budgets"&&e.jsx(Oe,{}),a==="compare"&&e.jsx(ze,{}),a==="yield"&&e.jsx(Ce,{}),a==="forks"&&e.jsx($e,{projectName:t}),a==="health"&&e.jsx(Be,{projectName:t}),a==="worktrees"&&e.jsx(Ve,{projectName:t}),a==="devices"&&e.jsx(Fe,{projectName:t}),a==="commands"&&e.jsx(ke,{data:g}),a==="messages"&&e.jsx(Ee,{data:g,projectName:t}),a==="search"&&e.jsx(Te,{projectName:t,initialQuery:G}),a==="qa"&&e.jsx(Ne,{projectName:t}),a==="bookmarks"&&e.jsx(Le,{}),a==="tags"&&e.jsx(Pe,{}),a==="sessions"&&e.jsx(De,{projectName:t,sessionEfficiency:m.session_efficiency}),a==="agents"&&e.jsx(Re,{projectName:t}),a==="playback"&&e.jsx(Se,{projectName:t}),a==="contextreplay"&&e.jsx(Ae,{projectName:t})]})},a)})]})}const Ze=Object.freeze(Object.defineProperty({__proto__:null,default:Ke},Symbol.toStringTag,{value:"Module"}));export{K as I,D as N,Ze as P,He as a,J as c,L as g,Xe as o,ye as s}; diff --git a/stackunderflow/static/react/assets/ProjectDashboard-DAsn11K-.js b/stackunderflow/static/react/assets/ProjectDashboard-DAsn11K-.js deleted file mode 100644 index cf4571a..0000000 --- a/stackunderflow/static/react/assets/ProjectDashboard-DAsn11K-.js +++ /dev/null @@ -1,7 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewTab-CSNvLBfV.js","assets/react-vendor-B7v2HPaI.js","assets/index-DQluCO2S.js","assets/index-DL9ELn-S.css","assets/format-Co_unrac.js","assets/IconHash-cdeuBxnj.js","assets/dashboardTabs-C5ecR5YO.js","assets/TokenCompositionDonut-DTEMWIwY.js","assets/IconTrendingUp-D1iuYAG9.js","assets/chartTheme-GpkpBpop.js","assets/recharts-C8DDeE7E.js","assets/IconArrowRight-lOOgkPXu.js","assets/IconFileText-ChD_eRqq.js","assets/IconCheck-BQLu3HFV.js","assets/IconCopy-BOYWZx4M.js","assets/IconUser-IjRNaThB.js","assets/IconClockHour4-BUN27e3Z.js","assets/IconRobot-DuCKb11z.js","assets/EmptyState-o0gibvhZ.js","assets/FilterBar-BS6lhcC1.js","assets/CommandsTab-DlkmMFl4.js","assets/DataTable-DCEy-2Es.js","assets/IconArrowUp-D8NJ3QQF.js","assets/MessagesTab-Dull7JZB.js","assets/Modal-DkeyqO4J.js","assets/Markdown-Be0CkqQs.js","assets/syntax-highlighter-BYF-y4SB.js","assets/markdown-DgJRk3H5.js","assets/ProviderChip-baymKnS_.js","assets/SearchTab-DsaZoPy9.js","assets/TimeAgo-BNE6wf6R.js","assets/IconAlertCircle-h2zR9MWj.js","assets/QATab-DUs6uRU9.js","assets/IconSortDescending-DunfClYo.js","assets/IconCode-nzK0btv1.js","assets/BookmarksTab-Cor0cmyo.js","assets/TagsTab-DSK8Zu2d.js","assets/SessionsTab-NrDPSNfB.js","assets/EstimatedCostMarker-BpsBXEjf.js","assets/IconClock-CgB7iTL4.js","assets/AgentsTab-BajlmbLz.js","assets/PlaybackTab-0L9gLEFP.js","assets/IconPlayerSkipForwardFilled-DA8tH9T1.js","assets/ContextReplayTab-ixP9t9_Y.js","assets/CostTab-DCJQfNNf.js","assets/BudgetsTab-BjHaaUsj.js","assets/CompareTab-D60fXyc4.js","assets/YieldTab-BbHHGYlL.js","assets/IconCircleX-D7ABaoUn.js","assets/ForksTab-ryk22jFG.js","assets/CodingHealthTab-B02yOcgC.js","assets/IconBolt-CWu2Wz0a.js","assets/WorktreesTab-B65wyswE.js","assets/IconActivity-Bf5MQINx.js"])))=>i.map(i=>d[i]); -import{r as s,j as e,m as H,d as X,u as F,e as Z,_ as c}from"./react-vendor-B7v2HPaI.js";import{h as ee,i as te,j as ae,a as re,f as se,g as oe,L as U,I as M,E as ne,r as ie,k as de,l as ce}from"./index-DQluCO2S.js";import{E as le}from"./EmptyState-o0gibvhZ.js";import{F as ue}from"./FilterBar-BS6lhcC1.js";import{I as xe,u as me,T as P,B as pe,a as q,D as ge}from"./dashboardTabs-C5ecR5YO.js";/** - * @license @tabler/icons-react v3.36.1 - MIT - * - * This source code is licensed under the MIT license. - * See the LICENSE file in the root directory of this source tree. - */const be=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],K=ee("outline","download","Download",be),D="stackunderflow:nav";function f(){return typeof window<"u"&&typeof window.history<"u"}function R(t){f()&&window.dispatchEvent(new CustomEvent(D,{detail:t}))}function S(t,n=[]){if(!f())return"";const r=new URL(window.location.href);for(const b of n)r.searchParams.delete(b);for(const[b,y]of Object.entries(t))r.searchParams.set(b,y);const a=`${r.pathname}${r.search}${r.hash}`,x=`${window.location.pathname}${window.location.search}${window.location.hash}`;return a!==x&&window.history.pushState({},"",a),r.search}function Ge(t){S({tab:"messages",interaction:t},["session"]),R({tab:"messages",interaction:t})}function He(t){S({tab:"sessions",session:t},["interaction"]),R({tab:"sessions",session:t})}function ye(t,n){const r={tab:t,...n??{}};S(r,["session","interaction"]),R(r)}function Q(){return f()?new URLSearchParams(window.location.search).get("tab"):null}function L(t){return f()?new URLSearchParams(window.location.search).get(t):null}function J(t){if(!f())return;const n=new URL(window.location.href);if(!n.searchParams.has(t))return;n.searchParams.delete(t);const r=`${n.pathname}${n.search}${n.hash}`;window.history.replaceState({},"",r)}const he=[{value:"today",label:"Today"},{value:"week",label:"Last 7 days"},{value:"month",label:"Last 30 days"},{value:"all",label:"All time"}],fe=[{value:"csv",label:"CSV"},{value:"json",label:"JSON"}];function we({tab:t,className:n}){const[r,a]=s.useState(!1),[x,b]=s.useState("csv"),[y,w]=s.useState("week"),h=s.useRef(null);s.useEffect(()=>{if(!r)return;const i=u=>{h.current&&(h.current.contains(u.target)||a(!1))},p=u=>{u.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",p)}},[r]);const v=()=>{const p=`/api/export?${new URLSearchParams({format:x,period:y}).toString()}`,u=document.createElement("a");u.href=p,u.rel="noopener",u.download="",document.body.appendChild(u),u.click(),document.body.removeChild(u),a(!1)};return e.jsxs("div",{ref:h,className:`relative ${n??""}`,children:[e.jsxs("button",{type:"button",onClick:()=>a(i=>!i),"aria-haspopup":"menu","aria-expanded":r,title:`Export ${t} data`,"data-testid":`export-button-${t}`,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 hover:border-gray-400 dark:hover:border-gray-600 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(K,{size:13}),"Export",e.jsx(te,{size:11,className:r?"rotate-180 transition-transform":"transition-transform"})]}),r&&e.jsxs("div",{role:"menu",className:"absolute right-0 top-full mt-1 z-20 w-56 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-md shadow-lg p-3 space-y-3","data-testid":`export-popover-${t}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Format"}),e.jsx("div",{className:"flex gap-1",children:fe.map(i=>{const p=x===i.value;return e.jsx("button",{type:"button",onClick:()=>b(i.value),"aria-pressed":p,className:"flex-1 text-xs px-2 py-1 rounded border transition-colors "+(p?"bg-indigo-500/20 border-indigo-500/60 text-indigo-700 dark:text-indigo-200":"bg-gray-50 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:border-gray-400 dark:hover:border-gray-600"),children:i.label},i.value)})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Period"}),e.jsx("select",{value:y,onChange:i=>w(i.target.value),className:"w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded px-2 py-1 text-xs text-gray-700 dark:text-gray-300 focus:outline-none focus:border-indigo-500","aria-label":"Period",children:he.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),e.jsxs("button",{type:"button",onClick:v,className:"w-full inline-flex items-center justify-center gap-1.5 px-2 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium rounded","data-testid":`export-download-${t}`,children:[e.jsx(K,{size:13}),"Download"]})]})]})}function ve({trail:t}){return t.length===0?null:e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center text-xs text-gray-600 dark:text-gray-400",children:e.jsx("ol",{className:"flex items-center flex-wrap gap-1",children:t.map((n,r)=>{const a=r===t.length-1,x=!a&&typeof n.onClick=="function";return e.jsxs(s.Fragment,{children:[e.jsx("li",{className:"flex items-center",children:x?e.jsx("button",{type:"button",onClick:n.onClick,className:"text-gray-600 dark:text-gray-400 hover:text-indigo-400 focus:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400 rounded px-0.5",children:n.label}):e.jsx("span",{className:a?"text-gray-800 dark:text-gray-200 font-medium":"text-gray-600 dark:text-gray-400","aria-current":a?"page":void 0,children:n.label})}),!a&&e.jsx("li",{"aria-hidden":"true",className:"flex items-center text-gray-400 dark:text-gray-600",children:e.jsx(ae,{size:12})})]},`${r}-${n.label}`)})})})}function _e(){return e.jsxs("button",{type:"button","aria-label":"Go back",onClick:()=>{typeof window<"u"&&window.history.back()},className:"inline-flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 rounded focus:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400",children:[e.jsx(xe,{size:12}),"Back"]})}const je=s.lazy(()=>c(()=>import("./OverviewTab-CSNvLBfV.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),ke=s.lazy(()=>c(()=>import("./CommandsTab-DlkmMFl4.js"),__vite__mapDeps([20,1,21,2,3,22,4,18,19,6]))),Ee=s.lazy(()=>c(()=>import("./MessagesTab-Dull7JZB.js"),__vite__mapDeps([23,1,21,2,3,22,24,19,4,25,26,27,28,18,6]))),Te=s.lazy(()=>c(()=>import("./SearchTab-DsaZoPy9.js"),__vite__mapDeps([29,1,2,3,18,30,4,31]))),Ne=s.lazy(()=>c(()=>import("./QATab-DUs6uRU9.js"),__vite__mapDeps([32,1,2,3,18,30,4,33,34]))),Le=s.lazy(()=>c(()=>import("./BookmarksTab-Cor0cmyo.js"),__vite__mapDeps([35,1,2,3,18,19,4,24,30,33,6,13]))),Pe=s.lazy(()=>c(()=>import("./TagsTab-DSK8Zu2d.js"),__vite__mapDeps([36,1,2,3,18,5,6]))),De=s.lazy(()=>c(()=>import("./SessionsTab-NrDPSNfB.js"),__vite__mapDeps([37,1,2,3,18,25,26,27,28,38,4,19,6,5,15,17,39,34]))),Re=s.lazy(()=>c(()=>import("./AgentsTab-BajlmbLz.js"),__vite__mapDeps([40,1,2,3,4,18,6,17,15,5,39]))),Se=s.lazy(()=>c(()=>import("./PlaybackTab-0L9gLEFP.js"),__vite__mapDeps([41,1,2,3,18,39,12,6,42]))),Ae=s.lazy(()=>c(()=>import("./ContextReplayTab-ixP9t9_Y.js"),__vite__mapDeps([43,1,2,3,18,4,42]))),Ie=s.lazy(()=>c(()=>import("./CostTab-DCJQfNNf.js"),__vite__mapDeps([44,1,2,3,4,7,6,5,8,9,10,38,22,19,18]))),Oe=s.lazy(()=>c(()=>import("./BudgetsTab-BjHaaUsj.js"),__vite__mapDeps([45,1,2,3,18,4,6,13,10]))),ze=s.lazy(()=>c(()=>import("./CompareTab-D60fXyc4.js"),__vite__mapDeps([46,1,2,3,18,28,4,6,31]))),Ce=s.lazy(()=>c(()=>import("./YieldTab-BbHHGYlL.js"),__vite__mapDeps([47,1,2,3,18,4,6,48,8]))),$e=s.lazy(()=>c(()=>import("./ForksTab-ryk22jFG.js"),__vite__mapDeps([49,1,2,3,18,4,6,17]))),Be=s.lazy(()=>c(()=>import("./CodingHealthTab-B02yOcgC.js"),__vite__mapDeps([50,1,2,3,18,6,12,51,19,4]))),Ve=s.lazy(()=>c(()=>import("./WorktreesTab-B65wyswE.js"),__vite__mapDeps([52,1,2,3,18,4,6,53,13,14]))),Fe=P.map(t=>t.id);function W(t){return!!t&&Fe.includes(t)}function Ue(){const t=Q();return W(t)?t:"overview"}function Me(t){if(!t)return[];const n=Object.entries(t).filter(([r])=>r!==""&&r.toLowerCase()!=="unknown").map(([r,a])=>({model:r,count:typeof(a==null?void 0:a.count)=="number"?a.count:0}));return n.sort((r,a)=>a.count-r.count),n.slice(0,6).map(r=>r.model)}function qe(){var $,B;const{name:t}=H(),n=X(),{filters:r}=re(),[a,x]=s.useState(Ue),[b,y]=s.useState(0),{isTabVisible:w,betaEnabled:h,setBetaEnabled:v}=me(),i=s.useMemo(()=>P.filter(o=>w(o.id,o.isBeta??!1)),[w]);s.useEffect(()=>{if(typeof window>"u")return;const o=d=>{if(d.key!==null&&d.key!==q)return;let l=ge;try{const k=window.localStorage.getItem(q);if(k!==null){const V=JSON.parse(k);typeof V=="boolean"&&(l=V)}}catch{}l!==h&&v(l)};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[h,v]),s.useEffect(()=>{i.some(o=>o.id===a)||x("overview")},[i,a]);const{isLoading:p,error:u}=F({queryKey:["setProject",t],queryFn:()=>de(t),enabled:!!t,staleTime:6e4}),{data:g,isLoading:_,isFetching:E,error:T}=F({queryKey:["dashboardData",t,r.providers,r.models],queryFn:()=>ce(new Date().getTimezoneOffset(),{providers:r.providers,models:r.models}),enabled:!!t&&!p,placeholderData:(o,d)=>{var l;return((l=d==null?void 0:d.queryKey)==null?void 0:l[1])===t?o:void 0}}),N=Z({mutationFn:()=>ie(new Date().getTimezoneOffset()),onSuccess:()=>{n.invalidateQueries({queryKey:["dashboardData",t]})}}),Y=s.useCallback(o=>{if(x(o),typeof window>"u")return;const d=new URL(window.location.href);d.searchParams.set("tab",o);const l=`${d.pathname}${d.search}${d.hash}`,k=`${window.location.pathname}${window.location.search}${window.location.hash}`;l!==k&&window.history.replaceState({},"",l)},[]),A=s.useCallback((o,d)=>{x(o),ye(o,d)},[]);s.useEffect(()=>{if(!(typeof window>"u"))return window.__suSwitchTab=A,()=>{delete window.__suSwitchTab}},[A]),s.useEffect(()=>{if(typeof window>"u")return;const o=()=>{const d=Q();W(d)&&x(l=>l===d?l:d),y(l=>l+1)};return window.addEventListener(D,o),window.addEventListener("popstate",o),()=>{window.removeEventListener(D,o),window.removeEventListener("popstate",o)}},[]);const I=t?se(t,void 0,oe()):"";if(p||_)return e.jsx(U,{message:`Loading ${I}...`});if(u||T&&!g){const o=u||T;return e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-4 text-red-700 dark:text-red-400 text-sm",children:["Failed to load project: ",o instanceof Error?o.message:"Unknown error"]})})}if(!g)return e.jsx(le,{title:"No data",description:"No dashboard data available"});const m=g.statistics,G=L("q")??"",O=L("session"),z=L("interaction"),C=(($=P.find(o=>o.id===a))==null?void 0:$.label)??a;let j=null;return O?j=[{label:C,onClick:()=>J("session")},{label:`Session · ${O}`}]:z&&(j=[{label:C,onClick:()=>J("interaction")},{label:`Interaction · ${z}`}]),e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:I}),((B=m==null?void 0:m.overview)==null?void 0:B.date_range)&&e.jsxs("p",{className:"text-xs text-gray-500",children:[m.overview.date_range.start," — ",m.overview.date_range.end]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E&&!_&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-gray-500","aria-live":"polite",children:[e.jsx(M,{size:12,className:"animate-spin"}),"Updating…"]}),T&&g&&e.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",role:"status",children:"Refresh failed"}),g.is_reindexing&&e.jsx("span",{className:"text-xs text-yellow-700 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-900/20 px-2 py-1 rounded",children:"Reindexing..."}),e.jsxs("button",{onClick:()=>N.mutate(),disabled:N.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white rounded text-sm border border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-600 disabled:opacity-50",children:[e.jsx(M,{size:14,className:N.isPending?"animate-spin":""}),"Refresh"]})]})]}),e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-800 flex items-center justify-between gap-3",children:[e.jsx("nav",{className:"flex gap-0 -mb-px overflow-x-auto flex-1 min-w-0","data-testid":"dashboard-tabs",children:i.map(o=>{const d=o.icon;return e.jsxs("button",{onClick:()=>Y(o.id),"data-tab":o.id,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium whitespace-nowrap border-b-2 ${a===o.id?"text-indigo-400 border-indigo-400":"text-gray-600 dark:text-gray-400 border-transparent hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-400 dark:hover:border-gray-600"}`,children:[e.jsx(d,{size:14}),o.label,o.isBeta===!0&&e.jsx(pe,{className:"ml-1.5"})]},o.id)})}),e.jsx("div",{className:"pb-1.5 flex-shrink-0",children:e.jsx(we,{tab:a})})]}),e.jsx(ue,{modelOptions:Me(m==null?void 0:m.models)}),j&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_e,{}),e.jsx(ve,{trail:j})]}),e.jsx("div",{"aria-busy":E&&!_,className:`transition-opacity duration-200 ${E&&!_?"opacity-60":""}`,children:e.jsx(ne,{children:e.jsxs(s.Suspense,{fallback:e.jsx(U,{size:"md",message:"Loading..."}),children:[a==="overview"&&e.jsx(je,{stats:m}),a==="cost"&&e.jsx(Ie,{stats:m}),a==="budgets"&&e.jsx(Oe,{}),a==="compare"&&e.jsx(ze,{}),a==="yield"&&e.jsx(Ce,{}),a==="forks"&&e.jsx($e,{projectName:t}),a==="health"&&e.jsx(Be,{projectName:t}),a==="worktrees"&&e.jsx(Ve,{projectName:t}),a==="commands"&&e.jsx(ke,{data:g}),a==="messages"&&e.jsx(Ee,{data:g,projectName:t}),a==="search"&&e.jsx(Te,{projectName:t,initialQuery:G}),a==="qa"&&e.jsx(Ne,{projectName:t}),a==="bookmarks"&&e.jsx(Le,{}),a==="tags"&&e.jsx(Pe,{}),a==="sessions"&&e.jsx(De,{projectName:t,sessionEfficiency:m.session_efficiency}),a==="agents"&&e.jsx(Re,{projectName:t}),a==="playback"&&e.jsx(Se,{projectName:t}),a==="contextreplay"&&e.jsx(Ae,{projectName:t})]})},a)})]})}const Xe=Object.freeze(Object.defineProperty({__proto__:null,default:qe},Symbol.toStringTag,{value:"Module"}));export{K as I,D as N,Xe as P,Ge as a,J as c,L as g,He as o,ye as s}; diff --git a/stackunderflow/static/react/assets/ProviderChip-baymKnS_.js b/stackunderflow/static/react/assets/ProviderChip-Bd3LCPUs.js similarity index 70% rename from stackunderflow/static/react/assets/ProviderChip-baymKnS_.js rename to stackunderflow/static/react/assets/ProviderChip-Bd3LCPUs.js index 4bd19fa..5a81dc5 100644 --- a/stackunderflow/static/react/assets/ProviderChip-baymKnS_.js +++ b/stackunderflow/static/react/assets/ProviderChip-Bd3LCPUs.js @@ -1 +1 @@ -import{j as t}from"./react-vendor-B7v2HPaI.js";import{n as a,m as i,B as n}from"./index-DQluCO2S.js";function c({provider:o,size:r="sm"}){const e=a(o),s=i(o);return t.jsx(n,{color:e,size:r,children:s})}export{c as P}; +import{j as t}from"./react-vendor-B7v2HPaI.js";import{n as a,m as i,B as n}from"./index-0LeeVNek.js";function c({provider:o,size:r="sm"}){const e=a(o),s=i(o);return t.jsx(n,{color:e,size:r,children:s})}export{c as P}; diff --git a/stackunderflow/static/react/assets/QATab-DUs6uRU9.js b/stackunderflow/static/react/assets/QATab-BnX7j0t9.js similarity index 97% rename from stackunderflow/static/react/assets/QATab-DUs6uRU9.js rename to stackunderflow/static/react/assets/QATab-BnX7j0t9.js index 24930d8..aaba75b 100644 --- a/stackunderflow/static/react/assets/QATab-DUs6uRU9.js +++ b/stackunderflow/static/react/assets/QATab-BnX7j0t9.js @@ -1,4 +1,4 @@ -import{r as i,u as j,j as e}from"./react-vendor-B7v2HPaI.js";import{h as k,b as N,I as _,L as w,T as A,j as Q,X as S,Y as M}from"./index-DQluCO2S.js";import{E as R}from"./EmptyState-o0gibvhZ.js";import{T as I}from"./TimeAgo-BNE6wf6R.js";import{f as T}from"./format-Co_unrac.js";import{I as C}from"./IconSortDescending-DunfClYo.js";import{I as P}from"./IconCode-nzK0btv1.js";/** +import{r as i,u as j,j as e}from"./react-vendor-B7v2HPaI.js";import{h as k,b as N,I as _,L as w,T as A,j as Q,X as S,Y as M}from"./index-0LeeVNek.js";import{E as R}from"./EmptyState-o0gibvhZ.js";import{T as I}from"./TimeAgo-BNE6wf6R.js";import{f as T}from"./format-Co_unrac.js";import{I as C}from"./IconSortDescending-szhiy27L.js";import{I as P}from"./IconCode-DFtqsCTV.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/SearchTab-DsaZoPy9.js b/stackunderflow/static/react/assets/SearchTab-D03-qVTk.js similarity index 97% rename from stackunderflow/static/react/assets/SearchTab-DsaZoPy9.js rename to stackunderflow/static/react/assets/SearchTab-D03-qVTk.js index e84614e..fc2c453 100644 --- a/stackunderflow/static/react/assets/SearchTab-DsaZoPy9.js +++ b/stackunderflow/static/react/assets/SearchTab-D03-qVTk.js @@ -1 +1 @@ -import{r as n,u as v,j as e}from"./react-vendor-B7v2HPaI.js";import{V as w,b as g,I as S,L as E,T as C,j as R,B as z,W as I}from"./index-DQluCO2S.js";import{E as y}from"./EmptyState-o0gibvhZ.js";import{T}from"./TimeAgo-BNE6wf6R.js";import{f as q}from"./format-Co_unrac.js";import{I as L}from"./IconAlertCircle-h2zR9MWj.js";const f=20;function M(t,x){const[c,d]=n.useState(t);return n.useEffect(()=>{const r=setTimeout(()=>d(t),x);return()=>clearTimeout(r)},[t,x]),c}function P(t){switch(t){case"user":return"blue";case"assistant":return"green";case"system":return"yellow";case"tool":return"purple";default:return"gray"}}function A({html:t}){const c=t.replace(/<\/?(?!mark\b)[a-z][^>]*>/gi,"").split(/(|<\/mark>)/gi),d=[];let r=!1;for(let o=0;o"){r=!0;continue}if(i.toLowerCase()===""){r=!1;continue}i!==""&&(r?d.push(e.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-500/30 text-yellow-900 dark:text-yellow-200 rounded-sm px-0.5",children:i},o)):d.push(i))}return e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed",children:d})}function _({result:t}){return e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-800 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"mb-1.5",children:t.snippet?e.jsx(A,{html:t.snippet}):e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed line-clamp-3",children:t.content.length>300?t.content.slice(0,300)+"...":t.content})}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(z,{color:P(t.role),children:t.role}),t.model&&t.model!=="N/A"&&e.jsx("span",{className:"text-[10px] text-gray-500",title:t.model,children:q(t.model)}),e.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400 font-mono truncate max-w-[180px]",children:t.session_id}),e.jsx(T,{timestamp:t.timestamp})]})]}),e.jsx("div",{className:"flex-shrink-0 text-right",children:e.jsx("span",{className:"text-[10px] font-mono text-gray-500",children:t.relevance.toFixed(2)})})]})})}function H({projectName:t,initialQuery:x=""}){const[c,d]=n.useState(x),[r,o]=n.useState(1),[i,p]=n.useState(!1),h=n.useRef(null),l=M(c,300);n.useEffect(()=>{o(1)},[l]),n.useEffect(()=>{var a;(a=h.current)==null||a.focus()},[]);const{data:s,isLoading:b,isError:j,error:u}=v({queryKey:["search",t,l,r],queryFn:()=>I({q:l,project:t,page:r,per_page:f}),enabled:l.length>0}),N=n.useCallback(async()=>{p(!0);try{await w()}finally{p(!1)}},[]),m=s?Math.ceil(s.total/f):0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(g,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{ref:h,type:"text",value:c,onChange:a=>d(a.target.value),placeholder:"Search messages...",className:"w-full pl-9 pr-3 py-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md text-sm text-gray-800 dark:text-gray-200 placeholder-gray-500 focus:outline-none focus:border-blue-600 focus:ring-1 focus:ring-blue-600 transition-colors"})]}),e.jsxs("button",{onClick:N,disabled:i,className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-300 dark:hover:border-gray-600 disabled:opacity-50 transition-colors",title:"Reindex search",children:[e.jsx(S,{size:14,className:i?"animate-spin":""}),"Reindex"]})]}),s&&l&&e.jsxs("p",{className:"mt-2 text-xs text-gray-500",children:[s.total," result",s.total!==1?"s":""," for “",s.query,"”"]})]}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[!l&&e.jsx(y,{icon:e.jsx(g,{size:32}),title:"Search messages",description:"Enter a query to search across all messages in this project."}),l&&b&&e.jsx(E,{message:"Searching..."}),j&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[e.jsx(L,{size:32,className:"text-red-400 mb-2"}),e.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Search failed"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:u instanceof Error?u.message:"An unexpected error occurred"})]}),s&&s.results.length===0&&e.jsx(y,{icon:e.jsx(g,{size:32}),title:"No results found",description:`No messages match "${l}". Try a different search term.`}),s&&s.results.length>0&&e.jsx("div",{children:s.results.map((a,k)=>e.jsx(_,{result:a},`${a.session_id}-${k}`))})]}),s&&m>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-t border-gray-200 dark:border-gray-800",children:[e.jsxs("button",{onClick:()=>o(a=>Math.max(1,a-1)),disabled:r<=1,className:"flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(C,{size:14}),"Prev"]}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Page ",r," of ",m]}),e.jsxs("button",{onClick:()=>o(a=>Math.min(m,a+1)),disabled:r>=m,className:"flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:["Next",e.jsx(R,{size:14})]})]})]})}export{H as default}; +import{r as n,u as v,j as e}from"./react-vendor-B7v2HPaI.js";import{V as w,b as g,I as S,L as E,T as C,j as R,B as z,W as I}from"./index-0LeeVNek.js";import{E as y}from"./EmptyState-o0gibvhZ.js";import{T}from"./TimeAgo-BNE6wf6R.js";import{f as q}from"./format-Co_unrac.js";import{I as L}from"./IconAlertCircle-DmtLevj2.js";const f=20;function M(t,x){const[c,d]=n.useState(t);return n.useEffect(()=>{const r=setTimeout(()=>d(t),x);return()=>clearTimeout(r)},[t,x]),c}function P(t){switch(t){case"user":return"blue";case"assistant":return"green";case"system":return"yellow";case"tool":return"purple";default:return"gray"}}function A({html:t}){const c=t.replace(/<\/?(?!mark\b)[a-z][^>]*>/gi,"").split(/(|<\/mark>)/gi),d=[];let r=!1;for(let o=0;o"){r=!0;continue}if(i.toLowerCase()===""){r=!1;continue}i!==""&&(r?d.push(e.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-500/30 text-yellow-900 dark:text-yellow-200 rounded-sm px-0.5",children:i},o)):d.push(i))}return e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed",children:d})}function _({result:t}){return e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-800 hover:bg-gray-100/70 dark:hover:bg-gray-800/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"mb-1.5",children:t.snippet?e.jsx(A,{html:t.snippet}):e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed line-clamp-3",children:t.content.length>300?t.content.slice(0,300)+"...":t.content})}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(z,{color:P(t.role),children:t.role}),t.model&&t.model!=="N/A"&&e.jsx("span",{className:"text-[10px] text-gray-500",title:t.model,children:q(t.model)}),e.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400 font-mono truncate max-w-[180px]",children:t.session_id}),e.jsx(T,{timestamp:t.timestamp})]})]}),e.jsx("div",{className:"flex-shrink-0 text-right",children:e.jsx("span",{className:"text-[10px] font-mono text-gray-500",children:t.relevance.toFixed(2)})})]})})}function H({projectName:t,initialQuery:x=""}){const[c,d]=n.useState(x),[r,o]=n.useState(1),[i,p]=n.useState(!1),h=n.useRef(null),l=M(c,300);n.useEffect(()=>{o(1)},[l]),n.useEffect(()=>{var a;(a=h.current)==null||a.focus()},[]);const{data:s,isLoading:b,isError:j,error:u}=v({queryKey:["search",t,l,r],queryFn:()=>I({q:l,project:t,page:r,per_page:f}),enabled:l.length>0}),N=n.useCallback(async()=>{p(!0);try{await w()}finally{p(!1)}},[]),m=s?Math.ceil(s.total/f):0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(g,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{ref:h,type:"text",value:c,onChange:a=>d(a.target.value),placeholder:"Search messages...",className:"w-full pl-9 pr-3 py-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md text-sm text-gray-800 dark:text-gray-200 placeholder-gray-500 focus:outline-none focus:border-blue-600 focus:ring-1 focus:ring-blue-600 transition-colors"})]}),e.jsxs("button",{onClick:N,disabled:i,className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md hover:text-gray-800 dark:hover:text-gray-200 hover:border-gray-300 dark:hover:border-gray-600 disabled:opacity-50 transition-colors",title:"Reindex search",children:[e.jsx(S,{size:14,className:i?"animate-spin":""}),"Reindex"]})]}),s&&l&&e.jsxs("p",{className:"mt-2 text-xs text-gray-500",children:[s.total," result",s.total!==1?"s":""," for “",s.query,"”"]})]}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[!l&&e.jsx(y,{icon:e.jsx(g,{size:32}),title:"Search messages",description:"Enter a query to search across all messages in this project."}),l&&b&&e.jsx(E,{message:"Searching..."}),j&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[e.jsx(L,{size:32,className:"text-red-400 mb-2"}),e.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Search failed"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:u instanceof Error?u.message:"An unexpected error occurred"})]}),s&&s.results.length===0&&e.jsx(y,{icon:e.jsx(g,{size:32}),title:"No results found",description:`No messages match "${l}". Try a different search term.`}),s&&s.results.length>0&&e.jsx("div",{children:s.results.map((a,k)=>e.jsx(_,{result:a},`${a.session_id}-${k}`))})]}),s&&m>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-t border-gray-200 dark:border-gray-800",children:[e.jsxs("button",{onClick:()=>o(a=>Math.max(1,a-1)),disabled:r<=1,className:"flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(C,{size:14}),"Prev"]}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Page ",r," of ",m]}),e.jsxs("button",{onClick:()=>o(a=>Math.min(m,a+1)),disabled:r>=m,className:"flex items-center gap-1 px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:["Next",e.jsx(R,{size:14})]})]})]})}export{H as default}; diff --git a/stackunderflow/static/react/assets/SessionsTab-NrDPSNfB.js b/stackunderflow/static/react/assets/SessionsTab-3DJNVHPg.js similarity index 79% rename from stackunderflow/static/react/assets/SessionsTab-NrDPSNfB.js rename to stackunderflow/static/react/assets/SessionsTab-3DJNVHPg.js index 3519e0f..b6b532a 100644 --- a/stackunderflow/static/react/assets/SessionsTab-NrDPSNfB.js +++ b/stackunderflow/static/react/assets/SessionsTab-3DJNVHPg.js @@ -1,15 +1,10 @@ -import{r as n,j as e,u as D}from"./react-vendor-B7v2HPaI.js";import{h as oe,B as Ne,i as ve,u as we,I as Se,a as _e,L as U,b as Ce,T as $e,j as Me,N as ie,a3 as Ee,a4 as Ie,k as Fe}from"./index-DQluCO2S.js";import{E as le}from"./EmptyState-o0gibvhZ.js";import Le from"./Markdown-Be0CkqQs.js";import{P as Re}from"./ProviderChip-baymKnS_.js";import{I as ze,E as De}from"./EstimatedCostMarker-BpsBXEjf.js";import{o as Y,g as Q,c as W,N as G}from"./ProjectDashboard-DAsn11K-.js";import{b as Ke,f as de}from"./format-Co_unrac.js";import{I as X}from"./FilterBar-BS6lhcC1.js";import{I as ce}from"./dashboardTabs-C5ecR5YO.js";import{I as Te}from"./IconHash-cdeuBxnj.js";import{I as xe,a as R}from"./IconUser-IjRNaThB.js";import{I as ue}from"./IconRobot-DuCKb11z.js";import{I as ge}from"./IconClock-CgB7iTL4.js";import{I as me}from"./IconCode-nzK0btv1.js";import"./syntax-highlighter-BYF-y4SB.js";import"./markdown-DgJRk3H5.js";/** +import{r as n,j as e,u as R}from"./react-vendor-B7v2HPaI.js";import{h as je,B as Ne,i as ve,u as we,I as Se,a as _e,L as U,b as Ce,T as $e,j as Me,N as oe,a3 as Ee,a4 as Ie,k as Fe}from"./index-0LeeVNek.js";import{E as ie}from"./EmptyState-o0gibvhZ.js";import Le from"./Markdown-Be0CkqQs.js";import{P as ze}from"./ProviderChip-Bd3LCPUs.js";import{I as De,E as Re}from"./EstimatedCostMarker-DsipcjDe.js";import{o as Y,g as Q,c as W,N as G}from"./ProjectDashboard-CixMPUyA.js";import{b as Ke,f as le}from"./format-Co_unrac.js";import{h as K,I as de}from"./dashboardTabs-BuoED77E.js";import{I as X}from"./FilterBar-CML9sBEu.js";import{I as Te}from"./IconHash-Cw_3c3J-.js";import{I as ce,a as z}from"./IconUser-YF3ooIRT.js";import{I as xe}from"./IconRobot-DArBIG_E.js";import{I as ue}from"./IconClock-BfNEbW3j.js";import{I as ge}from"./IconCode-DFtqsCTV.js";import"./syntax-highlighter-BYF-y4SB.js";import"./markdown-DgJRk3H5.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const Oe=[["path",{d:"M21 17l-18 0",key:"svg-0"}],["path",{d:"M6 10l-3 -3l3 -3",key:"svg-1"}],["path",{d:"M3 7l18 0",key:"svg-2"}],["path",{d:"M18 20l3 -3l-3 -3",key:"svg-3"}]],K=oe("outline","arrows-left-right","ArrowsLeftRight",Oe);/** - * @license @tabler/icons-react v3.36.1 - MIT - * - * This source code is licensed under the MIT license. - * See the LICENSE file in the root directory of this source tree. - */const Be=[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]],Ae=oe("outline","eye","Eye",Be);function Pe(t,r){const[s,d]=n.useState(r.key),[o,g]=n.useState(r.dir),h=n.useCallback(m=>{if(m===s){g(i=>i==="asc"?"desc":"asc");return}d(m);let k=!1;for(const i of t){const c=i[m];if(c!=null){k=typeof c=="number"||typeof c=="boolean";break}}g(k?"desc":"asc")},[s,t]);return{sorted:n.useMemo(()=>{const m=t.slice();return m.sort((k,i)=>{const c=k[s],b=i[s],y=c==null||typeof c=="number"&&Number.isNaN(c),a=b==null||typeof b=="number"&&Number.isNaN(b);if(y&&a)return 0;if(y)return 1;if(a)return-1;let p=0;return typeof c=="number"&&typeof b=="number"?p=c-b:p=String(c).localeCompare(String(b),void 0,{numeric:!0,sensitivity:"base"}),o==="asc"?p:-p}),m},[t,s,o]),sortKey:s,sortDir:o,setSort:h}}function _({label:t,sortKey:r,activeKey:s,dir:d,onClick:o,className:g,align:h="left"}){const x=r===s,m=h==="right"?"text-right":"text-left",k=x?d==="asc"?ze:ve:null;return e.jsx("th",{onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o())},className:["cursor-pointer select-none",m,g??""].filter(Boolean).join(" "),"data-sort-key":r,"aria-sort":x?d==="asc"?"ascending":"descending":"none",role:"columnheader",scope:"col",tabIndex:0,children:e.jsxs("span",{className:["inline-flex items-center gap-1",h==="right"?"w-full justify-end":""].filter(Boolean).join(" "),children:[e.jsx("span",{children:t}),k?e.jsx(k,{size:12,stroke:2.5,"aria-hidden":"true"}):null]})})}const Je={"edit-heavy":"green","research-heavy":"blue",balanced:"gray","idle-heavy":"yellow"},Z=["edit-heavy","research-heavy","idle-heavy","balanced"],Ve=[{key:"all",label:"All"},{key:"edit-heavy",label:"edit-heavy"},{key:"research-heavy",label:"research-heavy"},{key:"idle-heavy",label:"idle-heavy"},{key:"balanced",label:"balanced"}];function qe(t){return t.length>12?t.slice(0,8):t}function ee(t){if(!t||t<1)return"—";if(t<60)return`${t.toFixed(0)}s`;const r=t/60;return r<60?`${r.toFixed(1)}m`:`${(r/60).toFixed(1)}h`}function F(t){return`${(t*100).toFixed(0)}%`}function He(t){const r={};for(const s of t)r[s.classification]=(r[s.classification]??0)+1;return r}function Ue({data:t}){const r=n.useMemo(()=>t??[],[t]),[s,d]=n.useState("all"),o=n.useMemo(()=>s==="all"?r:r.filter(a=>a.classification===s),[r,s]),{sorted:g,sortKey:h,sortDir:x,setSort:m}=Pe(o,{key:"idle_gap_total_s",dir:"desc"}),k=n.useMemo(()=>He(r),[r]),i=n.useMemo(()=>{const a=new Set(Z),p=Object.keys(k).filter(j=>!a.has(j)).sort();return[...Z.filter(j=>k[j]),...p]},[k]);if(!t||t.length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"session-efficiency-table",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Session Efficiency"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No session efficiency data yet"})]});const c=String(h),b=i.map(a=>`${k[a]??0} ${a}`),y=b.length?b.join(" · "):"";return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"session-efficiency-table",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Session Efficiency",e.jsx("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:o.length===r.length?`${r.length} sessions`:`${o.length} of ${r.length} sessions`})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",role:"toolbar","aria-label":"Filter by classification","data-testid":"session-efficiency-filter-chips",children:Ve.map(a=>{const p=s===a.key,j=a.key==="all"?r.length:k[a.key]??0,v=a.key!=="all"&&j===0;return e.jsxs("button",{type:"button",disabled:v,onClick:()=>d(a.key),"data-testid":`session-efficiency-chip-${a.key}`,"aria-pressed":p,className:["inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs border transition-colors",p?"bg-blue-100 text-blue-800 border-blue-300 dark:bg-blue-900/60 dark:text-blue-200 dark:border-blue-700":"bg-gray-100/80 dark:bg-gray-800/60 text-gray-600 dark:text-gray-400 border-gray-300 dark:border-gray-700 hover:bg-white dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200",v?"opacity-40 cursor-not-allowed hover:bg-gray-100/80 dark:hover:bg-gray-800/60 hover:text-gray-600 dark:hover:text-gray-400":""].filter(Boolean).join(" "),children:[e.jsx("span",{children:a.label}),e.jsx("span",{className:"text-[10px] tabular-nums opacity-80",children:j})]},a.key)})}),e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx(_,{label:"Session",sortKey:"session_id",activeKey:c,dir:x,onClick:()=>m("session_id"),className:"px-3 py-2 w-28"}),e.jsx(_,{label:"Class",sortKey:"classification",activeKey:c,dir:x,onClick:()=>m("classification"),className:"px-3 py-2 w-36"}),e.jsx(_,{label:"Edit",sortKey:"edit_ratio",activeKey:c,dir:x,onClick:()=>m("edit_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Read",sortKey:"read_ratio",activeKey:c,dir:x,onClick:()=>m("read_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Search",sortKey:"search_ratio",activeKey:c,dir:x,onClick:()=>m("search_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Bash",sortKey:"bash_ratio",activeKey:c,dir:x,onClick:()=>m("bash_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Idle Total",sortKey:"idle_gap_total_s",activeKey:c,dir:x,onClick:()=>m("idle_gap_total_s"),align:"right",className:"px-3 py-2 w-24"}),e.jsx(_,{label:"Idle Max",sortKey:"idle_gap_max_s",activeKey:c,dir:x,onClick:()=>m("idle_gap_max_s"),align:"right",className:"px-3 py-2 w-24"})]})}),e.jsx("tbody",{children:g.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-6 text-center text-xs text-gray-500",children:"No sessions match this filter"})}):g.map(a=>{const p=Je[a.classification]??"gray";return e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 cursor-pointer hover:bg-gray-100/60 dark:hover:bg-gray-800/40 focus:bg-gray-100/80 dark:focus:bg-gray-800/60 focus:outline-none",onClick:()=>Y(a.session_id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),Y(a.session_id))},tabIndex:0,role:"link","aria-label":`Open session ${a.session_id}`,"data-testid":`session-efficiency-row-${a.session_id}`,children:[e.jsx("td",{className:"px-3 py-2 text-gray-700 dark:text-gray-300 font-mono text-xs",children:qe(a.session_id)}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(Ne,{color:p,children:a.classification})}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.edit_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.read_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.search_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.bash_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums",children:ee(a.idle_gap_total_s)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums",children:ee(a.idle_gap_max_s)})]},a.session_id)})})]})})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500","data-testid":"session-efficiency-footer",children:[r.length," sessions",y?`: ${y}`:""]})]})}const Ye=new Set(["cost","errors","duration_s","input","output","cache_creation","cache_read","commands","messages"]),te=[{key:"cost",label:"Cost",kind:"cost"},{key:"input",label:"Input tokens",kind:"tokens"},{key:"output",label:"Output tokens",kind:"tokens"},{key:"cache_read",label:"Cache read",kind:"tokens"},{key:"cache_creation",label:"Cache creation",kind:"tokens"},{key:"commands",label:"Commands",kind:"count"},{key:"messages",label:"Messages",kind:"count"},{key:"errors",label:"Errors",kind:"count"},{key:"duration_s",label:"Duration",kind:"duration"}];function L(t){return t.length>12?t.slice(0,8):t}function Qe(t){return Number.isFinite(t)?Math.round(t).toLocaleString():"0"}function We(t){if(!t)return"0s";if(Math.abs(t)<60)return`${t.toFixed(0)}s`;const s=t/60;return Math.abs(s)<60?`${s.toFixed(1)}m`:`${(s/60).toFixed(1)}h`}function T(t,r,s){switch(t){case"cost":return Ke(r,s);case"duration":return We(r);case"tokens":case"count":return Qe(r)}}function Ge(t,r,s){if(r===0)return"—";const d=r>0?"+":"−",o=T(t,Math.abs(r),s);return`${d}${o}`}function Xe(t){return t===null?"":isFinite(t)?t===0?"":` (${t>0?"+":"−"}${Math.abs(t).toFixed(0)}%)`:"∞%"}function re(t,r){var s;switch(r){case"cost":return t.cost??0;case"commands":return t.commands??0;case"messages":return t.messages??0;case"errors":return t.errors??0;case"duration_s":return t.duration_s??0;default:return((s=t.tokens)==null?void 0:s[r])??0}}function Ze(t,r){var s;switch(r){case"cost":return t.cost??0;case"commands":return t.commands??0;case"messages":return 0;case"errors":return t.errors??0;case"duration_s":return t.duration_s??0;default:return((s=t.tokens)==null?void 0:s[r])??0}}function et(t,r){return r===0?"text-gray-500":Ye.has(t)?r<0?"text-green-400":"text-red-400":r>0?"text-green-400":"text-red-400"}function tt({logPath:t,sessionAId:r,sessionBId:s,onClose:d}){const{currency:o}=we(),[g,h]=n.useState(null),[x,m]=n.useState(!1),[k,i]=n.useState(null),c=!!(r&&s),b=n.useCallback(async()=>{if(!c||!t){h(null);return}m(!0),i(null);try{const a=`/api/sessions/compare?log_path=${encodeURIComponent(t)}&a=${encodeURIComponent(r)}&b=${encodeURIComponent(s)}`,p=await fetch(a);if(!p.ok){const v=await p.text().catch(()=>"");throw new Error(`${p.status} ${p.statusText}${v?`: ${v}`:""}`)}const j=await p.json();h(j)}catch(a){i(a instanceof Error?a.message:String(a)),h(null)}finally{m(!1)}},[t,r,s,c]);if(n.useEffect(()=>{b()},[b]),!c)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-6 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(K,{size:16,className:"text-indigo-400"}),e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Compare sessions"}),d&&e.jsx("button",{type:"button",onClick:d,className:"ml-auto text-gray-500 hover:text-gray-700 dark:hover:text-gray-300","aria-label":"Close compare view",children:e.jsx(X,{size:14})})]}),e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center",children:"Pick two sessions to compare them side-by-side."})]});const y=e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(K,{size:16,className:"text-indigo-400"}),e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Compare sessions",e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal font-mono",children:[L(r)," ↔ ",L(s)]})]}),d&&e.jsx("button",{type:"button",onClick:d,className:"ml-auto text-gray-500 hover:text-gray-700 dark:hover:text-gray-300","aria-label":"Close compare view",children:e.jsx(X,{size:14})})]});return x?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Metric"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"A"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"B"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"Δ"})]})}),e.jsx("tbody",{children:te.map(a=>e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 animate-pulse",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-24 bg-gray-200/80 dark:bg-gray-700/60 rounded"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-16 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-16 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-12 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})})]},a.key))})]})})]}):k?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-red-300 dark:border-red-900/60",children:[y,e.jsxs("div",{className:"bg-red-100 dark:bg-red-950/30 border border-red-300 dark:border-red-900/40 rounded p-3 text-xs text-red-800 dark:text-red-200",children:[e.jsx("div",{className:"font-medium mb-1",children:"Failed to load comparison"}),e.jsx("div",{className:"text-red-700/90 dark:text-red-300/80 break-all",children:k}),e.jsxs("button",{type:"button",onClick:b,className:"mt-3 inline-flex items-center gap-1 px-2 py-1 rounded bg-red-200 dark:bg-red-900/50 hover:bg-red-300 dark:hover:bg-red-900/70 border border-red-400 dark:border-red-800 text-red-800 dark:text-red-100 text-[11px] uppercase tracking-wider",children:[e.jsx(Se,{size:12})," Retry"]})]})]}):g?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Metric"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:e.jsxs("span",{className:"font-mono text-indigo-700 dark:text-indigo-300",children:["A · ",L(g.a.session_id)]})}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:e.jsxs("span",{className:"font-mono text-indigo-700 dark:text-indigo-300",children:["B · ",L(g.b.session_id)]})}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"Δ (B − A)"})]})}),e.jsx("tbody",{children:te.map(a=>{const p=re(g.a,a.key),j=re(g.b,a.key),v=Ze(g.diff,a.key),l=v!==0?v:j-p,w=p!==0?l/Math.abs(p)*100:l===0?0:1/0,N=et(a.key,l);return e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50",children:[e.jsx("td",{className:"px-3 py-2 text-gray-700 dark:text-gray-300",children:a.label}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:T(a.kind,p,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:T(a.kind,j,o)}),e.jsxs("td",{className:`px-3 py-2 text-right tabular-nums ${N}`,children:[Ge(a.kind,l,o),e.jsx("span",{className:"text-[10px] text-gray-500",children:Xe(w)})]})]},a.key)})})]})})})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center",children:"No comparison data."})]})}function rt({total:t,initialCount:r=60,step:s=60,resetKey:d=""}){const[o,g]=n.useState(r),h=n.useRef(null);n.useEffect(()=>{g(r)},[d,r]);const x=Math.min(o,t),m=x{if(!m)return;const i=h.current;if(!i)return;const c=new IntersectionObserver(b=>{b.some(y=>y.isIntersecting)&&g(y=>Math.min(t,y+s))},{rootMargin:"400px 0px"});return c.observe(i),()=>c.disconnect()},[m,t,s]);const k=n.useCallback(i=>{g(c=>i>c?i:c)},[]);return{visibleCount:x,sentinelRef:h,hasMore:m,revealUpTo:k}}const M=30,se=60;function st(t,r){const[s,d]=n.useState(t);return n.useEffect(()=>{const o=setTimeout(()=>d(t),r);return()=>clearTimeout(o)},[t,r]),s}function at(t){return t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}function $(t){if(t===null)return"—";try{return(typeof t=="number"?new Date(t*1e3):new Date(t)).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return String(t)}}function O(t){if(!t)return"—";if(t<1)return"< 1m";if(t<60)return`${Math.round(t)}m`;const r=Math.floor(t/60),s=Math.round(t%60);return s>0?`${r}h ${s}m`:`${r}h`}function nt(t){if(t===null)return"—";try{return(typeof t=="number"?new Date(t*1e3):new Date(t)).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return String(t)}}function ot(t){const r=Date.now()/1e3-t;return r<3600?`${Math.round(r/60)}m ago`:r<86400?`${Math.round(r/3600)}h ago`:r<604800?`${Math.round(r/86400)}d ago`:nt(t)}const ae={human:{icon:R,color:"text-blue-400",bg:"bg-blue-500/10",label:"You"},user:{icon:R,color:"text-blue-400",bg:"bg-blue-500/10",label:"You"},assistant:{icon:ue,color:"text-emerald-400",bg:"bg-emerald-500/10",label:"Claude"},tool_use:{icon:ie,color:"text-purple-400",bg:"bg-purple-500/10",label:"Tool Call"},tool_result:{icon:me,color:"text-amber-400",bg:"bg-amber-500/10",label:"Tool Result"}},it=new Set(["progress","file-history-snapshot","pr-link","queue-operation","last-prompt","system"]);function lt(t){return it.has(String(t.type??""))}function dt(t){if(t.type!=="user"&&t.type!=="human")return!1;const r=t.message,s=r==null?void 0:r.content;return Array.isArray(s)?s.some(d=>typeof d=="object"&&d!==null&&d.type==="tool_result"):!1}function ye(t){return dt(t)?"tool_result":t.type==="user"||t.type==="human"?"human":t.type==="assistant"?"assistant":String(t.type??"unknown")}function pe(t){const r=t.message,s=(r==null?void 0:r.content)??t.content??t.summary;if(typeof s=="string")return s;if(Array.isArray(s)){const d=[];for(const o of s){if(typeof o=="string"){d.push(o);continue}if(!o||typeof o!="object")continue;const g=o;if(g.type==="text")d.push(String(g.text??""));else if(g.type==="tool_use")d.push(`**Tool: ${g.name}** + */const Oe=[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]],Be=je("outline","eye","Eye",Oe);function Ae(t,r){const[s,d]=n.useState(r.key),[o,g]=n.useState(r.dir),h=n.useCallback(m=>{if(m===s){g(i=>i==="asc"?"desc":"asc");return}d(m);let k=!1;for(const i of t){const c=i[m];if(c!=null){k=typeof c=="number"||typeof c=="boolean";break}}g(k?"desc":"asc")},[s,t]);return{sorted:n.useMemo(()=>{const m=t.slice();return m.sort((k,i)=>{const c=k[s],b=i[s],y=c==null||typeof c=="number"&&Number.isNaN(c),a=b==null||typeof b=="number"&&Number.isNaN(b);if(y&&a)return 0;if(y)return 1;if(a)return-1;let p=0;return typeof c=="number"&&typeof b=="number"?p=c-b:p=String(c).localeCompare(String(b),void 0,{numeric:!0,sensitivity:"base"}),o==="asc"?p:-p}),m},[t,s,o]),sortKey:s,sortDir:o,setSort:h}}function _({label:t,sortKey:r,activeKey:s,dir:d,onClick:o,className:g,align:h="left"}){const x=r===s,m=h==="right"?"text-right":"text-left",k=x?d==="asc"?De:ve:null;return e.jsx("th",{onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o())},className:["cursor-pointer select-none",m,g??""].filter(Boolean).join(" "),"data-sort-key":r,"aria-sort":x?d==="asc"?"ascending":"descending":"none",role:"columnheader",scope:"col",tabIndex:0,children:e.jsxs("span",{className:["inline-flex items-center gap-1",h==="right"?"w-full justify-end":""].filter(Boolean).join(" "),children:[e.jsx("span",{children:t}),k?e.jsx(k,{size:12,stroke:2.5,"aria-hidden":"true"}):null]})})}const Pe={"edit-heavy":"green","research-heavy":"blue",balanced:"gray","idle-heavy":"yellow"},Z=["edit-heavy","research-heavy","idle-heavy","balanced"],Je=[{key:"all",label:"All"},{key:"edit-heavy",label:"edit-heavy"},{key:"research-heavy",label:"research-heavy"},{key:"idle-heavy",label:"idle-heavy"},{key:"balanced",label:"balanced"}];function Ve(t){return t.length>12?t.slice(0,8):t}function ee(t){if(!t||t<1)return"—";if(t<60)return`${t.toFixed(0)}s`;const r=t/60;return r<60?`${r.toFixed(1)}m`:`${(r/60).toFixed(1)}h`}function F(t){return`${(t*100).toFixed(0)}%`}function qe(t){const r={};for(const s of t)r[s.classification]=(r[s.classification]??0)+1;return r}function He({data:t}){const r=n.useMemo(()=>t??[],[t]),[s,d]=n.useState("all"),o=n.useMemo(()=>s==="all"?r:r.filter(a=>a.classification===s),[r,s]),{sorted:g,sortKey:h,sortDir:x,setSort:m}=Ae(o,{key:"idle_gap_total_s",dir:"desc"}),k=n.useMemo(()=>qe(r),[r]),i=n.useMemo(()=>{const a=new Set(Z),p=Object.keys(k).filter(j=>!a.has(j)).sort();return[...Z.filter(j=>k[j]),...p]},[k]);if(!t||t.length===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"session-efficiency-table",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Session Efficiency"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No session efficiency data yet"})]});const c=String(h),b=i.map(a=>`${k[a]??0} ${a}`),y=b.length?b.join(" · "):"";return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"session-efficiency-table",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Session Efficiency",e.jsx("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:o.length===r.length?`${r.length} sessions`:`${o.length} of ${r.length} sessions`})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",role:"toolbar","aria-label":"Filter by classification","data-testid":"session-efficiency-filter-chips",children:Je.map(a=>{const p=s===a.key,j=a.key==="all"?r.length:k[a.key]??0,v=a.key!=="all"&&j===0;return e.jsxs("button",{type:"button",disabled:v,onClick:()=>d(a.key),"data-testid":`session-efficiency-chip-${a.key}`,"aria-pressed":p,className:["inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs border transition-colors",p?"bg-blue-100 text-blue-800 border-blue-300 dark:bg-blue-900/60 dark:text-blue-200 dark:border-blue-700":"bg-gray-100/80 dark:bg-gray-800/60 text-gray-600 dark:text-gray-400 border-gray-300 dark:border-gray-700 hover:bg-white dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200",v?"opacity-40 cursor-not-allowed hover:bg-gray-100/80 dark:hover:bg-gray-800/60 hover:text-gray-600 dark:hover:text-gray-400":""].filter(Boolean).join(" "),children:[e.jsx("span",{children:a.label}),e.jsx("span",{className:"text-[10px] tabular-nums opacity-80",children:j})]},a.key)})}),e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx(_,{label:"Session",sortKey:"session_id",activeKey:c,dir:x,onClick:()=>m("session_id"),className:"px-3 py-2 w-28"}),e.jsx(_,{label:"Class",sortKey:"classification",activeKey:c,dir:x,onClick:()=>m("classification"),className:"px-3 py-2 w-36"}),e.jsx(_,{label:"Edit",sortKey:"edit_ratio",activeKey:c,dir:x,onClick:()=>m("edit_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Read",sortKey:"read_ratio",activeKey:c,dir:x,onClick:()=>m("read_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Search",sortKey:"search_ratio",activeKey:c,dir:x,onClick:()=>m("search_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Bash",sortKey:"bash_ratio",activeKey:c,dir:x,onClick:()=>m("bash_ratio"),align:"right",className:"px-3 py-2 w-20"}),e.jsx(_,{label:"Idle Total",sortKey:"idle_gap_total_s",activeKey:c,dir:x,onClick:()=>m("idle_gap_total_s"),align:"right",className:"px-3 py-2 w-24"}),e.jsx(_,{label:"Idle Max",sortKey:"idle_gap_max_s",activeKey:c,dir:x,onClick:()=>m("idle_gap_max_s"),align:"right",className:"px-3 py-2 w-24"})]})}),e.jsx("tbody",{children:g.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-6 text-center text-xs text-gray-500",children:"No sessions match this filter"})}):g.map(a=>{const p=Pe[a.classification]??"gray";return e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 cursor-pointer hover:bg-gray-100/60 dark:hover:bg-gray-800/40 focus:bg-gray-100/80 dark:focus:bg-gray-800/60 focus:outline-none",onClick:()=>Y(a.session_id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),Y(a.session_id))},tabIndex:0,role:"link","aria-label":`Open session ${a.session_id}`,"data-testid":`session-efficiency-row-${a.session_id}`,children:[e.jsx("td",{className:"px-3 py-2 text-gray-700 dark:text-gray-300 font-mono text-xs",children:Ve(a.session_id)}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(Ne,{color:p,children:a.classification})}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.edit_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.read_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.search_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-700 dark:text-gray-300 tabular-nums",children:F(a.bash_ratio)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums",children:ee(a.idle_gap_total_s)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums",children:ee(a.idle_gap_max_s)})]},a.session_id)})})]})})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500","data-testid":"session-efficiency-footer",children:[r.length," sessions",y?`: ${y}`:""]})]})}const Ue=new Set(["cost","errors","duration_s","input","output","cache_creation","cache_read","commands","messages"]),te=[{key:"cost",label:"Cost",kind:"cost"},{key:"input",label:"Input tokens",kind:"tokens"},{key:"output",label:"Output tokens",kind:"tokens"},{key:"cache_read",label:"Cache read",kind:"tokens"},{key:"cache_creation",label:"Cache creation",kind:"tokens"},{key:"commands",label:"Commands",kind:"count"},{key:"messages",label:"Messages",kind:"count"},{key:"errors",label:"Errors",kind:"count"},{key:"duration_s",label:"Duration",kind:"duration"}];function L(t){return t.length>12?t.slice(0,8):t}function Ye(t){return Number.isFinite(t)?Math.round(t).toLocaleString():"0"}function Qe(t){if(!t)return"0s";if(Math.abs(t)<60)return`${t.toFixed(0)}s`;const s=t/60;return Math.abs(s)<60?`${s.toFixed(1)}m`:`${(s/60).toFixed(1)}h`}function T(t,r,s){switch(t){case"cost":return Ke(r,s);case"duration":return Qe(r);case"tokens":case"count":return Ye(r)}}function We(t,r,s){if(r===0)return"—";const d=r>0?"+":"−",o=T(t,Math.abs(r),s);return`${d}${o}`}function Ge(t){return t===null?"":isFinite(t)?t===0?"":` (${t>0?"+":"−"}${Math.abs(t).toFixed(0)}%)`:"∞%"}function re(t,r){var s;switch(r){case"cost":return t.cost??0;case"commands":return t.commands??0;case"messages":return t.messages??0;case"errors":return t.errors??0;case"duration_s":return t.duration_s??0;default:return((s=t.tokens)==null?void 0:s[r])??0}}function Xe(t,r){var s;switch(r){case"cost":return t.cost??0;case"commands":return t.commands??0;case"messages":return 0;case"errors":return t.errors??0;case"duration_s":return t.duration_s??0;default:return((s=t.tokens)==null?void 0:s[r])??0}}function Ze(t,r){return r===0?"text-gray-500":Ue.has(t)?r<0?"text-green-400":"text-red-400":r>0?"text-green-400":"text-red-400"}function et({logPath:t,sessionAId:r,sessionBId:s,onClose:d}){const{currency:o}=we(),[g,h]=n.useState(null),[x,m]=n.useState(!1),[k,i]=n.useState(null),c=!!(r&&s),b=n.useCallback(async()=>{if(!c||!t){h(null);return}m(!0),i(null);try{const a=`/api/sessions/compare?log_path=${encodeURIComponent(t)}&a=${encodeURIComponent(r)}&b=${encodeURIComponent(s)}`,p=await fetch(a);if(!p.ok){const v=await p.text().catch(()=>"");throw new Error(`${p.status} ${p.statusText}${v?`: ${v}`:""}`)}const j=await p.json();h(j)}catch(a){i(a instanceof Error?a.message:String(a)),h(null)}finally{m(!1)}},[t,r,s,c]);if(n.useEffect(()=>{b()},[b]),!c)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-6 border border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(K,{size:16,className:"text-indigo-400"}),e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Compare sessions"}),d&&e.jsx("button",{type:"button",onClick:d,className:"ml-auto text-gray-500 hover:text-gray-700 dark:hover:text-gray-300","aria-label":"Close compare view",children:e.jsx(X,{size:14})})]}),e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center",children:"Pick two sessions to compare them side-by-side."})]});const y=e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(K,{size:16,className:"text-indigo-400"}),e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Compare sessions",e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal font-mono",children:[L(r)," ↔ ",L(s)]})]}),d&&e.jsx("button",{type:"button",onClick:d,className:"ml-auto text-gray-500 hover:text-gray-700 dark:hover:text-gray-300","aria-label":"Close compare view",children:e.jsx(X,{size:14})})]});return x?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Metric"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"A"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"B"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"Δ"})]})}),e.jsx("tbody",{children:te.map(a=>e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50 animate-pulse",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-24 bg-gray-200/80 dark:bg-gray-700/60 rounded"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-16 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-16 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"h-3 w-12 bg-gray-200/60 dark:bg-gray-700/40 rounded ml-auto"})})]},a.key))})]})})]}):k?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-red-300 dark:border-red-900/60",children:[y,e.jsxs("div",{className:"bg-red-100 dark:bg-red-950/30 border border-red-300 dark:border-red-900/40 rounded p-3 text-xs text-red-800 dark:text-red-200",children:[e.jsx("div",{className:"font-medium mb-1",children:"Failed to load comparison"}),e.jsx("div",{className:"text-red-700/90 dark:text-red-300/80 break-all",children:k}),e.jsxs("button",{type:"button",onClick:b,className:"mt-3 inline-flex items-center gap-1 px-2 py-1 rounded bg-red-200 dark:bg-red-900/50 hover:bg-red-300 dark:hover:bg-red-900/70 border border-red-400 dark:border-red-800 text-red-800 dark:text-red-100 text-[11px] uppercase tracking-wider",children:[e.jsx(Se,{size:12})," Retry"]})]})]}):g?e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"bg-gray-100/50 dark:bg-gray-800/30 rounded border border-gray-200 dark:border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-400 text-xs uppercase tracking-wider whitespace-nowrap",children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Metric"}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:e.jsxs("span",{className:"font-mono text-indigo-700 dark:text-indigo-300",children:["A · ",L(g.a.session_id)]})}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:e.jsxs("span",{className:"font-mono text-indigo-700 dark:text-indigo-300",children:["B · ",L(g.b.session_id)]})}),e.jsx("th",{className:"px-3 py-2 text-right w-40",children:"Δ (B − A)"})]})}),e.jsx("tbody",{children:te.map(a=>{const p=re(g.a,a.key),j=re(g.b,a.key),v=Xe(g.diff,a.key),l=v!==0?v:j-p,w=p!==0?l/Math.abs(p)*100:l===0?0:1/0,N=Ze(a.key,l);return e.jsxs("tr",{className:"border-b border-gray-200/50 dark:border-gray-800/50",children:[e.jsx("td",{className:"px-3 py-2 text-gray-700 dark:text-gray-300",children:a.label}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:T(a.kind,p,o)}),e.jsx("td",{className:"px-3 py-2 text-right text-gray-800 dark:text-gray-200 tabular-nums",children:T(a.kind,j,o)}),e.jsxs("td",{className:`px-3 py-2 text-right tabular-nums ${N}`,children:[We(a.kind,l,o),e.jsx("span",{className:"text-[10px] text-gray-500",children:Ge(w)})]})]},a.key)})})]})})})]}):e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[y,e.jsx("div",{className:"text-xs text-gray-500 py-6 text-center",children:"No comparison data."})]})}function tt({total:t,initialCount:r=60,step:s=60,resetKey:d=""}){const[o,g]=n.useState(r),h=n.useRef(null);n.useEffect(()=>{g(r)},[d,r]);const x=Math.min(o,t),m=x{if(!m)return;const i=h.current;if(!i)return;const c=new IntersectionObserver(b=>{b.some(y=>y.isIntersecting)&&g(y=>Math.min(t,y+s))},{rootMargin:"400px 0px"});return c.observe(i),()=>c.disconnect()},[m,t,s]);const k=n.useCallback(i=>{g(c=>i>c?i:c)},[]);return{visibleCount:x,sentinelRef:h,hasMore:m,revealUpTo:k}}const M=30,se=60;function rt(t,r){const[s,d]=n.useState(t);return n.useEffect(()=>{const o=setTimeout(()=>d(t),r);return()=>clearTimeout(o)},[t,r]),s}function st(t){return t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}function $(t){if(t===null)return"—";try{return(typeof t=="number"?new Date(t*1e3):new Date(t)).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return String(t)}}function O(t){if(!t)return"—";if(t<1)return"< 1m";if(t<60)return`${Math.round(t)}m`;const r=Math.floor(t/60),s=Math.round(t%60);return s>0?`${r}h ${s}m`:`${r}h`}function at(t){if(t===null)return"—";try{return(typeof t=="number"?new Date(t*1e3):new Date(t)).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return String(t)}}function nt(t){const r=Date.now()/1e3-t;return r<3600?`${Math.round(r/60)}m ago`:r<86400?`${Math.round(r/3600)}h ago`:r<604800?`${Math.round(r/86400)}d ago`:at(t)}const ae={human:{icon:z,color:"text-blue-400",bg:"bg-blue-500/10",label:"You"},user:{icon:z,color:"text-blue-400",bg:"bg-blue-500/10",label:"You"},assistant:{icon:xe,color:"text-emerald-400",bg:"bg-emerald-500/10",label:"Claude"},tool_use:{icon:oe,color:"text-purple-400",bg:"bg-purple-500/10",label:"Tool Call"},tool_result:{icon:ge,color:"text-amber-400",bg:"bg-amber-500/10",label:"Tool Result"}},ot=new Set(["progress","file-history-snapshot","pr-link","queue-operation","last-prompt","system"]);function it(t){return ot.has(String(t.type??""))}function lt(t){if(t.type!=="user"&&t.type!=="human")return!1;const r=t.message,s=r==null?void 0:r.content;return Array.isArray(s)?s.some(d=>typeof d=="object"&&d!==null&&d.type==="tool_result"):!1}function me(t){return lt(t)?"tool_result":t.type==="user"||t.type==="human"?"human":t.type==="assistant"?"assistant":String(t.type??"unknown")}function ye(t){const r=t.message,s=(r==null?void 0:r.content)??t.content??t.summary;if(typeof s=="string")return s;if(Array.isArray(s)){const d=[];for(const o of s){if(typeof o=="string"){d.push(o);continue}if(!o||typeof o!="object")continue;const g=o;if(g.type==="text")d.push(String(g.text??""));else if(g.type==="tool_use")d.push(`**Tool: ${g.name}** \`\`\`json ${JSON.stringify(g.input,null,2)} \`\`\``);else if(g.type==="tool_result"){const h=g.content;if(typeof h=="string")d.push(h);else if(Array.isArray(h))for(const x of h)typeof x=="string"?d.push(x):x&&typeof x=="object"&&x.type==="text"&&d.push(String(x.text??""))}}return d.join(` -`)}return""}function ct(t){return typeof t.timestamp=="string"?t.timestamp:null}function xt(t){const r=t.message,s=r==null?void 0:r.model;return s&&s!=="N/A"?s.replace("claude-","").replace(/-\d{8,}$/,""):null}function ut(t){const r=t.message,s=r==null?void 0:r.usage;if(!s)return null;const d=s.input_tokens??0,o=s.output_tokens??0;return d||o?{input:d,output:o}:null}function gt(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function mt(t){return t>=100?`$${t.toFixed(0)}`:t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(2)}`:`$${t.toFixed(4)}`}function yt(t){return t?de(t):""}const pt=n.memo(function({file:r,selected:s,onSelect:d,compareMode:o=!1,checked:g=!1,checkboxDisabled:h=!1,onCheckToggle:x,highlighted:m=!1,registerRow:k,sessionId:i}){const b=(r.modified-r.created)/60,y=(r.input_tokens??0)+(r.output_tokens??0),a=n.useCallback(N=>k==null?void 0:k(i,N),[k,i]),p="w-full text-left rounded-lg border transition-colors p-4 flex items-start gap-3",j=s?"bg-white dark:bg-gray-800 border-indigo-500/50":g?"bg-indigo-950/30 border-indigo-500/60":"bg-gray-50/40 dark:bg-gray-900/40 border-gray-200 dark:border-gray-800 hover:border-gray-200 dark:hover:border-gray-700 hover:bg-gray-50/70 dark:hover:bg-gray-900/70",v=m?" ring-2 ring-indigo-400/70 animate-pulse":"",l=()=>{if(o){(!h||g)&&(x==null||x(i));return}d(r.name)},w=e.jsxs(e.Fragment,{children:[o&&e.jsx("div",{className:"pt-0.5 shrink-0",children:e.jsx("input",{type:"checkbox",checked:g,disabled:h&&!g,onChange:N=>{N.stopPropagation(),x==null||x(i)},onClick:N=>N.stopPropagation(),"aria-label":`Select session ${i} to compare`,"data-testid":`session-compare-checkbox-${i}`,className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-indigo-500 focus:ring-indigo-500 disabled:opacity-40"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[r.title?e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 line-clamp-2",children:r.title}):e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r.name.split(".")[0]}),r.is_subagent&&e.jsx("span",{className:"shrink-0 text-[10px] font-medium text-purple-400 bg-purple-500/15 border border-purple-500/30 px-1.5 py-0.5 rounded",children:"Sub-agent"}),e.jsx(Re,{provider:r.provider})]}),e.jsx("span",{className:"text-xs text-gray-500 shrink-0",children:ot(r.modified)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{size:11}),O(b>.5?b:null)]}),r.messages!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{size:11}),r.messages," msgs"]}),r.user_messages!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{size:11,className:"text-blue-400/70"}),r.user_messages," prompts"]}),r.tool_calls!=null&&r.tool_calls>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ie,{size:11,className:"text-purple-400/70"}),r.tool_calls," tools"]}),y>0&&e.jsxs("span",{children:[gt(y)," tokens"]}),r.estimated_cost!=null&&r.estimated_cost>0&&e.jsxs("span",{className:"text-emerald-400/80 font-medium",children:[e.jsx(De,{costSource:r.cost_source}),mt(r.estimated_cost)]}),r.model&&e.jsx("span",{className:"text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 px-1.5 py-0.5 rounded text-[10px]",title:r.model,children:yt(r.model)}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:at(r.size)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-gray-600 dark:text-gray-400 mt-1.5",children:[e.jsxs("span",{children:["Created ",$(r.created)]}),e.jsxs("span",{children:["Modified ",$(r.modified)]})]})]})]});return o?e.jsx("div",{ref:a,role:"button",tabIndex:0,"data-session-id":i,"data-testid":`session-row-${i}`,onClick:l,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),l())},className:`${p} ${j}${v} ${h&&!g?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:w}):e.jsx("div",{ref:a,"data-session-id":i,"data-testid":`session-row-${i}`,className:v?`rounded-lg${v}`:void 0,children:e.jsx("button",{onClick:l,className:`${p} ${j}`,children:w})})});function ht({line:t,index:r,showRaw:s,isSidechain:d=!1,isFirstInSidechainGroup:o=!1}){const[g,h]=n.useState(!1),[x,m]=n.useState(!1),k=ye(t),i=pe(t),c=ct(t),b=xt(t),y=ut(t),a=ae[k]??ae.assistant,p=a.icon;if(!i&&!s)return null;const j=i.length>500,v=g||!j?i:i.slice(0,500)+"...",l=w=>d?e.jsxs("div",{className:"ml-6 border-l-2 border-purple-500/30 pl-3",children:[o&&e.jsx("div",{className:"text-[10px] font-medium text-purple-400/70 mb-1",children:"Sub-agent"}),w]}):e.jsx(e.Fragment,{children:w});return l(s?e.jsxs("div",{className:"border border-gray-200 dark:border-gray-800 rounded-lg p-3 bg-gray-50/30 dark:bg-gray-900/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-[10px] text-gray-500 font-mono",children:["#",r+1]}),e.jsx("span",{className:`text-xs font-medium ${a.color}`,children:a.label}),c&&e.jsx("span",{className:"text-[10px] text-gray-500",children:$(c)})]}),e.jsx("pre",{className:"text-[11px] text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap font-mono bg-gray-50/50 dark:bg-gray-950/50 rounded p-2 max-h-96 overflow-y-auto",children:JSON.stringify(t,null,2)})]}):e.jsxs("div",{className:`rounded-lg border border-gray-200/50 dark:border-gray-800/50 ${a.bg}`,children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-100/30 dark:border-gray-800/30",children:[e.jsx(p,{size:14,className:a.color}),e.jsx("span",{className:`text-xs font-medium ${a.color}`,children:a.label}),b&&e.jsx("span",{className:"text-[10px] text-gray-500 bg-white dark:bg-gray-800 px-1.5 py-0.5 rounded",title:b,children:de(b)}),y&&(y.input!=null||y.output!=null)&&e.jsxs("span",{className:"text-[10px] text-gray-600 dark:text-gray-400",children:[(y.input??0).toLocaleString()," in / ",(y.output??0).toLocaleString()," out"]}),e.jsx("span",{className:"flex-1"}),c&&e.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400",children:$(c)}),e.jsx("button",{type:"button",onClick:()=>m(w=>!w),"aria-pressed":x,"aria-label":x?"Hide raw JSON":"View raw JSON",title:x?"Hide raw JSON":"View raw JSON",className:`text-[10px] px-1.5 py-0.5 rounded border transition-colors ${x?"bg-amber-100 text-amber-800 border-amber-300 dark:bg-amber-900/40 dark:text-amber-300 dark:border-amber-800":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:text-gray-800 dark:hover:text-gray-200"}`,children:x?"Hide JSON":"JSON"})]}),e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words",children:e.jsx(Le,{content:v})}),j&&!g&&e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-indigo-400 hover:text-indigo-300 mt-2",children:"Show more..."}),j&&g&&e.jsx("button",{onClick:()=>h(!1),className:"text-xs text-indigo-400 hover:text-indigo-300 mt-2",children:"Show less"}),x&&e.jsx("pre",{className:"mt-3 text-[11px] text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap font-mono bg-gray-50/70 dark:bg-gray-950/60 rounded p-2 max-h-96 overflow-y-auto border border-gray-200 dark:border-gray-800",children:JSON.stringify(t,null,2)})]})]}))}function bt({data:t,onBack:r}){const[s,d]=n.useState(!1),[o,g]=n.useState("all"),[h,x]=n.useState(""),m=st(h,200),[k,i]=n.useState(0),c=n.useMemo(()=>{const l=new Map;for(const w of t.lines)l.set(w,pe(w).toLowerCase());return l},[t.lines]),b=n.useMemo(()=>{let l=t.lines.filter(N=>!lt(N));o==="hide_subagent"?l=l.filter(N=>N.isSidechain!==!0):o!=="all"&&(l=l.filter(N=>ye(N)===o));const w=m.trim().toLowerCase();return w&&(l=l.filter(N=>(c.get(N)??"").includes(w))),l},[t.lines,o,m,c]),y=Math.max(1,Math.ceil(b.length/M)),a=Math.min(k,y-1),p=b.slice(a*M,(a+1)*M),j=n.useMemo(()=>{const l=new Map;return t.lines.forEach((w,N)=>l.set(w,N)),l},[t.lines]),v=t.metadata;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:[e.jsx(ce,{size:14}),"Sessions"]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{size:12})," ",t.total_lines," messages"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{size:12,className:"text-blue-400"})," ",t.user_count]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{size:12,className:"text-emerald-400"})," ",t.assistant_count]}),v.duration_minutes&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{size:12})," ",O(v.duration_minutes)]})]}),e.jsx("span",{className:"flex-1"}),e.jsxs("button",{onClick:()=>d(!s),className:`flex items-center gap-1.5 px-2.5 py-1 text-xs rounded border transition-colors ${s?"bg-amber-600/20 border-amber-600/50 text-amber-400":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,children:[s?e.jsx(me,{size:13}):e.jsx(Ae,{size:13}),s?"Raw JSON":"Formatted"]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 p-3 bg-gray-50/60 dark:bg-gray-900/60 border border-gray-200 dark:border-gray-800 rounded-lg text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Started"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:$(v.first_timestamp??v.created)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Ended"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:$(v.last_timestamp??v.modified)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Duration"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:O(v.duration_minutes)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Working Dir"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-mono text-[10px] truncate block",children:v.cwd})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Ce,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:h,onChange:l=>{x(l.target.value),i(0)},placeholder:"Search in conversation...",className:"w-full pl-8 pr-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-800 dark:text-gray-200 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),e.jsxs("select",{value:o,onChange:l=>{g(l.target.value),i(0)},className:"px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 focus:outline-none",children:[e.jsx("option",{value:"all",children:"Conversation"}),e.jsx("option",{value:"human",children:"Your prompts"}),e.jsx("option",{value:"assistant",children:"Claude responses"}),e.jsx("option",{value:"tool_result",children:"Tool results"}),e.jsx("option",{value:"hide_subagent",children:"Hide sub-agents"})]})]}),b.length===0?e.jsx(le,{title:"No messages",description:"No messages match your filters."}):e.jsx("div",{className:"space-y-2",children:p.map((l,w)=>{const N=l.isSidechain===!0,E=w>0?p[w-1]:void 0,z=N&&(!E||E.isSidechain!==!0);return e.jsx(ht,{line:l,index:j.get(l)??w,showRaw:s,isSidechain:N,isFirstInSidechainGroup:z},j.get(l)??w)})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:[a*M+1,"–",Math.min((a+1)*M,b.length)," of ",b.length]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>i(l=>Math.max(0,l-1)),disabled:a===0,className:"p-1 rounded bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-40",children:e.jsx($e,{size:14})}),e.jsxs("span",{className:"px-2 text-xs text-gray-600 dark:text-gray-400",children:[a+1,"/",y]}),e.jsx("button",{onClick:()=>i(l=>Math.min(y-1,l+1)),disabled:a>=y-1,className:"p-1 rounded bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-40",children:e.jsx(Me,{size:14})})]})]})]})}function ne(t){return t.replace(/\.jsonl$/i,"")}const ft=[];function Kt({projectName:t,sessionEfficiency:r}){var V,q;const[s,d]=n.useState(null),[o,g]=n.useState("modified"),[h,x]=n.useState(!1),[m,k]=n.useState([]),[i,c]=n.useState(null),b=n.useRef(new Map),{filters:y}=_e(),a=D({queryKey:["jsonlFiles",t,y.providers],queryFn:()=>Ee(t,{providers:y.providers})}),p=D({queryKey:["jsonlContent",s,t],queryFn:()=>Ie(s,t),enabled:!!s}),v=((V=D({queryKey:["setProject",t],queryFn:()=>Fe(t),enabled:!!t,staleTime:6e4}).data)==null?void 0:V.log_path)??"",l=n.useCallback(u=>{u&&(c(u),window.setTimeout(()=>{c(f=>f===u?null:f)},2e3))},[]);n.useEffect(()=>{const u=Q("session");u&&(l(u),W("session"))},[l]),n.useEffect(()=>{const u=()=>{const f=Q("session");f&&(l(f),W("session"))};return window.addEventListener("popstate",u),()=>window.removeEventListener("popstate",u)},[l]),n.useEffect(()=>{const u=f=>{const S=f.detail;S&&S.tab==="sessions"&&typeof S.session=="string"&&l(S.session)};return window.addEventListener(G,u),()=>window.removeEventListener(G,u)},[l]);const w=n.useCallback(u=>{k(f=>f.includes(u)?f.filter(S=>S!==u):f.length>=2?f:[...f,u])},[]),N=n.useCallback(()=>k([]),[]),E=n.useCallback(u=>d(u),[]),z=n.useCallback((u,f)=>{f?b.current.set(u,f):b.current.delete(u)},[]),B=((q=a.data)==null?void 0:q.files)??ft,C=n.useMemo(()=>{let u=B;if(y.models.length>0){const f=new Set(y.models);u=u.filter(S=>S.model!=null&&f.has(S.model.toLowerCase()))}return[...u].sort((f,S)=>o==="size"?S.size-f.size:o==="created"?S.created-f.created:S.modified-f.modified)},[B,y.models,o]),he=`${o}|${y.providers.join(",")}|${y.models.join(",")}`,{visibleCount:be,sentinelRef:fe,hasMore:ke,revealUpTo:A}=rt({total:C.length,initialCount:se,step:se,resetKey:he});if(n.useEffect(()=>{if(!i)return;const u=C.findIndex(I=>ne(I.name)===i);if(u<0)return;A(u+1);let f=0,S=0;const H=()=>{const I=b.current.get(i);if(I){I.scrollIntoView({behavior:"smooth",block:"center"});return}S++<12&&(f=requestAnimationFrame(H))};return f=requestAnimationFrame(H),()=>cancelAnimationFrame(f)},[i,C,A]),a.isLoading)return e.jsx(U,{message:"Loading sessions..."});if(a.isError)return e.jsx("div",{className:"text-red-400 p-4",children:"Failed to load sessions"});if(s){if(p.isLoading)return e.jsx(U,{message:"Loading conversation..."});if(p.isError)return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:()=>d(null),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:[e.jsx(ce,{size:14})," Back"]}),e.jsx("div",{className:"text-red-400 p-4",children:"Failed to load conversation"})]});if(p.data)return e.jsx(bt,{data:p.data,onBack:()=>d(null)})}if(C.length===0)return e.jsx(le,{title:"No sessions",description:"No session files found."});const je=m.length===2,[P,J]=m;return e.jsxs("div",{className:"space-y-4","data-testid":"sessions-tab",children:[e.jsx(Ue,{data:r??[]}),h&&je&&P&&J&&e.jsx(tt,{logPath:v,sessionAId:P,sessionBId:J,onClose:N}),e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx(Te,{size:14}),e.jsxs("span",{children:[e.jsx("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:C.length})," sessions"]}),h&&e.jsxs("span",{className:"text-xs text-indigo-400",children:["· ",m.length,"/2 selected"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("button",{type:"button",onClick:()=>{x(u=>{const f=!u;return f||k([]),f})},"aria-pressed":h,"data-testid":"sessions-compare-toggle",className:`flex items-center gap-1.5 px-2.5 py-1 rounded border transition-colors ${h?"bg-indigo-600/20 border-indigo-500/60 text-indigo-300":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,children:[e.jsx(K,{size:13}),"Compare"]}),e.jsx("div",{className:"flex items-center gap-1",children:["modified","created","size"].map(u=>e.jsx("button",{onClick:()=>g(u),className:`px-2 py-1 rounded ${o===u?"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200":"text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:u==="modified"?"Recent":u==="created"?"Oldest":"Size"},u))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[C.slice(0,be).map(u=>{const f=ne(u.name),S=m.includes(f);return e.jsx(pt,{file:u,sessionId:f,selected:s===u.name,onSelect:E,compareMode:h,checked:S,checkboxDisabled:m.length>=2,onCheckToggle:w,highlighted:i===f,registerRow:z},u.name)}),ke&&e.jsx("div",{ref:fe,"aria-hidden":"true",className:"h-1"})]})]})}export{Kt as default}; +`)}return""}function dt(t){return typeof t.timestamp=="string"?t.timestamp:null}function ct(t){const r=t.message,s=r==null?void 0:r.model;return s&&s!=="N/A"?s.replace("claude-","").replace(/-\d{8,}$/,""):null}function xt(t){const r=t.message,s=r==null?void 0:r.usage;if(!s)return null;const d=s.input_tokens??0,o=s.output_tokens??0;return d||o?{input:d,output:o}:null}function ut(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function gt(t){return t>=100?`$${t.toFixed(0)}`:t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(2)}`:`$${t.toFixed(4)}`}function mt(t){return t?le(t):""}const yt=n.memo(function({file:r,selected:s,onSelect:d,compareMode:o=!1,checked:g=!1,checkboxDisabled:h=!1,onCheckToggle:x,highlighted:m=!1,registerRow:k,sessionId:i}){const b=(r.modified-r.created)/60,y=(r.input_tokens??0)+(r.output_tokens??0),a=n.useCallback(N=>k==null?void 0:k(i,N),[k,i]),p="w-full text-left rounded-lg border transition-colors p-4 flex items-start gap-3",j=s?"bg-white dark:bg-gray-800 border-indigo-500/50":g?"bg-indigo-950/30 border-indigo-500/60":"bg-gray-50/40 dark:bg-gray-900/40 border-gray-200 dark:border-gray-800 hover:border-gray-200 dark:hover:border-gray-700 hover:bg-gray-50/70 dark:hover:bg-gray-900/70",v=m?" ring-2 ring-indigo-400/70 animate-pulse":"",l=()=>{if(o){(!h||g)&&(x==null||x(i));return}d(r.name)},w=e.jsxs(e.Fragment,{children:[o&&e.jsx("div",{className:"pt-0.5 shrink-0",children:e.jsx("input",{type:"checkbox",checked:g,disabled:h&&!g,onChange:N=>{N.stopPropagation(),x==null||x(i)},onClick:N=>N.stopPropagation(),"aria-label":`Select session ${i} to compare`,"data-testid":`session-compare-checkbox-${i}`,className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-indigo-500 focus:ring-indigo-500 disabled:opacity-40"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[r.title?e.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 line-clamp-2",children:r.title}):e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r.name.split(".")[0]}),r.is_subagent&&e.jsx("span",{className:"shrink-0 text-[10px] font-medium text-purple-400 bg-purple-500/15 border border-purple-500/30 px-1.5 py-0.5 rounded",children:"Sub-agent"}),e.jsx(ze,{provider:r.provider})]}),e.jsx("span",{className:"text-xs text-gray-500 shrink-0",children:nt(r.modified)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{size:11}),O(b>.5?b:null)]}),r.messages!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{size:11}),r.messages," msgs"]}),r.user_messages!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(z,{size:11,className:"text-blue-400/70"}),r.user_messages," prompts"]}),r.tool_calls!=null&&r.tool_calls>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(oe,{size:11,className:"text-purple-400/70"}),r.tool_calls," tools"]}),y>0&&e.jsxs("span",{children:[ut(y)," tokens"]}),r.estimated_cost!=null&&r.estimated_cost>0&&e.jsxs("span",{className:"text-emerald-400/80 font-medium",children:[e.jsx(Re,{costSource:r.cost_source}),gt(r.estimated_cost)]}),r.model&&e.jsx("span",{className:"text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 px-1.5 py-0.5 rounded text-[10px]",title:r.model,children:mt(r.model)}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:st(r.size)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-gray-600 dark:text-gray-400 mt-1.5",children:[e.jsxs("span",{children:["Created ",$(r.created)]}),e.jsxs("span",{children:["Modified ",$(r.modified)]})]})]})]});return o?e.jsx("div",{ref:a,role:"button",tabIndex:0,"data-session-id":i,"data-testid":`session-row-${i}`,onClick:l,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),l())},className:`${p} ${j}${v} ${h&&!g?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:w}):e.jsx("div",{ref:a,"data-session-id":i,"data-testid":`session-row-${i}`,className:v?`rounded-lg${v}`:void 0,children:e.jsx("button",{onClick:l,className:`${p} ${j}`,children:w})})});function pt({line:t,index:r,showRaw:s,isSidechain:d=!1,isFirstInSidechainGroup:o=!1}){const[g,h]=n.useState(!1),[x,m]=n.useState(!1),k=me(t),i=ye(t),c=dt(t),b=ct(t),y=xt(t),a=ae[k]??ae.assistant,p=a.icon;if(!i&&!s)return null;const j=i.length>500,v=g||!j?i:i.slice(0,500)+"...",l=w=>d?e.jsxs("div",{className:"ml-6 border-l-2 border-purple-500/30 pl-3",children:[o&&e.jsx("div",{className:"text-[10px] font-medium text-purple-400/70 mb-1",children:"Sub-agent"}),w]}):e.jsx(e.Fragment,{children:w});return l(s?e.jsxs("div",{className:"border border-gray-200 dark:border-gray-800 rounded-lg p-3 bg-gray-50/30 dark:bg-gray-900/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-[10px] text-gray-500 font-mono",children:["#",r+1]}),e.jsx("span",{className:`text-xs font-medium ${a.color}`,children:a.label}),c&&e.jsx("span",{className:"text-[10px] text-gray-500",children:$(c)})]}),e.jsx("pre",{className:"text-[11px] text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap font-mono bg-gray-50/50 dark:bg-gray-950/50 rounded p-2 max-h-96 overflow-y-auto",children:JSON.stringify(t,null,2)})]}):e.jsxs("div",{className:`rounded-lg border border-gray-200/50 dark:border-gray-800/50 ${a.bg}`,children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-100/30 dark:border-gray-800/30",children:[e.jsx(p,{size:14,className:a.color}),e.jsx("span",{className:`text-xs font-medium ${a.color}`,children:a.label}),b&&e.jsx("span",{className:"text-[10px] text-gray-500 bg-white dark:bg-gray-800 px-1.5 py-0.5 rounded",title:b,children:le(b)}),y&&(y.input!=null||y.output!=null)&&e.jsxs("span",{className:"text-[10px] text-gray-600 dark:text-gray-400",children:[(y.input??0).toLocaleString()," in / ",(y.output??0).toLocaleString()," out"]}),e.jsx("span",{className:"flex-1"}),c&&e.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400",children:$(c)}),e.jsx("button",{type:"button",onClick:()=>m(w=>!w),"aria-pressed":x,"aria-label":x?"Hide raw JSON":"View raw JSON",title:x?"Hide raw JSON":"View raw JSON",className:`text-[10px] px-1.5 py-0.5 rounded border transition-colors ${x?"bg-amber-100 text-amber-800 border-amber-300 dark:bg-amber-900/40 dark:text-amber-300 dark:border-amber-800":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:text-gray-800 dark:hover:text-gray-200"}`,children:x?"Hide JSON":"JSON"})]}),e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words",children:e.jsx(Le,{content:v})}),j&&!g&&e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-indigo-400 hover:text-indigo-300 mt-2",children:"Show more..."}),j&&g&&e.jsx("button",{onClick:()=>h(!1),className:"text-xs text-indigo-400 hover:text-indigo-300 mt-2",children:"Show less"}),x&&e.jsx("pre",{className:"mt-3 text-[11px] text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap font-mono bg-gray-50/70 dark:bg-gray-950/60 rounded p-2 max-h-96 overflow-y-auto border border-gray-200 dark:border-gray-800",children:JSON.stringify(t,null,2)})]})]}))}function ht({data:t,onBack:r}){const[s,d]=n.useState(!1),[o,g]=n.useState("all"),[h,x]=n.useState(""),m=rt(h,200),[k,i]=n.useState(0),c=n.useMemo(()=>{const l=new Map;for(const w of t.lines)l.set(w,ye(w).toLowerCase());return l},[t.lines]),b=n.useMemo(()=>{let l=t.lines.filter(N=>!it(N));o==="hide_subagent"?l=l.filter(N=>N.isSidechain!==!0):o!=="all"&&(l=l.filter(N=>me(N)===o));const w=m.trim().toLowerCase();return w&&(l=l.filter(N=>(c.get(N)??"").includes(w))),l},[t.lines,o,m,c]),y=Math.max(1,Math.ceil(b.length/M)),a=Math.min(k,y-1),p=b.slice(a*M,(a+1)*M),j=n.useMemo(()=>{const l=new Map;return t.lines.forEach((w,N)=>l.set(w,N)),l},[t.lines]),v=t.metadata;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:[e.jsx(de,{size:14}),"Sessions"]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{size:12})," ",t.total_lines," messages"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(z,{size:12,className:"text-blue-400"})," ",t.user_count]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{size:12,className:"text-emerald-400"})," ",t.assistant_count]}),v.duration_minutes&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{size:12})," ",O(v.duration_minutes)]})]}),e.jsx("span",{className:"flex-1"}),e.jsxs("button",{onClick:()=>d(!s),className:`flex items-center gap-1.5 px-2.5 py-1 text-xs rounded border transition-colors ${s?"bg-amber-600/20 border-amber-600/50 text-amber-400":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,children:[s?e.jsx(ge,{size:13}):e.jsx(Be,{size:13}),s?"Raw JSON":"Formatted"]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 p-3 bg-gray-50/60 dark:bg-gray-900/60 border border-gray-200 dark:border-gray-800 rounded-lg text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Started"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:$(v.first_timestamp??v.created)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Ended"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:$(v.last_timestamp??v.modified)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Duration"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200",children:O(v.duration_minutes)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 block mb-0.5",children:"Working Dir"}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-mono text-[10px] truncate block",children:v.cwd})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Ce,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{type:"text",value:h,onChange:l=>{x(l.target.value),i(0)},placeholder:"Search in conversation...",className:"w-full pl-8 pr-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-800 dark:text-gray-200 placeholder-gray-500 focus:outline-none focus:border-indigo-500"})]}),e.jsxs("select",{value:o,onChange:l=>{g(l.target.value),i(0)},className:"px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300 focus:outline-none",children:[e.jsx("option",{value:"all",children:"Conversation"}),e.jsx("option",{value:"human",children:"Your prompts"}),e.jsx("option",{value:"assistant",children:"Claude responses"}),e.jsx("option",{value:"tool_result",children:"Tool results"}),e.jsx("option",{value:"hide_subagent",children:"Hide sub-agents"})]})]}),b.length===0?e.jsx(ie,{title:"No messages",description:"No messages match your filters."}):e.jsx("div",{className:"space-y-2",children:p.map((l,w)=>{const N=l.isSidechain===!0,E=w>0?p[w-1]:void 0,D=N&&(!E||E.isSidechain!==!0);return e.jsx(pt,{line:l,index:j.get(l)??w,showRaw:s,isSidechain:N,isFirstInSidechainGroup:D},j.get(l)??w)})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:[a*M+1,"–",Math.min((a+1)*M,b.length)," of ",b.length]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>i(l=>Math.max(0,l-1)),disabled:a===0,className:"p-1 rounded bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-40",children:e.jsx($e,{size:14})}),e.jsxs("span",{className:"px-2 text-xs text-gray-600 dark:text-gray-400",children:[a+1,"/",y]}),e.jsx("button",{onClick:()=>i(l=>Math.min(y-1,l+1)),disabled:a>=y-1,className:"p-1 rounded bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-40",children:e.jsx(Me,{size:14})})]})]})]})}function ne(t){return t.replace(/\.jsonl$/i,"")}const bt=[];function Rt({projectName:t,sessionEfficiency:r}){var V,q;const[s,d]=n.useState(null),[o,g]=n.useState("modified"),[h,x]=n.useState(!1),[m,k]=n.useState([]),[i,c]=n.useState(null),b=n.useRef(new Map),{filters:y}=_e(),a=R({queryKey:["jsonlFiles",t,y.providers],queryFn:()=>Ee(t,{providers:y.providers})}),p=R({queryKey:["jsonlContent",s,t],queryFn:()=>Ie(s,t),enabled:!!s}),v=((V=R({queryKey:["setProject",t],queryFn:()=>Fe(t),enabled:!!t,staleTime:6e4}).data)==null?void 0:V.log_path)??"",l=n.useCallback(u=>{u&&(c(u),window.setTimeout(()=>{c(f=>f===u?null:f)},2e3))},[]);n.useEffect(()=>{const u=Q("session");u&&(l(u),W("session"))},[l]),n.useEffect(()=>{const u=()=>{const f=Q("session");f&&(l(f),W("session"))};return window.addEventListener("popstate",u),()=>window.removeEventListener("popstate",u)},[l]),n.useEffect(()=>{const u=f=>{const S=f.detail;S&&S.tab==="sessions"&&typeof S.session=="string"&&l(S.session)};return window.addEventListener(G,u),()=>window.removeEventListener(G,u)},[l]);const w=n.useCallback(u=>{k(f=>f.includes(u)?f.filter(S=>S!==u):f.length>=2?f:[...f,u])},[]),N=n.useCallback(()=>k([]),[]),E=n.useCallback(u=>d(u),[]),D=n.useCallback((u,f)=>{f?b.current.set(u,f):b.current.delete(u)},[]),B=((q=a.data)==null?void 0:q.files)??bt,C=n.useMemo(()=>{let u=B;if(y.models.length>0){const f=new Set(y.models);u=u.filter(S=>S.model!=null&&f.has(S.model.toLowerCase()))}return[...u].sort((f,S)=>o==="size"?S.size-f.size:o==="created"?S.created-f.created:S.modified-f.modified)},[B,y.models,o]),pe=`${o}|${y.providers.join(",")}|${y.models.join(",")}`,{visibleCount:he,sentinelRef:be,hasMore:fe,revealUpTo:A}=tt({total:C.length,initialCount:se,step:se,resetKey:pe});if(n.useEffect(()=>{if(!i)return;const u=C.findIndex(I=>ne(I.name)===i);if(u<0)return;A(u+1);let f=0,S=0;const H=()=>{const I=b.current.get(i);if(I){I.scrollIntoView({behavior:"smooth",block:"center"});return}S++<12&&(f=requestAnimationFrame(H))};return f=requestAnimationFrame(H),()=>cancelAnimationFrame(f)},[i,C,A]),a.isLoading)return e.jsx(U,{message:"Loading sessions..."});if(a.isError)return e.jsx("div",{className:"text-red-400 p-4",children:"Failed to load sessions"});if(s){if(p.isLoading)return e.jsx(U,{message:"Loading conversation..."});if(p.isError)return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:()=>d(null),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:[e.jsx(de,{size:14})," Back"]}),e.jsx("div",{className:"text-red-400 p-4",children:"Failed to load conversation"})]});if(p.data)return e.jsx(ht,{data:p.data,onBack:()=>d(null)})}if(C.length===0)return e.jsx(ie,{title:"No sessions",description:"No session files found."});const ke=m.length===2,[P,J]=m;return e.jsxs("div",{className:"space-y-4","data-testid":"sessions-tab",children:[e.jsx(He,{data:r??[]}),h&&ke&&P&&J&&e.jsx(et,{logPath:v,sessionAId:P,sessionBId:J,onClose:N}),e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx(Te,{size:14}),e.jsxs("span",{children:[e.jsx("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:C.length})," sessions"]}),h&&e.jsxs("span",{className:"text-xs text-indigo-400",children:["· ",m.length,"/2 selected"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("button",{type:"button",onClick:()=>{x(u=>{const f=!u;return f||k([]),f})},"aria-pressed":h,"data-testid":"sessions-compare-toggle",className:`flex items-center gap-1.5 px-2.5 py-1 rounded border transition-colors ${h?"bg-indigo-600/20 border-indigo-500/60 text-indigo-300":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,children:[e.jsx(K,{size:13}),"Compare"]}),e.jsx("div",{className:"flex items-center gap-1",children:["modified","created","size"].map(u=>e.jsx("button",{onClick:()=>g(u),className:`px-2 py-1 rounded ${o===u?"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200":"text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:u==="modified"?"Recent":u==="created"?"Oldest":"Size"},u))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[C.slice(0,he).map(u=>{const f=ne(u.name),S=m.includes(f);return e.jsx(yt,{file:u,sessionId:f,selected:s===u.name,onSelect:E,compareMode:h,checked:S,checkboxDisabled:m.length>=2,onCheckToggle:w,highlighted:i===f,registerRow:D},u.name)}),fe&&e.jsx("div",{ref:be,"aria-hidden":"true",className:"h-1"})]})]})}export{Rt as default}; diff --git a/stackunderflow/static/react/assets/Settings-BSujxVUW.js b/stackunderflow/static/react/assets/Settings-D4OLuWdJ.js similarity index 99% rename from stackunderflow/static/react/assets/Settings-BSujxVUW.js rename to stackunderflow/static/react/assets/Settings-D4OLuWdJ.js index 3605148..057ce8b 100644 --- a/stackunderflow/static/react/assets/Settings-BSujxVUW.js +++ b/stackunderflow/static/react/assets/Settings-D4OLuWdJ.js @@ -1,4 +1,4 @@ -import{u as j,j as e,L as R,r as h,d as B,e as w}from"./react-vendor-B7v2HPaI.js";import{h as A,u as I,q as F,t as M,v as O,w as D,x as P,y as L,z as q,A as z,C as K,D as N,F as U,I as C,G as $,p as H,H as Q,J,K as Y}from"./index-DQluCO2S.js";import{u as W,I as G,T as Z,B as V,b as X}from"./dashboardTabs-C5ecR5YO.js";import{c as S,b as _}from"./format-Co_unrac.js";import{I as ee}from"./IconAlertCircle-h2zR9MWj.js";import{I as E}from"./IconArrowRight-lOOgkPXu.js";import{I as re}from"./IconCircleX-D7ABaoUn.js";/** +import{u as j,j as e,L as R,r as h,d as B,e as w}from"./react-vendor-B7v2HPaI.js";import{h as A,u as I,q as F,t as M,v as O,w as D,x as P,y as L,z as q,A as z,C as K,D as N,F as U,I as C,G as $,p as H,H as Q,J,K as Y}from"./index-0LeeVNek.js";import{u as W,I as G,T as Z,B as V,b as X}from"./dashboardTabs-BuoED77E.js";import{c as S,b as _}from"./format-Co_unrac.js";import{I as ee}from"./IconAlertCircle-DmtLevj2.js";import{I as E}from"./IconArrowRight-CEBy4AKU.js";import{I as re}from"./IconCircleX-CZ-PNBqE.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/TagsTab-CJJHkPnn.js b/stackunderflow/static/react/assets/TagsTab-CJJHkPnn.js new file mode 100644 index 0000000..004276c --- /dev/null +++ b/stackunderflow/static/react/assets/TagsTab-CJJHkPnn.js @@ -0,0 +1 @@ +import{d as j,r as g,u,e as N,j as e}from"./react-vendor-B7v2HPaI.js";import{a0 as k,L as b,b as v,I as y,a1 as w,a2 as C}from"./index-0LeeVNek.js";import{E as p}from"./EmptyState-o0gibvhZ.js";import{I as S}from"./IconHash-Cw_3c3J-.js";import{I as L}from"./IconUsers-BhXPWMUX.js";import{g as h,I as T}from"./dashboardTabs-BuoED77E.js";function E(o,a){if(a===0)return"text-xs";const n=o/a;return n>.8?"text-xl":n>.6?"text-lg":n>.4?"text-base":n>.2?"text-sm":"text-xs"}const I={intent:"bg-amber-500/20 text-amber-300 border-amber-500/30 hover:bg-amber-500/30",language:"bg-blue-500/20 text-blue-300 border-blue-500/30 hover:bg-blue-500/30",framework:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30 hover:bg-emerald-500/30",tool:"bg-purple-500/20 text-purple-300 border-purple-500/30 hover:bg-purple-500/30",topic:"bg-indigo-500/20 text-indigo-300 border-indigo-500/30 hover:bg-indigo-500/30"},F="bg-indigo-500/20 text-indigo-300 border-indigo-500/30 hover:bg-indigo-500/30";function R(o){return I[o]??F}const q=[{category:"intent",label:"Intent",dot:"bg-amber-500"},{category:"language",label:"Language",dot:"bg-blue-500"},{category:"framework",label:"Framework",dot:"bg-emerald-500"},{category:"topic",label:"Topic",dot:"bg-indigo-500"},{category:"tool",label:"Tool",dot:"bg-purple-500"}];function P(){const o=j(),[a,n]=g.useState({kind:"cloud"}),[l,f]=g.useState(""),c=u({queryKey:["tagCloud"],queryFn:w}),x=a.kind==="browse"?a.tag:null,t=u({queryKey:["tagBrowse",x],queryFn:()=>C(x),enabled:!!x}),i=N({mutationFn:k,onSuccess:()=>{o.invalidateQueries({queryKey:["tagCloud"]})}});if(a.kind==="cloud"){if(c.isLoading)return e.jsx(b,{message:"Loading tags..."});if(c.isError)return e.jsxs("div",{className:"text-red-400 p-4",children:["Failed to load tags: ",c.error.message]});const r=c.data,d=r.tags.reduce((s,z)=>Math.max(s,z.count),0),m=r.tags.filter(s=>s.name.toLowerCase().includes(l.toLowerCase()));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx(S,{size:16}),e.jsxs("span",{children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:r.tags.length})," tags"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx(L,{size:16}),e.jsxs("span",{children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:r.total_sessions})," ","sessions"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(v,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500"}),e.jsx("input",{type:"text",placeholder:"Filter tags...",value:l,onChange:s=>f(s.target.value),className:"pl-9 pr-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-800 dark:text-zinc-200 placeholder-zinc-500 focus:outline-none focus:border-zinc-500 w-52"})]}),e.jsxs("button",{onClick:()=>i.mutate(),disabled:i.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 disabled:opacity-50 transition-colors",children:[e.jsx(y,{size:16,className:i.isPending?"animate-spin":""}),i.isPending?"Reindexing...":"Reindex"]})]})]}),e.jsx("div",{className:"flex items-center gap-4 text-xs text-zinc-500 flex-wrap",children:q.map(s=>e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${s.dot}`}),s.label]},s.category))}),m.length===0?e.jsx(p,{title:"No tags found",description:l?"Try a different filter.":"No tags available yet."}):e.jsx("div",{className:"flex flex-wrap gap-2 p-4 bg-zinc-50/50 dark:bg-zinc-900/50 border border-zinc-200 dark:border-zinc-800 rounded-xl",children:m.map(s=>e.jsxs("button",{onClick:()=>n({kind:"browse",tag:s.name}),className:`inline-flex items-center gap-1 px-2.5 py-1 border rounded-full cursor-pointer transition-colors ${R(s.category)} ${E(s.count,d)}`,children:[e.jsx(h,{size:12}),s.name,e.jsxs("span",{className:"text-[10px] opacity-70 ml-0.5",children:["(",s.count,")"]})]},s.name))}),i.isSuccess&&e.jsx("div",{className:"text-green-400 text-sm",children:"Reindex completed successfully."}),i.isError&&e.jsxs("div",{className:"text-red-400 text-sm",children:["Reindex failed: ",i.error.message]})]})}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>n({kind:"cloud"}),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors",children:[e.jsx(T,{size:16}),"Back"]}),e.jsxs("h3",{className:"text-lg font-medium text-zinc-900 dark:text-zinc-100 flex items-center gap-2",children:[e.jsx(h,{size:20}),a.tag]})]}),t.isLoading&&e.jsx(b,{message:"Loading sessions..."}),t.isError&&e.jsxs("div",{className:"text-red-400 p-4",children:["Failed to load sessions: ",t.error.message]}),t.isSuccess&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:t.data.count})," ","session",t.data.count!==1&&"s"," tagged with"," ",e.jsx("span",{className:"text-indigo-300 font-medium",children:t.data.tag})]}),t.data.sessions.length===0?e.jsx(p,{title:"No sessions",description:"No sessions have this tag."}):e.jsx("div",{className:"space-y-2",children:t.data.sessions.map(r=>e.jsx("div",{className:"p-4 bg-zinc-50/60 dark:bg-zinc-900/60 border border-zinc-200 dark:border-zinc-800 rounded-lg hover:border-zinc-200 dark:hover:border-zinc-700 transition-colors",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-mono text-zinc-800 dark:text-zinc-200 truncate",children:r.session_id}),e.jsx("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:r.source.map(d=>e.jsx("span",{className:"px-2 py-0.5 bg-white dark:bg-zinc-800 rounded text-zinc-600 dark:text-zinc-400",children:d},d))})]})},r.session_id))})]})]})}export{P as default}; diff --git a/stackunderflow/static/react/assets/TagsTab-DSK8Zu2d.js b/stackunderflow/static/react/assets/TagsTab-DSK8Zu2d.js deleted file mode 100644 index 08ac2ad..0000000 --- a/stackunderflow/static/react/assets/TagsTab-DSK8Zu2d.js +++ /dev/null @@ -1,6 +0,0 @@ -import{d as j,r as m,u,e as v,j as e}from"./react-vendor-B7v2HPaI.js";import{h as k,a0 as y,L as p,b as N,I as w,a1 as C,a2 as S}from"./index-DQluCO2S.js";import{E as b}from"./EmptyState-o0gibvhZ.js";import{I as L}from"./IconHash-cdeuBxnj.js";import{g as h,I as T}from"./dashboardTabs-C5ecR5YO.js";/** - * @license @tabler/icons-react v3.36.1 - MIT - * - * This source code is licensed under the MIT license. - * See the LICENSE file in the root directory of this source tree. - */const E=[["path",{d:"M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]],I=k("outline","users","Users",E);function F(o,r){if(r===0)return"text-xs";const n=o/r;return n>.8?"text-xl":n>.6?"text-lg":n>.4?"text-base":n>.2?"text-sm":"text-xs"}const R={intent:"bg-amber-500/20 text-amber-300 border-amber-500/30 hover:bg-amber-500/30",language:"bg-blue-500/20 text-blue-300 border-blue-500/30 hover:bg-blue-500/30",framework:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30 hover:bg-emerald-500/30",tool:"bg-purple-500/20 text-purple-300 border-purple-500/30 hover:bg-purple-500/30",topic:"bg-indigo-500/20 text-indigo-300 border-indigo-500/30 hover:bg-indigo-500/30"},_="bg-indigo-500/20 text-indigo-300 border-indigo-500/30 hover:bg-indigo-500/30";function M(o){return R[o]??_}const q=[{category:"intent",label:"Intent",dot:"bg-amber-500"},{category:"language",label:"Language",dot:"bg-blue-500"},{category:"framework",label:"Framework",dot:"bg-emerald-500"},{category:"topic",label:"Topic",dot:"bg-indigo-500"},{category:"tool",label:"Tool",dot:"bg-purple-500"}];function U(){const o=j(),[r,n]=m.useState({kind:"cloud"}),[l,f]=m.useState(""),c=u({queryKey:["tagCloud"],queryFn:C}),x=r.kind==="browse"?r.tag:null,t=u({queryKey:["tagBrowse",x],queryFn:()=>S(x),enabled:!!x}),i=v({mutationFn:y,onSuccess:()=>{o.invalidateQueries({queryKey:["tagCloud"]})}});if(r.kind==="cloud"){if(c.isLoading)return e.jsx(p,{message:"Loading tags..."});if(c.isError)return e.jsxs("div",{className:"text-red-400 p-4",children:["Failed to load tags: ",c.error.message]});const a=c.data,d=a.tags.reduce((s,z)=>Math.max(s,z.count),0),g=a.tags.filter(s=>s.name.toLowerCase().includes(l.toLowerCase()));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx(L,{size:16}),e.jsxs("span",{children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:a.tags.length})," tags"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx(I,{size:16}),e.jsxs("span",{children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:a.total_sessions})," ","sessions"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(N,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500"}),e.jsx("input",{type:"text",placeholder:"Filter tags...",value:l,onChange:s=>f(s.target.value),className:"pl-9 pr-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-800 dark:text-zinc-200 placeholder-zinc-500 focus:outline-none focus:border-zinc-500 w-52"})]}),e.jsxs("button",{onClick:()=>i.mutate(),disabled:i.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 disabled:opacity-50 transition-colors",children:[e.jsx(w,{size:16,className:i.isPending?"animate-spin":""}),i.isPending?"Reindexing...":"Reindex"]})]})]}),e.jsx("div",{className:"flex items-center gap-4 text-xs text-zinc-500 flex-wrap",children:q.map(s=>e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${s.dot}`}),s.label]},s.category))}),g.length===0?e.jsx(b,{title:"No tags found",description:l?"Try a different filter.":"No tags available yet."}):e.jsx("div",{className:"flex flex-wrap gap-2 p-4 bg-zinc-50/50 dark:bg-zinc-900/50 border border-zinc-200 dark:border-zinc-800 rounded-xl",children:g.map(s=>e.jsxs("button",{onClick:()=>n({kind:"browse",tag:s.name}),className:`inline-flex items-center gap-1 px-2.5 py-1 border rounded-full cursor-pointer transition-colors ${M(s.category)} ${F(s.count,d)}`,children:[e.jsx(h,{size:12}),s.name,e.jsxs("span",{className:"text-[10px] opacity-70 ml-0.5",children:["(",s.count,")"]})]},s.name))}),i.isSuccess&&e.jsx("div",{className:"text-green-400 text-sm",children:"Reindex completed successfully."}),i.isError&&e.jsxs("div",{className:"text-red-400 text-sm",children:["Reindex failed: ",i.error.message]})]})}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>n({kind:"cloud"}),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors",children:[e.jsx(T,{size:16}),"Back"]}),e.jsxs("h3",{className:"text-lg font-medium text-zinc-900 dark:text-zinc-100 flex items-center gap-2",children:[e.jsx(h,{size:20}),r.tag]})]}),t.isLoading&&e.jsx(p,{message:"Loading sessions..."}),t.isError&&e.jsxs("div",{className:"text-red-400 p-4",children:["Failed to load sessions: ",t.error.message]}),t.isSuccess&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{className:"text-zinc-900 dark:text-zinc-100 font-medium",children:t.data.count})," ","session",t.data.count!==1&&"s"," tagged with"," ",e.jsx("span",{className:"text-indigo-300 font-medium",children:t.data.tag})]}),t.data.sessions.length===0?e.jsx(b,{title:"No sessions",description:"No sessions have this tag."}):e.jsx("div",{className:"space-y-2",children:t.data.sessions.map(a=>e.jsx("div",{className:"p-4 bg-zinc-50/60 dark:bg-zinc-900/60 border border-zinc-200 dark:border-zinc-800 rounded-lg hover:border-zinc-200 dark:hover:border-zinc-700 transition-colors",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-mono text-zinc-800 dark:text-zinc-200 truncate",children:a.session_id}),e.jsx("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:a.source.map(d=>e.jsx("span",{className:"px-2 py-0.5 bg-white dark:bg-zinc-800 rounded text-zinc-600 dark:text-zinc-400",children:d},d))})]})},a.session_id))})]})]})}export{U as default}; diff --git a/stackunderflow/static/react/assets/TokenCompositionDonut-DTEMWIwY.js b/stackunderflow/static/react/assets/TokenCompositionDonut-DhTEtbxP.js similarity index 82% rename from stackunderflow/static/react/assets/TokenCompositionDonut-DTEMWIwY.js rename to stackunderflow/static/react/assets/TokenCompositionDonut-DhTEtbxP.js index edb3a18..b3c8227 100644 --- a/stackunderflow/static/react/assets/TokenCompositionDonut-DTEMWIwY.js +++ b/stackunderflow/static/react/assets/TokenCompositionDonut-DhTEtbxP.js @@ -1,4 +1,4 @@ -import{h as y,p as F,N as R,u as D,G as A,j as E}from"./index-DQluCO2S.js";import{j as e,r as f}from"./react-vendor-B7v2HPaI.js";import{b as L}from"./dashboardTabs-C5ecR5YO.js";import{I as z}from"./IconHash-cdeuBxnj.js";import{I as B}from"./IconTrendingUp-D1iuYAG9.js";import{c as j,b as N,a as b}from"./format-Co_unrac.js";import{u as M}from"./chartTheme-GpkpBpop.js";import{R as I,h as O,T,f as P,P as K,c as Y,d as H,i as W,L as U,S as G}from"./recharts-C8DDeE7E.js";/** +import{h as y,p as F,N as R,u as D,G as A,j as E}from"./index-0LeeVNek.js";import{j as e,r as b}from"./react-vendor-B7v2HPaI.js";import{b as L}from"./dashboardTabs-BuoED77E.js";import{I as z}from"./IconHash-Cw_3c3J-.js";import{I as B}from"./IconTrendingUp-CcTO0Xpf.js";import{c as j,b as N,a as f}from"./format-Co_unrac.js";import{u as I}from"./chartTheme-GpkpBpop.js";import{I as _}from"./IconDatabase-50ZWmnTz.js";import{R as M,h as O,T,f as P,P as K,c as Y,d as H,i as W,L as U,S as G}from"./recharts-C8DDeE7E.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. @@ -13,22 +13,17 @@ import{h as y,p as F,N as R,u as D,G as A,j as E}from"./index-DQluCO2S.js";impor * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const Q=[["path",{d:"M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]],_=y("outline","database","Database",Q);/** + */const Q=[["path",{d:"M5 12l14 0",key:"svg-0"}]],X=y("outline","minus","Minus",Q);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const X=[["path",{d:"M5 12l14 0",key:"svg-0"}]],Z=y("outline","minus","Minus",X);/** + */const Z=[["path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4",key:"svg-1"}],["path",{d:"M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5",key:"svg-2"}]],we=y("outline","route","Route",Z);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const ee=[["path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4",key:"svg-1"}],["path",{d:"M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5",key:"svg-2"}]],we=y("outline","route","Route",ee);/** - * @license @tabler/icons-react v3.36.1 - MIT - * - * This source code is licensed under the MIT license. - * See the LICENSE file in the root directory of this source tree. - */const te=[["path",{d:"M3 7l6 6l4 -4l8 8",key:"svg-0"}],["path",{d:"M21 10l0 7l-7 0",key:"svg-1"}]],ae=y("outline","trending-down","TrendingDown",te),re=[{key:"cost_per_command",label:"Cost / Cmd",icon:e.jsx(L,{size:14}),format:t=>`$${t.toFixed(4)}`,riseIsBad:!0},{key:"errors_per_command",label:"Errors / Cmd",icon:e.jsx(F,{size:14}),format:t=>t.toFixed(2),riseIsBad:!0},{key:"tools_per_command",label:"Tools / Cmd",icon:e.jsx(R,{size:14}),format:t=>t.toFixed(1),riseIsBad:!0},{key:"tokens_per_command",label:"Tokens / Cmd",icon:e.jsx(z,{size:14}),format:t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toFixed(0),riseIsBad:!0}];function ne(t,r){if(Math.abs(t)<.5)return e.jsx(Z,{size:12,className:"text-gray-500"});const n=t>0,s=n===r?"text-red-400":"text-green-400";return n?e.jsx(B,{size:12,className:s}):e.jsx(ae,{size:12,className:s})}function se(t,r){return Math.abs(t)<.5?"text-gray-500":t>0===r?"text-red-400":"text-green-400"}function oe(t){if(t instanceof Date)return Number.isNaN(t.getTime())?new Date:t;if(typeof t=="string"){const r=new Date(t);if(!Number.isNaN(r.getTime()))return r}return new Date}const ie=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}),v=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"});function w(t,r){return t.getFullYear()===r.getFullYear()?`${ie.format(t)} – ${v.format(r)}`:`${v.format(t)} – ${v.format(r)}`}function de(t){const n=new Date(t.getTime()-6048e5),d=new Date(t.getTime()-14*864e5),s=n;return{currentLabel:w(n,t),priorLabel:w(d,s)}}function Ce({trends:t,endDate:r,onTileClick:n}){if(!t||!t.current_week||!t.prior_week||!t.delta_pct)return e.jsx("div",{"data-testid":"trend-delta-strip-empty",className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:e.jsx("div",{className:"text-xs text-gray-500",children:"No trend data yet — need at least two weeks of activity."})});const{current_week:d,prior_week:s,delta_pct:i}=t,c=oe(r),{currentLabel:l,priorLabel:x}=de(c),o=a=>{n==null||n(a),typeof window<"u"&&typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent("stackunderflow:filter-window",{detail:{window:"current-week",metric:a}}))};return e.jsx("div",{"data-testid":"trend-delta-strip",className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 divide-x divide-gray-200 dark:divide-gray-800",children:re.map(a=>{const g=d[a.key]??0,u=s[a.key]??0,m=i[a.key]??0,h=`${a.label} + */const ee=[["path",{d:"M3 7l6 6l4 -4l8 8",key:"svg-0"}],["path",{d:"M21 10l0 7l-7 0",key:"svg-1"}]],te=y("outline","trending-down","TrendingDown",ee),ae=[{key:"cost_per_command",label:"Cost / Cmd",icon:e.jsx(L,{size:14}),format:t=>`$${t.toFixed(4)}`,riseIsBad:!0},{key:"errors_per_command",label:"Errors / Cmd",icon:e.jsx(F,{size:14}),format:t=>t.toFixed(2),riseIsBad:!0},{key:"tools_per_command",label:"Tools / Cmd",icon:e.jsx(R,{size:14}),format:t=>t.toFixed(1),riseIsBad:!0},{key:"tokens_per_command",label:"Tokens / Cmd",icon:e.jsx(z,{size:14}),format:t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toFixed(0),riseIsBad:!0}];function re(t,r){if(Math.abs(t)<.5)return e.jsx(X,{size:12,className:"text-gray-500"});const n=t>0,s=n===r?"text-red-400":"text-green-400";return n?e.jsx(B,{size:12,className:s}):e.jsx(te,{size:12,className:s})}function ne(t,r){return Math.abs(t)<.5?"text-gray-500":t>0===r?"text-red-400":"text-green-400"}function se(t){if(t instanceof Date)return Number.isNaN(t.getTime())?new Date:t;if(typeof t=="string"){const r=new Date(t);if(!Number.isNaN(r.getTime()))return r}return new Date}const oe=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}),v=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"});function w(t,r){return t.getFullYear()===r.getFullYear()?`${oe.format(t)} – ${v.format(r)}`:`${v.format(t)} – ${v.format(r)}`}function ie(t){const n=new Date(t.getTime()-6048e5),d=new Date(t.getTime()-14*864e5),s=n;return{currentLabel:w(n,t),priorLabel:w(d,s)}}function Ce({trends:t,endDate:r,onTileClick:n}){if(!t||!t.current_week||!t.prior_week||!t.delta_pct)return e.jsx("div",{"data-testid":"trend-delta-strip-empty",className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:e.jsx("div",{className:"text-xs text-gray-500",children:"No trend data yet — need at least two weeks of activity."})});const{current_week:d,prior_week:s,delta_pct:i}=t,c=se(r),{currentLabel:l,priorLabel:x}=ie(c),o=a=>{n==null||n(a),typeof window<"u"&&typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent("stackunderflow:filter-window",{detail:{window:"current-week",metric:a}}))};return e.jsx("div",{"data-testid":"trend-delta-strip",className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 divide-x divide-gray-200 dark:divide-gray-800",children:ae.map(a=>{const g=d[a.key]??0,u=s[a.key]??0,m=i[a.key]??0,h=`${a.label} Current (${l}): ${a.format(g)} Prior (${x}): ${a.format(u)} -Click to filter dashboard to current week`;return e.jsxs("button",{type:"button","data-testid":`trend-tile-${a.key}`,onClick:()=>o(a.key),title:h,"aria-label":`${a.label}, current ${a.format(g)}, prior ${a.format(u)}. Click to filter to current week.`,className:"relative group text-left px-4 py-3 cursor-pointer hover:bg-gray-100/60 dark:hover:bg-gray-800/40 focus:bg-gray-100/60 dark:focus:bg-gray-800/40 focus:outline-none focus-visible:ring-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-500 uppercase tracking-wider",children:[e.jsx("span",{className:"text-gray-500",children:a.icon}),a.label]}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:a.format(g)}),e.jsxs("span",{className:`inline-flex items-center gap-0.5 text-xs font-medium tabular-nums ${se(m,a.riseIsBad)}`,children:[ne(m,a.riseIsBad),Math.abs(m)<.05?"0%":`${m>0?"+":""}${m.toFixed(1)}%`]})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:"vs. prior 7 days"}),e.jsx("div",{role:"tooltip","data-testid":`trend-tile-tooltip-${a.key}`,className:"pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-20 w-56 opacity-0 group-hover:opacity-100 group-focus:opacity-100 group-focus-within:opacity-100 transition-opacity",children:e.jsxs("div",{className:"rounded-md border border-gray-300 dark:border-gray-700 bg-gray-50/95 dark:bg-gray-900/95 shadow-lg px-3 py-2 text-[11px] leading-snug text-gray-800 dark:text-gray-200",children:[e.jsx("div",{className:"font-semibold text-gray-900 dark:text-gray-100 mb-1",children:a.label}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Current"}),e.jsx("span",{className:"tabular-nums text-gray-900 dark:text-gray-100",children:a.format(g)})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mb-1",children:l}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Prior"}),e.jsx("span",{className:"tabular-nums text-gray-900 dark:text-gray-100",children:a.format(u)})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mb-1.5",children:x}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-1 text-[10px] text-gray-500",children:"Click to filter to current week"})]})})]},a.key)})})})}const ce=1e6;function S(t){return t/ce}function le(t){return t.length>8?t.slice(0,8):t}function xe(t,r){if(!t||t.length===0)return[];const n=r.tokens_saved??0,d=S(r.cost_saved_base_units??0),s=n>0?d/n:0;return t.map(i=>{var o,a;const c=((o=i.tokens)==null?void 0:o.cache_read)??0,l=((a=i.tokens)==null?void 0:a.cache_creation)??0,x=c-l;return{session_id:i.session_id,tokens_saved:x,cost_saved:Math.max(x,0)*s}}).filter(i=>i.tokens_saved>0).sort((i,c)=>c.tokens_saved-i.tokens_saved).slice(0,5)}function me(t){if(!t)return null;const r=[];for(const[n,d]of Object.entries(t)){const s=d==null?void 0:d.tokens;if(!s||typeof s!="object")continue;const i=Number(s.cache_read??0),c=Number(s.cache_creation??0);!Number.isFinite(i)||!Number.isFinite(c)||c<=0||r.push({date:n,ratio:i/c})}return r.length<2?null:(r.sort((n,d)=>n.date.localeCompare(d.date)),r)}function Me({cache:t,sessionCosts:r,dailyStats:n}){const{currency:d}=D(),s=M(),[i,c]=f.useState(!1),l=f.useMemo(()=>t?xe(r,t):[],[r,t]),x=f.useMemo(()=>me(n),[n]);if(!t||t.total_created===0)return e.jsxs("div",{className:"bg-gradient-to-br from-indigo-900/30 to-gray-50/50 dark:to-gray-900/30 rounded-lg p-6 border border-indigo-900/40","data-testid":"cache-roi-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(_,{size:18,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Cache ROI"})]}),e.jsx("div",{className:"text-gray-500 text-sm",children:"No cache activity yet"})]});const o=t.tokens_saved??0,a=t.total_created??0,g=a>0?o/a*100:0,u=t.break_even_achieved===!0,m=S(t.cost_saved_base_units??0),h=u?m:Math.min(m,0),k=t.hit_rate??0,$=l.length>0;return e.jsxs("div",{className:"bg-gradient-to-br from-indigo-900/40 to-gray-50/60 dark:to-gray-900/40 rounded-lg p-6 border border-indigo-900/50","data-testid":"cache-roi-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(_,{size:18,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Cache ROI"}),e.jsx("div",{className:"flex-1"}),u?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-green-800 dark:text-green-300 bg-green-100 dark:bg-green-900/40 border border-green-300 dark:border-green-800 rounded-full px-2 py-0.5",children:[e.jsx(A,{size:10})," break-even"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-800 dark:text-amber-300 bg-amber-100 dark:bg-amber-900/30 border border-amber-300 dark:border-amber-800 rounded-full px-2 py-0.5",children:[e.jsx(J,{size:10})," below break-even"]})]}),e.jsxs("div",{className:"flex items-end gap-5",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-5xl font-bold text-indigo-700 dark:text-indigo-300 leading-none",children:[g.toFixed(0),e.jsx("span",{className:"text-2xl text-indigo-600/80 dark:text-indigo-400/80 align-top ml-1",children:"%"})]}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"return on cache writes"})]}),x?e.jsx("div",{className:"w-28 h-12 shrink-0","aria-label":"Cache ROI trend sparkline","data-testid":"cache-roi-sparkline",children:e.jsx(I,{width:"100%",height:"100%",children:e.jsxs(O,{data:x,margin:{top:2,right:2,bottom:2,left:2},children:[e.jsx(T,{contentStyle:{...s.tooltipContent,borderRadius:"4px",fontSize:"10px",padding:"4px 6px"},labelStyle:s.tooltipLabel,formatter:p=>[`${p.toFixed(2)}×`,"read / created"]}),e.jsx(P,{type:"monotone",dataKey:"ratio",stroke:"#A5B4FC",strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}):null]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-5 pt-4 border-t border-indigo-900/30",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Tokens Saved"}),e.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:j(o)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Cost Saved"}),e.jsx("div",{className:`text-lg font-semibold mt-0.5 ${h>0?"text-green-700 dark:text-green-300":h<0?"text-red-700 dark:text-red-300":"text-gray-900 dark:text-gray-100"}`,children:N(h,d)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Hit Rate"}),e.jsxs("div",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:[k.toFixed(1),"%"]})]})]}),$?e.jsxs("div",{className:"mt-4 pt-3 border-t border-indigo-900/30",children:[e.jsxs("button",{type:"button",onClick:()=>c(p=>!p),"aria-expanded":i,className:"w-full flex items-center gap-1.5 text-[11px] text-indigo-700 dark:text-indigo-300 hover:text-indigo-800 dark:hover:text-indigo-200 uppercase tracking-wider focus:outline-none focus:text-indigo-800 dark:focus:text-indigo-200","data-testid":"cache-roi-toggle",children:[e.jsx(E,{size:12,className:`transition-transform ${i?"rotate-90":""}`}),e.jsx("span",{children:"Top cache savers"}),e.jsxs("span",{className:"text-gray-500 normal-case tracking-normal",children:["· top ",l.length," of ",(r==null?void 0:r.length)??0]})]}),i?e.jsx("ul",{className:"mt-3 divide-y divide-indigo-900/20 rounded border border-indigo-900/30 bg-gray-50/60 dark:bg-gray-900/40","data-testid":"cache-roi-savers",children:l.map(p=>e.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-xs",children:[e.jsx("code",{className:"text-indigo-700 dark:text-indigo-300 font-mono",children:le(p.session_id)}),e.jsxs("div",{className:"flex items-center gap-4 text-right",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-900 dark:text-gray-100 font-semibold",children:j(p.tokens_saved)}),e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"tokens"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-green-700 dark:text-green-300 font-semibold",children:N(p.cost_saved,d)}),e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"saved"})]})]})]},p.session_id))}):null]}):null]})}const C=[{key:"input",color:"#818CF8",label:"Input"},{key:"output",color:"#34D399",label:"Output"},{key:"cache_read",color:"#F59E0B",label:"Cache Read"},{key:"cache_creation",color:"#FB923C",label:"Cache Creation"}],ge=.03;function ue(t){const{cx:r,cy:n,midAngle:d,innerRadius:s,outerRadius:i,percent:c}=t;if(r==null||n==null||d==null||s==null||i==null||c==null||co+((t==null?void 0:t[a.key])??0),0),i=(t==null?void 0:t.reasoning)??0,c=(t==null?void 0:t.output)??0,l=c>0?i/c*100:0;if(!t||s===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-donut-empty",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Token Composition"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No token data yet"})]});const x=C.map(o=>({name:o.key,label:o.label,color:o.color,value:t[o.key]??0})).filter(o=>o.value>0);return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-donut",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Token Composition",e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:[b(s)," total"]})]}),e.jsx(I,{width:"100%",height:360,children:e.jsxs(K,{children:[e.jsxs(Y,{data:x,cx:"50%",cy:"50%",innerRadius:85,outerRadius:135,paddingAngle:2,dataKey:"value",nameKey:"label",label:ue,labelLine:!1,activeIndex:n,activeShape:pe,onMouseEnter:(o,a)=>d(a),onMouseLeave:()=>d(void 0),isAnimationActive:!1,children:[x.map((o,a)=>{const g=n!==void 0&&n!==a;return e.jsx(H,{fill:o.color,opacity:g?.35:1,style:{transition:"opacity 150ms ease"},"data-testid":`token-composition-slice-${o.name}`},a)}),e.jsx(W,{position:"center",content:o=>{const a=o.viewBox;if(!a||a.cx==null||a.cy==null)return null;const{cx:g,cy:u}=a;return e.jsxs("g",{"data-testid":"token-composition-center",children:[e.jsx("text",{x:g,y:u-6,textAnchor:"middle",dominantBaseline:"central",fill:r.textStrong,fontSize:20,fontWeight:700,children:b(s)}),e.jsx("text",{x:g,y:u+14,textAnchor:"middle",dominantBaseline:"central",fill:r.tickMuted.fill,fontSize:10,letterSpacing:"0.06em",children:"tokens"})]})}})]}),e.jsx(T,{contentStyle:r.tooltipContent,labelStyle:r.tooltipLabel,formatter:o=>{const a=s>0?o/s*100:0;return[`${o.toLocaleString()} (${a.toFixed(1)}%)`,"Tokens"]}}),e.jsx(U,{wrapperStyle:r.legend,content:o=>{const a=o.payload;return!a||a.length===0?null:e.jsx("ul",{className:"flex flex-wrap justify-center gap-x-4 gap-y-1 mt-2","data-testid":"token-composition-legend",children:a.map((g,u)=>{const m=x[u];if(!m)return null;const h=s>0?m.value/s*100:0,k=n!==void 0&&n!==u;return e.jsxs("li",{className:"flex items-center gap-1.5 text-xs transition-opacity",style:{opacity:k?.45:1},"data-testid":`token-composition-legend-item-${m.name}`,children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:g.color??m.color}}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:m.label}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-medium tabular-nums",children:b(m.value)}),e.jsxs("span",{className:"text-gray-500 tabular-nums",children:["(",h.toFixed(1),"%)"]})]},u)})})}})]})}),i>0&&e.jsxs("div",{className:"mt-1 flex items-center justify-center gap-1.5 text-xs text-gray-500 dark:text-gray-400","data-testid":"token-composition-reasoning",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block w-2.5 h-2.5 rounded-sm flex-shrink-0 border border-dashed",style:{borderColor:"#34D399"}}),e.jsx("span",{children:"of which reasoning"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium tabular-nums",children:b(i)}),e.jsxs("span",{className:"tabular-nums",children:["(",l.toFixed(1),"% of output)"]})]})]})}export{Me as C,we as I,Ce as T,_ as a,ae as b,Ie as c,_e as d}; +Click to filter dashboard to current week`;return e.jsxs("button",{type:"button","data-testid":`trend-tile-${a.key}`,onClick:()=>o(a.key),title:h,"aria-label":`${a.label}, current ${a.format(g)}, prior ${a.format(u)}. Click to filter to current week.`,className:"relative group text-left px-4 py-3 cursor-pointer hover:bg-gray-100/60 dark:hover:bg-gray-800/40 focus:bg-gray-100/60 dark:focus:bg-gray-800/40 focus:outline-none focus-visible:ring-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-500 uppercase tracking-wider",children:[e.jsx("span",{className:"text-gray-500",children:a.icon}),a.label]}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:a.format(g)}),e.jsxs("span",{className:`inline-flex items-center gap-0.5 text-xs font-medium tabular-nums ${ne(m,a.riseIsBad)}`,children:[re(m,a.riseIsBad),Math.abs(m)<.05?"0%":`${m>0?"+":""}${m.toFixed(1)}%`]})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-0.5",children:"vs. prior 7 days"}),e.jsx("div",{role:"tooltip","data-testid":`trend-tile-tooltip-${a.key}`,className:"pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-20 w-56 opacity-0 group-hover:opacity-100 group-focus:opacity-100 group-focus-within:opacity-100 transition-opacity",children:e.jsxs("div",{className:"rounded-md border border-gray-300 dark:border-gray-700 bg-gray-50/95 dark:bg-gray-900/95 shadow-lg px-3 py-2 text-[11px] leading-snug text-gray-800 dark:text-gray-200",children:[e.jsx("div",{className:"font-semibold text-gray-900 dark:text-gray-100 mb-1",children:a.label}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Current"}),e.jsx("span",{className:"tabular-nums text-gray-900 dark:text-gray-100",children:a.format(g)})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mb-1",children:l}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Prior"}),e.jsx("span",{className:"tabular-nums text-gray-900 dark:text-gray-100",children:a.format(u)})]}),e.jsx("div",{className:"text-[10px] text-gray-500 mb-1.5",children:x}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-1 text-[10px] text-gray-500",children:"Click to filter to current week"})]})})]},a.key)})})})}const de=1e6;function S(t){return t/de}function ce(t){return t.length>8?t.slice(0,8):t}function le(t,r){if(!t||t.length===0)return[];const n=r.tokens_saved??0,d=S(r.cost_saved_base_units??0),s=n>0?d/n:0;return t.map(i=>{var o,a;const c=((o=i.tokens)==null?void 0:o.cache_read)??0,l=((a=i.tokens)==null?void 0:a.cache_creation)??0,x=c-l;return{session_id:i.session_id,tokens_saved:x,cost_saved:Math.max(x,0)*s}}).filter(i=>i.tokens_saved>0).sort((i,c)=>c.tokens_saved-i.tokens_saved).slice(0,5)}function xe(t){if(!t)return null;const r=[];for(const[n,d]of Object.entries(t)){const s=d==null?void 0:d.tokens;if(!s||typeof s!="object")continue;const i=Number(s.cache_read??0),c=Number(s.cache_creation??0);!Number.isFinite(i)||!Number.isFinite(c)||c<=0||r.push({date:n,ratio:i/c})}return r.length<2?null:(r.sort((n,d)=>n.date.localeCompare(d.date)),r)}function Ie({cache:t,sessionCosts:r,dailyStats:n}){const{currency:d}=D(),s=I(),[i,c]=b.useState(!1),l=b.useMemo(()=>t?le(r,t):[],[r,t]),x=b.useMemo(()=>xe(n),[n]);if(!t||t.total_created===0)return e.jsxs("div",{className:"bg-gradient-to-br from-indigo-900/30 to-gray-50/50 dark:to-gray-900/30 rounded-lg p-6 border border-indigo-900/40","data-testid":"cache-roi-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(_,{size:18,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Cache ROI"})]}),e.jsx("div",{className:"text-gray-500 text-sm",children:"No cache activity yet"})]});const o=t.tokens_saved??0,a=t.total_created??0,g=a>0?o/a*100:0,u=t.break_even_achieved===!0,m=S(t.cost_saved_base_units??0),h=u?m:Math.min(m,0),k=t.hit_rate??0,$=l.length>0;return e.jsxs("div",{className:"bg-gradient-to-br from-indigo-900/40 to-gray-50/60 dark:to-gray-900/40 rounded-lg p-6 border border-indigo-900/50","data-testid":"cache-roi-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(_,{size:18,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:"Cache ROI"}),e.jsx("div",{className:"flex-1"}),u?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-green-800 dark:text-green-300 bg-green-100 dark:bg-green-900/40 border border-green-300 dark:border-green-800 rounded-full px-2 py-0.5",children:[e.jsx(A,{size:10})," break-even"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-800 dark:text-amber-300 bg-amber-100 dark:bg-amber-900/30 border border-amber-300 dark:border-amber-800 rounded-full px-2 py-0.5",children:[e.jsx(J,{size:10})," below break-even"]})]}),e.jsxs("div",{className:"flex items-end gap-5",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-5xl font-bold text-indigo-700 dark:text-indigo-300 leading-none",children:[g.toFixed(0),e.jsx("span",{className:"text-2xl text-indigo-600/80 dark:text-indigo-400/80 align-top ml-1",children:"%"})]}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"return on cache writes"})]}),x?e.jsx("div",{className:"w-28 h-12 shrink-0","aria-label":"Cache ROI trend sparkline","data-testid":"cache-roi-sparkline",children:e.jsx(M,{width:"100%",height:"100%",children:e.jsxs(O,{data:x,margin:{top:2,right:2,bottom:2,left:2},children:[e.jsx(T,{contentStyle:{...s.tooltipContent,borderRadius:"4px",fontSize:"10px",padding:"4px 6px"},labelStyle:s.tooltipLabel,formatter:p=>[`${p.toFixed(2)}×`,"read / created"]}),e.jsx(P,{type:"monotone",dataKey:"ratio",stroke:"#A5B4FC",strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}):null]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-5 pt-4 border-t border-indigo-900/30",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Tokens Saved"}),e.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:j(o)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Cost Saved"}),e.jsx("div",{className:`text-lg font-semibold mt-0.5 ${h>0?"text-green-700 dark:text-green-300":h<0?"text-red-700 dark:text-red-300":"text-gray-900 dark:text-gray-100"}`,children:N(h,d)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Hit Rate"}),e.jsxs("div",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mt-0.5",children:[k.toFixed(1),"%"]})]})]}),$?e.jsxs("div",{className:"mt-4 pt-3 border-t border-indigo-900/30",children:[e.jsxs("button",{type:"button",onClick:()=>c(p=>!p),"aria-expanded":i,className:"w-full flex items-center gap-1.5 text-[11px] text-indigo-700 dark:text-indigo-300 hover:text-indigo-800 dark:hover:text-indigo-200 uppercase tracking-wider focus:outline-none focus:text-indigo-800 dark:focus:text-indigo-200","data-testid":"cache-roi-toggle",children:[e.jsx(E,{size:12,className:`transition-transform ${i?"rotate-90":""}`}),e.jsx("span",{children:"Top cache savers"}),e.jsxs("span",{className:"text-gray-500 normal-case tracking-normal",children:["· top ",l.length," of ",(r==null?void 0:r.length)??0]})]}),i?e.jsx("ul",{className:"mt-3 divide-y divide-indigo-900/20 rounded border border-indigo-900/30 bg-gray-50/60 dark:bg-gray-900/40","data-testid":"cache-roi-savers",children:l.map(p=>e.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-xs",children:[e.jsx("code",{className:"text-indigo-700 dark:text-indigo-300 font-mono",children:ce(p.session_id)}),e.jsxs("div",{className:"flex items-center gap-4 text-right",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-900 dark:text-gray-100 font-semibold",children:j(p.tokens_saved)}),e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"tokens"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-green-700 dark:text-green-300 font-semibold",children:N(p.cost_saved,d)}),e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"saved"})]})]})]},p.session_id))}):null]}):null]})}const C=[{key:"input",color:"#818CF8",label:"Input"},{key:"output",color:"#34D399",label:"Output"},{key:"cache_read",color:"#F59E0B",label:"Cache Read"},{key:"cache_creation",color:"#FB923C",label:"Cache Creation"}],me=.03;function ge(t){const{cx:r,cy:n,midAngle:d,innerRadius:s,outerRadius:i,percent:c}=t;if(r==null||n==null||d==null||s==null||i==null||c==null||co+((t==null?void 0:t[a.key])??0),0),i=(t==null?void 0:t.reasoning)??0,c=(t==null?void 0:t.output)??0,l=c>0?i/c*100:0;if(!t||s===0)return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-donut-empty",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Token Composition"}),e.jsx("div",{className:"text-xs text-gray-500 py-8 text-center",children:"No token data yet"})]});const x=C.map(o=>({name:o.key,label:o.label,color:o.color,value:t[o.key]??0})).filter(o=>o.value>0);return e.jsxs("div",{className:"bg-gray-100/70 dark:bg-gray-800/50 rounded-lg p-4 border border-gray-200 dark:border-gray-800","data-testid":"token-composition-donut",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Token Composition",e.jsxs("span",{className:"ml-2 text-xs text-gray-500 font-normal",children:[f(s)," total"]})]}),e.jsx(M,{width:"100%",height:360,children:e.jsxs(K,{children:[e.jsxs(Y,{data:x,cx:"50%",cy:"50%",innerRadius:85,outerRadius:135,paddingAngle:2,dataKey:"value",nameKey:"label",label:ge,labelLine:!1,activeIndex:n,activeShape:ue,onMouseEnter:(o,a)=>d(a),onMouseLeave:()=>d(void 0),isAnimationActive:!1,children:[x.map((o,a)=>{const g=n!==void 0&&n!==a;return e.jsx(H,{fill:o.color,opacity:g?.35:1,style:{transition:"opacity 150ms ease"},"data-testid":`token-composition-slice-${o.name}`},a)}),e.jsx(W,{position:"center",content:o=>{const a=o.viewBox;if(!a||a.cx==null||a.cy==null)return null;const{cx:g,cy:u}=a;return e.jsxs("g",{"data-testid":"token-composition-center",children:[e.jsx("text",{x:g,y:u-6,textAnchor:"middle",dominantBaseline:"central",fill:r.textStrong,fontSize:20,fontWeight:700,children:f(s)}),e.jsx("text",{x:g,y:u+14,textAnchor:"middle",dominantBaseline:"central",fill:r.tickMuted.fill,fontSize:10,letterSpacing:"0.06em",children:"tokens"})]})}})]}),e.jsx(T,{contentStyle:r.tooltipContent,labelStyle:r.tooltipLabel,formatter:o=>{const a=s>0?o/s*100:0;return[`${o.toLocaleString()} (${a.toFixed(1)}%)`,"Tokens"]}}),e.jsx(U,{wrapperStyle:r.legend,content:o=>{const a=o.payload;return!a||a.length===0?null:e.jsx("ul",{className:"flex flex-wrap justify-center gap-x-4 gap-y-1 mt-2","data-testid":"token-composition-legend",children:a.map((g,u)=>{const m=x[u];if(!m)return null;const h=s>0?m.value/s*100:0,k=n!==void 0&&n!==u;return e.jsxs("li",{className:"flex items-center gap-1.5 text-xs transition-opacity",style:{opacity:k?.45:1},"data-testid":`token-composition-legend-item-${m.name}`,children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:g.color??m.color}}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:m.label}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-medium tabular-nums",children:f(m.value)}),e.jsxs("span",{className:"text-gray-500 tabular-nums",children:["(",h.toFixed(1),"%)"]})]},u)})})}})]})}),i>0&&e.jsxs("div",{className:"mt-1 flex items-center justify-center gap-1.5 text-xs text-gray-500 dark:text-gray-400","data-testid":"token-composition-reasoning",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block w-2.5 h-2.5 rounded-sm flex-shrink-0 border border-dashed",style:{borderColor:"#34D399"}}),e.jsx("span",{children:"of which reasoning"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium tabular-nums",children:f(i)}),e.jsxs("span",{className:"tabular-nums",children:["(",l.toFixed(1),"% of output)"]})]})]})}export{Ie as C,we as I,Ce as T,te as a,Me as b,_e as c}; diff --git a/stackunderflow/static/react/assets/WorktreesTab-B65wyswE.js b/stackunderflow/static/react/assets/WorktreesTab-By5aNgjx.js similarity index 98% rename from stackunderflow/static/react/assets/WorktreesTab-B65wyswE.js rename to stackunderflow/static/react/assets/WorktreesTab-By5aNgjx.js index d518754..f0f6b55 100644 --- a/stackunderflow/static/react/assets/WorktreesTab-B65wyswE.js +++ b/stackunderflow/static/react/assets/WorktreesTab-By5aNgjx.js @@ -1,4 +1,4 @@ -import{d as E,r as f,u as b,e as T,j as e}from"./react-vendor-B7v2HPaI.js";import{h as z,u as A,I,L as P,z as q,p as j,B as k,i as M,j as R,k as $}from"./index-DQluCO2S.js";import{E as F}from"./EmptyState-o0gibvhZ.js";import{b as w}from"./format-Co_unrac.js";import{o as u,b as L,c as D}from"./dashboardTabs-C5ecR5YO.js";import{I as U}from"./IconActivity-Bf5MQINx.js";import{I as W}from"./IconCheck-BQLu3HFV.js";import{I as B}from"./IconCopy-BOYWZx4M.js";/** +import{d as E,r as f,u as b,e as T,j as e}from"./react-vendor-B7v2HPaI.js";import{h as z,u as A,I,L as P,z as q,p as j,B as k,i as M,j as R,k as $}from"./index-0LeeVNek.js";import{E as F}from"./EmptyState-o0gibvhZ.js";import{b as w}from"./format-Co_unrac.js";import{p as u,b as L,c as D}from"./dashboardTabs-BuoED77E.js";import{I as U}from"./IconActivity-CtliCKZa.js";import{I as W}from"./IconCheck-D_dgJKrH.js";import{I as B}from"./IconCopy-Cl6jyttT.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. diff --git a/stackunderflow/static/react/assets/YieldTab-BbHHGYlL.js b/stackunderflow/static/react/assets/YieldTab-CGWBiQ4I.js similarity index 85% rename from stackunderflow/static/react/assets/YieldTab-BbHHGYlL.js rename to stackunderflow/static/react/assets/YieldTab-CGWBiQ4I.js index 83f5b40..7b4a63e 100644 --- a/stackunderflow/static/react/assets/YieldTab-BbHHGYlL.js +++ b/stackunderflow/static/react/assets/YieldTab-CGWBiQ4I.js @@ -1,6 +1,6 @@ -import{r as g,u as p,j as e}from"./react-vendor-B7v2HPaI.js";import{h as u,u as y,a as h,L as b,G as f,p as j,B as w,am as k}from"./index-DQluCO2S.js";import{E as N}from"./EmptyState-o0gibvhZ.js";import{b as m}from"./format-Co_unrac.js";import{m as x}from"./dashboardTabs-C5ecR5YO.js";import{I as v}from"./IconCircleX-D7ABaoUn.js";import{I as _}from"./IconTrendingUp-D1iuYAG9.js";/** +import{r as g,u as p,j as e}from"./react-vendor-B7v2HPaI.js";import{h as u,u as y,a as h,L as b,G as f,p as j,B as w,am as k}from"./index-0LeeVNek.js";import{E as N}from"./EmptyState-o0gibvhZ.js";import{b as m}from"./format-Co_unrac.js";import{n as x}from"./dashboardTabs-BuoED77E.js";import{I as v}from"./IconCircleX-CZ-PNBqE.js";import{I as _}from"./IconTrendingUp-CcTO0Xpf.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const C=[["path",{d:"M9 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M5 10h11a4 4 0 1 1 0 8h-1",key:"svg-1"}]],I=u("outline","arrow-back-up","ArrowBackUp",C),S=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}],A={productive:{label:"productive",color:"green"},reverted:{label:"reverted",color:"red"},abandoned:{label:"abandoned",color:"yellow"},no_repo:{label:"no repo",color:"gray"}};function n({icon:r,title:t,count:o,cost:c,color:s,currency:d}){return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:s,children:r}),e.jsx("span",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:t})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 tabular-nums",children:o.toLocaleString()}),e.jsx("div",{className:"text-xs text-gray-500 mt-1 tabular-nums",children:m(c,d)})]})}function T(r,t=80){return r?r.length>t?`${r.slice(0,t-1)}…`:r:"—"}function z(r){const t=new Date(r);return Number.isNaN(t.getTime())?r:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function F(r){return r===null||!Number.isFinite(r)?"—":r<1?`${Math.round(r*60)}m`:r<24?`${r.toFixed(1)}h`:`${(r/24).toFixed(1)}d`}function E({entry:r,currency:t}){const o=A[r.classification];return e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap",children:z(r.started_at)}),e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-800 dark:text-gray-200 break-all max-w-[220px]",children:r.project_slug||"—"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(w,{color:o.color,size:"sm",children:o.label})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 max-w-[360px]",children:T(r.follow_commit_msg)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:F(r.follow_commit_age_hours)}),e.jsx("td",{className:"px-3 py-2 text-sm tabular-nums text-gray-900 dark:text-gray-100 font-medium text-right whitespace-nowrap",children:m(r.cost_usd,t)})]})}function B({warning:r}){return e.jsxs("div",{className:"flex items-start gap-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md p-3 text-yellow-800 dark:text-yellow-300 text-xs",children:[e.jsx(j,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsx("span",{children:r})]})}function q(){const{currency:r}=y(),{filters:t}=h(),[o,c]=g.useState("week"),{data:s,isLoading:d,error:l}=p({queryKey:["yield",o,t.providers,t.models],queryFn:()=>k(o,{providers:t.providers,models:t.models}),staleTime:6e4}),a=s==null?void 0:s.summary;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Yield analysis"}),e.jsx("span",{className:"text-xs text-gray-500",children:"productive vs reverted vs abandoned, by git follow-up"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Yield period",children:S.map(i=>e.jsx("button",{type:"button",onClick:()=>c(i.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${i.id===o?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:i.label},i.id))})]}),(s==null?void 0:s.warning)&&e.jsx(B,{warning:s.warning}),d&&e.jsx(b,{message:"Computing yield..."}),l&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load yield: ",l instanceof Error?l.message:"Unknown error"]}),!d&&!l&&a&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(n,{icon:e.jsx(f,{size:16}),title:"Productive",count:a.productive,cost:a.productive_cost,color:"text-green-500",currency:r}),e.jsx(n,{icon:e.jsx(I,{size:16}),title:"Reverted",count:a.reverted,cost:a.reverted_cost,color:"text-red-500",currency:r}),e.jsx(n,{icon:e.jsx(v,{size:16}),title:"Abandoned",count:a.abandoned,cost:a.abandoned_cost,color:"text-yellow-500",currency:r}),e.jsx(n,{icon:e.jsx(_,{size:16}),title:"No repo",count:a.no_repo,cost:a.no_repo_cost,color:"text-gray-500",currency:r})]}),!d&&!l&&s&&s.entries.length===0&&e.jsx(N,{icon:e.jsx(x,{size:28}),title:"No sessions in window",description:"Try a wider period to see per-session yield."}),!d&&!l&&s&&s.entries.length>0&&e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Started"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Project"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Class"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Follow-up commit"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Age"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:s.entries.map(i=>e.jsx(E,{entry:i,currency:r},i.session_id))})]})})]})}export{q as default}; + */const C=[["path",{d:"M9 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M5 10h11a4 4 0 1 1 0 8h-1",key:"svg-1"}]],I=u("outline","arrow-back-up","ArrowBackUp",C),S=[{id:"today",label:"Today"},{id:"week",label:"7d"},{id:"month",label:"30d"},{id:"all",label:"All"}],A={productive:{label:"productive",color:"green"},reverted:{label:"reverted",color:"red"},abandoned:{label:"abandoned",color:"yellow"},no_repo:{label:"no repo",color:"gray"}};function l({icon:r,title:t,count:o,cost:c,color:s,currency:d}){return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:s,children:r}),e.jsx("span",{className:"text-xs uppercase tracking-wider text-gray-500 font-medium",children:t})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 tabular-nums",children:o.toLocaleString()}),e.jsx("div",{className:"text-xs text-gray-500 mt-1 tabular-nums",children:m(c,d)})]})}function T(r,t=80){return r?r.length>t?`${r.slice(0,t-1)}…`:r:"—"}function z(r){const t=new Date(r);return Number.isNaN(t.getTime())?r:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function F(r){return r===null||!Number.isFinite(r)?"—":r<1?`${Math.round(r*60)}m`:r<24?`${r.toFixed(1)}h`:`${(r/24).toFixed(1)}d`}function E({entry:r,currency:t}){const o=A[r.classification];return e.jsxs("tr",{className:"border-t border-gray-200 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap",children:z(r.started_at)}),e.jsx("td",{className:"px-3 py-2 text-xs font-mono text-gray-800 dark:text-gray-200 break-all max-w-[220px]",children:r.project_slug||"—"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(w,{color:o.color,size:"sm",children:o.label})}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 max-w-[360px]",children:T(r.follow_commit_msg)}),e.jsx("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 text-right tabular-nums whitespace-nowrap",children:F(r.follow_commit_age_hours)}),e.jsx("td",{className:"px-3 py-2 text-sm tabular-nums text-gray-900 dark:text-gray-100 font-medium text-right whitespace-nowrap",children:m(r.cost_usd,t)})]})}function B({warning:r}){return e.jsxs("div",{className:"flex items-start gap-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md p-3 text-yellow-800 dark:text-yellow-300 text-xs",children:[e.jsx(j,{size:14,className:"flex-shrink-0 mt-0.5"}),e.jsx("span",{children:r})]})}function q(){const{currency:r}=y(),{filters:t}=h(),[o,c]=g.useState("week"),{data:s,isLoading:d,error:n}=p({queryKey:["yield",o,t.providers,t.models],queryFn:()=>k(o,{providers:t.providers,models:t.models}),staleTime:6e4}),a=s==null?void 0:s.summary;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{size:16,className:"text-gray-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:"Yield analysis"}),e.jsx("span",{className:"text-xs text-gray-500",children:"productive vs reverted vs abandoned, by git follow-up"})]}),e.jsx("div",{className:"inline-flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden",role:"group","aria-label":"Yield period",children:S.map(i=>e.jsx("button",{type:"button",onClick:()=>c(i.id),className:`px-3 py-1.5 text-xs font-medium transition-colors ${i.id===o?"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400":"bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:i.label},i.id))})]}),(s==null?void 0:s.warning)&&e.jsx(B,{warning:s.warning}),d&&e.jsx(b,{message:"Computing yield..."}),n&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm",children:["Failed to load yield: ",n instanceof Error?n.message:"Unknown error"]}),!d&&!n&&a&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(l,{icon:e.jsx(f,{size:16}),title:"Productive",count:a.productive,cost:a.productive_cost,color:"text-green-500",currency:r}),e.jsx(l,{icon:e.jsx(I,{size:16}),title:"Reverted",count:a.reverted,cost:a.reverted_cost,color:"text-red-500",currency:r}),e.jsx(l,{icon:e.jsx(v,{size:16}),title:"Abandoned",count:a.abandoned,cost:a.abandoned_cost,color:"text-yellow-500",currency:r}),e.jsx(l,{icon:e.jsx(_,{size:16}),title:"No repo",count:a.no_repo,cost:a.no_repo_cost,color:"text-gray-500",currency:r})]}),!d&&!n&&s&&s.entries.length===0&&e.jsx(N,{icon:e.jsx(x,{size:28}),title:"No sessions in window",description:"Try a wider period to see per-session yield."}),!d&&!n&&s&&s.entries.length>0&&e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Started"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Project"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Class"}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Follow-up commit"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Age"}),e.jsx("th",{className:"px-3 py-2 text-right text-[10px] uppercase tracking-wider text-gray-500 font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:s.entries.map(i=>e.jsx(E,{entry:i,currency:r},i.session_id))})]})})]})}export{q as default}; diff --git a/stackunderflow/static/react/assets/dashboardTabs-C5ecR5YO.js b/stackunderflow/static/react/assets/dashboardTabs-BuoED77E.js similarity index 51% rename from stackunderflow/static/react/assets/dashboardTabs-C5ecR5YO.js rename to stackunderflow/static/react/assets/dashboardTabs-BuoED77E.js index 6220f7d..040d5b5 100644 --- a/stackunderflow/static/react/assets/dashboardTabs-C5ecR5YO.js +++ b/stackunderflow/static/react/assets/dashboardTabs-BuoED77E.js @@ -1,4 +1,4 @@ -import{h as e,M,b}from"./index-DQluCO2S.js";import{r as c,j as f}from"./react-vendor-B7v2HPaI.js";/** +import{h as e,M,b}from"./index-0LeeVNek.js";import{r,j as f}from"./react-vendor-B7v2HPaI.js";/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. @@ -8,79 +8,84 @@ import{h as e,M,b}from"./index-DQluCO2S.js";import{r as c,j as f}from"./react-ve * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const w=[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]],se=e("outline","arrow-left","ArrowLeft",w);/** + */const w=[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]],re=e("outline","arrow-left","ArrowLeft",w);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const B=[["path",{d:"M14 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-0"}],["path",{d:"M7 14a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-1"}],["path",{d:"M21 14a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-2"}],["path",{d:"M14 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-3"}],["path",{d:"M12 8v8",key:"svg-4"}],["path",{d:"M6.316 12.496l4.368 -4.992",key:"svg-5"}],["path",{d:"M17.684 12.496l-4.366 -4.99",key:"svg-6"}]],I=e("outline","binary-tree-2","BinaryTree2",B);/** + */const B=[["path",{d:"M21 17l-18 0",key:"svg-0"}],["path",{d:"M6 10l-3 -3l3 -3",key:"svg-1"}],["path",{d:"M3 7l18 0",key:"svg-2"}],["path",{d:"M18 20l3 -3l-3 -3",key:"svg-3"}]],I=e("outline","arrows-left-right","ArrowsLeftRight",B);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const S=[["path",{d:"M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4",key:"svg-0"}]],N=e("outline","bookmark","Bookmark",S);/** + */const S=[["path",{d:"M14 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-0"}],["path",{d:"M7 14a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-1"}],["path",{d:"M21 14a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-2"}],["path",{d:"M14 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0",key:"svg-3"}],["path",{d:"M12 8v8",key:"svg-4"}],["path",{d:"M6.316 12.496l4.368 -4.992",key:"svg-5"}],["path",{d:"M17.684 12.496l-4.366 -4.99",key:"svg-6"}]],N=e("outline","binary-tree-2","BinaryTree2",S);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const E=[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]],T=e("outline","currency-dollar","CurrencyDollar",E);/** + */const A=[["path",{d:"M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4",key:"svg-0"}]],E=e("outline","bookmark","Bookmark",A);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const A=[["path",{d:"M9 3h3l2 2h5a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M17 16v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2h2",key:"svg-1"}]],$=e("outline","folders","Folders",A);/** + */const T=[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]],$=e("outline","currency-dollar","CurrencyDollar",T);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const C=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M9 18h6a2 2 0 0 0 2 -2v-5",key:"svg-4"}],["path",{d:"M14 14l3 -3l3 3",key:"svg-5"}]],x=e("outline","git-branch","GitBranch",C);/** + */const C=[["path",{d:"M9 3h3l2 2h5a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M17 16v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2h2",key:"svg-1"}]],x=e("outline","folders","Folders",C);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const L=[["path",{d:"M10 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 12l0 4",key:"svg-4"}]],D=e("outline","git-fork","GitFork",L);/** + */const L=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M9 18h6a2 2 0 0 0 2 -2v-5",key:"svg-4"}],["path",{d:"M14 14l3 -3l3 3",key:"svg-5"}]],D=e("outline","git-branch","GitBranch",L);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const H=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 16v.01",key:"svg-1"}],["path",{d:"M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483",key:"svg-2"}]],O=e("outline","help-circle","HelpCircle",H);/** + */const H=[["path",{d:"M10 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 12l0 4",key:"svg-4"}]],O=e("outline","git-fork","GitFork",H);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const F=[["path",{d:"M10 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M10 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M18 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M2 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-4"}],["path",{d:"M14 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-5"}],["path",{d:"M5 17l2 -3",key:"svg-6"}],["path",{d:"M9 10l2 -3",key:"svg-7"}],["path",{d:"M13 7l2 3",key:"svg-8"}],["path",{d:"M17 14l2 3",key:"svg-9"}],["path",{d:"M15 14l-2 3",key:"svg-10"}],["path",{d:"M9 14l2 3",key:"svg-11"}]],j=e("outline","hierarchy-3","Hierarchy3",F);/** + */const F=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 16v.01",key:"svg-1"}],["path",{d:"M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483",key:"svg-2"}]],j=e("outline","help-circle","HelpCircle",F);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const G=[["path",{d:"M12 8l0 4l2 2",key:"svg-0"}],["path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5",key:"svg-1"}]],J=e("outline","history","History",G);/** + */const R=[["path",{d:"M10 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M10 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M18 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M2 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-4"}],["path",{d:"M14 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-5"}],["path",{d:"M5 17l2 -3",key:"svg-6"}],["path",{d:"M9 10l2 -3",key:"svg-7"}],["path",{d:"M13 7l2 3",key:"svg-8"}],["path",{d:"M17 14l2 3",key:"svg-9"}],["path",{d:"M15 14l-2 3",key:"svg-10"}],["path",{d:"M9 14l2 3",key:"svg-11"}]],G=e("outline","hierarchy-3","Hierarchy3",R);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const Y=[["path",{d:"M5 4h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-0"}],["path",{d:"M5 16h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-1"}],["path",{d:"M15 12h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-2"}],["path",{d:"M15 4h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-3"}]],R=e("outline","layout-dashboard","LayoutDashboard",Y);/** + */const J=[["path",{d:"M12 8l0 4l2 2",key:"svg-0"}],["path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5",key:"svg-1"}]],Y=e("outline","history","History",J);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const V=[["path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1",key:"svg-0"}]],W=e("outline","message-circle","MessageCircle",V);/** + */const V=[["path",{d:"M5 4h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-0"}],["path",{d:"M5 16h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-1"}],["path",{d:"M15 12h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-2"}],["path",{d:"M15 4h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-3"}]],W=e("outline","layout-dashboard","LayoutDashboard",V);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const K=[["path",{d:"M7 20l10 0",key:"svg-0"}],["path",{d:"M6 6l6 -1l6 1",key:"svg-1"}],["path",{d:"M12 3l0 17",key:"svg-2"}],["path",{d:"M9 12l-3 -6l-3 6a3 3 0 0 0 6 0",key:"svg-3"}],["path",{d:"M21 12l-3 -6l-3 6a3 3 0 0 0 6 0",key:"svg-4"}]],U=e("outline","scale","Scale",K);/** + */const K=[["path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1",key:"svg-0"}]],U=e("outline","message-circle","MessageCircle",K);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const q=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],P=e("outline","tag","Tag",q);/** + */const q=[["path",{d:"M7 20l10 0",key:"svg-0"}],["path",{d:"M6 6l6 -1l6 1",key:"svg-1"}],["path",{d:"M12 3l0 17",key:"svg-2"}],["path",{d:"M9 12l-3 -6l-3 6a3 3 0 0 0 6 0",key:"svg-3"}],["path",{d:"M21 12l-3 -6l-3 6a3 3 0 0 0 6 0",key:"svg-4"}]],P=e("outline","scale","Scale",q);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const Q=[["path",{d:"M8 9l3 3l-3 3",key:"svg-0"}],["path",{d:"M13 15l3 0",key:"svg-1"}],["path",{d:"M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12",key:"svg-2"}]],z=e("outline","terminal-2","Terminal2",Q);/** + */const Q=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],z=e("outline","tag","Tag",Q);/** * @license @tabler/icons-react v3.36.1 - MIT * * This source code is licensed under the MIT license. * See the LICENSE file in the root directory of this source tree. - */const X=[["path",{d:"M17 8v-3a1 1 0 0 0 -1 -1h-10a2 2 0 0 0 0 4h12a1 1 0 0 1 1 1v3m0 4v3a1 1 0 0 1 -1 1h-12a2 2 0 0 1 -2 -2v-12",key:"svg-0"}],["path",{d:"M20 12v4h-4a2 2 0 0 1 0 -4h4",key:"svg-1"}]],Z=e("outline","wallet","Wallet",X),h="suf:beta",y="suf:tabs",d=!0;function ee(){if(typeof window>"u")return d;try{const a=window.localStorage.getItem(h);if(a===null)return d;const t=JSON.parse(a);if(typeof t=="boolean")return t}catch{}return d}function ae(){if(typeof window>"u")return{};try{const a=window.localStorage.getItem(y);if(a===null)return{};const t=JSON.parse(a);if(t&&typeof t=="object"&&!Array.isArray(t)){const s={};for(const[l,r]of Object.entries(t))(r==="shown"||r==="hidden")&&(s[l]=r);return s}}catch{}return{}}function ne(){const[a,t]=c.useState(()=>ee()),[s,l]=c.useState(()=>ae());c.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(h,JSON.stringify(a))}catch{}},[a]),c.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(y,JSON.stringify(s))}catch{}},[s]);const r=c.useCallback(n=>{t(n)},[]),k=c.useCallback((n,i)=>{l(o=>{if(i==="default"){if(!(n in o))return o;const v={...o};return delete v[n],v}return o[n]===i?o:{...o,[n]:i}})},[]),p=c.useCallback((n,i)=>{const o=s[n];return o==="shown"?!0:o==="hidden"?!1:i?a:!0},[a,s]),u=c.useCallback(()=>{if(typeof window<"u")try{window.localStorage.removeItem(h),window.localStorage.removeItem(y)}catch{}t(d),l({})},[]);return{betaEnabled:a,tabOverrides:s,setBetaEnabled:r,setTabVisibility:k,isTabVisible:p,reset:u}}const g="bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300 text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider font-semibold";function ce({className:a}){const t=a?`${g} ${a}`:g;return f.jsx("span",{className:t,children:"BETA"})}const re=[{id:"overview",label:"Overview",icon:R},{id:"sessions",label:"Sessions",icon:$},{id:"agents",label:"Agents",icon:j,isBeta:!0},{id:"playback",label:"Playback",icon:J,isBeta:!0},{id:"contextreplay",label:"Context Replay",icon:M,isBeta:!0},{id:"cost",label:"Cost",icon:T},{id:"budgets",label:"Budgets",icon:Z,isBeta:!0},{id:"compare",label:"Compare",icon:U},{id:"yield",label:"Yield",icon:x,isBeta:!0},{id:"forks",label:"Forks",icon:D,isBeta:!0},{id:"health",label:"Health",icon:m,isBeta:!0},{id:"worktrees",label:"Worktrees",icon:I,isBeta:!0},{id:"commands",label:"Commands",icon:z},{id:"messages",label:"Messages",icon:W},{id:"search",label:"Search",icon:b},{id:"qa",label:"Q&A",icon:O,isBeta:!0},{id:"bookmarks",label:"Bookmarks",icon:N},{id:"tags",label:"Tags",icon:P,isBeta:!0}];export{ce as B,d as D,se as I,re as T,h as a,T as b,z as c,W as d,m as e,N as f,P as g,j as h,O as i,J as j,Z as k,U as l,x as m,D as n,I as o,ne as u}; + */const X=[["path",{d:"M8 9l3 3l-3 3",key:"svg-0"}],["path",{d:"M13 15l3 0",key:"svg-1"}],["path",{d:"M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12",key:"svg-2"}]],Z=e("outline","terminal-2","Terminal2",X);/** + * @license @tabler/icons-react v3.36.1 - MIT + * + * This source code is licensed under the MIT license. + * See the LICENSE file in the root directory of this source tree. + */const ee=[["path",{d:"M17 8v-3a1 1 0 0 0 -1 -1h-10a2 2 0 0 0 0 4h12a1 1 0 0 1 1 1v3m0 4v3a1 1 0 0 1 -1 1h-12a2 2 0 0 1 -2 -2v-12",key:"svg-0"}],["path",{d:"M20 12v4h-4a2 2 0 0 1 0 -4h4",key:"svg-1"}]],ae=e("outline","wallet","Wallet",ee),h="suf:beta",y="suf:tabs",d=!0;function te(){if(typeof window>"u")return d;try{const a=window.localStorage.getItem(h);if(a===null)return d;const t=JSON.parse(a);if(typeof t=="boolean")return t}catch{}return d}function oe(){if(typeof window>"u")return{};try{const a=window.localStorage.getItem(y);if(a===null)return{};const t=JSON.parse(a);if(t&&typeof t=="object"&&!Array.isArray(t)){const s={};for(const[l,c]of Object.entries(t))(c==="shown"||c==="hidden")&&(s[l]=c);return s}}catch{}return{}}function ce(){const[a,t]=r.useState(()=>te()),[s,l]=r.useState(()=>oe());r.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(h,JSON.stringify(a))}catch{}},[a]),r.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(y,JSON.stringify(s))}catch{}},[s]);const c=r.useCallback(n=>{t(n)},[]),k=r.useCallback((n,i)=>{l(o=>{if(i==="default"){if(!(n in o))return o;const v={...o};return delete v[n],v}return o[n]===i?o:{...o,[n]:i}})},[]),p=r.useCallback((n,i)=>{const o=s[n];return o==="shown"?!0:o==="hidden"?!1:i?a:!0},[a,s]),u=r.useCallback(()=>{if(typeof window<"u")try{window.localStorage.removeItem(h),window.localStorage.removeItem(y)}catch{}t(d),l({})},[]);return{betaEnabled:a,tabOverrides:s,setBetaEnabled:c,setTabVisibility:k,isTabVisible:p,reset:u}}const g="bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300 text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider font-semibold";function ie({className:a}){const t=a?`${g} ${a}`:g;return f.jsx("span",{className:t,children:"BETA"})}const le=[{id:"overview",label:"Overview",icon:W},{id:"sessions",label:"Sessions",icon:x},{id:"agents",label:"Agents",icon:G,isBeta:!0},{id:"playback",label:"Playback",icon:Y,isBeta:!0},{id:"contextreplay",label:"Context Replay",icon:M,isBeta:!0},{id:"cost",label:"Cost",icon:$},{id:"budgets",label:"Budgets",icon:ae,isBeta:!0},{id:"compare",label:"Compare",icon:P},{id:"yield",label:"Yield",icon:D,isBeta:!0},{id:"forks",label:"Forks",icon:O,isBeta:!0},{id:"health",label:"Health",icon:m,isBeta:!0},{id:"worktrees",label:"Worktrees",icon:N,isBeta:!0},{id:"devices",label:"Devices",icon:I,isBeta:!0},{id:"commands",label:"Commands",icon:Z},{id:"messages",label:"Messages",icon:U},{id:"search",label:"Search",icon:b},{id:"qa",label:"Q&A",icon:j,isBeta:!0},{id:"bookmarks",label:"Bookmarks",icon:E},{id:"tags",label:"Tags",icon:z,isBeta:!0}];export{ie as B,d as D,re as I,le as T,h as a,$ as b,Z as c,U as d,m as e,E as f,z as g,I as h,G as i,j,Y as k,ae as l,P as m,D as n,O as o,N as p,ce as u}; diff --git a/stackunderflow/static/react/assets/index-DQluCO2S.js b/stackunderflow/static/react/assets/index-0LeeVNek.js similarity index 98% rename from stackunderflow/static/react/assets/index-DQluCO2S.js rename to stackunderflow/static/react/assets/index-0LeeVNek.js index f4996c4..e36f74c 100644 --- a/stackunderflow/static/react/assets/index-DQluCO2S.js +++ b/stackunderflow/static/react/assets/index-0LeeVNek.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-Be0CkqQs.js","assets/react-vendor-B7v2HPaI.js","assets/syntax-highlighter-BYF-y4SB.js","assets/markdown-DgJRk3H5.js","assets/Overview-BqyHxuZ_.js","assets/EmptyState-o0gibvhZ.js","assets/ProviderChip-baymKnS_.js","assets/format-Co_unrac.js","assets/FilterBar-BS6lhcC1.js","assets/IconArrowUp-D8NJ3QQF.js","assets/ProjectDashboard-DAsn11K-.js","assets/dashboardTabs-C5ecR5YO.js","assets/Live-BX6jEGZn.js","assets/IconBolt-CWu2Wz0a.js","assets/IconClockHour4-BUN27e3Z.js","assets/IconActivity-Bf5MQINx.js","assets/Settings-BSujxVUW.js","assets/IconAlertCircle-h2zR9MWj.js","assets/IconArrowRight-lOOgkPXu.js","assets/IconCircleX-D7ABaoUn.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-Be0CkqQs.js","assets/react-vendor-B7v2HPaI.js","assets/syntax-highlighter-BYF-y4SB.js","assets/markdown-DgJRk3H5.js","assets/Overview-D7DJD716.js","assets/EmptyState-o0gibvhZ.js","assets/ProviderChip-Bd3LCPUs.js","assets/format-Co_unrac.js","assets/FilterBar-CML9sBEu.js","assets/IconArrowUp-CqAnfuIE.js","assets/ProjectDashboard-CixMPUyA.js","assets/dashboardTabs-BuoED77E.js","assets/Live-TQJbKokL.js","assets/IconBolt-DgchZkn1.js","assets/IconClockHour4-B94dRT7a.js","assets/IconActivity-CtliCKZa.js","assets/Settings-D4OLuWdJ.js","assets/IconAlertCircle-DmtLevj2.js","assets/IconArrowRight-CEBy4AKU.js","assets/IconCircleX-CZ-PNBqE.js"])))=>i.map(i=>d[i]); var Ae=Object.defineProperty;var Oe=(e,t,a)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var ee=(e,t,a)=>Oe(e,typeof t!="symbol"?t+"":t,a);import{r as o,j as r,u as le,a as De,b as Se,L as D,_ as U,d as Ue,e as ze,B as Fe,f as Be,h as F,Q as Je,i as Ge,R as Qe,k as We}from"./react-vendor-B7v2HPaI.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function a(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=a(n);fetch(n.href,i)}})();/** * @license @tabler/icons-react v3.36.1 - MIT * @@ -102,4 +102,4 @@ var Ae=Object.defineProperty;var Oe=(e,t,a)=>t in e?Ae(e,t,{enumerable:!0,config */const St=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],Nt=S("outline","trash","Trash",St),x="/api";async function y(e,t){const a=await fetch(e,t);if(!a.ok){const s=await a.text().catch(()=>"");throw new Error(`${a.status} ${a.statusText}${s?`: ${s}`:""}`)}return a.json()}function T(e,t){if(t!=null&&t.providers)for(const a of t.providers)a&&a.trim()&&e.append("provider",a.toLowerCase().trim());if(t!=null&&t.models)for(const a of t.models)a&&a.trim()&&e.append("model",a.toLowerCase().trim());return e}async function $t(e=!1,t,a){const s=new URLSearchParams({include_stats:String(e)});return typeof(a==null?void 0:a.limit)=="number"&&s.set("limit",String(a.limit)),typeof(a==null?void 0:a.offset)=="number"&&s.set("offset",String(a.offset)),T(s,t),y(`${x}/projects?${s}`)}async function Fr(){return y(`${x}/providers`)}async function Br(e){return y(`${x}/project-by-dir`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir_name:e})})}async function Jr(e=0,t){const a=new URLSearchParams({timezone_offset:String(e)});return T(a,t),y(`${x}/dashboard-data?${a}`)}async function Gr(e,t){const a=new URLSearchParams;typeof(e==null?void 0:e.page)=="number"&&a.set("page",String(e.page)),a.set("per_page",String(e.perPage)),T(a,t);const s=a.toString();return y(`${x}/messages${s?`?${s}`:""}`)}async function Qr(e,t){const a=new URLSearchParams;e&&a.set("project",e),T(a,t);const s=a.toString();return y(`${x}/jsonl-files${s?`?${s}`:""}`)}async function Wr(e,t){const a=new URLSearchParams({file:e});return t&&a.set("project",t),y(`${x}/jsonl-content?${a}`)}async function qr(e){const t=new URLSearchParams;return e.project&&t.set("project",e.project),e.date_from&&t.set("date_from",e.date_from),e.date_to&&t.set("date_to",e.date_to),e.search&&t.set("search",e.search),e.resolution_status&&t.set("resolution_status",e.resolution_status),e.page&&t.set("page",String(e.page)),t.set("per_page",String(e.per_page)),y(`${x}/qa?${t}`)}async function Kr(e){const t=new URLSearchParams;return t.set("q",e.q),e.project&&t.set("project",e.project),e.date_from&&t.set("date_from",e.date_from),e.date_to&&t.set("date_to",e.date_to),e.model&&t.set("model",e.model),e.role&&t.set("role",e.role),e.page&&t.set("page",String(e.page)),t.set("per_page",String(e.per_page)),y(`${x}/search?${t}`)}async function Hr(){return y(`${x}/tags`)}async function Vr(e){return y(`${x}/tags/browse/${encodeURIComponent(e)}`)}async function Yr(e,t="created_at"){const a=new URLSearchParams({sort_by:t});return e&&a.set("tag",e),y(`${x}/bookmarks?${a}`)}async function Xr(e){return y(`${x}/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Zr(e,t){return y(`${x}/bookmarks/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function ea(e=0){return y(`${x}/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timezone_offset:e})})}async function ta(){return y(`${x}/global-stats`)}async function ra(e){const a=new URLSearchParams().toString();return y(`${x}/commands/daily${a?`?${a}`:""}`)}function aa(e,t){const a=new URLSearchParams;for(const n of e)n&&n.trim()&&a.append("model",n.toLowerCase().trim());(t==="7d"||t==="30d")&&a.set("range",t);const s=a.toString();return s?`?${s}`:""}async function sa(){return y(`${x}/search/reindex`,{method:"POST"})}async function na(){return y(`${x}/qa/reindex`,{method:"POST"})}async function oa(){return y(`${x}/tags/reindex`,{method:"POST"})}async function ia(){return y(`${x}/pricing`)}async function _t(){return y(`${x}/cfg`)}async function la(){return y(`${x}/cfg/currencies`)}async function Ct(e){return y(`${x}/cfg/currency`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})})}async function ca(){return y(`${x}/cfg/model-aliases`)}async function da(e,t){return y(`${x}/cfg/model-aliases`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:e,to:t})})}async function ua(e){return y(`${x}/cfg/model-aliases?from=${encodeURIComponent(e)}`,{method:"DELETE"})}async function ga(e="month",t){const a=new URLSearchParams({period:e});if(t!=null&&t.providers&&t.providers.length===1){const s=t.providers[0];s&&a.set("provider",s.toLowerCase())}return y(`${x}/compare?${a}`)}async function ma(e="month",t){const a=new URLSearchParams({period:e});return T(a,t),y(`${x}/cost-data/by-provider?${a}`)}async function ha(e="week",t){const a=new URLSearchParams({period:e});return T(a,t),y(`${x}/yield?${a}`)}async function xa(e="all"){const t=new URLSearchParams({period:e});return y(`${x}/forks?${t}`)}async function fa(e="all"){const t=new URLSearchParams({period:e});return y(`${x}/benchmark?${t}`)}async function pa(){return y(`${x}/plan`)}function ue(){return-new Date().getTimezoneOffset()}async function ya(){const e=new URLSearchParams({timezone_offset:String(ue())});return y(`${x}/budgets?${e}`)}async function ba(e){const t=new URLSearchParams({timezone_offset:String(ue())});return y(`${x}/budgets?${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function ka(){const e=new URLSearchParams({timezone_offset:String(ue())});return y(`${x}/budgets?${e}`,{method:"DELETE"})}async function wa(){return y(`${x}/whatif`)}async function va(e="month",t){const a=new URLSearchParams({period:e});return T(a,t),y(`${x}/optimize?${a}`)}async function ja(){return y(`${x}/context-budget`)}class G extends Error{constructor(t="ETL pipeline route not available"){super(t),this.name="EtlPipelineNotReadyError"}}class Et extends Error{constructor(a){super(`A backfill is already running (job ${a.slice(0,8)}…)`);ee(this,"jobId");this.name="EtlBackfillInProgressError",this.jobId=a}}async function Lt(){const e=await fetch(`${x}/etl/status`);if(e.status===404)throw new G;if(!e.ok){const t=await e.text().catch(()=>"");throw new Error(`${e.status} ${e.statusText}${t?`: ${t}`:""}`)}return e.json()}async function Sa(e=!1){const t=await fetch(`${x}/etl/backfill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:e})});if(t.status===404)throw new G("Backfill route not available — run `stackunderflow etl backfill` from the CLI instead.");if(t.status===409){let a="unknown";try{const s=await t.json();typeof(s==null?void 0:s.job_id)=="string"&&s.job_id.length>0&&(a=s.job_id)}catch{}throw new Et(a)}if(!t.ok){const a=await t.text().catch(()=>"");throw new Error(`${t.status} ${t.statusText}${a?`: ${a}`:""}`)}return t.json()}function oe(e){if(e==null||!Number.isFinite(e)||e<0)return"—";const t=Math.floor(e);if(t<60)return`${t}s`;const a=Math.floor(t/60);if(a<60)return`${a}m`;const s=Math.floor(a/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Tt(e){switch(e){case"live":return{badge:"green",dot:"bg-green-500",pulse:!1};case"syncing":return{badge:"blue",dot:"bg-blue-500",pulse:!0};case"stale":return{badge:"yellow",dot:"bg-yellow-500",pulse:!1};case"error":return{badge:"red",dot:"bg-red-500",pulse:!1}}}function Pt(e){const{health:t,lag_seconds:a,watcher:s,events:n,last_job:i}=e;switch(t){case"live":return`Live (synced ${oe(s.seconds_since_refresh??a)} ago)`;case"syncing":{const l=s.events_in_last_cycle;return`Syncing (${l} event${l===1?"":"s"} behind)`}case"stale":return`Stale by ${oe(a)}`;case"error":return(i==null?void 0:i.status)==="failed"?`Backfill failed (job ${i.job_id.slice(0,8)}…)`:"ETL error — see /etl/status"}return`Unknown (${n.total} events)`}async function Na(e=50,t){const a=new URLSearchParams({limit:String(e)});return t&&a.set("project",t),y(`${x}/agent-teams?${a.toString()}`)}async function $a(e){return y(`${x}/agent-teams/${encodeURIComponent(e)}`)}function _a(e){const t=new URLSearchParams(e),a=t.get("session"),s=t.get("agent");return{session:a&&a.length>0?a:null,agent:s&&s.length>0?s:null}}function Ca(e,t){const a=new URLSearchParams(e);t.session?a.set("session",t.session):a.delete("session"),t.agent?a.set("agent",t.agent):a.delete("agent");const s=a.toString();return s.length>0?`?${s}`:""}function Rt(e){const t=new URLSearchParams;return e!=null&&e.toolFilter&&e.toolFilter.length>0&&t.set("tool_filter",e.toolFilter.join(",")),typeof(e==null?void 0:e.limit)=="number"&&t.set("limit",String(e.limit)),t.set("include_payload","1"),t}async function Ea(e,t){const a=Rt(t).toString();return y(`${x}/playback/${encodeURIComponent(e)}${a?`?${a}`:""}`)}class Mt extends Error{constructor(t){super(`Unparseable timestamp: ${t}`),this.name="PlaybackFsBadTimestampError"}}async function La(e,t){const a=new URLSearchParams({at:t.at});t.paths&&t.paths.length>0&&a.set("paths",t.paths.join(",")),typeof t.includeContent=="boolean"&&a.set("include_content",t.includeContent?"true":"false");const s=await fetch(`${x}/playback/${encodeURIComponent(e)}/fs?${a.toString()}`);if(s.status===422){const n=await s.text().catch(()=>"");throw new Mt(n||t.at)}if(!s.ok){const n=await s.text().catch(()=>"");throw new Error(`${s.status} ${s.statusText}${n?`: ${n}`:""}`)}return s.json()}async function Ta(e,t){const s=new URLSearchParams().toString();return y(`${x}/context-replay/${encodeURIComponent(e)}${s?`?${s}`:""}`)}function It(e){if(e===null||e.trim()==="")return null;const t=Number(e);return!Number.isInteger(t)||t<0?null:t}function Pa(e){const t=new URLSearchParams(e),a=t.get("session");return{session:a&&a.length>0?a:null,seq:It(t.get("seq"))}}async function Ra(e,t="30days"){const a=new URLSearchParams({period:t});return y(`${x}/optimize/prescriptions?${a}`)}const $e="su-name-mode";function _e(){const e=localStorage.getItem($e);return e==="name"||e==="path"||e==="anon"?e:"name"}function Ma(e){localStorage.setItem($e,e),window.dispatchEvent(new Event("namemode-changed"))}function J(e,t,a){const s=a??_e();if(s==="anon")return`Project ${(t??0)+1}`;if(s==="path")return e.startsWith("-")?"/"+e.slice(1).replace(/-/g,"/"):e.replace(/-/g,"/");const i=(e.startsWith("-")?e.slice(1):e).split("-");let l=-1;for(let m=i.length-1;m>=0;m--)if(/^(year|dev|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{0,2}$/i.test(i[m]??"")){l=m;break}return l>=0&&lxe());o.useEffect(()=>{Bt(t)},[t]),o.useEffect(()=>{if(!Gt())return;const d=()=>{const c=xe();a(g=>g.providers.length===c.providers.length&&g.providers.every((u,k)=>u===c.providers[k])&&g.models.length===c.models.length&&g.models.every((u,k)=>u===c.models[k])?g:c)};return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[]);const s=o.useCallback(d=>{a(c=>{const g=q(d);return c.providers.length===g.length&&c.providers.every((u,k)=>u===g[k])?c:{...c,providers:g}})},[]),n=o.useCallback(d=>{a(c=>{const g=q(d);return c.models.length===g.length&&c.models.every((u,k)=>u===g[k])?c:{...c,models:g}})},[]),i=o.useCallback(d=>{const c=d.toLowerCase().trim();c&&a(g=>g.providers.includes(c)?g:{...g,providers:[...g.providers,c]})},[]),l=o.useCallback(d=>{const c=d.toLowerCase().trim();c&&a(g=>g.models.includes(c)?g:{...g,models:[...g.models,c]})},[]),m=o.useCallback(d=>{const c=d.toLowerCase().trim();a(g=>g.providers.includes(c)?{...g,providers:g.providers.filter(u=>u!==c)}:g)},[]),h=o.useCallback(d=>{const c=d.toLowerCase().trim();a(g=>g.models.includes(c)?{...g,models:g.models.filter(u=>u!==c)}:g)},[]),p=o.useCallback(()=>{a(d=>d.providers.length===0&&d.models.length===0?d:{providers:[],models:[]})},[]),b=o.useMemo(()=>({filters:t,setProviders:s,setModels:n,addProvider:i,addModel:l,removeProvider:m,removeModel:h,clearFilters:p,isFiltered:t.providers.length>0||t.models.length>0,queryString:Jt(t)}),[t,s,n,i,l,m,h,p]);return r.jsx(Ee.Provider,{value:b,children:e})}function Wt(){const e=o.useContext(Ee);if(!e)throw new Error("useFilters() must be used inside a ");return e}const Le="suf:theme",fe="dark";function qt(){if(typeof window>"u")return fe;try{const e=window.localStorage.getItem(Le);if(e==="light"||e==="dark")return e}catch{}return fe}function Kt(e){if(typeof document>"u")return;const t=document.documentElement;e==="dark"?t.classList.add("dark"):t.classList.remove("dark")}function Ht(){const[e,t]=o.useState(()=>qt());o.useEffect(()=>{if(Kt(e),!(typeof window>"u"))try{window.localStorage.setItem(Le,e)}catch{}},[e]);const a=o.useCallback(n=>{t(n)},[]),s=o.useCallback(()=>{t(n=>n==="dark"?"light":"dark")},[]);return{theme:e,toggle:s,setTheme:a}}function Vt({className:e}){const{theme:t,toggle:a}=Ht(),s=t==="dark"?"light":"dark",n=t==="dark"?wt:nt,i=`Switch to ${s} mode`,l="inline-flex items-center justify-center rounded-md p-1.5 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 transition-colors",m=e?`${l} ${e}`:l;return r.jsx("button",{type:"button",onClick:a,className:m,"aria-label":i,title:i,children:r.jsx(n,{size:18,stroke:1.75,"aria-hidden":"true"})})}const Yt=1e4,Xt=2e3,Zt=5e3;function er(){const[e,t]=o.useState(!1),a=o.useRef(null),s=o.useRef(null),[n,i]=o.useState(null),{data:l,error:m,isLoading:h}=le({queryKey:["etl-status"],queryFn:Lt,refetchInterval:c=>{var u;const g=c.state.data;return((u=g==null?void 0:g.current_job)==null?void 0:u.status)==="running"?Xt:Yt},staleTime:Zt,retry:(c,g)=>g instanceof G?!1:c<2});if(o.useEffect(()=>{var u;if(!l)return;const c=s.current,g=((u=l.last_job)==null?void 0:u.status)==="failed";if(c&&c!=="live"&&l.health==="live"&&!g){i("ETL caught up");const k=window.setTimeout(()=>i(null),3500);return()=>window.clearTimeout(k)}s.current=l.health},[l]),o.useEffect(()=>{if(!e)return;function c(g){a.current&&!a.current.contains(g.target)&&t(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e]),m instanceof G)return r.jsxs("div",{className:"hidden md:inline-flex items-center gap-1.5 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 bg-gray-100/60 dark:bg-gray-800/40 text-gray-500 dark:text-gray-500",title:"The ETL status route is not available on this build.","aria-label":"ETL pipeline not ready",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-gray-400 dark:bg-gray-600","aria-hidden":"true"}),r.jsx("span",{className:"hidden lg:inline",children:"ETL pipeline not ready"})]});if(m)return r.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 text-[11px] rounded border border-red-300 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400",title:`Failed to fetch ETL status: ${m instanceof Error?m.message:String(m)}`,"aria-label":"ETL status fetch failed",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-500","aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:"ETL fetch failed"})]});if(h||!l)return r.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 text-[11px] rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-500","aria-label":"Loading ETL status",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-gray-400 dark:bg-gray-600 animate-pulse","aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:"ETL…"})]});const p=Tt(l.health),b=Pt(l),d={green:"border-green-300 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-900/30 dark:text-green-300",blue:"border-blue-300 bg-blue-50 text-blue-800 dark:border-blue-800 dark:bg-blue-900/30 dark:text-blue-300",yellow:"border-yellow-300 bg-yellow-50 text-yellow-800 dark:border-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",red:"border-red-300 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400"};return r.jsxs("div",{className:"relative",ref:a,children:[r.jsxs("button",{type:"button",onClick:()=>t(c=>!c),className:`inline-flex items-center gap-1.5 px-2 py-1 text-[11px] rounded border transition-colors ${d[p.badge]}`,title:b,"aria-label":b,"aria-expanded":e,children:[r.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${p.dot} ${p.pulse?"animate-pulse":""}`,"aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline whitespace-nowrap",children:b})]}),e&&r.jsx(tr,{data:l}),n&&r.jsx("div",{role:"status",className:"absolute right-0 top-full mt-2 z-50 px-3 py-1.5 rounded border border-green-300 dark:border-green-800 bg-green-50 dark:bg-green-900/40 text-[11px] text-green-800 dark:text-green-300 shadow-lg whitespace-nowrap",children:n})]})}function tr({data:e}){const{watcher:t,marts:a,events:s,lag_seconds:n,health:i}=e,l=Object.entries(a).sort(([h],[p])=>h.localeCompare(p)),m=Object.entries(s.by_provider).sort(([,h],[,p])=>p-h);return r.jsxs("div",{className:"absolute right-0 top-full mt-2 w-80 z-50 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-lg shadow-xl text-xs",role:"dialog","aria-label":"ETL pipeline status",children:[r.jsxs("div",{className:"px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-200",children:"ETL pipeline"}),r.jsx("span",{className:"font-mono uppercase tracking-wide text-[10px] text-gray-500",children:i})]}),r.jsxs("div",{className:"text-[11px] text-gray-500 mt-0.5",children:["Lag ",oe(n)," · ",s.total.toLocaleString()," events total"]})]}),r.jsxs("div",{className:"px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Watcher"}),r.jsx("span",{className:"font-mono text-gray-800 dark:text-gray-200",children:t.enabled?t.running?"running":"enabled · idle":"disabled"})]}),r.jsxs("div",{className:"flex items-center justify-between mt-1",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Last refresh"}),r.jsx("span",{className:"font-mono text-gray-800 dark:text-gray-200",children:t.last_refresh_ts??"never"})]}),r.jsxs("div",{className:"flex items-center justify-between mt-1",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Last cycle"}),r.jsx("span",{className:"font-mono text-gray-800 dark:text-gray-200",children:t.events_in_last_cycle!=null?r.jsxs(r.Fragment,{children:[t.events_in_last_cycle.toLocaleString()," event",t.events_in_last_cycle===1?"":"s"]}):"unknown"})]})]}),r.jsxs("div",{className:"px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsx("div",{className:"text-gray-600 dark:text-gray-400 mb-1.5",children:"Marts"}),l.length===0?r.jsx("div",{className:"text-gray-500 italic",children:"No marts registered."}):r.jsx("ul",{className:"space-y-1",children:l.map(([h,p])=>{const b=s.max_id-p.watermark;return r.jsxs("li",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-300",children:h}),r.jsxs("span",{className:"font-mono text-[10px] text-gray-500 tabular-nums",children:["wm ",p.watermark.toLocaleString()," / ",s.max_id.toLocaleString(),b>0?` (-${b.toLocaleString()})`:""," · ",p.row_count.toLocaleString()," rows"]})]},h)})})]}),r.jsxs("div",{className:"px-3 py-2",children:[r.jsx("div",{className:"text-gray-600 dark:text-gray-400 mb-1.5",children:"Events by provider"}),m.length===0?r.jsx("div",{className:"text-gray-500 italic",children:"No events ingested yet."}):r.jsx("ul",{className:"space-y-1",children:m.map(([h,p])=>r.jsxs("li",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-300",children:h}),r.jsx("span",{className:"font-mono text-[10px] text-gray-500 tabular-nums",children:p.toLocaleString()})]},h))})]})]})}const ie="stackunderflow.project_group_by_provider";function rr(){return typeof localStorage>"u"?!1:localStorage.getItem(ie)==="1"}function ar(e){typeof localStorage>"u"||(e?localStorage.setItem(ie,"1"):localStorage.removeItem(ie))}function sr({onToggleChat:e,chatOpen:t}){const a=De(),s=Se(),{addProvider:n}=Wt(),{data:i}=le({queryKey:["projects",!1],queryFn:()=>$t(!1),staleTime:6e4}),l=(i==null?void 0:i.projects)??[],[m,h]=o.useState(!1),[p,b]=o.useState(""),[d,c]=o.useState(""),[g,u]=o.useState(()=>rr()),[k,$]=o.useState(new Set),[,v]=o.useState(0),N=o.useRef(null),K=()=>{u(f=>{const j=!f;return ar(j),j})},A=f=>{$(j=>{const _=new Set(j);return _.has(f)?_.delete(f):_.add(f),_})},P=s.pathname.match(/^\/project\/(.+?)(?:\/|$)/),C=P?decodeURIComponent(P[1]):null;o.useEffect(()=>{function f(j){N.current&&!N.current.contains(j.target)&&h(!1)}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),o.useEffect(()=>{const f=()=>v(j=>j+1);return window.addEventListener("namemode-changed",f),()=>window.removeEventListener("namemode-changed",f)},[]);const H=f=>{h(!1),a(`/project/${encodeURIComponent(f)}`)},V=f=>{f.preventDefault(),p.trim()&&C&&a(`/project/${encodeURIComponent(C)}?tab=search&q=${encodeURIComponent(p.trim())}`)},z=_e(),Y=C?J(C,void 0,z):null;return r.jsxs("header",{className:"h-12 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 flex items-center px-4 gap-4 shrink-0",children:[r.jsxs(D,{to:"/",className:"flex items-center gap-2 text-indigo-400 hover:text-indigo-300 shrink-0",children:[r.jsx(bt,{size:22}),r.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"StackUnderflow"})]}),r.jsxs("div",{className:"relative",ref:N,children:[r.jsxs("button",{onClick:()=>h(!m),className:"flex items-center gap-1.5 text-sm text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100 bg-white dark:bg-gray-800 rounded px-2.5 py-1 max-w-[240px]",children:[r.jsx("span",{className:"truncate",children:Y??"Select project"}),r.jsx(ce,{size:14,className:"shrink-0"})]}),m&&r.jsx(nr,{projects:l,currentProject:C,mode:z,projectFilter:d,setProjectFilter:c,groupByProvider:g,toggleGroupMode:K,collapsedGroups:k,toggleGroupCollapsed:A,onSelectProject:f=>{H(f),c("")},onProviderClick:f=>{n(f)}})]}),r.jsxs("nav",{className:"hidden md:flex items-center gap-1 ml-2",children:[r.jsx(D,{to:"/",className:`px-2.5 py-1 rounded text-xs font-medium ${s.pathname==="/"?"bg-white dark:bg-gray-800 text-indigo-400":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100/70 dark:hover:bg-gray-800/50"}`,children:"Overview"}),r.jsx(D,{to:"/live",className:`px-2.5 py-1 rounded text-xs font-medium ${s.pathname==="/live"?"bg-white dark:bg-gray-800 text-indigo-400":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100/70 dark:hover:bg-gray-800/50"}`,children:"Live"}),C&&r.jsx(D,{to:`/project/${encodeURIComponent(C)}`,className:`px-2.5 py-1 rounded text-xs font-medium ${s.pathname.startsWith("/project/")?"bg-white dark:bg-gray-800 text-indigo-400":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100/70 dark:hover:bg-gray-800/50"}`,children:"Dashboard"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("form",{onSubmit:V,className:"hidden sm:flex items-center",children:r.jsxs("div",{className:"relative",children:[r.jsx(mt,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-gray-500"}),r.jsx("input",{type:"text",value:p,onChange:f=>b(f.target.value),placeholder:"Search messages...",className:"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded pl-7 pr-3 py-1 text-xs text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500 w-48"})]})}),r.jsx(er,{}),r.jsx(D,{to:"/settings",className:"p-1.5 rounded text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-800",title:"Settings","aria-label":"Open settings",children:r.jsx(pt,{size:18})}),r.jsx(Vt,{}),r.jsx("button",{onClick:e,className:`p-1.5 rounded ${t?"bg-indigo-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-800"}`,title:"Toggle Ask StackUnderflow",children:r.jsx(ne,{size:18})})]})}function nr({projects:e,currentProject:t,mode:a,projectFilter:s,setProjectFilter:n,groupByProvider:i,toggleGroupMode:l,collapsedGroups:m,toggleGroupCollapsed:h,onSelectProject:p,onProviderClick:b}){const d=s.toLowerCase(),c=d?e.filter(u=>u.dir_name.toLowerCase().includes(d)||(u.display_name||"").toLowerCase().includes(d)||J(u.dir_name,0,a).toLowerCase().includes(d)):e,g=o.useMemo(()=>{const u=new Map;for(const k of c){const $=(k.provider??"").split(",").map(v=>v.trim()).filter(Boolean);if($.length===0){const v="unknown";u.has(v)||u.set(v,[]),u.get(v).push(k)}else for(const v of $){const N=v.toLowerCase();u.has(N)||u.set(N,[]),u.get(N).push(k)}}return Array.from(u.entries()).sort((k,$)=>$[1].length-k[1].length)},[c]);return r.jsxs("div",{className:"absolute top-full left-0 mt-1 w-80 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-lg shadow-xl z-50 flex flex-col max-h-96",children:[r.jsxs("div",{className:"p-2 border-b border-gray-300 dark:border-gray-700 space-y-2",children:[r.jsx("input",{type:"text",value:s,onChange:u=>n(u.target.value),placeholder:"Search projects...",autoFocus:!0,className:"w-full bg-gray-50 dark:bg-gray-900 border border-gray-400 dark:border-gray-600 rounded px-2.5 py-1.5 text-xs text-gray-700 dark:text-gray-300 placeholder-gray-500 focus:outline-none focus:border-indigo-500"}),r.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[r.jsxs("span",{className:"text-gray-500",children:[c.length," project",c.length===1?"":"s"]}),r.jsx("button",{type:"button",onClick:l,className:`px-1.5 py-0.5 rounded border transition-colors ${i?"border-indigo-500 bg-indigo-500/15 text-indigo-700 dark:text-indigo-300":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"}`,title:"Toggle group-by-provider (persists across sessions)",children:i?"∴ Grouped":"· Flat"})]})]}),r.jsx("div",{className:"overflow-y-auto flex-1",children:c.length===0?r.jsx("div",{className:"px-3 py-3 text-xs text-gray-500 text-center",children:"No matches"}):i?g.map(([u,k])=>{const $=m.has(u);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-gray-100/70 dark:bg-gray-900/70 sticky top-0 z-10 border-b border-gray-200 dark:border-gray-800",children:[r.jsxs("button",{type:"button",onClick:()=>h(u),className:"flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100",children:[$?r.jsx(de,{size:12}):r.jsx(ce,{size:12}),r.jsx(Dt,{color:Ft(u),size:"sm",children:he(u)}),r.jsxs("span",{className:"text-gray-500 tabular-nums",children:["(",k.length,")"]})]}),r.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),b(u)},className:"text-[10px] text-indigo-600 dark:text-indigo-400 hover:underline",title:`Filter dashboard to ${he(u)} only`,children:"filter"})]}),!$&&k.map((v,N)=>r.jsxs("button",{onClick:()=>p(v.dir_name),className:`w-full text-left px-3 py-2 text-sm hover:bg-gray-300 dark:hover:bg-gray-700 ${v.dir_name===t?"text-indigo-400 bg-gray-200/50 dark:bg-gray-700/50":"text-gray-700 dark:text-gray-300"}`,children:[r.jsx("div",{className:"truncate",children:J(v.dir_name,N,a)}),r.jsxs("div",{className:"text-xs text-gray-500",children:[v.file_count," files"]})]},`${u}-${v.dir_name}`))]},u)}):c.map((u,k)=>r.jsxs("button",{onClick:()=>p(u.dir_name),className:`w-full text-left px-3 py-2 text-sm hover:bg-gray-300 dark:hover:bg-gray-700 ${u.dir_name===t?"text-indigo-400 bg-gray-200/50 dark:bg-gray-700/50":"text-gray-700 dark:text-gray-300"}`,children:[r.jsx("div",{className:"truncate",children:J(u.dir_name,k,a)}),r.jsxs("div",{className:"text-xs text-gray-500",children:[u.file_count," files"]})]},u.dir_name))})]})}function pe(e){return`/ollama-api${e}`}const or={async chat(e,t,a){var m;const s=await fetch(pe("/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,stream:!0}),signal:a});if(!s.ok){const h=await s.text().catch(()=>"");throw new Error(`Chat failed: ${s.status} ${s.statusText}${h?` - ${h}`:""}`)}const n=(m=s.body)==null?void 0:m.getReader();if(!n)throw new Error("No response body");const i=new TextDecoder;let l="";try{for(;;){const{done:h,value:p}=await n.read();if(h)break;l+=i.decode(p,{stream:!0});const b=l.split(` `);l=b.pop()||"";for(const d of b)if(d.trim())try{const c=JSON.parse(d);t(c)}catch{}}if(l.trim())try{const h=JSON.parse(l);t(h)}catch{}}finally{n.releaseLock()}},async listModels(){try{const e=await fetch(pe("/tags"));return e.ok?(await e.json()).models||[]:[]}catch{return[]}}},ye="/api/meta-agent",ir={async chat(e,t,a){var m;const s=await fetch(`${ye}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:a});if(!s.ok){const h=await s.text().catch(()=>"");throw new Error(`Meta-agent chat failed: ${s.status} ${s.statusText}${h?` - ${h}`:""}`)}const n=(m=s.body)==null?void 0:m.getReader();if(!n)throw new Error("No response body");const i=new TextDecoder;let l="";try{for(;;){const{done:h,value:p}=await n.read();if(h)break;l+=i.decode(p,{stream:!0});const b=l.split(` `);l=b.pop()||"";for(const d of b)if(d.trim())try{const c=JSON.parse(d);t(c)}catch{}}if(l.trim())try{const h=JSON.parse(l);t(h)}catch{}}finally{n.releaseLock()}},async listTools(){try{const e=await fetch(`${ye}/tools`);return e.ok?await e.json():null}catch{return null}}},lr=["qwen2.5-coder","qwen2.5","llama3.2","llama3.1","firefunction","command-r","mistral-nemo","mistral-large","mixtral","deepseek"];function cr(e){if(!e)return!1;const t=e.toLowerCase();return lr.some(a=>t.includes(a))}function dr(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${(e/(1024*1024)).toFixed(0)} MB`}function ur({models:e,currentModel:t,onSelectModel:a,onRefresh:s}){return r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800",children:[r.jsx("label",{className:"text-xs text-gray-500 shrink-0",children:"Model:"}),r.jsxs("select",{value:t,onChange:n=>a(n.target.value),className:"flex-1 bg-white dark:bg-gray-800 text-sm text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500 min-w-0",children:[e.length===0&&r.jsx("option",{value:"",children:"No models available"}),e.map(n=>r.jsxs("option",{value:n.name,children:[n.name," (",dr(n.size),")"]},n.name))]}),r.jsx("button",{onClick:s,className:"p-1 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",title:"Refresh model list",children:r.jsx(ut,{size:16})})]})}const be=4096;function ke(e){try{const t=JSON.stringify(e,null,2);return t.length<=be?t:t.slice(0,be)+` -... [truncated for display]`}catch{return String(e)}}function gr(e){return e.result?e.result.ok?`ok · ${e.result.duration_ms}ms`:`error · ${e.result.duration_ms}ms`:"running…"}function mr(e){if(!e.result)return"";const t=e.result.data;if(!t||typeof t!="object")return"";const a=t;return typeof a.count=="number"?`${a.count} matches`:typeof a.file_count=="number"?`${a.file_count} files touched`:typeof a.total_cost_usd=="number"?`$${a.total_cost_usd.toFixed(2)} total`:typeof a.sessions=="number"&&typeof a.cost_usd=="number"?`${a.sessions} sessions · $${a.cost_usd.toFixed(2)}`:typeof a.error=="string"?a.error:""}function hr({invocation:e}){var m;const[t,a]=o.useState(!1),s=gr(e),n=mr(e),i=(m=e.result)==null?void 0:m.ok,l=!e.result;return r.jsxs("div",{"data-testid":"meta-tool-call","data-tool-name":e.name,"data-tool-status":l?"running":i?"ok":"error",className:"my-2 border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>a(h=>!h),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-gray-800/50 rounded-lg",children:[t?r.jsx(ce,{size:12,className:"text-gray-500 shrink-0"}):r.jsx(de,{size:12,className:"text-gray-500 shrink-0"}),r.jsxs("span",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 rounded inline-flex items-center gap-1 shrink-0",children:[r.jsx(jt,{size:10}),"tool"]}),r.jsx("span",{className:"font-mono text-gray-800 dark:text-gray-200 truncate",children:e.name}),r.jsx("span",{className:"flex-1"}),n&&r.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate hidden sm:inline",children:n}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-500 dark:text-gray-400 shrink-0",children:[l&&r.jsx(rt,{size:12,className:"animate-spin"}),!l&&i&&r.jsx(et,{size:12,className:"text-emerald-500"}),!l&&!i&&r.jsx(Ne,{size:12,className:"text-amber-500"}),s]})]}),t&&r.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 border-t border-gray-200 dark:border-gray-800",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"args"}),r.jsx("pre",{"data-testid":"meta-tool-args",className:"bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 rounded p-2 overflow-auto text-[11px] text-gray-700 dark:text-gray-300 max-h-48",children:ke(e.args)})]}),e.result&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"result"}),r.jsx("pre",{"data-testid":"meta-tool-result",className:"bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 rounded p-2 overflow-auto text-[11px] text-gray-700 dark:text-gray-300 max-h-64",children:ke(e.result.data)})]})]})]})}const xr=o.lazy(()=>U(()=>import("./Markdown-Be0CkqQs.js"),__vite__mapDeps([0,1,2,3])));function we(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function fr({messages:e}){const t=o.useRef(null);return o.useEffect(()=>{var a;(a=t.current)==null||a.scrollIntoView({behavior:"smooth"})},[e]),e.length===0?r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"text-center text-gray-500",children:[r.jsx("p",{className:"text-sm",children:"Ask about your sessions, costs, or projects."}),r.jsx("p",{className:"text-xs mt-1 leading-relaxed",children:"The meta agent reads from your local StackUnderflow store — nothing leaves the machine."})]})}):r.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[e.map(a=>r.jsx(pr,{message:a},a.id)),r.jsx("div",{ref:t})]})}function pr({message:e}){return e.role==="user"?r.jsx("div",{className:"flex justify-end mb-3",children:r.jsxs("div",{className:"max-w-[85%] rounded-lg px-3 py-2 bg-blue-600 text-white",children:[r.jsx("div",{className:"text-sm break-words",children:r.jsx("p",{className:"whitespace-pre-wrap",children:e.content})}),r.jsx("div",{className:"text-[10px] mt-1 text-blue-200",children:we(e.timestamp)})]})}):r.jsx("div",{className:"flex justify-start mb-3",children:r.jsxs("div",{className:"max-w-[95%] w-full",children:[e.toolCalls&&e.toolCalls.length>0&&r.jsx("div",{"data-testid":"meta-tool-calls",className:"mb-1",children:e.toolCalls.map(a=>r.jsx(hr,{invocation:a},a.id))}),(e.content||e.error)&&r.jsxs("div",{className:"rounded-lg px-3 py-2 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200",children:[r.jsxs("div",{className:"text-sm break-words",children:[e.content&&r.jsx(o.Suspense,{fallback:r.jsx("p",{className:"whitespace-pre-wrap",children:e.content}),children:r.jsx(xr,{content:e.content})}),e.error&&r.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["Error: ",e.error]})]}),r.jsx("div",{className:"text-[10px] mt-1 text-gray-500",children:we(e.timestamp)})]})]})})}function yr({onSend:e,isGenerating:t,onStop:a,disabled:s}){const[n,i]=o.useState(""),l=o.useRef(null),m=o.useCallback(()=>{const b=n.trim();!b||s||(e(b),i(""),l.current&&(l.current.style.height="auto"))},[n,s,e]),h=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),m())},p=b=>{i(b.target.value);const d=b.target;d.style.height="auto",d.style.height=`${Math.min(d.scrollHeight,120)}px`};return r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 p-2",children:r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("textarea",{ref:l,value:n,onChange:p,onKeyDown:h,placeholder:s?"Select a model to start chatting...":"Ask a question...",disabled:s||t,rows:1,className:"flex-1 bg-white dark:bg-gray-800 text-sm text-gray-800 dark:text-gray-200 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 resize-none focus:outline-none focus:border-blue-500 placeholder-gray-500 dark:placeholder-gray-600 disabled:opacity-50"}),t?r.jsx("button",{onClick:a,className:"p-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors shrink-0",title:"Stop generating",children:r.jsx(it,{size:18})}):r.jsx("button",{onClick:m,disabled:s||!n.trim(),className:"p-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-700 disabled:text-gray-500 text-white rounded-lg transition-colors shrink-0",title:"Send message",children:r.jsx(xt,{size:18})})]})})}function br(e){return new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function kr({sessions:e,currentSessionId:t,onSwitch:a,onNew:s,onDelete:n}){return r.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-800",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Sessions"}),r.jsx("button",{onClick:s,className:"p-0.5 text-gray-500 hover:text-blue-400 transition-colors",title:"New chat session",children:r.jsx(ct,{size:14})})]}),e.length>0&&r.jsx("div",{className:"max-h-24 overflow-auto px-1 pb-1 space-y-0.5",children:e.map(i=>r.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded text-xs cursor-pointer group ${i.id===t?"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200":"text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300"}`,onClick:()=>a(i.id),children:[r.jsx("span",{className:"flex-1 truncate",children:i.contextLabel}),r.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400 shrink-0",children:br(i.updatedAt)}),r.jsx("button",{onClick:l=>{l.stopPropagation(),n(i.id)},className:"p-0.5 text-gray-600 dark:text-gray-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-all shrink-0",title:"Delete session",children:r.jsx(Nt,{size:12})})]},i.id))})]})}const Te="stackunderflow_metaAgentSessions";function te(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function wr(){try{const e=localStorage.getItem(Te);return e?JSON.parse(e).map(a=>({...a,createdAt:new Date(a.createdAt),updatedAt:new Date(a.updatedAt),messages:a.messages.map(s=>({...s,timestamp:new Date(s.timestamp)}))})):[]}catch{return[]}}function vr(e){try{localStorage.setItem(Te,JSON.stringify(e))}catch{}}function jr(e,t,a){if(e){const s=e.question_text.substring(0,40);return s.lengthf.id===i)||null,K=(N==null?void 0:N.messages)||[],A=o.useCallback(async()=>{try{const f=await or.listModels();u(f),$(!0),f.length>0&&!d&&f[0]&&c(f[0].name)}catch{$(!0)}},[d]);o.useEffect(()=>{if(!k){const f=setTimeout(A,1e3);return()=>clearTimeout(f)}},[k,A]),o.useEffect(()=>{vr(s)},[s]);const P=o.useCallback(()=>{const f=jr(e,t,a),j={id:te(),contextLabel:f,createdAt:new Date,updatedAt:new Date,messages:[],projectSlug:a};return n(_=>[j,..._]),l(j.id),j.id},[e,t,a]),C=o.useCallback(async f=>{if(!d){b("No model selected");return}b(null);let j=i;j||(j=P());const _={id:te(),role:"user",content:f,timestamp:new Date},ge=te(),Me={id:ge,role:"assistant",content:"",timestamp:new Date,toolCalls:[]};n(w=>w.map(R=>R.id===j?{...R,messages:[...R.messages,_,Me],updatedAt:new Date}:R));const X=s.find(w=>w.id===j),Ie=[...((X==null?void 0:X.messages)||[]).map(w=>({role:w.role,content:w.content})),{role:"user",content:f}];h(!0);const me=new AbortController;v.current=me;try{await ir.chat({messages:Ie,model:d,tools_enabled:!0,project_slug:a},w=>{n(R=>R.map(M=>{if(M.id!==j)return M;const L=[...M.messages],I=L.findIndex(O=>O.id===ge);if(I<0)return M;const E=L[I];if(!E)return M;if(w.type==="token")L[I]={...E,content:E.content+w.delta};else if(w.type==="tool_call"){const O={id:w.id,name:w.name,args:w.args};L[I]={...E,toolCalls:[...E.toolCalls||[],O]}}else if(w.type==="tool_result"){const O=(E.toolCalls||[]).map(Z=>Z.id===w.id?{...Z,result:{ok:w.ok,data:w.data,duration_ms:w.duration_ms}}:Z);L[I]={...E,toolCalls:O}}else w.type==="error"&&(L[I]={...E,error:w.message});return{...M,messages:L,updatedAt:new Date}}))},me.signal)}catch(w){w instanceof Error&&w.name!=="AbortError"&&b(w.message)}finally{h(!1),v.current=null}},[d,i,s,a,P]),H=o.useCallback(()=>{var f;(f=v.current)==null||f.abort()},[]),V=o.useCallback(f=>{n(j=>j.filter(_=>_.id!==f)),i===f&&l(null)},[i]),z=s.map(f=>({id:f.id,contextLabel:f.contextLabel,updatedAt:f.updatedAt})),Y=cr(d);return r.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950",children:[r.jsx(ur,{models:g,currentModel:d,onSelectModel:c,onRefresh:A}),r.jsx(kr,{sessions:z,currentSessionId:i,onSwitch:l,onNew:P,onDelete:V}),!Y&&d&&r.jsxs("div",{"data-testid":"meta-agent-tools-warning",className:"mx-3 mt-2 px-2 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-300 dark:border-amber-800 rounded text-[11px] text-amber-800 dark:text-amber-300 flex items-center gap-1.5",children:[r.jsx(Ne,{size:12,className:"shrink-0"}),r.jsxs("span",{children:["Tool-calling may not work with ",r.jsx("span",{className:"font-mono",children:d})," — pick a tools-capable model (qwen2.5-coder, llama3.2…)"]})]}),p&&r.jsx("div",{className:"mx-3 mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded text-xs text-red-700 dark:text-red-400",children:p}),r.jsx(fr,{messages:K}),r.jsx(yr,{onSend:C,isGenerating:m,onStop:H,disabled:!d})]})}const Pe="stackunderflow_metaAgentSidebar";function re(){try{const e=localStorage.getItem(Pe);if(e==="collapsed"||e==="expanded"||e==="hidden")return e}catch{}return null}function je(e){try{localStorage.setItem(Pe,e)}catch{}}function Sr(e,t){return t<768?"hidden":e||(t>=1280?"expanded":"collapsed")}const B="collapsed",ae="expanded",se="hidden";function Nr({selectedProject:e,forceOverlay:t,onCloseOverlay:a}){const[s,n]=o.useState(()=>Sr(re(),typeof window<"u"?window.innerWidth:1280));o.useEffect(()=>{const m=()=>{const h=window.innerWidth;if(h<768)n(se);else if(s===se)n(re()||(h>=1280?ae:B));else{const p=re();p&&p!==s&&n(p)}};return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[s]);const i=o.useCallback(()=>{n(ae),je(ae)},[]),l=o.useCallback(()=>{n(B),je(B)},[]);return t?r.jsxs("div",{className:"fixed inset-y-0 right-0 w-full max-w-md bg-white dark:bg-gray-950 border-l border-gray-200 dark:border-gray-800 shadow-2xl z-40 flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-800",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Ask StackUnderflow"}),r.jsx("button",{onClick:a,className:"p-1 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-800","aria-label":"Close meta agent",children:r.jsx(de,{size:16})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ve,{currentQA:null,currentSessionFile:null,selectedProject:e})})]}):s===se?null:s===B?r.jsx("aside",{"data-testid":"meta-agent-sidebar-rail",className:"w-10 shrink-0 border-l border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex flex-col items-center py-2 gap-2",children:r.jsx("button",{onClick:i,className:"p-1.5 rounded text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-800",title:"Open Ask StackUnderflow","aria-label":"Expand meta-agent sidebar",children:r.jsx(ne,{size:18})})}):r.jsxs("aside",{"data-testid":"meta-agent-sidebar",className:"w-96 shrink-0 border-l border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 flex flex-col",children:[r.jsxs("header",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800",children:[r.jsx(ne,{size:16,className:"text-indigo-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Ask StackUnderflow"}),e&&r.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 rounded font-mono truncate max-w-[120px]",title:`Scoped to ${e}`,children:e}),r.jsx("span",{className:"flex-1"}),r.jsx("button",{onClick:l,className:"p-1 rounded text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800",title:"Collapse sidebar","aria-label":"Collapse meta-agent sidebar",children:r.jsx(Ye,{size:14})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ve,{currentQA:null,currentSessionFile:null,selectedProject:e})})]})}function $r({size:e="md",message:t}){const a={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return r.jsxs("div",{className:"flex flex-col items-center justify-center p-4",children:[r.jsx("div",{className:`${a[e]} animate-spin rounded-full border-2 border-gray-300 dark:border-gray-700 border-t-blue-500`}),t&&r.jsx("p",{className:"mt-3 text-sm text-gray-600 dark:text-gray-400",children:t})]})}const Re=o.createContext(null);function _r({warning:e,onDismiss:t}){return r.jsxs("div",{role:"alert",className:"bg-yellow-100 dark:bg-yellow-900/40 border-b border-yellow-300 dark:border-yellow-800 text-yellow-900 dark:text-yellow-100 text-sm px-4 py-2 flex items-start gap-3",children:[r.jsx("span",{"aria-hidden":"true",className:"font-semibold mt-0.5",children:"FX:"}),r.jsx("span",{className:"flex-1 leading-snug",children:e}),r.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss currency warning",className:"ml-2 text-yellow-900/70 dark:text-yellow-100/70 hover:text-yellow-900 dark:hover:text-yellow-100 font-bold",children:"×"})]})}function Cr({children:e}){var d;const t=Ue(),[a,s]=o.useState(null),n=le({queryKey:["cfg"],queryFn:_t,staleTime:5*6e4}),i=ze({mutationFn:c=>Ct(c),onSuccess:()=>{t.invalidateQueries({queryKey:["cfg"]}),t.invalidateQueries({queryKey:["dashboardData"]}),t.invalidateQueries({queryKey:["projects"]}),t.invalidateQueries({queryKey:["globalStats"]}),t.invalidateQueries({queryKey:["jsonlFiles"]}),s(null)}}),l=o.useCallback(async c=>{await i.mutateAsync(c)},[i]),m=((d=n.data)==null?void 0:d.currency)??null,h={currency:m,isLoading:n.isLoading,setCurrencyCode:l},p=(m==null?void 0:m.warning)??null,b=!!p&&p!==a;return r.jsxs(Re.Provider,{value:h,children:[b&&p&&r.jsx(_r,{warning:p,onDismiss:()=>s(p)}),e]})}function Ia(){const e=o.useContext(Re);return e||{currency:null,isLoading:!1,setCurrencyCode:async()=>{}}}const Er=o.lazy(()=>U(()=>import("./Overview-BqyHxuZ_.js"),__vite__mapDeps([4,1,5,6,7,8,9]))),Lr=o.lazy(()=>U(()=>import("./ProjectDashboard-DAsn11K-.js").then(e=>e.P),__vite__mapDeps([10,1,5,8,7,11]))),Tr=o.lazy(()=>U(()=>import("./Live-BX6jEGZn.js"),__vite__mapDeps([12,1,7,5,13,14,15]))),Pr=o.lazy(()=>U(()=>import("./Settings-BSujxVUW.js"),__vite__mapDeps([16,1,11,7,17,18,19])));function Rr(){const t=Se().pathname.match(/^\/project\/(.+?)(?:\/|$)/);return t?decodeURIComponent(t[1]):null}function Mr(){const[e,t]=o.useState(!1),[a,s]=o.useState(()=>typeof window>"u"?!1:window.innerWidth<768),n=Rr();o.useEffect(()=>{const l=()=>s(window.innerWidth<768);return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);const i=()=>{if(a)t(l=>!l);else{try{const m=localStorage.getItem("stackunderflow_metaAgentSidebar")==="expanded"?"collapsed":"expanded";localStorage.setItem("stackunderflow_metaAgentSidebar",m)}catch{}window.dispatchEvent(new Event("resize"))}};return r.jsxs("div",{className:"h-screen w-screen bg-white dark:bg-gray-950 flex flex-col",children:[r.jsx(sr,{onToggleChat:i,chatOpen:e}),r.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[r.jsx("main",{className:"flex-1 overflow-auto min-w-0",children:r.jsx(o.Suspense,{fallback:r.jsx($r,{size:"md",message:"Loading…"}),children:r.jsxs(Be,{children:[r.jsx(F,{path:"/",element:r.jsx(Er,{})}),r.jsx(F,{path:"/live",element:r.jsx(Tr,{})}),r.jsx(F,{path:"/project/:name",element:r.jsx(Lr,{})}),r.jsx(F,{path:"/settings",element:r.jsx(Pr,{})})]})})}),r.jsx(Nr,{selectedProject:n,forceOverlay:a&&e,onCloseOverlay:()=>t(!1)})]})]})}function Ir(){return r.jsx(Fe,{children:r.jsx(Cr,{children:r.jsx(Qt,{children:r.jsx(Mr,{})})})})}class Ar extends o.Component{constructor(a){super(a);ee(this,"handleReset",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,s){console.error("ErrorBoundary caught:",a,s)}render(){var a;return this.state.hasError?this.props.fallback?this.props.fallback:r.jsx("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:r.jsxs("div",{className:"rounded-lg border border-red-300 dark:border-red-800 bg-red-100 dark:bg-red-900/30 p-4 max-w-md",children:[r.jsx("h3",{className:"text-red-700 dark:text-red-400 font-semibold text-sm mb-1",children:"Something went wrong"}),r.jsx("p",{className:"text-red-700/80 dark:text-red-300/70 text-xs mb-3",children:((a=this.state.error)==null?void 0:a.message)||"An unexpected error occurred"}),r.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs font-medium rounded bg-red-600 dark:bg-red-800 text-white dark:text-red-200 hover:bg-red-700 dark:hover:bg-red-700 transition-colors",children:"Try again"})]})}):this.props.children}}(function(){try{(window.localStorage.getItem("suf:theme")==="light"?"light":"dark")==="light"?document.documentElement.classList.remove("dark"):document.documentElement.classList.add("dark")}catch{document.documentElement.classList.add("dark")}})();const Or=new Je({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});Ge.createRoot(document.getElementById("root")).render(r.jsx(Qe.StrictMode,{children:r.jsx(We,{client:Or,children:r.jsx(Ar,{children:r.jsx(Ir,{})})})}));export{Yr as $,ct as A,Dt as B,Et as C,G as D,Ar as E,Sa as F,et as G,la as H,ut as I,ca as J,Lt as K,$r as L,bt as M,jt as N,ia as O,pa as P,Ra as Q,va as R,rt as S,Ye as T,Gr as U,sa as V,Kr as W,na as X,qr as Y,Xr as Z,Zr as _,Wt as a,oa as a0,Hr as a1,Vr as a2,Qr as a3,Wr as a4,_a as a5,Ca as a6,Na as a7,$a as a8,La as a9,Mt as aa,Pa as ab,Ea as ac,Ta as ad,ma as ae,aa as af,ba as ag,ka as ah,ya as ai,wa as aj,fa as ak,ga as al,ha as am,xa as an,mt as b,$t as c,ta as d,ra as e,J as f,_e as g,S as h,ce as i,de as j,Br as k,Jr as l,he as m,Ft as n,Fr as o,Ne as p,ja as q,ea as r,Ma as s,Ht as t,Ia as u,wt as v,nt as w,da as x,ua as y,Nt as z}; +... [truncated for display]`}catch{return String(e)}}function gr(e){return e.result?e.result.ok?`ok · ${e.result.duration_ms}ms`:`error · ${e.result.duration_ms}ms`:"running…"}function mr(e){if(!e.result)return"";const t=e.result.data;if(!t||typeof t!="object")return"";const a=t;return typeof a.count=="number"?`${a.count} matches`:typeof a.file_count=="number"?`${a.file_count} files touched`:typeof a.total_cost_usd=="number"?`$${a.total_cost_usd.toFixed(2)} total`:typeof a.sessions=="number"&&typeof a.cost_usd=="number"?`${a.sessions} sessions · $${a.cost_usd.toFixed(2)}`:typeof a.error=="string"?a.error:""}function hr({invocation:e}){var m;const[t,a]=o.useState(!1),s=gr(e),n=mr(e),i=(m=e.result)==null?void 0:m.ok,l=!e.result;return r.jsxs("div",{"data-testid":"meta-tool-call","data-tool-name":e.name,"data-tool-status":l?"running":i?"ok":"error",className:"my-2 border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>a(h=>!h),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-gray-800/50 rounded-lg",children:[t?r.jsx(ce,{size:12,className:"text-gray-500 shrink-0"}):r.jsx(de,{size:12,className:"text-gray-500 shrink-0"}),r.jsxs("span",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 rounded inline-flex items-center gap-1 shrink-0",children:[r.jsx(jt,{size:10}),"tool"]}),r.jsx("span",{className:"font-mono text-gray-800 dark:text-gray-200 truncate",children:e.name}),r.jsx("span",{className:"flex-1"}),n&&r.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate hidden sm:inline",children:n}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-500 dark:text-gray-400 shrink-0",children:[l&&r.jsx(rt,{size:12,className:"animate-spin"}),!l&&i&&r.jsx(et,{size:12,className:"text-emerald-500"}),!l&&!i&&r.jsx(Ne,{size:12,className:"text-amber-500"}),s]})]}),t&&r.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 border-t border-gray-200 dark:border-gray-800",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"args"}),r.jsx("pre",{"data-testid":"meta-tool-args",className:"bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 rounded p-2 overflow-auto text-[11px] text-gray-700 dark:text-gray-300 max-h-48",children:ke(e.args)})]}),e.result&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"result"}),r.jsx("pre",{"data-testid":"meta-tool-result",className:"bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 rounded p-2 overflow-auto text-[11px] text-gray-700 dark:text-gray-300 max-h-64",children:ke(e.result.data)})]})]})]})}const xr=o.lazy(()=>U(()=>import("./Markdown-Be0CkqQs.js"),__vite__mapDeps([0,1,2,3])));function we(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function fr({messages:e}){const t=o.useRef(null);return o.useEffect(()=>{var a;(a=t.current)==null||a.scrollIntoView({behavior:"smooth"})},[e]),e.length===0?r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"text-center text-gray-500",children:[r.jsx("p",{className:"text-sm",children:"Ask about your sessions, costs, or projects."}),r.jsx("p",{className:"text-xs mt-1 leading-relaxed",children:"The meta agent reads from your local StackUnderflow store — nothing leaves the machine."})]})}):r.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[e.map(a=>r.jsx(pr,{message:a},a.id)),r.jsx("div",{ref:t})]})}function pr({message:e}){return e.role==="user"?r.jsx("div",{className:"flex justify-end mb-3",children:r.jsxs("div",{className:"max-w-[85%] rounded-lg px-3 py-2 bg-blue-600 text-white",children:[r.jsx("div",{className:"text-sm break-words",children:r.jsx("p",{className:"whitespace-pre-wrap",children:e.content})}),r.jsx("div",{className:"text-[10px] mt-1 text-blue-200",children:we(e.timestamp)})]})}):r.jsx("div",{className:"flex justify-start mb-3",children:r.jsxs("div",{className:"max-w-[95%] w-full",children:[e.toolCalls&&e.toolCalls.length>0&&r.jsx("div",{"data-testid":"meta-tool-calls",className:"mb-1",children:e.toolCalls.map(a=>r.jsx(hr,{invocation:a},a.id))}),(e.content||e.error)&&r.jsxs("div",{className:"rounded-lg px-3 py-2 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200",children:[r.jsxs("div",{className:"text-sm break-words",children:[e.content&&r.jsx(o.Suspense,{fallback:r.jsx("p",{className:"whitespace-pre-wrap",children:e.content}),children:r.jsx(xr,{content:e.content})}),e.error&&r.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["Error: ",e.error]})]}),r.jsx("div",{className:"text-[10px] mt-1 text-gray-500",children:we(e.timestamp)})]})]})})}function yr({onSend:e,isGenerating:t,onStop:a,disabled:s}){const[n,i]=o.useState(""),l=o.useRef(null),m=o.useCallback(()=>{const b=n.trim();!b||s||(e(b),i(""),l.current&&(l.current.style.height="auto"))},[n,s,e]),h=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),m())},p=b=>{i(b.target.value);const d=b.target;d.style.height="auto",d.style.height=`${Math.min(d.scrollHeight,120)}px`};return r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 p-2",children:r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("textarea",{ref:l,value:n,onChange:p,onKeyDown:h,placeholder:s?"Select a model to start chatting...":"Ask a question...",disabled:s||t,rows:1,className:"flex-1 bg-white dark:bg-gray-800 text-sm text-gray-800 dark:text-gray-200 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 resize-none focus:outline-none focus:border-blue-500 placeholder-gray-500 dark:placeholder-gray-600 disabled:opacity-50"}),t?r.jsx("button",{onClick:a,className:"p-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors shrink-0",title:"Stop generating",children:r.jsx(it,{size:18})}):r.jsx("button",{onClick:m,disabled:s||!n.trim(),className:"p-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-700 disabled:text-gray-500 text-white rounded-lg transition-colors shrink-0",title:"Send message",children:r.jsx(xt,{size:18})})]})})}function br(e){return new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function kr({sessions:e,currentSessionId:t,onSwitch:a,onNew:s,onDelete:n}){return r.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-800",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Sessions"}),r.jsx("button",{onClick:s,className:"p-0.5 text-gray-500 hover:text-blue-400 transition-colors",title:"New chat session",children:r.jsx(ct,{size:14})})]}),e.length>0&&r.jsx("div",{className:"max-h-24 overflow-auto px-1 pb-1 space-y-0.5",children:e.map(i=>r.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded text-xs cursor-pointer group ${i.id===t?"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200":"text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300"}`,onClick:()=>a(i.id),children:[r.jsx("span",{className:"flex-1 truncate",children:i.contextLabel}),r.jsx("span",{className:"text-[10px] text-gray-600 dark:text-gray-400 shrink-0",children:br(i.updatedAt)}),r.jsx("button",{onClick:l=>{l.stopPropagation(),n(i.id)},className:"p-0.5 text-gray-600 dark:text-gray-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-all shrink-0",title:"Delete session",children:r.jsx(Nt,{size:12})})]},i.id))})]})}const Te="stackunderflow_metaAgentSessions";function te(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function wr(){try{const e=localStorage.getItem(Te);return e?JSON.parse(e).map(a=>({...a,createdAt:new Date(a.createdAt),updatedAt:new Date(a.updatedAt),messages:a.messages.map(s=>({...s,timestamp:new Date(s.timestamp)}))})):[]}catch{return[]}}function vr(e){try{localStorage.setItem(Te,JSON.stringify(e))}catch{}}function jr(e,t,a){if(e){const s=e.question_text.substring(0,40);return s.lengthf.id===i)||null,K=(N==null?void 0:N.messages)||[],A=o.useCallback(async()=>{try{const f=await or.listModels();u(f),$(!0),f.length>0&&!d&&f[0]&&c(f[0].name)}catch{$(!0)}},[d]);o.useEffect(()=>{if(!k){const f=setTimeout(A,1e3);return()=>clearTimeout(f)}},[k,A]),o.useEffect(()=>{vr(s)},[s]);const P=o.useCallback(()=>{const f=jr(e,t,a),j={id:te(),contextLabel:f,createdAt:new Date,updatedAt:new Date,messages:[],projectSlug:a};return n(_=>[j,..._]),l(j.id),j.id},[e,t,a]),C=o.useCallback(async f=>{if(!d){b("No model selected");return}b(null);let j=i;j||(j=P());const _={id:te(),role:"user",content:f,timestamp:new Date},ge=te(),Me={id:ge,role:"assistant",content:"",timestamp:new Date,toolCalls:[]};n(w=>w.map(R=>R.id===j?{...R,messages:[...R.messages,_,Me],updatedAt:new Date}:R));const X=s.find(w=>w.id===j),Ie=[...((X==null?void 0:X.messages)||[]).map(w=>({role:w.role,content:w.content})),{role:"user",content:f}];h(!0);const me=new AbortController;v.current=me;try{await ir.chat({messages:Ie,model:d,tools_enabled:!0,project_slug:a},w=>{n(R=>R.map(M=>{if(M.id!==j)return M;const L=[...M.messages],I=L.findIndex(O=>O.id===ge);if(I<0)return M;const E=L[I];if(!E)return M;if(w.type==="token")L[I]={...E,content:E.content+w.delta};else if(w.type==="tool_call"){const O={id:w.id,name:w.name,args:w.args};L[I]={...E,toolCalls:[...E.toolCalls||[],O]}}else if(w.type==="tool_result"){const O=(E.toolCalls||[]).map(Z=>Z.id===w.id?{...Z,result:{ok:w.ok,data:w.data,duration_ms:w.duration_ms}}:Z);L[I]={...E,toolCalls:O}}else w.type==="error"&&(L[I]={...E,error:w.message});return{...M,messages:L,updatedAt:new Date}}))},me.signal)}catch(w){w instanceof Error&&w.name!=="AbortError"&&b(w.message)}finally{h(!1),v.current=null}},[d,i,s,a,P]),H=o.useCallback(()=>{var f;(f=v.current)==null||f.abort()},[]),V=o.useCallback(f=>{n(j=>j.filter(_=>_.id!==f)),i===f&&l(null)},[i]),z=s.map(f=>({id:f.id,contextLabel:f.contextLabel,updatedAt:f.updatedAt})),Y=cr(d);return r.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950",children:[r.jsx(ur,{models:g,currentModel:d,onSelectModel:c,onRefresh:A}),r.jsx(kr,{sessions:z,currentSessionId:i,onSwitch:l,onNew:P,onDelete:V}),!Y&&d&&r.jsxs("div",{"data-testid":"meta-agent-tools-warning",className:"mx-3 mt-2 px-2 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-300 dark:border-amber-800 rounded text-[11px] text-amber-800 dark:text-amber-300 flex items-center gap-1.5",children:[r.jsx(Ne,{size:12,className:"shrink-0"}),r.jsxs("span",{children:["Tool-calling may not work with ",r.jsx("span",{className:"font-mono",children:d})," — pick a tools-capable model (qwen2.5-coder, llama3.2…)"]})]}),p&&r.jsx("div",{className:"mx-3 mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded text-xs text-red-700 dark:text-red-400",children:p}),r.jsx(fr,{messages:K}),r.jsx(yr,{onSend:C,isGenerating:m,onStop:H,disabled:!d})]})}const Pe="stackunderflow_metaAgentSidebar";function re(){try{const e=localStorage.getItem(Pe);if(e==="collapsed"||e==="expanded"||e==="hidden")return e}catch{}return null}function je(e){try{localStorage.setItem(Pe,e)}catch{}}function Sr(e,t){return t<768?"hidden":e||(t>=1280?"expanded":"collapsed")}const B="collapsed",ae="expanded",se="hidden";function Nr({selectedProject:e,forceOverlay:t,onCloseOverlay:a}){const[s,n]=o.useState(()=>Sr(re(),typeof window<"u"?window.innerWidth:1280));o.useEffect(()=>{const m=()=>{const h=window.innerWidth;if(h<768)n(se);else if(s===se)n(re()||(h>=1280?ae:B));else{const p=re();p&&p!==s&&n(p)}};return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[s]);const i=o.useCallback(()=>{n(ae),je(ae)},[]),l=o.useCallback(()=>{n(B),je(B)},[]);return t?r.jsxs("div",{className:"fixed inset-y-0 right-0 w-full max-w-md bg-white dark:bg-gray-950 border-l border-gray-200 dark:border-gray-800 shadow-2xl z-40 flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-800",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Ask StackUnderflow"}),r.jsx("button",{onClick:a,className:"p-1 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-800","aria-label":"Close meta agent",children:r.jsx(de,{size:16})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ve,{currentQA:null,currentSessionFile:null,selectedProject:e})})]}):s===se?null:s===B?r.jsx("aside",{"data-testid":"meta-agent-sidebar-rail",className:"w-10 shrink-0 border-l border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex flex-col items-center py-2 gap-2",children:r.jsx("button",{onClick:i,className:"p-1.5 rounded text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-800",title:"Open Ask StackUnderflow","aria-label":"Expand meta-agent sidebar",children:r.jsx(ne,{size:18})})}):r.jsxs("aside",{"data-testid":"meta-agent-sidebar",className:"w-96 shrink-0 border-l border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 flex flex-col",children:[r.jsxs("header",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800",children:[r.jsx(ne,{size:16,className:"text-indigo-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Ask StackUnderflow"}),e&&r.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 rounded font-mono truncate max-w-[120px]",title:`Scoped to ${e}`,children:e}),r.jsx("span",{className:"flex-1"}),r.jsx("button",{onClick:l,className:"p-1 rounded text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800",title:"Collapse sidebar","aria-label":"Collapse meta-agent sidebar",children:r.jsx(Ye,{size:14})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ve,{currentQA:null,currentSessionFile:null,selectedProject:e})})]})}function $r({size:e="md",message:t}){const a={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};return r.jsxs("div",{className:"flex flex-col items-center justify-center p-4",children:[r.jsx("div",{className:`${a[e]} animate-spin rounded-full border-2 border-gray-300 dark:border-gray-700 border-t-blue-500`}),t&&r.jsx("p",{className:"mt-3 text-sm text-gray-600 dark:text-gray-400",children:t})]})}const Re=o.createContext(null);function _r({warning:e,onDismiss:t}){return r.jsxs("div",{role:"alert",className:"bg-yellow-100 dark:bg-yellow-900/40 border-b border-yellow-300 dark:border-yellow-800 text-yellow-900 dark:text-yellow-100 text-sm px-4 py-2 flex items-start gap-3",children:[r.jsx("span",{"aria-hidden":"true",className:"font-semibold mt-0.5",children:"FX:"}),r.jsx("span",{className:"flex-1 leading-snug",children:e}),r.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss currency warning",className:"ml-2 text-yellow-900/70 dark:text-yellow-100/70 hover:text-yellow-900 dark:hover:text-yellow-100 font-bold",children:"×"})]})}function Cr({children:e}){var d;const t=Ue(),[a,s]=o.useState(null),n=le({queryKey:["cfg"],queryFn:_t,staleTime:5*6e4}),i=ze({mutationFn:c=>Ct(c),onSuccess:()=>{t.invalidateQueries({queryKey:["cfg"]}),t.invalidateQueries({queryKey:["dashboardData"]}),t.invalidateQueries({queryKey:["projects"]}),t.invalidateQueries({queryKey:["globalStats"]}),t.invalidateQueries({queryKey:["jsonlFiles"]}),s(null)}}),l=o.useCallback(async c=>{await i.mutateAsync(c)},[i]),m=((d=n.data)==null?void 0:d.currency)??null,h={currency:m,isLoading:n.isLoading,setCurrencyCode:l},p=(m==null?void 0:m.warning)??null,b=!!p&&p!==a;return r.jsxs(Re.Provider,{value:h,children:[b&&p&&r.jsx(_r,{warning:p,onDismiss:()=>s(p)}),e]})}function Ia(){const e=o.useContext(Re);return e||{currency:null,isLoading:!1,setCurrencyCode:async()=>{}}}const Er=o.lazy(()=>U(()=>import("./Overview-D7DJD716.js"),__vite__mapDeps([4,1,5,6,7,8,9]))),Lr=o.lazy(()=>U(()=>import("./ProjectDashboard-CixMPUyA.js").then(e=>e.P),__vite__mapDeps([10,1,5,8,7,11]))),Tr=o.lazy(()=>U(()=>import("./Live-TQJbKokL.js"),__vite__mapDeps([12,1,7,5,13,14,15]))),Pr=o.lazy(()=>U(()=>import("./Settings-D4OLuWdJ.js"),__vite__mapDeps([16,1,11,7,17,18,19])));function Rr(){const t=Se().pathname.match(/^\/project\/(.+?)(?:\/|$)/);return t?decodeURIComponent(t[1]):null}function Mr(){const[e,t]=o.useState(!1),[a,s]=o.useState(()=>typeof window>"u"?!1:window.innerWidth<768),n=Rr();o.useEffect(()=>{const l=()=>s(window.innerWidth<768);return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);const i=()=>{if(a)t(l=>!l);else{try{const m=localStorage.getItem("stackunderflow_metaAgentSidebar")==="expanded"?"collapsed":"expanded";localStorage.setItem("stackunderflow_metaAgentSidebar",m)}catch{}window.dispatchEvent(new Event("resize"))}};return r.jsxs("div",{className:"h-screen w-screen bg-white dark:bg-gray-950 flex flex-col",children:[r.jsx(sr,{onToggleChat:i,chatOpen:e}),r.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[r.jsx("main",{className:"flex-1 overflow-auto min-w-0",children:r.jsx(o.Suspense,{fallback:r.jsx($r,{size:"md",message:"Loading…"}),children:r.jsxs(Be,{children:[r.jsx(F,{path:"/",element:r.jsx(Er,{})}),r.jsx(F,{path:"/live",element:r.jsx(Tr,{})}),r.jsx(F,{path:"/project/:name",element:r.jsx(Lr,{})}),r.jsx(F,{path:"/settings",element:r.jsx(Pr,{})})]})})}),r.jsx(Nr,{selectedProject:n,forceOverlay:a&&e,onCloseOverlay:()=>t(!1)})]})]})}function Ir(){return r.jsx(Fe,{children:r.jsx(Cr,{children:r.jsx(Qt,{children:r.jsx(Mr,{})})})})}class Ar extends o.Component{constructor(a){super(a);ee(this,"handleReset",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,s){console.error("ErrorBoundary caught:",a,s)}render(){var a;return this.state.hasError?this.props.fallback?this.props.fallback:r.jsx("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:r.jsxs("div",{className:"rounded-lg border border-red-300 dark:border-red-800 bg-red-100 dark:bg-red-900/30 p-4 max-w-md",children:[r.jsx("h3",{className:"text-red-700 dark:text-red-400 font-semibold text-sm mb-1",children:"Something went wrong"}),r.jsx("p",{className:"text-red-700/80 dark:text-red-300/70 text-xs mb-3",children:((a=this.state.error)==null?void 0:a.message)||"An unexpected error occurred"}),r.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs font-medium rounded bg-red-600 dark:bg-red-800 text-white dark:text-red-200 hover:bg-red-700 dark:hover:bg-red-700 transition-colors",children:"Try again"})]})}):this.props.children}}(function(){try{(window.localStorage.getItem("suf:theme")==="light"?"light":"dark")==="light"?document.documentElement.classList.remove("dark"):document.documentElement.classList.add("dark")}catch{document.documentElement.classList.add("dark")}})();const Or=new Je({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});Ge.createRoot(document.getElementById("root")).render(r.jsx(Qe.StrictMode,{children:r.jsx(We,{client:Or,children:r.jsx(Ar,{children:r.jsx(Ir,{})})})}));export{Yr as $,ct as A,Dt as B,Et as C,G as D,Ar as E,Sa as F,et as G,la as H,ut as I,ca as J,Lt as K,$r as L,bt as M,jt as N,ia as O,pa as P,Ra as Q,va as R,rt as S,Ye as T,Gr as U,sa as V,Kr as W,na as X,qr as Y,Xr as Z,Zr as _,Wt as a,oa as a0,Hr as a1,Vr as a2,Qr as a3,Wr as a4,_a as a5,Ca as a6,Na as a7,$a as a8,La as a9,Mt as aa,Pa as ab,Ea as ac,Ta as ad,ma as ae,aa as af,ba as ag,ka as ah,ya as ai,wa as aj,fa as ak,ga as al,ha as am,xa as an,mt as b,$t as c,ta as d,ra as e,J as f,_e as g,S as h,ce as i,de as j,Br as k,Jr as l,he as m,Ft as n,Fr as o,Ne as p,ja as q,ea as r,Ma as s,Ht as t,Ia as u,wt as v,nt as w,da as x,ua as y,Nt as z}; diff --git a/stackunderflow/static/react/assets/index-CQL5TeFe.css b/stackunderflow/static/react/assets/index-CQL5TeFe.css new file mode 100644 index 0000000..9df6b31 --- /dev/null +++ b/stackunderflow/static/react/assets/index-CQL5TeFe.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(102 126 234 / .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(102 126 234 / .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}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px var(--tw-prose-kbd-shadows),0 3px 0 var(--tw-prose-kbd-shadows);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: rgb(17 24 39 / 10%);--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: rgb(255 255 255 / 10%);--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-sm{font-size:.875rem;line-height:1.7142857}.prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.3333333em;margin-bottom:1.3333333em;padding-inline-start:1.1111111em}.prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;border-radius:.3125rem;padding-top:.1428571em;padding-inline-end:.3571429em;padding-bottom:.1428571em;padding-inline-start:.3571429em}.prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em}.prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}.prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8888889em}.prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;margin-bottom:.2857143em}.prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;padding-inline-start:1.5714286em}.prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.8571429em;margin-bottom:2.8571429em}.prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.5}.prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-invert{--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.right-0{right:0}.top-0{top:0}.top-1\/2{top:50%}.top-5{top:1.25rem}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-mr-0\.5{margin-right:-.125rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-64{height:16rem}.h-8{height:2rem}.h-80{height:20rem}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-full{height:100%}.h-screen{height:100vh}.max-h-24{max-height:6rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[300px\]{max-height:300px}.max-h-\[500px\]{max-height:500px}.max-h-\[70vh\]{max-height:70vh}.min-h-0{min-height:0px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-80{width:20rem}.w-96{width:24rem}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-\[120px\]{max-width:120px}.max-w-\[12rem\]{max-width:12rem}.max-w-\[16rem\]{max-width:16rem}.max-w-\[180px\]{max-width:180px}.max-w-\[18rem\]{max-width:18rem}.max-w-\[20rem\]{max-width:20rem}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-\[40\%\]{max-width:40%}.max-w-\[85\%\]{max-width:85%}.max-w-\[95\%\]{max-width:95%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x: -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))}.-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))}.rotate-90{--tw-rotate: 90deg;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-auto{cursor:auto}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.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-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1{row-gap:.25rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-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-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-x>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.divide-indigo-900\/20>:not([hidden])~:not([hidden]){border-color:#312e8133}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.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-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-300{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-600\/50{border-color:#d9770680}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(193 200 251 / var(--tw-border-opacity, 1))}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(162 173 249 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(102 126 234 / var(--tw-border-opacity, 1))}.border-blue-500\/30{border-color:#667eea4d}.border-cyan-300{--tw-border-opacity: 1;border-color:rgb(103 232 249 / var(--tw-border-opacity, 1))}.border-emerald-300{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.border-emerald-400{--tw-border-opacity: 1;border-color:rgb(52 211 153 / var(--tw-border-opacity, 1))}.border-emerald-500\/30{border-color:#10b9814d}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-100\/30{border-color:#f3f4f64d}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-200\/50{border-color:#e5e7eb80}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-800{--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.border-indigo-300{--tw-border-opacity: 1;border-color:rgb(165 180 252 / var(--tw-border-opacity, 1))}.border-indigo-400{--tw-border-opacity: 1;border-color:rgb(129 140 248 / var(--tw-border-opacity, 1))}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/40{border-color:#6366f166}.border-indigo-500\/50{border-color:#6366f180}.border-indigo-500\/60{border-color:#6366f199}.border-indigo-700{--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity, 1))}.border-indigo-800\/60{border-color:#3730a399}.border-indigo-900\/30{border-color:#312e814d}.border-indigo-900\/40{border-color:#312e8166}.border-indigo-900\/50{border-color:#312e8180}.border-orange-300{--tw-border-opacity: 1;border-color:rgb(253 186 116 / var(--tw-border-opacity, 1))}.border-pink-300{--tw-border-opacity: 1;border-color:rgb(249 168 212 / var(--tw-border-opacity, 1))}.border-purple-300{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity, 1))}.border-purple-500\/30{border-color:#a855f74d}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-red-900\/30{border-color:#7f1d1d4d}.border-red-900\/40{border-color:#7f1d1d66}.border-rose-300{--tw-border-opacity: 1;border-color:rgb(253 164 175 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity, 1))}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity, 1))}.border-yellow-800{--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.border-zinc-200{--tw-border-opacity: 1;border-color:rgb(228 228 231 / var(--tw-border-opacity, 1))}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(102 126 234 / var(--tw-border-opacity, 1))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-50\/60{background-color:#fffbeb99}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-600\/20{background-color:#d9770633}.bg-black\/60{background-color:#0009}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(224 228 253 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(240 241 254 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(102 126 234 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#667eea1a}.bg-blue-500\/20{background-color:#667eea33}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(90 111 216 / var(--tw-bg-opacity, 1))}.bg-cyan-100{--tw-bg-opacity: 1;background-color:rgb(207 250 254 / var(--tw-bg-opacity, 1))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-emerald-100{--tw-bg-opacity: 1;background-color:rgb(209 250 229 / var(--tw-bg-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / 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\/20{background-color:#10b98133}.bg-fuchsia-100{--tw-bg-opacity: 1;background-color:rgb(250 232 255 / var(--tw-bg-opacity, 1))}.bg-fuchsia-500{--tw-bg-opacity: 1;background-color:rgb(217 70 239 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-100\/40{background-color:#f3f4f666}.bg-gray-100\/50{background-color:#f3f4f680}.bg-gray-100\/60{background-color:#f3f4f699}.bg-gray-100\/70{background-color:#f3f4f6b3}.bg-gray-100\/80{background-color:#f3f4f6cc}.bg-gray-100\/90{background-color:#f3f4f6e6}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-200\/40{background-color:#e5e7eb66}.bg-gray-200\/50{background-color:#e5e7eb80}.bg-gray-200\/60{background-color:#e5e7eb99}.bg-gray-200\/80{background-color:#e5e7ebcc}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\/30{background-color:#f9fafb4d}.bg-gray-50\/40{background-color:#f9fafb66}.bg-gray-50\/50{background-color:#f9fafb80}.bg-gray-50\/60{background-color:#f9fafb99}.bg-gray-50\/70{background-color:#f9fafbb3}.bg-gray-50\/80{background-color:#f9fafbcc}.bg-gray-50\/95{background-color:#f9fafbf2}.bg-gray-500\/10{background-color:#6b72801a}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-indigo-50\/70{background-color:#eef2ffb3}.bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-500\/15{background-color:#6366f126}.bg-indigo-500\/20{background-color:#6366f133}.bg-indigo-500\/25{background-color:#6366f140}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-950\/30{background-color:#1e1b4b4d}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(252 231 243 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / 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\/70{background-color:#ef4444b3}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-rose-100{--tw-bg-opacity: 1;background-color:rgb(255 228 230 / var(--tw-bg-opacity, 1))}.bg-rose-50{--tw-bg-opacity: 1;background-color:rgb(255 241 242 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-sky-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-teal-100{--tw-bg-opacity: 1;background-color:rgb(204 251 241 / var(--tw-bg-opacity, 1))}.bg-teal-500{--tw-bg-opacity: 1;background-color:rgb(20 184 166 / var(--tw-bg-opacity, 1))}.bg-violet-100{--tw-bg-opacity: 1;background-color:rgb(237 233 254 / var(--tw-bg-opacity, 1))}.bg-violet-500{--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity, 1))}.bg-violet-600{--tw-bg-opacity: 1;background-color:rgb(124 58 237 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-zinc-50\/50{background-color:#fafafa80}.bg-zinc-50\/60{background-color:#fafafa99}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-indigo-900\/30{--tw-gradient-from: rgb(49 46 129 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-900\/40{--tw-gradient-from: rgb(49 46 129 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900\/20{--tw-gradient-from: rgb(127 29 29 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900\/30{--tw-gradient-from: rgb(127 29 29 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-50\/50{--tw-gradient-to: rgb(249 250 251 / .5) var(--tw-gradient-to-position)}.to-gray-50\/60{--tw-gradient-to: rgb(249 250 251 / .6) var(--tw-gradient-to-position)}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.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-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-1\.5{padding-bottom:.375rem}.pb-2{padding-bottom:.5rem}.pb-2\.5{padding-bottom:.625rem}.pb-3{padding-bottom:.75rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-6{padding-right:1.5rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[9px\]{font-size:9px}.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}.normal-case{text-transform:none}.italic{font-style:italic}.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}.leading-snug{line-height:1.375}.tracking-normal{letter-spacing:0em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-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-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(193 200 251 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.text-blue-400\/70{color:#8494efb3}.text-blue-500{--tw-text-opacity: 1;color:rgb(102 126 234 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(90 111 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(59 71 152 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-800{--tw-text-opacity: 1;color:rgb(21 94 117 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/80{color:#34d399cc}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-emerald-800{--tw-text-opacity: 1;color:rgb(6 95 70 / var(--tw-text-opacity, 1))}.text-fuchsia-800{--tw-text-opacity: 1;color:rgb(134 25 143 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-600\/70{color:#16a34ab3}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-indigo-200{--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-indigo-600\/80{color:#4f46e5cc}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-indigo-800{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-pink-800{--tw-text-opacity: 1;color:rgb(157 23 77 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-400\/70{color:#c084fcb3}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / 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-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-700\/80{color:#b91c1ccc}.text-red-700\/90{color:#b91c1ce6}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-rose-700{--tw-text-opacity: 1;color:rgb(190 18 60 / var(--tw-text-opacity, 1))}.text-rose-800{--tw-text-opacity: 1;color:rgb(159 18 57 / var(--tw-text-opacity, 1))}.text-sky-800{--tw-text-opacity: 1;color:rgb(7 89 133 / var(--tw-text-opacity, 1))}.text-teal-800{--tw-text-opacity: 1;color:rgb(17 94 89 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-violet-800{--tw-text-opacity: 1;color:rgb(91 33 182 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.text-yellow-900\/70{color:#713f12b3}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.text-zinc-800{--tw-text-opacity: 1;color:rgb(39 39 42 / var(--tw-text-opacity, 1))}.text-zinc-900{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-zinc-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(113 113 122 / var(--tw-placeholder-opacity, 1))}.placeholder-zinc-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(113 113 122 / var(--tw-placeholder-opacity, 1))}.accent-indigo-500{accent-color:#6366f1}.accent-indigo-600{accent-color:#4f46e5}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-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)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--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(3px + 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-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-2{--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)}.ring-indigo-400\/70{--tw-ring-color: rgb(129 140 248 / .7)}.ring-indigo-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.ring-indigo-500\/40{--tw-ring-color: rgb(99 102 241 / .4)}.ring-red-500\/70{--tw-ring-color: rgb(239 68 68 / .7)}.\!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)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[suf\:beta\]{suf:beta}.\[suf\:tabs\]{suf:tabs}.\[suf\:theme\]{suf:theme}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#f3f4f6}::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#9ca3af}html.dark ::-webkit-scrollbar-track{background:#111827}html.dark ::-webkit-scrollbar-thumb{background:#374151}html.dark ::-webkit-scrollbar-thumb:hover{background:#4b5563}pre code{font-family:JetBrains Mono,Fira Code,Monaco,Consolas,monospace}.prose-invert{--tw-prose-body: rgb(55 65 81);--tw-prose-headings: rgb(17 24 39);--tw-prose-links: rgb(67 56 202);--tw-prose-bold: rgb(17 24 39);--tw-prose-counters: rgb(107 114 128);--tw-prose-bullets: rgb(156 163 175);--tw-prose-hr: rgb(229 231 235);--tw-prose-quotes: rgb(17 24 39);--tw-prose-quote-borders: rgb(229 231 235);--tw-prose-captions: rgb(107 114 128);--tw-prose-code: rgb(29 78 216);--tw-prose-pre-code: rgb(55 65 81);--tw-prose-pre-bg: rgb(243 244 246);--tw-prose-th-borders: rgb(229 231 235);--tw-prose-td-borders: rgb(243 244 246)}html.dark .prose-invert{--tw-prose-body: rgb(209 213 219);--tw-prose-headings: rgb(243 244 246);--tw-prose-links: rgb(96 165 250);--tw-prose-bold: rgb(243 244 246);--tw-prose-counters: rgb(156 163 175);--tw-prose-bullets: rgb(107 114 128);--tw-prose-hr: rgb(55 65 81);--tw-prose-quotes: rgb(243 244 246);--tw-prose-quote-borders: rgb(55 65 81);--tw-prose-captions: rgb(156 163 175);--tw-prose-code: rgb(147 197 253);--tw-prose-pre-code: rgb(209 213 219);--tw-prose-pre-bg: rgb(17 24 39);--tw-prose-th-borders: rgb(55 65 81);--tw-prose-td-borders: rgb(31 41 55)}.animate-spin{transition:none}.first\:pt-0:first-child{padding-top:0}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.hover\:h-2\.5:hover{height:.625rem}.hover\:w-2\.5:hover{width:.625rem}.hover\:border-gray-200:hover{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:border-zinc-200:hover{--tw-border-opacity: 1;border-color:rgb(228 228 231 / var(--tw-border-opacity, 1))}.hover\:bg-amber-500\/25:hover{background-color:#f59e0b40}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(102 126 234 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/30:hover{background-color:#667eea4d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(74 90 184 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/30:hover{background-color:#10b9814d}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100\/50:hover{background-color:#f3f4f680}.hover\:bg-gray-100\/60:hover{background-color:#f3f4f699}.hover\:bg-gray-100\/70:hover{background-color:#f3f4f6b3}.hover\:bg-gray-100\/80:hover{background-color:#f3f4f6cc}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200\/70:hover{background-color:#e5e7ebb3}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50\/70:hover{background-color:#f9fafbb3}.hover\:bg-indigo-50:hover{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500\/30:hover{background-color:#6366f14d}.hover\:bg-indigo-600:hover{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/25:hover{background-color:#a855f740}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-300:hover{--tw-bg-opacity: 1;background-color:rgb(252 165 165 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-200:hover{--tw-bg-opacity: 1;background-color:rgb(228 228 231 / var(--tw-bg-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-800:hover{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-indigo-400:hover{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.hover\:text-indigo-800:hover{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.hover\:text-indigo-900:hover{--tw-text-opacity: 1;color:rgb(49 46 129 / 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\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-red-800:hover{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.hover\:text-yellow-900:hover{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);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)}.hover\:brightness-125:hover{--tw-brightness: brightness(1.25);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\:z-10:focus{z-index:10}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(102 126 234 / var(--tw-border-opacity, 1))}.focus\:border-blue-600:focus{--tw-border-opacity: 1;border-color:rgb(90 111 216 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:border-zinc-500:focus{--tw-border-opacity: 1;border-color:rgb(113 113 122 / var(--tw-border-opacity, 1))}.focus\:bg-gray-100\/60:focus{background-color:#f3f4f699}.focus\:bg-gray-100\/70:focus{background-color:#f3f4f6b3}.focus\:bg-gray-100\/80:focus{background-color:#f3f4f6cc}.focus\:bg-red-100:focus{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.focus\:text-indigo-800:focus{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1: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(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)}.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-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(90 111 216 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/60:focus{--tw-ring-color: rgb(99 102 241 / .6)}.focus\:ring-offset-0:focus{--tw-ring-offset-width: 0px}.focus-visible\:ring-1:focus-visible{--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)}.focus-visible\:ring-2:focus-visible{--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-visible\:ring-blue-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(102 126 234 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-gray-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(156 163 175 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(129 140 248 / var(--tw-ring-opacity, 1))}.disabled\:cursor-default:disabled{cursor:default}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.disabled\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\:text-gray-500:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:opacity-100{opacity:1}.prose-headings\:font-semibold :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:600}.prose-headings\:text-gray-800 :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.prose-p\:leading-relaxed :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){line-height:1.625}.prose-p\:text-gray-700 :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-a\:text-blue-400 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.prose-a\:no-underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:none}.hover\:prose-a\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))):hover{text-decoration-line:underline}.prose-blockquote\:border-gray-300 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.prose-blockquote\:text-gray-600 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.prose-strong\:text-gray-800 :is(:where(strong):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.prose-code\:rounded :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){border-radius:.25rem}.prose-code\:bg-gray-100 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.prose-code\:px-1 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){padding-left:.25rem;padding-right:.25rem}.prose-code\:py-0\.5 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){padding-top:.125rem;padding-bottom:.125rem}.prose-code\:text-xs :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-code\:text-blue-700 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(74 90 184 / var(--tw-text-opacity, 1))}.prose-code\:before\:content-none :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):before{--tw-content: none;content:var(--tw-content)}.prose-code\:after\:content-none :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):after{--tw-content: none;content:var(--tw-content)}.prose-pre\:bg-transparent :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){background-color:transparent}.prose-pre\:p-0 :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){padding:0}.prose-li\:text-gray-700 :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-th\:text-gray-700 :is(:where(th):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-td\:text-gray-600 :is(:where(td):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.prose-hr\:border-gray-300 :is(:where(hr):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.dark\:divide-gray-800:is(.dark *)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity, 1))}.dark\:border-amber-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(180 83 9 / var(--tw-border-opacity, 1))}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-amber-800\/60:is(.dark *){border-color:#92400e99}.dark\:border-amber-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 53 15 / var(--tw-border-opacity, 1))}.dark\:border-amber-900\/30:is(.dark *){border-color:#78350f4d}.dark\:border-amber-900\/40:is(.dark *){border-color:#78350f66}.dark\:border-amber-900\/50:is(.dark *){border-color:#78350f80}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(74 90 184 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(59 71 152 / var(--tw-border-opacity, 1))}.dark\:border-blue-800\/60:is(.dark *){border-color:#3b479899}.dark\:border-cyan-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(14 116 144 / var(--tw-border-opacity, 1))}.dark\:border-cyan-800\/60:is(.dark *){border-color:#155e7599}.dark\:border-emerald-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.dark\:border-emerald-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity, 1))}.dark\:border-emerald-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(6 95 70 / var(--tw-border-opacity, 1))}.dark\:border-gray-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-gray-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.dark\:border-gray-800\/30:is(.dark *){border-color:#1f29374d}.dark\:border-gray-800\/50:is(.dark *){border-color:#1f293780}.dark\:border-gray-800\/70:is(.dark *){border-color:#1f2937b3}.dark\:border-green-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-800\/60:is(.dark *){border-color:#16653499}.dark\:border-indigo-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.dark\:border-indigo-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity, 1))}.dark\:border-indigo-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 48 163 / var(--tw-border-opacity, 1))}.dark\:border-indigo-800\/60:is(.dark *){border-color:#3730a399}.dark\:border-orange-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(154 52 18 / var(--tw-border-opacity, 1))}.dark\:border-orange-800\/60:is(.dark *){border-color:#9a341299}.dark\:border-pink-800\/60:is(.dark *){border-color:#9d174d99}.dark\:border-purple-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(126 34 206 / var(--tw-border-opacity, 1))}.dark\:border-purple-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(107 33 168 / var(--tw-border-opacity, 1))}.dark\:border-purple-800\/60:is(.dark *){border-color:#6b21a899}.dark\:border-red-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.dark\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.dark\:border-red-800\/60:is(.dark *){border-color:#991b1b99}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-red-900\/40:is(.dark *){border-color:#7f1d1d66}.dark\:border-red-900\/50:is(.dark *){border-color:#7f1d1d80}.dark\:border-red-900\/60:is(.dark *){border-color:#7f1d1d99}.dark\:border-rose-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(190 18 60 / var(--tw-border-opacity, 1))}.dark\:border-rose-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(159 18 57 / var(--tw-border-opacity, 1))}.dark\:border-yellow-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.dark\:border-yellow-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.dark\:border-yellow-800\/60:is(.dark *){border-color:#854d0e99}.dark\:border-zinc-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.dark\:border-zinc-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.dark\:bg-amber-900\/10:is(.dark *){background-color:#78350f1a}.dark\:bg-amber-900\/20:is(.dark *){background-color:#78350f33}.dark\:bg-amber-900\/30:is(.dark *){background-color:#78350f4d}.dark\:bg-amber-900\/40:is(.dark *){background-color:#78350f66}.dark\:bg-amber-900\/50:is(.dark *){background-color:#78350f80}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(132 148 239 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/20:is(.dark *){background-color:#2c357833}.dark\:bg-blue-900\/30:is(.dark *){background-color:#2c35784d}.dark\:bg-blue-900\/40:is(.dark *){background-color:#2c357866}.dark\:bg-blue-900\/50:is(.dark *){background-color:#2c357880}.dark\:bg-blue-900\/60:is(.dark *){background-color:#2c357899}.dark\:bg-cyan-900\/40:is(.dark *){background-color:#164e6366}.dark\:bg-cyan-900\/50:is(.dark *){background-color:#164e6380}.dark\:bg-emerald-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.dark\:bg-emerald-900\/20:is(.dark *){background-color:#064e3b33}.dark\:bg-emerald-900\/40:is(.dark *){background-color:#064e3b66}.dark\:bg-emerald-900\/50:is(.dark *){background-color:#064e3b80}.dark\:bg-fuchsia-900\/40:is(.dark *){background-color:#701a7566}.dark\:bg-gray-500:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700\/40:is(.dark *){background-color:#37415166}.dark\:bg-gray-700\/50:is(.dark *){background-color:#37415180}.dark\:bg-gray-700\/60:is(.dark *){background-color:#37415199}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/20:is(.dark *){background-color:#1f293733}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/40:is(.dark *){background-color:#1f293766}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-800\/60:is(.dark *){background-color:#1f293799}.dark\:bg-gray-800\/80:is(.dark *){background-color:#1f2937cc}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900\/30:is(.dark *){background-color:#1118274d}.dark\:bg-gray-900\/40:is(.dark *){background-color:#11182766}.dark\:bg-gray-900\/50:is(.dark *){background-color:#11182780}.dark\:bg-gray-900\/60:is(.dark *){background-color:#11182799}.dark\:bg-gray-900\/70:is(.dark *){background-color:#111827b3}.dark\:bg-gray-900\/95:is(.dark *){background-color:#111827f2}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950\/50:is(.dark *){background-color:#03071280}.dark\:bg-gray-950\/60:is(.dark *){background-color:#03071299}.dark\:bg-green-900\/20:is(.dark *){background-color:#14532d33}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-900\/40:is(.dark *){background-color:#14532d66}.dark\:bg-green-900\/50:is(.dark *){background-color:#14532d80}.dark\:bg-indigo-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(129 140 248 / var(--tw-bg-opacity, 1))}.dark\:bg-indigo-400\/15:is(.dark *){background-color:#818cf826}.dark\:bg-indigo-900\/20:is(.dark *){background-color:#312e8133}.dark\:bg-indigo-900\/30:is(.dark *){background-color:#312e814d}.dark\:bg-indigo-900\/40:is(.dark *){background-color:#312e8166}.dark\:bg-indigo-900\/50:is(.dark *){background-color:#312e8180}.dark\:bg-orange-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-900\/40:is(.dark *){background-color:#7c2d1266}.dark\:bg-orange-900\/50:is(.dark *){background-color:#7c2d1280}.dark\:bg-pink-900\/40:is(.dark *){background-color:#83184366}.dark\:bg-purple-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.dark\:bg-purple-900\/40:is(.dark *){background-color:#581c8766}.dark\:bg-purple-900\/50:is(.dark *){background-color:#581c8780}.dark\:bg-red-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity, 1))}.dark\:bg-red-900\/20:is(.dark *){background-color:#7f1d1d33}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-900\/40:is(.dark *){background-color:#7f1d1d66}.dark\:bg-red-900\/50:is(.dark *){background-color:#7f1d1d80}.dark\:bg-red-950\/30:is(.dark *){background-color:#450a0a4d}.dark\:bg-rose-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.dark\:bg-rose-900\/20:is(.dark *){background-color:#88133733}.dark\:bg-rose-900\/40:is(.dark *){background-color:#88133766}.dark\:bg-rose-900\/50:is(.dark *){background-color:#88133780}.dark\:bg-sky-900\/40:is(.dark *){background-color:#0c4a6e66}.dark\:bg-teal-900\/40:is(.dark *){background-color:#134e4a66}.dark\:bg-violet-900\/40:is(.dark *){background-color:#4c1d9566}.dark\:bg-yellow-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-500\/30:is(.dark *){background-color:#eab3084d}.dark\:bg-yellow-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-900\/20:is(.dark *){background-color:#713f1233}.dark\:bg-yellow-900\/30:is(.dark *){background-color:#713f124d}.dark\:bg-yellow-900\/40:is(.dark *){background-color:#713f1266}.dark\:bg-yellow-900\/50:is(.dark *){background-color:#713f1280}.dark\:bg-zinc-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.dark\:bg-zinc-900\/50:is(.dark *){background-color:#18181b80}.dark\:bg-zinc-900\/60:is(.dark *){background-color:#18181b99}.dark\:to-gray-900\/30:is(.dark *){--tw-gradient-to: rgb(17 24 39 / .3) var(--tw-gradient-to-position)}.dark\:to-gray-900\/40:is(.dark *){--tw-gradient-to: rgb(17 24 39 / .4) var(--tw-gradient-to-position)}.dark\:text-amber-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(193 200 251 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.dark\:text-cyan-300:is(.dark *){--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.dark\:text-emerald-300:is(.dark *){--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.dark\:text-emerald-400:is(.dark *){--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.dark\:text-fuchsia-300:is(.dark *){--tw-text-opacity: 1;color:rgb(240 171 252 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-green-400\/70:is(.dark *){color:#4ade80b3}.dark\:text-indigo-200:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:text-indigo-300:is(.dark *){--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400\/80:is(.dark *){color:#818cf8cc}.dark\:text-orange-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.dark\:text-pink-300:is(.dark *){--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.dark\:text-purple-300:is(.dark *){--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.dark\:text-red-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.dark\:text-red-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-300\/70:is(.dark *){color:#fca5a5b3}.dark\:text-red-300\/80:is(.dark *){color:#fca5a5cc}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-400\/80:is(.dark *){color:#f87171cc}.dark\:text-rose-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.dark\:text-rose-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.dark\:text-sky-300:is(.dark *){--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.dark\:text-teal-300:is(.dark *){--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity, 1))}.dark\:text-violet-300:is(.dark *){--tw-text-opacity: 1;color:rgb(196 181 253 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100\/70:is(.dark *){color:#fef9c3b3}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-zinc-100:is(.dark *){--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity, 1))}.dark\:text-zinc-200:is(.dark *){--tw-text-opacity: 1;color:rgb(228 228 231 / var(--tw-text-opacity, 1))}.dark\:text-zinc-300:is(.dark *){--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.dark\:text-zinc-400:is(.dark *){--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.dark\:placeholder-gray-600:is(.dark *)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.dark\:placeholder-gray-600:is(.dark *)::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.dark\:accent-indigo-400:is(.dark *){accent-color:#818cf8}.dark\:hover\:border-gray-500:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.dark\:hover\:border-gray-600:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:hover\:border-gray-700:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:hover\:border-zinc-700:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700\/50:hover:is(.dark *){background-color:#37415180}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-800\/30:hover:is(.dark *){background-color:#1f29374d}.dark\:hover\:bg-gray-800\/40:hover:is(.dark *){background-color:#1f293766}.dark\:hover\:bg-gray-800\/50:hover:is(.dark *){background-color:#1f293780}.dark\:hover\:bg-gray-800\/60:hover:is(.dark *){background-color:#1f293799}.dark\:hover\:bg-gray-900\/70:hover:is(.dark *){background-color:#111827b3}.dark\:hover\:bg-indigo-900\/20:hover:is(.dark *){background-color:#312e8133}.dark\:hover\:bg-indigo-900\/30:hover:is(.dark *){background-color:#312e814d}.dark\:hover\:bg-red-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900\/20:hover:is(.dark *){background-color:#7f1d1d33}.dark\:hover\:bg-red-900\/30:hover:is(.dark *){background-color:#7f1d1d4d}.dark\:hover\:bg-red-900\/70:hover:is(.dark *){background-color:#7f1d1db3}.dark\:hover\:bg-yellow-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-zinc-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-gray-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-300:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:hover\:text-indigo-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(224 231 255 / var(--tw-text-opacity, 1))}.dark\:hover\:text-indigo-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:hover\:text-red-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.dark\:hover\:text-red-300:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:hover\:text-white:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:hover\:text-yellow-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800\/40:focus:is(.dark *){background-color:#1f293766}.dark\:focus\:bg-gray-800\/50:focus:is(.dark *){background-color:#1f293780}.dark\:focus\:bg-gray-800\/60:focus:is(.dark *){background-color:#1f293799}.dark\:focus\:bg-red-900\/20:focus:is(.dark *){background-color:#7f1d1d33}.dark\:focus\:text-indigo-200:focus:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:focus-visible\:ring-gray-600:focus-visible:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity, 1))}.dark\:disabled\:bg-gray-700:disabled:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:prose-headings\:text-gray-200 :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:prose-p\:text-gray-300 :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-blockquote\:border-gray-700 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:prose-blockquote\:text-gray-400 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:prose-strong\:text-gray-200 :is(:where(strong):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:prose-code\:bg-gray-800 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:prose-code\:text-blue-300 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.dark\:prose-li\:text-gray-300 :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-th\:text-gray-300 :is(:where(th):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-td\:text-gray-400 :is(:where(td):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:prose-hr\:border-gray-700 :is(:where(hr):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}@media(min-width:640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[1fr_auto_1fr_auto\]{grid-template-columns:1fr auto 1fr auto}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}}@media(min-width:768px){.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:inline{display:inline}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:border-b-0{border-bottom-width:0px}.lg\:border-r{border-right-width:1px}}@media(min-width:1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}} diff --git a/stackunderflow/static/react/assets/index-DL9ELn-S.css b/stackunderflow/static/react/assets/index-DL9ELn-S.css deleted file mode 100644 index b3b0e47..0000000 --- a/stackunderflow/static/react/assets/index-DL9ELn-S.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(102 126 234 / .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(102 126 234 / .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}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px var(--tw-prose-kbd-shadows),0 3px 0 var(--tw-prose-kbd-shadows);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: rgb(17 24 39 / 10%);--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: rgb(255 255 255 / 10%);--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-sm{font-size:.875rem;line-height:1.7142857}.prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.3333333em;margin-bottom:1.3333333em;padding-inline-start:1.1111111em}.prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;border-radius:.3125rem;padding-top:.1428571em;padding-inline-end:.3571429em;padding-bottom:.1428571em;padding-inline-start:.3571429em}.prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em}.prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}.prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8888889em}.prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;margin-bottom:.2857143em}.prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;padding-inline-start:1.5714286em}.prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.8571429em;margin-bottom:2.8571429em}.prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.5}.prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-invert{--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.right-0{right:0}.top-0{top:0}.top-1\/2{top:50%}.top-5{top:1.25rem}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-mr-0\.5{margin-right:-.125rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-64{height:16rem}.h-8{height:2rem}.h-80{height:20rem}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-full{height:100%}.h-screen{height:100vh}.max-h-24{max-height:6rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[300px\]{max-height:300px}.max-h-\[500px\]{max-height:500px}.max-h-\[70vh\]{max-height:70vh}.min-h-0{min-height:0px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-80{width:20rem}.w-96{width:24rem}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-\[120px\]{max-width:120px}.max-w-\[12rem\]{max-width:12rem}.max-w-\[16rem\]{max-width:16rem}.max-w-\[180px\]{max-width:180px}.max-w-\[18rem\]{max-width:18rem}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-\[40\%\]{max-width:40%}.max-w-\[85\%\]{max-width:85%}.max-w-\[95\%\]{max-width:95%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x: -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))}.-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))}.rotate-90{--tw-rotate: 90deg;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-auto{cursor:auto}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.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-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1{row-gap:.25rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-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-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-x>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.divide-indigo-900\/20>:not([hidden])~:not([hidden]){border-color:#312e8133}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.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-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-300{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-600\/50{border-color:#d9770680}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(193 200 251 / var(--tw-border-opacity, 1))}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(162 173 249 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(102 126 234 / var(--tw-border-opacity, 1))}.border-blue-500\/30{border-color:#667eea4d}.border-cyan-300{--tw-border-opacity: 1;border-color:rgb(103 232 249 / var(--tw-border-opacity, 1))}.border-emerald-300{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.border-emerald-400{--tw-border-opacity: 1;border-color:rgb(52 211 153 / var(--tw-border-opacity, 1))}.border-emerald-500\/30{border-color:#10b9814d}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-100\/30{border-color:#f3f4f64d}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-200\/50{border-color:#e5e7eb80}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-800{--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.border-indigo-300{--tw-border-opacity: 1;border-color:rgb(165 180 252 / var(--tw-border-opacity, 1))}.border-indigo-400{--tw-border-opacity: 1;border-color:rgb(129 140 248 / var(--tw-border-opacity, 1))}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/40{border-color:#6366f166}.border-indigo-500\/50{border-color:#6366f180}.border-indigo-500\/60{border-color:#6366f199}.border-indigo-700{--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity, 1))}.border-indigo-800\/60{border-color:#3730a399}.border-indigo-900\/30{border-color:#312e814d}.border-indigo-900\/40{border-color:#312e8166}.border-indigo-900\/50{border-color:#312e8180}.border-orange-300{--tw-border-opacity: 1;border-color:rgb(253 186 116 / var(--tw-border-opacity, 1))}.border-pink-300{--tw-border-opacity: 1;border-color:rgb(249 168 212 / var(--tw-border-opacity, 1))}.border-purple-300{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity, 1))}.border-purple-500\/30{border-color:#a855f74d}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-red-900\/30{border-color:#7f1d1d4d}.border-red-900\/40{border-color:#7f1d1d66}.border-rose-300{--tw-border-opacity: 1;border-color:rgb(253 164 175 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity, 1))}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity, 1))}.border-yellow-800{--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.border-zinc-200{--tw-border-opacity: 1;border-color:rgb(228 228 231 / var(--tw-border-opacity, 1))}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(102 126 234 / var(--tw-border-opacity, 1))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-50\/60{background-color:#fffbeb99}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-600\/20{background-color:#d9770633}.bg-black\/60{background-color:#0009}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(224 228 253 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(240 241 254 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(102 126 234 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#667eea1a}.bg-blue-500\/20{background-color:#667eea33}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(90 111 216 / var(--tw-bg-opacity, 1))}.bg-cyan-100{--tw-bg-opacity: 1;background-color:rgb(207 250 254 / var(--tw-bg-opacity, 1))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-emerald-100{--tw-bg-opacity: 1;background-color:rgb(209 250 229 / var(--tw-bg-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / 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\/20{background-color:#10b98133}.bg-fuchsia-100{--tw-bg-opacity: 1;background-color:rgb(250 232 255 / var(--tw-bg-opacity, 1))}.bg-fuchsia-500{--tw-bg-opacity: 1;background-color:rgb(217 70 239 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-100\/40{background-color:#f3f4f666}.bg-gray-100\/50{background-color:#f3f4f680}.bg-gray-100\/60{background-color:#f3f4f699}.bg-gray-100\/70{background-color:#f3f4f6b3}.bg-gray-100\/80{background-color:#f3f4f6cc}.bg-gray-100\/90{background-color:#f3f4f6e6}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-200\/40{background-color:#e5e7eb66}.bg-gray-200\/50{background-color:#e5e7eb80}.bg-gray-200\/60{background-color:#e5e7eb99}.bg-gray-200\/80{background-color:#e5e7ebcc}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\/30{background-color:#f9fafb4d}.bg-gray-50\/40{background-color:#f9fafb66}.bg-gray-50\/50{background-color:#f9fafb80}.bg-gray-50\/60{background-color:#f9fafb99}.bg-gray-50\/70{background-color:#f9fafbb3}.bg-gray-50\/80{background-color:#f9fafbcc}.bg-gray-50\/95{background-color:#f9fafbf2}.bg-gray-500\/10{background-color:#6b72801a}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-indigo-50\/70{background-color:#eef2ffb3}.bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-500\/15{background-color:#6366f126}.bg-indigo-500\/20{background-color:#6366f133}.bg-indigo-500\/25{background-color:#6366f140}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-950\/30{background-color:#1e1b4b4d}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(252 231 243 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / 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\/70{background-color:#ef4444b3}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-rose-100{--tw-bg-opacity: 1;background-color:rgb(255 228 230 / var(--tw-bg-opacity, 1))}.bg-rose-50{--tw-bg-opacity: 1;background-color:rgb(255 241 242 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-sky-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-teal-100{--tw-bg-opacity: 1;background-color:rgb(204 251 241 / var(--tw-bg-opacity, 1))}.bg-teal-500{--tw-bg-opacity: 1;background-color:rgb(20 184 166 / var(--tw-bg-opacity, 1))}.bg-violet-100{--tw-bg-opacity: 1;background-color:rgb(237 233 254 / var(--tw-bg-opacity, 1))}.bg-violet-500{--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity, 1))}.bg-violet-600{--tw-bg-opacity: 1;background-color:rgb(124 58 237 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-zinc-50\/50{background-color:#fafafa80}.bg-zinc-50\/60{background-color:#fafafa99}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-indigo-900\/30{--tw-gradient-from: rgb(49 46 129 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-900\/40{--tw-gradient-from: rgb(49 46 129 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900\/20{--tw-gradient-from: rgb(127 29 29 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900\/30{--tw-gradient-from: rgb(127 29 29 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-50\/50{--tw-gradient-to: rgb(249 250 251 / .5) var(--tw-gradient-to-position)}.to-gray-50\/60{--tw-gradient-to: rgb(249 250 251 / .6) var(--tw-gradient-to-position)}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.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-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-1\.5{padding-bottom:.375rem}.pb-2{padding-bottom:.5rem}.pb-2\.5{padding-bottom:.625rem}.pb-3{padding-bottom:.75rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-6{padding-right:1.5rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[9px\]{font-size:9px}.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}.normal-case{text-transform:none}.italic{font-style:italic}.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}.leading-snug{line-height:1.375}.tracking-normal{letter-spacing:0em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-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-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(193 200 251 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.text-blue-400\/70{color:#8494efb3}.text-blue-500{--tw-text-opacity: 1;color:rgb(102 126 234 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(90 111 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(59 71 152 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-800{--tw-text-opacity: 1;color:rgb(21 94 117 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/80{color:#34d399cc}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-emerald-800{--tw-text-opacity: 1;color:rgb(6 95 70 / var(--tw-text-opacity, 1))}.text-fuchsia-800{--tw-text-opacity: 1;color:rgb(134 25 143 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-600\/70{color:#16a34ab3}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-indigo-200{--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-indigo-600\/80{color:#4f46e5cc}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-indigo-800{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-pink-800{--tw-text-opacity: 1;color:rgb(157 23 77 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-400\/70{color:#c084fcb3}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / 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-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-700\/80{color:#b91c1ccc}.text-red-700\/90{color:#b91c1ce6}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-rose-700{--tw-text-opacity: 1;color:rgb(190 18 60 / var(--tw-text-opacity, 1))}.text-rose-800{--tw-text-opacity: 1;color:rgb(159 18 57 / var(--tw-text-opacity, 1))}.text-sky-800{--tw-text-opacity: 1;color:rgb(7 89 133 / var(--tw-text-opacity, 1))}.text-teal-800{--tw-text-opacity: 1;color:rgb(17 94 89 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-violet-800{--tw-text-opacity: 1;color:rgb(91 33 182 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.text-yellow-900\/70{color:#713f12b3}.text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.text-zinc-600{--tw-text-opacity: 1;color:rgb(82 82 91 / var(--tw-text-opacity, 1))}.text-zinc-700{--tw-text-opacity: 1;color:rgb(63 63 70 / var(--tw-text-opacity, 1))}.text-zinc-800{--tw-text-opacity: 1;color:rgb(39 39 42 / var(--tw-text-opacity, 1))}.text-zinc-900{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-zinc-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(113 113 122 / var(--tw-placeholder-opacity, 1))}.placeholder-zinc-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(113 113 122 / var(--tw-placeholder-opacity, 1))}.accent-indigo-500{accent-color:#6366f1}.accent-indigo-600{accent-color:#4f46e5}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-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)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--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(3px + 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-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-2{--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)}.ring-indigo-400\/70{--tw-ring-color: rgb(129 140 248 / .7)}.ring-indigo-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.ring-indigo-500\/40{--tw-ring-color: rgb(99 102 241 / .4)}.ring-red-500\/70{--tw-ring-color: rgb(239 68 68 / .7)}.\!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)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[suf\:beta\]{suf:beta}.\[suf\:tabs\]{suf:tabs}.\[suf\:theme\]{suf:theme}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#f3f4f6}::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#9ca3af}html.dark ::-webkit-scrollbar-track{background:#111827}html.dark ::-webkit-scrollbar-thumb{background:#374151}html.dark ::-webkit-scrollbar-thumb:hover{background:#4b5563}pre code{font-family:JetBrains Mono,Fira Code,Monaco,Consolas,monospace}.prose-invert{--tw-prose-body: rgb(55 65 81);--tw-prose-headings: rgb(17 24 39);--tw-prose-links: rgb(67 56 202);--tw-prose-bold: rgb(17 24 39);--tw-prose-counters: rgb(107 114 128);--tw-prose-bullets: rgb(156 163 175);--tw-prose-hr: rgb(229 231 235);--tw-prose-quotes: rgb(17 24 39);--tw-prose-quote-borders: rgb(229 231 235);--tw-prose-captions: rgb(107 114 128);--tw-prose-code: rgb(29 78 216);--tw-prose-pre-code: rgb(55 65 81);--tw-prose-pre-bg: rgb(243 244 246);--tw-prose-th-borders: rgb(229 231 235);--tw-prose-td-borders: rgb(243 244 246)}html.dark .prose-invert{--tw-prose-body: rgb(209 213 219);--tw-prose-headings: rgb(243 244 246);--tw-prose-links: rgb(96 165 250);--tw-prose-bold: rgb(243 244 246);--tw-prose-counters: rgb(156 163 175);--tw-prose-bullets: rgb(107 114 128);--tw-prose-hr: rgb(55 65 81);--tw-prose-quotes: rgb(243 244 246);--tw-prose-quote-borders: rgb(55 65 81);--tw-prose-captions: rgb(156 163 175);--tw-prose-code: rgb(147 197 253);--tw-prose-pre-code: rgb(209 213 219);--tw-prose-pre-bg: rgb(17 24 39);--tw-prose-th-borders: rgb(55 65 81);--tw-prose-td-borders: rgb(31 41 55)}.animate-spin{transition:none}.first\:pt-0:first-child{padding-top:0}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.hover\:h-2\.5:hover{height:.625rem}.hover\:w-2\.5:hover{width:.625rem}.hover\:border-gray-200:hover{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:border-zinc-200:hover{--tw-border-opacity: 1;border-color:rgb(228 228 231 / var(--tw-border-opacity, 1))}.hover\:bg-amber-500\/25:hover{background-color:#f59e0b40}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(102 126 234 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/30:hover{background-color:#667eea4d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(74 90 184 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/30:hover{background-color:#10b9814d}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100\/50:hover{background-color:#f3f4f680}.hover\:bg-gray-100\/60:hover{background-color:#f3f4f699}.hover\:bg-gray-100\/70:hover{background-color:#f3f4f6b3}.hover\:bg-gray-100\/80:hover{background-color:#f3f4f6cc}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200\/70:hover{background-color:#e5e7ebb3}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50\/70:hover{background-color:#f9fafbb3}.hover\:bg-indigo-50:hover{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500\/30:hover{background-color:#6366f14d}.hover\:bg-indigo-600:hover{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/25:hover{background-color:#a855f740}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-300:hover{--tw-bg-opacity: 1;background-color:rgb(252 165 165 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:bg-zinc-200:hover{--tw-bg-opacity: 1;background-color:rgb(228 228 231 / var(--tw-bg-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-800:hover{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-indigo-400:hover{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.hover\:text-indigo-800:hover{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.hover\:text-indigo-900:hover{--tw-text-opacity: 1;color:rgb(49 46 129 / 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\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-red-800:hover{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.hover\:text-yellow-900:hover{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);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)}.hover\:brightness-125:hover{--tw-brightness: brightness(1.25);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(102 126 234 / var(--tw-border-opacity, 1))}.focus\:border-blue-600:focus{--tw-border-opacity: 1;border-color:rgb(90 111 216 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:border-zinc-500:focus{--tw-border-opacity: 1;border-color:rgb(113 113 122 / var(--tw-border-opacity, 1))}.focus\:bg-gray-100\/60:focus{background-color:#f3f4f699}.focus\:bg-gray-100\/70:focus{background-color:#f3f4f6b3}.focus\:bg-gray-100\/80:focus{background-color:#f3f4f6cc}.focus\:bg-red-100:focus{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.focus\:text-indigo-800:focus{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1: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(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)}.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-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(90 111 216 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/60:focus{--tw-ring-color: rgb(99 102 241 / .6)}.focus\:ring-offset-0:focus{--tw-ring-offset-width: 0px}.focus-visible\:ring-1:focus-visible{--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)}.focus-visible\:ring-2:focus-visible{--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-visible\:ring-blue-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(102 126 234 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-gray-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(156 163 175 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(129 140 248 / var(--tw-ring-opacity, 1))}.disabled\:cursor-default:disabled{cursor:default}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.disabled\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\:text-gray-500:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:opacity-100{opacity:1}.prose-headings\:font-semibold :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){font-weight:600}.prose-headings\:text-gray-800 :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.prose-p\:leading-relaxed :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){line-height:1.625}.prose-p\:text-gray-700 :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-a\:text-blue-400 :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.prose-a\:no-underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:none}.hover\:prose-a\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))):hover{text-decoration-line:underline}.prose-blockquote\:border-gray-300 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.prose-blockquote\:text-gray-600 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.prose-strong\:text-gray-800 :is(:where(strong):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.prose-code\:rounded :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){border-radius:.25rem}.prose-code\:bg-gray-100 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.prose-code\:px-1 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){padding-left:.25rem;padding-right:.25rem}.prose-code\:py-0\.5 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){padding-top:.125rem;padding-bottom:.125rem}.prose-code\:text-xs :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){font-size:.75rem;line-height:1rem}.prose-code\:text-blue-700 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(74 90 184 / var(--tw-text-opacity, 1))}.prose-code\:before\:content-none :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):before{--tw-content: none;content:var(--tw-content)}.prose-code\:after\:content-none :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):after{--tw-content: none;content:var(--tw-content)}.prose-pre\:bg-transparent :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){background-color:transparent}.prose-pre\:p-0 :is(:where(pre):not(:where([class~=not-prose],[class~=not-prose] *))){padding:0}.prose-li\:text-gray-700 :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-th\:text-gray-700 :is(:where(th):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.prose-td\:text-gray-600 :is(:where(td):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.prose-hr\:border-gray-300 :is(:where(hr):not(:where([class~=not-prose],[class~=not-prose] *))){--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.dark\:divide-gray-800:is(.dark *)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity, 1))}.dark\:border-amber-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(180 83 9 / var(--tw-border-opacity, 1))}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-amber-800\/60:is(.dark *){border-color:#92400e99}.dark\:border-amber-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 53 15 / var(--tw-border-opacity, 1))}.dark\:border-amber-900\/30:is(.dark *){border-color:#78350f4d}.dark\:border-amber-900\/40:is(.dark *){border-color:#78350f66}.dark\:border-amber-900\/50:is(.dark *){border-color:#78350f80}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(74 90 184 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(59 71 152 / var(--tw-border-opacity, 1))}.dark\:border-blue-800\/60:is(.dark *){border-color:#3b479899}.dark\:border-cyan-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(14 116 144 / var(--tw-border-opacity, 1))}.dark\:border-cyan-800\/60:is(.dark *){border-color:#155e7599}.dark\:border-emerald-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.dark\:border-emerald-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity, 1))}.dark\:border-emerald-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(6 95 70 / var(--tw-border-opacity, 1))}.dark\:border-gray-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-gray-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.dark\:border-gray-800\/30:is(.dark *){border-color:#1f29374d}.dark\:border-gray-800\/50:is(.dark *){border-color:#1f293780}.dark\:border-gray-800\/70:is(.dark *){border-color:#1f2937b3}.dark\:border-green-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-800\/60:is(.dark *){border-color:#16653499}.dark\:border-indigo-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.dark\:border-indigo-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity, 1))}.dark\:border-indigo-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 48 163 / var(--tw-border-opacity, 1))}.dark\:border-indigo-800\/60:is(.dark *){border-color:#3730a399}.dark\:border-orange-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(154 52 18 / var(--tw-border-opacity, 1))}.dark\:border-orange-800\/60:is(.dark *){border-color:#9a341299}.dark\:border-pink-800\/60:is(.dark *){border-color:#9d174d99}.dark\:border-purple-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(126 34 206 / var(--tw-border-opacity, 1))}.dark\:border-purple-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(107 33 168 / var(--tw-border-opacity, 1))}.dark\:border-purple-800\/60:is(.dark *){border-color:#6b21a899}.dark\:border-red-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.dark\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.dark\:border-red-800\/60:is(.dark *){border-color:#991b1b99}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-red-900\/40:is(.dark *){border-color:#7f1d1d66}.dark\:border-red-900\/50:is(.dark *){border-color:#7f1d1d80}.dark\:border-red-900\/60:is(.dark *){border-color:#7f1d1d99}.dark\:border-rose-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(190 18 60 / var(--tw-border-opacity, 1))}.dark\:border-rose-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(159 18 57 / var(--tw-border-opacity, 1))}.dark\:border-yellow-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.dark\:border-yellow-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(133 77 14 / var(--tw-border-opacity, 1))}.dark\:border-yellow-800\/60:is(.dark *){border-color:#854d0e99}.dark\:border-zinc-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.dark\:border-zinc-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1))}.dark\:bg-amber-900\/10:is(.dark *){background-color:#78350f1a}.dark\:bg-amber-900\/20:is(.dark *){background-color:#78350f33}.dark\:bg-amber-900\/30:is(.dark *){background-color:#78350f4d}.dark\:bg-amber-900\/40:is(.dark *){background-color:#78350f66}.dark\:bg-amber-900\/50:is(.dark *){background-color:#78350f80}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(132 148 239 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/20:is(.dark *){background-color:#2c357833}.dark\:bg-blue-900\/30:is(.dark *){background-color:#2c35784d}.dark\:bg-blue-900\/40:is(.dark *){background-color:#2c357866}.dark\:bg-blue-900\/50:is(.dark *){background-color:#2c357880}.dark\:bg-blue-900\/60:is(.dark *){background-color:#2c357899}.dark\:bg-cyan-900\/40:is(.dark *){background-color:#164e6366}.dark\:bg-cyan-900\/50:is(.dark *){background-color:#164e6380}.dark\:bg-emerald-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.dark\:bg-emerald-900\/20:is(.dark *){background-color:#064e3b33}.dark\:bg-emerald-900\/40:is(.dark *){background-color:#064e3b66}.dark\:bg-emerald-900\/50:is(.dark *){background-color:#064e3b80}.dark\:bg-fuchsia-900\/40:is(.dark *){background-color:#701a7566}.dark\:bg-gray-500:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700\/40:is(.dark *){background-color:#37415166}.dark\:bg-gray-700\/50:is(.dark *){background-color:#37415180}.dark\:bg-gray-700\/60:is(.dark *){background-color:#37415199}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/20:is(.dark *){background-color:#1f293733}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/40:is(.dark *){background-color:#1f293766}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-800\/60:is(.dark *){background-color:#1f293799}.dark\:bg-gray-800\/80:is(.dark *){background-color:#1f2937cc}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900\/30:is(.dark *){background-color:#1118274d}.dark\:bg-gray-900\/40:is(.dark *){background-color:#11182766}.dark\:bg-gray-900\/50:is(.dark *){background-color:#11182780}.dark\:bg-gray-900\/60:is(.dark *){background-color:#11182799}.dark\:bg-gray-900\/70:is(.dark *){background-color:#111827b3}.dark\:bg-gray-900\/95:is(.dark *){background-color:#111827f2}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950\/50:is(.dark *){background-color:#03071280}.dark\:bg-gray-950\/60:is(.dark *){background-color:#03071299}.dark\:bg-green-900\/20:is(.dark *){background-color:#14532d33}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-900\/40:is(.dark *){background-color:#14532d66}.dark\:bg-green-900\/50:is(.dark *){background-color:#14532d80}.dark\:bg-indigo-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(129 140 248 / var(--tw-bg-opacity, 1))}.dark\:bg-indigo-400\/15:is(.dark *){background-color:#818cf826}.dark\:bg-indigo-900\/20:is(.dark *){background-color:#312e8133}.dark\:bg-indigo-900\/30:is(.dark *){background-color:#312e814d}.dark\:bg-indigo-900\/40:is(.dark *){background-color:#312e8166}.dark\:bg-indigo-900\/50:is(.dark *){background-color:#312e8180}.dark\:bg-orange-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-900\/40:is(.dark *){background-color:#7c2d1266}.dark\:bg-orange-900\/50:is(.dark *){background-color:#7c2d1280}.dark\:bg-pink-900\/40:is(.dark *){background-color:#83184366}.dark\:bg-purple-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.dark\:bg-purple-900\/40:is(.dark *){background-color:#581c8766}.dark\:bg-purple-900\/50:is(.dark *){background-color:#581c8780}.dark\:bg-red-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity, 1))}.dark\:bg-red-900\/20:is(.dark *){background-color:#7f1d1d33}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-900\/40:is(.dark *){background-color:#7f1d1d66}.dark\:bg-red-900\/50:is(.dark *){background-color:#7f1d1d80}.dark\:bg-red-950\/30:is(.dark *){background-color:#450a0a4d}.dark\:bg-rose-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.dark\:bg-rose-900\/20:is(.dark *){background-color:#88133733}.dark\:bg-rose-900\/40:is(.dark *){background-color:#88133766}.dark\:bg-rose-900\/50:is(.dark *){background-color:#88133780}.dark\:bg-sky-900\/40:is(.dark *){background-color:#0c4a6e66}.dark\:bg-teal-900\/40:is(.dark *){background-color:#134e4a66}.dark\:bg-violet-900\/40:is(.dark *){background-color:#4c1d9566}.dark\:bg-yellow-400:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-500\/30:is(.dark *){background-color:#eab3084d}.dark\:bg-yellow-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-900\/20:is(.dark *){background-color:#713f1233}.dark\:bg-yellow-900\/30:is(.dark *){background-color:#713f124d}.dark\:bg-yellow-900\/40:is(.dark *){background-color:#713f1266}.dark\:bg-yellow-900\/50:is(.dark *){background-color:#713f1280}.dark\:bg-zinc-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity, 1))}.dark\:bg-zinc-900\/50:is(.dark *){background-color:#18181b80}.dark\:bg-zinc-900\/60:is(.dark *){background-color:#18181b99}.dark\:to-gray-900\/30:is(.dark *){--tw-gradient-to: rgb(17 24 39 / .3) var(--tw-gradient-to-position)}.dark\:to-gray-900\/40:is(.dark *){--tw-gradient-to: rgb(17 24 39 / .4) var(--tw-gradient-to-position)}.dark\:text-amber-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(193 200 251 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(132 148 239 / var(--tw-text-opacity, 1))}.dark\:text-cyan-300:is(.dark *){--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.dark\:text-emerald-300:is(.dark *){--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.dark\:text-emerald-400:is(.dark *){--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.dark\:text-fuchsia-300:is(.dark *){--tw-text-opacity: 1;color:rgb(240 171 252 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-green-400\/70:is(.dark *){color:#4ade80b3}.dark\:text-indigo-200:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:text-indigo-300:is(.dark *){--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400\/80:is(.dark *){color:#818cf8cc}.dark\:text-orange-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.dark\:text-pink-300:is(.dark *){--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.dark\:text-purple-300:is(.dark *){--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.dark\:text-red-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.dark\:text-red-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-300\/70:is(.dark *){color:#fca5a5b3}.dark\:text-red-300\/80:is(.dark *){color:#fca5a5cc}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-400\/80:is(.dark *){color:#f87171cc}.dark\:text-rose-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.dark\:text-rose-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.dark\:text-sky-300:is(.dark *){--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.dark\:text-teal-300:is(.dark *){--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity, 1))}.dark\:text-violet-300:is(.dark *){--tw-text-opacity: 1;color:rgb(196 181 253 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100\/70:is(.dark *){color:#fef9c3b3}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-zinc-100:is(.dark *){--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity, 1))}.dark\:text-zinc-200:is(.dark *){--tw-text-opacity: 1;color:rgb(228 228 231 / var(--tw-text-opacity, 1))}.dark\:text-zinc-300:is(.dark *){--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity, 1))}.dark\:text-zinc-400:is(.dark *){--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.dark\:placeholder-gray-600:is(.dark *)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.dark\:placeholder-gray-600:is(.dark *)::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.dark\:accent-indigo-400:is(.dark *){accent-color:#818cf8}.dark\:hover\:border-gray-500:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.dark\:hover\:border-gray-600:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:hover\:border-gray-700:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:hover\:border-zinc-700:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700\/50:hover:is(.dark *){background-color:#37415180}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-800\/30:hover:is(.dark *){background-color:#1f29374d}.dark\:hover\:bg-gray-800\/40:hover:is(.dark *){background-color:#1f293766}.dark\:hover\:bg-gray-800\/50:hover:is(.dark *){background-color:#1f293780}.dark\:hover\:bg-gray-800\/60:hover:is(.dark *){background-color:#1f293799}.dark\:hover\:bg-gray-900\/70:hover:is(.dark *){background-color:#111827b3}.dark\:hover\:bg-indigo-900\/20:hover:is(.dark *){background-color:#312e8133}.dark\:hover\:bg-indigo-900\/30:hover:is(.dark *){background-color:#312e814d}.dark\:hover\:bg-red-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900\/20:hover:is(.dark *){background-color:#7f1d1d33}.dark\:hover\:bg-red-900\/30:hover:is(.dark *){background-color:#7f1d1d4d}.dark\:hover\:bg-red-900\/70:hover:is(.dark *){background-color:#7f1d1db3}.dark\:hover\:bg-yellow-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-zinc-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-gray-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-300:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:hover\:text-gray-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:hover\:text-indigo-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(224 231 255 / var(--tw-text-opacity, 1))}.dark\:hover\:text-indigo-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:hover\:text-red-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.dark\:hover\:text-red-300:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:hover\:text-white:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:hover\:text-yellow-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800\/40:focus:is(.dark *){background-color:#1f293766}.dark\:focus\:bg-gray-800\/50:focus:is(.dark *){background-color:#1f293780}.dark\:focus\:bg-gray-800\/60:focus:is(.dark *){background-color:#1f293799}.dark\:focus\:bg-red-900\/20:focus:is(.dark *){background-color:#7f1d1d33}.dark\:focus\:text-indigo-200:focus:is(.dark *){--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity, 1))}.dark\:focus-visible\:ring-gray-600:focus-visible:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity, 1))}.dark\:disabled\:bg-gray-700:disabled:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:prose-headings\:text-gray-200 :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:prose-p\:text-gray-300 :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-blockquote\:border-gray-700 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:prose-blockquote\:text-gray-400 :is(:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:prose-strong\:text-gray-200 :is(:where(strong):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:prose-code\:bg-gray-800 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:prose-code\:text-blue-300 :is(:where(code):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(162 173 249 / var(--tw-text-opacity, 1))}.dark\:prose-li\:text-gray-300 :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-th\:text-gray-300 :is(:where(th):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:prose-td\:text-gray-400 :is(:where(td):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:prose-hr\:border-gray-700 :is(:where(hr):not(:where([class~=not-prose],[class~=not-prose] *))):is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}@media(min-width:640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[1fr_auto_1fr_auto\]{grid-template-columns:1fr auto 1fr auto}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}}@media(min-width:768px){.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:inline{display:inline}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:border-b-0{border-bottom-width:0px}.lg\:border-r{border-right-width:1px}}@media(min-width:1280px){.xl\:col-span-4{grid-column:span 4 / span 4}.xl\:col-span-8{grid-column:span 8 / span 8}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}} diff --git a/stackunderflow/static/react/index.html b/stackunderflow/static/react/index.html index e247932..933ac0f 100644 --- a/stackunderflow/static/react/index.html +++ b/stackunderflow/static/react/index.html @@ -5,9 +5,9 @@ StackUnderflow - + - +