@arbidocs/react 0.3.148 → 0.3.149

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.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
4
3
  var chunkZMTLGO3K_cjs = require('./chunk-ZMTLGO3K.cjs');
4
+ var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
5
5
  var React2 = require('react');
6
6
  var reactQuery = require('@tanstack/react-query');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -1336,7 +1336,7 @@ function ArbiChat({
1336
1336
  ) }) });
1337
1337
  }
1338
1338
  var TypingIndicator = React2.memo(function TypingIndicator2() {
1339
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
1339
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", "data-testid": "dm-typing-indicator", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
1340
1340
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]" }),
1341
1341
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]" }),
1342
1342
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]" })
@@ -1350,23 +1350,35 @@ var ChatBubble = React2.memo(function ChatBubble2({
1350
1350
  read,
1351
1351
  onDelete,
1352
1352
  isLastOfRun = true,
1353
+ senderName,
1354
+ classNames,
1353
1355
  renderMessage = (m) => m,
1354
- formatTimestamp = (t) => t
1356
+ formatTimestamp = (t) => t,
1357
+ "data-testid": testId
1355
1358
  }) {
1356
1359
  const [isHovered, setIsHovered] = React2.useState(false);
1357
1360
  const [isFocused, setIsFocused] = React2.useState(false);
1358
1361
  const showDeleteButton = isHovered || isFocused;
1359
1362
  if (deleted) {
1360
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" }) });
1363
+ return /* @__PURE__ */ jsxRuntime.jsx(
1364
+ "div",
1365
+ {
1366
+ "data-testid": testId,
1367
+ className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
1368
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
1369
+ }
1370
+ );
1361
1371
  }
1362
1372
  const bubbleRadius = chunkZBZKHBDS_cjs.cn(
1363
1373
  "rounded-2xl",
1364
- isSent && isLastOfRun && "rounded-br-md",
1365
- !isSent && isLastOfRun && "rounded-bl-md"
1374
+ isSent && isLastOfRun && "rounded-br-sm",
1375
+ !isSent && isLastOfRun && "rounded-bl-sm"
1366
1376
  );
1377
+ const bubbleSurface = isSent ? chunkZBZKHBDS_cjs.cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
1367
1378
  return /* @__PURE__ */ jsxRuntime.jsxs(
1368
1379
  "div",
1369
1380
  {
1381
+ "data-testid": testId,
1370
1382
  className: chunkZBZKHBDS_cjs.cn(
1371
1383
  "flex w-full items-end",
1372
1384
  isLastOfRun ? "mb-2" : "mb-0.5",
@@ -1389,41 +1401,23 @@ var ChatBubble = React2.memo(function ChatBubble2({
1389
1401
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
1390
1402
  }
1391
1403
  ),
1392
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs(
1393
- "div",
1394
- {
1395
- className: chunkZBZKHBDS_cjs.cn(
1396
- "px-3 py-1.5 break-words",
1397
- bubbleRadius,
1398
- isSent ? "bg-primary text-primary-foreground chat-bubble-sent" : "bg-card border border-primary"
1399
- ),
1400
- children: [
1401
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
1402
- isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
1403
- "div",
1404
- {
1405
- className: chunkZBZKHBDS_cjs.cn(
1406
- "flex items-center gap-1 mt-0.5",
1407
- isSent ? "justify-end" : "justify-start"
1408
- ),
1409
- children: [
1410
- /* @__PURE__ */ jsxRuntime.jsx(
1411
- "span",
1412
- {
1413
- className: chunkZBZKHBDS_cjs.cn(
1414
- "text-[11px] leading-none",
1415
- isSent ? "text-primary-foreground/70" : "text-muted-foreground"
1416
- ),
1417
- children: formatTimestamp(timestamp)
1418
- }
1419
- ),
1420
- isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 text-primary-foreground/80 flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 text-primary-foreground/60 flex-shrink-0" }))
1421
- ]
1422
- }
1423
- )
1424
- ]
1425
- }
1426
- ) }),
1404
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkZBZKHBDS_cjs.cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
1405
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
1406
+ isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
1407
+ "div",
1408
+ {
1409
+ className: chunkZBZKHBDS_cjs.cn(
1410
+ "flex items-center gap-1.5 mt-0.5",
1411
+ isSent ? "justify-end" : "justify-start"
1412
+ ),
1413
+ children: [
1414
+ senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
1415
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
1416
+ isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
1417
+ ]
1418
+ }
1419
+ )
1420
+ ] }) }),
1427
1421
  !isSent && onDelete && /* @__PURE__ */ jsxRuntime.jsx(
1428
1422
  "button",
1429
1423
  {
@@ -5438,88 +5432,207 @@ function ConversationList({
5438
5432
  selectedPeerId,
5439
5433
  onSelect,
5440
5434
  classNames,
5441
- emptyState
5435
+ emptyState,
5436
+ header,
5437
+ className
5442
5438
  }) {
5443
5439
  return /* @__PURE__ */ jsxRuntime.jsxs(
5444
5440
  "aside",
5445
5441
  {
5446
- className: "flex min-h-0 flex-col border-b border-border md:w-80 md:shrink-0 md:border-b-0 md:border-r",
5442
+ className: chunkZBZKHBDS_cjs.cn(
5443
+ "flex min-h-0 flex-col border-b border-border md:w-80 md:shrink-0 md:border-b-0 md:border-r",
5444
+ className
5445
+ ),
5447
5446
  "data-testid": "arbi-dm-list",
5448
5447
  children: [
5449
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
5448
+ header === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
5450
5449
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Conversations" }),
5451
5450
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
5452
5451
  conversations.length,
5453
5452
  " ",
5454
5453
  conversations.length === 1 ? "colleague" : "colleagues"
5455
5454
  ] })
5456
- ] }),
5457
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c) => {
5455
+ ] }) : header,
5456
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c, i) => {
5458
5457
  const { peer, lastMessage, unreadCount } = c;
5458
+ const newSection = c.sectionLabel && c.sectionLabel !== conversations[i - 1]?.sectionLabel;
5459
5459
  const active = peer.external_id === selectedPeerId;
5460
- const preview = lastMessage ? `${lastMessage.isMine ? "You: " : ""}${lastMessage.body}` : "No messages yet \u2014 say hello";
5461
- return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
5462
- "button",
5463
- {
5464
- type: "button",
5465
- onClick: () => onSelect(peer.external_id),
5466
- "data-testid": `arbi-dm-conversation-${peer.external_id}`,
5467
- className: chunkZBZKHBDS_cjs.cn(
5468
- "flex w-full items-start gap-3 border-b border-border/60 px-4 py-3 text-left transition-colors",
5469
- active ? "bg-accent" : "hover:bg-accent/60"
5470
- ),
5471
- children: [
5472
- /* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer }),
5473
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
5474
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
5475
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: userDisplayName(peer) }),
5476
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: lastMessage ? formatRelativeTime(lastMessage.createdAt) : "" })
5477
- ] }),
5478
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-2", children: [
5479
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children: preview }),
5480
- unreadCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.Badge, { className: chunkZBZKHBDS_cjs.cn("px-1.5 py-0 text-[10px]", classNames?.unreadBadge), children: unreadCount }) : null
5481
- ] })
5482
- ] })
5483
- ]
5484
- }
5485
- ) }, peer.external_id);
5460
+ const preview = lastMessage?.body ?? "No messages yet \u2014 say hello";
5461
+ const unread = unreadCount > 0;
5462
+ const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5463
+ c.leading ?? /* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer }),
5464
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
5465
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
5466
+ /* @__PURE__ */ jsxRuntime.jsx(
5467
+ "span",
5468
+ {
5469
+ className: chunkZBZKHBDS_cjs.cn(
5470
+ "truncate text-sm text-foreground",
5471
+ unread ? "font-bold" : "font-semibold"
5472
+ ),
5473
+ children: userDisplayName(peer)
5474
+ }
5475
+ ),
5476
+ c.statusLabel ? /* @__PURE__ */ jsxRuntime.jsx(
5477
+ chunkZBZKHBDS_cjs.Badge,
5478
+ {
5479
+ variant: "outline",
5480
+ className: "shrink-0 rounded-full px-2 py-0 text-[10px] font-medium text-muted-foreground",
5481
+ children: c.statusLabel
5482
+ }
5483
+ ) : unreadCount > 0 ? (
5484
+ // Quiet by default: a filled brand pill with a shadow
5485
+ // shouted louder than the message it was counting.
5486
+ // Enough to catch the eye scanning the list, no more.
5487
+ /* @__PURE__ */ jsxRuntime.jsx(
5488
+ chunkZBZKHBDS_cjs.Badge,
5489
+ {
5490
+ variant: "accent",
5491
+ className: chunkZBZKHBDS_cjs.cn(
5492
+ "min-w-[1.125rem] justify-center rounded-full px-1 py-0 text-[10px] font-medium leading-[1.125rem] shadow-none",
5493
+ classNames?.unreadBadge
5494
+ ),
5495
+ children: unreadCount
5496
+ }
5497
+ )
5498
+ ) : null
5499
+ ] }),
5500
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-1.5", children: [
5501
+ lastMessage?.isMine ? lastMessage.read ? /* @__PURE__ */ jsxRuntime.jsx(
5502
+ lucideReact.CheckCheck,
5503
+ {
5504
+ className: "size-3.5 shrink-0 text-ai-accent",
5505
+ "aria-label": "Read"
5506
+ }
5507
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
5508
+ lucideReact.Check,
5509
+ {
5510
+ className: "size-3.5 shrink-0 text-muted-foreground",
5511
+ "aria-label": "Sent"
5512
+ }
5513
+ ) : null,
5514
+ /* @__PURE__ */ jsxRuntime.jsx(
5515
+ "p",
5516
+ {
5517
+ className: chunkZBZKHBDS_cjs.cn(
5518
+ "min-w-0 flex-1 truncate text-xs",
5519
+ unread ? "font-medium text-foreground" : "text-muted-foreground"
5520
+ ),
5521
+ children: c.subtitle ?? preview
5522
+ }
5523
+ ),
5524
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: lastMessage ? formatRelativeTime(lastMessage.createdAt) : "" })
5525
+ ] })
5526
+ ] })
5527
+ ] });
5528
+ const rowClass = chunkZBZKHBDS_cjs.cn(
5529
+ // Each row is its own opaque surface. Left transparent it takes
5530
+ // the panel's colour, and the chips stop reading as cards at all
5531
+ // — which is the whole point of them.
5532
+ "flex w-full items-start gap-3 border-b border-border/60 bg-card px-4 py-3 text-left transition-colors",
5533
+ c.disabled ? "cursor-default" : active ? "bg-ai-accent-soft" : "hover:bg-accent/40"
5534
+ );
5535
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
5536
+ newSection && /* @__PURE__ */ jsxRuntime.jsx(
5537
+ "p",
5538
+ {
5539
+ className: "bg-muted/40 px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
5540
+ "data-testid": "arbi-dm-section",
5541
+ children: c.sectionLabel
5542
+ }
5543
+ ),
5544
+ c.disabled ? /* @__PURE__ */ jsxRuntime.jsxs(
5545
+ "div",
5546
+ {
5547
+ "data-testid": `arbi-dm-conversation-${peer.external_id}`,
5548
+ className: rowClass,
5549
+ children: [
5550
+ body,
5551
+ c.trailing
5552
+ ]
5553
+ }
5554
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
5555
+ "button",
5556
+ {
5557
+ type: "button",
5558
+ onClick: () => onSelect(peer.external_id),
5559
+ "data-testid": `arbi-dm-conversation-${peer.external_id}`,
5560
+ className: rowClass,
5561
+ children: body
5562
+ }
5563
+ )
5564
+ ] }, peer.external_id);
5486
5565
  }) }) })
5487
5566
  ]
5488
5567
  }
5489
5568
  );
5490
5569
  }
5491
- function MessageBubble2({ message, classNames }) {
5492
- const { isMine } = message;
5493
- const who = isMine ? "You" : userDisplayName(message.sender);
5494
- return /* @__PURE__ */ jsxRuntime.jsxs(
5495
- "div",
5570
+
5571
+ // src/directmessages/grouping.ts
5572
+ var RUN_WINDOW_MS = 2 * 60 * 1e3;
5573
+ function dayKey(iso) {
5574
+ const d = new Date(iso);
5575
+ if (Number.isNaN(d.getTime())) return iso;
5576
+ return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
5577
+ }
5578
+ function annotateThread(messages, accessors, runWindowMs = RUN_WINDOW_MS) {
5579
+ const { senderId, createdAt } = accessors;
5580
+ return messages.map((message, i) => {
5581
+ const next = messages[i + 1];
5582
+ const prev = messages[i - 1];
5583
+ const day = dayKey(createdAt(message));
5584
+ const continuesIntoNext = !!next && senderId(next) === senderId(message) && dayKey(createdAt(next)) === day && Date.parse(createdAt(next)) - Date.parse(createdAt(message)) < runWindowMs;
5585
+ return {
5586
+ message,
5587
+ isLastOfRun: !continuesIntoNext,
5588
+ isFirstOfDay: !prev || dayKey(createdAt(prev)) !== day
5589
+ };
5590
+ });
5591
+ }
5592
+ function DateSeparator({ children }) {
5593
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-3 flex justify-center", "data-testid": "dm-date-separator", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-background/80 px-2 py-0.5 text-xs text-muted-foreground", children }) });
5594
+ }
5595
+ function MessageBubble2({
5596
+ message,
5597
+ classNames,
5598
+ isLastOfRun = true,
5599
+ onDelete,
5600
+ deleted
5601
+ }) {
5602
+ return /* @__PURE__ */ jsxRuntime.jsx(
5603
+ ChatBubble,
5496
5604
  {
5497
5605
  "data-testid": "arbi-dm-message",
5498
- className: chunkZBZKHBDS_cjs.cn("flex flex-col gap-1", isMine ? "items-end" : "items-start"),
5499
- children: [
5500
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
5501
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-foreground", children: who }),
5502
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground", children: formatRelativeTime(message.createdAt) })
5503
- ] }),
5504
- /* @__PURE__ */ jsxRuntime.jsx(
5505
- "div",
5506
- {
5507
- className: chunkZBZKHBDS_cjs.cn(
5508
- "max-w-[80%] rounded-2xl px-3.5 py-2 text-sm shadow-sm",
5509
- isMine ? chunkZBZKHBDS_cjs.cn("rounded-br-sm bg-accent text-accent-foreground", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn(
5510
- "rounded-bl-sm border border-border bg-card text-card-foreground",
5511
- classNames?.peerBubble
5512
- )
5513
- ),
5514
- children: message.body
5515
- }
5516
- )
5517
- ]
5606
+ message: message.body,
5607
+ timestamp: message.createdAt,
5608
+ isSent: message.isMine,
5609
+ read: message.read,
5610
+ deleted,
5611
+ onDelete,
5612
+ isLastOfRun,
5613
+ senderName: message.isMine ? "You" : userDisplayName(message.sender),
5614
+ classNames,
5615
+ formatTimestamp: formatRelativeTime
5518
5616
  }
5519
5617
  );
5520
5618
  }
5521
- function MessageThread({ conversation, classNames, emptyState }) {
5619
+ var THREAD_ACCESSORS = {
5620
+ senderId: (m) => m.sender.external_id,
5621
+ createdAt: (m) => m.createdAt
5622
+ };
5623
+ function MessageThread({
5624
+ conversation,
5625
+ classNames,
5626
+ emptyState,
5627
+ formatDay,
5628
+ onDeleteMessage,
5629
+ deletedIds
5630
+ }) {
5522
5631
  const bottomRef = React2.useRef(null);
5632
+ const items = React2.useMemo(
5633
+ () => annotateThread(conversation?.messages ?? [], THREAD_ACCESSORS),
5634
+ [conversation?.messages]
5635
+ );
5523
5636
  React2.useEffect(() => {
5524
5637
  bottomRef.current?.scrollIntoView({ block: "end" });
5525
5638
  }, [conversation?.peer.external_id, conversation?.messages.length]);
@@ -5532,7 +5645,7 @@ function MessageThread({ conversation, classNames, emptyState }) {
5532
5645
  ] })
5533
5646
  ] }) });
5534
5647
  }
5535
- const { peer, messages } = conversation;
5648
+ const { peer } = conversation;
5536
5649
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5537
5650
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-center gap-3 border-b border-border px-4 py-3", children: [
5538
5651
  /* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer, className: "size-9" }),
@@ -5541,20 +5654,42 @@ function MessageThread({ conversation, classNames, emptyState }) {
5541
5654
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-muted-foreground", children: peer.email })
5542
5655
  ] })
5543
5656
  ] }),
5544
- /* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 px-4 py-4", "data-testid": "arbi-dm-thread", children: [
5545
- messages.map((m) => /* @__PURE__ */ jsxRuntime.jsx(MessageBubble2, { message: m, classNames }, m.externalId)),
5657
+ /* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4 py-4", "data-testid": "arbi-dm-thread", children: [
5658
+ items.map(({ message: m, isLastOfRun, isFirstOfDay }) => /* @__PURE__ */ jsxRuntime.jsxs(React2.Fragment, { children: [
5659
+ isFirstOfDay && formatDay && /* @__PURE__ */ jsxRuntime.jsx(DateSeparator, { children: formatDay(m.createdAt) }),
5660
+ /* @__PURE__ */ jsxRuntime.jsx(
5661
+ MessageBubble2,
5662
+ {
5663
+ message: m,
5664
+ classNames,
5665
+ isLastOfRun,
5666
+ deleted: deletedIds?.has(m.externalId),
5667
+ onDelete: onDeleteMessage ? () => onDeleteMessage(m) : void 0
5668
+ }
5669
+ )
5670
+ ] }, m.externalId)),
5546
5671
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: bottomRef })
5547
5672
  ] }) })
5548
5673
  ] });
5549
5674
  }
5550
- function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
5675
+ function DmComposer({
5676
+ placeholder,
5677
+ disabled,
5678
+ busy,
5679
+ onSend,
5680
+ error,
5681
+ children,
5682
+ classNames
5683
+ }) {
5551
5684
  const [draft, setDraft] = React2.useState("");
5685
+ const inputRef = React2.useRef(null);
5552
5686
  const submit = async () => {
5553
5687
  const text = draft.trim();
5554
- if (!text || disabled) return;
5688
+ if (!text || disabled || busy) return;
5555
5689
  setDraft("");
5556
5690
  try {
5557
5691
  await onSend(text);
5692
+ inputRef.current?.focus();
5558
5693
  } catch {
5559
5694
  setDraft(text);
5560
5695
  }
@@ -5566,10 +5701,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
5566
5701
  }
5567
5702
  };
5568
5703
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-3", children: [
5704
+ children,
5569
5705
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-2", children: [
5570
5706
  /* @__PURE__ */ jsxRuntime.jsx(
5571
5707
  chunkZBZKHBDS_cjs.Textarea,
5572
5708
  {
5709
+ ref: inputRef,
5573
5710
  value: draft,
5574
5711
  onChange: (e) => setDraft(e.target.value),
5575
5712
  onKeyDown,
@@ -5585,11 +5722,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
5585
5722
  {
5586
5723
  type: "button",
5587
5724
  onClick: () => void submit(),
5588
- disabled: disabled || !draft.trim(),
5725
+ disabled: disabled || busy || !draft.trim(),
5589
5726
  className: chunkZBZKHBDS_cjs.cn(classNames?.sendButton),
5590
5727
  "data-testid": "arbi-dm-send",
5728
+ "aria-label": "Send message",
5591
5729
  children: [
5592
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
5730
+ busy ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
5593
5731
  " Send"
5594
5732
  ]
5595
5733
  }
@@ -6793,6 +6931,14 @@ function DocumentGallery({
6793
6931
  );
6794
6932
  }
6795
6933
 
6934
+ Object.defineProperty(exports, "ArbiProvider", {
6935
+ enumerable: true,
6936
+ get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
6937
+ });
6938
+ Object.defineProperty(exports, "useArbi", {
6939
+ enumerable: true,
6940
+ get: function () { return chunkZMTLGO3K_cjs.useArbi; }
6941
+ });
6796
6942
  Object.defineProperty(exports, "AiMarkdown", {
6797
6943
  enumerable: true,
6798
6944
  get: function () { return chunkZBZKHBDS_cjs.AiMarkdown; }
@@ -7217,14 +7363,6 @@ Object.defineProperty(exports, "toggleVariants", {
7217
7363
  enumerable: true,
7218
7364
  get: function () { return chunkZBZKHBDS_cjs.toggleVariants; }
7219
7365
  });
7220
- Object.defineProperty(exports, "ArbiProvider", {
7221
- enumerable: true,
7222
- get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
7223
- });
7224
- Object.defineProperty(exports, "useArbi", {
7225
- enumerable: true,
7226
- get: function () { return chunkZMTLGO3K_cjs.useArbi; }
7227
- });
7228
7366
  Object.defineProperty(exports, "Arbi", {
7229
7367
  enumerable: true,
7230
7368
  get: function () { return browser.Arbi; }
@@ -7262,6 +7400,7 @@ exports.CommandPaletteProvider = CommandPaletteProvider;
7262
7400
  exports.ConversationList = ConversationList;
7263
7401
  exports.DEFAULT_ASPECT_OPTIONS = DEFAULT_ASPECT_OPTIONS;
7264
7402
  exports.DEFAULT_NOTIFY_TONE = DEFAULT_NOTIFY_TONE;
7403
+ exports.DateSeparator = DateSeparator;
7265
7404
  exports.DirectMessages = DirectMessages;
7266
7405
  exports.DmAvatar = DmAvatar;
7267
7406
  exports.DmComposer = DmComposer;
@@ -7300,6 +7439,7 @@ exports.PassageCard = PassageCard;
7300
7439
  exports.PdfIcon = PdfIcon;
7301
7440
  exports.ProjectEntity = ProjectEntity;
7302
7441
  exports.ProviderIcon = ProviderIcon;
7442
+ exports.RUN_WINDOW_MS = RUN_WINDOW_MS;
7303
7443
  exports.RagDot = RagDot;
7304
7444
  exports.RelevanceDot = RelevanceDot;
7305
7445
  exports.SemanticSearch = SemanticSearch;
@@ -7316,11 +7456,13 @@ exports.VISIBILITY_ICONS = VISIBILITY_ICONS;
7316
7456
  exports.VidIcon = VidIcon;
7317
7457
  exports.VisibilityIcon = VisibilityIcon;
7318
7458
  exports.XlsIcon = XlsIcon;
7459
+ exports.annotateThread = annotateThread;
7319
7460
  exports.arbiQueryKeys = arbiQueryKeys;
7320
7461
  exports.configureEntityRegistry = configureEntityRegistry;
7321
7462
  exports.configureRagLabels = configureRagLabels;
7322
7463
  exports.configureStatusRegistry = configureStatusRegistry;
7323
7464
  exports.cropImage = cropImage;
7465
+ exports.dayKey = dayKey;
7324
7466
  exports.describeActivity = describeActivity;
7325
7467
  exports.formatRelativeTime = formatRelativeTime;
7326
7468
  exports.getEntityColor = getEntityColor2;