@arbidocs/react 0.3.108 → 0.3.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,43 @@
1
1
  import * as React from 'react';
2
- import React__default, { createContext, forwardRef, useMemo, useContext, useState, useRef, useCallback, useEffect } from 'react';
3
- import { Arbi, resolveCitations, summarizeCitations } from '@arbidocs/sdk/browser';
2
+ import React__default, { createContext, memo, useState, forwardRef, useMemo, useCallback, useId, useRef, useContext, useEffect } from 'react';
3
+ import { Arbi, connectWithReconnect, resolveCitations, summarizeCitations } from '@arbidocs/sdk/browser';
4
4
  export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { useQuery, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
7
- import { createPortal } from 'react-dom';
6
+ import { useQuery, useMutation, QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
7
+ import { Trash2, CheckCheck, Check, Circle, X, ChevronRight, ChevronDown, ChevronUp, Search, MoreVertical, MessageCircleMore, Bot, Calendar, Folder, StickyNote, Hash, List, SquareCheckBig, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image, CornerDownLeft, Send, Tags, Crown, Eye, FolderOpen, Package } from 'lucide-react';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
10
+ import { isMessageType } from '@arbidocs/client';
11
+ export { isMessageType } from '@arbidocs/client';
12
+ import { create } from 'zustand';
13
+ import { createPortal } from 'react-dom';
10
14
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
11
15
  import { cva } from 'class-variance-authority';
12
16
  import { Slot } from '@radix-ui/react-slot';
13
17
  import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
18
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
19
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
20
+ import * as ProgressPrimitive from '@radix-ui/react-progress';
21
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
22
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
23
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
24
+ import * as SwitchPrimitives from '@radix-ui/react-switch';
25
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
26
+ import * as SliderPrimitive from '@radix-ui/react-slider';
27
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
28
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
29
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
30
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
31
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
32
+ import * as SelectPrimitive from '@radix-ui/react-select';
33
+ import { Command as Command$1 } from 'cmdk';
14
34
  import { diffWords } from 'diff';
15
35
  import ReactMarkdown from 'react-markdown';
16
36
  import remarkGfm from 'remark-gfm';
17
37
  import rehypeRaw from 'rehype-raw';
18
- import { MoreVertical, Loader2, AlertTriangle, ShieldCheck, Check, Copy, Sparkles, FileText, GitCompareArrows, Download, Search, CornerDownLeft, Send, Tags, Eye, FolderOpen, Bot, Calendar, Folder, StickyNote, Hash, List, SquareCheckBig, Package, X } from 'lucide-react';
19
38
  import { AnimatePresence, motion } from 'framer-motion';
20
39
  import { AgGridReact } from 'ag-grid-react';
21
40
  import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
22
- import { create } from 'zustand';
23
41
 
24
42
  // src/ArbiProvider.tsx
25
43
  var ArbiContext = createContext(null);
@@ -1243,6 +1261,256 @@ function ArbiChat({
1243
1261
  function cn(...inputs) {
1244
1262
  return twMerge(clsx(inputs));
1245
1263
  }
1264
+ var TypingIndicator = memo(function TypingIndicator2() {
1265
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full justify-start mb-2", children: /* @__PURE__ */ jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 items-center", children: [
1266
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]" }),
1267
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]" }),
1268
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]" })
1269
+ ] }) }) });
1270
+ });
1271
+ var ChatBubble = memo(function ChatBubble2({
1272
+ message,
1273
+ timestamp,
1274
+ isSent,
1275
+ deleted,
1276
+ read,
1277
+ onDelete,
1278
+ isLastOfRun = true,
1279
+ renderMessage = (m) => m,
1280
+ formatTimestamp = (t) => t
1281
+ }) {
1282
+ const [isHovered, setIsHovered] = useState(false);
1283
+ const [isFocused, setIsFocused] = useState(false);
1284
+ const showDeleteButton = isHovered || isFocused;
1285
+ if (deleted) {
1286
+ return /* @__PURE__ */ jsx("div", { className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`, children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" }) });
1287
+ }
1288
+ const bubbleRadius = cn(
1289
+ "rounded-2xl",
1290
+ isSent && isLastOfRun && "rounded-br-md",
1291
+ !isSent && isLastOfRun && "rounded-bl-md"
1292
+ );
1293
+ return /* @__PURE__ */ jsxs(
1294
+ "div",
1295
+ {
1296
+ className: cn(
1297
+ "flex w-full items-end",
1298
+ isLastOfRun ? "mb-2" : "mb-0.5",
1299
+ isSent ? "justify-end" : "justify-start"
1300
+ ),
1301
+ onMouseEnter: () => setIsHovered(true),
1302
+ onMouseLeave: () => setIsHovered(false),
1303
+ children: [
1304
+ isSent && onDelete && /* @__PURE__ */ jsx(
1305
+ "button",
1306
+ {
1307
+ onClick: onDelete,
1308
+ onFocus: () => setIsFocused(true),
1309
+ onBlur: () => setIsFocused(false),
1310
+ className: cn(
1311
+ "self-end p-1 mr-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1312
+ showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1313
+ ),
1314
+ "aria-label": "Delete message",
1315
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1316
+ }
1317
+ ),
1318
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs(
1319
+ "div",
1320
+ {
1321
+ className: cn(
1322
+ "px-3 py-1.5 break-words",
1323
+ bubbleRadius,
1324
+ isSent ? "bg-primary text-primary-foreground chat-bubble-sent" : "bg-card border border-primary"
1325
+ ),
1326
+ children: [
1327
+ /* @__PURE__ */ jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
1328
+ isLastOfRun && /* @__PURE__ */ jsxs(
1329
+ "div",
1330
+ {
1331
+ className: cn(
1332
+ "flex items-center gap-1 mt-0.5",
1333
+ isSent ? "justify-end" : "justify-start"
1334
+ ),
1335
+ children: [
1336
+ /* @__PURE__ */ jsx(
1337
+ "span",
1338
+ {
1339
+ className: cn(
1340
+ "text-[11px] leading-none",
1341
+ isSent ? "text-primary-foreground/70" : "text-muted-foreground"
1342
+ ),
1343
+ children: formatTimestamp(timestamp)
1344
+ }
1345
+ ),
1346
+ isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 text-primary-foreground/80 flex-shrink-0" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-primary-foreground/60 flex-shrink-0" }))
1347
+ ]
1348
+ }
1349
+ )
1350
+ ]
1351
+ }
1352
+ ) }),
1353
+ !isSent && onDelete && /* @__PURE__ */ jsx(
1354
+ "button",
1355
+ {
1356
+ onClick: onDelete,
1357
+ onFocus: () => setIsFocused(true),
1358
+ onBlur: () => setIsFocused(false),
1359
+ className: cn(
1360
+ "self-end p-1 ml-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
1361
+ showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
1362
+ ),
1363
+ "aria-label": "Delete message",
1364
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
1365
+ }
1366
+ )
1367
+ ]
1368
+ }
1369
+ );
1370
+ });
1371
+ var useArbiWsStore = create((set) => ({
1372
+ status: "disconnected",
1373
+ tasks: {},
1374
+ lastTaskUpdate: null,
1375
+ presence: {},
1376
+ setStatus: (status) => set({ status }),
1377
+ applyTaskUpdate: (msg) => set((s) => ({ tasks: { ...s.tasks, [msg.doc_ext_id]: msg }, lastTaskUpdate: msg })),
1378
+ applyPresence: (msg) => set((s) => ({ presence: { ...s.presence, [msg.user_id]: msg.status } })),
1379
+ reset: () => set({ status: "disconnected", tasks: {}, lastTaskUpdate: null, presence: {} })
1380
+ }));
1381
+ var ArbiWsContext = createContext(null);
1382
+ function useArbiWsContext() {
1383
+ const ctx = useContext(ArbiWsContext);
1384
+ if (!ctx) {
1385
+ throw new Error("useArbiWebSocket hooks must be used within an <ArbiWebSocketProvider>");
1386
+ }
1387
+ return ctx;
1388
+ }
1389
+ function ArbiWebSocketProvider({ enabled = true, children }) {
1390
+ const arbi = useArbi();
1391
+ const subscribersRef = useRef(/* @__PURE__ */ new Set());
1392
+ const setStatus = useArbiWsStore((s) => s.setStatus);
1393
+ const applyTaskUpdate = useArbiWsStore((s) => s.applyTaskUpdate);
1394
+ const applyPresence = useArbiWsStore((s) => s.applyPresence);
1395
+ const reset = useArbiWsStore((s) => s.reset);
1396
+ const context = useMemo(
1397
+ () => ({
1398
+ subscribe: (fn) => {
1399
+ subscribersRef.current.add(fn);
1400
+ return () => {
1401
+ subscribersRef.current.delete(fn);
1402
+ };
1403
+ }
1404
+ }),
1405
+ []
1406
+ );
1407
+ useEffect(() => {
1408
+ if (!enabled) {
1409
+ reset();
1410
+ return;
1411
+ }
1412
+ let conn = null;
1413
+ let cancelled = false;
1414
+ const onMessage = (msg) => {
1415
+ if (isMessageType(msg, "task_update")) applyTaskUpdate(msg);
1416
+ else if (isMessageType(msg, "presence_update")) applyPresence(msg);
1417
+ for (const fn of subscribersRef.current) {
1418
+ try {
1419
+ fn(msg);
1420
+ } catch {
1421
+ }
1422
+ }
1423
+ };
1424
+ const start = async () => {
1425
+ const info = arbi.getConnectionInfo();
1426
+ if (!info) return;
1427
+ setStatus("connecting");
1428
+ try {
1429
+ const c = await connectWithReconnect({
1430
+ baseUrl: info.baseUrl,
1431
+ accessToken: info.accessToken,
1432
+ // Resolve the freshest token on every (re)connect so rotation is picked up.
1433
+ getAccessToken: () => arbi.getConnectionInfo()?.accessToken ?? null,
1434
+ onMessage,
1435
+ onReconnecting: () => setStatus("reconnecting"),
1436
+ onReconnected: () => setStatus("connected"),
1437
+ onClose: () => {
1438
+ if (!cancelled) setStatus("reconnecting");
1439
+ }
1440
+ });
1441
+ if (cancelled) {
1442
+ c.close();
1443
+ return;
1444
+ }
1445
+ conn = c;
1446
+ setStatus("connected");
1447
+ } catch {
1448
+ setStatus("disconnected");
1449
+ }
1450
+ };
1451
+ void start();
1452
+ return () => {
1453
+ cancelled = true;
1454
+ conn?.close();
1455
+ reset();
1456
+ };
1457
+ }, [enabled, arbi, setStatus, applyTaskUpdate, applyPresence, reset]);
1458
+ return /* @__PURE__ */ jsx(ArbiWsContext.Provider, { value: context, children });
1459
+ }
1460
+ function useArbiWebSocket(onMessage) {
1461
+ const { subscribe } = useArbiWsContext();
1462
+ const handlerRef = useRef(onMessage);
1463
+ handlerRef.current = onMessage;
1464
+ useEffect(() => subscribe((msg) => handlerRef.current(msg)), [subscribe]);
1465
+ }
1466
+ function useArbiWsMessage(type, handler) {
1467
+ const { subscribe } = useArbiWsContext();
1468
+ const handlerRef = useRef(handler);
1469
+ handlerRef.current = handler;
1470
+ useEffect(
1471
+ () => subscribe((msg) => {
1472
+ if (isMessageType(msg, type)) handlerRef.current(msg);
1473
+ }),
1474
+ [subscribe, type]
1475
+ );
1476
+ }
1477
+ function useArbiWsStatus() {
1478
+ return useArbiWsStore((s) => s.status);
1479
+ }
1480
+ function useArbiConnected() {
1481
+ return useArbiWsStore((s) => s.status === "connected");
1482
+ }
1483
+ function useArbiWsTasks() {
1484
+ return useArbiWsStore((s) => s.tasks);
1485
+ }
1486
+ function useArbiWsTask(docId) {
1487
+ return useArbiWsStore((s) => s.tasks[docId]);
1488
+ }
1489
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
1490
+ "completed",
1491
+ "failed",
1492
+ "skipped",
1493
+ "empty",
1494
+ "low-content"
1495
+ ]);
1496
+ function useArbiDocumentSync(workspaceId) {
1497
+ const queryClient = useQueryClient();
1498
+ useArbiWebSocket((msg) => {
1499
+ if (!workspaceId) return;
1500
+ if (isMessageType(msg, "batch_complete")) {
1501
+ if (msg.workspace_ext_id !== workspaceId) return;
1502
+ void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documents(workspaceId) });
1503
+ void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tags(workspaceId) });
1504
+ return;
1505
+ }
1506
+ if (isMessageType(msg, "task_update")) {
1507
+ if (msg.workspace_ext_id !== workspaceId) return;
1508
+ if (TERMINAL_STATUSES.has(msg.status)) {
1509
+ void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documents(workspaceId) });
1510
+ }
1511
+ }
1512
+ });
1513
+ }
1246
1514
  var TooltipContext = React.createContext(null);
1247
1515
  var TooltipProvider = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
1248
1516
  function Tooltip({ children, delayDuration = 300 }) {
@@ -1479,161 +1747,890 @@ var HoverCardContent = React.forwardRef(({ className, align = "center", sideOffs
1479
1747
  }
1480
1748
  ) }));
1481
1749
  HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
1482
- function Card({ className, ...props }) {
1483
- return /* @__PURE__ */ jsx(
1750
+ var cardVariants = cva("rounded-lg bg-card text-card-foreground", {
1751
+ variants: {
1752
+ variant: {
1753
+ flat: "",
1754
+ outline: "border",
1755
+ elevated: "border shadow-sm"
1756
+ }
1757
+ },
1758
+ defaultVariants: {
1759
+ variant: "flat"
1760
+ }
1761
+ });
1762
+ var Card = React.forwardRef(
1763
+ ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
1484
1764
  "div",
1485
1765
  {
1766
+ ref,
1486
1767
  "data-slot": "card",
1487
- className: cn(
1488
- "rounded-xl border border-border bg-card text-card-foreground shadow-sm",
1489
- className
1490
- ),
1768
+ className: cn(cardVariants({ variant }), className),
1491
1769
  ...props
1492
1770
  }
1493
- );
1494
- }
1495
- function CardHeader({ className, ...props }) {
1496
- return /* @__PURE__ */ jsx(
1771
+ )
1772
+ );
1773
+ Card.displayName = "Card";
1774
+ var CardHeader = React.forwardRef(
1775
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1497
1776
  "div",
1498
1777
  {
1778
+ ref,
1499
1779
  "data-slot": "card-header",
1500
- className: cn("flex flex-col gap-1.5 p-6", className),
1780
+ className: cn("flex flex-col space-y-1.5 p-6", className),
1501
1781
  ...props
1502
1782
  }
1503
- );
1504
- }
1505
- function CardTitle({ className, ...props }) {
1506
- return /* @__PURE__ */ jsx(
1783
+ )
1784
+ );
1785
+ CardHeader.displayName = "CardHeader";
1786
+ var CardTitle = React.forwardRef(
1787
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1507
1788
  "div",
1508
1789
  {
1790
+ ref,
1509
1791
  "data-slot": "card-title",
1510
- className: cn("text-lg font-semibold leading-none tracking-tight", className),
1792
+ className: cn("font-semibold leading-none tracking-tight", className),
1511
1793
  ...props
1512
1794
  }
1513
- );
1514
- }
1515
- function CardDescription({ className, ...props }) {
1516
- return /* @__PURE__ */ jsx(
1795
+ )
1796
+ );
1797
+ CardTitle.displayName = "CardTitle";
1798
+ var CardDescription = React.forwardRef(
1799
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1517
1800
  "div",
1518
1801
  {
1802
+ ref,
1519
1803
  "data-slot": "card-description",
1520
1804
  className: cn("text-sm text-muted-foreground", className),
1521
1805
  ...props
1522
1806
  }
1523
- );
1524
- }
1525
- function CardContent({ className, ...props }) {
1526
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-content", className: cn("p-6 pt-0", className), ...props });
1527
- }
1528
- function CardFooter({ className, ...props }) {
1529
- return /* @__PURE__ */ jsx(
1807
+ )
1808
+ );
1809
+ CardDescription.displayName = "CardDescription";
1810
+ var CardContent = React.forwardRef(
1811
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, "data-slot": "card-content", className: cn("p-6 pt-0", className), ...props })
1812
+ );
1813
+ CardContent.displayName = "CardContent";
1814
+ var CardFooter = React.forwardRef(
1815
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1530
1816
  "div",
1531
1817
  {
1818
+ ref,
1532
1819
  "data-slot": "card-footer",
1533
1820
  className: cn("flex items-center p-6 pt-0", className),
1534
1821
  ...props
1535
1822
  }
1536
- );
1537
- }
1538
- function Input({ className, type, ...props }) {
1823
+ )
1824
+ );
1825
+ CardFooter.displayName = "CardFooter";
1826
+ var Input = React.forwardRef(
1827
+ ({ className, type, ...props }, ref) => {
1828
+ return /* @__PURE__ */ jsx(
1829
+ "input",
1830
+ {
1831
+ type,
1832
+ "data-slot": "input",
1833
+ className: cn(
1834
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1835
+ className
1836
+ ),
1837
+ ref,
1838
+ ...props
1839
+ }
1840
+ );
1841
+ }
1842
+ );
1843
+ Input.displayName = "Input";
1844
+ var Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1845
+ "label",
1846
+ {
1847
+ ref,
1848
+ className: `text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${className || ""}`,
1849
+ ...props
1850
+ }
1851
+ ));
1852
+ Label.displayName = "Label";
1853
+ var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
1854
+ SeparatorPrimitive.Root,
1855
+ {
1856
+ ref,
1857
+ decorative,
1858
+ orientation,
1859
+ className: cn(
1860
+ "shrink-0 bg-border",
1861
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
1862
+ className
1863
+ ),
1864
+ ...props
1865
+ }
1866
+ ));
1867
+ Separator.displayName = SeparatorPrimitive.Root.displayName;
1868
+ var Textarea = React.forwardRef(
1869
+ ({ className, ...props }, ref) => {
1870
+ return /* @__PURE__ */ jsx(
1871
+ "textarea",
1872
+ {
1873
+ className: cn(
1874
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1875
+ className
1876
+ ),
1877
+ ref,
1878
+ ...props
1879
+ }
1880
+ );
1881
+ }
1882
+ );
1883
+ Textarea.displayName = "Textarea";
1884
+ var Collapsible = CollapsiblePrimitive.Root;
1885
+ var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
1886
+ var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
1887
+ var Progress = React.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx(
1888
+ ProgressPrimitive.Root,
1889
+ {
1890
+ ref,
1891
+ className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
1892
+ ...props,
1893
+ children: /* @__PURE__ */ jsx(
1894
+ ProgressPrimitive.Indicator,
1895
+ {
1896
+ className: "h-full w-full flex-1 bg-primary transition-all",
1897
+ style: { transform: `translateX(-${100 - (value || 0)}%)` }
1898
+ }
1899
+ )
1900
+ }
1901
+ ));
1902
+ Progress.displayName = ProgressPrimitive.Root.displayName;
1903
+ var ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1904
+ ScrollAreaPrimitive.Root,
1905
+ {
1906
+ ref,
1907
+ className: cn("relative overflow-hidden", className),
1908
+ ...props,
1909
+ children: [
1910
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
1911
+ /* @__PURE__ */ jsx(ScrollBar, {}),
1912
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
1913
+ ]
1914
+ }
1915
+ ));
1916
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
1917
+ var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
1918
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
1919
+ {
1920
+ ref,
1921
+ orientation,
1922
+ className: cn(
1923
+ "flex touch-none select-none transition-colors",
1924
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1925
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
1926
+ className
1927
+ ),
1928
+ ...props,
1929
+ children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1930
+ }
1931
+ ));
1932
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
1933
+ var RadioGroup = React.forwardRef(({ className, ...props }, ref) => {
1934
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref });
1935
+ });
1936
+ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
1937
+ var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
1539
1938
  return /* @__PURE__ */ jsx(
1540
- "input",
1939
+ RadioGroupPrimitive.Item,
1541
1940
  {
1542
- type,
1543
- "data-slot": "input",
1941
+ ref,
1544
1942
  className: cn(
1545
- "flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors",
1546
- "placeholder:text-muted-foreground/70",
1547
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring/60",
1548
- "disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:text-sm file:font-medium",
1943
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1549
1944
  className
1550
1945
  ),
1551
- ...props
1946
+ ...props,
1947
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
1552
1948
  }
1553
1949
  );
1554
- }
1555
- function useWorkspaceDocs(workspaceId) {
1556
- const { data: docs = [], isLoading, isError } = useDocuments(workspaceId);
1557
- const docIds = useMemo(
1558
- () => docs.map((d) => d.external_id).filter((id) => !!id),
1559
- [docs]
1560
- );
1561
- return { wsId: workspaceId, docs, docIds, isLoading, isError, ready: docIds.length > 0 };
1562
- }
1563
- function useAiTask() {
1564
- const mutation = useAssistantQuery();
1565
- const [status, setStatus] = useState("idle");
1566
- const [text, setText] = useState("");
1567
- const [stepCount, setStepCount] = useState(0);
1568
- const [error, setError] = useState(null);
1569
- const [responseId, setResponseId] = useState(null);
1570
- const [artifacts, setArtifacts] = useState([]);
1571
- const bufferRef = useRef("");
1572
- const artifactsRef = useRef(/* @__PURE__ */ new Map());
1573
- const reset = useCallback(() => {
1574
- setStatus("idle");
1575
- setText("");
1576
- setStepCount(0);
1577
- setError(null);
1578
- setResponseId(null);
1579
- setArtifacts([]);
1580
- artifactsRef.current = /* @__PURE__ */ new Map();
1581
- bufferRef.current = "";
1582
- }, []);
1583
- const run = useCallback(
1584
- async (question, docIds, opts) => {
1585
- setStatus("running");
1586
- setText("");
1587
- setStepCount(0);
1588
- setError(null);
1589
- setArtifacts([]);
1590
- artifactsRef.current = /* @__PURE__ */ new Map();
1591
- bufferRef.current = "";
1592
- let streamError = null;
1593
- try {
1594
- const result = await mutation.mutateAsync({
1595
- question,
1596
- docIds,
1597
- previousResponseId: opts?.previousResponseId ?? void 0,
1598
- model: opts?.model,
1599
- onToken: (c) => {
1600
- bufferRef.current += c;
1601
- setText(bufferRef.current);
1602
- },
1603
- onAgentStep: () => setStepCount((n) => n + 1),
1604
- onArtifact: (a) => {
1605
- artifactsRef.current.set(a.doc_ext_id, a);
1606
- setArtifacts([...artifactsRef.current.values()]);
1607
- },
1608
- onError: (m) => {
1609
- streamError = m;
1610
- }
1611
- });
1612
- const finalText = result.text || bufferRef.current;
1613
- setText(finalText);
1614
- setResponseId(result.assistantMessageExtId);
1615
- setStepCount(result.agentSteps.length || 0);
1616
- if (result.artifacts?.length) {
1617
- for (const a of result.artifacts) artifactsRef.current.set(a.doc_ext_id, a);
1618
- setArtifacts([...artifactsRef.current.values()]);
1619
- }
1620
- const err = streamError || result.errors[0] || null;
1621
- if (err && !finalText) {
1622
- setError(err);
1623
- setStatus("error");
1624
- } else {
1625
- setStatus("done");
1626
- }
1627
- return result;
1628
- } catch (e) {
1629
- setError(e instanceof Error ? e.message : "The assistant request failed.");
1630
- setStatus("error");
1631
- return null;
1632
- }
1633
- },
1634
- [mutation]
1635
- );
1636
- return {
1950
+ });
1951
+ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
1952
+ var Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1953
+ CheckboxPrimitive.Root,
1954
+ {
1955
+ ref,
1956
+ className: cn(
1957
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
1958
+ className
1959
+ ),
1960
+ ...props,
1961
+ children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
1962
+ }
1963
+ ));
1964
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
1965
+ var Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1966
+ SwitchPrimitives.Root,
1967
+ {
1968
+ className: cn(
1969
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
1970
+ className
1971
+ ),
1972
+ ...props,
1973
+ ref,
1974
+ children: /* @__PURE__ */ jsx(
1975
+ SwitchPrimitives.Thumb,
1976
+ {
1977
+ className: cn(
1978
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
1979
+ )
1980
+ }
1981
+ )
1982
+ }
1983
+ ));
1984
+ Switch.displayName = SwitchPrimitives.Root.displayName;
1985
+ var Tabs = TabsPrimitive.Root;
1986
+ var TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1987
+ TabsPrimitive.List,
1988
+ {
1989
+ ref,
1990
+ className: cn(
1991
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
1992
+ className
1993
+ ),
1994
+ ...props
1995
+ }
1996
+ ));
1997
+ TabsList.displayName = TabsPrimitive.List.displayName;
1998
+ var TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1999
+ TabsPrimitive.Trigger,
2000
+ {
2001
+ ref,
2002
+ className: cn(
2003
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
2004
+ className
2005
+ ),
2006
+ ...props
2007
+ }
2008
+ ));
2009
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
2010
+ var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2011
+ TabsPrimitive.Content,
2012
+ {
2013
+ ref,
2014
+ className: cn(
2015
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
2016
+ className
2017
+ ),
2018
+ ...props
2019
+ }
2020
+ ));
2021
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
2022
+ var Table = React.forwardRef(
2023
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })
2024
+ );
2025
+ Table.displayName = "Table";
2026
+ var TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2027
+ TableHeader.displayName = "TableHeader";
2028
+ var TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
2029
+ TableBody.displayName = "TableBody";
2030
+ var TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2031
+ "tfoot",
2032
+ {
2033
+ ref,
2034
+ className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
2035
+ ...props
2036
+ }
2037
+ ));
2038
+ TableFooter.displayName = "TableFooter";
2039
+ var TableRow = React.forwardRef(
2040
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2041
+ "tr",
2042
+ {
2043
+ ref,
2044
+ className: cn(
2045
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
2046
+ className
2047
+ ),
2048
+ ...props
2049
+ }
2050
+ )
2051
+ );
2052
+ TableRow.displayName = "TableRow";
2053
+ var TableHead = React.forwardRef(
2054
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2055
+ "th",
2056
+ {
2057
+ ref,
2058
+ className: cn(
2059
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
2060
+ className
2061
+ ),
2062
+ ...props
2063
+ }
2064
+ )
2065
+ );
2066
+ TableHead.displayName = "TableHead";
2067
+ var TableCell = React.forwardRef(
2068
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2069
+ "td",
2070
+ {
2071
+ ref,
2072
+ className: cn(
2073
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
2074
+ className
2075
+ ),
2076
+ ...props
2077
+ }
2078
+ )
2079
+ );
2080
+ TableCell.displayName = "TableCell";
2081
+ var TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
2082
+ TableCaption.displayName = "TableCaption";
2083
+ var Slider = React.forwardRef(
2084
+ ({ className, rangeClassName, ...props }, ref) => /* @__PURE__ */ jsxs(
2085
+ SliderPrimitive.Root,
2086
+ {
2087
+ ref,
2088
+ className: cn("relative flex w-full touch-none select-none items-center", className),
2089
+ ...props,
2090
+ children: [
2091
+ /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: cn("absolute h-full bg-primary", rangeClassName) }) }),
2092
+ /* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })
2093
+ ]
2094
+ }
2095
+ )
2096
+ );
2097
+ Slider.displayName = SliderPrimitive.Root.displayName;
2098
+ var toggleVariants = cva(
2099
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
2100
+ {
2101
+ variants: {
2102
+ variant: {
2103
+ default: "bg-transparent",
2104
+ outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"
2105
+ },
2106
+ size: {
2107
+ default: "h-9 px-2 min-w-9",
2108
+ sm: "h-8 px-1.5 min-w-8",
2109
+ lg: "h-10 px-2.5 min-w-10"
2110
+ }
2111
+ },
2112
+ defaultVariants: {
2113
+ variant: "default",
2114
+ size: "default"
2115
+ }
2116
+ }
2117
+ );
2118
+ var Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
2119
+ TogglePrimitive.Root,
2120
+ {
2121
+ ref,
2122
+ className: cn(toggleVariants({ variant, size, className })),
2123
+ ...props
2124
+ }
2125
+ ));
2126
+ Toggle.displayName = TogglePrimitive.Root.displayName;
2127
+ var ToggleGroupContext = React.createContext({
2128
+ size: "default",
2129
+ variant: "default"
2130
+ });
2131
+ var ToggleGroup = React.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsx(
2132
+ ToggleGroupPrimitive.Root,
2133
+ {
2134
+ ref,
2135
+ className: cn("flex items-center justify-center gap-1", className),
2136
+ ...props,
2137
+ children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
2138
+ }
2139
+ ));
2140
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
2141
+ var ToggleGroupItem = React.forwardRef(({ className, children, variant, size, ...props }, ref) => {
2142
+ const context = React.useContext(ToggleGroupContext);
2143
+ return /* @__PURE__ */ jsx(
2144
+ ToggleGroupPrimitive.Item,
2145
+ {
2146
+ ref,
2147
+ className: cn(
2148
+ toggleVariants({
2149
+ variant: context.variant || variant,
2150
+ size: context.size || size
2151
+ }),
2152
+ className
2153
+ ),
2154
+ ...props,
2155
+ children
2156
+ }
2157
+ );
2158
+ });
2159
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
2160
+ var Dialog = DialogPrimitive.Root;
2161
+ var DialogTrigger = DialogPrimitive.Trigger;
2162
+ var DialogPortal = DialogPrimitive.Portal;
2163
+ var DialogClose = DialogPrimitive.Close;
2164
+ var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2165
+ DialogPrimitive.Overlay,
2166
+ {
2167
+ ref,
2168
+ className: cn(
2169
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
2170
+ className
2171
+ ),
2172
+ ...props
2173
+ }
2174
+ ));
2175
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
2176
+ var DialogContent = React.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
2177
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
2178
+ /* @__PURE__ */ jsxs(
2179
+ DialogPrimitive.Content,
2180
+ {
2181
+ ref,
2182
+ className: cn(
2183
+ "fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg max-h-[90vh] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-md",
2184
+ className
2185
+ ),
2186
+ ...props,
2187
+ children: [
2188
+ children,
2189
+ !hideCloseButton && /* @__PURE__ */ jsxs(
2190
+ DialogPrimitive.Close,
2191
+ {
2192
+ className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
2193
+ "data-testid": "dialog-close-button",
2194
+ children: [
2195
+ /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
2196
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close dialog" })
2197
+ ]
2198
+ }
2199
+ )
2200
+ ]
2201
+ }
2202
+ )
2203
+ ] }));
2204
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
2205
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
2206
+ DialogHeader.displayName = "DialogHeader";
2207
+ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
2208
+ "div",
2209
+ {
2210
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
2211
+ ...props
2212
+ }
2213
+ );
2214
+ DialogFooter.displayName = "DialogFooter";
2215
+ var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2216
+ DialogPrimitive.Title,
2217
+ {
2218
+ ref,
2219
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
2220
+ ...props
2221
+ }
2222
+ ));
2223
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
2224
+ var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2225
+ DialogPrimitive.Description,
2226
+ {
2227
+ ref,
2228
+ className: cn("text-sm text-muted-foreground", className),
2229
+ ...props
2230
+ }
2231
+ ));
2232
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
2233
+ var Popover = PopoverPrimitive.Root;
2234
+ var PopoverTrigger = PopoverPrimitive.Trigger;
2235
+ var PopoverAnchor = PopoverPrimitive.Anchor;
2236
+ var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
2237
+ PopoverPrimitive.Content,
2238
+ {
2239
+ ref,
2240
+ align,
2241
+ sideOffset,
2242
+ className: cn(
2243
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",
2244
+ className
2245
+ ),
2246
+ ...props
2247
+ }
2248
+ ) }));
2249
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
2250
+ var DropdownMenu = DropdownMenuPrimitive.Root;
2251
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
2252
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
2253
+ var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
2254
+ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
2255
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
2256
+ var DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
2257
+ DropdownMenuPrimitive.SubTrigger,
2258
+ {
2259
+ ref,
2260
+ className: cn(
2261
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
2262
+ inset && "pl-8",
2263
+ className
2264
+ ),
2265
+ ...props,
2266
+ children: [
2267
+ children,
2268
+ /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })
2269
+ ]
2270
+ }
2271
+ ));
2272
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
2273
+ var DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2274
+ DropdownMenuPrimitive.SubContent,
2275
+ {
2276
+ ref,
2277
+ className: cn(
2278
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
2279
+ className
2280
+ ),
2281
+ ...props
2282
+ }
2283
+ ));
2284
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
2285
+ var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
2286
+ DropdownMenuPrimitive.Content,
2287
+ {
2288
+ ref,
2289
+ sideOffset,
2290
+ className: cn(
2291
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
2292
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
2293
+ className
2294
+ ),
2295
+ ...props
2296
+ }
2297
+ ) }));
2298
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
2299
+ var DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
2300
+ DropdownMenuPrimitive.Item,
2301
+ {
2302
+ ref,
2303
+ className: cn(
2304
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
2305
+ inset && "pl-8",
2306
+ className
2307
+ ),
2308
+ ...props
2309
+ }
2310
+ ));
2311
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
2312
+ var DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
2313
+ DropdownMenuPrimitive.CheckboxItem,
2314
+ {
2315
+ ref,
2316
+ className: cn(
2317
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2318
+ className
2319
+ ),
2320
+ checked,
2321
+ ...props,
2322
+ children: [
2323
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-4 w-4 items-center justify-center rounded border border-border bg-popover", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-primary" }) }) }),
2324
+ children
2325
+ ]
2326
+ }
2327
+ ));
2328
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
2329
+ var DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
2330
+ DropdownMenuPrimitive.RadioItem,
2331
+ {
2332
+ ref,
2333
+ className: cn(
2334
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2335
+ className
2336
+ ),
2337
+ ...props,
2338
+ children: [
2339
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
2340
+ children
2341
+ ]
2342
+ }
2343
+ ));
2344
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
2345
+ var DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
2346
+ DropdownMenuPrimitive.Label,
2347
+ {
2348
+ ref,
2349
+ className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
2350
+ ...props
2351
+ }
2352
+ ));
2353
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
2354
+ var DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2355
+ DropdownMenuPrimitive.Separator,
2356
+ {
2357
+ ref,
2358
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
2359
+ ...props
2360
+ }
2361
+ ));
2362
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
2363
+ var DropdownMenuShortcut = ({ className, ...props }) => {
2364
+ return /* @__PURE__ */ jsx("span", { className: cn("ml-auto text-sm tracking-widest opacity-60", className), ...props });
2365
+ };
2366
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
2367
+ var Select = SelectPrimitive.Root;
2368
+ var SelectGroup = SelectPrimitive.Group;
2369
+ var SelectValue = SelectPrimitive.Value;
2370
+ var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
2371
+ SelectPrimitive.Trigger,
2372
+ {
2373
+ ref,
2374
+ className: cn(
2375
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
2376
+ className
2377
+ ),
2378
+ ...props,
2379
+ children: [
2380
+ children,
2381
+ /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
2382
+ ]
2383
+ }
2384
+ ));
2385
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
2386
+ var SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2387
+ SelectPrimitive.ScrollUpButton,
2388
+ {
2389
+ ref,
2390
+ className: cn("flex cursor-default items-center justify-center py-1", className),
2391
+ ...props,
2392
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" })
2393
+ }
2394
+ ));
2395
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
2396
+ var SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2397
+ SelectPrimitive.ScrollDownButton,
2398
+ {
2399
+ ref,
2400
+ className: cn("flex cursor-default items-center justify-center py-1", className),
2401
+ ...props,
2402
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
2403
+ }
2404
+ ));
2405
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
2406
+ var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
2407
+ SelectPrimitive.Content,
2408
+ {
2409
+ ref,
2410
+ className: cn(
2411
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2412
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
2413
+ className
2414
+ ),
2415
+ position,
2416
+ ...props,
2417
+ children: [
2418
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
2419
+ /* @__PURE__ */ jsx(
2420
+ SelectPrimitive.Viewport,
2421
+ {
2422
+ className: cn(
2423
+ "p-1",
2424
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
2425
+ ),
2426
+ children
2427
+ }
2428
+ ),
2429
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
2430
+ ]
2431
+ }
2432
+ ) }));
2433
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
2434
+ var SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2435
+ SelectPrimitive.Label,
2436
+ {
2437
+ ref,
2438
+ className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
2439
+ ...props
2440
+ }
2441
+ ));
2442
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
2443
+ var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
2444
+ SelectPrimitive.Item,
2445
+ {
2446
+ ref,
2447
+ className: cn(
2448
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2449
+ className
2450
+ ),
2451
+ ...props,
2452
+ children: [
2453
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
2454
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
2455
+ ]
2456
+ }
2457
+ ));
2458
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
2459
+ var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2460
+ SelectPrimitive.Separator,
2461
+ {
2462
+ ref,
2463
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
2464
+ ...props
2465
+ }
2466
+ ));
2467
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
2468
+ var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2469
+ Command$1,
2470
+ {
2471
+ ref,
2472
+ className: cn(
2473
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
2474
+ className
2475
+ ),
2476
+ ...props
2477
+ }
2478
+ ));
2479
+ Command.displayName = Command$1.displayName;
2480
+ var CommandDialog = ({ children, ...props }) => {
2481
+ return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
2482
+ };
2483
+ var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", "data-cmdk-input-wrapper": "", children: [
2484
+ /* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2485
+ /* @__PURE__ */ jsx(
2486
+ Command$1.Input,
2487
+ {
2488
+ ref,
2489
+ className: cn(
2490
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
2491
+ className
2492
+ ),
2493
+ ...props
2494
+ }
2495
+ )
2496
+ ] }));
2497
+ CommandInput.displayName = Command$1.Input.displayName;
2498
+ var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2499
+ Command$1.List,
2500
+ {
2501
+ ref,
2502
+ className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
2503
+ ...props
2504
+ }
2505
+ ));
2506
+ CommandList.displayName = Command$1.List.displayName;
2507
+ var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
2508
+ CommandEmpty.displayName = Command$1.Empty.displayName;
2509
+ var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2510
+ Command$1.Group,
2511
+ {
2512
+ ref,
2513
+ className: cn(
2514
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
2515
+ className
2516
+ ),
2517
+ ...props
2518
+ }
2519
+ ));
2520
+ CommandGroup.displayName = Command$1.Group.displayName;
2521
+ var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2522
+ Command$1.Separator,
2523
+ {
2524
+ ref,
2525
+ className: cn("-mx-1 h-px bg-border", className),
2526
+ ...props
2527
+ }
2528
+ ));
2529
+ CommandSeparator.displayName = Command$1.Separator.displayName;
2530
+ var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2531
+ Command$1.Item,
2532
+ {
2533
+ ref,
2534
+ className: cn(
2535
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
2536
+ className
2537
+ ),
2538
+ ...props
2539
+ }
2540
+ ));
2541
+ CommandItem.displayName = Command$1.Item.displayName;
2542
+ var CommandShortcut = ({ className, ...props }) => {
2543
+ return /* @__PURE__ */ jsx(
2544
+ "span",
2545
+ {
2546
+ className: cn("ml-auto text-sm tracking-widest text-muted-foreground", className),
2547
+ ...props
2548
+ }
2549
+ );
2550
+ };
2551
+ CommandShortcut.displayName = "CommandShortcut";
2552
+ function useWorkspaceDocs(workspaceId) {
2553
+ const { data: docs = [], isLoading, isError } = useDocuments(workspaceId);
2554
+ const docIds = useMemo(
2555
+ () => docs.map((d) => d.external_id).filter((id) => !!id),
2556
+ [docs]
2557
+ );
2558
+ return { wsId: workspaceId, docs, docIds, isLoading, isError, ready: docIds.length > 0 };
2559
+ }
2560
+ function useAiTask() {
2561
+ const mutation = useAssistantQuery();
2562
+ const [status, setStatus] = useState("idle");
2563
+ const [text, setText] = useState("");
2564
+ const [stepCount, setStepCount] = useState(0);
2565
+ const [error, setError] = useState(null);
2566
+ const [responseId, setResponseId] = useState(null);
2567
+ const [artifacts, setArtifacts] = useState([]);
2568
+ const bufferRef = useRef("");
2569
+ const artifactsRef = useRef(/* @__PURE__ */ new Map());
2570
+ const reset = useCallback(() => {
2571
+ setStatus("idle");
2572
+ setText("");
2573
+ setStepCount(0);
2574
+ setError(null);
2575
+ setResponseId(null);
2576
+ setArtifacts([]);
2577
+ artifactsRef.current = /* @__PURE__ */ new Map();
2578
+ bufferRef.current = "";
2579
+ }, []);
2580
+ const run = useCallback(
2581
+ async (question, docIds, opts) => {
2582
+ setStatus("running");
2583
+ setText("");
2584
+ setStepCount(0);
2585
+ setError(null);
2586
+ setArtifacts([]);
2587
+ artifactsRef.current = /* @__PURE__ */ new Map();
2588
+ bufferRef.current = "";
2589
+ let streamError = null;
2590
+ try {
2591
+ const result = await mutation.mutateAsync({
2592
+ question,
2593
+ docIds,
2594
+ previousResponseId: opts?.previousResponseId ?? void 0,
2595
+ model: opts?.model,
2596
+ onToken: (c) => {
2597
+ bufferRef.current += c;
2598
+ setText(bufferRef.current);
2599
+ },
2600
+ onAgentStep: () => setStepCount((n) => n + 1),
2601
+ onArtifact: (a) => {
2602
+ artifactsRef.current.set(a.doc_ext_id, a);
2603
+ setArtifacts([...artifactsRef.current.values()]);
2604
+ },
2605
+ onError: (m) => {
2606
+ streamError = m;
2607
+ }
2608
+ });
2609
+ const finalText = result.text || bufferRef.current;
2610
+ setText(finalText);
2611
+ setResponseId(result.assistantMessageExtId);
2612
+ setStepCount(result.agentSteps.length || 0);
2613
+ if (result.artifacts?.length) {
2614
+ for (const a of result.artifacts) artifactsRef.current.set(a.doc_ext_id, a);
2615
+ setArtifacts([...artifactsRef.current.values()]);
2616
+ }
2617
+ const err = streamError || result.errors[0] || null;
2618
+ if (err && !finalText) {
2619
+ setError(err);
2620
+ setStatus("error");
2621
+ } else {
2622
+ setStatus("done");
2623
+ }
2624
+ return result;
2625
+ } catch (e) {
2626
+ setError(e instanceof Error ? e.message : "The assistant request failed.");
2627
+ setStatus("error");
2628
+ return null;
2629
+ }
2630
+ },
2631
+ [mutation]
2632
+ );
2633
+ return {
1637
2634
  status,
1638
2635
  text,
1639
2636
  stepCount,
@@ -1720,6 +2717,38 @@ function textToArtifact(title, content, opts) {
1720
2717
  t: null
1721
2718
  };
1722
2719
  }
2720
+ var markdownBaseComponents = {
2721
+ h1: ({ children, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", "data-testid": "markdown-heading-1", ...props, children }),
2722
+ h2: ({ children, ...props }) => /* @__PURE__ */ jsx("h2", { className: "font-semibold text-base", "data-testid": "markdown-heading-2", ...props, children }),
2723
+ h3: ({ children, ...props }) => /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", "data-testid": "markdown-heading-3", ...props, children }),
2724
+ h4: ({ children, ...props }) => /* @__PURE__ */ jsx("h4", { className: "font-semibold text-base", ...props, children }),
2725
+ h5: ({ children, ...props }) => /* @__PURE__ */ jsx("h5", { className: "font-medium", ...props, children }),
2726
+ strong: ({ children, ...props }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", ...props, children }),
2727
+ blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-primary pl-4", ...props, children }),
2728
+ ol: ({ children, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-2 pl-6", "data-testid": "markdown-ordered-list", ...props, children }),
2729
+ ul: ({ children, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-none space-y-2 pl-6", "data-testid": "markdown-unordered-list", ...props, children }),
2730
+ li: ({ children, ...props }) => /* @__PURE__ */ jsx("li", { className: "my-1.5", ...props, children }),
2731
+ table: ({ children, ...props }) => /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", ...props, children }),
2732
+ th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { ...props, children }),
2733
+ td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { ...props, children }),
2734
+ tr: ({ children, ...props }) => /* @__PURE__ */ jsx("tr", { ...props, children }),
2735
+ p: ({ children, ...props }) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", ...props, children }),
2736
+ hr: (props) => /* @__PURE__ */ jsx("hr", { className: "border-foreground/20", ...props }),
2737
+ sup: ({ children, ...props }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", ...props, children }),
2738
+ sub: ({ children, ...props }) => /* @__PURE__ */ jsx("sub", { className: "text-xs", ...props, children }),
2739
+ div: ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", { className, ...props, children }),
2740
+ br: (props) => /* @__PURE__ */ jsx("br", { ...props }),
2741
+ kbd: ({ children, ...props }) => /* @__PURE__ */ jsx(
2742
+ "kbd",
2743
+ {
2744
+ className: "px-1.5 py-0.5 text-xs font-mono bg-muted border border-border rounded",
2745
+ ...props,
2746
+ children
2747
+ }
2748
+ ),
2749
+ abbr: ({ children, title, ...props }) => /* @__PURE__ */ jsx("abbr", { title, className: "underline decoration-dotted cursor-help", ...props, children }),
2750
+ cite: ({ children, ...props }) => /* @__PURE__ */ jsx("cite", { className: "italic", ...props, children })
2751
+ };
1723
2752
  function AiMarkdown({ children, className }) {
1724
2753
  return /* @__PURE__ */ jsx(
1725
2754
  "div",
@@ -1732,15 +2761,9 @@ function AiMarkdown({ children, className }) {
1732
2761
  remarkPlugins: [remarkGfm],
1733
2762
  rehypePlugins: [rehypeRaw],
1734
2763
  components: {
1735
- h1: (p) => /* @__PURE__ */ jsx("h1", { className: "mb-2 mt-4 text-lg font-semibold text-foreground first:mt-0", ...p }),
1736
- h2: (p) => /* @__PURE__ */ jsx("h2", { className: "mb-2 mt-4 text-base font-semibold text-foreground first:mt-0", ...p }),
1737
- h3: (p) => /* @__PURE__ */ jsx("h3", { className: "mb-1.5 mt-3 text-sm font-semibold text-foreground first:mt-0", ...p }),
1738
- p: (p) => /* @__PURE__ */ jsx("p", { className: "mb-3 last:mb-0", ...p }),
1739
- ul: (p) => /* @__PURE__ */ jsx("ul", { className: "mb-3 list-disc space-y-1 pl-5 last:mb-0", ...p }),
1740
- ol: (p) => /* @__PURE__ */ jsx("ol", { className: "mb-3 list-decimal space-y-1 pl-5 last:mb-0", ...p }),
1741
- li: (p) => /* @__PURE__ */ jsx("li", { className: "pl-1", ...p }),
1742
- strong: (p) => /* @__PURE__ */ jsx("strong", { className: "font-semibold text-foreground", ...p }),
2764
+ ...markdownBaseComponents,
1743
2765
  a: (p) => /* @__PURE__ */ jsx("a", { className: "text-ai-accent underline underline-offset-2", ...p }),
2766
+ code: (p) => /* @__PURE__ */ jsx("code", { className: "rounded bg-secondary px-1 py-0.5 font-mono text-[0.8em]", ...p }),
1744
2767
  // Redline marks: deletions in red strike, <ins>/<mark> additions accented.
1745
2768
  del: (p) => /* @__PURE__ */ jsx(
1746
2769
  "del",
@@ -1751,14 +2774,7 @@ function AiMarkdown({ children, className }) {
1751
2774
  ),
1752
2775
  ins: (p) => /* @__PURE__ */ jsx("ins", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent no-underline", ...p }),
1753
2776
  mark: (p) => /* @__PURE__ */ jsx("mark", { className: "rounded bg-ai-accent-soft px-0.5 text-ai-accent", ...p }),
1754
- code: (p) => /* @__PURE__ */ jsx("code", { className: "rounded bg-secondary px-1 py-0.5 font-mono text-[0.8em]", ...p }),
1755
- blockquote: (p) => /* @__PURE__ */ jsx(
1756
- "blockquote",
1757
- {
1758
- className: "my-3 border-l-2 border-ai-accent/40 pl-3 italic text-muted-foreground",
1759
- ...p
1760
- }
1761
- ),
2777
+ // Self-contained bordered tables (base leaves these to app CSS).
1762
2778
  table: (p) => /* @__PURE__ */ jsx("div", { className: "my-3 overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { className: "w-full border-collapse text-xs", ...p }) }),
1763
2779
  thead: (p) => /* @__PURE__ */ jsx("thead", { className: "bg-secondary/60", ...p }),
1764
2780
  th: (p) => /* @__PURE__ */ jsx(
@@ -1857,7 +2873,7 @@ function AiAnswer({
1857
2873
  ] });
1858
2874
  }
1859
2875
  function AiActionCard({
1860
- icon: Icon = Sparkles,
2876
+ icon: Icon2 = Sparkles,
1861
2877
  title,
1862
2878
  description,
1863
2879
  prompt,
@@ -1873,10 +2889,10 @@ function AiActionCard({
1873
2889
  const p = typeof prompt === "function" ? prompt() : prompt;
1874
2890
  void task.run(p, docIds);
1875
2891
  };
1876
- return /* @__PURE__ */ jsxs(Card, { className: "p-5", "data-testid": testId, children: [
2892
+ return /* @__PURE__ */ jsxs(Card, { variant: "elevated", className: "rounded-xl p-5", "data-testid": testId, children: [
1877
2893
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
1878
2894
  /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
1879
- /* @__PURE__ */ jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-ai-accent-soft text-ai-accent", children: /* @__PURE__ */ jsx(Icon, { className: "size-4" }) }),
2895
+ /* @__PURE__ */ jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-ai-accent-soft text-ai-accent", children: /* @__PURE__ */ jsx(Icon2, { className: "size-4" }) }),
1880
2896
  /* @__PURE__ */ jsxs("div", { children: [
1881
2897
  /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: title }),
1882
2898
  /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground", children: description })
@@ -2083,6 +3099,47 @@ function ArtifactCanvas({
2083
3099
  }
2084
3100
  );
2085
3101
  }
3102
+ function MessageArtifactCard({
3103
+ artifact,
3104
+ onOpen
3105
+ }) {
3106
+ const { docExtId, title, isComplete, mode } = artifact;
3107
+ const isImage = mode === "image";
3108
+ const Icon2 = isImage ? Image : FileText;
3109
+ const statusText = isImage ? isComplete ? "Image ready" : "Generating\u2026" : isComplete ? "Draft ready" : "Drafting\u2026";
3110
+ return /* @__PURE__ */ jsxs(
3111
+ Card,
3112
+ {
3113
+ variant: "outline",
3114
+ className: "mt-3 flex items-center gap-3 px-3 py-2.5",
3115
+ "data-testid": `message-artifact-card-${docExtId}`,
3116
+ children: [
3117
+ /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }),
3118
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
3119
+ /* @__PURE__ */ jsx(
3120
+ "div",
3121
+ {
3122
+ className: "truncate text-chat font-semibold text-foreground",
3123
+ "data-testid": "artifact-title",
3124
+ children: title || (isImage ? "Generated image" : "Untitled draft")
3125
+ }
3126
+ ),
3127
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", "data-testid": "artifact-status", children: statusText })
3128
+ ] }),
3129
+ /* @__PURE__ */ jsx(
3130
+ "button",
3131
+ {
3132
+ type: "button",
3133
+ onClick: () => onOpen(docExtId),
3134
+ className: "shrink-0 rounded-md bg-secondary/15 px-3 py-1.5 text-sm font-semibold text-secondary transition-colors hover:bg-secondary/25",
3135
+ "data-testid": `view-artifact-button-${docExtId}`,
3136
+ children: isImage ? "View image" : "View draft"
3137
+ }
3138
+ )
3139
+ ]
3140
+ }
3141
+ );
3142
+ }
2086
3143
  function DocSearch({
2087
3144
  docIds,
2088
3145
  onOpenDoc,
@@ -2129,8 +3186,9 @@ function DocSearch({
2129
3186
  results.slice(0, 8).map((r, i) => /* @__PURE__ */ jsxs(
2130
3187
  Card,
2131
3188
  {
3189
+ variant: "elevated",
2132
3190
  className: cn(
2133
- "p-3",
3191
+ "rounded-xl p-3",
2134
3192
  onOpenDoc && r.docId && "cursor-pointer transition-colors hover:border-ai-accent/40"
2135
3193
  ),
2136
3194
  onClick: () => r.docId && onOpenDoc?.(r.docId),
@@ -2182,6 +3240,7 @@ Question: ${question}`,
2182
3240
  onChange: (e) => setQ(e.target.value),
2183
3241
  onKeyDown: (e) => e.key === "Enter" && (e.preventDefault(), ask()),
2184
3242
  placeholder: "Ask about this document\u2026",
3243
+ className: "bg-card text-sm placeholder:text-muted-foreground/70 focus-visible:border-ring/60 focus-visible:ring-2 focus-visible:ring-ring/50",
2185
3244
  "data-testid": "doc-qa-input"
2186
3245
  }
2187
3246
  ),
@@ -2224,20 +3283,325 @@ Question: ${question}`,
2224
3283
  )
2225
3284
  ] });
2226
3285
  }
3286
+ var INLINE_MD_COMPONENTS = {
3287
+ p: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3288
+ strong: ({ children }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", children }),
3289
+ em: ({ children }) => /* @__PURE__ */ jsx("em", { children }),
3290
+ code: ({ children }) => /* @__PURE__ */ jsx("code", { className: "font-mono", children }),
3291
+ a: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3292
+ ul: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3293
+ ol: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3294
+ li: ({ children }) => /* @__PURE__ */ jsxs("span", { children: [
3295
+ children,
3296
+ " "
3297
+ ] }),
3298
+ h1: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3299
+ h2: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3300
+ h3: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3301
+ h4: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3302
+ h5: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3303
+ h6: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3304
+ blockquote: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
3305
+ pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children })
3306
+ };
3307
+ var CitationRendererComponent = ({
3308
+ content,
3309
+ citations,
3310
+ citationData,
3311
+ className,
3312
+ messageId,
3313
+ isStreaming = false,
3314
+ renderMarkdown,
3315
+ ExternalLink,
3316
+ onOpenCitation,
3317
+ onActivateChunk,
3318
+ useCitationState,
3319
+ onCloseCitation,
3320
+ onDismissCitation
3321
+ }) => {
3322
+ const chunkMap = useMemo(() => {
3323
+ const map = /* @__PURE__ */ new Map();
3324
+ if (citationData) {
3325
+ Object.entries(citationData).forEach(([, docChunks]) => {
3326
+ if (docChunks && Array.isArray(docChunks)) {
3327
+ docChunks.forEach((chunk) => {
3328
+ if (chunk.metadata && chunk.metadata.chunk_ext_id) {
3329
+ map.set(chunk.metadata.chunk_ext_id, chunk);
3330
+ }
3331
+ });
3332
+ }
3333
+ });
3334
+ }
3335
+ return map;
3336
+ }, [citationData]);
3337
+ const getChunkDetails = useCallback(
3338
+ (chunkIds) => [...new Set(chunkIds)].map((id) => chunkMap.get(id)).filter((c) => c !== void 0),
3339
+ [chunkMap]
3340
+ );
3341
+ const handleChunkClick = useCallback(
3342
+ (citationNum, chunkIds, chunk) => {
3343
+ onActivateChunk({ messageId, citationNum, chunkIds, chunk, citationData });
3344
+ },
3345
+ [messageId, citationData, onActivateChunk]
3346
+ );
3347
+ const markdownComponents = useMemo(() => {
3348
+ const components = {
3349
+ a: ({ href, children, ...props }) => {
3350
+ if (!href?.startsWith("#cite-")) {
3351
+ if (!href || href.startsWith("#")) {
3352
+ return /* @__PURE__ */ jsx("a", { className: "text-primary underline underline-offset-2", href, ...props, children });
3353
+ }
3354
+ return /* @__PURE__ */ jsx(ExternalLink, { href, ...props, children });
3355
+ }
3356
+ const citationNum = href.slice(6);
3357
+ const citationKey = `${messageId}-${citationNum}`;
3358
+ const chunkIds = citations?.[citationNum] || [];
3359
+ const chunks = getChunkDetails(chunkIds);
3360
+ return /* @__PURE__ */ jsx(
3361
+ CitationPopover,
3362
+ {
3363
+ citationNum,
3364
+ messageId,
3365
+ chunks,
3366
+ isStreaming,
3367
+ onOpen: () => onOpenCitation(citationKey),
3368
+ onChunkClick: (chunk) => handleChunkClick(citationNum, chunkIds, chunk),
3369
+ useCitationState,
3370
+ onCloseCitation,
3371
+ onDismissCitation,
3372
+ children
3373
+ },
3374
+ citationKey
3375
+ );
3376
+ }
3377
+ };
3378
+ return components;
3379
+ }, [
3380
+ citations,
3381
+ messageId,
3382
+ isStreaming,
3383
+ getChunkDetails,
3384
+ handleChunkClick,
3385
+ onOpenCitation,
3386
+ ExternalLink,
3387
+ useCitationState,
3388
+ onCloseCitation,
3389
+ onDismissCitation
3390
+ ]);
3391
+ return /* @__PURE__ */ jsx("div", { className: cn("citation-container", className), "data-testid": "citation-renderer", children: renderMarkdown({ components: markdownComponents, isStreaming, children: content }) });
3392
+ };
3393
+ var CitationPopover = ({
3394
+ citationNum,
3395
+ messageId,
3396
+ chunks,
3397
+ isStreaming,
3398
+ onOpen,
3399
+ onChunkClick,
3400
+ useCitationState,
3401
+ onCloseCitation,
3402
+ onDismissCitation,
3403
+ children
3404
+ }) => {
3405
+ const { activeCitationKey, viewingPassageId, isOnConversationPage } = useCitationState();
3406
+ const isActive = activeCitationKey === `${messageId}-${citationNum}`;
3407
+ const open = isActive && isOnConversationPage;
3408
+ const chatContainer = useMemo(
3409
+ () => document.querySelector('main[data-testid^="conversation-"]'),
3410
+ []
3411
+ );
3412
+ const triggerRef = useRef(null);
3413
+ const [alignOffset, setAlignOffset] = useState(0);
3414
+ const handleOpen = useCallback(() => {
3415
+ if (triggerRef.current && chatContainer) {
3416
+ const triggerLeft = triggerRef.current.getBoundingClientRect().left;
3417
+ const chatLeft = chatContainer.getBoundingClientRect().left;
3418
+ setAlignOffset(-(triggerLeft - chatLeft));
3419
+ }
3420
+ onOpen();
3421
+ if (chunks.length > 0) {
3422
+ onChunkClick(chunks[0]);
3423
+ }
3424
+ }, [onOpen, onChunkClick, chunks, chatContainer]);
3425
+ const byDoc = useMemo(() => {
3426
+ const map = /* @__PURE__ */ new Map();
3427
+ chunks.forEach((chunk) => {
3428
+ const docId = chunk.metadata.doc_ext_id ?? "unknown";
3429
+ const title = chunk.metadata.doc_title ?? docId;
3430
+ if (!map.has(docId)) map.set(docId, { title, chunks: [] });
3431
+ map.get(docId).chunks.push(chunk);
3432
+ });
3433
+ return Array.from(map.entries()).map(([docId, val]) => ({ docId, ...val }));
3434
+ }, [chunks]);
3435
+ return /* @__PURE__ */ jsxs(
3436
+ Popover,
3437
+ {
3438
+ open,
3439
+ onOpenChange: (next) => {
3440
+ if (isStreaming) return;
3441
+ if (next) {
3442
+ handleOpen();
3443
+ } else {
3444
+ onCloseCitation();
3445
+ }
3446
+ },
3447
+ children: [
3448
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
3449
+ CitationLink,
3450
+ {
3451
+ ref: triggerRef,
3452
+ citationNum,
3453
+ isActive,
3454
+ isStreaming,
3455
+ children
3456
+ }
3457
+ ) }),
3458
+ /* @__PURE__ */ jsxs(
3459
+ PopoverContent,
3460
+ {
3461
+ className: "w-[min(var(--radix-popover-content-available-width),48rem)] min-w-0 p-0 max-h-[75vh] overflow-y-auto border-2 border-border shadow-xl",
3462
+ align: "start",
3463
+ alignOffset,
3464
+ side: "bottom",
3465
+ sideOffset: 6,
3466
+ avoidCollisions: true,
3467
+ container: chatContainer,
3468
+ collisionBoundary: chatContainer,
3469
+ collisionPadding: { top: 8, bottom: 8, left: 8, right: 8 },
3470
+ "data-testid": `citation-popover-${citationNum}`,
3471
+ onInteractOutside: (e) => e.preventDefault(),
3472
+ onEscapeKeyDown: (e) => e.preventDefault(),
3473
+ onCloseAutoFocus: (e) => e.preventDefault(),
3474
+ children: [
3475
+ /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-b border-border sticky top-0 bg-popover z-10 flex items-center justify-between gap-2", children: [
3476
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-semibold text-muted-foreground tracking-wide", children: [
3477
+ "Citation ",
3478
+ citationNum,
3479
+ " (",
3480
+ chunks.length,
3481
+ " passage",
3482
+ chunks.length !== 1 ? "s" : "",
3483
+ ")"
3484
+ ] }),
3485
+ /* @__PURE__ */ jsx(
3486
+ "button",
3487
+ {
3488
+ onClick: onDismissCitation,
3489
+ className: "shrink-0 text-muted-foreground hover:text-foreground transition-colors",
3490
+ "aria-label": "Close",
3491
+ "data-testid": `citation-popover-close-${citationNum}`,
3492
+ children: /* @__PURE__ */ jsx(
3493
+ "svg",
3494
+ {
3495
+ width: "12",
3496
+ height: "12",
3497
+ viewBox: "0 0 12 12",
3498
+ fill: "none",
3499
+ xmlns: "http://www.w3.org/2000/svg",
3500
+ children: /* @__PURE__ */ jsx(
3501
+ "path",
3502
+ {
3503
+ d: "M1 1L11 11M11 1L1 11",
3504
+ stroke: "currentColor",
3505
+ strokeWidth: "1.5",
3506
+ strokeLinecap: "round"
3507
+ }
3508
+ )
3509
+ }
3510
+ )
3511
+ }
3512
+ )
3513
+ ] }),
3514
+ (() => {
3515
+ let idx = 0;
3516
+ return byDoc.map(({ docId, title, chunks: docChunks }) => /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-b border-border last:border-0", children: [
3517
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-primary mb-1 truncate", title, children: title }),
3518
+ docChunks.map((chunk) => {
3519
+ idx++;
3520
+ const isSelected = viewingPassageId === chunk.metadata.chunk_ext_id;
3521
+ return /* @__PURE__ */ jsxs(
3522
+ "button",
3523
+ {
3524
+ "data-testid": `citation-chunk-${chunk.metadata.chunk_ext_id}`,
3525
+ onClick: () => onChunkClick(chunk),
3526
+ className: cn(
3527
+ "w-full text-left text-xs rounded px-2 py-1.5 transition-colors flex items-start gap-2 mb-1 last:mb-0",
3528
+ isSelected ? "bg-yellow-100 dark:bg-yellow-900/30 text-yellow-900 dark:text-yellow-100" : "text-muted-foreground hover:text-primary hover:bg-muted"
3529
+ ),
3530
+ children: [
3531
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[10px] font-mono bg-muted text-muted-foreground rounded px-1 py-0.5 mt-0.5", children: [
3532
+ idx,
3533
+ "."
3534
+ ] }),
3535
+ chunk.metadata.page_number != null && /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[10px] font-mono bg-muted text-muted-foreground rounded-full px-1.5 py-0.5 mt-0.5", children: [
3536
+ "p.",
3537
+ chunk.metadata.page_number
3538
+ ] }),
3539
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 overflow-hidden whitespace-nowrap text-ellipsis block", children: [
3540
+ /* @__PURE__ */ jsx("span", { children: "(\u201C" }),
3541
+ " ",
3542
+ /* @__PURE__ */ jsx(ReactMarkdown, { components: INLINE_MD_COMPONENTS, children: chunk.content.replace(/\n+/g, " ").trim() }),
3543
+ " ",
3544
+ /* @__PURE__ */ jsx("span", { children: "\u201D)" })
3545
+ ] })
3546
+ ]
3547
+ },
3548
+ chunk.metadata.chunk_ext_id
3549
+ );
3550
+ })
3551
+ ] }, docId));
3552
+ })()
3553
+ ]
3554
+ }
3555
+ )
3556
+ ]
3557
+ }
3558
+ );
3559
+ };
3560
+ var CitationLink = React__default.forwardRef(
3561
+ ({ citationNum, isActive, isStreaming, children, ...props }, ref) => /* @__PURE__ */ jsxs(
3562
+ "span",
3563
+ {
3564
+ ref,
3565
+ className: cn(
3566
+ "cited-text transition-colors px-0.5 rounded inline-block",
3567
+ isStreaming ? "cursor-default" : "cursor-pointer",
3568
+ isActive ? "bg-yellow-100 dark:bg-yellow-900/30 hover:bg-yellow-200 dark:hover:bg-yellow-900/40" : "hover:bg-yellow-50 dark:hover:bg-yellow-900/20"
3569
+ ),
3570
+ "data-testid": `citation-link-${citationNum}`,
3571
+ ...props,
3572
+ children: [
3573
+ children,
3574
+ /* @__PURE__ */ jsx("sup", { className: "relative -top-2", children: /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center min-w-4 h-4 px-1 text-[10px] border border-muted bg-muted text-primary rounded font-normal cursor-pointer antialiased tabular-nums font-heading", children: citationNum }) })
3575
+ ]
3576
+ }
3577
+ )
3578
+ );
3579
+ CitationLink.displayName = "CitationLink";
3580
+ var CitationRenderer = React__default.memo(CitationRendererComponent);
2227
3581
 
2228
3582
  // src/icons/colors.ts
2229
3583
  var NEUTRAL_GRAY = "#64748b";
2230
3584
  var FILE_TYPE_COLORS = {
2231
3585
  pdf: "#ef4444",
2232
3586
  // red
3587
+ doc: "#3b82f6",
3588
+ // blue (Word docs)
3589
+ docx: "#3b82f6",
3590
+ // blue
3591
+ html: "#0284c7",
3592
+ // sky-600 (web files)
2233
3593
  img: "#8b5cf6",
2234
3594
  // violet-500 (images)
2235
3595
  vid: "#10b981",
2236
3596
  // emerald-500 (video)
2237
3597
  aud: "#f59e0b",
2238
3598
  // amber-500 (audio)
3599
+ xls: "#16a34a",
3600
+ // green-600 (Excel)
2239
3601
  eml: "#0d9488",
2240
3602
  // teal-600 (email)
3603
+ txt: NEUTRAL_GRAY,
3604
+ // gray (plain text)
2241
3605
  generic: NEUTRAL_GRAY,
2242
3606
  // gray (unknown)
2243
3607
  white: "#ffffff"
@@ -2293,6 +3657,206 @@ var PdfIcon = ({ size = 16, className = "" }) => {
2293
3657
  }
2294
3658
  );
2295
3659
  };
3660
+ var DocIcon = ({ size = 16, className = "" }) => {
3661
+ return /* @__PURE__ */ jsxs(
3662
+ "svg",
3663
+ {
3664
+ width: size,
3665
+ height: size,
3666
+ viewBox: "0 0 24 24",
3667
+ fill: "none",
3668
+ xmlns: "http://www.w3.org/2000/svg",
3669
+ className,
3670
+ children: [
3671
+ /* @__PURE__ */ jsx(
3672
+ "path",
3673
+ {
3674
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
3675
+ fill: FILE_TYPE_COLORS.doc,
3676
+ stroke: FILE_TYPE_COLORS.doc,
3677
+ strokeWidth: "1",
3678
+ strokeLinecap: "round",
3679
+ strokeLinejoin: "round"
3680
+ }
3681
+ ),
3682
+ /* @__PURE__ */ jsx(
3683
+ "path",
3684
+ {
3685
+ d: "M14 2v6h6",
3686
+ fill: "none",
3687
+ stroke: FILE_TYPE_COLORS.white,
3688
+ strokeWidth: "1",
3689
+ strokeLinecap: "round",
3690
+ strokeLinejoin: "round"
3691
+ }
3692
+ ),
3693
+ /* @__PURE__ */ jsx(
3694
+ "text",
3695
+ {
3696
+ x: "12",
3697
+ y: "16",
3698
+ fontSize: "6",
3699
+ fill: "white",
3700
+ textAnchor: "middle",
3701
+ fontWeight: "bold",
3702
+ fontFamily: "Arial, sans-serif",
3703
+ children: "DOC"
3704
+ }
3705
+ )
3706
+ ]
3707
+ }
3708
+ );
3709
+ };
3710
+ var HtmlIcon = ({ size = 16, className = "" }) => {
3711
+ return /* @__PURE__ */ jsxs(
3712
+ "svg",
3713
+ {
3714
+ width: size,
3715
+ height: size,
3716
+ viewBox: "0 0 24 24",
3717
+ fill: "none",
3718
+ xmlns: "http://www.w3.org/2000/svg",
3719
+ className,
3720
+ children: [
3721
+ /* @__PURE__ */ jsx(
3722
+ "path",
3723
+ {
3724
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
3725
+ fill: FILE_TYPE_COLORS.html,
3726
+ stroke: FILE_TYPE_COLORS.html,
3727
+ strokeWidth: "1",
3728
+ strokeLinecap: "round",
3729
+ strokeLinejoin: "round"
3730
+ }
3731
+ ),
3732
+ /* @__PURE__ */ jsx(
3733
+ "path",
3734
+ {
3735
+ d: "M14 2v6h6",
3736
+ fill: "none",
3737
+ stroke: FILE_TYPE_COLORS.white,
3738
+ strokeWidth: "1",
3739
+ strokeLinecap: "round",
3740
+ strokeLinejoin: "round"
3741
+ }
3742
+ ),
3743
+ /* @__PURE__ */ jsx(
3744
+ "text",
3745
+ {
3746
+ x: "12",
3747
+ y: "16",
3748
+ fontSize: "5",
3749
+ fill: "white",
3750
+ textAnchor: "middle",
3751
+ fontWeight: "bold",
3752
+ fontFamily: "Arial, sans-serif",
3753
+ children: "HTML"
3754
+ }
3755
+ )
3756
+ ]
3757
+ }
3758
+ );
3759
+ };
3760
+ var TxtIcon = ({ size = 16, className = "" }) => {
3761
+ return /* @__PURE__ */ jsxs(
3762
+ "svg",
3763
+ {
3764
+ width: size,
3765
+ height: size,
3766
+ viewBox: "0 0 24 24",
3767
+ fill: "none",
3768
+ xmlns: "http://www.w3.org/2000/svg",
3769
+ className,
3770
+ children: [
3771
+ /* @__PURE__ */ jsx(
3772
+ "path",
3773
+ {
3774
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
3775
+ fill: FILE_TYPE_COLORS.txt,
3776
+ stroke: FILE_TYPE_COLORS.txt,
3777
+ strokeWidth: "1",
3778
+ strokeLinecap: "round",
3779
+ strokeLinejoin: "round"
3780
+ }
3781
+ ),
3782
+ /* @__PURE__ */ jsx(
3783
+ "path",
3784
+ {
3785
+ d: "M14 2v6h6",
3786
+ fill: "none",
3787
+ stroke: FILE_TYPE_COLORS.white,
3788
+ strokeWidth: "1",
3789
+ strokeLinecap: "round",
3790
+ strokeLinejoin: "round"
3791
+ }
3792
+ ),
3793
+ /* @__PURE__ */ jsx(
3794
+ "text",
3795
+ {
3796
+ x: "12",
3797
+ y: "16",
3798
+ fontSize: "6",
3799
+ fill: "white",
3800
+ textAnchor: "middle",
3801
+ fontWeight: "bold",
3802
+ fontFamily: "Arial, sans-serif",
3803
+ children: "TXT"
3804
+ }
3805
+ )
3806
+ ]
3807
+ }
3808
+ );
3809
+ };
3810
+ var XlsIcon = ({ size = 16, className = "" }) => {
3811
+ return /* @__PURE__ */ jsxs(
3812
+ "svg",
3813
+ {
3814
+ width: size,
3815
+ height: size,
3816
+ viewBox: "0 0 24 24",
3817
+ fill: "none",
3818
+ xmlns: "http://www.w3.org/2000/svg",
3819
+ className,
3820
+ children: [
3821
+ /* @__PURE__ */ jsx(
3822
+ "path",
3823
+ {
3824
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
3825
+ fill: FILE_TYPE_COLORS.xls,
3826
+ stroke: FILE_TYPE_COLORS.xls,
3827
+ strokeWidth: "1",
3828
+ strokeLinecap: "round",
3829
+ strokeLinejoin: "round"
3830
+ }
3831
+ ),
3832
+ /* @__PURE__ */ jsx(
3833
+ "path",
3834
+ {
3835
+ d: "M14 2v6h6",
3836
+ fill: "none",
3837
+ stroke: FILE_TYPE_COLORS.white,
3838
+ strokeWidth: "1",
3839
+ strokeLinecap: "round",
3840
+ strokeLinejoin: "round"
3841
+ }
3842
+ ),
3843
+ /* @__PURE__ */ jsx(
3844
+ "text",
3845
+ {
3846
+ x: "12",
3847
+ y: "16",
3848
+ fontSize: "6",
3849
+ fill: "white",
3850
+ textAnchor: "middle",
3851
+ fontWeight: "bold",
3852
+ fontFamily: "Arial, sans-serif",
3853
+ children: "XLS"
3854
+ }
3855
+ )
3856
+ ]
3857
+ }
3858
+ );
3859
+ };
2296
3860
  var AudIcon = ({ size = 16, className = "" }) => {
2297
3861
  return /* @__PURE__ */ jsxs(
2298
3862
  "svg",
@@ -2494,56 +4058,428 @@ var EmlIcon = ({ size = 16, className = "" }) => {
2494
4058
  }
2495
4059
  );
2496
4060
  };
2497
- var FileIcon = ({ size = 16, className = "" }) => {
4061
+ var FileIcon = ({ size = 16, className = "" }) => {
4062
+ return /* @__PURE__ */ jsxs(
4063
+ "svg",
4064
+ {
4065
+ width: size,
4066
+ height: size,
4067
+ viewBox: "0 0 24 24",
4068
+ fill: "none",
4069
+ xmlns: "http://www.w3.org/2000/svg",
4070
+ className,
4071
+ children: [
4072
+ /* @__PURE__ */ jsx(
4073
+ "path",
4074
+ {
4075
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
4076
+ fill: FILE_TYPE_COLORS.generic,
4077
+ stroke: FILE_TYPE_COLORS.generic,
4078
+ strokeWidth: "1",
4079
+ strokeLinecap: "round",
4080
+ strokeLinejoin: "round"
4081
+ }
4082
+ ),
4083
+ /* @__PURE__ */ jsx(
4084
+ "path",
4085
+ {
4086
+ d: "M14 2v6h6",
4087
+ fill: "none",
4088
+ stroke: FILE_TYPE_COLORS.white,
4089
+ strokeWidth: "1",
4090
+ strokeLinecap: "round",
4091
+ strokeLinejoin: "round"
4092
+ }
4093
+ ),
4094
+ /* @__PURE__ */ jsx(
4095
+ "text",
4096
+ {
4097
+ x: "12",
4098
+ y: "17",
4099
+ fontSize: "10",
4100
+ fill: "white",
4101
+ textAnchor: "middle",
4102
+ fontWeight: "bold",
4103
+ fontFamily: "Arial, sans-serif",
4104
+ children: "?"
4105
+ }
4106
+ )
4107
+ ]
4108
+ }
4109
+ );
4110
+ };
4111
+ var AppleIcon = ({
4112
+ size = 20,
4113
+ className = "",
4114
+ "aria-label": ariaLabel,
4115
+ "aria-hidden": ariaHidden = true
4116
+ }) => {
4117
+ return /* @__PURE__ */ jsx(
4118
+ "svg",
4119
+ {
4120
+ className,
4121
+ width: size,
4122
+ height: size,
4123
+ viewBox: "0 0 24 24",
4124
+ fill: "currentColor",
4125
+ "aria-label": ariaLabel,
4126
+ "aria-hidden": ariaHidden,
4127
+ children: /* @__PURE__ */ jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" })
4128
+ }
4129
+ );
4130
+ };
4131
+ var GoogleIcon = ({
4132
+ size = 20,
4133
+ className = "",
4134
+ "aria-label": ariaLabel,
4135
+ "aria-hidden": ariaHidden = true
4136
+ }) => {
2498
4137
  return /* @__PURE__ */ jsxs(
2499
4138
  "svg",
2500
4139
  {
4140
+ className,
2501
4141
  width: size,
2502
4142
  height: size,
2503
4143
  viewBox: "0 0 24 24",
2504
- fill: "none",
2505
- xmlns: "http://www.w3.org/2000/svg",
2506
- className,
4144
+ "aria-label": ariaLabel,
4145
+ "aria-hidden": ariaHidden,
2507
4146
  children: [
2508
4147
  /* @__PURE__ */ jsx(
2509
4148
  "path",
2510
4149
  {
2511
- d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2512
- fill: FILE_TYPE_COLORS.generic,
2513
- stroke: FILE_TYPE_COLORS.generic,
2514
- strokeWidth: "1",
2515
- strokeLinecap: "round",
2516
- strokeLinejoin: "round"
4150
+ fill: "#4285F4",
4151
+ d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
2517
4152
  }
2518
4153
  ),
2519
4154
  /* @__PURE__ */ jsx(
2520
4155
  "path",
2521
4156
  {
2522
- d: "M14 2v6h6",
2523
- fill: "none",
2524
- stroke: FILE_TYPE_COLORS.white,
2525
- strokeWidth: "1",
2526
- strokeLinecap: "round",
2527
- strokeLinejoin: "round"
4157
+ fill: "#34A853",
4158
+ d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
2528
4159
  }
2529
4160
  ),
2530
4161
  /* @__PURE__ */ jsx(
2531
- "text",
4162
+ "path",
2532
4163
  {
2533
- x: "12",
2534
- y: "17",
2535
- fontSize: "10",
2536
- fill: "white",
2537
- textAnchor: "middle",
2538
- fontWeight: "bold",
2539
- fontFamily: "Arial, sans-serif",
2540
- children: "?"
4164
+ fill: "#FBBC05",
4165
+ d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
4166
+ }
4167
+ ),
4168
+ /* @__PURE__ */ jsx(
4169
+ "path",
4170
+ {
4171
+ fill: "#EA4335",
4172
+ d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
2541
4173
  }
2542
4174
  )
2543
4175
  ]
2544
4176
  }
2545
4177
  );
2546
4178
  };
4179
+ var GitHubIcon = ({
4180
+ size = 20,
4181
+ className = "",
4182
+ "aria-label": ariaLabel,
4183
+ "aria-hidden": ariaHidden = true
4184
+ }) => {
4185
+ return /* @__PURE__ */ jsx(
4186
+ "svg",
4187
+ {
4188
+ className,
4189
+ width: size,
4190
+ height: size,
4191
+ viewBox: "0 0 24 24",
4192
+ fill: "currentColor",
4193
+ "aria-label": ariaLabel,
4194
+ "aria-hidden": ariaHidden,
4195
+ children: /* @__PURE__ */ jsx(
4196
+ "path",
4197
+ {
4198
+ fillRule: "evenodd",
4199
+ clipRule: "evenodd",
4200
+ d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
4201
+ }
4202
+ )
4203
+ }
4204
+ );
4205
+ };
4206
+ var LinkedInIcon = ({
4207
+ size = 20,
4208
+ className = "",
4209
+ "aria-label": ariaLabel,
4210
+ "aria-hidden": ariaHidden = true
4211
+ }) => {
4212
+ return /* @__PURE__ */ jsx(
4213
+ "svg",
4214
+ {
4215
+ className,
4216
+ width: size,
4217
+ height: size,
4218
+ viewBox: "0 0 24 24",
4219
+ fill: "#0A66C2",
4220
+ "aria-label": ariaLabel,
4221
+ "aria-hidden": ariaHidden,
4222
+ children: /* @__PURE__ */ jsx("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" })
4223
+ }
4224
+ );
4225
+ };
4226
+ var OpenAIIcon = ({
4227
+ size = 16,
4228
+ className = "",
4229
+ "aria-label": ariaLabel = "OpenAI",
4230
+ "aria-hidden": ariaHidden = true
4231
+ }) => /* @__PURE__ */ jsx(
4232
+ "svg",
4233
+ {
4234
+ className,
4235
+ width: size,
4236
+ height: size,
4237
+ viewBox: "0 0 24 24",
4238
+ "aria-label": ariaLabel,
4239
+ "aria-hidden": ariaHidden,
4240
+ children: /* @__PURE__ */ jsx(
4241
+ "path",
4242
+ {
4243
+ fill: "#10A37F",
4244
+ d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
4245
+ }
4246
+ )
4247
+ }
4248
+ );
4249
+ var ClaudeIcon = ({
4250
+ size = 16,
4251
+ className = "",
4252
+ "aria-label": ariaLabel = "Claude",
4253
+ "aria-hidden": ariaHidden = true
4254
+ }) => /* @__PURE__ */ jsx(
4255
+ "svg",
4256
+ {
4257
+ className,
4258
+ width: size,
4259
+ height: size,
4260
+ viewBox: "0 0 24 24",
4261
+ "aria-label": ariaLabel,
4262
+ "aria-hidden": ariaHidden,
4263
+ children: /* @__PURE__ */ jsx(
4264
+ "path",
4265
+ {
4266
+ fill: "#D97757",
4267
+ d: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"
4268
+ }
4269
+ )
4270
+ }
4271
+ );
4272
+ var GeminiIcon = ({
4273
+ size = 16,
4274
+ className = "",
4275
+ "aria-label": ariaLabel = "Gemini",
4276
+ "aria-hidden": ariaHidden = true
4277
+ }) => /* @__PURE__ */ jsxs(
4278
+ "svg",
4279
+ {
4280
+ className,
4281
+ width: size,
4282
+ height: size,
4283
+ viewBox: "0 0 24 24",
4284
+ "aria-label": ariaLabel,
4285
+ "aria-hidden": ariaHidden,
4286
+ children: [
4287
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "geminiGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
4288
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#1BA1E3" }),
4289
+ /* @__PURE__ */ jsx("stop", { offset: "25%", stopColor: "#5489D6" }),
4290
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#9B72CB" }),
4291
+ /* @__PURE__ */ jsx("stop", { offset: "75%", stopColor: "#D96570" }),
4292
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#F49C46" })
4293
+ ] }) }),
4294
+ /* @__PURE__ */ jsx(
4295
+ "path",
4296
+ {
4297
+ fill: "url(#geminiGradient)",
4298
+ d: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"
4299
+ }
4300
+ )
4301
+ ]
4302
+ }
4303
+ );
4304
+ var FireworksIcon = ({
4305
+ size = 16,
4306
+ className = "",
4307
+ "aria-label": ariaLabel = "Fireworks AI",
4308
+ "aria-hidden": ariaHidden = true
4309
+ }) => /* @__PURE__ */ jsxs(
4310
+ "svg",
4311
+ {
4312
+ className,
4313
+ width: size,
4314
+ height: size,
4315
+ viewBox: "-2 6 36 20",
4316
+ preserveAspectRatio: "xMidYMid meet",
4317
+ fill: "none",
4318
+ style: { minWidth: size, minHeight: size },
4319
+ "aria-label": ariaLabel,
4320
+ "aria-hidden": ariaHidden,
4321
+ children: [
4322
+ /* @__PURE__ */ jsx(
4323
+ "path",
4324
+ {
4325
+ fill: "#6720FF",
4326
+ d: "M15.9851 19.1274C15.0969 19.1274 14.2999 18.6001 13.96 17.7838L9.86258 8H12.2608L15.9991 16.9499L19.7339 8H22.1321L18.0102 17.7873C17.6686 18.6001 16.8733 19.1274 15.9851 19.1274Z"
4327
+ }
4328
+ ),
4329
+ /* @__PURE__ */ jsx(
4330
+ "path",
4331
+ {
4332
+ fill: "#6720FF",
4333
+ d: "M21.3316 23.8029C20.4469 23.8029 19.6533 23.2792 19.31 22.4698C18.9649 21.6535 19.1436 20.7215 19.7672 20.0891L27.2299 12.5302L28.1618 14.7287L21.3298 21.636L31.068 21.5817L32 23.7802L21.3333 23.8065L21.3298 23.8029H21.3316Z"
4334
+ }
4335
+ ),
4336
+ /* @__PURE__ */ jsx(
4337
+ "path",
4338
+ {
4339
+ fill: "#6720FF",
4340
+ d: "M0 23.7766L0.931955 21.5781L10.6702 21.6324L3.83993 14.7234L4.77189 12.5249L12.2345 20.0838C12.8582 20.7145 13.0386 21.65 12.6918 22.4645C12.3484 23.2756 11.5513 23.7977 10.6702 23.7977L0.00350359 23.7731L0 23.7766Z"
4341
+ }
4342
+ )
4343
+ ]
4344
+ }
4345
+ );
4346
+ function ProviderIcon({
4347
+ modelName,
4348
+ provider,
4349
+ size = 16,
4350
+ className = ""
4351
+ }) {
4352
+ const m = (modelName ?? "").toLowerCase();
4353
+ const p = (provider ?? "").toLowerCase();
4354
+ if (m.includes("gpt") || p === "openai") {
4355
+ return /* @__PURE__ */ jsx(OpenAIIcon, { size, className });
4356
+ }
4357
+ if (m.includes("claude") || p === "anthropic") {
4358
+ return /* @__PURE__ */ jsx(ClaudeIcon, { size, className });
4359
+ }
4360
+ if (m.includes("gemini") || p.startsWith("vertex_ai")) {
4361
+ return /* @__PURE__ */ jsx(GeminiIcon, { size, className });
4362
+ }
4363
+ if (p === "google") {
4364
+ return /* @__PURE__ */ jsx(GoogleIcon, { size, className });
4365
+ }
4366
+ if (p === "fireworks_ai") {
4367
+ return /* @__PURE__ */ jsx(FireworksIcon, { size, className });
4368
+ }
4369
+ return /* @__PURE__ */ jsx(
4370
+ Crown,
4371
+ {
4372
+ className,
4373
+ style: { width: size, height: size, color: "#EAB308", fill: "#EAB308" }
4374
+ }
4375
+ );
4376
+ }
4377
+ var ArbiIcon = ({
4378
+ size = 20,
4379
+ className = "",
4380
+ "aria-label": ariaLabel = "ARBI Docs",
4381
+ "aria-hidden": ariaHidden = false
4382
+ }) => {
4383
+ return /* @__PURE__ */ jsx(
4384
+ "img",
4385
+ {
4386
+ src: "/favicon.svg",
4387
+ alt: ariaLabel,
4388
+ className: `rounded object-contain ${className}`,
4389
+ style: { width: size, height: size },
4390
+ "aria-label": ariaLabel,
4391
+ "aria-hidden": ariaHidden
4392
+ }
4393
+ );
4394
+ };
4395
+ var ArbiBotHeadIcon = ({ size = 24, className = "" }) => {
4396
+ const maskId = useId();
4397
+ return /* @__PURE__ */ jsxs(
4398
+ "svg",
4399
+ {
4400
+ xmlns: "http://www.w3.org/2000/svg",
4401
+ width: size,
4402
+ height: size,
4403
+ viewBox: "30 -5 190 190",
4404
+ preserveAspectRatio: "xMidYMid meet",
4405
+ className,
4406
+ children: [
4407
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
4408
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
4409
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
4410
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
4411
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
4412
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
4413
+ ] }) }) }),
4414
+ /* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
4415
+ /* @__PURE__ */ jsx(
4416
+ "g",
4417
+ {
4418
+ transform: "translate(0,250) scale(0.1,-0.1)",
4419
+ fill: "currentColor",
4420
+ stroke: "currentColor",
4421
+ strokeWidth: "100",
4422
+ children: /* @__PURE__ */ jsx("path", { d: "M1038 2434 c-217 -39 -406 -154 -522 -318 -121 -170 -176 -376 -103 -384 l27 -3 0 -106 c0 -88 -3 -108 -17 -118 -15 -11 -16 -18 -5 -66 44 -188 209 -369 420 -459 l65 -28 -74 -7 c-283 -26 -444 -152 -535 -418 -70 -204 -73 -507 -5 -507 4 0 12 75 19 168 18 263 68 419 167 530 78 87 224 162 263 134 9 -6 43 -26 76 -43 224 -117 802 -95 948 38 38 34 165 -22 253 -111 117 -119 168 -268 187 -549 6 -92 15 -167 19 -167 89 0 53 415 -54 627 -88 173 -238 270 -458 295 l-99 11 75 32 c201 88 367 274 406 454 10 47 9 56 -5 66 -13 10 -16 32 -16 118 l0 106 28 3 c91 10 -12 297 -165 459 -202 214 -544 307 -895 243z m472 -84 c170 -43 323 -140 416 -264 47 -61 117 -197 128 -248 l6 -28 -65 0 c-64 0 -65 1 -78 33 -43 102 -109 136 -262 137 l-110 0 -38 -40 c-25 -27 -46 -40 -65 -41 -134 -5 -394 1 -410 10 -11 6 -30 24 -42 41 l-21 30 -112 0 c-156 -1 -219 -33 -262 -136 -14 -34 -14 -34 -80 -34 -76 0 -74 -7 -30 103 96 243 311 406 595 452 118 20 319 13 430 -15z m-561 -505 c97 -50 126 -174 61 -263 -118 -163 -380 -23 -309 165 35 93 162 143 248 98z m799 -15 c129 -96 69 -304 -92 -318 -189 -16 -265 218 -106 326 48 33 149 29 198 -8z m272 -389 c0 -23 -45 -110 -86 -168 -245 -343 -856 -408 -1231 -130 -90 67 -213 236 -213 294 0 11 132 13 765 13 457 0 765 -4 765 -9z" })
4423
+ }
4424
+ ),
4425
+ /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
4426
+ /* @__PURE__ */ jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
4427
+ /* @__PURE__ */ jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
4428
+ /* @__PURE__ */ jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" })
4429
+ ] })
4430
+ ] })
4431
+ ]
4432
+ }
4433
+ );
4434
+ };
4435
+ var ArbiBotIcon = ({ size = 24, className = "" }) => {
4436
+ const maskId = useId();
4437
+ return /* @__PURE__ */ jsxs(
4438
+ "svg",
4439
+ {
4440
+ xmlns: "http://www.w3.org/2000/svg",
4441
+ width: size,
4442
+ height: size,
4443
+ viewBox: "0 0 250 250",
4444
+ preserveAspectRatio: "xMidYMid meet",
4445
+ className,
4446
+ children: [
4447
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
4448
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
4449
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
4450
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
4451
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
4452
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
4453
+ ] }) }) }),
4454
+ /* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
4455
+ /* @__PURE__ */ jsx(
4456
+ "g",
4457
+ {
4458
+ transform: "translate(0,250) scale(0.1,-0.1)",
4459
+ fill: "currentColor",
4460
+ stroke: "currentColor",
4461
+ strokeWidth: "100",
4462
+ children: /* @__PURE__ */ jsx("path", { d: "M1038 2434 c-217 -39 -406 -154 -522 -318 -121 -170 -176 -376 -103 -384 l27 -3 0 -106 c0 -88 -3 -108 -17 -118 -15 -11 -16 -18 -5 -66 44 -188 209 -369 420 -459 l65 -28 -74 -7 c-283 -26 -444 -152 -535 -418 -70 -204 -73 -507 -5 -507 4 0 12 75 19 168 18 263 68 419 167 530 78 87 224 162 263 134 9 -6 43 -26 76 -43 224 -117 802 -95 948 38 38 34 165 -22 253 -111 117 -119 168 -268 187 -549 6 -92 15 -167 19 -167 89 0 53 415 -54 627 -88 173 -238 270 -458 295 l-99 11 75 32 c201 88 367 274 406 454 10 47 9 56 -5 66 -13 10 -16 32 -16 118 l0 106 28 3 c91 10 -12 297 -165 459 -202 214 -544 307 -895 243z m472 -84 c170 -43 323 -140 416 -264 47 -61 117 -197 128 -248 l6 -28 -65 0 c-64 0 -65 1 -78 33 -43 102 -109 136 -262 137 l-110 0 -38 -40 c-25 -27 -46 -40 -65 -41 -134 -5 -394 1 -410 10 -11 6 -30 24 -42 41 l-21 30 -112 0 c-156 -1 -219 -33 -262 -136 -14 -34 -14 -34 -80 -34 -76 0 -74 -7 -30 103 96 243 311 406 595 452 118 20 319 13 430 -15z m-561 -505 c97 -50 126 -174 61 -263 -118 -163 -380 -23 -309 165 35 93 162 143 248 98z m799 -15 c129 -96 69 -304 -92 -318 -189 -16 -265 218 -106 326 48 33 149 29 198 -8z m272 -389 c0 -23 -45 -110 -86 -168 -245 -343 -856 -408 -1231 -130 -90 67 -213 236 -213 294 0 11 132 13 765 13 457 0 765 -4 765 -9z" })
4463
+ }
4464
+ ),
4465
+ /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
4466
+ /* @__PURE__ */ jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
4467
+ /* @__PURE__ */ jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
4468
+ /* @__PURE__ */ jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" }),
4469
+ /* @__PURE__ */ jsx("g", { transform: "translate(564,0)", children: /* @__PURE__ */ jsx(
4470
+ "path",
4471
+ {
4472
+ d: "M515 353 c-49 -136 -91 -253 -93 -261 -3 -10 11 -12 60 -10 l63 3 19 53 19 52 91 0 92 0 18 -55 17 -56 62 3 c76 4 79 -24 -30 275 l-88 243 -70 0 -70 0 -90 -247z m215 -55 c0 -4 -27 -8 -59 -8 l-60 0 31 92 31 93 29 -85 c15 -46 28 -88 28 -92z",
4473
+ stroke: "currentColor",
4474
+ strokeWidth: "30"
4475
+ }
4476
+ ) })
4477
+ ] })
4478
+ ] })
4479
+ ]
4480
+ }
4481
+ );
4482
+ };
2547
4483
  var EntityPill = forwardRef(function EntityPill2({
2548
4484
  icon,
2549
4485
  label,
@@ -2565,12 +4501,12 @@ var EntityPill = forwardRef(function EntityPill2({
2565
4501
  "data-testid": testId
2566
4502
  }, ref) {
2567
4503
  const shapeClass = shape === "pill" ? "rounded-full" : "rounded-md";
2568
- const sizeClasses = size === "base" ? "gap-1.5 px-1.5 py-0.5" : "gap-1 px-1";
4504
+ const sizeClasses2 = size === "base" ? "gap-1.5 px-1.5 py-0.5" : "gap-1 px-1";
2569
4505
  const textSizeClass = size === "base" ? "text-base" : "text-sm";
2570
4506
  const baseClasses = cn(
2571
4507
  "group/pill items-center",
2572
4508
  fullWidth ? "flex w-full" : "inline-flex",
2573
- sizeClasses,
4509
+ sizeClasses2,
2574
4510
  shapeClass,
2575
4511
  "bg-muted",
2576
4512
  "border border-border",
@@ -2864,6 +4800,33 @@ function DocumentEntity({
2864
4800
  }
2865
4801
  );
2866
4802
  }
4803
+ var TAG_TYPE_LABELS = {
4804
+ checkbox: "Checkbox",
4805
+ select: "Select",
4806
+ number: "Number",
4807
+ text: "Text",
4808
+ folder: "Folder",
4809
+ search: "Saved Search",
4810
+ date: "Date",
4811
+ assistant: "AI Assistant"
4812
+ };
4813
+ var TAG_TYPE_ICONS = {
4814
+ checkbox: SquareCheckBig,
4815
+ select: List,
4816
+ number: Hash,
4817
+ text: StickyNote,
4818
+ folder: Folder,
4819
+ search: Search,
4820
+ date: Calendar,
4821
+ assistant: Bot
4822
+ };
4823
+ function getTagTypeIcon(type) {
4824
+ return TAG_TYPE_ICONS[type ?? "text"] || StickyNote;
4825
+ }
4826
+ function getTagTypeLabel(type) {
4827
+ const t = type ?? "text";
4828
+ return TAG_TYPE_LABELS[t] || t;
4829
+ }
2867
4830
  var BASE_COLORS = {
2868
4831
  "0": "#10b981",
2869
4832
  "1": "#3b82f6",
@@ -2885,37 +4848,18 @@ var BASE_COLORS = {
2885
4848
  function getEntityColor(entityId) {
2886
4849
  return BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
2887
4850
  }
2888
- var TAG_TYPE_LABELS = {
2889
- checkbox: "Checkbox",
2890
- select: "Select",
2891
- number: "Number",
2892
- text: "Text",
2893
- folder: "Folder",
2894
- search: "Saved Search",
2895
- date: "Date",
2896
- assistant: "AI Assistant"
2897
- };
2898
- var TAG_TYPE_ICONS = {
2899
- checkbox: SquareCheckBig,
2900
- select: List,
2901
- number: Hash,
2902
- text: StickyNote,
2903
- folder: Folder,
2904
- search: Search,
2905
- date: Calendar,
2906
- assistant: Bot
2907
- };
2908
4851
  function TagEntity({
2909
4852
  tag,
2910
4853
  size = "md",
2911
4854
  className = "",
2912
4855
  onClick,
2913
- showTooltip = true
4856
+ showTooltip = true,
4857
+ tooltipContent
2914
4858
  }) {
2915
4859
  const tagType = tag.tag_type?.type ?? "text";
2916
4860
  const iconSize = size === "sm" ? 12 : size === "md" ? 14 : 16;
2917
- const Icon = TAG_TYPE_ICONS[tagType] || StickyNote;
2918
- const sizeClasses = {
4861
+ const Icon2 = getTagTypeIcon(tagType);
4862
+ const sizeClasses2 = {
2919
4863
  sm: "p-0.5",
2920
4864
  md: "p-1",
2921
4865
  lg: "p-1.5"
@@ -2924,20 +4868,20 @@ function TagEntity({
2924
4868
  const iconElement = /* @__PURE__ */ jsx(
2925
4869
  "span",
2926
4870
  {
2927
- className: `inline-flex items-center justify-center rounded-md text-white flex-shrink-0 ${sizeClasses[size]}`,
4871
+ className: `inline-flex items-center justify-center rounded-md text-white flex-shrink-0 ${sizeClasses2[size]}`,
2928
4872
  style: { backgroundColor: tagColor },
2929
- children: /* @__PURE__ */ jsx(Icon, { size: iconSize, className: "flex-shrink-0" })
4873
+ children: /* @__PURE__ */ jsx(Icon2, { size: iconSize, className: "flex-shrink-0" })
2930
4874
  }
2931
4875
  );
2932
4876
  const pillSize = size === "lg" ? "base" : "sm";
2933
- const tooltipContent = showTooltip ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
4877
+ const defaultTooltip = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2934
4878
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2935
4879
  /* @__PURE__ */ jsx(
2936
4880
  "span",
2937
4881
  {
2938
4882
  className: "inline-flex items-center justify-center rounded-md text-white p-1",
2939
4883
  style: { backgroundColor: tagColor },
2940
- children: /* @__PURE__ */ jsx(Icon, { size: 16 })
4884
+ children: /* @__PURE__ */ jsx(Icon2, { size: 16 })
2941
4885
  }
2942
4886
  ),
2943
4887
  /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: tag.name })
@@ -2945,7 +4889,7 @@ function TagEntity({
2945
4889
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 text-sm", children: [
2946
4890
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2947
4891
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
2948
- /* @__PURE__ */ jsx("span", { children: TAG_TYPE_LABELS[tagType] || tagType })
4892
+ /* @__PURE__ */ jsx("span", { children: getTagTypeLabel(tagType) })
2949
4893
  ] }),
2950
4894
  tag.doctag_count != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2951
4895
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Documents:" }),
@@ -2953,7 +4897,8 @@ function TagEntity({
2953
4897
  ] }),
2954
4898
  tag.shared != null && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: tag.shared ? "Shared" : "Private" }) })
2955
4899
  ] })
2956
- ] }) : void 0;
4900
+ ] });
4901
+ const resolvedTooltip = showTooltip ? tooltipContent ?? defaultTooltip : void 0;
2957
4902
  return /* @__PURE__ */ jsx(
2958
4903
  EntityPill,
2959
4904
  {
@@ -2962,7 +4907,7 @@ function TagEntity({
2962
4907
  size: pillSize,
2963
4908
  shape: "rounded",
2964
4909
  labelMaxWidth: "max-w-[180px]",
2965
- tooltipContent,
4910
+ tooltipContent: resolvedTooltip,
2966
4911
  onClick,
2967
4912
  className,
2968
4913
  "data-testid": `tag-entity-${tag.external_id}`
@@ -3025,6 +4970,161 @@ function ProjectEntity({
3025
4970
  }
3026
4971
  );
3027
4972
  }
4973
+ var sizeClasses = {
4974
+ xs: "h-5 w-5",
4975
+ sm: "h-6 w-6",
4976
+ md: "h-8 w-8",
4977
+ lg: "h-10 w-10"
4978
+ };
4979
+ var textSizeClasses = {
4980
+ xs: "text-xs",
4981
+ sm: "text-xs",
4982
+ md: "text-xs",
4983
+ lg: "text-sm"
4984
+ };
4985
+ var presenceDotClasses = {
4986
+ xs: "w-2 h-2 border",
4987
+ sm: "w-2.5 h-2.5 border",
4988
+ md: "w-3 h-3 border-2",
4989
+ lg: "w-3.5 h-3.5 border-2"
4990
+ };
4991
+ var presencePositionClasses = {
4992
+ xs: "-right-1 bottom-0",
4993
+ sm: "-right-1 bottom-0",
4994
+ md: "-right-1.5 -bottom-0.5",
4995
+ lg: "-right-1.5 -bottom-0.5"
4996
+ };
4997
+ var presenceColorClasses = {
4998
+ connected: "bg-status-online",
4999
+ connecting: "bg-status-connecting",
5000
+ disconnected: "bg-status-away",
5001
+ error: "bg-status-busy",
5002
+ hidden: "bg-status-offline"
5003
+ };
5004
+ var UserEntity = memo(function UserEntity2({
5005
+ size = "md",
5006
+ variant = "pill",
5007
+ className,
5008
+ showTooltip = true,
5009
+ interactive = true,
5010
+ hasUnreadMessages = false,
5011
+ initials = "",
5012
+ displayName = "",
5013
+ picture,
5014
+ colorClass = "",
5015
+ isAgent = false,
5016
+ agentStyle,
5017
+ isMe = false,
5018
+ displayStatus,
5019
+ onClick,
5020
+ tooltipContent,
5021
+ empty = false
5022
+ }) {
5023
+ if (empty) {
5024
+ return /* @__PURE__ */ jsx(
5025
+ Avatar,
5026
+ {
5027
+ className: cn(sizeClasses[size], "border border-border", className),
5028
+ "data-testid": "user-entity",
5029
+ children: /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-status-empty text-muted-foreground text-xs font-semibold", children: "?" })
5030
+ }
5031
+ );
5032
+ }
5033
+ const agentBadge = isAgent ? /* @__PURE__ */ jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
5034
+ const chatIcon = interactive && !isMe && !isAgent ? /* @__PURE__ */ jsxs("div", { className: "relative flex-shrink-0 ml-0.5", children: [
5035
+ /* @__PURE__ */ jsx(MessageCircleMore, { className: "w-3.5 h-3.5 text-muted-foreground" }),
5036
+ hasUnreadMessages && /* @__PURE__ */ jsx("div", { className: "absolute -top-1 -right-1.5 w-2 h-2 aspect-square rounded-full bg-secondary border border-background" })
5037
+ ] }) : void 0;
5038
+ const avatarCore = /* @__PURE__ */ jsxs(
5039
+ Avatar,
5040
+ {
5041
+ className: cn(
5042
+ sizeClasses[size],
5043
+ isAgent ? "rounded-full border-2 border-dashed" : "border border-white"
5044
+ ),
5045
+ style: agentStyle,
5046
+ "data-testid": "user-entity",
5047
+ children: [
5048
+ picture && /* @__PURE__ */ jsx(AvatarImage, { src: picture, alt: initials }),
5049
+ /* @__PURE__ */ jsx(
5050
+ AvatarFallback,
5051
+ {
5052
+ className: cn(
5053
+ textSizeClasses[size],
5054
+ "font-semibold leading-none",
5055
+ isAgent ? "rounded-full bg-transparent" : `text-white ${colorClass}`
5056
+ ),
5057
+ style: agentStyle,
5058
+ children: initials
5059
+ }
5060
+ )
5061
+ ]
5062
+ }
5063
+ );
5064
+ const presenceDot = displayStatus && /* @__PURE__ */ jsx(
5065
+ "div",
5066
+ {
5067
+ className: cn(
5068
+ "absolute rounded-full border-white",
5069
+ presenceDotClasses[size],
5070
+ presencePositionClasses[size],
5071
+ presenceColorClasses[displayStatus]
5072
+ ),
5073
+ "data-testid": "user-entity-presence"
5074
+ }
5075
+ );
5076
+ const avatarElement = displayStatus ? /* @__PURE__ */ jsxs(
5077
+ "div",
5078
+ {
5079
+ className: cn(
5080
+ "relative inline-block",
5081
+ sizeClasses[size],
5082
+ variant === "pill" ? "" : className
5083
+ ),
5084
+ children: [
5085
+ avatarCore,
5086
+ presenceDot
5087
+ ]
5088
+ }
5089
+ ) : /* @__PURE__ */ jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
5090
+ const resolvedTooltip = showTooltip ? tooltipContent : void 0;
5091
+ if (variant === "pill") {
5092
+ if (!interactive) {
5093
+ return /* @__PURE__ */ jsx(
5094
+ EntityPill,
5095
+ {
5096
+ icon: avatarElement,
5097
+ label: displayName,
5098
+ secondaryText: agentBadge,
5099
+ shape: "pill",
5100
+ tooltipContent: resolvedTooltip,
5101
+ className,
5102
+ "data-testid": "user-entity-pill"
5103
+ }
5104
+ );
5105
+ }
5106
+ return /* @__PURE__ */ jsx(
5107
+ EntityPill,
5108
+ {
5109
+ icon: avatarElement,
5110
+ label: displayName,
5111
+ secondaryText: chatIcon || agentBadge,
5112
+ shape: "pill",
5113
+ onClick,
5114
+ tooltipContent: resolvedTooltip,
5115
+ className,
5116
+ "data-testid": "user-entity-pill"
5117
+ }
5118
+ );
5119
+ }
5120
+ if (showTooltip) {
5121
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
5122
+ /* @__PURE__ */ jsx(TooltipTrigger, { onFocusCapture: (e) => e.stopPropagation(), className: "inline-flex", children: avatarElement }),
5123
+ /* @__PURE__ */ jsx(TooltipContent, { className: "p-2", children: tooltipContent })
5124
+ ] });
5125
+ }
5126
+ return avatarElement;
5127
+ });
3028
5128
  var useArbiUiStore = create((set) => ({
3029
5129
  selectedDocIds: [],
3030
5130
  setSelectedDocIds: (ids) => set({ selectedDocIds: ids }),
@@ -3593,6 +5693,6 @@ function DocumentReview({
3593
5693
  );
3594
5694
  }
3595
5695
 
3596
- export { AiActionCard, AiAnswer, AiMarkdown, ArbiChat, ArbiChatPanel, ArbiProvider, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, DocumentGallery, DocumentReview, DocumentTable, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, PdfIcon, ProjectEntity, TagEntity, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useParsedDocument, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useWorkspaceDocs, useWorkspaces };
5696
+ export { AiActionCard, AiAnswer, AiMarkdown, AppleIcon, ArbiBotHeadIcon, ArbiBotIcon, ArbiChat, ArbiChatPanel, ArbiIcon, ArbiProvider, ArbiWebSocketProvider, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatBubble, Checkbox, CitationRenderer, ClaudeIcon, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DocIcon, DocQaPanel, DocSearch, DocumentEntity, DocumentGallery, DocumentReview, DocumentTable, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, FireworksIcon, GeminiIcon, GitHubIcon, GoogleIcon, HoverCard, HoverCardContent, HoverCardTrigger, HtmlIcon, ImgIcon, Input, Label, LinkedInIcon, MessageArtifactCard, OpenAIIcon, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, ProjectEntity, ProviderIcon, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TxtIcon, TypingIndicator, UserEntity, VidIcon, XlsIcon, arbiQueryKeys, badgeVariants, buttonVariants, cardVariants, cn, getTagTypeIcon, getTagTypeLabel, markdownBaseComponents, redlineStats, textToArtifact, toRedlineMarkdown, toggleVariants, useAgents, useAiTask, useArbi, useArbiConnected, useArbiDocumentSync, useArbiUiStore, useArbiWebSocket, useArbiWsContext, useArbiWsMessage, useArbiWsStatus, useArbiWsStore, useArbiWsTask, useArbiWsTasks, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useParsedDocument, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useWorkspaceDocs, useWorkspaces };
3597
5697
  //# sourceMappingURL=index.js.map
3598
5698
  //# sourceMappingURL=index.js.map