@arbidocs/blocks 0.5.174 → 0.5.176

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.
Files changed (105) hide show
  1. package/dist/{ConnectedCallDock-LW7S4ROJ.cjs → ConnectedCallDock-KD5LWW2E.cjs} +5 -5
  2. package/dist/{ConnectedCallDock-LW7S4ROJ.cjs.map → ConnectedCallDock-KD5LWW2E.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-YXJUNNUX.cjs → ConnectedCallRoom-GSMF7ZUE.cjs} +5 -5
  4. package/dist/{ConnectedCallRoom-YXJUNNUX.cjs.map → ConnectedCallRoom-GSMF7ZUE.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-3MRTTNR2.cjs → ConnectedNativeDocxComparison-AAQJZYZH.cjs} +6 -6
  6. package/dist/{ConnectedNativeDocxComparison-3MRTTNR2.cjs.map → ConnectedNativeDocxComparison-AAQJZYZH.cjs.map} +1 -1
  7. package/dist/{ConnectedStreamedWordArtifact-HNTS6HS4.cjs → ConnectedStreamedWordArtifact-CSNA2CJD.cjs} +6 -6
  8. package/dist/{ConnectedStreamedWordArtifact-HNTS6HS4.cjs.map → ConnectedStreamedWordArtifact-CSNA2CJD.cjs.map} +1 -1
  9. package/dist/{DocumentReviewCard-JNLNWWW3.cjs → DocumentReviewCard-SOEYIMRO.cjs} +14 -14
  10. package/dist/{DocumentReviewCard-JNLNWWW3.cjs.map → DocumentReviewCard-SOEYIMRO.cjs.map} +1 -1
  11. package/dist/{FilesViewerDialog-VDZDL5Y6.cjs → FilesViewerDialog-RRAVDDN4.cjs} +15 -15
  12. package/dist/{FilesViewerDialog-VDZDL5Y6.cjs.map → FilesViewerDialog-RRAVDDN4.cjs.map} +1 -1
  13. package/dist/{WorkspaceTableView-QT63XYII.cjs → WorkspaceTableView-LGDLG3TX.cjs} +7 -7
  14. package/dist/{WorkspaceTableView-QT63XYII.cjs.map → WorkspaceTableView-LGDLG3TX.cjs.map} +1 -1
  15. package/dist/agents/index.cjs +162 -162
  16. package/dist/{ai-NZKIMYW5.cjs → ai-XIT4MY3S.cjs} +13 -13
  17. package/dist/ai-XIT4MY3S.cjs.map +1 -0
  18. package/dist/calls/index.cjs +23 -23
  19. package/dist/chat/CitationMark.js +3 -2
  20. package/dist/chat/CitationMark.js.map +2 -2
  21. package/dist/chat/index.cjs +25 -25
  22. package/dist/chat/passage-text.d.ts +6 -0
  23. package/dist/chat/passage-text.js +8 -0
  24. package/dist/chat/passage-text.js.map +7 -0
  25. package/dist/{chunk-KEV2R7WX.cjs → chunk-2TLEQBTM.cjs} +5 -5
  26. package/dist/{chunk-KEV2R7WX.cjs.map → chunk-2TLEQBTM.cjs.map} +1 -1
  27. package/dist/{chunk-TUURH4NE.cjs → chunk-5YLNNO3N.cjs} +4 -4
  28. package/dist/{chunk-TUURH4NE.cjs.map → chunk-5YLNNO3N.cjs.map} +1 -1
  29. package/dist/{chunk-L3MYUPSH.cjs → chunk-6AFAYGJW.cjs} +5 -5
  30. package/dist/{chunk-L3MYUPSH.cjs.map → chunk-6AFAYGJW.cjs.map} +1 -1
  31. package/dist/{chunk-7TEHA3JK.cjs → chunk-6CPJ5ZOY.cjs} +9 -4
  32. package/dist/chunk-6CPJ5ZOY.cjs.map +1 -0
  33. package/dist/{chunk-A257IJ5J.cjs → chunk-6EJ7KD4U.cjs} +6 -6
  34. package/dist/{chunk-A257IJ5J.cjs.map → chunk-6EJ7KD4U.cjs.map} +1 -1
  35. package/dist/{chunk-GAN4HOJ4.cjs → chunk-77FZT7AP.cjs} +62 -61
  36. package/dist/chunk-77FZT7AP.cjs.map +1 -0
  37. package/dist/{chunk-FE5EPT72.cjs → chunk-77MAR6Y4.cjs} +5 -5
  38. package/dist/{chunk-FE5EPT72.cjs.map → chunk-77MAR6Y4.cjs.map} +1 -1
  39. package/dist/{chunk-42TZ5T5X.cjs → chunk-AYK3BLUB.cjs} +3 -3
  40. package/dist/{chunk-42TZ5T5X.cjs.map → chunk-AYK3BLUB.cjs.map} +1 -1
  41. package/dist/{chunk-A7MGQMOV.cjs → chunk-H4N6BZNU.cjs} +3 -3
  42. package/dist/{chunk-A7MGQMOV.cjs.map → chunk-H4N6BZNU.cjs.map} +1 -1
  43. package/dist/{chunk-6TLNFMCX.cjs → chunk-IXKLARPD.cjs} +4 -4
  44. package/dist/{chunk-6TLNFMCX.cjs.map → chunk-IXKLARPD.cjs.map} +1 -1
  45. package/dist/{chunk-7TX2JCTZ.cjs → chunk-J7LSWWA3.cjs} +4 -4
  46. package/dist/{chunk-7TX2JCTZ.cjs.map → chunk-J7LSWWA3.cjs.map} +1 -1
  47. package/dist/{chunk-LYDSETR7.cjs → chunk-JEHGTPS2.cjs} +3 -3
  48. package/dist/{chunk-LYDSETR7.cjs.map → chunk-JEHGTPS2.cjs.map} +1 -1
  49. package/dist/{chunk-GLFMRQBT.cjs → chunk-MXP32DA2.cjs} +3 -3
  50. package/dist/{chunk-GLFMRQBT.cjs.map → chunk-MXP32DA2.cjs.map} +1 -1
  51. package/dist/{chunk-I5LXJLO5.cjs → chunk-MZPBZSKS.cjs} +3 -3
  52. package/dist/{chunk-I5LXJLO5.cjs.map → chunk-MZPBZSKS.cjs.map} +1 -1
  53. package/dist/{chunk-4LCLVVYD.cjs → chunk-N2YNXFT4.cjs} +42 -39
  54. package/dist/chunk-N2YNXFT4.cjs.map +1 -0
  55. package/dist/{chunk-K6C7L73R.cjs → chunk-OABDY4YO.cjs} +28 -28
  56. package/dist/{chunk-K6C7L73R.cjs.map → chunk-OABDY4YO.cjs.map} +1 -1
  57. package/dist/{chunk-4YFU5L4C.cjs → chunk-P3PTSXGJ.cjs} +4 -4
  58. package/dist/{chunk-4YFU5L4C.cjs.map → chunk-P3PTSXGJ.cjs.map} +1 -1
  59. package/dist/{chunk-HSYRI3JQ.cjs → chunk-POUMLXMJ.cjs} +6 -6
  60. package/dist/{chunk-HSYRI3JQ.cjs.map → chunk-POUMLXMJ.cjs.map} +1 -1
  61. package/dist/{chunk-4AT2LJ2H.cjs → chunk-PXC6RSHQ.cjs} +4 -4
  62. package/dist/{chunk-4AT2LJ2H.cjs.map → chunk-PXC6RSHQ.cjs.map} +1 -1
  63. package/dist/{chunk-STPBNALX.cjs → chunk-QEEK2Z5T.cjs} +28 -19
  64. package/dist/chunk-QEEK2Z5T.cjs.map +1 -0
  65. package/dist/{chunk-4S2JPEZG.cjs → chunk-TUTPAAFH.cjs} +27 -27
  66. package/dist/{chunk-4S2JPEZG.cjs.map → chunk-TUTPAAFH.cjs.map} +1 -1
  67. package/dist/{chunk-ZT6C4MNX.cjs → chunk-UC6Z7E6C.cjs} +4 -4
  68. package/dist/{chunk-ZT6C4MNX.cjs.map → chunk-UC6Z7E6C.cjs.map} +1 -1
  69. package/dist/{chunk-AJ3WUINN.cjs → chunk-VNK4HCHH.cjs} +31 -31
  70. package/dist/{chunk-AJ3WUINN.cjs.map → chunk-VNK4HCHH.cjs.map} +1 -1
  71. package/dist/{chunk-F6SXNJU3.cjs → chunk-XBM6TVZL.cjs} +4 -4
  72. package/dist/{chunk-F6SXNJU3.cjs.map → chunk-XBM6TVZL.cjs.map} +1 -1
  73. package/dist/connect/docx.cjs +9 -9
  74. package/dist/connect/index.cjs +976 -976
  75. package/dist/connect/viewer.cjs +12 -12
  76. package/dist/connection/files/explorer/FileTiles.js +6 -3
  77. package/dist/connection/files/explorer/FileTiles.js.map +2 -2
  78. package/dist/connection/viewer/ConnectedDocumentViewer.js +2 -1
  79. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  80. package/dist/connection/viewer/useViewerTabs.d.ts +1 -1
  81. package/dist/connection/viewer/useViewerTabs.js +2 -2
  82. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  83. package/dist/embed/index.cjs +16 -16
  84. package/dist/files/ExplorerTile.d.ts +7 -0
  85. package/dist/files/ExplorerTile.js +17 -14
  86. package/dist/files/ExplorerTile.js.map +2 -2
  87. package/dist/files/ViewerChrome.js +1 -1
  88. package/dist/files/ViewerChrome.js.map +2 -2
  89. package/dist/files/ViewerParts.d.ts +6 -1
  90. package/dist/files/ViewerParts.js +9 -2
  91. package/dist/files/ViewerParts.js.map +2 -2
  92. package/dist/files/index.cjs +227 -227
  93. package/dist/index.cjs +691 -691
  94. package/dist/pages/index.cjs +17 -17
  95. package/dist/settings/index.cjs +136 -136
  96. package/dist/studio/index.cjs +4 -4
  97. package/dist/styles.css +1 -1
  98. package/dist/workflow-canvas/index.cjs +25 -25
  99. package/node_modules/@arbidocs/coedit/package.json +1 -1
  100. package/package.json +5 -5
  101. package/dist/ai-NZKIMYW5.cjs.map +0 -1
  102. package/dist/chunk-4LCLVVYD.cjs.map +0 -1
  103. package/dist/chunk-7TEHA3JK.cjs.map +0 -1
  104. package/dist/chunk-GAN4HOJ4.cjs.map +0 -1
  105. package/dist/chunk-STPBNALX.cjs.map +0 -1
@@ -53,6 +53,7 @@ function TileLink({
53
53
  function isInsideTileLink(e) {
54
54
  return e.target instanceof Element && !!e.target.closest('[data-slot="explorer-tile-link"]');
55
55
  }
56
+ const TILE_SCALE = "[--tile-u:clamp(0.8px,0.5cqw,1.2px)]";
56
57
  function ExplorerMenu({
57
58
  items,
58
59
  testId,
@@ -70,10 +71,10 @@ function ExplorerMenu({
70
71
  onClick: (e) => e.stopPropagation(),
71
72
  onPointerDown: (e) => e.stopPropagation(),
72
73
  className: cn(
73
- "flex size-6 items-center justify-center rounded-md bg-background/90 text-muted-foreground backdrop-blur-sm transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-background data-[state=open]:text-foreground pointer-coarse:size-11",
74
+ "flex size-[calc(var(--tile-u,1px)*24)] items-center justify-center rounded-md bg-background/90 text-muted-foreground backdrop-blur-sm transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-background data-[state=open]:text-foreground pointer-coarse:size-11",
74
75
  triggerClassName
75
76
  ),
76
- children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" })
77
+ children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-[calc(var(--tile-u,1px)*16)]" })
77
78
  }
78
79
  ) }),
79
80
  /* @__PURE__ */ jsx(
@@ -170,7 +171,7 @@ function SelectCheckbox({
170
171
  onClick: onToggle,
171
172
  "aria-label": selected ? labels.deselect : labels.select,
172
173
  className: cn(
173
- "size-6 rounded-md border-muted-foreground/60 bg-card transition data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground pointer-coarse:size-9",
174
+ "size-[calc(var(--tile-u,1px)*24)] rounded-md border-muted-foreground/60 bg-card transition data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground pointer-coarse:size-9",
174
175
  selected ? "opacity-100" : "opacity-60 hover:opacity-100",
175
176
  className
176
177
  )
@@ -207,7 +208,7 @@ function ExplorerFileTile({
207
208
  const [thumbFailed, setThumbFailed] = useState(false);
208
209
  const [thumbLandscape, setThumbLandscape] = useState(false);
209
210
  const showThumbnail = !!thumbnailUrl && !thumbFailed && !progress;
210
- const tile = /* @__PURE__ */ jsxs(
211
+ const tile = /* @__PURE__ */ jsx(
211
212
  "div",
212
213
  {
213
214
  ref: rootRef,
@@ -228,11 +229,11 @@ function ExplorerFileTile({
228
229
  "data-testid": testIdOr(testIds?.root, { testId: "explorer-file" }),
229
230
  "data-doc-id": id,
230
231
  className: cn(
231
- "group relative h-full cursor-default select-none overflow-hidden rounded-lg border transition",
232
+ "@container group relative h-full cursor-default select-none overflow-hidden rounded-lg border transition",
232
233
  dragging && "opacity-40",
233
234
  selected ? "border-primary/30 bg-accent" : "border-border bg-muted hover:bg-muted/70"
234
235
  ),
235
- children: [
236
+ children: /* @__PURE__ */ jsxs("div", { className: TILE_SCALE, style: { display: "contents" }, children: [
236
237
  href && /* @__PURE__ */ jsx(TileLink, { href, label: title, onSelect: onOpen }),
237
238
  showThumbnail ? /* @__PURE__ */ jsx(
238
239
  "img",
@@ -299,7 +300,7 @@ function ExplorerFileTile({
299
300
  ] }),
300
301
  entity
301
302
  ] })
302
- ]
303
+ ] })
303
304
  }
304
305
  );
305
306
  if (!tooltip) return tile;
@@ -336,7 +337,7 @@ function ExplorerFolderTile({
336
337
  const isEmpty = count === 0;
337
338
  const countLabel = isEmpty ? l.empty : l.itemCount(count);
338
339
  const joined = path.join("/");
339
- return /* @__PURE__ */ jsxs(
340
+ return /* @__PURE__ */ jsx(
340
341
  "div",
341
342
  {
342
343
  ref: rootRef,
@@ -347,11 +348,11 @@ function ExplorerFolderTile({
347
348
  "data-folder-path": joined,
348
349
  title: name,
349
350
  className: cn(
350
- "group relative flex h-full cursor-pointer select-none flex-col items-center justify-center gap-1 rounded-lg p-2 text-center transition",
351
+ "@container group relative flex h-full cursor-pointer select-none flex-col items-center justify-center gap-1 rounded-lg p-2 text-center transition",
351
352
  isOver ? "bg-accent ring-2 ring-primary/40" : selected ? "bg-accent ring-1 ring-primary/30" : "bg-muted hover:bg-muted/70",
352
353
  isEmpty && !isOver && !selected && "opacity-70"
353
354
  ),
354
- children: [
355
+ children: /* @__PURE__ */ jsxs("div", { className: TILE_SCALE, style: { display: "contents" }, children: [
355
356
  href && !editing && /* @__PURE__ */ jsx(TileLink, { href, label: displayName || name, onSelect: onOpen }),
356
357
  onToggleSelect && !isEmpty && /* @__PURE__ */ jsx(
357
358
  SelectCheckbox,
@@ -379,6 +380,7 @@ function ExplorerFolderTile({
379
380
  {
380
381
  className: cn(
381
382
  "transition",
383
+ density === "list" ? "size-[calc(var(--tile-u,1px)*34)]" : "size-[calc(var(--tile-u,1px)*48)]",
382
384
  isEmpty ? "text-yellow-text/50" : "fill-yellow-text/30 text-yellow-text group-hover:fill-yellow-text/40"
383
385
  ),
384
386
  size: iconSize
@@ -398,13 +400,13 @@ function ExplorerFolderTile({
398
400
  "span",
399
401
  {
400
402
  className: cn(
401
- "line-clamp-2 w-full break-words text-xs font-semibold leading-tight",
403
+ "line-clamp-2 w-full break-words text-[length:calc(var(--tile-u,1px)*12)] font-semibold leading-tight",
402
404
  isEmpty ? "text-foreground/60" : "text-foreground/90"
403
405
  ),
404
406
  children: displayName
405
407
  }
406
408
  ),
407
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: countLabel }),
409
+ /* @__PURE__ */ jsx("span", { className: "text-[length:calc(var(--tile-u,1px)*12)] text-muted-foreground", children: countLabel }),
408
410
  processingCount > 0 && /* @__PURE__ */ jsxs(
409
411
  "span",
410
412
  {
@@ -418,7 +420,7 @@ function ExplorerFolderTile({
418
420
  ]
419
421
  }
420
422
  )
421
- ]
423
+ ] })
422
424
  }
423
425
  );
424
426
  }
@@ -469,6 +471,7 @@ export {
469
471
  DEFAULT_EXPLORER_LABELS,
470
472
  ExplorerFileTile,
471
473
  ExplorerFileTooltip,
472
- ExplorerFolderTile
474
+ ExplorerFolderTile,
475
+ TILE_SCALE
473
476
  };
474
477
  //# sourceMappingURL=ExplorerTile.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/files/ExplorerTile.tsx"],
4
- "sourcesContent": ["import { useRef, useState } from 'react'\nimport type { HTMLAttributes, MouseEvent, ReactNode, Ref } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { Folder, LoaderCircle, MoreHorizontal, Sparkles } from 'lucide-react'\nimport {\n Checkbox,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\nimport { testIdOr } from '../chat/test-id'\nimport { formatCount } from '../lib/format'\n\n/** Every fixed string of the explorer tiles. Pass a partial `labels` to translate or reword. */\nexport interface ExplorerLabels {\n moreActions: string\n name: string\n select: string\n deselect: string\n empty: string\n itemCount: (count: number) => string\n processing: (count: number) => string\n aiSummary: string\n noSummary: string\n lastModifiedBy: string\n shared: string\n private: string\n}\n\nexport const DEFAULT_EXPLORER_LABELS: ExplorerLabels = {\n moreActions: 'More actions',\n name: 'Name',\n select: 'Select',\n deselect: 'Deselect',\n empty: 'Empty',\n itemCount: (count) => formatCount(count, { one: 'item', other: 'items' }),\n processing: (count) => `${count} processing`,\n aiSummary: 'AI Summary:',\n noSummary: 'No AI summary is available for this document yet.',\n lastModifiedBy: 'Last modified by',\n shared: 'Shared',\n private: 'Private',\n}\n\nexport interface ExplorerFileTestIds {\n root: string\n menu: string\n renameInput: string\n}\n\nexport interface ExplorerFolderTestIds {\n root: string\n menu: string\n renameInput: string\n /** Replaces the whole `explorer-folder-processing-<path>` id. */\n processing: string\n}\n\n/** Stretched anchor under the tile controls: gives the tile a real URL when `href` is set. */\nfunction TileLink({\n href,\n label,\n onSelect,\n}: {\n href: string\n label: string\n onSelect: () => void\n}) {\n return (\n <ActionLink\n href={href}\n onSelect={onSelect}\n aria-label={label}\n data-slot=\"explorer-tile-link\"\n className=\"absolute inset-0 z-10 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n )\n}\n\nfunction isInsideTileLink(e: MouseEvent): boolean {\n return e.target instanceof Element && !!e.target.closest('[data-slot=\"explorer-tile-link\"]')\n}\n\nexport type ExplorerDensity = 'grid' | 'list'\n\nexport interface ExplorerMenuItem {\n id: string\n label: string\n icon: LucideIcon\n onSelect: () => void\n /** Red styling, for Delete. */\n destructive?: boolean\n /** Draw a separator above this item. */\n separatorBefore?: boolean\n /** A nested menu: the item opens it instead of acting (`onSelect` is then ignored). */\n submenu?: ExplorerMenuItem[]\n testId?: string\n}\n\nfunction ExplorerMenu({\n items,\n testId,\n label,\n align,\n triggerClassName,\n}: {\n items: ExplorerMenuItem[]\n testId: string\n label: string\n align: 'start' | 'end'\n triggerClassName?: string\n}) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={label}\n data-testid={testId}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n className={cn(\n 'flex size-6 items-center justify-center rounded-md bg-background/90 text-muted-foreground backdrop-blur-sm transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-background data-[state=open]:text-foreground pointer-coarse:size-11',\n triggerClassName\n )}\n >\n <MoreHorizontal className=\"size-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align={align}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n className=\"w-44\"\n >\n {items.map((item) => (\n <div key={item.id}>\n {item.separatorBefore && <DropdownMenuSeparator />}\n {item.submenu ? (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid={item.testId}>\n <item.icon className=\"mr-2 size-4\" />\n {item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-52\">\n {item.submenu.map((sub) => (\n <DropdownMenuItem key={sub.id} onSelect={sub.onSelect} data-testid={sub.testId}>\n <sub.icon className=\"mr-2 size-4\" />\n {sub.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n onSelect={item.onSelect}\n data-testid={item.testId}\n className={cn(item.destructive && 'text-destructive focus:text-destructive')}\n >\n <item.icon className=\"mr-2 size-4\" />\n {item.label}\n </DropdownMenuItem>\n )}\n </div>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/** Inline rename field. Enter / blur commits, Escape cancels; guarded against Enter-then-blur. */\nfunction RenameField({\n seed,\n testId,\n label,\n onCommit,\n onCancel,\n className,\n}: {\n seed: string\n testId: string\n label: string\n onCommit: (value: string) => void\n onCancel: () => void\n className?: string\n}) {\n const doneRef = useRef(false)\n const commit = (value: string) => {\n if (doneRef.current) return\n doneRef.current = true\n const trimmed = value.trim()\n if (trimmed && trimmed !== seed) onCommit(trimmed)\n else onCancel()\n }\n return (\n <input\n autoFocus\n defaultValue={seed}\n data-testid={testId}\n aria-label={label}\n onFocus={(e) => e.currentTarget.select()}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n commit(e.currentTarget.value)\n } else if (e.key === 'Escape') {\n e.preventDefault()\n doneRef.current = true\n onCancel()\n }\n }}\n onBlur={(e) => commit(e.currentTarget.value)}\n className={cn(\n 'w-full rounded-md border border-primary bg-background px-1 py-0.5 text-sm text-foreground outline-none',\n className\n )}\n />\n )\n}\n\n/** Selection checkbox: always visible (dimmed at rest), solid when selected. */\nfunction SelectCheckbox({\n selected,\n onToggle,\n labels,\n className,\n}: {\n selected: boolean\n onToggle: (e: MouseEvent) => void\n labels: Pick<ExplorerLabels, 'select' | 'deselect'>\n className?: string\n}) {\n return (\n <Checkbox\n checked={selected}\n // Pointer-down stop prevents the drag sensor / tile click from firing.\n onPointerDown={(e) => e.stopPropagation()}\n onClick={onToggle}\n aria-label={selected ? labels.deselect : labels.select}\n className={cn(\n 'size-6 rounded-md border-muted-foreground/60 bg-card transition data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground pointer-coarse:size-9',\n selected ? 'opacity-100' : 'opacity-60 hover:opacity-100',\n className\n )}\n />\n )\n}\n\n// \u2500\u2500 File tile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFileTileProps {\n /** Document id (`data-doc-id`). */\n id: string\n /** Rename seed: the display title. */\n title: string\n density: ExplorerDensity\n selected: boolean\n /** Part of an in-flight drag: dimmed. */\n dragging?: boolean\n renaming?: boolean\n /** First-page thumbnail (data URI/URL). Without one the file-type icon shows. */\n thumbnailUrl?: string\n /** Renders the file-type glyph at a pixel size. */\n renderFileIcon: (size: number) => ReactNode\n /** In-flight processing: shows a centred progress overlay with this label. */\n progress?: { label: string; queued: boolean }\n /** Terminal status marker (bottom-right), usually a `StatusPill`. */\n statusMarker?: ReactNode\n /** \"Available offline\" marker (bottom-left). */\n offlineMarker?: ReactNode\n /** The canonical entity pill at the bottom (click opens). */\n entity: ReactNode\n /** Hover card content. Omit to disable the tooltip (renaming, or while dragging). */\n tooltip?: ReactNode\n menuItems: ExplorerMenuItem[]\n /** Drag-and-drop hook-up: ref + listener/aria props from the host's DnD library. */\n rootRef?: Ref<HTMLDivElement>\n rootProps?: HTMLAttributes<HTMLDivElement>\n /** Plain click / double click / menu \"Open\". With `href`, a plain click still calls this. */\n onOpen: () => void\n /** Route of the document: the tile gets a real link (modified clicks go to the browser). */\n href?: string\n labels?: Partial<ExplorerLabels>\n /** Overrides for the test ids (defaults keep the current ids). */\n testIds?: Partial<ExplorerFileTestIds>\n /** Modifier (shift/meta/ctrl) click: range / toggle selection. */\n onSelect: (e: MouseEvent) => void\n onToggle: (e: MouseEvent) => void\n onCommitRename: (name: string) => void\n onCancelRename: () => void\n}\n\n/** One document tile: thumbnail (or icon) filling the tile with checkbox, menu, status and pill. */\nexport function ExplorerFileTile({\n id,\n title,\n density,\n selected,\n dragging,\n renaming,\n thumbnailUrl,\n renderFileIcon,\n progress,\n statusMarker,\n offlineMarker,\n entity,\n tooltip,\n menuItems,\n rootRef,\n rootProps,\n onOpen,\n href,\n labels,\n testIds,\n onSelect,\n onToggle,\n onCommitRename,\n onCancelRename,\n}: ExplorerFileTileProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...labels }\n const [thumbFailed, setThumbFailed] = useState(false)\n // Portrait pages fill the tile top-aligned; landscape / odd shapes are fit whole.\n const [thumbLandscape, setThumbLandscape] = useState(false)\n const showThumbnail = !!thumbnailUrl && !thumbFailed && !progress\n\n const tile = (\n <div\n ref={rootRef}\n {...rootProps}\n onClick={(e) => {\n if (href && isInsideTileLink(e)) {\n // The link owns plain and new-tab clicks; shift keeps range selection.\n if (e.shiftKey) {\n e.preventDefault()\n onSelect(e)\n }\n return\n }\n if (e.shiftKey || e.metaKey || e.ctrlKey) onSelect(e)\n else onOpen()\n }}\n onDoubleClick={onOpen}\n data-slot=\"explorer-file-tile\"\n data-testid={testIdOr(testIds?.root, { testId: 'explorer-file' })}\n data-doc-id={id}\n className={cn(\n 'group relative h-full cursor-default select-none overflow-hidden rounded-lg border transition',\n dragging && 'opacity-40',\n selected ? 'border-primary/30 bg-accent' : 'border-border bg-muted hover:bg-muted/70'\n )}\n >\n {href && <TileLink href={href} label={title} onSelect={onOpen} />}\n {showThumbnail ? (\n <img\n src={thumbnailUrl}\n alt=\"\"\n loading=\"lazy\"\n draggable={false}\n onError={() => setThumbFailed(true)}\n onLoad={(e) =>\n setThumbLandscape(e.currentTarget.naturalWidth > e.currentTarget.naturalHeight)\n }\n className={cn(\n 'absolute inset-0 size-full bg-card',\n thumbLandscape ? 'object-contain' : 'object-cover object-top'\n )}\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderFileIcon(density === 'list' ? 30 : 44)}\n </div>\n )}\n\n {progress && (\n <div className=\"absolute inset-0 z-10 flex flex-col items-center justify-center gap-1.5 bg-background/80 px-3\">\n <div\n className={cn(\n 'h-1.5 w-full rounded-sm',\n progress.queued ? 'progress-bar-queued' : 'progress-bar-processing'\n )}\n />\n <span className=\"text-xs font-medium text-primary\">{progress.label}</span>\n </div>\n )}\n\n <SelectCheckbox\n selected={selected}\n onToggle={onToggle}\n labels={l}\n className=\"absolute left-1.5 top-1.5 z-20\"\n />\n\n <div className=\"absolute right-1.5 top-1.5 z-20\">\n <ExplorerMenu\n items={menuItems}\n testId={testIdOr(testIds?.menu, { testId: 'explorer-file-menu' })}\n label={l.moreActions}\n align=\"start\"\n />\n </div>\n\n {renaming ? (\n <div className=\"absolute inset-x-0 bottom-0 z-20 flex items-center gap-1 bg-background/90 px-1.5 py-1 backdrop-blur-sm\">\n <span className=\"shrink-0\">{renderFileIcon(13)}</span>\n <RenameField\n seed={title}\n testId={testIdOr(testIds?.renameInput, { testId: 'explorer-rename-input' })}\n label={l.name}\n onCommit={onCommitRename}\n onCancel={onCancelRename}\n className=\"flex-1 text-left\"\n />\n </div>\n ) : (\n <div className=\"absolute inset-x-1.5 bottom-1.5 z-20 flex flex-col gap-1\">\n {(offlineMarker || statusMarker) && (\n <div className=\"flex items-center\">\n {offlineMarker}\n {statusMarker && <div className=\"ml-auto flex\">{statusMarker}</div>}\n </div>\n )}\n {entity}\n </div>\n )}\n </div>\n )\n\n if (!tooltip) return tile\n return (\n <Tooltip delayDuration={500}>\n <TooltipTrigger asChild>{tile}</TooltipTrigger>\n <TooltipContent side=\"bottom\" sideOffset={6} className=\"p-2.5\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n )\n}\n\n// \u2500\u2500 Folder tile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFolderTileProps {\n /** Stored folder name (rename seed, native tooltip). */\n name: string\n /** Label shown on the tile; `''`/null renders no label (provider roots shorten to nothing). */\n displayName: string | null\n /** Folder path segments (ids and `data-folder-path`). */\n path: string[]\n /** Number of items beneath this folder; 0 renders it faded as \"Empty\". */\n count: number\n density: ExplorerDensity\n editing?: boolean\n /** Every document beneath is selected. */\n selected?: boolean\n /** Some (not all) documents beneath are selected. */\n partiallySelected?: boolean\n processingCount?: number\n /** A dragged item is over this folder. */\n isOver?: boolean\n /** Replace the folder glyph (e.g. a provider's brand mark). */\n icon?: ReactNode\n menuItems?: ExplorerMenuItem[]\n rootRef?: Ref<HTMLDivElement>\n rootProps?: HTMLAttributes<HTMLDivElement>\n onOpen: () => void\n /** Route of the folder: the tile gets a real link (modified clicks go to the browser). */\n href?: string\n labels?: Partial<ExplorerLabels>\n /** Overrides for the test ids (defaults keep the current ids). */\n testIds?: Partial<ExplorerFolderTestIds>\n onToggleSelect?: (e: MouseEvent) => void\n onCommitName?: (name: string) => void\n onCancelName?: () => void\n}\n\n/** One folder tile: glyph, name, item count, optional processing count and actions menu. */\nexport function ExplorerFolderTile({\n name,\n displayName,\n path,\n count,\n density,\n editing,\n selected,\n partiallySelected,\n processingCount = 0,\n isOver,\n icon,\n menuItems = [],\n rootRef,\n rootProps,\n onOpen,\n href,\n labels,\n testIds,\n onToggleSelect,\n onCommitName,\n onCancelName,\n}: ExplorerFolderTileProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...labels }\n const iconSize = density === 'list' ? 34 : 48\n const isEmpty = count === 0\n const countLabel = isEmpty ? l.empty : l.itemCount(count)\n const joined = path.join('/')\n\n return (\n <div\n ref={rootRef}\n {...rootProps}\n onClick={editing || href ? undefined : onOpen}\n data-slot=\"explorer-folder-tile\"\n data-testid={testIdOr(testIds?.root, { testId: 'explorer-folder' })}\n data-folder-path={joined}\n title={name}\n className={cn(\n 'group relative flex h-full cursor-pointer select-none flex-col items-center justify-center gap-1 rounded-lg p-2 text-center transition',\n isOver\n ? 'bg-accent ring-2 ring-primary/40'\n : selected\n ? 'bg-accent ring-1 ring-primary/30'\n : 'bg-muted hover:bg-muted/70',\n isEmpty && !isOver && !selected && 'opacity-70'\n )}\n >\n {href && !editing && <TileLink href={href} label={displayName || name} onSelect={onOpen} />}\n {onToggleSelect && !isEmpty && (\n <SelectCheckbox\n selected={!!selected}\n onToggle={onToggleSelect}\n labels={l}\n className={cn(\n 'absolute left-1.5 top-1.5 z-20',\n partiallySelected && !selected && 'opacity-100'\n )}\n />\n )}\n {menuItems.length > 0 && !editing && (\n <div className=\"absolute right-1 top-1 z-20\">\n <ExplorerMenu\n items={menuItems}\n testId={testIdOr(testIds?.menu, { testId: 'explorer-folder-menu' })}\n label={l.moreActions}\n align=\"end\"\n />\n </div>\n )}\n {icon ?? (\n <Folder\n className={cn(\n 'transition',\n isEmpty\n ? 'text-yellow-text/50'\n : 'fill-yellow-text/30 text-yellow-text group-hover:fill-yellow-text/40'\n )}\n size={iconSize}\n />\n )}\n {editing ? (\n <RenameField\n seed={name}\n testId={testIdOr(testIds?.renameInput, { testId: 'explorer-rename-input' })}\n label={l.name}\n onCommit={(next) => onCommitName?.(next)}\n onCancel={() => onCancelName?.()}\n className=\"text-center\"\n />\n ) : (\n displayName && (\n <span\n className={cn(\n 'line-clamp-2 w-full break-words text-xs font-semibold leading-tight',\n isEmpty ? 'text-foreground/60' : 'text-foreground/90'\n )}\n >\n {displayName}\n </span>\n )\n )}\n <span className=\"text-xs text-muted-foreground\">{countLabel}</span>\n {processingCount > 0 && (\n <span\n className=\"inline-flex items-center gap-1 text-xs font-semibold text-primary\"\n data-testid={testIdOr(testIds?.processing, {\n testId: `explorer-folder-processing-${joined}`,\n })}\n >\n <LoaderCircle className=\"size-3 animate-spin\" />\n {l.processing(processingCount)}\n </span>\n )}\n </div>\n )\n}\n\n// \u2500\u2500 Hover card \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFileTooltipProps {\n title: string\n /** AI summary; a placeholder is shown when empty. */\n summary?: string | null\n /** Pre-formatted \"last modified\" date; omit to hide the meta rows. */\n modifiedLabel?: string | null\n /** Small avatar of whoever last modified it. */\n modifiedByAvatar?: ReactNode\n shared: boolean\n /** Glyph for the shared/private state. */\n visibilityIcon?: ReactNode\n labels: string[]\n /** Fixed strings of the card (not the document labels above). */\n uiLabels?: Partial<ExplorerLabels>\n}\n\n/** The explorer hover card: leads with the AI summary, then who/when and the labels. */\nexport function ExplorerFileTooltip({\n title,\n summary,\n modifiedLabel,\n modifiedByAvatar,\n shared,\n visibilityIcon,\n labels,\n uiLabels,\n}: ExplorerFileTooltipProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...uiLabels }\n return (\n <div className=\"max-w-xs space-y-2\">\n <div className=\"break-words text-xs font-semibold leading-snug text-foreground\">{title}</div>\n <div className=\"space-y-1 border-t border-border pt-1.5\">\n <div className=\"flex items-center gap-1 text-xs font-semibold text-foreground\">\n <Sparkles className=\"size-3.5 shrink-0 text-yellow-text\" />\n {l.aiSummary}\n </div>\n <p className=\"line-clamp-6 text-xs leading-snug text-foreground/90\">\n {summary?.trim() || l.noSummary}\n </p>\n </div>\n {(modifiedLabel || labels.length > 0) && (\n <div className=\"space-y-1.5 border-t border-border pt-1.5\">\n {modifiedLabel && (\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1\">\n <span>{l.lastModifiedBy}</span>\n {modifiedByAvatar}\n <span>{modifiedLabel}</span>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {visibilityIcon}\n <span>{shared ? l.shared : l.private}</span>\n </div>\n </div>\n )}\n {labels.length > 0 && (\n <div className=\"flex flex-wrap gap-1 pt-0.5\">\n {labels.map((label) => (\n <span\n key={label}\n className=\"rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground/80\"\n >\n {label}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n"],
5
- "mappings": ";AA+EI,cAuEY,YAvEZ;AA/EJ,SAAS,QAAQ,gBAAgB;AAGjC,SAAS,QAAQ,cAAc,gBAAgB,gBAAgB;AAC/D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAkBrB,MAAM,0BAA0C;AAAA,EACrD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP,WAAW,CAAC,UAAU,YAAY,OAAO,EAAE,KAAK,QAAQ,OAAO,QAAQ,CAAC;AAAA,EACxE,YAAY,CAAC,UAAU,GAAG,KAAK;AAAA,EAC/B,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,SAAS;AACX;AAiBA,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,cAAY;AAAA,MACZ,aAAU;AAAA,MACV,WAAU;AAAA;AAAA,EACZ;AAEJ;AAEA,SAAS,iBAAiB,GAAwB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ED;AAAA,kCAAC,gBAAa,WAAU,uBAAsB;AAAA,cAC7C,EAAE,WAAW,eAAe;AAAA;AAAA;AAAA,QAC/B;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAqBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,QAAM,IAAI,EAAE,GAAG,yBAAyB,GAAG,SAAS;AACpD,SACE,qBAAC,SAAI,WAAU,sBACb;AAAA,wBAAC,SAAI,WAAU,kEAAkE,iBAAM;AAAA,IACvF,qBAAC,SAAI,WAAU,2CACb;AAAA,2BAAC,SAAI,WAAU,iEACb;AAAA,4BAAC,YAAS,WAAU,sCAAqC;AAAA,QACxD,EAAE;AAAA,SACL;AAAA,MACA,oBAAC,OAAE,WAAU,wDACV,mBAAS,KAAK,KAAK,EAAE,WACxB;AAAA,OACF;AAAA,KACE,iBAAiB,OAAO,SAAS,MACjC,qBAAC,SAAI,WAAU,6CACZ;AAAA,uBACC,qBAAC,SAAI,WAAU,yEACb;AAAA,6BAAC,SAAI,WAAU,6CACb;AAAA,8BAAC,UAAM,YAAE,gBAAe;AAAA,UACvB;AAAA,UACD,oBAAC,UAAM,yBAAc;AAAA,WACvB;AAAA,QACA,qBAAC,SAAI,WAAU,oCACZ;AAAA;AAAA,UACD,oBAAC,UAAM,mBAAS,EAAE,SAAS,EAAE,SAAQ;AAAA,WACvC;AAAA,SACF;AAAA,MAED,OAAO,SAAS,KACf,oBAAC,SAAI,WAAU,+BACZ,iBAAO,IAAI,CAAC,UACX;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAET;AAAA;AAAA,QAHI;AAAA,MAIP,CACD,GACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ;",
4
+ "sourcesContent": ["import { useRef, useState } from 'react'\nimport type { HTMLAttributes, MouseEvent, ReactNode, Ref } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { Folder, LoaderCircle, MoreHorizontal, Sparkles } from 'lucide-react'\nimport {\n Checkbox,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\nimport { testIdOr } from '../chat/test-id'\nimport { formatCount } from '../lib/format'\n\n/** Every fixed string of the explorer tiles. Pass a partial `labels` to translate or reword. */\nexport interface ExplorerLabels {\n moreActions: string\n name: string\n select: string\n deselect: string\n empty: string\n itemCount: (count: number) => string\n processing: (count: number) => string\n aiSummary: string\n noSummary: string\n lastModifiedBy: string\n shared: string\n private: string\n}\n\nexport const DEFAULT_EXPLORER_LABELS: ExplorerLabels = {\n moreActions: 'More actions',\n name: 'Name',\n select: 'Select',\n deselect: 'Deselect',\n empty: 'Empty',\n itemCount: (count) => formatCount(count, { one: 'item', other: 'items' }),\n processing: (count) => `${count} processing`,\n aiSummary: 'AI Summary:',\n noSummary: 'No AI summary is available for this document yet.',\n lastModifiedBy: 'Last modified by',\n shared: 'Shared',\n private: 'Private',\n}\n\nexport interface ExplorerFileTestIds {\n root: string\n menu: string\n renameInput: string\n}\n\nexport interface ExplorerFolderTestIds {\n root: string\n menu: string\n renameInput: string\n /** Replaces the whole `explorer-folder-processing-<path>` id. */\n processing: string\n}\n\n/** Stretched anchor under the tile controls: gives the tile a real URL when `href` is set. */\nfunction TileLink({\n href,\n label,\n onSelect,\n}: {\n href: string\n label: string\n onSelect: () => void\n}) {\n return (\n <ActionLink\n href={href}\n onSelect={onSelect}\n aria-label={label}\n data-slot=\"explorer-tile-link\"\n className=\"absolute inset-0 z-10 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n )\n}\n\nfunction isInsideTileLink(e: MouseEvent): boolean {\n return e.target instanceof Element && !!e.target.closest('[data-slot=\"explorer-tile-link\"]')\n}\n\n/**\n * The tile's unit, set on a `display: contents` child of the tile (which is an `@container`):\n * 1px at a 200px-wide tile, 0.8px at 160px and below, 1.2px at 240px and above. Controls, text and\n * glyphs inside the tile size themselves as `calc(var(--tile-u, 1px) * <px at 200px>)`, so they\n * follow the Gallery zoom. Touch screens keep their 44px targets (`pointer-coarse:` wins).\n */\nexport const TILE_SCALE = '[--tile-u:clamp(0.8px,0.5cqw,1.2px)]'\n\nexport type ExplorerDensity = 'grid' | 'list'\n\nexport interface ExplorerMenuItem {\n id: string\n label: string\n icon: LucideIcon\n onSelect: () => void\n /** Red styling, for Delete. */\n destructive?: boolean\n /** Draw a separator above this item. */\n separatorBefore?: boolean\n /** A nested menu: the item opens it instead of acting (`onSelect` is then ignored). */\n submenu?: ExplorerMenuItem[]\n testId?: string\n}\n\nfunction ExplorerMenu({\n items,\n testId,\n label,\n align,\n triggerClassName,\n}: {\n items: ExplorerMenuItem[]\n testId: string\n label: string\n align: 'start' | 'end'\n triggerClassName?: string\n}) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={label}\n data-testid={testId}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n className={cn(\n 'flex size-[calc(var(--tile-u,1px)*24)] items-center justify-center rounded-md bg-background/90 text-muted-foreground backdrop-blur-sm transition hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-background data-[state=open]:text-foreground pointer-coarse:size-11',\n triggerClassName\n )}\n >\n <MoreHorizontal className=\"size-[calc(var(--tile-u,1px)*16)]\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align={align}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n className=\"w-44\"\n >\n {items.map((item) => (\n <div key={item.id}>\n {item.separatorBefore && <DropdownMenuSeparator />}\n {item.submenu ? (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid={item.testId}>\n <item.icon className=\"mr-2 size-4\" />\n {item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-52\">\n {item.submenu.map((sub) => (\n <DropdownMenuItem key={sub.id} onSelect={sub.onSelect} data-testid={sub.testId}>\n <sub.icon className=\"mr-2 size-4\" />\n {sub.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n onSelect={item.onSelect}\n data-testid={item.testId}\n className={cn(item.destructive && 'text-destructive focus:text-destructive')}\n >\n <item.icon className=\"mr-2 size-4\" />\n {item.label}\n </DropdownMenuItem>\n )}\n </div>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/** Inline rename field. Enter / blur commits, Escape cancels; guarded against Enter-then-blur. */\nfunction RenameField({\n seed,\n testId,\n label,\n onCommit,\n onCancel,\n className,\n}: {\n seed: string\n testId: string\n label: string\n onCommit: (value: string) => void\n onCancel: () => void\n className?: string\n}) {\n const doneRef = useRef(false)\n const commit = (value: string) => {\n if (doneRef.current) return\n doneRef.current = true\n const trimmed = value.trim()\n if (trimmed && trimmed !== seed) onCommit(trimmed)\n else onCancel()\n }\n return (\n <input\n autoFocus\n defaultValue={seed}\n data-testid={testId}\n aria-label={label}\n onFocus={(e) => e.currentTarget.select()}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n commit(e.currentTarget.value)\n } else if (e.key === 'Escape') {\n e.preventDefault()\n doneRef.current = true\n onCancel()\n }\n }}\n onBlur={(e) => commit(e.currentTarget.value)}\n className={cn(\n 'w-full rounded-md border border-primary bg-background px-1 py-0.5 text-sm text-foreground outline-none',\n className\n )}\n />\n )\n}\n\n/** Selection checkbox: always visible (dimmed at rest), solid when selected. */\nfunction SelectCheckbox({\n selected,\n onToggle,\n labels,\n className,\n}: {\n selected: boolean\n onToggle: (e: MouseEvent) => void\n labels: Pick<ExplorerLabels, 'select' | 'deselect'>\n className?: string\n}) {\n return (\n <Checkbox\n checked={selected}\n // Pointer-down stop prevents the drag sensor / tile click from firing.\n onPointerDown={(e) => e.stopPropagation()}\n onClick={onToggle}\n aria-label={selected ? labels.deselect : labels.select}\n className={cn(\n 'size-[calc(var(--tile-u,1px)*24)] rounded-md border-muted-foreground/60 bg-card transition data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground pointer-coarse:size-9',\n selected ? 'opacity-100' : 'opacity-60 hover:opacity-100',\n className\n )}\n />\n )\n}\n\n// \u2500\u2500 File tile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFileTileProps {\n /** Document id (`data-doc-id`). */\n id: string\n /** Rename seed: the display title. */\n title: string\n density: ExplorerDensity\n selected: boolean\n /** Part of an in-flight drag: dimmed. */\n dragging?: boolean\n renaming?: boolean\n /** First-page thumbnail (data URI/URL). Without one the file-type icon shows. */\n thumbnailUrl?: string\n /** Renders the file-type glyph at a pixel size. */\n renderFileIcon: (size: number) => ReactNode\n /** In-flight processing: shows a centred progress overlay with this label. */\n progress?: { label: string; queued: boolean }\n /** Terminal status marker (bottom-right), usually a `StatusPill`. */\n statusMarker?: ReactNode\n /** \"Available offline\" marker (bottom-left). */\n offlineMarker?: ReactNode\n /** The canonical entity pill at the bottom (click opens). */\n entity: ReactNode\n /** Hover card content. Omit to disable the tooltip (renaming, or while dragging). */\n tooltip?: ReactNode\n menuItems: ExplorerMenuItem[]\n /** Drag-and-drop hook-up: ref + listener/aria props from the host's DnD library. */\n rootRef?: Ref<HTMLDivElement>\n rootProps?: HTMLAttributes<HTMLDivElement>\n /** Plain click / double click / menu \"Open\". With `href`, a plain click still calls this. */\n onOpen: () => void\n /** Route of the document: the tile gets a real link (modified clicks go to the browser). */\n href?: string\n labels?: Partial<ExplorerLabels>\n /** Overrides for the test ids (defaults keep the current ids). */\n testIds?: Partial<ExplorerFileTestIds>\n /** Modifier (shift/meta/ctrl) click: range / toggle selection. */\n onSelect: (e: MouseEvent) => void\n onToggle: (e: MouseEvent) => void\n onCommitRename: (name: string) => void\n onCancelRename: () => void\n}\n\n/** One document tile: thumbnail (or icon) filling the tile with checkbox, menu, status and pill. */\nexport function ExplorerFileTile({\n id,\n title,\n density,\n selected,\n dragging,\n renaming,\n thumbnailUrl,\n renderFileIcon,\n progress,\n statusMarker,\n offlineMarker,\n entity,\n tooltip,\n menuItems,\n rootRef,\n rootProps,\n onOpen,\n href,\n labels,\n testIds,\n onSelect,\n onToggle,\n onCommitRename,\n onCancelRename,\n}: ExplorerFileTileProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...labels }\n const [thumbFailed, setThumbFailed] = useState(false)\n // Portrait pages fill the tile top-aligned; landscape / odd shapes are fit whole.\n const [thumbLandscape, setThumbLandscape] = useState(false)\n const showThumbnail = !!thumbnailUrl && !thumbFailed && !progress\n\n const tile = (\n <div\n ref={rootRef}\n {...rootProps}\n onClick={(e) => {\n if (href && isInsideTileLink(e)) {\n // The link owns plain and new-tab clicks; shift keeps range selection.\n if (e.shiftKey) {\n e.preventDefault()\n onSelect(e)\n }\n return\n }\n if (e.shiftKey || e.metaKey || e.ctrlKey) onSelect(e)\n else onOpen()\n }}\n onDoubleClick={onOpen}\n data-slot=\"explorer-file-tile\"\n data-testid={testIdOr(testIds?.root, { testId: 'explorer-file' })}\n data-doc-id={id}\n className={cn(\n '@container group relative h-full cursor-default select-none overflow-hidden rounded-lg border transition',\n dragging && 'opacity-40',\n selected ? 'border-primary/30 bg-accent' : 'border-border bg-muted hover:bg-muted/70'\n )}\n >\n <div className={TILE_SCALE} style={{ display: 'contents' }}>\n {href && <TileLink href={href} label={title} onSelect={onOpen} />}\n {showThumbnail ? (\n <img\n src={thumbnailUrl}\n alt=\"\"\n loading=\"lazy\"\n draggable={false}\n onError={() => setThumbFailed(true)}\n onLoad={(e) =>\n setThumbLandscape(e.currentTarget.naturalWidth > e.currentTarget.naturalHeight)\n }\n className={cn(\n 'absolute inset-0 size-full bg-card',\n thumbLandscape ? 'object-contain' : 'object-cover object-top'\n )}\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderFileIcon(density === 'list' ? 30 : 44)}\n </div>\n )}\n\n {progress && (\n <div className=\"absolute inset-0 z-10 flex flex-col items-center justify-center gap-1.5 bg-background/80 px-3\">\n <div\n className={cn(\n 'h-1.5 w-full rounded-sm',\n progress.queued ? 'progress-bar-queued' : 'progress-bar-processing'\n )}\n />\n <span className=\"text-xs font-medium text-primary\">{progress.label}</span>\n </div>\n )}\n\n <SelectCheckbox\n selected={selected}\n onToggle={onToggle}\n labels={l}\n className=\"absolute left-1.5 top-1.5 z-20\"\n />\n\n <div className=\"absolute right-1.5 top-1.5 z-20\">\n <ExplorerMenu\n items={menuItems}\n testId={testIdOr(testIds?.menu, { testId: 'explorer-file-menu' })}\n label={l.moreActions}\n align=\"start\"\n />\n </div>\n\n {renaming ? (\n <div className=\"absolute inset-x-0 bottom-0 z-20 flex items-center gap-1 bg-background/90 px-1.5 py-1 backdrop-blur-sm\">\n <span className=\"shrink-0\">{renderFileIcon(13)}</span>\n <RenameField\n seed={title}\n testId={testIdOr(testIds?.renameInput, { testId: 'explorer-rename-input' })}\n label={l.name}\n onCommit={onCommitRename}\n onCancel={onCancelRename}\n className=\"flex-1 text-left\"\n />\n </div>\n ) : (\n <div className=\"absolute inset-x-1.5 bottom-1.5 z-20 flex flex-col gap-1\">\n {(offlineMarker || statusMarker) && (\n <div className=\"flex items-center\">\n {offlineMarker}\n {statusMarker && <div className=\"ml-auto flex\">{statusMarker}</div>}\n </div>\n )}\n {entity}\n </div>\n )}\n </div>\n </div>\n )\n\n if (!tooltip) return tile\n return (\n <Tooltip delayDuration={500}>\n <TooltipTrigger asChild>{tile}</TooltipTrigger>\n <TooltipContent side=\"bottom\" sideOffset={6} className=\"p-2.5\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n )\n}\n\n// \u2500\u2500 Folder tile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFolderTileProps {\n /** Stored folder name (rename seed, native tooltip). */\n name: string\n /** Label shown on the tile; `''`/null renders no label (provider roots shorten to nothing). */\n displayName: string | null\n /** Folder path segments (ids and `data-folder-path`). */\n path: string[]\n /** Number of items beneath this folder; 0 renders it faded as \"Empty\". */\n count: number\n density: ExplorerDensity\n editing?: boolean\n /** Every document beneath is selected. */\n selected?: boolean\n /** Some (not all) documents beneath are selected. */\n partiallySelected?: boolean\n processingCount?: number\n /** A dragged item is over this folder. */\n isOver?: boolean\n /** Replace the folder glyph (e.g. a provider's brand mark). */\n icon?: ReactNode\n menuItems?: ExplorerMenuItem[]\n rootRef?: Ref<HTMLDivElement>\n rootProps?: HTMLAttributes<HTMLDivElement>\n onOpen: () => void\n /** Route of the folder: the tile gets a real link (modified clicks go to the browser). */\n href?: string\n labels?: Partial<ExplorerLabels>\n /** Overrides for the test ids (defaults keep the current ids). */\n testIds?: Partial<ExplorerFolderTestIds>\n onToggleSelect?: (e: MouseEvent) => void\n onCommitName?: (name: string) => void\n onCancelName?: () => void\n}\n\n/** One folder tile: glyph, name, item count, optional processing count and actions menu. */\nexport function ExplorerFolderTile({\n name,\n displayName,\n path,\n count,\n density,\n editing,\n selected,\n partiallySelected,\n processingCount = 0,\n isOver,\n icon,\n menuItems = [],\n rootRef,\n rootProps,\n onOpen,\n href,\n labels,\n testIds,\n onToggleSelect,\n onCommitName,\n onCancelName,\n}: ExplorerFolderTileProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...labels }\n const iconSize = density === 'list' ? 34 : 48\n const isEmpty = count === 0\n const countLabel = isEmpty ? l.empty : l.itemCount(count)\n const joined = path.join('/')\n\n return (\n <div\n ref={rootRef}\n {...rootProps}\n onClick={editing || href ? undefined : onOpen}\n data-slot=\"explorer-folder-tile\"\n data-testid={testIdOr(testIds?.root, { testId: 'explorer-folder' })}\n data-folder-path={joined}\n title={name}\n className={cn(\n '@container group relative flex h-full cursor-pointer select-none flex-col items-center justify-center gap-1 rounded-lg p-2 text-center transition',\n isOver\n ? 'bg-accent ring-2 ring-primary/40'\n : selected\n ? 'bg-accent ring-1 ring-primary/30'\n : 'bg-muted hover:bg-muted/70',\n isEmpty && !isOver && !selected && 'opacity-70'\n )}\n >\n <div className={TILE_SCALE} style={{ display: 'contents' }}>\n {href && !editing && <TileLink href={href} label={displayName || name} onSelect={onOpen} />}\n {onToggleSelect && !isEmpty && (\n <SelectCheckbox\n selected={!!selected}\n onToggle={onToggleSelect}\n labels={l}\n className={cn(\n 'absolute left-1.5 top-1.5 z-20',\n partiallySelected && !selected && 'opacity-100'\n )}\n />\n )}\n {menuItems.length > 0 && !editing && (\n <div className=\"absolute right-1 top-1 z-20\">\n <ExplorerMenu\n items={menuItems}\n testId={testIdOr(testIds?.menu, { testId: 'explorer-folder-menu' })}\n label={l.moreActions}\n align=\"end\"\n />\n </div>\n )}\n {icon ?? (\n <Folder\n className={cn(\n 'transition',\n density === 'list'\n ? 'size-[calc(var(--tile-u,1px)*34)]'\n : 'size-[calc(var(--tile-u,1px)*48)]',\n isEmpty\n ? 'text-yellow-text/50'\n : 'fill-yellow-text/30 text-yellow-text group-hover:fill-yellow-text/40'\n )}\n size={iconSize}\n />\n )}\n {editing ? (\n <RenameField\n seed={name}\n testId={testIdOr(testIds?.renameInput, { testId: 'explorer-rename-input' })}\n label={l.name}\n onCommit={(next) => onCommitName?.(next)}\n onCancel={() => onCancelName?.()}\n className=\"text-center\"\n />\n ) : (\n displayName && (\n <span\n className={cn(\n 'line-clamp-2 w-full break-words text-[length:calc(var(--tile-u,1px)*12)] font-semibold leading-tight',\n isEmpty ? 'text-foreground/60' : 'text-foreground/90'\n )}\n >\n {displayName}\n </span>\n )\n )}\n <span className=\"text-[length:calc(var(--tile-u,1px)*12)] text-muted-foreground\">\n {countLabel}\n </span>\n {processingCount > 0 && (\n <span\n className=\"inline-flex items-center gap-1 text-xs font-semibold text-primary\"\n data-testid={testIdOr(testIds?.processing, {\n testId: `explorer-folder-processing-${joined}`,\n })}\n >\n <LoaderCircle className=\"size-3 animate-spin\" />\n {l.processing(processingCount)}\n </span>\n )}\n </div>\n </div>\n )\n}\n\n// \u2500\u2500 Hover card \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ExplorerFileTooltipProps {\n title: string\n /** AI summary; a placeholder is shown when empty. */\n summary?: string | null\n /** Pre-formatted \"last modified\" date; omit to hide the meta rows. */\n modifiedLabel?: string | null\n /** Small avatar of whoever last modified it. */\n modifiedByAvatar?: ReactNode\n shared: boolean\n /** Glyph for the shared/private state. */\n visibilityIcon?: ReactNode\n labels: string[]\n /** Fixed strings of the card (not the document labels above). */\n uiLabels?: Partial<ExplorerLabels>\n}\n\n/** The explorer hover card: leads with the AI summary, then who/when and the labels. */\nexport function ExplorerFileTooltip({\n title,\n summary,\n modifiedLabel,\n modifiedByAvatar,\n shared,\n visibilityIcon,\n labels,\n uiLabels,\n}: ExplorerFileTooltipProps) {\n const l = { ...DEFAULT_EXPLORER_LABELS, ...uiLabels }\n return (\n <div className=\"max-w-xs space-y-2\">\n <div className=\"break-words text-xs font-semibold leading-snug text-foreground\">{title}</div>\n <div className=\"space-y-1 border-t border-border pt-1.5\">\n <div className=\"flex items-center gap-1 text-xs font-semibold text-foreground\">\n <Sparkles className=\"size-3.5 shrink-0 text-yellow-text\" />\n {l.aiSummary}\n </div>\n <p className=\"line-clamp-6 text-xs leading-snug text-foreground/90\">\n {summary?.trim() || l.noSummary}\n </p>\n </div>\n {(modifiedLabel || labels.length > 0) && (\n <div className=\"space-y-1.5 border-t border-border pt-1.5\">\n {modifiedLabel && (\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1\">\n <span>{l.lastModifiedBy}</span>\n {modifiedByAvatar}\n <span>{modifiedLabel}</span>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {visibilityIcon}\n <span>{shared ? l.shared : l.private}</span>\n </div>\n </div>\n )}\n {labels.length > 0 && (\n <div className=\"flex flex-wrap gap-1 pt-0.5\">\n {labels.map((label) => (\n <span\n key={label}\n className=\"rounded bg-muted px-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J;AAAA;AAAA,EACF;AAEJ;AAqBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,QAAM,IAAI,EAAE,GAAG,yBAAyB,GAAG,SAAS;AACpD,SACE,qBAAC,SAAI,WAAU,sBACb;AAAA,wBAAC,SAAI,WAAU,kEAAkE,iBAAM;AAAA,IACvF,qBAAC,SAAI,WAAU,2CACb;AAAA,2BAAC,SAAI,WAAU,iEACb;AAAA,4BAAC,YAAS,WAAU,sCAAqC;AAAA,QACxD,EAAE;AAAA,SACL;AAAA,MACA,oBAAC,OAAE,WAAU,wDACV,mBAAS,KAAK,KAAK,EAAE,WACxB;AAAA,OACF;AAAA,KACE,iBAAiB,OAAO,SAAS,MACjC,qBAAC,SAAI,WAAU,6CACZ;AAAA,uBACC,qBAAC,SAAI,WAAU,yEACb;AAAA,6BAAC,SAAI,WAAU,6CACb;AAAA,8BAAC,UAAM,YAAE,gBAAe;AAAA,UACvB;AAAA,UACD,oBAAC,UAAM,yBAAc;AAAA,WACvB;AAAA,QACA,qBAAC,SAAI,WAAU,oCACZ;AAAA;AAAA,UACD,oBAAC,UAAM,mBAAS,EAAE,SAAS,EAAE,SAAQ;AAAA,WACvC;AAAA,SACF;AAAA,MAED,OAAO,SAAS,KACf,oBAAC,SAAI,WAAU,+BACZ,iBAAO,IAAI,CAAC,UACX;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAET;AAAA;AAAA,QAHI;AAAA,MAIP,CACD,GACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -49,7 +49,7 @@ const ViewerFrame = ({
49
49
  "data-bare": bare || void 0,
50
50
  "data-testid": testIdOr(testIds?.root, { testId: "document-viewer" }),
51
51
  children: [
52
- !bare && /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-10 bg-background", children: [
52
+ !bare && /* @__PURE__ */ jsxs("div", { className: "@container sticky top-0 z-10 bg-background", children: [
53
53
  header,
54
54
  compareRow && /* @__PURE__ */ jsx(
55
55
  "div",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/files/ViewerChrome.tsx"],
4
- "sourcesContent": ["import type { ReactNode } from 'react'\nimport {\n Check,\n ChevronLeft,\n ChevronRight,\n Crop,\n GitCompare,\n ImagePlus,\n Loader2,\n Pencil,\n X,\n ZoomIn,\n} from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Every fixed string of the viewer chrome and parts. Pass a partial `labels` to translate or reword. */\nexport interface ViewerLabels {\n useAsReference: string\n useAsReferenceTitle: string\n crop: string\n cropTitle: string\n previousPage: string\n nextPage: string\n /** The zoom button's accessible name; `level` is the current zoom, e.g. \"150%\". */\n zoom: (level: string) => string\n pageInput: string\n pageOfTitle: string\n pageOf: (page: number, total: number) => string\n previewUnavailable: string\n cannotPreview: (extension: string) => string\n downloadToOpen: string\n download: string\n}\n\nexport const DEFAULT_VIEWER_LABELS: ViewerLabels = {\n useAsReference: 'Use as reference',\n useAsReferenceTitle: 'Use as reference for a new image generation',\n crop: 'Crop',\n cropTitle: 'Crop and save as a new version',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n zoom: (level) => `Zoom ${level}. Click to zoom in further, then back to fit the page width.`,\n pageInput: 'Page number input',\n pageOfTitle: 'Click to go to page',\n pageOf: (page, total) => `Page ${page} of ${total}. Click to navigate.`,\n previewUnavailable: 'Preview not available',\n cannotPreview: (extension) => `${extension} files cannot be previewed in the browser.`,\n downloadToOpen: 'Download to open',\n download: 'Download',\n}\n\nexport interface ViewerFrameTestIds {\n root: string\n compareRow: string\n /** Replaces the whole `document-viewer-content-<id>` id. */\n content: string\n}\n\n// \u2500\u2500 Frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerFrameProps {\n /** The sticky top bar (tabs + title + actions). */\n header: ReactNode\n /** \"Comparing against...\" chips, shown on their own row under the header when set. */\n compareRow?: ReactNode\n /** Document id; the content area's test id is `document-viewer-content-{id}`. */\n contentId: string\n children: ReactNode\n /** Rendered after the content area (modals owned by the viewer, e.g. crop). */\n footer?: ReactNode\n /** The content alone, on black (a clean view to share or put full screen): no header. */\n bare?: boolean\n /** Over the content, e.g. the control leaving the clean view. */\n overlay?: ReactNode\n frameRef?: React.Ref<HTMLDivElement>\n className?: string\n testIds?: Partial<ViewerFrameTestIds>\n}\n\n/** The document viewer shell: sticky header, optional compare row, scrolling content. */\nexport const ViewerFrame = ({\n header,\n compareRow,\n contentId,\n children,\n footer,\n frameRef,\n className,\n testIds,\n bare = false,\n overlay,\n}: ViewerFrameProps) => (\n <div\n ref={frameRef}\n className={cn(\n 'flex h-full w-full flex-col',\n bare && 'bg-black [&_[data-slot=pdf-scroller]]:bg-black',\n className\n )}\n data-slot=\"viewer-frame\"\n data-bare={bare || undefined}\n data-testid={testIdOr(testIds?.root, { testId: 'document-viewer' })}\n >\n {!bare && (\n <div className=\"sticky top-0 z-10 bg-background\">\n {header}\n {compareRow && (\n <div\n className=\"flex flex-wrap items-center gap-1.5 border-t border-border px-3 py-1.5\"\n data-testid={testIdOr(testIds?.compareRow, { testId: 'compare-indicator-row' })}\n >\n {compareRow}\n </div>\n )}\n </div>\n )}\n <div\n className=\"relative flex-1 overflow-hidden\"\n data-testid={testIdOr(testIds?.content, { testId: `document-viewer-content-${contentId}` })}\n >\n {children}\n {overlay}\n </div>\n {footer}\n </div>\n)\n\n/** Centered muted status line for loading / error states inside the viewer. */\nexport function ViewerMessage({ children, testId }: { children: ReactNode; testId?: string }) {\n return (\n <div className=\"flex h-full items-center justify-center\" data-testid={testId}>\n <div className=\"text-sm text-muted-foreground\">{children}</div>\n </div>\n )\n}\n\n// \u2500\u2500 Title \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerTitleProps {\n title: string\n /** e.g. \"v3\". */\n versionLabel?: string | null\n /** Let the pill shrink (live artifacts share the row with more controls). */\n shrink?: boolean\n}\n\n/** Read-only document name (plain text, no fill) with the version label. */\nexport function ViewerTitle({ title, versionLabel, shrink }: ViewerTitleProps) {\n return (\n <span\n className={cn(\n 'inline-flex min-w-0 items-center gap-1.5 px-1 py-1 text-sm font-medium',\n shrink ? 'shrink' : 'shrink-0'\n )}\n title={title}\n >\n <span className=\"truncate\">{title}</span>\n {versionLabel && (\n <span className=\"shrink-0 text-xs font-normal text-muted-foreground\">{versionLabel}</span>\n )}\n </span>\n )\n}\n\n// \u2500\u2500 Actions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerImageActionsProps {\n compact: boolean\n /** Start a generation from the image. Omitted: not offered. */\n onUseAsReference?: () => void\n onCrop: () => void\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ useAsReference: string; crop: string }>\n}\n\n/** Image-only actions: feed it into a new generation, or crop it into a new version. */\nexport function ViewerImageActions({\n compact,\n onUseAsReference,\n onCrop,\n labels,\n testIds,\n}: ViewerImageActionsProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const size = compact ? 'icon' : 'sm'\n return (\n <>\n {onUseAsReference && (\n <Button\n onClick={onUseAsReference}\n variant=\"outline\"\n size={size}\n title={l.useAsReferenceTitle}\n aria-label={l.useAsReference}\n data-testid={testIdOr(testIds?.useAsReference, {\n testId: 'image-use-as-reference-button',\n })}\n className=\"pointer-coarse:min-h-11\"\n >\n <ImagePlus className=\"size-4\" />\n {!compact && <span className=\"ml-1\">{l.useAsReference}</span>}\n </Button>\n )}\n <Button\n onClick={onCrop}\n variant=\"outline\"\n size={size}\n title={l.cropTitle}\n aria-label={l.crop}\n data-testid={testIdOr(testIds?.crop, { testId: 'image-crop-button' })}\n className=\"pointer-coarse:min-h-11\"\n >\n <Crop className=\"size-4\" />\n {!compact && <span className=\"ml-1\">{l.crop}</span>}\n </Button>\n </>\n )\n}\n\n// \u2500\u2500 PDF page navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface PdfPageNavProps {\n canPrev: boolean\n canNext: boolean\n onPrev: () => void\n onNext: () => void\n /** The \"3 / 12\" counter between the arrows (the host owns its editing behaviour). */\n counter: ReactNode\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ overlay: string; prev: string; next: string }>\n}\n\n/** Floating prev / counter / next control over a rendered PDF. */\nexport function PdfPageNav({\n canPrev,\n canNext,\n onPrev,\n onNext,\n counter,\n labels,\n testIds,\n}: PdfPageNavProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div\n className=\"absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-lg border border-border bg-background/95 px-2 py-1.5 shadow-lg backdrop-blur\"\n data-testid={testIdOr(testIds?.overlay, { testId: 'pdf-page-nav-overlay' })}\n >\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 shrink-0 pointer-coarse:size-11\"\n onClick={onPrev}\n disabled={!canPrev}\n aria-label={l.previousPage}\n data-testid={testIdOr(testIds?.prev, { testId: 'pdf-page-nav-prev' })}\n >\n <ChevronLeft className=\"size-4\" />\n </Button>\n {counter}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 shrink-0 pointer-coarse:size-11\"\n onClick={onNext}\n disabled={!canNext}\n aria-label={l.nextPage}\n data-testid={testIdOr(testIds?.next, { testId: 'pdf-page-nav-next' })}\n >\n <ChevronRight className=\"size-4\" />\n </Button>\n </div>\n )\n}\n\n// \u2500\u2500 Zoom \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerZoomControlProps {\n /** Multiplier of the fit-width size (1 = fit width). */\n zoom: number\n /** Steps to the next zoom level (and back to fit width after the last). */\n onCycle: () => void\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ button: string; level: string }>\n}\n\n/**\n * The viewer's zoom button, on every pointer: a docked panel on a desktop screen still leaves the\n * text too small to read, so mouse users need a way to enlarge it too. It stays quiet at fit width\n * and shows the level once zoomed; pinch and double-tap work alongside it.\n */\nexport function ViewerZoomControl({ zoom, onCycle, labels, testIds }: ViewerZoomControlProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const level = `${Math.round(zoom * 100)}%`\n const isZoomed = Math.abs(zoom - 1) > 0.02\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={onCycle}\n title={`Zoom ${level}`}\n aria-label={l.zoom(level)}\n data-testid={testIdOr(testIds?.button, { testId: 'viewer-zoom-button' })}\n className=\"absolute right-3 bottom-4 z-10 h-9 min-w-9 items-center justify-center gap-1 rounded-full border border-border bg-background/95 px-2 shadow-md backdrop-blur pointer-coarse:h-11 pointer-coarse:min-w-11 pointer-coarse:px-2.5\"\n >\n <ZoomIn className=\"size-4\" />\n {isZoomed && (\n <span\n className=\"text-xs font-medium tabular-nums\"\n data-testid={testIdOr(testIds?.level, { testId: 'viewer-zoom-level' })}\n >\n {level}\n </span>\n )}\n </Button>\n )\n}\n"],
5
- "mappings": ";AAyGM,SAkFF,UA/EM,KAHJ;AAxGN;AAAA,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L,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,QAAQ,KAAK;AAAA,MACpB,cAAY,EAAE,KAAK,KAAK;AAAA,MACxB,eAAa,SAAS,SAAS,QAAQ,EAAE,QAAQ,qBAAqB,CAAC;AAAA,MACvE,WAAU;AAAA,MAEV;AAAA,4BAAC,UAAO,WAAU,UAAS;AAAA,QAC1B,YACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAa,SAAS,SAAS,OAAO,EAAE,QAAQ,oBAAoB,CAAC;AAAA,YAEpE;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["import type { ReactNode } from 'react'\nimport {\n Check,\n ChevronLeft,\n ChevronRight,\n Crop,\n GitCompare,\n ImagePlus,\n Loader2,\n Pencil,\n X,\n ZoomIn,\n} from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Every fixed string of the viewer chrome and parts. Pass a partial `labels` to translate or reword. */\nexport interface ViewerLabels {\n useAsReference: string\n useAsReferenceTitle: string\n crop: string\n cropTitle: string\n previousPage: string\n nextPage: string\n /** The zoom button's accessible name; `level` is the current zoom, e.g. \"150%\". */\n zoom: (level: string) => string\n pageInput: string\n pageOfTitle: string\n pageOf: (page: number, total: number) => string\n previewUnavailable: string\n cannotPreview: (extension: string) => string\n downloadToOpen: string\n download: string\n}\n\nexport const DEFAULT_VIEWER_LABELS: ViewerLabels = {\n useAsReference: 'Use as reference',\n useAsReferenceTitle: 'Use as reference for a new image generation',\n crop: 'Crop',\n cropTitle: 'Crop and save as a new version',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n zoom: (level) => `Zoom ${level}. Click to zoom in further, then back to fit the page width.`,\n pageInput: 'Page number input',\n pageOfTitle: 'Click to go to page',\n pageOf: (page, total) => `Page ${page} of ${total}. Click to navigate.`,\n previewUnavailable: 'Preview not available',\n cannotPreview: (extension) => `${extension} files cannot be previewed in the browser.`,\n downloadToOpen: 'Download to open',\n download: 'Download',\n}\n\nexport interface ViewerFrameTestIds {\n root: string\n compareRow: string\n /** Replaces the whole `document-viewer-content-<id>` id. */\n content: string\n}\n\n// \u2500\u2500 Frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerFrameProps {\n /** The sticky top bar (tabs + title + actions). */\n header: ReactNode\n /** \"Comparing against...\" chips, shown on their own row under the header when set. */\n compareRow?: ReactNode\n /** Document id; the content area's test id is `document-viewer-content-{id}`. */\n contentId: string\n children: ReactNode\n /** Rendered after the content area (modals owned by the viewer, e.g. crop). */\n footer?: ReactNode\n /** The content alone, on black (a clean view to share or put full screen): no header. */\n bare?: boolean\n /** Over the content, e.g. the control leaving the clean view. */\n overlay?: ReactNode\n frameRef?: React.Ref<HTMLDivElement>\n className?: string\n testIds?: Partial<ViewerFrameTestIds>\n}\n\n/** The document viewer shell: sticky header, optional compare row, scrolling content. */\nexport const ViewerFrame = ({\n header,\n compareRow,\n contentId,\n children,\n footer,\n frameRef,\n className,\n testIds,\n bare = false,\n overlay,\n}: ViewerFrameProps) => (\n <div\n ref={frameRef}\n className={cn(\n 'flex h-full w-full flex-col',\n bare && 'bg-black [&_[data-slot=pdf-scroller]]:bg-black',\n className\n )}\n data-slot=\"viewer-frame\"\n data-bare={bare || undefined}\n data-testid={testIdOr(testIds?.root, { testId: 'document-viewer' })}\n >\n {!bare && (\n <div className=\"@container sticky top-0 z-10 bg-background\">\n {header}\n {compareRow && (\n <div\n className=\"flex flex-wrap items-center gap-1.5 border-t border-border px-3 py-1.5\"\n data-testid={testIdOr(testIds?.compareRow, { testId: 'compare-indicator-row' })}\n >\n {compareRow}\n </div>\n )}\n </div>\n )}\n <div\n className=\"relative flex-1 overflow-hidden\"\n data-testid={testIdOr(testIds?.content, { testId: `document-viewer-content-${contentId}` })}\n >\n {children}\n {overlay}\n </div>\n {footer}\n </div>\n)\n\n/** Centered muted status line for loading / error states inside the viewer. */\nexport function ViewerMessage({ children, testId }: { children: ReactNode; testId?: string }) {\n return (\n <div className=\"flex h-full items-center justify-center\" data-testid={testId}>\n <div className=\"text-sm text-muted-foreground\">{children}</div>\n </div>\n )\n}\n\n// \u2500\u2500 Title \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerTitleProps {\n title: string\n /** e.g. \"v3\". */\n versionLabel?: string | null\n /** Let the pill shrink (live artifacts share the row with more controls). */\n shrink?: boolean\n}\n\n/** Read-only document name (plain text, no fill) with the version label. */\nexport function ViewerTitle({ title, versionLabel, shrink }: ViewerTitleProps) {\n return (\n <span\n className={cn(\n 'inline-flex min-w-0 items-center gap-1.5 px-1 py-1 text-sm font-medium',\n shrink ? 'shrink' : 'shrink-0'\n )}\n title={title}\n >\n <span className=\"truncate\">{title}</span>\n {versionLabel && (\n <span className=\"shrink-0 text-xs font-normal text-muted-foreground\">{versionLabel}</span>\n )}\n </span>\n )\n}\n\n// \u2500\u2500 Actions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerImageActionsProps {\n compact: boolean\n /** Start a generation from the image. Omitted: not offered. */\n onUseAsReference?: () => void\n onCrop: () => void\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ useAsReference: string; crop: string }>\n}\n\n/** Image-only actions: feed it into a new generation, or crop it into a new version. */\nexport function ViewerImageActions({\n compact,\n onUseAsReference,\n onCrop,\n labels,\n testIds,\n}: ViewerImageActionsProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const size = compact ? 'icon' : 'sm'\n return (\n <>\n {onUseAsReference && (\n <Button\n onClick={onUseAsReference}\n variant=\"outline\"\n size={size}\n title={l.useAsReferenceTitle}\n aria-label={l.useAsReference}\n data-testid={testIdOr(testIds?.useAsReference, {\n testId: 'image-use-as-reference-button',\n })}\n className=\"pointer-coarse:min-h-11\"\n >\n <ImagePlus className=\"size-4\" />\n {!compact && <span className=\"ml-1\">{l.useAsReference}</span>}\n </Button>\n )}\n <Button\n onClick={onCrop}\n variant=\"outline\"\n size={size}\n title={l.cropTitle}\n aria-label={l.crop}\n data-testid={testIdOr(testIds?.crop, { testId: 'image-crop-button' })}\n className=\"pointer-coarse:min-h-11\"\n >\n <Crop className=\"size-4\" />\n {!compact && <span className=\"ml-1\">{l.crop}</span>}\n </Button>\n </>\n )\n}\n\n// \u2500\u2500 PDF page navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface PdfPageNavProps {\n canPrev: boolean\n canNext: boolean\n onPrev: () => void\n onNext: () => void\n /** The \"3 / 12\" counter between the arrows (the host owns its editing behaviour). */\n counter: ReactNode\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ overlay: string; prev: string; next: string }>\n}\n\n/** Floating prev / counter / next control over a rendered PDF. */\nexport function PdfPageNav({\n canPrev,\n canNext,\n onPrev,\n onNext,\n counter,\n labels,\n testIds,\n}: PdfPageNavProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div\n className=\"absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-lg border border-border bg-background/95 px-2 py-1.5 shadow-lg backdrop-blur\"\n data-testid={testIdOr(testIds?.overlay, { testId: 'pdf-page-nav-overlay' })}\n >\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 shrink-0 pointer-coarse:size-11\"\n onClick={onPrev}\n disabled={!canPrev}\n aria-label={l.previousPage}\n data-testid={testIdOr(testIds?.prev, { testId: 'pdf-page-nav-prev' })}\n >\n <ChevronLeft className=\"size-4\" />\n </Button>\n {counter}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 shrink-0 pointer-coarse:size-11\"\n onClick={onNext}\n disabled={!canNext}\n aria-label={l.nextPage}\n data-testid={testIdOr(testIds?.next, { testId: 'pdf-page-nav-next' })}\n >\n <ChevronRight className=\"size-4\" />\n </Button>\n </div>\n )\n}\n\n// \u2500\u2500 Zoom \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerZoomControlProps {\n /** Multiplier of the fit-width size (1 = fit width). */\n zoom: number\n /** Steps to the next zoom level (and back to fit width after the last). */\n onCycle: () => void\n labels?: Partial<ViewerLabels>\n testIds?: Partial<{ button: string; level: string }>\n}\n\n/**\n * The viewer's zoom button, on every pointer: a docked panel on a desktop screen still leaves the\n * text too small to read, so mouse users need a way to enlarge it too. It stays quiet at fit width\n * and shows the level once zoomed; pinch and double-tap work alongside it.\n */\nexport function ViewerZoomControl({ zoom, onCycle, labels, testIds }: ViewerZoomControlProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const level = `${Math.round(zoom * 100)}%`\n const isZoomed = Math.abs(zoom - 1) > 0.02\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={onCycle}\n title={`Zoom ${level}`}\n aria-label={l.zoom(level)}\n data-testid={testIdOr(testIds?.button, { testId: 'viewer-zoom-button' })}\n className=\"absolute right-3 bottom-4 z-10 h-9 min-w-9 items-center justify-center gap-1 rounded-full border border-border bg-background/95 px-2 shadow-md backdrop-blur pointer-coarse:h-11 pointer-coarse:min-w-11 pointer-coarse:px-2.5\"\n >\n <ZoomIn className=\"size-4\" />\n {isZoomed && (\n <span\n className=\"text-xs font-medium tabular-nums\"\n data-testid={testIdOr(testIds?.level, { testId: 'viewer-zoom-level' })}\n >\n {level}\n </span>\n )}\n </Button>\n )\n}\n"],
5
+ "mappings": ";AAyGM,SAkFF,UA/EM,KAHJ;AAxGN;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAIA;AAAA,OACK;AACP,SAAS,QAAQ,UAAU;AAC3B,SAAS,gBAAgB;AAqBlB,MAAM,wBAAsC;AAAA,EACjD,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA,EACV,MAAM,CAAC,UAAU,QAAQ,KAAK;AAAA,EAC9B,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAAQ,CAAC,MAAM,UAAU,QAAQ,IAAI,OAAO,KAAK;AAAA,EACjD,oBAAoB;AAAA,EACpB,eAAe,CAAC,cAAc,GAAG,SAAS;AAAA,EAC1C,gBAAgB;AAAA,EAChB,UAAU;AACZ;AA+BO,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,KAAK;AAAA,IACL,WAAW;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,IACA,aAAU;AAAA,IACV,aAAW,QAAQ;AAAA,IACnB,eAAa,SAAS,SAAS,MAAM,EAAE,QAAQ,kBAAkB,CAAC;AAAA,IAEjE;AAAA,OAAC,QACA,qBAAC,SAAI,WAAU,8CACZ;AAAA;AAAA,QACA,cACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAa,SAAS,SAAS,YAAY,EAAE,QAAQ,wBAA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,GAA2B;AAC5F,QAAM,IAAI,EAAE,GAAG,uBAAuB,GAAG,OAAO;AAChD,QAAM,QAAQ,GAAG,KAAK,MAAM,OAAO,GAAG,CAAC;AACvC,QAAM,WAAW,KAAK,IAAI,OAAO,CAAC,IAAI;AACtC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,QAAQ,KAAK;AAAA,MACpB,cAAY,EAAE,KAAK,KAAK;AAAA,MACxB,eAAa,SAAS,SAAS,QAAQ,EAAE,QAAQ,qBAAqB,CAAC;AAAA,MACvE,WAAU;AAAA,MAEV;AAAA,4BAAC,UAAO,WAAU,UAAS;AAAA,QAC1B,YACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAa,SAAS,SAAS,OAAO,EAAE,QAAQ,oBAAoB,CAAC;AAAA,YAEpE;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -15,9 +15,14 @@ export interface ViewerTabBarProps {
15
15
  activeId: string;
16
16
  onChange: (id: string) => void;
17
17
  className?: string;
18
+ /**
19
+ * Hide the labels (icon only) while the nearest `@container` ancestor is narrower than 40rem.
20
+ * The host must make the viewer header a container; without one the labels would stay hidden.
21
+ */
22
+ collapseLabels?: boolean;
18
23
  }
19
24
  /** Underline tab strip for the viewer's formats (PDF, DOCX, Source, Versions, HTML...). */
20
- export declare function ViewerTabBar({ tabs, activeId, onChange, className }: ViewerTabBarProps): import("react").JSX.Element;
25
+ export declare function ViewerTabBar({ tabs, activeId, onChange, className, collapseLabels, }: ViewerTabBarProps): import("react").JSX.Element;
21
26
  export interface ViewerPageCounterProps {
22
27
  page: number;
23
28
  total: number;
@@ -12,7 +12,13 @@ import {
12
12
  } from "@arbidocs/react/ui";
13
13
  import { testIdOr } from "../chat/test-id.js";
14
14
  import { DEFAULT_VIEWER_LABELS } from "./ViewerChrome.js";
15
- function ViewerTabBar({ tabs, activeId, onChange, className }) {
15
+ function ViewerTabBar({
16
+ tabs,
17
+ activeId,
18
+ onChange,
19
+ className,
20
+ collapseLabels
21
+ }) {
16
22
  return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center", className), role: "group", children: tabs.map((tab) => {
17
23
  const isActive = tab.id === activeId;
18
24
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -27,11 +33,12 @@ function ViewerTabBar({ tabs, activeId, onChange, className }) {
27
33
  className: cn(
28
34
  "shrink-0 border-b-2 px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11",
29
35
  tab.label && "inline-flex items-center gap-1.5 text-sm",
36
+ tab.label && collapseLabels && "px-2 @[40rem]:px-3",
30
37
  isActive ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:border-border hover:text-foreground"
31
38
  ),
32
39
  children: [
33
40
  tab.icon,
34
- tab.label && /* @__PURE__ */ jsx("span", { children: tab.label })
41
+ tab.label && /* @__PURE__ */ jsx("span", { className: cn(collapseLabels && "hidden @[40rem]:inline"), children: tab.label })
35
42
  ]
36
43
  }
37
44
  ) }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/files/ViewerParts.tsx"],
4
- "sourcesContent": ["import { useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { ArrowLeftRight, Download, Eye, EyeOff, X } from 'lucide-react'\nimport {\n Button,\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { DEFAULT_VIEWER_LABELS, type ViewerLabels } from './ViewerChrome'\n\n// \u2500\u2500 Tabs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerTab {\n id: string\n icon: ReactNode\n /** Tooltip and accessible name. */\n tooltip: string\n /** Visible text next to the icon, for tabs whose icon alone is not self-explanatory. */\n label?: string\n /** Overrides the tab test id (default `<id>-tab`). */\n testId?: string\n}\n\nexport interface ViewerTabBarProps {\n tabs: ViewerTab[]\n activeId: string\n onChange: (id: string) => void\n className?: string\n}\n\n/** Underline tab strip for the viewer's formats (PDF, DOCX, Source, Versions, HTML...). */\nexport function ViewerTabBar({ tabs, activeId, onChange, className }: ViewerTabBarProps) {\n return (\n <TooltipProvider>\n <div className={cn('flex shrink-0 items-center', className)} role=\"group\">\n {tabs.map((tab) => {\n const isActive = tab.id === activeId\n return (\n <Tooltip key={tab.id}>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => onChange(tab.id)}\n aria-label={tab.tooltip}\n aria-pressed={isActive}\n data-testid={testIdOr(tab.testId, { testId: `${tab.id}-tab` })}\n className={cn(\n 'shrink-0 border-b-2 px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n tab.label && 'inline-flex items-center gap-1.5 text-sm',\n isActive\n ? 'border-primary text-primary'\n : 'border-transparent text-muted-foreground hover:border-border hover:text-foreground'\n )}\n >\n {tab.icon}\n {tab.label && <span>{tab.label}</span>}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">{tab.tooltip}</TooltipContent>\n </Tooltip>\n )\n })}\n </div>\n </TooltipProvider>\n )\n}\n\n// \u2500\u2500 Page counter \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerPageCounterProps {\n page: number\n total: number\n /** Called with a valid 1..total page typed into the counter. */\n onGoTo: (page: number) => void\n labels?: Partial<ViewerLabels>\n}\n\n/** \"3 / 12\": click the number to type a page; Enter or blur commits, Escape cancels. */\nexport function ViewerPageCounter({ page, total, onGoTo, labels }: ViewerPageCounterProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const [isEditing, setIsEditing] = useState(false)\n const [input, setInput] = useState('')\n const inputRef = useRef<HTMLInputElement>(null)\n if (total <= 0) return null\n\n const commit = () => {\n const n = parseInt(input, 10)\n if (!isNaN(n) && n >= 1 && n <= total) onGoTo(n)\n setIsEditing(false)\n }\n\n return (\n <div className=\"flex shrink-0 items-center gap-1 rounded-md bg-muted px-2 py-1\">\n {isEditing ? (\n <input\n ref={inputRef}\n autoFocus\n type=\"text\"\n value={input}\n onFocus={(e) => e.currentTarget.select()}\n onChange={(e) => setInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') commit()\n else if (e.key === 'Escape') setIsEditing(false)\n }}\n onBlur={commit}\n className=\"w-8 rounded border border-border bg-background px-1 py-0.5 text-center text-sm font-medium focus:outline-none\"\n aria-label={l.pageInput}\n />\n ) : (\n <button\n type=\"button\"\n onClick={() => {\n setInput(String(page))\n setIsEditing(true)\n }}\n className=\"min-w-[2rem] cursor-text rounded border border-border bg-background px-1 py-0.5 text-sm font-medium transition-colors hover:bg-muted pointer-coarse:min-h-11 pointer-coarse:min-w-11\"\n title={l.pageOfTitle}\n aria-label={l.pageOf(page, total)}\n >\n {page}\n </button>\n )}\n <span className=\"text-sm text-muted-foreground\">/ {total}</span>\n </div>\n )\n}\n\n// \u2500\u2500 Fallbacks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A format that cannot be previewed in the browser: offer the original instead. */\nexport function ViewerPreviewUnavailable({\n extension,\n onDownload,\n labels,\n}: {\n extension: string\n onDownload: () => void\n labels?: Partial<ViewerLabels>\n}) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-4 p-8 text-center\">\n <div className=\"text-4xl text-muted-foreground\" aria-hidden>\n \uD83D\uDCC4\n </div>\n <div>\n <p className=\"mb-1 font-medium\">{l.previewUnavailable}</p>\n <p className=\"mb-4 text-sm text-muted-foreground\">{l.cannotPreview(extension)}</p>\n <Button variant=\"outline\" size=\"sm\" onClick={onDownload}>\n <Download className=\"mr-2 size-4\" />\n {l.downloadToOpen}\n </Button>\n </div>\n </div>\n )\n}\n\n/** The file failed to load: say so and offer the download instead. */\nexport function ViewerLoadError({\n message,\n onDownload,\n labels,\n testId,\n}: {\n message: string\n onDownload: () => void\n labels?: Partial<ViewerLabels>\n /** Overrides the root test id (default `pdf-load-error`). */\n testId?: string\n}) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div\n className=\"flex h-full flex-col items-center justify-center gap-3 p-8 text-center\"\n data-testid={testIdOr(testId, { testId: 'pdf-load-error' })}\n >\n <p className=\"text-sm text-muted-foreground\">{message}</p>\n <Button variant=\"outline\" size=\"sm\" onClick={onDownload}>\n <Download className=\"mr-2 size-4\" />\n {l.download}\n </Button>\n </div>\n )\n}\n"],
5
- "mappings": ";AA4CgB,SAegB,KAfhB;AA5ChB,SAAS,QAAQ,gBAAgB;AAEjC,SAAyB,gBAAgC;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,6BAAgD;AAuBlD,SAAS,aAAa,EAAE,MAAM,UAAU,UAAU,UAAU,GAAsB;AACvF,SACE,oBAAC,mBACC,8BAAC,SAAI,WAAW,GAAG,8BAA8B,SAAS,GAAG,MAAK,SAC/D,eAAK,IAAI,CAAC,QAAQ;AACjB,UAAM,WAAW,IAAI,OAAO;AAC5B,WACE,qBAAC,WACC;AAAA,0BAAC,kBAAe,SAAO,MACrB;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,SAAS,IAAI,EAAE;AAAA,UAC9B,cAAY,IAAI;AAAA,UAChB,gBAAc;AAAA,UACd,eAAa,SAAS,IAAI,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,OAAO,CAAC;AAAA,UAC7D,WAAW;AAAA,YACT;AAAA,YACA,IAAI,SAAS;AAAA,YACb,WACI,gCACA;AAAA,UACN;AAAA,UAEC;AAAA,gBAAI;AAAA,YACJ,IAAI,SAAS,oBAAC,UAAM,cAAI,OAAM;AAAA;AAAA;AAAA,MACjC,GACF;AAAA,MACA,oBAAC,kBAAe,MAAK,UAAU,cAAI,SAAQ;AAAA,SApB/B,IAAI,EAqBlB;AAAA,EAEJ,CAAC,GACH,GACF;AAEJ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;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,IAAI,EAAE,GAAG,uBAAuB,GAAG,OAAO;AAChD,SACE,qBAAC,SAAI,WAAU,0EACb;AAAA,wBAAC,SAAI,WAAU,kCAAiC,eAAW,MAAC,uBAE5D;AAAA,IACA,qBAAC,SACC;AAAA,0BAAC,OAAE,WAAU,oBAAoB,YAAE,oBAAmB;AAAA,MACtD,oBAAC,OAAE,WAAU,sCAAsC,YAAE,cAAc,SAAS,GAAE;AAAA,MAC9E,qBAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,YAC3C;AAAA,4BAAC,YAAS,WAAU,eAAc;AAAA,QACjC,EAAE;AAAA,SACL;AAAA,OACF;AAAA,KACF;AAEJ;AAGO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,IAAI,EAAE,GAAG,uBAAuB,GAAG,OAAO;AAChD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,eAAa,SAAS,QAAQ,EAAE,QAAQ,iBAAiB,CAAC;AAAA,MAE1D;AAAA,4BAAC,OAAE,WAAU,iCAAiC,mBAAQ;AAAA,QACtD,qBAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,YAC3C;AAAA,8BAAC,YAAS,WAAU,eAAc;AAAA,UACjC,EAAE;AAAA,WACL;AAAA;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["import { useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { ArrowLeftRight, Download, Eye, EyeOff, X } from 'lucide-react'\nimport {\n Button,\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { DEFAULT_VIEWER_LABELS, type ViewerLabels } from './ViewerChrome'\n\n// \u2500\u2500 Tabs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerTab {\n id: string\n icon: ReactNode\n /** Tooltip and accessible name. */\n tooltip: string\n /** Visible text next to the icon, for tabs whose icon alone is not self-explanatory. */\n label?: string\n /** Overrides the tab test id (default `<id>-tab`). */\n testId?: string\n}\n\nexport interface ViewerTabBarProps {\n tabs: ViewerTab[]\n activeId: string\n onChange: (id: string) => void\n className?: string\n /**\n * Hide the labels (icon only) while the nearest `@container` ancestor is narrower than 40rem.\n * The host must make the viewer header a container; without one the labels would stay hidden.\n */\n collapseLabels?: boolean\n}\n\n/** Underline tab strip for the viewer's formats (PDF, DOCX, Source, Versions, HTML...). */\nexport function ViewerTabBar({\n tabs,\n activeId,\n onChange,\n className,\n collapseLabels,\n}: ViewerTabBarProps) {\n return (\n <TooltipProvider>\n <div className={cn('flex shrink-0 items-center', className)} role=\"group\">\n {tabs.map((tab) => {\n const isActive = tab.id === activeId\n return (\n <Tooltip key={tab.id}>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => onChange(tab.id)}\n aria-label={tab.tooltip}\n aria-pressed={isActive}\n data-testid={testIdOr(tab.testId, { testId: `${tab.id}-tab` })}\n className={cn(\n 'shrink-0 border-b-2 px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n tab.label && 'inline-flex items-center gap-1.5 text-sm',\n tab.label && collapseLabels && 'px-2 @[40rem]:px-3',\n isActive\n ? 'border-primary text-primary'\n : 'border-transparent text-muted-foreground hover:border-border hover:text-foreground'\n )}\n >\n {tab.icon}\n {tab.label && (\n <span className={cn(collapseLabels && 'hidden @[40rem]:inline')}>\n {tab.label}\n </span>\n )}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">{tab.tooltip}</TooltipContent>\n </Tooltip>\n )\n })}\n </div>\n </TooltipProvider>\n )\n}\n\n// \u2500\u2500 Page counter \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ViewerPageCounterProps {\n page: number\n total: number\n /** Called with a valid 1..total page typed into the counter. */\n onGoTo: (page: number) => void\n labels?: Partial<ViewerLabels>\n}\n\n/** \"3 / 12\": click the number to type a page; Enter or blur commits, Escape cancels. */\nexport function ViewerPageCounter({ page, total, onGoTo, labels }: ViewerPageCounterProps) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n const [isEditing, setIsEditing] = useState(false)\n const [input, setInput] = useState('')\n const inputRef = useRef<HTMLInputElement>(null)\n if (total <= 0) return null\n\n const commit = () => {\n const n = parseInt(input, 10)\n if (!isNaN(n) && n >= 1 && n <= total) onGoTo(n)\n setIsEditing(false)\n }\n\n return (\n <div className=\"flex shrink-0 items-center gap-1 rounded-md bg-muted px-2 py-1\">\n {isEditing ? (\n <input\n ref={inputRef}\n autoFocus\n type=\"text\"\n value={input}\n onFocus={(e) => e.currentTarget.select()}\n onChange={(e) => setInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') commit()\n else if (e.key === 'Escape') setIsEditing(false)\n }}\n onBlur={commit}\n className=\"w-8 rounded border border-border bg-background px-1 py-0.5 text-center text-sm font-medium focus:outline-none\"\n aria-label={l.pageInput}\n />\n ) : (\n <button\n type=\"button\"\n onClick={() => {\n setInput(String(page))\n setIsEditing(true)\n }}\n className=\"min-w-[2rem] cursor-text rounded border border-border bg-background px-1 py-0.5 text-sm font-medium transition-colors hover:bg-muted pointer-coarse:min-h-11 pointer-coarse:min-w-11\"\n title={l.pageOfTitle}\n aria-label={l.pageOf(page, total)}\n >\n {page}\n </button>\n )}\n <span className=\"text-sm text-muted-foreground\">/ {total}</span>\n </div>\n )\n}\n\n// \u2500\u2500 Fallbacks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A format that cannot be previewed in the browser: offer the original instead. */\nexport function ViewerPreviewUnavailable({\n extension,\n onDownload,\n labels,\n}: {\n extension: string\n onDownload: () => void\n labels?: Partial<ViewerLabels>\n}) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-4 p-8 text-center\">\n <div className=\"text-4xl text-muted-foreground\" aria-hidden>\n \uD83D\uDCC4\n </div>\n <div>\n <p className=\"mb-1 font-medium\">{l.previewUnavailable}</p>\n <p className=\"mb-4 text-sm text-muted-foreground\">{l.cannotPreview(extension)}</p>\n <Button variant=\"outline\" size=\"sm\" onClick={onDownload}>\n <Download className=\"mr-2 size-4\" />\n {l.downloadToOpen}\n </Button>\n </div>\n </div>\n )\n}\n\n/** The file failed to load: say so and offer the download instead. */\nexport function ViewerLoadError({\n message,\n onDownload,\n labels,\n testId,\n}: {\n message: string\n onDownload: () => void\n labels?: Partial<ViewerLabels>\n /** Overrides the root test id (default `pdf-load-error`). */\n testId?: string\n}) {\n const l = { ...DEFAULT_VIEWER_LABELS, ...labels }\n return (\n <div\n className=\"flex h-full flex-col items-center justify-center gap-3 p-8 text-center\"\n data-testid={testIdOr(testId, { testId: 'pdf-load-error' })}\n >\n <p className=\"text-sm text-muted-foreground\">{message}</p>\n <Button variant=\"outline\" size=\"sm\" onClick={onDownload}>\n <Download className=\"mr-2 size-4\" />\n {l.download}\n </Button>\n </div>\n )\n}\n"],
5
+ "mappings": ";AAuDgB,SAiBI,KAjBJ;AAvDhB,SAAS,QAAQ,gBAAgB;AAEjC,SAAyB,gBAAgC;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,6BAAgD;AA4BlD,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,SACE,oBAAC,mBACC,8BAAC,SAAI,WAAW,GAAG,8BAA8B,SAAS,GAAG,MAAK,SAC/D,eAAK,IAAI,CAAC,QAAQ;AACjB,UAAM,WAAW,IAAI,OAAO;AAC5B,WACE,qBAAC,WACC;AAAA,0BAAC,kBAAe,SAAO,MACrB;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,SAAS,IAAI,EAAE;AAAA,UAC9B,cAAY,IAAI;AAAA,UAChB,gBAAc;AAAA,UACd,eAAa,SAAS,IAAI,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,OAAO,CAAC;AA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