@arbidocs/blocks 0.5.175 → 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 (87) 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-AAQJZYZH.cjs +1 -1
  6. package/dist/ConnectedStreamedWordArtifact-CSNA2CJD.cjs +1 -1
  7. package/dist/{DocumentReviewCard-LOUVMFRX.cjs → DocumentReviewCard-SOEYIMRO.cjs} +12 -12
  8. package/dist/{DocumentReviewCard-LOUVMFRX.cjs.map → DocumentReviewCard-SOEYIMRO.cjs.map} +1 -1
  9. package/dist/{FilesViewerDialog-2NZR4MHD.cjs → FilesViewerDialog-RRAVDDN4.cjs} +8 -8
  10. package/dist/{FilesViewerDialog-2NZR4MHD.cjs.map → FilesViewerDialog-RRAVDDN4.cjs.map} +1 -1
  11. package/dist/agents/index.cjs +162 -162
  12. package/dist/{ai-NZKIMYW5.cjs → ai-XIT4MY3S.cjs} +13 -13
  13. package/dist/ai-XIT4MY3S.cjs.map +1 -0
  14. package/dist/calls/index.cjs +2 -2
  15. package/dist/chat/CitationMark.js +3 -2
  16. package/dist/chat/CitationMark.js.map +2 -2
  17. package/dist/chat/index.cjs +25 -25
  18. package/dist/chat/passage-text.d.ts +6 -0
  19. package/dist/chat/passage-text.js +8 -0
  20. package/dist/chat/passage-text.js.map +7 -0
  21. package/dist/{chunk-OIMDCS4Y.cjs → chunk-2TLEQBTM.cjs} +5 -5
  22. package/dist/{chunk-OIMDCS4Y.cjs.map → chunk-2TLEQBTM.cjs.map} +1 -1
  23. package/dist/{chunk-7TEHA3JK.cjs → chunk-6CPJ5ZOY.cjs} +9 -4
  24. package/dist/chunk-6CPJ5ZOY.cjs.map +1 -0
  25. package/dist/{chunk-A257IJ5J.cjs → chunk-6EJ7KD4U.cjs} +6 -6
  26. package/dist/{chunk-A257IJ5J.cjs.map → chunk-6EJ7KD4U.cjs.map} +1 -1
  27. package/dist/{chunk-EBY2JHL3.cjs → chunk-77FZT7AP.cjs} +55 -54
  28. package/dist/chunk-77FZT7AP.cjs.map +1 -0
  29. package/dist/{chunk-ZSQZZGC7.cjs → chunk-77MAR6Y4.cjs} +5 -5
  30. package/dist/{chunk-ZSQZZGC7.cjs.map → chunk-77MAR6Y4.cjs.map} +1 -1
  31. package/dist/{chunk-PUKLWHV6.cjs → chunk-AYK3BLUB.cjs} +3 -3
  32. package/dist/{chunk-PUKLWHV6.cjs.map → chunk-AYK3BLUB.cjs.map} +1 -1
  33. package/dist/{chunk-DVRAM3J4.cjs → chunk-IXKLARPD.cjs} +4 -4
  34. package/dist/{chunk-DVRAM3J4.cjs.map → chunk-IXKLARPD.cjs.map} +1 -1
  35. package/dist/{chunk-NFXHBTAO.cjs → chunk-J7LSWWA3.cjs} +4 -4
  36. package/dist/{chunk-NFXHBTAO.cjs.map → chunk-J7LSWWA3.cjs.map} +1 -1
  37. package/dist/{chunk-5G33DATM.cjs → chunk-N2YNXFT4.cjs} +42 -39
  38. package/dist/chunk-N2YNXFT4.cjs.map +1 -0
  39. package/dist/{chunk-7OMRSZOJ.cjs → chunk-OABDY4YO.cjs} +28 -28
  40. package/dist/{chunk-7OMRSZOJ.cjs.map → chunk-OABDY4YO.cjs.map} +1 -1
  41. package/dist/{chunk-NTQJHLYM.cjs → chunk-P3PTSXGJ.cjs} +4 -4
  42. package/dist/{chunk-NTQJHLYM.cjs.map → chunk-P3PTSXGJ.cjs.map} +1 -1
  43. package/dist/{chunk-HSYRI3JQ.cjs → chunk-POUMLXMJ.cjs} +6 -6
  44. package/dist/{chunk-HSYRI3JQ.cjs.map → chunk-POUMLXMJ.cjs.map} +1 -1
  45. package/dist/{chunk-6DHDITKK.cjs → chunk-QEEK2Z5T.cjs} +27 -18
  46. package/dist/chunk-QEEK2Z5T.cjs.map +1 -0
  47. package/dist/{chunk-VCVB2OP7.cjs → chunk-TUTPAAFH.cjs} +8 -8
  48. package/dist/{chunk-VCVB2OP7.cjs.map → chunk-TUTPAAFH.cjs.map} +1 -1
  49. package/dist/{chunk-ZT6C4MNX.cjs → chunk-UC6Z7E6C.cjs} +4 -4
  50. package/dist/{chunk-ZT6C4MNX.cjs.map → chunk-UC6Z7E6C.cjs.map} +1 -1
  51. package/dist/{chunk-SZ4U6GYC.cjs → chunk-VNK4HCHH.cjs} +26 -26
  52. package/dist/{chunk-SZ4U6GYC.cjs.map → chunk-VNK4HCHH.cjs.map} +1 -1
  53. package/dist/{chunk-DI6UEQCZ.cjs → chunk-XBM6TVZL.cjs} +4 -4
  54. package/dist/{chunk-DI6UEQCZ.cjs.map → chunk-XBM6TVZL.cjs.map} +1 -1
  55. package/dist/connect/docx.cjs +1 -1
  56. package/dist/connect/index.cjs +634 -634
  57. package/dist/connect/viewer.cjs +6 -6
  58. package/dist/connection/files/explorer/FileTiles.js +6 -3
  59. package/dist/connection/files/explorer/FileTiles.js.map +2 -2
  60. package/dist/connection/viewer/ConnectedDocumentViewer.js +2 -1
  61. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  62. package/dist/connection/viewer/useViewerTabs.d.ts +1 -1
  63. package/dist/connection/viewer/useViewerTabs.js +2 -2
  64. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  65. package/dist/embed/index.cjs +12 -12
  66. package/dist/files/ExplorerTile.d.ts +7 -0
  67. package/dist/files/ExplorerTile.js +17 -14
  68. package/dist/files/ExplorerTile.js.map +2 -2
  69. package/dist/files/ViewerChrome.js +1 -1
  70. package/dist/files/ViewerChrome.js.map +2 -2
  71. package/dist/files/ViewerParts.d.ts +6 -1
  72. package/dist/files/ViewerParts.js +9 -2
  73. package/dist/files/ViewerParts.js.map +2 -2
  74. package/dist/files/index.cjs +226 -226
  75. package/dist/index.cjs +240 -240
  76. package/dist/pages/index.cjs +17 -17
  77. package/dist/site/index.cjs +5 -5
  78. package/dist/studio/index.cjs +5 -5
  79. package/dist/styles.css +1 -1
  80. package/dist/workflow-canvas/index.cjs +21 -21
  81. package/node_modules/@arbidocs/coedit/package.json +1 -1
  82. package/package.json +5 -5
  83. package/dist/ai-NZKIMYW5.cjs.map +0 -1
  84. package/dist/chunk-5G33DATM.cjs.map +0 -1
  85. package/dist/chunk-6DHDITKK.cjs.map +0 -1
  86. package/dist/chunk-7TEHA3JK.cjs.map +0 -1
  87. package/dist/chunk-EBY2JHL3.cjs.map +0 -1
@@ -16,7 +16,7 @@ import {
16
16
  useArbiSessionStore
17
17
  } from "@arbidocs/react";
18
18
  import { useIsPhone } from "../../lib/use-media-query.js";
19
- function useViewerTabs(doc, isCompact, hasHistory = false, snapshot = false) {
19
+ function useViewerTabs(doc, _isCompact, hasHistory = false, snapshot = false) {
20
20
  const {
21
21
  documentData,
22
22
  isArtifact,
@@ -123,7 +123,7 @@ function useViewerTabs(doc, isCompact, hasHistory = false, snapshot = false) {
123
123
  // would flip from PDF to Text once it arrives).
124
124
  { icon: /* @__PURE__ */ jsx(FileText, { className: "size-5" }), tooltip: "Document" }
125
125
  );
126
- const tabLabel = (id, label) => !isCompact || activeTab === id || id === "html" ? label : void 0;
126
+ const tabLabel = (_id, label) => label;
127
127
  const versionsTab = {
128
128
  id: "versions",
129
129
  icon: /* @__PURE__ */ jsx(History, { className: "size-5" }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/connection/viewer/useViewerTabs.tsx"],
4
- "sourcesContent": ["/**\n * Tabs of the document viewer: which tabs a document has, the automatic switches when the\n * document's type or parsed content changes, and switching (which ends a comparison when leaving\n * the tab that hosts it). The open tab is the session state's, so whatever opens a document can\n * open it on a tab.\n */\n\nimport { useEffect, useRef } from 'react'\nimport { Code, FileText, History, MonitorPlay, Presentation } from 'lucide-react'\nimport { friendlyFileType } from '@arbidocs/react/ui'\nimport {\n AudIcon,\n DocIcon,\n EmlIcon,\n HtmlIcon,\n ImgIcon,\n PdfIcon,\n VidIcon,\n XlsIcon,\n useArbiSessionState,\n useArbiSessionStore,\n type ArbiViewerTab,\n} from '@arbidocs/react'\nimport type { ViewerTab } from '../../files/ViewerParts'\nimport { useIsPhone } from '../../lib/use-media-query'\nimport type { ViewedDocument } from './useViewedDocument'\n\n/**\n * @param hasHistory The document has earlier versions (a signed copy, a re-upload): PDF and text\n * documents then get a Versions tab too. Artifacts and Word documents always have one.\n */\nexport function useViewerTabs(\n doc: ViewedDocument,\n isCompact: boolean,\n hasHistory = false,\n snapshot = false\n) {\n const {\n documentData,\n isArtifact,\n isPresentation,\n isDraft,\n isStreaming,\n isDocx,\n isXlsx,\n isEmail,\n isVideo,\n isAudio,\n isImage,\n liveKind,\n hasParsedContent,\n isParsedDocLoading,\n } = doc\n const session = useArbiSessionStore()\n const {\n tab: activeTab,\n compareId,\n tabRequest,\n phonePdfChosen,\n } = useArbiSessionState((s) => s.documentViewer)\n const setActiveTab = (tab: ArbiViewerTab) => session.setDocumentViewer({ tab })\n // A passage being opened (a citation, a search hit): it is lit on the PDF, else marked on the text\n // view, never in an editor.\n const passageId = useArbiSessionState((s) => s.viewingDocument?.passageId ?? null)\n // A plain-text file is still shown as a generated PDF, but the tab names the file the user\n // opened (\"Text\", as the Fields panel does), not the rendering format.\n const isTextFile = friendlyFileType(documentData?.file_type, documentData?.file_name) === 'Text'\n const isPhone = useIsPhone()\n const phoneDefaultDecidedFor = useRef<string | null>(null)\n\n // Switch to the tab that fits the document type. Only on type changes: never over the user's own\n // choice. Keyed on the document and its kind, not on the record: a refreshed record (a new\n // version finishing processing) must not send a user on the PDF tab of a Word document back to\n // the editor. Also on a passage opened: it asks for the PDF tab whatever the type.\n const hasDocumentData = !!documentData\n const documentKey = documentData?.external_id\n useEffect(() => {\n // A presentation opens on its slides; another document never shows that tab.\n if (isPresentation && snapshot && activeTab === 'slides') {\n setActiveTab('pdf')\n } else if (isPresentation && !snapshot && hasDocumentData && activeTab === 'pdf') {\n setActiveTab('slides')\n } else if (!isPresentation && documentData && activeTab === 'slides') {\n setActiveTab(isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n }\n // A passage opened on a document whose type leaves the PDF tab goes to the text view, where\n // every passage is marked (the PDF pane's own fallback is not there to do it).\n else if (passageId && activeTab === 'pdf' && (isArtifact || isDocx)) {\n setActiveTab('html')\n }\n // A Word artifact (an AI draft, stored as .docx) has one Word tab, 'edit', not a DOCX tab.\n else if (isArtifact && (activeTab === 'pdf' || (!liveKind && activeTab === 'docx'))) {\n setActiveTab(liveKind ? 'preview' : 'edit')\n } else if (isDocx && activeTab === 'pdf') {\n setActiveTab('docx')\n } else if (!liveKind && activeTab === 'preview') {\n setActiveTab(isArtifact ? 'edit' : 'pdf')\n } else if (!isArtifact && documentData && activeTab === 'edit') {\n setActiveTab(isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n } else if (\n !isArtifact &&\n !isDocx &&\n !isXlsx &&\n documentData &&\n (activeTab === 'docx' || activeTab === 'xlsx')\n ) {\n setActiveTab('pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n snapshot,\n hasDocumentData,\n documentKey,\n isArtifact,\n isDocx,\n isXlsx,\n liveKind,\n isPresentation,\n passageId,\n ])\n\n // A tab asked for when the document was opened (a signature request opens on the PDF, where it\n // is signed) wins over the type's own tab once that document has loaded, and over the phone's\n // text default. Declared after the type switch above so it has the last word.\n useEffect(() => {\n if (!tabRequest || !documentKey || tabRequest.documentId !== documentKey) return\n phoneDefaultDecidedFor.current = documentKey\n session.setDocumentViewer({ tabRequest: null, tab: tabRequest.tab })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [documentKey, tabRequest])\n\n // Versions of a PDF or text document exist only with history: leave the tab when there is none\n // (another document opened while it was active).\n const hasVersionsTab = isArtifact || isDocx || hasHistory\n useEffect(() => {\n if (activeTab === 'versions' && documentData && !hasVersionsTab) {\n setActiveTab(isXlsx ? 'xlsx' : 'pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeTab, documentData, hasVersionsTab])\n\n // The text tab exists only with parsed content. When it is open without any (a recording with\n // no transcript, a failed parse), fall back to the natural default once the parsed query\n // settles. Not during a comparison, which uses the text tab. Waits for the record: until it is\n // here the parsed query has not started, so it is not loading yet.\n useEffect(() => {\n if (\n activeTab === 'html' &&\n documentData !== undefined &&\n !isParsedDocLoading &&\n !hasParsedContent &&\n !compareId\n ) {\n setActiveTab(isArtifact ? 'edit' : isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n activeTab,\n documentData,\n isParsedDocLoading,\n hasParsedContent,\n compareId,\n isArtifact,\n isDocx,\n isXlsx,\n ])\n\n // Phones open a document on the readable reflowed (text) view: a fit-width PDF on a 390px\n // screen is footnote-sized. Decided once per document, after the parsed query settles, and only\n // over the PDF default (Word, sheets, artifacts and media keep their own tab). A PDF the user\n // picked by hand this session wins.\n useEffect(() => {\n if (!isPhone || !documentKey || isParsedDocLoading) return\n if (phoneDefaultDecidedFor.current === documentKey) return\n phoneDefaultDecidedFor.current = documentKey\n const opensOnPdf =\n !isArtifact && !isDocx && !isXlsx && !isVideo && !isAudio && !isImage && !isEmail\n if (opensOnPdf && hasParsedContent && !compareId && !phonePdfChosen && activeTab === 'pdf') {\n setActiveTab('html')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPhone, documentKey, isParsedDocLoading, hasParsedContent])\n\n const handleTabChange = (tabId: string) => {\n // A comparison is shown on the text tab: leaving it ends the comparison.\n const change: Parameters<typeof session.setDocumentViewer>[0] = { tab: tabId as ArbiViewerTab }\n if (tabId !== 'html' && compareId) change.compareId = null\n // A phone user who goes back to the PDF wants it: stop opening documents on the text view\n // until they pick it again.\n if (isPhone && (tabId === 'pdf' || tabId === 'html')) change.phonePdfChosen = tabId === 'pdf'\n session.setDocumentViewer(change)\n }\n\n const mediaTab = isVideo\n ? { icon: <VidIcon size={20} />, tooltip: 'Video' }\n : isAudio\n ? { icon: <AudIcon size={20} />, tooltip: 'Audio' }\n : isImage\n ? { icon: <ImgIcon size={20} />, tooltip: 'Image' }\n : isEmail\n ? { icon: <EmlIcon size={20} />, tooltip: 'Email' }\n : isTextFile\n ? { icon: <FileText className=\"size-5\" />, tooltip: 'Text' }\n : documentData\n ? { icon: <PdfIcon size={20} />, tooltip: 'PDF' }\n : // The file type is unknown until the record loads: name no guess (a text file\n // would flip from PDF to Text once it arrives).\n { icon: <FileText className=\"size-5\" />, tooltip: 'Document' }\n // Tabs say what they are: in a narrow panel or on a phone only the open tab keeps its name, plus\n // the text view, whose icon is not recognisable. Labelling every tab there would crowd the header.\n const tabLabel = (id: string, label: string) =>\n !isCompact || activeTab === id || id === 'html' ? label : undefined\n\n const versionsTab: ViewerTab = {\n id: 'versions',\n icon: <History className=\"size-5\" />,\n tooltip: 'Versions',\n label: tabLabel('versions', 'Versions'),\n }\n const viewerTabs: ViewerTab[] = [\n // A presentation's slides, edited; then its PDF (the slides as saved), once it has one.\n ...(isPresentation && !snapshot\n ? [\n {\n id: 'slides',\n icon: <Presentation className=\"size-5\" />,\n tooltip: 'Slides',\n label: tabLabel('slides', 'Slides'),\n },\n ]\n : []),\n ...(isArtifact\n ? [\n ...(liveKind\n ? [\n {\n id: 'preview',\n icon: <MonitorPlay className=\"size-5\" />,\n tooltip: 'Preview',\n label: tabLabel('preview', 'Preview'),\n },\n ]\n : []),\n {\n id: 'edit',\n icon: liveKind ? <Code className=\"size-5\" /> : <FileText className=\"size-5\" />,\n tooltip: liveKind ? 'Code' : 'Editor',\n label: tabLabel('edit', liveKind ? 'Code' : 'Document'),\n },\n ...(!liveKind && !isDraft && !isStreaming && isDocx\n ? [\n {\n id: 'pdf',\n icon: <PdfIcon size={20} />,\n tooltip: 'PDF',\n label: tabLabel('pdf', 'PDF'),\n },\n ]\n : []),\n versionsTab,\n ]\n : [\n ...(isDocx\n ? [\n {\n id: 'docx',\n icon: <DocIcon size={20} />,\n tooltip: 'DOCX (with track changes & comments)',\n label: tabLabel('docx', 'DOCX'),\n },\n ]\n : []),\n ...(isXlsx\n ? [\n {\n id: 'xlsx',\n icon: <XlsIcon size={20} />,\n tooltip: 'Spreadsheet',\n label: tabLabel('xlsx', 'Sheet'),\n },\n ]\n : []),\n ...(isPresentation && isDraft\n ? []\n : [{ id: 'pdf', ...mediaTab, label: tabLabel('pdf', mediaTab.tooltip) }]),\n ...(hasVersionsTab ? [versionsTab] : []),\n ]),\n ...((hasParsedContent || compareId) && !liveKind\n ? [\n {\n id: 'html',\n icon:\n compareId || isVideo || isAudio ? (\n <FileText className=\"size-5\" />\n ) : (\n <HtmlIcon size={20} />\n ),\n tooltip: compareId ? 'Word redline' : isVideo || isAudio ? 'Transcript' : 'HTML',\n label: tabLabel(\n 'html',\n compareId ? 'Compare' : isVideo || isAudio ? 'Transcript' : 'HTML'\n ),\n },\n ]\n : []),\n ]\n\n return { activeTab, handleTabChange, viewerTabs }\n}\n"],
5
- "mappings": ";AAkMc;AA3Ld,SAAS,WAAW,cAAc;AAClC,SAAS,MAAM,UAAU,SAAS,aAAa,oBAAoB;AACnE,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,kBAAkB;AAOpB,SAAS,cACd,KACA,WACA,aAAa,OACb,WAAW,OACX;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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,WAAW,UACtB,oBAAC,YAAS,WAAU,UAAS,IAE7B,oBAAC,YAAS,MAAM,IAAI;AAAA,QAExB,SAAS,YAAY,iBAAiB,WAAW,UAAU,eAAe;AAAA,QAC1E,OAAO;AAAA,UACL;AAAA,UACA,YAAY,YAAY,WAAW,UAAU,eAAe;AAAA,QAC9D;AAAA,MACF;AAAA,IACF,IACA,CAAC;AAAA,EACP;AAEA,SAAO,EAAE,WAAW,iBAAiB,WAAW;AAClD;",
4
+ "sourcesContent": ["/**\n * Tabs of the document viewer: which tabs a document has, the automatic switches when the\n * document's type or parsed content changes, and switching (which ends a comparison when leaving\n * the tab that hosts it). The open tab is the session state's, so whatever opens a document can\n * open it on a tab.\n */\n\nimport { useEffect, useRef } from 'react'\nimport { Code, FileText, History, MonitorPlay, Presentation } from 'lucide-react'\nimport { friendlyFileType } from '@arbidocs/react/ui'\nimport {\n AudIcon,\n DocIcon,\n EmlIcon,\n HtmlIcon,\n ImgIcon,\n PdfIcon,\n VidIcon,\n XlsIcon,\n useArbiSessionState,\n useArbiSessionStore,\n type ArbiViewerTab,\n} from '@arbidocs/react'\nimport type { ViewerTab } from '../../files/ViewerParts'\nimport { useIsPhone } from '../../lib/use-media-query'\nimport type { ViewedDocument } from './useViewedDocument'\n\n/**\n * @param hasHistory The document has earlier versions (a signed copy, a re-upload): PDF and text\n * documents then get a Versions tab too. Artifacts and Word documents always have one.\n */\nexport function useViewerTabs(\n doc: ViewedDocument,\n _isCompact: boolean,\n hasHistory = false,\n snapshot = false\n) {\n const {\n documentData,\n isArtifact,\n isPresentation,\n isDraft,\n isStreaming,\n isDocx,\n isXlsx,\n isEmail,\n isVideo,\n isAudio,\n isImage,\n liveKind,\n hasParsedContent,\n isParsedDocLoading,\n } = doc\n const session = useArbiSessionStore()\n const {\n tab: activeTab,\n compareId,\n tabRequest,\n phonePdfChosen,\n } = useArbiSessionState((s) => s.documentViewer)\n const setActiveTab = (tab: ArbiViewerTab) => session.setDocumentViewer({ tab })\n // A passage being opened (a citation, a search hit): it is lit on the PDF, else marked on the text\n // view, never in an editor.\n const passageId = useArbiSessionState((s) => s.viewingDocument?.passageId ?? null)\n // A plain-text file is still shown as a generated PDF, but the tab names the file the user\n // opened (\"Text\", as the Fields panel does), not the rendering format.\n const isTextFile = friendlyFileType(documentData?.file_type, documentData?.file_name) === 'Text'\n const isPhone = useIsPhone()\n const phoneDefaultDecidedFor = useRef<string | null>(null)\n\n // Switch to the tab that fits the document type. Only on type changes: never over the user's own\n // choice. Keyed on the document and its kind, not on the record: a refreshed record (a new\n // version finishing processing) must not send a user on the PDF tab of a Word document back to\n // the editor. Also on a passage opened: it asks for the PDF tab whatever the type.\n const hasDocumentData = !!documentData\n const documentKey = documentData?.external_id\n useEffect(() => {\n // A presentation opens on its slides; another document never shows that tab.\n if (isPresentation && snapshot && activeTab === 'slides') {\n setActiveTab('pdf')\n } else if (isPresentation && !snapshot && hasDocumentData && activeTab === 'pdf') {\n setActiveTab('slides')\n } else if (!isPresentation && documentData && activeTab === 'slides') {\n setActiveTab(isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n }\n // A passage opened on a document whose type leaves the PDF tab goes to the text view, where\n // every passage is marked (the PDF pane's own fallback is not there to do it).\n else if (passageId && activeTab === 'pdf' && (isArtifact || isDocx)) {\n setActiveTab('html')\n }\n // A Word artifact (an AI draft, stored as .docx) has one Word tab, 'edit', not a DOCX tab.\n else if (isArtifact && (activeTab === 'pdf' || (!liveKind && activeTab === 'docx'))) {\n setActiveTab(liveKind ? 'preview' : 'edit')\n } else if (isDocx && activeTab === 'pdf') {\n setActiveTab('docx')\n } else if (!liveKind && activeTab === 'preview') {\n setActiveTab(isArtifact ? 'edit' : 'pdf')\n } else if (!isArtifact && documentData && activeTab === 'edit') {\n setActiveTab(isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n } else if (\n !isArtifact &&\n !isDocx &&\n !isXlsx &&\n documentData &&\n (activeTab === 'docx' || activeTab === 'xlsx')\n ) {\n setActiveTab('pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n snapshot,\n hasDocumentData,\n documentKey,\n isArtifact,\n isDocx,\n isXlsx,\n liveKind,\n isPresentation,\n passageId,\n ])\n\n // A tab asked for when the document was opened (a signature request opens on the PDF, where it\n // is signed) wins over the type's own tab once that document has loaded, and over the phone's\n // text default. Declared after the type switch above so it has the last word.\n useEffect(() => {\n if (!tabRequest || !documentKey || tabRequest.documentId !== documentKey) return\n phoneDefaultDecidedFor.current = documentKey\n session.setDocumentViewer({ tabRequest: null, tab: tabRequest.tab })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [documentKey, tabRequest])\n\n // Versions of a PDF or text document exist only with history: leave the tab when there is none\n // (another document opened while it was active).\n const hasVersionsTab = isArtifact || isDocx || hasHistory\n useEffect(() => {\n if (activeTab === 'versions' && documentData && !hasVersionsTab) {\n setActiveTab(isXlsx ? 'xlsx' : 'pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeTab, documentData, hasVersionsTab])\n\n // The text tab exists only with parsed content. When it is open without any (a recording with\n // no transcript, a failed parse), fall back to the natural default once the parsed query\n // settles. Not during a comparison, which uses the text tab. Waits for the record: until it is\n // here the parsed query has not started, so it is not loading yet.\n useEffect(() => {\n if (\n activeTab === 'html' &&\n documentData !== undefined &&\n !isParsedDocLoading &&\n !hasParsedContent &&\n !compareId\n ) {\n setActiveTab(isArtifact ? 'edit' : isDocx ? 'docx' : isXlsx ? 'xlsx' : 'pdf')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n activeTab,\n documentData,\n isParsedDocLoading,\n hasParsedContent,\n compareId,\n isArtifact,\n isDocx,\n isXlsx,\n ])\n\n // Phones open a document on the readable reflowed (text) view: a fit-width PDF on a 390px\n // screen is footnote-sized. Decided once per document, after the parsed query settles, and only\n // over the PDF default (Word, sheets, artifacts and media keep their own tab). A PDF the user\n // picked by hand this session wins.\n useEffect(() => {\n if (!isPhone || !documentKey || isParsedDocLoading) return\n if (phoneDefaultDecidedFor.current === documentKey) return\n phoneDefaultDecidedFor.current = documentKey\n const opensOnPdf =\n !isArtifact && !isDocx && !isXlsx && !isVideo && !isAudio && !isImage && !isEmail\n if (opensOnPdf && hasParsedContent && !compareId && !phonePdfChosen && activeTab === 'pdf') {\n setActiveTab('html')\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPhone, documentKey, isParsedDocLoading, hasParsedContent])\n\n const handleTabChange = (tabId: string) => {\n // A comparison is shown on the text tab: leaving it ends the comparison.\n const change: Parameters<typeof session.setDocumentViewer>[0] = { tab: tabId as ArbiViewerTab }\n if (tabId !== 'html' && compareId) change.compareId = null\n // A phone user who goes back to the PDF wants it: stop opening documents on the text view\n // until they pick it again.\n if (isPhone && (tabId === 'pdf' || tabId === 'html')) change.phonePdfChosen = tabId === 'pdf'\n session.setDocumentViewer(change)\n }\n\n const mediaTab = isVideo\n ? { icon: <VidIcon size={20} />, tooltip: 'Video' }\n : isAudio\n ? { icon: <AudIcon size={20} />, tooltip: 'Audio' }\n : isImage\n ? { icon: <ImgIcon size={20} />, tooltip: 'Image' }\n : isEmail\n ? { icon: <EmlIcon size={20} />, tooltip: 'Email' }\n : isTextFile\n ? { icon: <FileText className=\"size-5\" />, tooltip: 'Text' }\n : documentData\n ? { icon: <PdfIcon size={20} />, tooltip: 'PDF' }\n : // The file type is unknown until the record loads: name no guess (a text file\n // would flip from PDF to Text once it arrives).\n { icon: <FileText className=\"size-5\" />, tooltip: 'Document' }\n // Every tab carries its name; the tab bar hides the text with a container query when the viewer\n // header is narrow (icons only, the name stays in the tooltip and accessible name).\n const tabLabel = (_id: string, label: string) => label\n\n const versionsTab: ViewerTab = {\n id: 'versions',\n icon: <History className=\"size-5\" />,\n tooltip: 'Versions',\n label: tabLabel('versions', 'Versions'),\n }\n const viewerTabs: ViewerTab[] = [\n // A presentation's slides, edited; then its PDF (the slides as saved), once it has one.\n ...(isPresentation && !snapshot\n ? [\n {\n id: 'slides',\n icon: <Presentation className=\"size-5\" />,\n tooltip: 'Slides',\n label: tabLabel('slides', 'Slides'),\n },\n ]\n : []),\n ...(isArtifact\n ? [\n ...(liveKind\n ? [\n {\n id: 'preview',\n icon: <MonitorPlay className=\"size-5\" />,\n tooltip: 'Preview',\n label: tabLabel('preview', 'Preview'),\n },\n ]\n : []),\n {\n id: 'edit',\n icon: liveKind ? <Code className=\"size-5\" /> : <FileText className=\"size-5\" />,\n tooltip: liveKind ? 'Code' : 'Editor',\n label: tabLabel('edit', liveKind ? 'Code' : 'Document'),\n },\n ...(!liveKind && !isDraft && !isStreaming && isDocx\n ? [\n {\n id: 'pdf',\n icon: <PdfIcon size={20} />,\n tooltip: 'PDF',\n label: tabLabel('pdf', 'PDF'),\n },\n ]\n : []),\n versionsTab,\n ]\n : [\n ...(isDocx\n ? [\n {\n id: 'docx',\n icon: <DocIcon size={20} />,\n tooltip: 'DOCX (with track changes & comments)',\n label: tabLabel('docx', 'DOCX'),\n },\n ]\n : []),\n ...(isXlsx\n ? [\n {\n id: 'xlsx',\n icon: <XlsIcon size={20} />,\n tooltip: 'Spreadsheet',\n label: tabLabel('xlsx', 'Sheet'),\n },\n ]\n : []),\n ...(isPresentation && isDraft\n ? []\n : [{ id: 'pdf', ...mediaTab, label: tabLabel('pdf', mediaTab.tooltip) }]),\n ...(hasVersionsTab ? [versionsTab] : []),\n ]),\n ...((hasParsedContent || compareId) && !liveKind\n ? [\n {\n id: 'html',\n icon:\n compareId || isVideo || isAudio ? (\n <FileText className=\"size-5\" />\n ) : (\n <HtmlIcon size={20} />\n ),\n tooltip: compareId ? 'Word redline' : isVideo || isAudio ? 'Transcript' : 'HTML',\n label: tabLabel(\n 'html',\n compareId ? 'Compare' : isVideo || isAudio ? 'Transcript' : 'HTML'\n ),\n },\n ]\n : []),\n ]\n\n return { activeTab, handleTabChange, viewerTabs }\n}\n"],
5
+ "mappings": ";AAkMc;AA3Ld,SAAS,WAAW,cAAc;AAClC,SAAS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,MACF,IACA,CAAC;AAAA,MACL,GAAI,kBAAkB,UAClB,CAAC,IACD,CAAC,EAAE,IAAI,OAAO,GAAG,UAAU,OAAO,SAAS,OAAO,SAAS,OAAO,EAAE,CAAC;AAAA,MACzE,GAAI,iBAAiB,CAAC,WAAW,IAAI,CAAC;AAAA,IACxC;AAAA,IACJ,IAAK,oBAAoB,cAAc,CAAC,WACpC;AAAA,MACE;AAAA,QACE,IAAI;AAAA,QACJ,MACE,aAAa,WAAW,UACtB,oBAAC,YAAS,WAAU,UAAS,IAE7B,oBAAC,YAAS,MAAM,IAAI;AAAA,QAExB,SAAS,YAAY,iBAAiB,WAAW,UAAU,eAAe;AAAA,QAC1E,OAAO;AAAA,UACL;AAAA,UACA,YAAY,YAAY,WAAW,UAAU,eAAe;AAAA,QAC9D;AAAA,MACF;AAAA,IACF,IACA,CAAC;AAAA,EACP;AAEA,SAAO,EAAE,WAAW,iBAAiB,WAAW;AAClD;",
6
6
  "names": []
7
7
  }
@@ -1,21 +1,21 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkVCVB2OP7_cjs = require('../chunk-VCVB2OP7.cjs');
4
+ var chunkTUTPAAFH_cjs = require('../chunk-TUTPAAFH.cjs');
5
5
  require('../chunk-7GVKG3G4.cjs');
6
6
  require('../chunk-OHWYQI3B.cjs');
7
- require('../chunk-NTQJHLYM.cjs');
8
- require('../chunk-NFXHBTAO.cjs');
7
+ require('../chunk-P3PTSXGJ.cjs');
8
+ require('../chunk-J7LSWWA3.cjs');
9
9
  require('../chunk-ER2MRSLT.cjs');
10
10
  require('../chunk-TJY7XPDE.cjs');
11
11
  require('../chunk-XNW62J54.cjs');
12
12
  require('../chunk-H4N6BZNU.cjs');
13
- require('../chunk-5G33DATM.cjs');
13
+ require('../chunk-N2YNXFT4.cjs');
14
14
  require('../chunk-JEHGTPS2.cjs');
15
15
  require('../chunk-WJIAA6G3.cjs');
16
16
  require('../chunk-JWCVA4LC.cjs');
17
17
  require('../chunk-QQMMCXBP.cjs');
18
- require('../chunk-6DHDITKK.cjs');
18
+ require('../chunk-QEEK2Z5T.cjs');
19
19
  require('../chunk-223D4727.cjs');
20
20
  require('../chunk-DTMBAFIL.cjs');
21
21
  require('../chunk-SNUBQMIS.cjs');
@@ -52,9 +52,9 @@ require('../chunk-3YEXZX4H.cjs');
52
52
  require('../chunk-4PA6VCCR.cjs');
53
53
  require('../chunk-5FSULBPE.cjs');
54
54
  require('../chunk-AHDJXIUB.cjs');
55
- require('../chunk-IXCWZ4HC.cjs');
56
55
  require('../chunk-S3GVFAFB.cjs');
57
56
  require('../chunk-6UZC4XVV.cjs');
57
+ require('../chunk-IXCWZ4HC.cjs');
58
58
  require('../chunk-DKY67DA6.cjs');
59
59
  require('../chunk-Y3GJBLAI.cjs');
60
60
  require('../chunk-SQCCQU3K.cjs');
@@ -90,27 +90,27 @@ require('../chunk-PLIF5CUV.cjs');
90
90
 
91
91
  Object.defineProperty(exports, "ArbiChat", {
92
92
  enumerable: true,
93
- get: function () { return chunkVCVB2OP7_cjs.ArbiChat; }
93
+ get: function () { return chunkTUTPAAFH_cjs.ArbiChat; }
94
94
  });
95
95
  Object.defineProperty(exports, "ConnectedCompactLogin", {
96
96
  enumerable: true,
97
- get: function () { return chunkVCVB2OP7_cjs.ConnectedCompactLogin; }
97
+ get: function () { return chunkTUTPAAFH_cjs.ConnectedCompactLogin; }
98
98
  });
99
99
  Object.defineProperty(exports, "ConnectedEmbeddedChat", {
100
100
  enumerable: true,
101
- get: function () { return chunkVCVB2OP7_cjs.ConnectedEmbeddedChat; }
101
+ get: function () { return chunkTUTPAAFH_cjs.ConnectedEmbeddedChat; }
102
102
  });
103
103
  Object.defineProperty(exports, "ConnectedLoginPage", {
104
104
  enumerable: true,
105
- get: function () { return chunkVCVB2OP7_cjs.ConnectedLoginPage; }
105
+ get: function () { return chunkTUTPAAFH_cjs.ConnectedLoginPage; }
106
106
  });
107
107
  Object.defineProperty(exports, "EmbeddedChatPanel", {
108
108
  enumerable: true,
109
- get: function () { return chunkVCVB2OP7_cjs.EmbeddedChatPanel; }
109
+ get: function () { return chunkTUTPAAFH_cjs.EmbeddedChatPanel; }
110
110
  });
111
111
  Object.defineProperty(exports, "defaultHost", {
112
112
  enumerable: true,
113
- get: function () { return chunkVCVB2OP7_cjs.defaultHost; }
113
+ get: function () { return chunkTUTPAAFH_cjs.defaultHost; }
114
114
  });
115
115
  Object.defineProperty(exports, "useConnection", {
116
116
  enumerable: true,
@@ -28,6 +28,13 @@ export interface ExplorerFolderTestIds {
28
28
  /** Replaces the whole `explorer-folder-processing-<path>` id. */
29
29
  processing: string;
30
30
  }
31
+ /**
32
+ * The tile's unit, set on a `display: contents` child of the tile (which is an `@container`):
33
+ * 1px at a 200px-wide tile, 0.8px at 160px and below, 1.2px at 240px and above. Controls, text and
34
+ * glyphs inside the tile size themselves as `calc(var(--tile-u, 1px) * <px at 200px>)`, so they
35
+ * follow the Gallery zoom. Touch screens keep their 44px targets (`pointer-coarse:` wins).
36
+ */
37
+ export declare const TILE_SCALE = "[--tile-u:clamp(0.8px,0.5cqw,1.2px)]";
31
38
  export type ExplorerDensity = 'grid' | 'list';
32
39
  export interface ExplorerMenuItem {
33
40
  id: string;
@@ -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,S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,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-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,cA+EY,YA/EZ;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;AAChD,SAAO,EAAE,kBAAkB,WAAW,CAAC,CAAC,EAAE,OAAO,QAA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
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,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,mCACZ;AAAA;AAAA,QACA,cACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAa,SAAS,SAAS,YAAY,EAAE,QAAQ,wBAAwB,CAAC;AAAA,Y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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;",
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,SAA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AAAA,YACd,eAAa,SAAS,SAAS,MAAM,EAAE,QAAQ,oBAAoB,CAAC;AAAA,YAEpE,8BAAC,gBAAa,WAAU,UAAS;AAAA;AAAA,QACnC;AAAA;AAAA;AAAA,EACF;AAEJ;AAkBO,SAAS,kBAAkB,EAAE,MAAM,SAAS,QAAQ,QAAQ,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;