@arbidocs/blocks 0.5.123 → 0.5.125

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 (192) hide show
  1. package/dist/{ClippingMediaViewer-IEIBT74X.cjs → ClippingMediaViewer-ZFEX5A3U.cjs} +11 -10
  2. package/dist/ClippingMediaViewer-ZFEX5A3U.cjs.map +1 -0
  3. package/dist/{ClippingPdfViewer-OGYLMVCE.cjs → ClippingPdfViewer-3LRTEPHV.cjs} +45 -11
  4. package/dist/ClippingPdfViewer-3LRTEPHV.cjs.map +1 -0
  5. package/dist/ConnectedCallDock-XJOYVVAH.cjs +6 -6
  6. package/dist/ConnectedCallRoom-CUDYAPQK.cjs +6 -6
  7. package/dist/{ConnectedNativeDocxComparison-QKHCYD6W.cjs → ConnectedNativeDocxComparison-7QQ55JIO.cjs} +13 -13
  8. package/dist/{ConnectedNativeDocxComparison-QKHCYD6W.cjs.map → ConnectedNativeDocxComparison-7QQ55JIO.cjs.map} +1 -1
  9. package/dist/{ConnectedPresentation-5DOJ35XL.cjs → ConnectedPresentation-L32JPRFI.cjs} +30 -156
  10. package/dist/ConnectedPresentation-L32JPRFI.cjs.map +1 -0
  11. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs → ConnectedProductionSetDialog-4EAY6KAZ.cjs} +3 -3
  12. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs.map → ConnectedProductionSetDialog-4EAY6KAZ.cjs.map} +1 -1
  13. package/dist/{ConnectedSlidesTab-7YMEDGUU.cjs → ConnectedSlidesTab-P7GGNUTO.cjs} +31 -29
  14. package/dist/ConnectedSlidesTab-P7GGNUTO.cjs.map +1 -0
  15. package/dist/{ConnectedStreamedWordArtifact-AG62232A.cjs → ConnectedStreamedWordArtifact-7NJ3N52V.cjs} +13 -13
  16. package/dist/{ConnectedStreamedWordArtifact-AG62232A.cjs.map → ConnectedStreamedWordArtifact-7NJ3N52V.cjs.map} +1 -1
  17. package/dist/{DocumentReviewCard-M53XFLI2.cjs → DocumentReviewCard-BFPOFQXI.cjs} +16 -16
  18. package/dist/{DocumentReviewCard-M53XFLI2.cjs.map → DocumentReviewCard-BFPOFQXI.cjs.map} +1 -1
  19. package/dist/{FilesViewerDialog-2QCCRWF2.cjs → FilesViewerDialog-MHUVEZ7M.cjs} +35 -32
  20. package/dist/FilesViewerDialog-MHUVEZ7M.cjs.map +1 -0
  21. package/dist/{NativeDocxEditor-2LQY2CTV.cjs → NativeDocxEditor-SIRYPMBN.cjs} +6 -6
  22. package/dist/{NativeDocxEditor-2LQY2CTV.cjs.map → NativeDocxEditor-SIRYPMBN.cjs.map} +1 -1
  23. package/dist/SpotlightStrip-ED22UYTM.cjs +398 -0
  24. package/dist/SpotlightStrip-ED22UYTM.cjs.map +1 -0
  25. package/dist/{WorkspaceTableView-3XYAV4BV.cjs → WorkspaceTableView-MIFYXV3G.cjs} +8 -8
  26. package/dist/{WorkspaceTableView-3XYAV4BV.cjs.map → WorkspaceTableView-MIFYXV3G.cjs.map} +1 -1
  27. package/dist/agents/index.cjs +216 -216
  28. package/dist/ai-IEIR7SC2.cjs +3 -3
  29. package/dist/auth/index.cjs +1 -1
  30. package/dist/calls/index.cjs +2 -2
  31. package/dist/chat/index.cjs +6 -6
  32. package/dist/{chunk-GNZAH6UI.cjs → chunk-2K6IMIVL.cjs} +3 -3
  33. package/dist/{chunk-GNZAH6UI.cjs.map → chunk-2K6IMIVL.cjs.map} +1 -1
  34. package/dist/{chunk-NQML7IUC.cjs → chunk-3UP32FM3.cjs} +6 -6
  35. package/dist/{chunk-NQML7IUC.cjs.map → chunk-3UP32FM3.cjs.map} +1 -1
  36. package/dist/chunk-3ZZZO4F7.cjs +145 -0
  37. package/dist/chunk-3ZZZO4F7.cjs.map +1 -0
  38. package/dist/{chunk-L4CIFLCU.cjs → chunk-4LP5MJGQ.cjs} +4 -4
  39. package/dist/{chunk-L4CIFLCU.cjs.map → chunk-4LP5MJGQ.cjs.map} +1 -1
  40. package/dist/{chunk-JD2HX2BR.cjs → chunk-6JMW3IJ2.cjs} +152 -155
  41. package/dist/chunk-6JMW3IJ2.cjs.map +1 -0
  42. package/dist/{chunk-WV7BCGCK.cjs → chunk-7RJZIPLE.cjs} +33 -33
  43. package/dist/{chunk-WV7BCGCK.cjs.map → chunk-7RJZIPLE.cjs.map} +1 -1
  44. package/dist/{chunk-WFMWKPGY.cjs → chunk-ADPRIBSH.cjs} +9 -33
  45. package/dist/chunk-ADPRIBSH.cjs.map +1 -0
  46. package/dist/{chunk-7NLO7ASW.cjs → chunk-AISYXX4M.cjs} +4 -4
  47. package/dist/{chunk-7NLO7ASW.cjs.map → chunk-AISYXX4M.cjs.map} +1 -1
  48. package/dist/{chunk-5QERK4PK.cjs → chunk-AS6QZETU.cjs} +35 -35
  49. package/dist/{chunk-5QERK4PK.cjs.map → chunk-AS6QZETU.cjs.map} +1 -1
  50. package/dist/{chunk-V6MW7B4B.cjs → chunk-B3R62764.cjs} +6 -6
  51. package/dist/{chunk-V6MW7B4B.cjs.map → chunk-B3R62764.cjs.map} +1 -1
  52. package/dist/{chunk-VKH3BEZE.cjs → chunk-BLIO3B7Z.cjs} +3 -3
  53. package/dist/{chunk-VKH3BEZE.cjs.map → chunk-BLIO3B7Z.cjs.map} +1 -1
  54. package/dist/{chunk-46P7IDBX.cjs → chunk-CQ2RJYE2.cjs} +4 -4
  55. package/dist/chunk-CQ2RJYE2.cjs.map +1 -0
  56. package/dist/{chunk-MXBXZXXQ.cjs → chunk-ENOPKX7E.cjs} +3 -3
  57. package/dist/{chunk-MXBXZXXQ.cjs.map → chunk-ENOPKX7E.cjs.map} +1 -1
  58. package/dist/{chunk-2CSLFAGF.cjs → chunk-GAMRVB3I.cjs} +4 -3
  59. package/dist/chunk-GAMRVB3I.cjs.map +1 -0
  60. package/dist/chunk-IRGRMJPP.cjs +18 -0
  61. package/dist/{chunk-SDRYSLOX.cjs.map → chunk-IRGRMJPP.cjs.map} +1 -1
  62. package/dist/{chunk-ADDQKZ5I.cjs → chunk-J3FFSEKO.cjs} +4 -4
  63. package/dist/{chunk-ADDQKZ5I.cjs.map → chunk-J3FFSEKO.cjs.map} +1 -1
  64. package/dist/chunk-JITYC4OS.cjs +66 -0
  65. package/dist/chunk-JITYC4OS.cjs.map +1 -0
  66. package/dist/chunk-JY7UUZQG.cjs +1513 -0
  67. package/dist/chunk-JY7UUZQG.cjs.map +1 -0
  68. package/dist/{chunk-ALK3PUUB.cjs → chunk-L6HTZIBD.cjs} +3 -3
  69. package/dist/{chunk-ALK3PUUB.cjs.map → chunk-L6HTZIBD.cjs.map} +1 -1
  70. package/dist/chunk-MVXHTAJ4.cjs +111 -0
  71. package/dist/chunk-MVXHTAJ4.cjs.map +1 -0
  72. package/dist/{chunk-OHHKBURG.cjs → chunk-OGK377NL.cjs} +33 -33
  73. package/dist/{chunk-OHHKBURG.cjs.map → chunk-OGK377NL.cjs.map} +1 -1
  74. package/dist/{chunk-T73BHNQX.cjs → chunk-OHWHYVKG.cjs} +3 -3
  75. package/dist/{chunk-T73BHNQX.cjs.map → chunk-OHWHYVKG.cjs.map} +1 -1
  76. package/dist/{chunk-4TTX6ZNS.cjs → chunk-ORNLCBNE.cjs} +24 -2
  77. package/dist/chunk-ORNLCBNE.cjs.map +1 -0
  78. package/dist/{chunk-MLA2BJ2Y.cjs → chunk-PSB64T43.cjs} +28 -28
  79. package/dist/{chunk-MLA2BJ2Y.cjs.map → chunk-PSB64T43.cjs.map} +1 -1
  80. package/dist/{chunk-COD5ENHK.cjs → chunk-PVJ5ODDB.cjs} +4 -4
  81. package/dist/{chunk-COD5ENHK.cjs.map → chunk-PVJ5ODDB.cjs.map} +1 -1
  82. package/dist/{chunk-7557LDAN.cjs → chunk-PWBRE7JA.cjs} +5 -5
  83. package/dist/{chunk-7557LDAN.cjs.map → chunk-PWBRE7JA.cjs.map} +1 -1
  84. package/dist/{chunk-7PN3YENO.cjs → chunk-QIK7E6VF.cjs} +4 -4
  85. package/dist/{chunk-7PN3YENO.cjs.map → chunk-QIK7E6VF.cjs.map} +1 -1
  86. package/dist/{chunk-DWMWEALB.cjs → chunk-TSFNLY3K.cjs} +143 -1634
  87. package/dist/chunk-TSFNLY3K.cjs.map +1 -0
  88. package/dist/{chunk-YGBHY67W.cjs → chunk-UA7HOLAZ.cjs} +5 -5
  89. package/dist/{chunk-YGBHY67W.cjs.map → chunk-UA7HOLAZ.cjs.map} +1 -1
  90. package/dist/{chunk-KXIRVKCJ.cjs → chunk-UUENH4BJ.cjs} +3 -3
  91. package/dist/{chunk-KXIRVKCJ.cjs.map → chunk-UUENH4BJ.cjs.map} +1 -1
  92. package/dist/chunk-WVZLAAIZ.cjs +31 -0
  93. package/dist/chunk-WVZLAAIZ.cjs.map +1 -0
  94. package/dist/{chunk-E3L5DB5F.cjs → chunk-YOEP3I4V.cjs} +5 -5
  95. package/dist/{chunk-E3L5DB5F.cjs.map → chunk-YOEP3I4V.cjs.map} +1 -1
  96. package/dist/{chunk-SNPK3R3O.cjs → chunk-YVO6Z5BS.cjs} +10 -10
  97. package/dist/{chunk-SNPK3R3O.cjs.map → chunk-YVO6Z5BS.cjs.map} +1 -1
  98. package/dist/chunk-ZZZITHGK.cjs +119 -0
  99. package/dist/chunk-ZZZITHGK.cjs.map +1 -0
  100. package/dist/connect/docx.cjs +17 -17
  101. package/dist/connect/index.cjs +994 -994
  102. package/dist/connect/viewer.cjs +28 -25
  103. package/dist/connection/presentation/ClippingMediaViewer.js +3 -3
  104. package/dist/connection/presentation/ClippingMediaViewer.js.map +2 -2
  105. package/dist/connection/presentation/ClippingPdfViewer.d.ts +4 -3
  106. package/dist/connection/presentation/ClippingPdfViewer.js +48 -9
  107. package/dist/connection/presentation/ClippingPdfViewer.js.map +2 -2
  108. package/dist/connection/presentation/SpotlightLayer.d.ts +5 -0
  109. package/dist/connection/presentation/SpotlightLayer.js +19 -0
  110. package/dist/connection/presentation/SpotlightLayer.js.map +7 -0
  111. package/dist/connection/presentation/SpotlightStrip.d.ts +10 -0
  112. package/dist/connection/presentation/SpotlightStrip.js +237 -0
  113. package/dist/connection/presentation/SpotlightStrip.js.map +7 -0
  114. package/dist/connection/presentation/useViewerClipping.d.ts +4 -3
  115. package/dist/connection/presentation/useViewerClipping.js +8 -4
  116. package/dist/connection/presentation/useViewerClipping.js.map +2 -2
  117. package/dist/connection/viewer/ConnectedDocumentViewer.js +1 -1
  118. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  119. package/dist/connection/viewer/VersionDropdown.js +1 -1
  120. package/dist/connection/viewer/VersionDropdown.js.map +1 -1
  121. package/dist/connection/viewer/ViewerPdfPane.js +2 -0
  122. package/dist/connection/viewer/ViewerPdfPane.js.map +2 -2
  123. package/dist/connection/viewer/pdf/passageHighlights.d.ts +5 -0
  124. package/dist/connection/viewer/pdf/passageHighlights.js +14 -1
  125. package/dist/connection/viewer/pdf/passageHighlights.js.map +2 -2
  126. package/dist/connection/viewer/pdf/usePassageTextFallback.d.ts +12 -0
  127. package/dist/connection/viewer/pdf/usePassageTextFallback.js +30 -0
  128. package/dist/connection/viewer/pdf/usePassageTextFallback.js.map +7 -0
  129. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js +2 -11
  130. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js.map +2 -2
  131. package/dist/connection/viewer/useCleanView.d.ts +3 -1
  132. package/dist/connection/viewer/useCleanView.js +6 -3
  133. package/dist/connection/viewer/useCleanView.js.map +2 -2
  134. package/dist/connection/viewer/useViewerTabs.js +13 -1
  135. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  136. package/dist/document-tools/DocumentToolButtons.js +1 -1
  137. package/dist/document-tools/DocumentToolButtons.js.map +1 -1
  138. package/dist/document-tools/index.cjs +20 -20
  139. package/dist/docx/DocxCommandMenu.js +2 -1
  140. package/dist/docx/DocxCommandMenu.js.map +2 -2
  141. package/dist/docx/index.cjs +38 -38
  142. package/dist/embed/index.cjs +20 -20
  143. package/dist/facts/index.cjs +64 -64
  144. package/dist/files/index.cjs +223 -223
  145. package/dist/index.cjs +521 -521
  146. package/dist/presentation/ClipCaptureOverlay.d.ts +7 -3
  147. package/dist/presentation/ClipCaptureOverlay.js +43 -14
  148. package/dist/presentation/ClipCaptureOverlay.js.map +2 -2
  149. package/dist/presentation/PresentControls.d.ts +8 -0
  150. package/dist/presentation/PresentControls.js +1 -0
  151. package/dist/presentation/PresentControls.js.map +2 -2
  152. package/dist/presentation/PresentationStage.d.ts +10 -2
  153. package/dist/presentation/PresentationStage.js +6 -3
  154. package/dist/presentation/PresentationStage.js.map +2 -2
  155. package/dist/presentation/PresenterView.js +1 -22
  156. package/dist/presentation/PresenterView.js.map +2 -2
  157. package/dist/presentation/SpotlightView.d.ts +19 -0
  158. package/dist/presentation/SpotlightView.js +180 -0
  159. package/dist/presentation/SpotlightView.js.map +7 -0
  160. package/dist/presentation/passage-clip.d.ts +17 -0
  161. package/dist/presentation/passage-clip.js +25 -0
  162. package/dist/presentation/passage-clip.js.map +7 -0
  163. package/dist/presentation/spotlight.d.ts +58 -0
  164. package/dist/presentation/spotlight.js +110 -0
  165. package/dist/presentation/spotlight.js.map +7 -0
  166. package/dist/presentation/store.d.ts +5 -0
  167. package/dist/presentation/store.js +19 -0
  168. package/dist/presentation/store.js.map +2 -2
  169. package/dist/presentation/usePointerActive.d.ts +2 -0
  170. package/dist/presentation/usePointerActive.js +28 -0
  171. package/dist/presentation/usePointerActive.js.map +7 -0
  172. package/dist/settings/index.cjs +146 -146
  173. package/dist/site/index.cjs +6 -6
  174. package/dist/studio/index.cjs +9 -9
  175. package/dist/styles.css +1 -1
  176. package/dist/workflow-canvas/index.cjs +35 -35
  177. package/node_modules/@arbidocs/coedit/package.json +1 -1
  178. package/package.json +5 -5
  179. package/dist/ClippingMediaViewer-IEIBT74X.cjs.map +0 -1
  180. package/dist/ClippingPdfViewer-OGYLMVCE.cjs.map +0 -1
  181. package/dist/ConnectedPresentation-5DOJ35XL.cjs.map +0 -1
  182. package/dist/ConnectedSlidesTab-7YMEDGUU.cjs.map +0 -1
  183. package/dist/FilesViewerDialog-2QCCRWF2.cjs.map +0 -1
  184. package/dist/chunk-2CSLFAGF.cjs.map +0 -1
  185. package/dist/chunk-46P7IDBX.cjs.map +0 -1
  186. package/dist/chunk-4TTX6ZNS.cjs.map +0 -1
  187. package/dist/chunk-DWMWEALB.cjs.map +0 -1
  188. package/dist/chunk-JD2HX2BR.cjs.map +0 -1
  189. package/dist/chunk-SDRYSLOX.cjs +0 -18
  190. package/dist/chunk-WFMWKPGY.cjs.map +0 -1
  191. package/dist/chunk-XK4TVJKD.cjs +0 -73
  192. package/dist/chunk-XK4TVJKD.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/files/fields/useMemberLookup.ts","../src/connection/files/grid/ConnectedTagEntity.tsx","../src/connection/files/fields/DocumentFieldParts.tsx","../src/connection/files/fields/documentField.tsx"],"names":["useWorkspaceUsers","useCallback","useTags","useMemo","getTagTypeIcon","getEntityColor","jsxs","EntityTooltip","jsx","EntityTooltipHeader","getTagTypeLabel","Badge","VisibilityToggle","formatFriendlyDate","UserAvatar","Fragment","SharedTagEntity","useDocumentFolders","FolderCommandList","useOpenViewerDocumentId","RelatedDocumentsCell","FieldAttribution","DocumentUser","FieldLabelsSelect","getDocumentTitle","formatDocDate","getDocumentDate","FieldValue","friendlyFileType","DebouncedInput","value","FieldFolderSelect","FieldFolderValue","isLabelTag","tag","isAnnotationTag","FieldNativeSelect","Textarea","FieldWithAttribution"],"mappings":";;;;;;;;;;;;AAIO,SAAS,eAAA,GAEgB;AAC9B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,GAAU,EAAC,KAAMA,uBAAA,EAAkB;AACjD,EAAA,OAAOC,mBAAA;AAAA,IACL,CAAC,MAAA,KAAY,MAAA,GAAS,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,CAAK,WAAA,KAAgB,MAAM,CAAA,EAAG,IAAA,G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O;AAEL,IAAA,KAAA,mBACErB,cAAAA;AAAA,MAAC6B,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,QAAQ,IAAA,IAAQ,EAAA;AAAA,QACvB,QAAA,EAAU,CAAC,CAAA,KACT,OAAA,CAAQ,wBAAA,CAAyB,GAAA,EAAK,CAAA,CAAE,MAAA,CAAO,KAAA,EAAO,MAAA,EAAQ,SAAA,IAAa,IAAI,CAAA;AAAA,QAEjF,WAAA,EAAY,eAAA;AAAA,QACZ,IAAA,EAAM,CAAA;AAAA,QACN,SAAA,EAAW;AAAA;AAAA,KACb;AAAA,EAEJ;AAEA,EAAA,OAAO;AAAA,IACL,OAAO,GAAA,CAAI,IAAA;AAAA,IACX,GAAA;AAAA,IACA,QAAA,EAAU,MAAA,mBACR7B,cAAAA,CAAC8B,sCAAA,EAAA,EAAqB,WAAA,kBAAa9B,cAAAA,CAAC,iBAAA,EAAA,EAAkB,MAAA,EAAgB,CAAA,EACnE,QAAA,EAAA,KAAA,EACH,CAAA,GAEA;AAAA,GAEJ;AACF","file":"chunk-MLA2BJ2Y.cjs","sourcesContent":["import { useCallback } from 'react'\nimport { useWorkspaceUsers, type DocumentPerson } from '@arbidocs/react'\n\n/** Finds a workspace member by id (undefined for anyone else, or no id). */\nexport function useMemberLookup(): (\n userId: string | null | undefined\n) => DocumentPerson | undefined {\n const { data: members = [] } = useWorkspaceUsers()\n return useCallback(\n (userId) => (userId ? members.find((m) => m.user.external_id === userId)?.user : undefined),\n [members]\n )\n}\n","/**\n * A label or field as a pill, with the rich hover card: its type, how many documents carry it, who\n * can see it (a toggle for its owner), and who created and last changed it. The pill itself is the\n * shared `TagEntity` of `@arbidocs/react/ui`; this adds what it reads from the session.\n */\n\nimport { useMemo } from 'react'\nimport { useTags, useWorkspaceUsers } from '@arbidocs/react'\nimport type { TagResponse } from '@arbidocs/sdk/browser'\nimport {\n Badge,\n formatFriendlyDate,\n getEntityColor,\n getTagTypeIcon,\n getTagTypeLabel,\n TagEntity as SharedTagEntity,\n VisibilityToggle,\n} from '@arbidocs/react/ui'\nimport { EntityTooltip, EntityTooltipHeader } from '../../../components/EntityTooltip'\nimport { UserAvatar } from './cells'\n\nexport interface ConnectedTagEntityProps {\n tag: TagResponse\n size?: 'sm' | 'md' | 'lg'\n className?: string\n onClick?: (e: React.MouseEvent) => void\n /** Whether to show the detailed tooltip (default: true) */\n showTooltip?: boolean\n /** Whether current user can edit this tag (owner) */\n canEdit?: boolean\n /** Callback when edit is requested (clicking visibility toggle as owner) */\n onEditClick?: () => void\n}\n\nexport function ConnectedTagEntity({\n tag,\n size = 'md',\n className = '',\n onClick,\n showTooltip = true,\n canEdit = false,\n onEditClick,\n}: ConnectedTagEntityProps) {\n // Get fresh tag data from React Query cache for accurate doctag_count\n const { data: workspaceTags } = useTags()\n\n // The workspace's members: who created and last changed it.\n const { data: members = [] } = useWorkspaceUsers()\n const byId = (id: string | null | undefined) =>\n id ? members.find((m) => m.user.external_id === id)?.user : undefined\n\n // Look up fresh tag from query cache, fall back to prop if not found\n const freshTag = useMemo(() => {\n if (!workspaceTags) return tag\n const found = workspaceTags.find((t) => t.external_id === tag.external_id)\n return found || tag\n }, [workspaceTags, tag])\n\n // Look up creator and updater from the people you know\n const creator = byId(tag.created_by_ext_id) ?? null\n const updater = byId(tag.updated_by_ext_id) ?? null\n\n const Icon = getTagTypeIcon(tag.tag_type.type)\n const tagColor = getEntityColor(tag.external_id, 'medium')\n\n // Handle visibility toggle click for owner\n const handleVisibilityToggle = () => {\n if (canEdit && onEditClick) {\n onEditClick()\n }\n }\n\n // Rich, store-coupled tooltip — injected into the shared pill.\n const tooltipContent = showTooltip ? (\n <EntityTooltip>\n <EntityTooltipHeader\n lead={\n <span\n className=\"inline-flex items-center justify-center rounded-md text-white p-1\"\n style={{ backgroundColor: tagColor }}\n >\n <Icon size={16} />\n </span>\n }\n title={tag.name}\n />\n\n <div className=\"flex flex-col gap-1.5 text-sm\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Type:</span>\n <span>{getTagTypeLabel(tag.tag_type.type)}</span>\n </div>\n\n {/* Files count - use freshTag for accurate count */}\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Documents:</span>\n <Badge variant=\"secondary\" className=\"h-5 min-w-[20px] justify-center\">\n {freshTag.doctag_count ?? 0}\n </Badge>\n </div>\n\n {/* Visibility with toggle */}\n <div className=\"flex items-center gap-2\">\n <VisibilityToggle\n items={freshTag}\n onToggle={handleVisibilityToggle}\n disabled={!canEdit}\n showLabel={false}\n showTooltip={canEdit}\n tooltipActive=\"Click to edit\"\n tooltipInactive=\"Click to edit\"\n />\n <span className=\"text-muted-foreground\">{freshTag.shared ? 'Shared' : 'Private'}</span>\n </div>\n\n {/* Created at/by */}\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Created:</span>\n <span>{formatFriendlyDate(tag.created_at)}</span>\n <span className=\"text-muted-foreground\">by</span>\n <UserAvatar user={creator ?? undefined} />\n </div>\n\n {/* Updated at/by */}\n {tag.updated_at && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Updated:</span>\n <span>{formatFriendlyDate(tag.updated_at)}</span>\n {updater && (\n <>\n <span className=\"text-muted-foreground\">by</span>\n <UserAvatar user={updater} />\n </>\n )}\n </div>\n )}\n </div>\n </EntityTooltip>\n ) : undefined\n\n return (\n <SharedTagEntity\n tag={{ ...tag, color: tagColor }}\n size={size}\n className={className}\n onClick={onClick}\n showTooltip={showTooltip}\n tooltipContent={tooltipContent}\n />\n )\n}\n","/**\n * The parts of the review form's fields: the folder picker, the related documents, who last set a\n * value, and the labels picker.\n */\n\nimport { useMemo } from 'react'\nimport type { TagResponse } from '@arbidocs/sdk/browser'\nimport { useOpenViewerDocumentId, type RelatedDocs, type WorkspaceDocument } from '@arbidocs/react'\nimport { formatFriendlyDate, getEntityColor } from '@arbidocs/react/ui'\nimport { FieldAttribution, FieldLabelsSelect } from '../../../files/FieldParts'\nimport type { LabelOption } from '../../../files/cells/LabelMultiSelect'\nimport { FolderCommandList } from '../../../files/FolderPicker'\nimport { RelatedDocumentsCell, useDocumentFolders } from '../grid/cells'\nimport { DocumentUser } from './DocumentUser'\nimport { useMemberLookup } from './useMemberLookup'\n\ntype DocTag = NonNullable<WorkspaceDocument['doctags']>[number]\n\n/** The workspace's folders to move the document to. */\nexport function FolderPicker({\n documents,\n value,\n onSelect,\n}: {\n documents: WorkspaceDocument[]\n value: string | null | undefined\n onSelect: (folder: string | null) => void\n}) {\n const folders = useDocumentFolders(documents, value)\n return (\n <FolderCommandList folders={folders} value={value} onSelect={onSelect} showRemove={!!value} />\n )\n}\n\n/** The related documents, the one open in the viewer marked. */\nexport function RelatedDocuments({\n doc,\n related,\n onOpen,\n onDelete,\n canDelete,\n onCompare,\n}: {\n doc: WorkspaceDocument\n related: RelatedDocs<WorkspaceDocument>\n onOpen?: (docId: string) => void\n onDelete?: (docId: string) => void\n canDelete?: (doc: WorkspaceDocument) => boolean\n onCompare?: (docId: string, otherDocId: string) => void\n}) {\n const viewingDocumentId = useOpenViewerDocumentId()\n return (\n <RelatedDocumentsCell\n currentDoc={doc}\n related={related}\n viewingDocumentId={viewingDocumentId}\n onDocumentClick={(id) => onOpen?.(id)}\n onDelete={(other) => onDelete?.(other.external_id)}\n canDelete={canDelete}\n onCompare={onCompare}\n />\n )\n}\n\n/** Who last set a value, and when: shown on hover. */\nexport function DocTagAttribution({ doctag }: { doctag: DocTag }) {\n const memberById = useMemberLookup()\n const creator = memberById(doctag.created_by_ext_id)\n const updater =\n doctag.updated_by_ext_id && doctag.updated_by_ext_id !== doctag.created_by_ext_id\n ? memberById(doctag.updated_by_ext_id)\n : undefined\n const lastUser = updater || creator\n if (!lastUser) return null\n const lines = [\n creator &&\n `Created ${formatFriendlyDate(doctag.created_at)} by ${creator.given_name || creator.email}`,\n updater &&\n `Updated ${formatFriendlyDate(doctag.updated_at)} by ${updater.given_name || updater.email}`,\n ].filter((line): line is string => !!line)\n return (\n <FieldAttribution\n avatar={<DocumentUser user={lastUser} tooltip={false} />}\n date={formatFriendlyDate(updater ? doctag.updated_at : doctag.created_at)}\n lines={lines}\n />\n )\n}\n\n/** The labels as a picker: toggle one, or create one by name and apply it. */\nexport function LabelsCombobox({\n labelTags,\n appliedTagIds,\n onToggle,\n onCreateAndApply,\n}: {\n labelTags: TagResponse[]\n appliedTagIds: ReadonlySet<string>\n onToggle: (tag: TagResponse) => void\n onCreateAndApply?: (name: string) => void\n}) {\n const options: LabelOption[] = useMemo(\n () =>\n labelTags.map((t) => ({\n id: t.external_id,\n name: t.name,\n color: getEntityColor(t.external_id, 'medium'),\n })),\n [labelTags]\n )\n\n // An existing label of that name (any case) is applied rather than made again.\n const handleCreate = (name: string) => {\n const trimmed = name.trim()\n if (!trimmed) return\n const existing = labelTags.find((t) => t.name.toLowerCase() === trimmed.toLowerCase())\n if (!existing) onCreateAndApply?.(trimmed)\n else if (!appliedTagIds.has(existing.external_id)) onToggle(existing)\n }\n\n return (\n <FieldLabelsSelect\n options={options}\n appliedIds={appliedTagIds}\n onToggle={(id) => {\n const tag = labelTags.find((t) => t.external_id === id)\n if (tag) onToggle(tag)\n }}\n onCreate={onCreateAndApply ? handleCreate : undefined}\n />\n )\n}\n","/**\n * One field of a document as the review form shows it (a column of the documents table, one per\n * row): its label, icon and the value, editable where the table's column is. Standard fields,\n * metadata, the folder, related documents, the labels and each annotation (with who last set it).\n */\n\nimport type { ElementType, ReactNode } from 'react'\nimport { isAnnotationTag, isLabelTag, type TagResponse } from '@arbidocs/sdk/browser'\nimport type { DocumentPerson, RelatedDocs, WorkspaceDocument } from '@arbidocs/react'\nimport {\n DebouncedInput,\n formatFriendlyDate,\n friendlyFileType,\n Textarea,\n formatDocDate,\n getDocumentDate,\n getDocumentTitle,\n} from '@arbidocs/react/ui'\nimport {\n FieldFolderSelect,\n FieldFolderValue,\n FieldNativeSelect,\n FieldValue,\n FieldWithAttribution,\n} from '../../../files/FieldParts'\nimport { DocumentUser } from './DocumentUser'\nimport {\n DocTagAttribution,\n FolderPicker,\n LabelsCombobox,\n RelatedDocuments,\n} from './DocumentFieldParts'\n\ntype DocTag = NonNullable<WorkspaceDocument['doctags']>[number]\nexport type DocTagCitations = NonNullable<DocTag['citations']> | null\n\n/** A field as the form lays it out. */\nexport interface DocumentFieldContent {\n label: string\n icon?: ReactNode\n /** The annotation the field is (its pill is shown as the label). */\n tag?: TagResponse\n children: ReactNode\n}\n\nexport interface DocumentFieldOptions {\n /** The column (a standard field's id, or an annotation's tag id). */\n columnId: string\n doc: WorkspaceDocument\n canEdit: boolean\n workspaceTags: TagResponse[]\n /** The workspace's documents (the folders to pick from). */\n allDocuments?: WorkspaceDocument[]\n /** Who uploaded the document. */\n creator?: DocumentPerson\n getColumnLabel: (colId: string) => string\n getColumnIcon: (colId: string) => ElementType | undefined\n isColumnEditable: (colId: string) => boolean\n onUpdateDocumentField: (field: string, value: unknown) => void\n onUpdateTagValue: (tag: TagResponse, value: string | boolean) => void\n onUpdateTagWithCitations: (tag: TagResponse, note: string, citations: DocTagCitations) => void\n /** Create a label and apply it (the labels picker). Absent: the picker only toggles. */\n onCreateAndApplyLabel?: (name: string) => void\n /** The document's related documents (email family, copies, duplicates, similar). */\n relatedDocs?: RelatedDocs<WorkspaceDocument>\n /** Open a related document. */\n onOpenDocument?: (docId: string) => void\n /** Delete a related document (asks first). */\n onDeleteDocument?: (docId: string) => void\n canDeleteRelatedDocument?: (doc: WorkspaceDocument) => boolean\n /** Compare with a similar document. Absent: not offered. */\n onCompareDocuments?: (docId: string, otherDocId: string) => void\n}\n\n/** The document metadata a field edits as text. */\nconst METADATA_FIELDS: Record<string, (doc: WorkspaceDocument) => string> = {\n title: (doc) => getDocumentTitle(doc),\n doc_nature: (doc) => doc.doc_metadata?.doc_nature || '',\n doc_author: (doc) => doc.doc_metadata?.doc_author || '',\n doc_subject: (doc) => doc.doc_metadata?.doc_subject || '',\n // As the table shows it: with the time when the value has one (emails).\n doc_date: (doc) => formatDocDate(getDocumentDate(doc)),\n}\n\nconst INPUT_CLASS = 'text-sm bg-muted/40 focus:bg-background transition-colors'\n\n/** A read-only standard field: its value (muted unless said otherwise). */\nconst READ_ONLY_FIELDS: Record<string, (doc: WorkspaceDocument) => ReactNode> = {\n file_name: (doc) => <FieldValue tone=\"strong\">{doc.file_name || 'N/A'}</FieldValue>,\n status: (doc) => <FieldValue tone=\"muted\">{doc.status || 'N/A'}</FieldValue>,\n n_pages: (doc) => <FieldValue tone=\"muted\">{doc.n_pages || 'N/A'}</FieldValue>,\n created_at: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.created_at ? formatFriendlyDate(doc.created_at) : 'N/A'}\n </FieldValue>\n ),\n updated_at: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.updated_at ? formatFriendlyDate(doc.updated_at) : 'N/A'}\n </FieldValue>\n ),\n file_type: (doc) => (\n <FieldValue tone=\"muted\">\n {friendlyFileType(doc.file_type, doc.file_name, doc.folder)}\n </FieldValue>\n ),\n file_size: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.file_size ? `${Math.round(doc.file_size / 1024)} KB` : 'N/A'}\n </FieldValue>\n ),\n doc_id: (doc) => (\n <FieldValue tone=\"muted\" isMono>\n {doc.external_id || 'N/A'}\n </FieldValue>\n ),\n content_hash: (doc) => (\n <FieldValue tone=\"muted\" isMono isTruncated>\n {doc.content_hash || 'N/A'}\n </FieldValue>\n ),\n}\n\n/** The field of `columnId`, or null when the document has none to show there. */\nexport function documentFieldContent(options: DocumentFieldOptions): DocumentFieldContent | null {\n const { columnId, doc, canEdit, workspaceTags, getColumnLabel, getColumnIcon } = options\n const Icon = getColumnIcon(columnId)\n const standard = (children: ReactNode): DocumentFieldContent => ({\n label: getColumnLabel(columnId),\n icon: Icon ? <Icon size={14} /> : undefined,\n children,\n })\n\n const metadata = METADATA_FIELDS[columnId]\n if (metadata) {\n const editable = options.isColumnEditable(columnId) && canEdit\n return standard(\n editable ? (\n <DebouncedInput\n value={metadata(doc)}\n onChange={(value) => options.onUpdateDocumentField(columnId, value)}\n multiline={true}\n placeholder={`Add ${getColumnLabel(columnId).toLowerCase()}…`}\n className={INPUT_CLASS}\n />\n ) : (\n <FieldValue>{metadata(doc) || 'N/A'}</FieldValue>\n )\n )\n }\n\n const readOnly = READ_ONLY_FIELDS[columnId]\n if (readOnly) return standard(readOnly(doc))\n\n if (columnId === 'created_by') return standard(<DocumentUser user={options.creator} />)\n\n if (columnId === 'folder') {\n return standard(\n canEdit ? (\n <FieldFolderSelect\n folder={doc.folder}\n picker={\n <FolderPicker\n documents={options.allDocuments ?? []}\n value={doc.folder}\n onSelect={(folder) => options.onUpdateDocumentField('folder', folder)}\n />\n }\n />\n ) : (\n <FieldFolderValue folder={doc.folder} />\n )\n )\n }\n\n if (columnId === 'related') {\n const related = options.relatedDocs\n if (!related) return null\n return standard(\n <RelatedDocuments\n doc={doc}\n related={related}\n onOpen={options.onOpenDocument}\n onDelete={options.onDeleteDocument}\n canDelete={options.canDeleteRelatedDocument}\n onCompare={options.onCompareDocuments}\n />\n )\n }\n\n if (columnId === 'all_tags') {\n // The labels (and issues), toggled in place.\n const labelTags = workspaceTags.filter(isLabelTag)\n const appliedIds = new Set(\n (doc.doctags ?? [])\n .filter((dt) => labelTags.some((t) => t.external_id === dt.tag_ext_id))\n .map((dt) => dt.tag_ext_id)\n )\n return standard(\n <LabelsCombobox\n labelTags={labelTags}\n appliedTagIds={appliedIds}\n onToggle={(tag) => options.onUpdateTagValue(tag, !appliedIds.has(tag.external_id))}\n onCreateAndApply={options.onCreateAndApplyLabel}\n />\n )\n }\n\n // An annotation (a label is a value of the Labels field, not a field of its own).\n const tag = workspaceTags.find((t) => t.external_id === columnId)\n if (!tag || !isAnnotationTag(tag)) return null\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n let value: ReactNode\n if (tag.tag_type.type === 'select') {\n value = (\n <FieldNativeSelect\n value={doctag?.note || ''}\n options={tag.tag_type.options}\n onChange={(next) => options.onUpdateTagValue(tag, next)}\n ariaLabel={tag.name}\n />\n )\n } else if (tag.tag_type.type === 'number') {\n value = (\n <DebouncedInput\n type=\"number\"\n value={doctag?.note || ''}\n onChange={(next) => options.onUpdateTagValue(tag, next)}\n placeholder={`Add ${tag.name.toLowerCase()}…`}\n className={INPUT_CLASS}\n />\n )\n } else {\n // A plain note: a value's citations come from generation and are kept as they are.\n value = (\n <Textarea\n value={doctag?.note || ''}\n onChange={(e) =>\n options.onUpdateTagWithCitations(tag, e.target.value, doctag?.citations ?? null)\n }\n placeholder=\"Add a note...\"\n rows={2}\n className={INPUT_CLASS}\n />\n )\n }\n\n return {\n label: tag.name,\n tag,\n children: doctag ? (\n <FieldWithAttribution attribution={<DocTagAttribution doctag={doctag} />}>\n {value}\n </FieldWithAttribution>\n ) : (\n value\n ),\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/files/fields/useMemberLookup.ts","../src/connection/files/grid/ConnectedTagEntity.tsx","../src/connection/files/fields/DocumentFieldParts.tsx","../src/connection/files/fields/documentField.tsx"],"names":["useWorkspaceUsers","useCallback","useTags","useMemo","getTagTypeIcon","getEntityColor","jsxs","EntityTooltip","jsx","EntityTooltipHeader","getTagTypeLabel","Badge","VisibilityToggle","formatFriendlyDate","UserAvatar","Fragment","SharedTagEntity","useDocumentFolders","FolderCommandList","useOpenViewerDocumentId","RelatedDocumentsCell","FieldAttribution","DocumentUser","FieldLabelsSelect","getDocumentTitle","formatDocDate","getDocumentDate","FieldValue","friendlyFileType","DebouncedInput","value","FieldFolderSelect","FieldFolderValue","isLabelTag","tag","isAnnotationTag","FieldNativeSelect","Textarea","FieldWithAttribution"],"mappings":";;;;;;;;;;;;AAIO,SAAS,eAAA,GAEgB;AAC9B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,GAAU,EAAC,KAAMA,uBAAA,EAAkB;AACjD,EAAA,OAAOC,mBAAA;AAAA,IACL,CAAC,MAAA,KAAY,MAAA,GAAS,OAAA,C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AA,CAAK,aAAa,CAAA,MAAA,CAAA;AAAA,QAC1C,SAAA,EAAW;AAAA;AAAA,KACb;AAAA,EAEJ,CAAA,MAAO;AAEL,IAAA,KAAA,mBACErB,cAAAA;AAAA,MAAC6B,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,QAAQ,IAAA,IAAQ,EAAA;AAAA,QACvB,QAAA,EAAU,CAAC,CAAA,KACT,OAAA,CAAQ,wBAAA,CAAyB,GAAA,EAAK,CAAA,CAAE,MAAA,CAAO,KAAA,EAAO,MAAA,EAAQ,SAAA,IAAa,IAAI,CAAA;AAAA,QAEjF,WAAA,EAAY,eAAA;AAAA,QACZ,IAAA,EAAM,CAAA;AAAA,QACN,SAAA,EAAW;AAAA;AAAA,KACb;AAAA,EAEJ;AAEA,EAAA,OAAO;AAAA,IACL,OAAO,GAAA,CAAI,IAAA;AAAA,IACX,GAAA;AAAA,IACA,QAAA,EAAU,MAAA,mBACR7B,cAAAA,CAAC8B,sCAAA,EAAA,EAAqB,WAAA,kBAAa9B,cAAAA,CAAC,iBAAA,EAAA,EAAkB,MAAA,EAAgB,CAAA,EACnE,QAAA,EAAA,KAAA,EACH,CAAA,GAEA;AAAA,GAEJ;AACF","file":"chunk-PSB64T43.cjs","sourcesContent":["import { useCallback } from 'react'\nimport { useWorkspaceUsers, type DocumentPerson } from '@arbidocs/react'\n\n/** Finds a workspace member by id (undefined for anyone else, or no id). */\nexport function useMemberLookup(): (\n userId: string | null | undefined\n) => DocumentPerson | undefined {\n const { data: members = [] } = useWorkspaceUsers()\n return useCallback(\n (userId) => (userId ? members.find((m) => m.user.external_id === userId)?.user : undefined),\n [members]\n )\n}\n","/**\n * A label or field as a pill, with the rich hover card: its type, how many documents carry it, who\n * can see it (a toggle for its owner), and who created and last changed it. The pill itself is the\n * shared `TagEntity` of `@arbidocs/react/ui`; this adds what it reads from the session.\n */\n\nimport { useMemo } from 'react'\nimport { useTags, useWorkspaceUsers } from '@arbidocs/react'\nimport type { TagResponse } from '@arbidocs/sdk/browser'\nimport {\n Badge,\n formatFriendlyDate,\n getEntityColor,\n getTagTypeIcon,\n getTagTypeLabel,\n TagEntity as SharedTagEntity,\n VisibilityToggle,\n} from '@arbidocs/react/ui'\nimport { EntityTooltip, EntityTooltipHeader } from '../../../components/EntityTooltip'\nimport { UserAvatar } from './cells'\n\nexport interface ConnectedTagEntityProps {\n tag: TagResponse\n size?: 'sm' | 'md' | 'lg'\n className?: string\n onClick?: (e: React.MouseEvent) => void\n /** Whether to show the detailed tooltip (default: true) */\n showTooltip?: boolean\n /** Whether current user can edit this tag (owner) */\n canEdit?: boolean\n /** Callback when edit is requested (clicking visibility toggle as owner) */\n onEditClick?: () => void\n}\n\nexport function ConnectedTagEntity({\n tag,\n size = 'md',\n className = '',\n onClick,\n showTooltip = true,\n canEdit = false,\n onEditClick,\n}: ConnectedTagEntityProps) {\n // Get fresh tag data from React Query cache for accurate doctag_count\n const { data: workspaceTags } = useTags()\n\n // The workspace's members: who created and last changed it.\n const { data: members = [] } = useWorkspaceUsers()\n const byId = (id: string | null | undefined) =>\n id ? members.find((m) => m.user.external_id === id)?.user : undefined\n\n // Look up fresh tag from query cache, fall back to prop if not found\n const freshTag = useMemo(() => {\n if (!workspaceTags) return tag\n const found = workspaceTags.find((t) => t.external_id === tag.external_id)\n return found || tag\n }, [workspaceTags, tag])\n\n // Look up creator and updater from the people you know\n const creator = byId(tag.created_by_ext_id) ?? null\n const updater = byId(tag.updated_by_ext_id) ?? null\n\n const Icon = getTagTypeIcon(tag.tag_type.type)\n const tagColor = getEntityColor(tag.external_id, 'medium')\n\n // Handle visibility toggle click for owner\n const handleVisibilityToggle = () => {\n if (canEdit && onEditClick) {\n onEditClick()\n }\n }\n\n // Rich, store-coupled tooltip — injected into the shared pill.\n const tooltipContent = showTooltip ? (\n <EntityTooltip>\n <EntityTooltipHeader\n lead={\n <span\n className=\"inline-flex items-center justify-center rounded-md text-white p-1\"\n style={{ backgroundColor: tagColor }}\n >\n <Icon size={16} />\n </span>\n }\n title={tag.name}\n />\n\n <div className=\"flex flex-col gap-1.5 text-sm\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Type:</span>\n <span>{getTagTypeLabel(tag.tag_type.type)}</span>\n </div>\n\n {/* Files count - use freshTag for accurate count */}\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Documents:</span>\n <Badge variant=\"secondary\" className=\"h-5 min-w-[20px] justify-center\">\n {freshTag.doctag_count ?? 0}\n </Badge>\n </div>\n\n {/* Visibility with toggle */}\n <div className=\"flex items-center gap-2\">\n <VisibilityToggle\n items={freshTag}\n onToggle={handleVisibilityToggle}\n disabled={!canEdit}\n showLabel={false}\n showTooltip={canEdit}\n tooltipActive=\"Click to edit\"\n tooltipInactive=\"Click to edit\"\n />\n <span className=\"text-muted-foreground\">{freshTag.shared ? 'Shared' : 'Private'}</span>\n </div>\n\n {/* Created at/by */}\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Created:</span>\n <span>{formatFriendlyDate(tag.created_at)}</span>\n <span className=\"text-muted-foreground\">by</span>\n <UserAvatar user={creator ?? undefined} />\n </div>\n\n {/* Updated at/by */}\n {tag.updated_at && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Updated:</span>\n <span>{formatFriendlyDate(tag.updated_at)}</span>\n {updater && (\n <>\n <span className=\"text-muted-foreground\">by</span>\n <UserAvatar user={updater} />\n </>\n )}\n </div>\n )}\n </div>\n </EntityTooltip>\n ) : undefined\n\n return (\n <SharedTagEntity\n tag={{ ...tag, color: tagColor }}\n size={size}\n className={className}\n onClick={onClick}\n showTooltip={showTooltip}\n tooltipContent={tooltipContent}\n />\n )\n}\n","/**\n * The parts of the review form's fields: the folder picker, the related documents, who last set a\n * value, and the labels picker.\n */\n\nimport { useMemo } from 'react'\nimport type { TagResponse } from '@arbidocs/sdk/browser'\nimport { useOpenViewerDocumentId, type RelatedDocs, type WorkspaceDocument } from '@arbidocs/react'\nimport { formatFriendlyDate, getEntityColor } from '@arbidocs/react/ui'\nimport { FieldAttribution, FieldLabelsSelect } from '../../../files/FieldParts'\nimport type { LabelOption } from '../../../files/cells/LabelMultiSelect'\nimport { FolderCommandList } from '../../../files/FolderPicker'\nimport { RelatedDocumentsCell, useDocumentFolders } from '../grid/cells'\nimport { DocumentUser } from './DocumentUser'\nimport { useMemberLookup } from './useMemberLookup'\n\ntype DocTag = NonNullable<WorkspaceDocument['doctags']>[number]\n\n/** The workspace's folders to move the document to. */\nexport function FolderPicker({\n documents,\n value,\n onSelect,\n}: {\n documents: WorkspaceDocument[]\n value: string | null | undefined\n onSelect: (folder: string | null) => void\n}) {\n const folders = useDocumentFolders(documents, value)\n return (\n <FolderCommandList folders={folders} value={value} onSelect={onSelect} showRemove={!!value} />\n )\n}\n\n/** The related documents, the one open in the viewer marked. */\nexport function RelatedDocuments({\n doc,\n related,\n onOpen,\n onDelete,\n canDelete,\n onCompare,\n}: {\n doc: WorkspaceDocument\n related: RelatedDocs<WorkspaceDocument>\n onOpen?: (docId: string) => void\n onDelete?: (docId: string) => void\n canDelete?: (doc: WorkspaceDocument) => boolean\n onCompare?: (docId: string, otherDocId: string) => void\n}) {\n const viewingDocumentId = useOpenViewerDocumentId()\n return (\n <RelatedDocumentsCell\n currentDoc={doc}\n related={related}\n viewingDocumentId={viewingDocumentId}\n onDocumentClick={(id) => onOpen?.(id)}\n onDelete={(other) => onDelete?.(other.external_id)}\n canDelete={canDelete}\n onCompare={onCompare}\n />\n )\n}\n\n/** Who last set a value, and when: shown on hover. */\nexport function DocTagAttribution({ doctag }: { doctag: DocTag }) {\n const memberById = useMemberLookup()\n const creator = memberById(doctag.created_by_ext_id)\n const updater =\n doctag.updated_by_ext_id && doctag.updated_by_ext_id !== doctag.created_by_ext_id\n ? memberById(doctag.updated_by_ext_id)\n : undefined\n const lastUser = updater || creator\n if (!lastUser) return null\n const lines = [\n creator &&\n `Created ${formatFriendlyDate(doctag.created_at)} by ${creator.given_name || creator.email}`,\n updater &&\n `Updated ${formatFriendlyDate(doctag.updated_at)} by ${updater.given_name || updater.email}`,\n ].filter((line): line is string => !!line)\n return (\n <FieldAttribution\n avatar={<DocumentUser user={lastUser} tooltip={false} />}\n date={formatFriendlyDate(updater ? doctag.updated_at : doctag.created_at)}\n lines={lines}\n />\n )\n}\n\n/** The labels as a picker: toggle one, or create one by name and apply it. */\nexport function LabelsCombobox({\n labelTags,\n appliedTagIds,\n onToggle,\n onCreateAndApply,\n}: {\n labelTags: TagResponse[]\n appliedTagIds: ReadonlySet<string>\n onToggle: (tag: TagResponse) => void\n onCreateAndApply?: (name: string) => void\n}) {\n const options: LabelOption[] = useMemo(\n () =>\n labelTags.map((t) => ({\n id: t.external_id,\n name: t.name,\n color: getEntityColor(t.external_id, 'medium'),\n })),\n [labelTags]\n )\n\n // An existing label of that name (any case) is applied rather than made again.\n const handleCreate = (name: string) => {\n const trimmed = name.trim()\n if (!trimmed) return\n const existing = labelTags.find((t) => t.name.toLowerCase() === trimmed.toLowerCase())\n if (!existing) onCreateAndApply?.(trimmed)\n else if (!appliedTagIds.has(existing.external_id)) onToggle(existing)\n }\n\n return (\n <FieldLabelsSelect\n options={options}\n appliedIds={appliedTagIds}\n onToggle={(id) => {\n const tag = labelTags.find((t) => t.external_id === id)\n if (tag) onToggle(tag)\n }}\n onCreate={onCreateAndApply ? handleCreate : undefined}\n />\n )\n}\n","/**\n * One field of a document as the review form shows it (a column of the documents table, one per\n * row): its label, icon and the value, editable where the table's column is. Standard fields,\n * metadata, the folder, related documents, the labels and each annotation (with who last set it).\n */\n\nimport type { ElementType, ReactNode } from 'react'\nimport { isAnnotationTag, isLabelTag, type TagResponse } from '@arbidocs/sdk/browser'\nimport type { DocumentPerson, RelatedDocs, WorkspaceDocument } from '@arbidocs/react'\nimport {\n DebouncedInput,\n formatFriendlyDate,\n friendlyFileType,\n Textarea,\n formatDocDate,\n getDocumentDate,\n getDocumentTitle,\n} from '@arbidocs/react/ui'\nimport {\n FieldFolderSelect,\n FieldFolderValue,\n FieldNativeSelect,\n FieldValue,\n FieldWithAttribution,\n} from '../../../files/FieldParts'\nimport { DocumentUser } from './DocumentUser'\nimport {\n DocTagAttribution,\n FolderPicker,\n LabelsCombobox,\n RelatedDocuments,\n} from './DocumentFieldParts'\n\ntype DocTag = NonNullable<WorkspaceDocument['doctags']>[number]\nexport type DocTagCitations = NonNullable<DocTag['citations']> | null\n\n/** A field as the form lays it out. */\nexport interface DocumentFieldContent {\n label: string\n icon?: ReactNode\n /** The annotation the field is (its pill is shown as the label). */\n tag?: TagResponse\n children: ReactNode\n}\n\nexport interface DocumentFieldOptions {\n /** The column (a standard field's id, or an annotation's tag id). */\n columnId: string\n doc: WorkspaceDocument\n canEdit: boolean\n workspaceTags: TagResponse[]\n /** The workspace's documents (the folders to pick from). */\n allDocuments?: WorkspaceDocument[]\n /** Who uploaded the document. */\n creator?: DocumentPerson\n getColumnLabel: (colId: string) => string\n getColumnIcon: (colId: string) => ElementType | undefined\n isColumnEditable: (colId: string) => boolean\n onUpdateDocumentField: (field: string, value: unknown) => void\n onUpdateTagValue: (tag: TagResponse, value: string | boolean) => void\n onUpdateTagWithCitations: (tag: TagResponse, note: string, citations: DocTagCitations) => void\n /** Create a label and apply it (the labels picker). Absent: the picker only toggles. */\n onCreateAndApplyLabel?: (name: string) => void\n /** The document's related documents (email family, copies, duplicates, similar). */\n relatedDocs?: RelatedDocs<WorkspaceDocument>\n /** Open a related document. */\n onOpenDocument?: (docId: string) => void\n /** Delete a related document (asks first). */\n onDeleteDocument?: (docId: string) => void\n canDeleteRelatedDocument?: (doc: WorkspaceDocument) => boolean\n /** Compare with a similar document. Absent: not offered. */\n onCompareDocuments?: (docId: string, otherDocId: string) => void\n}\n\n/** The document metadata a field edits as text. */\nconst METADATA_FIELDS: Record<string, (doc: WorkspaceDocument) => string> = {\n title: (doc) => getDocumentTitle(doc),\n doc_nature: (doc) => doc.doc_metadata?.doc_nature || '',\n doc_author: (doc) => doc.doc_metadata?.doc_author || '',\n doc_subject: (doc) => doc.doc_metadata?.doc_subject || '',\n // As the table shows it: with the time when the value has one (emails).\n doc_date: (doc) => formatDocDate(getDocumentDate(doc)),\n}\n\nconst INPUT_CLASS = 'text-sm bg-muted/40 focus:bg-background transition-colors'\n\n/** A read-only standard field: its value (muted unless said otherwise). */\nconst READ_ONLY_FIELDS: Record<string, (doc: WorkspaceDocument) => ReactNode> = {\n file_name: (doc) => <FieldValue tone=\"strong\">{doc.file_name || 'N/A'}</FieldValue>,\n status: (doc) => <FieldValue tone=\"muted\">{doc.status || 'N/A'}</FieldValue>,\n n_pages: (doc) => <FieldValue tone=\"muted\">{doc.n_pages || 'N/A'}</FieldValue>,\n created_at: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.created_at ? formatFriendlyDate(doc.created_at) : 'N/A'}\n </FieldValue>\n ),\n updated_at: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.updated_at ? formatFriendlyDate(doc.updated_at) : 'N/A'}\n </FieldValue>\n ),\n file_type: (doc) => (\n <FieldValue tone=\"muted\">\n {friendlyFileType(doc.file_type, doc.file_name, doc.folder)}\n </FieldValue>\n ),\n file_size: (doc) => (\n <FieldValue tone=\"muted\">\n {doc.file_size ? `${Math.round(doc.file_size / 1024)} KB` : 'N/A'}\n </FieldValue>\n ),\n doc_id: (doc) => (\n <FieldValue tone=\"muted\" isMono>\n {doc.external_id || 'N/A'}\n </FieldValue>\n ),\n content_hash: (doc) => (\n <FieldValue tone=\"muted\" isMono isTruncated>\n {doc.content_hash || 'N/A'}\n </FieldValue>\n ),\n}\n\n/** The field of `columnId`, or null when the document has none to show there. */\nexport function documentFieldContent(options: DocumentFieldOptions): DocumentFieldContent | null {\n const { columnId, doc, canEdit, workspaceTags, getColumnLabel, getColumnIcon } = options\n const Icon = getColumnIcon(columnId)\n const standard = (children: ReactNode): DocumentFieldContent => ({\n label: getColumnLabel(columnId),\n icon: Icon ? <Icon size={14} /> : undefined,\n children,\n })\n\n const metadata = METADATA_FIELDS[columnId]\n if (metadata) {\n const editable = options.isColumnEditable(columnId) && canEdit\n return standard(\n editable ? (\n <DebouncedInput\n value={metadata(doc)}\n onChange={(value) => options.onUpdateDocumentField(columnId, value)}\n multiline={true}\n placeholder={`Add ${getColumnLabel(columnId).toLowerCase()}…`}\n className={INPUT_CLASS}\n />\n ) : (\n <FieldValue>{metadata(doc) || 'N/A'}</FieldValue>\n )\n )\n }\n\n const readOnly = READ_ONLY_FIELDS[columnId]\n if (readOnly) return standard(readOnly(doc))\n\n if (columnId === 'created_by') return standard(<DocumentUser user={options.creator} />)\n\n if (columnId === 'folder') {\n return standard(\n canEdit ? (\n <FieldFolderSelect\n folder={doc.folder}\n picker={\n <FolderPicker\n documents={options.allDocuments ?? []}\n value={doc.folder}\n onSelect={(folder) => options.onUpdateDocumentField('folder', folder)}\n />\n }\n />\n ) : (\n <FieldFolderValue folder={doc.folder} />\n )\n )\n }\n\n if (columnId === 'related') {\n const related = options.relatedDocs\n if (!related) return null\n return standard(\n <RelatedDocuments\n doc={doc}\n related={related}\n onOpen={options.onOpenDocument}\n onDelete={options.onDeleteDocument}\n canDelete={options.canDeleteRelatedDocument}\n onCompare={options.onCompareDocuments}\n />\n )\n }\n\n if (columnId === 'all_tags') {\n // The labels (and issues), toggled in place.\n const labelTags = workspaceTags.filter(isLabelTag)\n const appliedIds = new Set(\n (doc.doctags ?? [])\n .filter((dt) => labelTags.some((t) => t.external_id === dt.tag_ext_id))\n .map((dt) => dt.tag_ext_id)\n )\n return standard(\n <LabelsCombobox\n labelTags={labelTags}\n appliedTagIds={appliedIds}\n onToggle={(tag) => options.onUpdateTagValue(tag, !appliedIds.has(tag.external_id))}\n onCreateAndApply={options.onCreateAndApplyLabel}\n />\n )\n }\n\n // An annotation (a label is a value of the Labels field, not a field of its own).\n const tag = workspaceTags.find((t) => t.external_id === columnId)\n if (!tag || !isAnnotationTag(tag)) return null\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n let value: ReactNode\n if (tag.tag_type.type === 'select') {\n value = (\n <FieldNativeSelect\n value={doctag?.note || ''}\n options={tag.tag_type.options}\n onChange={(next) => options.onUpdateTagValue(tag, next)}\n ariaLabel={tag.name}\n />\n )\n } else if (tag.tag_type.type === 'number') {\n value = (\n <DebouncedInput\n type=\"number\"\n value={doctag?.note || ''}\n onChange={(next) => options.onUpdateTagValue(tag, next)}\n placeholder={`Add ${tag.name.toLowerCase()}…`}\n className={INPUT_CLASS}\n />\n )\n } else {\n // A plain note: a value's citations come from generation and are kept as they are.\n value = (\n <Textarea\n value={doctag?.note || ''}\n onChange={(e) =>\n options.onUpdateTagWithCitations(tag, e.target.value, doctag?.citations ?? null)\n }\n placeholder=\"Add a note...\"\n rows={2}\n className={INPUT_CLASS}\n />\n )\n }\n\n return {\n label: tag.name,\n tag,\n children: doctag ? (\n <FieldWithAttribution attribution={<DocTagAttribution doctag={doctag} />}>\n {value}\n </FieldWithAttribution>\n ) : (\n value\n ),\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk2CSLFAGF_cjs = require('./chunk-2CSLFAGF.cjs');
4
+ var chunkGAMRVB3I_cjs = require('./chunk-GAMRVB3I.cjs');
5
5
  var react = require('react');
6
6
  var artifacts = require('@arbidocs/react/artifacts');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -115,7 +115,7 @@ function NativeDocxComparison({
115
115
  if (!documentId)
116
116
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
117
117
  return /* @__PURE__ */ jsxRuntime.jsx(
118
- chunk2CSLFAGF_cjs.NativeDocxEditor,
118
+ chunkGAMRVB3I_cjs.NativeDocxEditor,
119
119
  {
120
120
  adapter,
121
121
  documentId,
@@ -126,5 +126,5 @@ function NativeDocxComparison({
126
126
  }
127
127
 
128
128
  exports.NativeDocxComparison = NativeDocxComparison;
129
- //# sourceMappingURL=chunk-COD5ENHK.cjs.map
130
- //# sourceMappingURL=chunk-COD5ENHK.cjs.map
129
+ //# sourceMappingURL=chunk-PVJ5ODDB.cjs.map
130
+ //# sourceMappingURL=chunk-PVJ5ODDB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":";;;;;;;AA8BA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAOA,0BAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAUA,0BAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAQA,SAAS,aAAA,CACP,SAAA,EACA,MAAA,EACA,SAAA,EACmE;AACnE,EAAA,MAAM,IAAA,GAAO,CAAC,GAAA,KAAqC;AACjD,IAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAQ,GAAIA,0BAAgB,GAAG,CAAA;AAC9C,IAAA,IAAI,OAAA,EAAS,OAAO,EAAE,KAAA,EAAO,OAAA,EAAQ;AACrC,IAAA,MAAM,MAAM,SAAA,CAAU,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,gBAAgB,KAAK,CAAA;AACzD,IAAA,OAAO,MAAM,EAAE,KAAA,EAAO,SAAS,GAAA,CAAI,eAAA,IAAmB,GAA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CAAC,UAAA;AACH,IAAA,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEA,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"chunk-COD5ENHK.cjs","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\n/** A workspace document as the comparison needs it: its current version and what it was made from. */\nexport interface NativeDocxComparedDocument {\n external_id: string\n current_version?: number | null\n derived_from?: ReadonlyArray<{\n doc_ext_id: string\n role: string\n version?: number | null\n }> | null\n}\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n /** Called once for each redline the comparison saves as a new document (to add it to the lists). */\n onCompared?: (documentId: string) => void | Promise<void>\n /**\n * The workspace's documents, all of them (a redline may be on any page). The unedited redline\n * saved earlier from the same two versions is opened from here instead of saving another.\n */\n documents?: ReadonlyArray<NativeDocxComparedDocument>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\ninterface ComparedSide {\n docId: string\n version: number\n}\n\n/** The two versions compared. A plain id compares the document's current version (from the list). */\nfunction comparedSides(\n documents: ReadonlyArray<NativeDocxComparedDocument>,\n baseId: string,\n revisedId: string\n): { base: ComparedSide; revised: ComparedSide; key: string } | null {\n const side = (ref: string): ComparedSide | null => {\n const { docId, version } = parseVersionRef(ref)\n if (version) return { docId, version }\n const doc = documents.find((d) => d.external_id === docId)\n return doc ? { docId, version: doc.current_version ?? 1 } : null\n }\n const base = side(baseId)\n const revised = side(revisedId)\n if (!base || !revised) return null\n return {\n base,\n revised,\n key: `${base.docId}@v${base.version}>${revised.docId}@v${revised.version}`,\n }\n}\n\n/**\n * Redlines saved in this page's life, by the versions compared, with whether the lists have shown\n * them yet. One the lists never got (adding it failed) is reopened from here; one they showed and\n * no longer do was deleted.\n */\nconst savedThisSession = new Map<string, { id: string; listed: boolean }>()\n\n/**\n * The redline to reopen for these two versions: a document made from both (`redline_base` and\n * `redline_revised`, at the versions compared) that is still unedited (no version saved since it\n * was made, so it shows the real differences), else the one saved earlier in this page's life that\n * the lists never got. An edited or deleted one is not reopened: the comparison makes a fresh one.\n */\nfunction reusableRedline(\n documents: ReadonlyArray<NativeDocxComparedDocument>,\n sides: { base: ComparedSide; revised: ComparedSide; key: string }\n): string | undefined {\n const madeFrom = (doc: NativeDocxComparedDocument, role: string, from: ComparedSide) =>\n !!doc.derived_from?.some(\n (link) =>\n link.role === role && link.doc_ext_id === from.docId && link.version === from.version\n )\n const unedited = documents.find(\n (doc) =>\n (doc.current_version ?? 1) === 1 &&\n madeFrom(doc, 'redline_base', sides.base) &&\n madeFrom(doc, 'redline_revised', sides.revised)\n )\n if (unedited) return unedited.external_id\n const saved = savedThisSession.get(sides.key)\n if (!saved) return undefined\n // Listed now (yet not unedited) means edited; listed before and gone means deleted.\n if (saved.listed || documents.some((doc) => doc.external_id === saved.id)) {\n savedThisSession.delete(sides.key)\n return undefined\n }\n return saved.id\n}\n\n/** Note which redlines saved in this page's life the lists now show. */\nfunction noteListed(documents: ReadonlyArray<NativeDocxComparedDocument>): void {\n for (const saved of savedThisSession.values())\n if (!saved.listed && documents.some((doc) => doc.external_id === saved.id)) saved.listed = true\n}\n\n/**\n * Redlines being saved, by request. Another open of the same comparison meanwhile (React\n * StrictMode runs effects twice; reopening the viewer) waits for this one instead of saving a\n * second. Each is kept until its document has been added to the lists, where the next open finds it.\n */\nconst savingRedlines = new Map<string, Promise<string>>()\n\nfunction saveRedline(\n adapter: NativeDocxAdapter,\n query: string,\n sessionKey: string | undefined,\n onSaved: (documentId: string) => void | Promise<void>\n): Promise<string> {\n const saving = savingRedlines.get(query)\n if (saving) return saving\n const saved = adapter\n .request(`/redline?${query}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (sessionKey)\n savedThisSession.set(sessionKey, { id: result.document_ext_id, listed: false })\n return result.document_ext_id\n })\n savingRedlines.set(query, saved)\n void saved\n .then(\n (documentId) => Promise.resolve(onSaved(documentId)).catch(() => {}),\n () => {}\n )\n .finally(() => savingRedlines.delete(query))\n return saved\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n documents,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared, documents })\n host.current = { adapter, onCompared, documents }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n if (documents) noteListed(documents)\n }, [documents])\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n const listed = host.current.documents ?? []\n const sides = comparedSides(listed, baseId, revisedId)\n const saved = sides && reusableRedline(listed, sides)\n // The redline is a document of its own (the Word editor opens documents): reopen the unedited\n // one saved from these versions, else save it once, however often the comparison opens.\n void (\n saved\n ? Promise.resolve(saved)\n : saveRedline(\n host.current.adapter,\n String(redlineQuery(baseId, revisedId)),\n sides?.key,\n (id) => host.current.onCompared?.(id)\n )\n )\n .then((id) => {\n if (!cancelled) setDocumentId(id)\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":";;;;;;;AA8BA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAOA,0BAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAUA,0BAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAQA,SAAS,aAAA,CACP,SAAA,EACA,MAAA,EACA,SAAA,EACmE;AACnE,EAAA,MAAM,IAAA,GAAO,CAAC,GAAA,KAAqC;AACjD,IAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAQ,GAAIA,0BAAgB,GAAG,CAAA;AAC9C,IAAA,IAAI,OAAA,EAAS,OAAO,E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EAAM,CAAA;AAAA,sBACVA,cAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,UAAA,CAAW,CAAC,KAAA,KAAU,KAAA,GAAQ,CAAC,CAAA,EAAG,QAAA,EAAA,kBAAA,EAAgB;AAAA,KAAA,EAC3E,CAAA;AAEJ,EAAA,IAAI,CAAC,UAAA;AACH,IAAA,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEA,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"chunk-PVJ5ODDB.cjs","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\n/** A workspace document as the comparison needs it: its current version and what it was made from. */\nexport interface NativeDocxComparedDocument {\n external_id: string\n current_version?: number | null\n derived_from?: ReadonlyArray<{\n doc_ext_id: string\n role: string\n version?: number | null\n }> | null\n}\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n /** Called once for each redline the comparison saves as a new document (to add it to the lists). */\n onCompared?: (documentId: string) => void | Promise<void>\n /**\n * The workspace's documents, all of them (a redline may be on any page). The unedited redline\n * saved earlier from the same two versions is opened from here instead of saving another.\n */\n documents?: ReadonlyArray<NativeDocxComparedDocument>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\ninterface ComparedSide {\n docId: string\n version: number\n}\n\n/** The two versions compared. A plain id compares the document's current version (from the list). */\nfunction comparedSides(\n documents: ReadonlyArray<NativeDocxComparedDocument>,\n baseId: string,\n revisedId: string\n): { base: ComparedSide; revised: ComparedSide; key: string } | null {\n const side = (ref: string): ComparedSide | null => {\n const { docId, version } = parseVersionRef(ref)\n if (version) return { docId, version }\n const doc = documents.find((d) => d.external_id === docId)\n return doc ? { docId, version: doc.current_version ?? 1 } : null\n }\n const base = side(baseId)\n const revised = side(revisedId)\n if (!base || !revised) return null\n return {\n base,\n revised,\n key: `${base.docId}@v${base.version}>${revised.docId}@v${revised.version}`,\n }\n}\n\n/**\n * Redlines saved in this page's life, by the versions compared, with whether the lists have shown\n * them yet. One the lists never got (adding it failed) is reopened from here; one they showed and\n * no longer do was deleted.\n */\nconst savedThisSession = new Map<string, { id: string; listed: boolean }>()\n\n/**\n * The redline to reopen for these two versions: a document made from both (`redline_base` and\n * `redline_revised`, at the versions compared) that is still unedited (no version saved since it\n * was made, so it shows the real differences), else the one saved earlier in this page's life that\n * the lists never got. An edited or deleted one is not reopened: the comparison makes a fresh one.\n */\nfunction reusableRedline(\n documents: ReadonlyArray<NativeDocxComparedDocument>,\n sides: { base: ComparedSide; revised: ComparedSide; key: string }\n): string | undefined {\n const madeFrom = (doc: NativeDocxComparedDocument, role: string, from: ComparedSide) =>\n !!doc.derived_from?.some(\n (link) =>\n link.role === role && link.doc_ext_id === from.docId && link.version === from.version\n )\n const unedited = documents.find(\n (doc) =>\n (doc.current_version ?? 1) === 1 &&\n madeFrom(doc, 'redline_base', sides.base) &&\n madeFrom(doc, 'redline_revised', sides.revised)\n )\n if (unedited) return unedited.external_id\n const saved = savedThisSession.get(sides.key)\n if (!saved) return undefined\n // Listed now (yet not unedited) means edited; listed before and gone means deleted.\n if (saved.listed || documents.some((doc) => doc.external_id === saved.id)) {\n savedThisSession.delete(sides.key)\n return undefined\n }\n return saved.id\n}\n\n/** Note which redlines saved in this page's life the lists now show. */\nfunction noteListed(documents: ReadonlyArray<NativeDocxComparedDocument>): void {\n for (const saved of savedThisSession.values())\n if (!saved.listed && documents.some((doc) => doc.external_id === saved.id)) saved.listed = true\n}\n\n/**\n * Redlines being saved, by request. Another open of the same comparison meanwhile (React\n * StrictMode runs effects twice; reopening the viewer) waits for this one instead of saving a\n * second. Each is kept until its document has been added to the lists, where the next open finds it.\n */\nconst savingRedlines = new Map<string, Promise<string>>()\n\nfunction saveRedline(\n adapter: NativeDocxAdapter,\n query: string,\n sessionKey: string | undefined,\n onSaved: (documentId: string) => void | Promise<void>\n): Promise<string> {\n const saving = savingRedlines.get(query)\n if (saving) return saving\n const saved = adapter\n .request(`/redline?${query}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (sessionKey)\n savedThisSession.set(sessionKey, { id: result.document_ext_id, listed: false })\n return result.document_ext_id\n })\n savingRedlines.set(query, saved)\n void saved\n .then(\n (documentId) => Promise.resolve(onSaved(documentId)).catch(() => {}),\n () => {}\n )\n .finally(() => savingRedlines.delete(query))\n return saved\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n documents,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared, documents })\n host.current = { adapter, onCompared, documents }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n if (documents) noteListed(documents)\n }, [documents])\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n const listed = host.current.documents ?? []\n const sides = comparedSides(listed, baseId, revisedId)\n const saved = sides && reusableRedline(listed, sides)\n // The redline is a document of its own (the Word editor opens documents): reopen the unedited\n // one saved from these versions, else save it once, however often the comparison opens.\n void (\n saved\n ? Promise.resolve(saved)\n : saveRedline(\n host.current.adapter,\n String(redlineQuery(baseId, revisedId)),\n sides?.key,\n (id) => host.current.onCompared?.(id)\n )\n )\n .then((id) => {\n if (!cancelled) setDocumentId(id)\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
@@ -5,7 +5,7 @@ var chunk4ONPEVTP_cjs = require('./chunk-4ONPEVTP.cjs');
5
5
  var chunkV3KLUWQQ_cjs = require('./chunk-V3KLUWQQ.cjs');
6
6
  var chunkP5AQYC4D_cjs = require('./chunk-P5AQYC4D.cjs');
7
7
  var chunkWAV762GP_cjs = require('./chunk-WAV762GP.cjs');
8
- var chunkVKH3BEZE_cjs = require('./chunk-VKH3BEZE.cjs');
8
+ var chunkBLIO3B7Z_cjs = require('./chunk-BLIO3B7Z.cjs');
9
9
  var chunkJJZOL5MG_cjs = require('./chunk-JJZOL5MG.cjs');
10
10
  var chunk3YEXZX4H_cjs = require('./chunk-3YEXZX4H.cjs');
11
11
  var chunkVZOOGA47_cjs = require('./chunk-VZOOGA47.cjs');
@@ -14,8 +14,8 @@ var chunkJR2YSBD5_cjs = require('./chunk-JR2YSBD5.cjs');
14
14
  var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
15
15
  var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
16
16
  var chunkIPSHAMO2_cjs = require('./chunk-IPSHAMO2.cjs');
17
- var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
18
17
  var chunkLJJJ6CYH_cjs = require('./chunk-LJJJ6CYH.cjs');
18
+ var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
19
19
  var react$1 = require('react');
20
20
  var react = require('@arbidocs/react');
21
21
  var jsxRuntime = require('react/jsx-runtime');
@@ -354,7 +354,7 @@ function ConnectedNativeDocxEditor({
354
354
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [
355
355
  openFailed && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "text-muted-foreground border-b px-3 py-2 text-xs", children: "Co-editing isn't available for this document right now, so this is a read-only copy of the last saved version." }),
356
356
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
357
- chunkVKH3BEZE_cjs.NativeDocxEditor,
357
+ chunkBLIO3B7Z_cjs.NativeDocxEditor,
358
358
  {
359
359
  ...props,
360
360
  snapshot: props.snapshot || openFailed,
@@ -486,5 +486,5 @@ exports.useConnectedNativeDocxAdapter = useConnectedNativeDocxAdapter;
486
486
  exports.useConnectedWorkspaceRole = useConnectedWorkspaceRole;
487
487
  exports.useDocxCommentTarget = useDocxCommentTarget;
488
488
  exports.useNativeDocxSupport = useNativeDocxSupport;
489
- //# sourceMappingURL=chunk-7557LDAN.cjs.map
490
- //# sourceMappingURL=chunk-7557LDAN.cjs.map
489
+ //# sourceMappingURL=chunk-PWBRE7JA.cjs.map
490
+ //# sourceMappingURL=chunk-PWBRE7JA.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useConnectedWorkspace","useWorkspaceUsers","fmtDate","useBlocksEnvironment","useOpenWorkflow","useMemo","workflowSteps","useWorkflows","useConnectedConversations","useAgents","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useState","isScheduledWorkflow","useEffect","jsx","WorkflowsTable","workflowSignal","workflowTriggerType","toWorkflowFieldDocument","DocumentPicker","useArbi","useListedDocuments","useRef","buildDeepLinkUrl","parseDeepLinkPath","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","isCandidate","useRegisterOpenDocument","jsxs","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY,MAAM,IAAA;AAEjB,SAAS,oBAAA,GAA0C;AACxD,EAAA,OAAOA,yBAAA,GAAU,IAAA,IAAQ,UAAA;AAC3B;AAGO,SAAS,oBAAA,GAAyE;AACvF,EAAA,MAAM,SAAA,GAAY,oBAAA,EAAqB,CAAE,gBAAA,IAAoB,SAAA;AAC7D,EAAA,OAAO,SAAA,EAAU;AACnB;ACIO,SAAS,yBAAA,GAA4B;AAC1C,EAAA,MAAM,EAAE,WAAA,EAAa,IAAA,EAAM,MAAA,EAAQ,mBAAA,KAAwBC,uCAAA,EAAsB;AACjF,EAAA,MAAM,EAAE,MAAM,OAAA,GAAU,IAAG,GAAIC,uBAAA,CAAkB,eAAe,MAAA,EAAW;AAAA,IACzE,OAAA,EAAS,IAAA,IAAQ,CAAC,CAAC,WAAA;AAAA,IACnB,WAAA,EAAa;AAAA,GACd,CAAA;AACD,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,IAAA,CAAK,WAAA,KAAgB,MAAM,CAAA,EAAG,IAAA;AACjE,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,IAAA;AAAA;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mB;AAAA,UAC9C,IAAA,EAAM,KAAK,SAAA,CAAU;AAAA,YACnB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,aAAa,OAAA,CAAQ,WAAA;AAAA,YACrB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,eAAe,OAAA,CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,QAAA,MAAA,CAAO,sBAAsB,SAAS,CAAA;AACtC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG,MAAA;AAAA,MACrF,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,UAAA;AAAA,MACA,iBAAiB,OAAA,CAAQ,eAAA;AAAA,MACzB;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,IAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,kBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-7557LDAN.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n *\n * The host's catalogue (the host configuration's `workflows.catalogue`), when it has one, is listed\n * in its categories above the saved workflows: an entry opens in the builder (`onOpenTemplate`) or\n * runs (the environment's `openWorkflow(id, { view: 'run' })`). A filtered list (`filter`) is about\n * saved workflows only and leaves the catalogue out.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport type { WorkflowCatalogueRow } from '../agents/tasks/WorkflowCatalogueSections'\nimport {\n isScheduledWorkflow,\n workflowSignal,\n workflowTriggerType,\n} from '../agents/tasks/workflowRows'\nimport { workflowSteps } from '../agents/workflows/run'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useOpenWorkflow } from './workflows/useOpenWorkflow'\nimport { useHost } from '../provider/host'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n /** When a workflow that starts on a step signal starts (the default trigger text). */\n signalTrigger: (signal: string) => string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n signalTrigger: (signal) => `When a step signals ${signal}`,\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n | 'catalogue'\n | 'categories'\n | 'renderIcon'\n> {\n /**\n * Which saved workflows to list: `scheduled` (those that start on a date or a repeat), or a\n * predicate. Default: all.\n */\n filter?: 'scheduled' | ((workflow: WorkflowResponse) => boolean)\n /**\n * When a workflow starts, in the host's words. Default: the step signal it starts on, else its\n * trigger type.\n */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger,\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n onRunTemplate,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const openWorkflow = useOpenWorkflow()\n const host = useHost().workflows\n // A filtered list (the scheduled workflows) is about saved workflows only.\n const catalogueEntries = filter ? undefined : host?.catalogue\n const catalogue = useMemo(\n () =>\n catalogueEntries?.map(({ workflow, category, note, runnable }): WorkflowCatalogueRow => ({\n id: workflow.id,\n title: workflow.title,\n description: workflow.description,\n icon: workflow.icon,\n category,\n stepCount: workflowSteps(workflow).length,\n note,\n runnable,\n })),\n [catalogueEntries]\n )\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => {\n const keep = filter === 'scheduled' ? isScheduledWorkflow : filter\n return keep ? saved.filter(keep) : saved\n }, [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={\n describeTrigger ??\n ((w) => {\n const signal = workflowSignal(w)\n return signal ? l.signalTrigger(signal) : workflowTriggerType(w).replaceAll('_', ' ')\n })\n }\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={host?.renderIcon}\n onRunTemplate={onRunTemplate ?? (openWorkflow && ((id) => openWorkflow(id, { view: 'run' })))}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/content-path'\nimport type { HouseTemplate, HouseTemplateHost } from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n // The built-in template comes with the Word editor's template code: loaded on demand.\n return (await import('../../docx/template/HouseTemplate')).builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport type { NativeDocxAdapter, NativeDocxEditorProps } from '../../docx/NativeDocxEditor'\nimport { NativeDocxEditor } from '../../docx/lazy'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter' | 'compact'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn&apos;t available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => import('../../docx/fonts').then((m) => m.loadDocxFonts(fontBaseUrl)),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id, version) => {\n if (onDocumentsChanged) await onDocumentsChanged([id], 'version')\n if (version || !onDocumentsChanged) {\n const fresh = await refreshDocuments(queries, arbi, [id])\n if (\n version &&\n !fresh.some((doc) => doc.external_id === id && (doc.current_version ?? 0) >= version)\n ) {\n throw new Error(\n 'The version was saved, but its current status could not be confirmed. Please try again.'\n )\n }\n }\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useConnectedWorkspace","useWorkspaceUsers","fmtDate","useBlocksEnvironment","useOpenWorkflow","useMemo","workflowSteps","useWorkflows","useConnectedConversations","useAgents","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useState","isScheduledWorkflow","useEffect","jsx","WorkflowsTable","workflowSignal","workflowTriggerType","toWorkflowFieldDocument","DocumentPicker","useArbi","useListedDocuments","useRef","buildDeepLinkUrl","parseDeepLinkPath","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","isCandidate","useRegisterOpenDocument","jsxs","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY,MAAM,IAAA;AAEjB,SAAS,oBAAA,GAA0C;AACxD,EAAA,OAAOA,yBAAA,GAAU,IAAA,IAAQ,UAAA;AAC3B;AAGO,SAAS,oBAAA,GAAyE;AACvF,EAAA,MAAM,SAAA,GAAY,oBAAA,EAAqB,CAAE,gBAAA,IAAoB,SAAA;AAC7D,EAAA,OAAO,SAAA,EAAU;AACnB;ACIO,SAAS,yBAAA,GAA4B;AAC1C,EAAA,MAAM,EAAE,WAAA,EAAa,IAAA,EAAM,MAAA,EAAQ,mBAAA,KAAwBC,uCAAA,EAAsB;AACjF,EAAA,MAAM,EAAE,MAAM,OAAA,GAAU,IAAG,GAAIC,uBAAA,CAAkB,eAAe,MAAA,EAAW;AAAA,IACzE,OAAA,EAAS,IAAA,IAAQ,CAAC,CAAC,WAAA;AAAA,IACnB,WAAA,EAAa;AAAA,GACd,CAAA;AACD,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,IAAA,CAAK,WAAA,KAAgB,MAAM,CAAA,EAAG,IAAA;AACjE,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,IAAA;AAAA;AAAA,IAEA,aAAA,EAAe,IAAA,KAAS,OAAA,IAAW,IAAA,KAAS,cAAA;AAAA;AAAA,IAE5C,kBAAkB,IAAA,KAAS;AAAA,GAC7B;AACF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AAA,YACrB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,eAAe,OAAA,CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,QAAA,MAAA,CAAO,sBAAsB,SAAS,CAAA;AACtC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG,MAAA;AAAA,MACrF,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,UAAA;AAAA,MACA,iBAAiB,OAAA,CAAQ,eAAA;AAAA,MACzB;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,IAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,kBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-PWBRE7JA.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n *\n * The host's catalogue (the host configuration's `workflows.catalogue`), when it has one, is listed\n * in its categories above the saved workflows: an entry opens in the builder (`onOpenTemplate`) or\n * runs (the environment's `openWorkflow(id, { view: 'run' })`). A filtered list (`filter`) is about\n * saved workflows only and leaves the catalogue out.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport type { WorkflowCatalogueRow } from '../agents/tasks/WorkflowCatalogueSections'\nimport {\n isScheduledWorkflow,\n workflowSignal,\n workflowTriggerType,\n} from '../agents/tasks/workflowRows'\nimport { workflowSteps } from '../agents/workflows/run'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useOpenWorkflow } from './workflows/useOpenWorkflow'\nimport { useHost } from '../provider/host'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n /** When a workflow that starts on a step signal starts (the default trigger text). */\n signalTrigger: (signal: string) => string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n signalTrigger: (signal) => `When a step signals ${signal}`,\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n | 'catalogue'\n | 'categories'\n | 'renderIcon'\n> {\n /**\n * Which saved workflows to list: `scheduled` (those that start on a date or a repeat), or a\n * predicate. Default: all.\n */\n filter?: 'scheduled' | ((workflow: WorkflowResponse) => boolean)\n /**\n * When a workflow starts, in the host's words. Default: the step signal it starts on, else its\n * trigger type.\n */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger,\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n onRunTemplate,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const openWorkflow = useOpenWorkflow()\n const host = useHost().workflows\n // A filtered list (the scheduled workflows) is about saved workflows only.\n const catalogueEntries = filter ? undefined : host?.catalogue\n const catalogue = useMemo(\n () =>\n catalogueEntries?.map(({ workflow, category, note, runnable }): WorkflowCatalogueRow => ({\n id: workflow.id,\n title: workflow.title,\n description: workflow.description,\n icon: workflow.icon,\n category,\n stepCount: workflowSteps(workflow).length,\n note,\n runnable,\n })),\n [catalogueEntries]\n )\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => {\n const keep = filter === 'scheduled' ? isScheduledWorkflow : filter\n return keep ? saved.filter(keep) : saved\n }, [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={\n describeTrigger ??\n ((w) => {\n const signal = workflowSignal(w)\n return signal ? l.signalTrigger(signal) : workflowTriggerType(w).replaceAll('_', ' ')\n })\n }\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={host?.renderIcon}\n onRunTemplate={onRunTemplate ?? (openWorkflow && ((id) => openWorkflow(id, { view: 'run' })))}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/content-path'\nimport type { HouseTemplate, HouseTemplateHost } from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n // The built-in template comes with the Word editor's template code: loaded on demand.\n return (await import('../../docx/template/HouseTemplate')).builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport type { NativeDocxAdapter, NativeDocxEditorProps } from '../../docx/NativeDocxEditor'\nimport { NativeDocxEditor } from '../../docx/lazy'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter' | 'compact'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn&apos;t available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => import('../../docx/fonts').then((m) => m.loadDocxFonts(fontBaseUrl)),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id, version) => {\n if (onDocumentsChanged) await onDocumentsChanged([id], 'version')\n if (version || !onDocumentsChanged) {\n const fresh = await refreshDocuments(queries, arbi, [id])\n if (\n version &&\n !fresh.some((doc) => doc.external_id === id && (doc.current_version ?? 0) >= version)\n ) {\n throw new Error(\n 'The version was saved, but its current status could not be confirmed. Please try again.'\n )\n }\n }\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk5QERK4PK_cjs = require('./chunk-5QERK4PK.cjs');
4
+ var chunkAS6QZETU_cjs = require('./chunk-AS6QZETU.cjs');
5
5
  var react = require('@arbidocs/react');
6
6
  var ui = require('@arbidocs/react/ui');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -25,9 +25,9 @@ function DocumentUser({
25
25
  initials: `${user.given_name?.charAt(0) ?? ""}${user.family_name?.charAt(0) ?? ""}`
26
26
  }
27
27
  );
28
- return /* @__PURE__ */ jsxRuntime.jsx(chunk5QERK4PK_cjs.UserAvatar, { user, onOpen: openUser });
28
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkAS6QZETU_cjs.UserAvatar, { user, onOpen: openUser });
29
29
  }
30
30
 
31
31
  exports.DocumentUser = DocumentUser;
32
- //# sourceMappingURL=chunk-7PN3YENO.cjs.map
33
- //# sourceMappingURL=chunk-7PN3YENO.cjs.map
32
+ //# sourceMappingURL=chunk-QIK7E6VF.cjs.map
33
+ //# sourceMappingURL=chunk-QIK7E6VF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/files/fields/DocumentUser.tsx"],"names":["useDocumentsSupport","useDocumentHostActions","jsx","Fragment","UserEntity","getUserDisplayName","UserAvatar"],"mappings":";;;;;;;AAUO,SAAS,YAAA,CAAa;AAAA,EAC3B,IAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,OAAA,GAAU;AACZ,CAAA,EAMG;AACD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAIA,yBAAA,EAAoB;AAC3C,EAAA,MAAM,EAAE,QAAA,EAAS,GAAIC,4BAAA,EAAuB;AAC5C,EAAA,IAAI,IAAA,IAAQ,UAAA,EAAY,uBAAOC,cAAA,CAAAC,mBAAA,EAAA,EAAG,QAAA,EAAA,UAAA,CAAW,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,CAAA,EAAE,CAAA;AACzE,EAAA,IAAI,QAAQ,OAAA,KAAY,MAAA;AACtB,IAAA,uBACED,cAAA;AAAA,MAACE,aAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,IAAA;AAAA,QACL,OAAA,EAAQ,MAAA;AAAA,QACR,WAAA,EAAaC,sBAAmB,IAAI,CAAA;AAAA,QACpC,SAAS,IAAA,CAAK,OAAA;AAAA,QACd,QAAA,EAAU,CAAA,EAAG,IAAA,CAAK,UAAA,EAAY,OAAO,CAAC,CAAA,IAAK,EAAE,CAAA,EAAG,IAAA,CAAK,WAAA,EAAa,MAAA,CAAO,CAAC,KAAK,EAAE,CAAA;AAAA;AAAA,KACnF;AAEJ,EAAA,uBAAOH,cAAA,CAACI,4BAAA,EAAA,EAAW,IAAA,EAAY,MAAA,EAAQ,QAAA,EAAU,CAAA;AACnD","file":"chunk-7PN3YENO.cjs","sourcesContent":["/**\n * A person by a document or a field (who made a document, a field, a value): the host's own\n * rendering when it has one (`DocumentsSupport.renderUser`: presence, their card), else the kit's\n * avatar, which opens them when the host can.\n */\n\nimport { useDocumentHostActions, useDocumentsSupport, type DocumentPerson } from '@arbidocs/react'\nimport { UserEntity, getUserDisplayName } from '@arbidocs/react/ui'\nimport { UserAvatar } from '../grid/cells'\n\nexport function DocumentUser({\n user,\n tooltip = true,\n variant = 'icon',\n}: {\n user: DocumentPerson | undefined\n /** Whether hovering shows their card (the host's rendering). */\n tooltip?: boolean\n /** Their face alone (`icon`) or their face and name (`pill`). */\n variant?: 'icon' | 'pill'\n}) {\n const { renderUser } = useDocumentsSupport()\n const { openUser } = useDocumentHostActions()\n if (user && renderUser) return <>{renderUser(user, { tooltip, variant })}</>\n if (user && variant === 'pill')\n return (\n <UserEntity\n size=\"sm\"\n variant=\"pill\"\n displayName={getUserDisplayName(user)}\n picture={user.picture}\n initials={`${user.given_name?.charAt(0) ?? ''}${user.family_name?.charAt(0) ?? ''}`}\n />\n )\n return <UserAvatar user={user} onOpen={openUser} />\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/files/fields/DocumentUser.tsx"],"names":["useDocumentsSupport","useDocumentHostActions","jsx","Fragment","UserEntity","getUserDisplayName","UserAvatar"],"mappings":";;;;;;;AAUO,SAAS,YAAA,CAAa;AAAA,EAC3B,IAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,OAAA,GAAU;AACZ,CAAA,EAMG;AACD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAIA,yBAAA,EAAoB;AAC3C,EAAA,MAAM,EAAE,QAAA,EAAS,GAAIC,4BAAA,EAAuB;AAC5C,EAAA,IAAI,IAAA,IAAQ,UAAA,EAAY,uBAAOC,cAAA,CAAAC,mBAAA,EAAA,EAAG,QAAA,EAAA,UAAA,CAAW,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,CAAA,EAAE,CAAA;AACzE,EAAA,IAAI,QAAQ,OAAA,KAAY,MAAA;AACtB,IAAA,uBACED,cAAA;AAAA,MAACE,aAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,IAAA;AAAA,QACL,OAAA,EAAQ,MAAA;AAAA,QACR,WAAA,EAAaC,sBAAmB,IAAI,CAAA;AAAA,QACpC,SAAS,IAAA,CAAK,OAAA;AAAA,QACd,QAAA,EAAU,CAAA,EAAG,IAAA,CAAK,UAAA,EAAY,OAAO,CAAC,CAAA,IAAK,EAAE,CAAA,EAAG,IAAA,CAAK,WAAA,EAAa,MAAA,CAAO,CAAC,KAAK,EAAE,CAAA;AAAA;AAAA,KACnF;AAEJ,EAAA,uBAAOH,cAAA,CAACI,4BAAA,EAAA,EAAW,IAAA,EAAY,MAAA,EAAQ,QAAA,EAAU,CAAA;AACnD","file":"chunk-QIK7E6VF.cjs","sourcesContent":["/**\n * A person by a document or a field (who made a document, a field, a value): the host's own\n * rendering when it has one (`DocumentsSupport.renderUser`: presence, their card), else the kit's\n * avatar, which opens them when the host can.\n */\n\nimport { useDocumentHostActions, useDocumentsSupport, type DocumentPerson } from '@arbidocs/react'\nimport { UserEntity, getUserDisplayName } from '@arbidocs/react/ui'\nimport { UserAvatar } from '../grid/cells'\n\nexport function DocumentUser({\n user,\n tooltip = true,\n variant = 'icon',\n}: {\n user: DocumentPerson | undefined\n /** Whether hovering shows their card (the host's rendering). */\n tooltip?: boolean\n /** Their face alone (`icon`) or their face and name (`pill`). */\n variant?: 'icon' | 'pill'\n}) {\n const { renderUser } = useDocumentsSupport()\n const { openUser } = useDocumentHostActions()\n if (user && renderUser) return <>{renderUser(user, { tooltip, variant })}</>\n if (user && variant === 'pill')\n return (\n <UserEntity\n size=\"sm\"\n variant=\"pill\"\n displayName={getUserDisplayName(user)}\n picture={user.picture}\n initials={`${user.given_name?.charAt(0) ?? ''}${user.family_name?.charAt(0) ?? ''}`}\n />\n )\n return <UserAvatar user={user} onOpen={openUser} />\n}\n"]}