@arbidocs/blocks 0.4.146 → 0.4.150

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 (357) hide show
  1. package/dist/ConnectedNativeDocxComparison-3XQSINPQ.cjs +44 -0
  2. package/dist/ConnectedNativeDocxComparison-3XQSINPQ.cjs.map +1 -0
  3. package/dist/ConnectedNativeDocxComparison-XQSXVGHR.js +35 -0
  4. package/dist/ConnectedNativeDocxComparison-XQSXVGHR.js.map +1 -0
  5. package/dist/ConnectedNativeDocxEditor-IPEZDERL.js +33 -0
  6. package/dist/ConnectedNativeDocxEditor-IPEZDERL.js.map +1 -0
  7. package/dist/ConnectedNativeDocxEditor-OUWFMIPH.cjs +46 -0
  8. package/dist/ConnectedNativeDocxEditor-OUWFMIPH.cjs.map +1 -0
  9. package/dist/ConnectedStreamedWordArtifact-D5LSMDO4.cjs +44 -0
  10. package/dist/ConnectedStreamedWordArtifact-D5LSMDO4.cjs.map +1 -0
  11. package/dist/ConnectedStreamedWordArtifact-UZVNBKQB.js +35 -0
  12. package/dist/ConnectedStreamedWordArtifact-UZVNBKQB.js.map +1 -0
  13. package/dist/FactTextEditor-YESAU2IJ.js +25 -0
  14. package/dist/FactTextEditor-YESAU2IJ.js.map +1 -0
  15. package/dist/FactTextEditor-YUPBCTXK.cjs +27 -0
  16. package/dist/FactTextEditor-YUPBCTXK.cjs.map +1 -0
  17. package/dist/{NativeDocxEditor-BE2OEOTJ.cjs → NativeDocxEditor-5VBNM5I7.cjs} +8 -8
  18. package/dist/{NativeDocxEditor-BE2OEOTJ.cjs.map → NativeDocxEditor-5VBNM5I7.cjs.map} +1 -1
  19. package/dist/{NativeDocxEditor-KOPFMRYW.js → NativeDocxEditor-XT5ZLFGU.js} +4 -4
  20. package/dist/{NativeDocxEditor-KOPFMRYW.js.map → NativeDocxEditor-XT5ZLFGU.js.map} +1 -1
  21. package/dist/agents/index.cjs +265 -266
  22. package/dist/agents/index.js +8 -9
  23. package/dist/calendar/index.cjs +117 -125
  24. package/dist/calendar/index.d.ts +0 -1
  25. package/dist/calendar/index.js +1 -1
  26. package/dist/calls/index.cjs +3 -3
  27. package/dist/calls/index.js +2 -2
  28. package/dist/chat/index.cjs +78 -78
  29. package/dist/chat/index.js +3 -3
  30. package/dist/{chunk-2FL7QJKJ.js → chunk-265GOG4W.js} +3 -3
  31. package/dist/{chunk-2FL7QJKJ.js.map → chunk-265GOG4W.js.map} +1 -1
  32. package/dist/{chunk-IJST4EBM.js → chunk-3E2F4AHD.js} +8 -8
  33. package/dist/{chunk-IJST4EBM.js.map → chunk-3E2F4AHD.js.map} +1 -1
  34. package/dist/chunk-3FSXWVHW.cjs +5184 -0
  35. package/dist/chunk-3FSXWVHW.cjs.map +1 -0
  36. package/dist/{chunk-LPYEUD2D.cjs → chunk-4JNKXOFZ.cjs} +3 -3
  37. package/dist/{chunk-LPYEUD2D.cjs.map → chunk-4JNKXOFZ.cjs.map} +1 -1
  38. package/dist/{chunk-ODRHHWHY.cjs → chunk-4KMLM3GY.cjs} +4 -4
  39. package/dist/chunk-4KMLM3GY.cjs.map +1 -0
  40. package/dist/{chunk-MHFF5N65.cjs → chunk-757OYF6G.cjs} +4 -38
  41. package/dist/chunk-757OYF6G.cjs.map +1 -0
  42. package/dist/chunk-AXTDDWMR.js +16 -0
  43. package/dist/chunk-AXTDDWMR.js.map +1 -0
  44. package/dist/{chunk-B3AHCIV5.js → chunk-BJ24VPOA.js} +4 -55
  45. package/dist/chunk-BJ24VPOA.js.map +1 -0
  46. package/dist/chunk-C7PTF6BQ.cjs +172 -0
  47. package/dist/chunk-C7PTF6BQ.cjs.map +1 -0
  48. package/dist/{chunk-T5B7FM7S.js → chunk-COA3S3CZ.js} +3 -3
  49. package/dist/{chunk-T5B7FM7S.js.map → chunk-COA3S3CZ.js.map} +1 -1
  50. package/dist/{chunk-C44TDH54.js → chunk-CQPFW64W.js} +5 -5
  51. package/dist/{chunk-C44TDH54.js.map → chunk-CQPFW64W.js.map} +1 -1
  52. package/dist/chunk-D3WFIFRY.cjs +659 -0
  53. package/dist/chunk-D3WFIFRY.cjs.map +1 -0
  54. package/dist/{chunk-QXMR5YHC.js → chunk-DIB4JYUY.js} +19 -3
  55. package/dist/chunk-DIB4JYUY.js.map +1 -0
  56. package/dist/chunk-DVB5ZKOF.js +22 -0
  57. package/dist/chunk-DVB5ZKOF.js.map +1 -0
  58. package/dist/{chunk-VHJHY7TT.js → chunk-ECERC6TI.js} +3 -3
  59. package/dist/{chunk-VHJHY7TT.js.map → chunk-ECERC6TI.js.map} +1 -1
  60. package/dist/chunk-EDV7CYG6.cjs +18 -0
  61. package/dist/chunk-EDV7CYG6.cjs.map +1 -0
  62. package/dist/chunk-FAXXN7KI.cjs +213 -0
  63. package/dist/chunk-FAXXN7KI.cjs.map +1 -0
  64. package/dist/{chunk-2MJWWPHY.js → chunk-G4IYES7G.js} +140 -15
  65. package/dist/chunk-G4IYES7G.js.map +1 -0
  66. package/dist/{chunk-MFMASSEO.cjs → chunk-GGTUMLCT.cjs} +93 -91
  67. package/dist/chunk-GGTUMLCT.cjs.map +1 -0
  68. package/dist/{chunk-QI6AIHWP.cjs → chunk-GOWXP5KT.cjs} +145 -14
  69. package/dist/chunk-GOWXP5KT.cjs.map +1 -0
  70. package/dist/{chunk-O6IEZDRC.cjs → chunk-GRGS5M6O.cjs} +181 -3
  71. package/dist/chunk-GRGS5M6O.cjs.map +1 -0
  72. package/dist/{chunk-A6IU4GIW.js → chunk-HGLC566X.js} +598 -13
  73. package/dist/chunk-HGLC566X.js.map +1 -0
  74. package/dist/{chunk-O2GW5IY6.cjs → chunk-ILM42LE6.cjs} +33 -33
  75. package/dist/{chunk-O2GW5IY6.cjs.map → chunk-ILM42LE6.cjs.map} +1 -1
  76. package/dist/{chunk-C3CGJK7A.cjs → chunk-IPQ5MJ4Z.cjs} +636 -31
  77. package/dist/chunk-IPQ5MJ4Z.cjs.map +1 -0
  78. package/dist/{chunk-NRFAWUVD.js → chunk-JAANWQGB.js} +157 -157
  79. package/dist/chunk-JAANWQGB.js.map +1 -0
  80. package/dist/{chunk-7RJTEWYM.js → chunk-JGOST4IL.js} +350 -64
  81. package/dist/chunk-JGOST4IL.js.map +1 -0
  82. package/dist/chunk-KHXEIEXN.js +41 -0
  83. package/dist/chunk-KHXEIEXN.js.map +1 -0
  84. package/dist/chunk-KLPRAQCE.cjs +22 -0
  85. package/dist/chunk-KLPRAQCE.cjs.map +1 -0
  86. package/dist/chunk-KQYPP72K.js +644 -0
  87. package/dist/chunk-KQYPP72K.js.map +1 -0
  88. package/dist/chunk-KUT2Y7JF.cjs +43 -0
  89. package/dist/chunk-KUT2Y7JF.cjs.map +1 -0
  90. package/dist/{chunk-6YTHQ73P.cjs → chunk-LLYZGH3L.cjs} +3 -56
  91. package/dist/chunk-LLYZGH3L.cjs.map +1 -0
  92. package/dist/{chunk-YSHIC4NJ.cjs → chunk-LXTOOUEN.cjs} +159 -154
  93. package/dist/chunk-LXTOOUEN.cjs.map +1 -0
  94. package/dist/{chunk-EVUEIBNU.js → chunk-M4S75AEJ.js} +44 -5
  95. package/dist/chunk-M4S75AEJ.js.map +1 -0
  96. package/dist/{chunk-V5OAXIBN.cjs → chunk-NPR5BGFF.cjs} +11 -11
  97. package/dist/{chunk-V5OAXIBN.cjs.map → chunk-NPR5BGFF.cjs.map} +1 -1
  98. package/dist/{chunk-PLJ7PHWU.cjs → chunk-NS7NVX4E.cjs} +3 -3
  99. package/dist/{chunk-PLJ7PHWU.cjs.map → chunk-NS7NVX4E.cjs.map} +1 -1
  100. package/dist/{chunk-RB7GX2VT.cjs → chunk-NWNAYXC7.cjs} +9 -9
  101. package/dist/{chunk-RB7GX2VT.cjs.map → chunk-NWNAYXC7.cjs.map} +1 -1
  102. package/dist/chunk-Q6N6MZKO.js +5004 -0
  103. package/dist/chunk-Q6N6MZKO.js.map +1 -0
  104. package/dist/{chunk-I2QSDQQV.cjs → chunk-QT3A4PFC.cjs} +21 -2
  105. package/dist/chunk-QT3A4PFC.cjs.map +1 -0
  106. package/dist/{chunk-6HCJ3ZEU.js → chunk-R6VCPDPF.js} +178 -6
  107. package/dist/chunk-R6VCPDPF.js.map +1 -0
  108. package/dist/{chunk-ZM26YEOT.js → chunk-RY2SODRN.js} +3 -3
  109. package/dist/{chunk-ZM26YEOT.js.map → chunk-RY2SODRN.js.map} +1 -1
  110. package/dist/chunk-SDOEHEJP.js +208 -0
  111. package/dist/chunk-SDOEHEJP.js.map +1 -0
  112. package/dist/{chunk-DETZZBG2.cjs → chunk-SIB6C7P7.cjs} +43 -2
  113. package/dist/chunk-SIB6C7P7.cjs.map +1 -0
  114. package/dist/{chunk-OPTBQSCV.cjs → chunk-SMN32BQ3.cjs} +4 -183
  115. package/dist/chunk-SMN32BQ3.cjs.map +1 -0
  116. package/dist/chunk-TAWPVD6C.cjs +1956 -0
  117. package/dist/chunk-TAWPVD6C.cjs.map +1 -0
  118. package/dist/chunk-TC25LGIM.js +6584 -0
  119. package/dist/chunk-TC25LGIM.js.map +1 -0
  120. package/dist/{chunk-OBWYM25Y.js → chunk-TL45OJQE.js} +85 -83
  121. package/dist/chunk-TL45OJQE.js.map +1 -0
  122. package/dist/{chunk-AOSUHWIL.js → chunk-TZOQKV64.js} +4 -37
  123. package/dist/chunk-TZOQKV64.js.map +1 -0
  124. package/dist/chunk-UTVY63DG.js +16 -0
  125. package/dist/chunk-UTVY63DG.js.map +1 -0
  126. package/dist/chunk-V4YZXGXR.cjs +6751 -0
  127. package/dist/chunk-V4YZXGXR.cjs.map +1 -0
  128. package/dist/chunk-XRWHFMHK.js +19 -0
  129. package/dist/chunk-XRWHFMHK.js.map +1 -0
  130. package/dist/{chunk-O4YPVYPO.cjs → chunk-YAEXSCUW.cjs} +364 -60
  131. package/dist/chunk-YAEXSCUW.cjs.map +1 -0
  132. package/dist/chunk-YIFCLNII.cjs +18 -0
  133. package/dist/chunk-YIFCLNII.cjs.map +1 -0
  134. package/dist/chunk-Z27QMJ6S.cjs +25 -0
  135. package/dist/chunk-Z27QMJ6S.cjs.map +1 -0
  136. package/dist/{chunk-CSI2B2H5.js → chunk-Z4NQ3TED.js} +4 -4
  137. package/dist/chunk-Z4NQ3TED.js.map +1 -0
  138. package/dist/{chunk-DWZXSPMB.cjs → chunk-ZAVEMQ37.cjs} +3 -3
  139. package/dist/{chunk-DWZXSPMB.cjs.map → chunk-ZAVEMQ37.cjs.map} +1 -1
  140. package/dist/{chunk-FUTMU4FR.js → chunk-ZLEYLCE4.js} +8 -181
  141. package/dist/chunk-ZLEYLCE4.js.map +1 -0
  142. package/dist/chunk-ZNLTEZEF.js +170 -0
  143. package/dist/chunk-ZNLTEZEF.js.map +1 -0
  144. package/dist/chunk-ZO7PJMCO.js +1907 -0
  145. package/dist/chunk-ZO7PJMCO.js.map +1 -0
  146. package/dist/citations/index.cjs +14 -14
  147. package/dist/citations/index.js +2 -2
  148. package/dist/collaboration/index.cjs +74 -74
  149. package/dist/collaboration/index.js +3 -3
  150. package/dist/connect/docx.cjs +23 -28
  151. package/dist/connect/docx.cjs.map +1 -1
  152. package/dist/connect/docx.js +12 -28
  153. package/dist/connect/docx.js.map +1 -1
  154. package/dist/connect/index.cjs +8799 -2057
  155. package/dist/connect/index.cjs.map +1 -1
  156. package/dist/connect/index.d.ts +11 -2
  157. package/dist/connect/index.js +8578 -1884
  158. package/dist/connect/index.js.map +1 -1
  159. package/dist/connect/viewer.cjs +1229 -0
  160. package/dist/connect/viewer.cjs.map +1 -0
  161. package/dist/connect/viewer.d.ts +8 -0
  162. package/dist/connect/viewer.js +1226 -0
  163. package/dist/connect/viewer.js.map +1 -0
  164. package/dist/connection/ConnectedWorkflowsTable.d.ts +2 -12
  165. package/dist/connection/ai.d.ts +2 -9
  166. package/dist/connection/billing/AddAddonDialog.d.ts +24 -0
  167. package/dist/connection/billing/BillingCard.d.ts +18 -0
  168. package/dist/connection/billing/BillingProjectEntity.d.ts +9 -0
  169. package/dist/connection/billing/ChangePlanDialog.d.ts +20 -0
  170. package/dist/connection/billing/ChangeProPlan.d.ts +20 -0
  171. package/dist/connection/billing/CheckoutTotal.d.ts +12 -0
  172. package/dist/connection/billing/DailyCapEditor.d.ts +4 -0
  173. package/dist/connection/billing/InvoicesModal.d.ts +6 -0
  174. package/dist/connection/billing/NewProjectFlow.d.ts +14 -0
  175. package/dist/connection/billing/PlanChangeLines.d.ts +13 -0
  176. package/dist/connection/billing/PlanSelector.d.ts +50 -0
  177. package/dist/connection/billing/ProjectBilling.d.ts +24 -0
  178. package/dist/connection/billing/ProjectDetail.d.ts +16 -0
  179. package/dist/connection/billing/ProjectUsageCard.d.ts +21 -0
  180. package/dist/connection/billing/ProjectUsageContent.d.ts +18 -0
  181. package/dist/connection/billing/ProjectsTable.d.ts +13 -0
  182. package/dist/connection/billing/ReduceAddonDialog.d.ts +18 -0
  183. package/dist/connection/billing/ReferralReward.d.ts +32 -0
  184. package/dist/connection/billing/SharedProjects.d.ts +13 -0
  185. package/dist/connection/billing/StripeCheckoutModal.d.ts +32 -0
  186. package/dist/connection/billing/SubscriptionPlans.d.ts +15 -0
  187. package/dist/connection/billing/SubscriptionStatus.d.ts +10 -0
  188. package/dist/connection/billing/addon-pricing.d.ts +97 -0
  189. package/dist/connection/billing/api-error.d.ts +6 -0
  190. package/dist/connection/billing/billing-country.d.ts +14 -0
  191. package/dist/connection/billing/billing-focus.d.ts +11 -0
  192. package/dist/connection/billing/index.d.ts +22 -0
  193. package/dist/connection/billing/plan-badge.d.ts +15 -0
  194. package/dist/connection/billing/plan-change-outcome.d.ts +15 -0
  195. package/dist/connection/billing/plan-constants.d.ts +29 -0
  196. package/dist/connection/billing/plan-pricing.d.ts +67 -0
  197. package/dist/connection/billing/quota-items.d.ts +33 -0
  198. package/dist/connection/billing/referral-reward.d.ts +28 -0
  199. package/dist/connection/billing/refusal-copy.d.ts +5 -0
  200. package/dist/connection/billing/reward-balance.d.ts +19 -0
  201. package/dist/connection/billing/support.d.ts +35 -0
  202. package/dist/connection/billing/tax-quote.d.ts +36 -0
  203. package/dist/connection/billing/useAddonPurchase.d.ts +32 -0
  204. package/dist/connection/billing/useAutoRefreshPendingProjects.d.ts +11 -0
  205. package/dist/connection/billing/useCheckoutQuote.d.ts +30 -0
  206. package/dist/connection/billing/useOpenBillingPortal.d.ts +12 -0
  207. package/dist/connection/calendar/CalendarSettingsDialog.d.ts +1 -1
  208. package/dist/connection/connectors/ConnectedAppsSettings.d.ts +24 -0
  209. package/dist/connection/connectors/ConnectedDriveSyncDialog.d.ts +12 -0
  210. package/dist/connection/connectors/ConnectedMailboxSyncDialog.d.ts +12 -0
  211. package/dist/connection/connectors/index.d.ts +4 -0
  212. package/dist/connection/connectors/sync-labels.d.ts +21 -0
  213. package/dist/connection/facts/ConnectedFactsPage.d.ts +50 -0
  214. package/dist/connection/facts/FactMarkdownEditor.d.ts +57 -0
  215. package/dist/connection/facts/FactSourcesPopover.d.ts +38 -0
  216. package/dist/connection/facts/FactTextEditor.d.ts +2 -0
  217. package/dist/connection/facts/factNouns.d.ts +4 -0
  218. package/dist/connection/facts/factPageColumns.d.ts +37 -0
  219. package/dist/connection/facts/types.d.ts +127 -0
  220. package/dist/connection/facts/useFactActions.d.ts +10 -0
  221. package/dist/connection/facts/useFactComposer.d.ts +54 -0
  222. package/dist/connection/facts/useFactFilters.d.ts +101 -0
  223. package/dist/connection/facts/useFactSelection.d.ts +82 -0
  224. package/dist/connection/facts/useFactsGrid.d.ts +87 -0
  225. package/dist/connection/facts/useFactsPageView.d.ts +4 -0
  226. package/dist/connection/mail/ConnectedMailComposer.d.ts +3 -1
  227. package/dist/connection/mail/ConnectedMailbox.d.ts +4 -2
  228. package/dist/connection/mail/MailComposerForm.d.ts +4 -2
  229. package/dist/connection/mail/MailRecipientInput.d.ts +14 -0
  230. package/dist/connection/mail/index.d.ts +1 -1
  231. package/dist/connection/mail/types.d.ts +10 -0
  232. package/dist/connection/search/ConnectedSearchPage.d.ts +64 -0
  233. package/dist/connection/search/SearchResultRows.d.ts +38 -0
  234. package/dist/connection/search/index.d.ts +2 -0
  235. package/dist/connection/settings-page/ConnectedSettingsPage.d.ts +4 -0
  236. package/dist/connection/settings-page/index.d.ts +1 -1
  237. package/dist/connection/tags/ConnectedTagTable.d.ts +108 -0
  238. package/dist/connection/tags/ConnectedTagsPage.d.ts +55 -0
  239. package/dist/connection/tags/DocTagPassages.d.ts +25 -0
  240. package/dist/connection/tags/GlossaryExport.d.ts +7 -0
  241. package/dist/connection/tags/TagCombineFilter.d.ts +14 -0
  242. package/dist/connection/tags/TagPlacement.d.ts +16 -0
  243. package/dist/connection/tags/TagsPageSections.d.ts +36 -0
  244. package/dist/connection/tags/tagCombine.d.ts +55 -0
  245. package/dist/connection/useConnectedWorkNotifications.d.ts +7 -24
  246. package/dist/connection/viewer/ConnectedDocumentToolsProvider.d.ts +11 -0
  247. package/dist/connection/viewer/ConnectedDocumentViewer.d.ts +21 -0
  248. package/dist/connection/viewer/FinaliseTranslationButton.d.ts +15 -0
  249. package/dist/connection/viewer/ViewerPdfPane.d.ts +46 -0
  250. package/dist/connection/viewer/support.d.ts +79 -0
  251. package/dist/connection/viewer/useImageCrop.d.ts +13 -0
  252. package/dist/connection/viewer/useViewedDocument.d.ts +70 -0
  253. package/dist/connection/viewer/useViewerBlobs.d.ts +15 -0
  254. package/dist/connection/viewer/useViewerTabs.d.ts +18 -0
  255. package/dist/connection/viewer/useViewerVersions.d.ts +11 -0
  256. package/dist/connection/workspace-settings/useConnectedWorkspaceSettings.d.ts +6 -0
  257. package/dist/document-tools/index.cjs +59 -652
  258. package/dist/document-tools/index.cjs.map +1 -1
  259. package/dist/document-tools/index.js +2 -641
  260. package/dist/document-tools/index.js.map +1 -1
  261. package/dist/docx/index.cjs +48 -47
  262. package/dist/docx/index.js +4 -3
  263. package/dist/facts/FactsBulkBar.d.ts +6 -3
  264. package/dist/facts/cited-version-ref.d.ts +1 -0
  265. package/dist/facts/index.cjs +206 -1942
  266. package/dist/facts/index.cjs.map +1 -1
  267. package/dist/facts/index.d.ts +1 -0
  268. package/dist/facts/index.js +15 -1897
  269. package/dist/facts/index.js.map +1 -1
  270. package/dist/files/ViewerChrome.d.ts +5 -4
  271. package/dist/files/ViewerControlBar.d.ts +12 -0
  272. package/dist/files/doc-labels.d.ts +35 -0
  273. package/dist/files/grid/FilterButton.d.ts +12 -0
  274. package/dist/files/grid/RowDensityControl.d.ts +18 -0
  275. package/dist/files/grid/row-density.d.ts +27 -0
  276. package/dist/files/index.cjs +779 -7100
  277. package/dist/files/index.cjs.map +1 -1
  278. package/dist/files/index.d.ts +5 -0
  279. package/dist/files/index.js +14 -6919
  280. package/dist/files/index.js.map +1 -1
  281. package/dist/home/index.cjs +2 -2
  282. package/dist/home/index.js +2 -2
  283. package/dist/index.cjs +1043 -1259
  284. package/dist/index.cjs.map +1 -1
  285. package/dist/index.js +27 -360
  286. package/dist/index.js.map +1 -1
  287. package/dist/retrieval/SearchSnippet.d.ts +6 -0
  288. package/dist/retrieval/index.cjs +75 -42
  289. package/dist/retrieval/index.d.ts +2 -0
  290. package/dist/retrieval/index.js +3 -2
  291. package/dist/retrieval/search-results.d.ts +46 -0
  292. package/dist/settings/Billing.d.ts +0 -66
  293. package/dist/settings/PlanBadge.d.ts +1 -1
  294. package/dist/settings/SubscriptionParts.d.ts +1 -50
  295. package/dist/settings/index.cjs +501 -3714
  296. package/dist/settings/index.cjs.map +1 -1
  297. package/dist/settings/index.d.ts +3 -2
  298. package/dist/settings/index.js +10 -3527
  299. package/dist/settings/index.js.map +1 -1
  300. package/dist/settings/inverted-index-filter.d.ts +26 -0
  301. package/dist/shell/index.cjs +2 -2
  302. package/dist/shell/index.js +2 -2
  303. package/dist/site/index.cjs +5 -5
  304. package/dist/site/index.js +1 -1
  305. package/dist/studio/index.cjs +6 -6
  306. package/dist/studio/index.js +5 -5
  307. package/dist/tags/definitions.d.ts +10 -0
  308. package/dist/tags/index.d.ts +4 -1
  309. package/dist/tags/page/ExtractEntitiesDialog.d.ts +24 -0
  310. package/dist/tags/page/TagPicker.d.ts +16 -0
  311. package/dist/tags/page/tagsPageLabels.d.ts +36 -0
  312. package/dist/workflow-canvas/index.cjs +21 -22
  313. package/dist/workflow-canvas/index.cjs.map +1 -1
  314. package/dist/workflow-canvas/index.js +8 -9
  315. package/dist/workflow-canvas/index.js.map +1 -1
  316. package/node_modules/@arbidocs/coedit/package.json +1 -1
  317. package/package.json +13 -4
  318. package/dist/calendar/access-setup.d.ts +0 -8
  319. package/dist/chunk-2MJWWPHY.js.map +0 -1
  320. package/dist/chunk-3AFWGEDJ.cjs +0 -53
  321. package/dist/chunk-3AFWGEDJ.cjs.map +0 -1
  322. package/dist/chunk-5YHEHEJT.js +0 -1667
  323. package/dist/chunk-5YHEHEJT.js.map +0 -1
  324. package/dist/chunk-6HCJ3ZEU.js.map +0 -1
  325. package/dist/chunk-6YTHQ73P.cjs.map +0 -1
  326. package/dist/chunk-7RJTEWYM.js.map +0 -1
  327. package/dist/chunk-A6IU4GIW.js.map +0 -1
  328. package/dist/chunk-AOSUHWIL.js.map +0 -1
  329. package/dist/chunk-B3AHCIV5.js.map +0 -1
  330. package/dist/chunk-C3CGJK7A.cjs.map +0 -1
  331. package/dist/chunk-CSI2B2H5.js.map +0 -1
  332. package/dist/chunk-DETZZBG2.cjs.map +0 -1
  333. package/dist/chunk-EVUEIBNU.js.map +0 -1
  334. package/dist/chunk-FUTMU4FR.js.map +0 -1
  335. package/dist/chunk-I2QSDQQV.cjs.map +0 -1
  336. package/dist/chunk-J5CWKFSC.js +0 -170
  337. package/dist/chunk-J5CWKFSC.js.map +0 -1
  338. package/dist/chunk-MFMASSEO.cjs.map +0 -1
  339. package/dist/chunk-MHFF5N65.cjs.map +0 -1
  340. package/dist/chunk-NRFAWUVD.js.map +0 -1
  341. package/dist/chunk-O4YPVYPO.cjs.map +0 -1
  342. package/dist/chunk-O6IEZDRC.cjs.map +0 -1
  343. package/dist/chunk-OBWYM25Y.js.map +0 -1
  344. package/dist/chunk-ODRHHWHY.cjs.map +0 -1
  345. package/dist/chunk-OPTBQSCV.cjs.map +0 -1
  346. package/dist/chunk-QI6AIHWP.cjs.map +0 -1
  347. package/dist/chunk-QXMR5YHC.js.map +0 -1
  348. package/dist/chunk-RFXJYIDV.js +0 -50
  349. package/dist/chunk-RFXJYIDV.js.map +0 -1
  350. package/dist/chunk-U73KPFYH.cjs +0 -1717
  351. package/dist/chunk-U73KPFYH.cjs.map +0 -1
  352. package/dist/chunk-XVUOMWMD.cjs +0 -177
  353. package/dist/chunk-XVUOMWMD.cjs.map +0 -1
  354. package/dist/chunk-YSHIC4NJ.cjs.map +0 -1
  355. package/dist/connection/ConnectedTagTable.d.ts +0 -32
  356. package/dist/connection/calendar/CopyField.d.ts +0 -9
  357. package/dist/connection/calendar/OpenAccessPanel.d.ts +0 -7
@@ -0,0 +1,1956 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunk2WLXQGWC_cjs = require('./chunk-2WLXQGWC.cjs');
5
+ var chunkVPPX5XUF_cjs = require('./chunk-VPPX5XUF.cjs');
6
+ var chunkRC25WMVB_cjs = require('./chunk-RC25WMVB.cjs');
7
+ var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
8
+ var chunk2EI7NCUA_cjs = require('./chunk-2EI7NCUA.cjs');
9
+ var chunk7RGLTF76_cjs = require('./chunk-7RGLTF76.cjs');
10
+ var chunkBIXHB4LV_cjs = require('./chunk-BIXHB4LV.cjs');
11
+ var chunkPPCATBOY_cjs = require('./chunk-PPCATBOY.cjs');
12
+ var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
13
+ var lucideReact = require('lucide-react');
14
+ var jsxRuntime = require('react/jsx-runtime');
15
+ var artifacts = require('@arbidocs/react/artifacts');
16
+ var ui = require('@arbidocs/react/ui');
17
+ var react = require('react');
18
+
19
+ var DEFAULT_FACT_SOURCE_GROUP_LABELS = {
20
+ remove: "Remove this document",
21
+ wholeDocument: "Whole document \u2014 open it to cite specific passages"
22
+ };
23
+ function FactSourceGroup({
24
+ docId,
25
+ document: document2,
26
+ isViewing,
27
+ onRemove,
28
+ children,
29
+ hasPassages,
30
+ labels,
31
+ testIds
32
+ }) {
33
+ const l = { ...DEFAULT_FACT_SOURCE_GROUP_LABELS, ...labels };
34
+ return /* @__PURE__ */ jsxRuntime.jsxs(
35
+ "div",
36
+ {
37
+ className: "flex flex-col gap-1",
38
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.root?.(docId), { testId: `citation-doc-${docId}` }),
39
+ "data-viewing": isViewing || void 0,
40
+ "data-slot": "fact-source-group",
41
+ children: [
42
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 px-1 text-sm", children: [
43
+ document2,
44
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1" }),
45
+ onRemove && /* @__PURE__ */ jsxRuntime.jsx(
46
+ "button",
47
+ {
48
+ type: "button",
49
+ onClick: onRemove,
50
+ "aria-label": l.remove,
51
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.remove?.(docId), {
52
+ testId: `fact-source-remove-${docId}`
53
+ }),
54
+ className: "shrink-0 rounded p-0.5 hover:bg-destructive/20 hover:text-destructive pointer-coarse:p-3",
55
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3" })
56
+ }
57
+ )
58
+ ] }),
59
+ hasPassages ? children : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2 text-xs text-muted-foreground", children: l.wholeDocument })
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ function toFactCitations(citations) {
65
+ if (!citations) return null;
66
+ return citations.map((d) => ({
67
+ doc_ext_id: d.doc_ext_id,
68
+ ...d.version ? { version: d.version } : {},
69
+ chunks: d.chunks ?? []
70
+ }));
71
+ }
72
+ function isWholeDoc(doc) {
73
+ return doc.chunks.length === 0;
74
+ }
75
+ function docIdsOf(citations) {
76
+ return (citations ?? []).map((d) => d.doc_ext_id);
77
+ }
78
+ function chunkIdsOf(citations) {
79
+ return (citations ?? []).flatMap((d) => d.chunks.map((c) => c.chunk_id));
80
+ }
81
+ function hasChunk(citations, chunkId) {
82
+ return (citations ?? []).some((d) => d.chunks.some((c) => c.chunk_id === chunkId));
83
+ }
84
+ function withDoc(citations, docExtId) {
85
+ const list = citations ?? [];
86
+ if (list.some((d) => d.doc_ext_id === docExtId)) return list;
87
+ return [...list, { doc_ext_id: docExtId, chunks: [] }];
88
+ }
89
+ function withoutDoc(citations, docExtId) {
90
+ const remaining = (citations ?? []).filter((d) => d.doc_ext_id !== docExtId);
91
+ return remaining.length ? remaining : null;
92
+ }
93
+ function withChunk(citations, docExtId, chunk) {
94
+ const list = citations ?? [];
95
+ const idx = list.findIndex((d) => d.doc_ext_id === docExtId);
96
+ if (idx === -1) return [...list, { doc_ext_id: docExtId, chunks: [chunk] }];
97
+ const doc = list[idx];
98
+ if (doc.chunks.some((c) => c.chunk_id === chunk.chunk_id)) return list;
99
+ const next = [...list];
100
+ next[idx] = { ...doc, chunks: [...doc.chunks, chunk] };
101
+ return next;
102
+ }
103
+ function withoutChunk(citations, chunkId, opts = {}) {
104
+ const keepDoc = opts.keepDoc ?? true;
105
+ const list = citations ?? [];
106
+ if (!hasChunk(list, chunkId)) return citations ?? null;
107
+ const next = [];
108
+ for (const doc of list) {
109
+ if (!doc.chunks.some((c) => c.chunk_id === chunkId)) {
110
+ next.push(doc);
111
+ continue;
112
+ }
113
+ const chunks = doc.chunks.filter((c) => c.chunk_id !== chunkId);
114
+ if (chunks.length || keepDoc) next.push({ ...doc, chunks });
115
+ }
116
+ return next.length ? next : null;
117
+ }
118
+ function repairBoldFlanking(md) {
119
+ return md.replace(/([.,;:!?"'’”)\]])(\*\*|__)(?=[A-Za-z0-9])/g, "$1$2 ");
120
+ }
121
+ var CHAT_LEAD_IN = /^(?:here(?:'s| is| are)|below (?:is|are)|sure|certainly)\b[^\n]*:[ \t]*(?:\n+|$)/i;
122
+ function dropChatLeadIn(md) {
123
+ const body = md.replace(CHAT_LEAD_IN, "");
124
+ return body.trim() ? body : md;
125
+ }
126
+ function buildFactCitations(content, activeCitations, citationData) {
127
+ const text = dropChatLeadIn(repairBoldFlanking(artifacts.unwrapCitationLinks(content)).trim()).trim();
128
+ if (!activeCitations) return { text, citations: null };
129
+ const chunkMeta = /* @__PURE__ */ new Map();
130
+ for (const chunks of Object.values(citationData)) {
131
+ if (!Array.isArray(chunks)) continue;
132
+ for (const chunk of chunks) {
133
+ const meta = {
134
+ doc_ext_id: chunk.metadata?.doc_ext_id ?? null,
135
+ page: chunk.metadata?.page_number ?? null
136
+ };
137
+ for (const key of [chunk.metadata?.chunk_ext_id, chunk.chunk_id]) {
138
+ if (key && !chunkMeta.has(key)) chunkMeta.set(key, meta);
139
+ }
140
+ }
141
+ }
142
+ let citations = null;
143
+ for (const chunkIds of Object.values(activeCitations)) {
144
+ for (const chunkId of chunkIds) {
145
+ const meta = chunkMeta.get(chunkId);
146
+ if (!meta?.doc_ext_id) continue;
147
+ citations = withChunk(citations, meta.doc_ext_id, { chunk_id: chunkId, page: meta.page });
148
+ }
149
+ }
150
+ return { text, citations };
151
+ }
152
+ function citedVersionRef(docId, version, currentVersion) {
153
+ if (!version) return docId;
154
+ return currentVersion != null && currentVersion === version ? docId : artifacts.versionRef(docId, version);
155
+ }
156
+ var DEFAULT_FACT_COMPOSER_LABELS = {
157
+ shared: "Shared",
158
+ verified: "Verified",
159
+ dates: "Dates",
160
+ deleteFact: "Delete fact",
161
+ cancel: "Cancel",
162
+ saveFact: "Save fact",
163
+ saving: "Saving\u2026",
164
+ addFact: "Add fact",
165
+ adding: "Adding\u2026"
166
+ };
167
+ var DEFAULT_FACT_SOURCES_ROW_LABELS = {
168
+ sources: "Sources",
169
+ hintButton: "How to add sources",
170
+ hint: "In the picker, tick a document's checkbox to add it as a source, or click its name to just open it. Inside a document, click a passage to add it \u2014 shift-click to take a whole range. Add as many as you like, from as many documents as you like."
171
+ };
172
+ function FactFieldRow({
173
+ label,
174
+ children,
175
+ className
176
+ }) {
177
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col gap-1.5", className), "data-slot": "fact-field-row", children: [
178
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
179
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", children })
180
+ ] });
181
+ }
182
+ function FactSourcesRow({ toggle, picker, labels, hintTestId }) {
183
+ const l = { ...DEFAULT_FACT_SOURCES_ROW_LABELS, ...labels };
184
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", "data-slot": "fact-sources-row", children: [
185
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 text-sm font-medium text-foreground", children: [
186
+ l.sources,
187
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
188
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
189
+ "button",
190
+ {
191
+ type: "button",
192
+ "aria-label": l.hintButton,
193
+ className: "text-muted-foreground hover:text-foreground",
194
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(hintTestId, { testId: "facts-source-hint" }),
195
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "size-3.5" })
196
+ }
197
+ ) }),
198
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { className: "max-w-xs", children: l.hint })
199
+ ] })
200
+ ] }),
201
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
202
+ toggle,
203
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: picker })
204
+ ] })
205
+ ] });
206
+ }
207
+ function FactComposer({
208
+ isOpen,
209
+ panelRef,
210
+ editor,
211
+ labels,
212
+ sharedToggle,
213
+ verifiedToggle,
214
+ dateInput,
215
+ isEditing,
216
+ canSave,
217
+ isSaving,
218
+ isDeleting,
219
+ onSave,
220
+ onCancel,
221
+ onDelete,
222
+ error,
223
+ uiLabels: labelOverrides,
224
+ testIds
225
+ }) {
226
+ const l = { ...DEFAULT_FACT_COMPOSER_LABELS, ...labelOverrides };
227
+ return /* @__PURE__ */ jsxRuntime.jsx(
228
+ "div",
229
+ {
230
+ className: ui.cn(
231
+ "grid shrink-0 transition-[grid-template-rows,opacity] duration-500 ease-in-out",
232
+ isOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
233
+ ),
234
+ "data-slot": "fact-composer",
235
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(
236
+ "div",
237
+ {
238
+ ref: panelRef,
239
+ className: "facts-composer flex flex-col gap-4 border-b border-border bg-muted px-4 py-4",
240
+ children: [
241
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
242
+ editor,
243
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2", children: [
245
+ /* @__PURE__ */ jsxRuntime.jsx(
246
+ "div",
247
+ {
248
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.tags, { testId: "facts-page-composer-tags" }),
249
+ className: "min-w-[14rem] flex-1",
250
+ children: labels
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-6", children: [
254
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-foreground", children: [
255
+ sharedToggle,
256
+ l.shared
257
+ ] }),
258
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-foreground", children: [
259
+ verifiedToggle,
260
+ l.verified
261
+ ] })
262
+ ] })
263
+ ] }),
264
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2", children: [
265
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-[10rem] flex-1 flex-col gap-1.5", children: [
266
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: l.dates }),
267
+ dateInput
268
+ ] }),
269
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-2 self-end max-sm:w-full max-sm:justify-end", children: [
270
+ isEditing && /* @__PURE__ */ jsxRuntime.jsx(
271
+ ui.Button,
272
+ {
273
+ variant: "ghost",
274
+ size: "sm",
275
+ className: "size-7 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive pointer-coarse:size-11",
276
+ onClick: onDelete,
277
+ disabled: isDeleting,
278
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.delete, {
279
+ testId: "facts-page-composer-delete"
280
+ }),
281
+ "aria-label": l.deleteFact,
282
+ title: l.deleteFact,
283
+ children: isDeleting ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-3.5" })
284
+ }
285
+ ),
286
+ /* @__PURE__ */ jsxRuntime.jsx(
287
+ ui.Button,
288
+ {
289
+ variant: "ghost",
290
+ size: "sm",
291
+ className: "h-7 pointer-coarse:h-11",
292
+ onClick: onCancel,
293
+ children: l.cancel
294
+ }
295
+ ),
296
+ /* @__PURE__ */ jsxRuntime.jsx(
297
+ ui.Button,
298
+ {
299
+ size: "sm",
300
+ className: "h-7 pointer-coarse:h-11",
301
+ disabled: !canSave,
302
+ onClick: onSave,
303
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.save, { testId: "facts-page-composer-save" }),
304
+ children: isEditing ? isSaving ? l.saving : l.saveFact : isSaving ? l.adding : l.addFact
305
+ }
306
+ )
307
+ ] })
308
+ ] })
309
+ ] })
310
+ ] }),
311
+ error && /* @__PURE__ */ jsxRuntime.jsx(
312
+ "p",
313
+ {
314
+ className: "text-xs text-destructive",
315
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.error, { testId: "facts-page-composer-error" }),
316
+ children: error
317
+ }
318
+ )
319
+ ]
320
+ }
321
+ ) })
322
+ }
323
+ );
324
+ }
325
+
326
+ // src/facts/fact-date.ts
327
+ var EMPTY_FACT_DATE_FIELDS = {
328
+ date: "",
329
+ time: "",
330
+ timezone: "",
331
+ endDate: "",
332
+ endTime: ""
333
+ };
334
+ function isMidnightUtc(d) {
335
+ return d.getUTCHours() === 0 && d.getUTCMinutes() === 0 && d.getUTCSeconds() === 0;
336
+ }
337
+ function isEndOfDayUtc(d) {
338
+ return d.getUTCHours() === 23 && d.getUTCMinutes() === 59;
339
+ }
340
+ function dayKeyUtc(d) {
341
+ return d.toISOString().slice(0, 10);
342
+ }
343
+ function safeTimeZone(tz) {
344
+ try {
345
+ new Intl.DateTimeFormat("en-US", { timeZone: tz });
346
+ return tz;
347
+ } catch {
348
+ return "UTC";
349
+ }
350
+ }
351
+ function isoToZonedParts(iso, timeZone) {
352
+ const d = new Date(iso);
353
+ const parts = Object.fromEntries(
354
+ new Intl.DateTimeFormat("en-US", {
355
+ timeZone: safeTimeZone(timeZone),
356
+ hourCycle: "h23",
357
+ year: "numeric",
358
+ month: "2-digit",
359
+ day: "2-digit",
360
+ hour: "2-digit",
361
+ minute: "2-digit"
362
+ }).formatToParts(d).map((p) => [p.type, p.value])
363
+ );
364
+ return {
365
+ date: `${parts.year}-${parts.month}-${parts.day}`,
366
+ time: `${parts.hour}:${parts.minute}`
367
+ };
368
+ }
369
+ function zonedPartsToIso(date, time, timeZone) {
370
+ const tz = safeTimeZone(timeZone);
371
+ const guess = /* @__PURE__ */ new Date(`${date}T${time}:00Z`);
372
+ const zoned = isoToZonedParts(guess.toISOString(), tz);
373
+ const [y, m, dd] = zoned.date.split("-").map(Number);
374
+ const [hh, mi] = zoned.time.split(":").map(Number);
375
+ const asIfUtc = Date.UTC(y, m - 1, dd, hh, mi);
376
+ const offsetMs = asIfUtc - guess.getTime();
377
+ return new Date(guess.getTime() - offsetMs).toISOString();
378
+ }
379
+ function factDateSpanToFields(dateStart, dateEnd, timezone) {
380
+ if (!dateStart) return EMPTY_FACT_DATE_FIELDS;
381
+ const start = new Date(dateStart);
382
+ if (Number.isNaN(start.getTime())) return EMPTY_FACT_DATE_FIELDS;
383
+ const end = dateEnd ? new Date(dateEnd) : start;
384
+ const dateOnly = isMidnightUtc(start) && (!dateEnd || isEndOfDayUtc(end));
385
+ if (dateOnly) {
386
+ const startKey = dayKeyUtc(start);
387
+ const endKey = dateEnd ? dayKeyUtc(end) : startKey;
388
+ return { ...EMPTY_FACT_DATE_FIELDS, date: startKey, endDate: endKey !== startKey ? endKey : "" };
389
+ }
390
+ const tz = timezone || "UTC";
391
+ const startParts = isoToZonedParts(dateStart, tz);
392
+ const isInstant = !dateEnd || dateStart === dateEnd;
393
+ const endParts = isInstant ? null : isoToZonedParts(dateEnd, tz);
394
+ return {
395
+ date: startParts.date,
396
+ time: startParts.time,
397
+ timezone: tz,
398
+ endDate: endParts?.date ?? "",
399
+ endTime: endParts?.time ?? ""
400
+ };
401
+ }
402
+ function factDateFieldsToSpan(fields) {
403
+ if (!fields.date) return { date: null, date_end: null, timezone: null };
404
+ const tz = fields.timezone || chunkBIXHB4LV_cjs.detectTimeZone();
405
+ const startIso = fields.time ? zonedPartsToIso(fields.date, fields.time, tz) : `${fields.date}T00:00:00.000Z`;
406
+ let endIso;
407
+ if (fields.endDate) {
408
+ endIso = fields.time && fields.endTime ? zonedPartsToIso(fields.endDate, fields.endTime, tz) : `${fields.endDate}T23:59:59.000Z`;
409
+ } else {
410
+ endIso = fields.time ? startIso : `${fields.date}T23:59:59.000Z`;
411
+ }
412
+ return { date: startIso, date_end: endIso, timezone: fields.time ? tz : null };
413
+ }
414
+ var DEFAULT_FACT_DATE_INPUT_LABELS = {
415
+ weekdays: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
416
+ months: [
417
+ "January",
418
+ "February",
419
+ "March",
420
+ "April",
421
+ "May",
422
+ "June",
423
+ "July",
424
+ "August",
425
+ "September",
426
+ "October",
427
+ "November",
428
+ "December"
429
+ ],
430
+ previousMonth: "Previous month",
431
+ earlierYears: "Earlier years",
432
+ nextMonth: "Next month",
433
+ laterYears: "Later years",
434
+ pickYear: "Pick a year",
435
+ addDate: "Add a date",
436
+ startTime: "Start time",
437
+ endTime: "End time",
438
+ setStartFirst: "Set a start time first",
439
+ timezone: "Timezone",
440
+ endDate: "End date (optional)",
441
+ clearDate: "Clear date"
442
+ };
443
+ function dayKey(year, monthIndex, day) {
444
+ const m = String(monthIndex + 1).padStart(2, "0");
445
+ const d = String(day).padStart(2, "0");
446
+ return `${year}-${m}-${d}`;
447
+ }
448
+ function prettyDay(iso) {
449
+ const [y, m, d] = iso.split("-").map(Number);
450
+ if (!y || !m || !d) return iso;
451
+ return new Date(Date.UTC(y, m - 1, d)).toLocaleDateString(void 0, {
452
+ year: "numeric",
453
+ month: "short",
454
+ day: "numeric",
455
+ timeZone: "UTC"
456
+ });
457
+ }
458
+ function summarizeWithTimes(v) {
459
+ const start = `${prettyDay(v.date)}, ${v.time}`;
460
+ const endDay = v.endDate || v.date;
461
+ if (v.endTime) return `${start} \u2013 ${prettyDay(endDay)}, ${v.endTime}`;
462
+ if (v.endDate && v.endDate !== v.date) return `${start} \u2013 ${prettyDay(v.endDate)}`;
463
+ return start;
464
+ }
465
+ function MonthCalendar({
466
+ selected,
467
+ onSelect,
468
+ labels: l,
469
+ testIds
470
+ }) {
471
+ const now = /* @__PURE__ */ new Date();
472
+ const todayKey = dayKey(now.getFullYear(), now.getMonth(), now.getDate());
473
+ const initial = react.useMemo(() => {
474
+ if (selected) {
475
+ const [y, m] = selected.split("-").map(Number);
476
+ if (y && m) return { year: y, monthIndex: m - 1 };
477
+ }
478
+ return { year: now.getFullYear(), monthIndex: now.getMonth() };
479
+ }, []);
480
+ const [view, setView] = react.useState(initial);
481
+ const [mode, setMode] = react.useState("days");
482
+ const [yearStart, setYearStart] = react.useState(initial.year - 5);
483
+ const firstWeekday = new Date(view.year, view.monthIndex, 1).getDay();
484
+ const daysInMonth = new Date(view.year, view.monthIndex + 1, 0).getDate();
485
+ const cells = [
486
+ ...Array.from({ length: firstWeekday }, () => null),
487
+ ...Array.from({ length: daysInMonth }, (_, i) => i + 1)
488
+ ];
489
+ const step = (delta) => {
490
+ const next = view.monthIndex + delta;
491
+ setView({
492
+ year: view.year + Math.floor(next / 12),
493
+ monthIndex: (next % 12 + 12) % 12
494
+ });
495
+ };
496
+ const openYears = () => {
497
+ setYearStart(view.year - 5);
498
+ setMode("years");
499
+ };
500
+ const pickYear = (year) => {
501
+ setView((v) => ({ ...v, year }));
502
+ setMode("days");
503
+ };
504
+ const years = Array.from({ length: 12 }, (_, i) => yearStart + i);
505
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[248px]", children: [
506
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-1 pb-2", children: [
507
+ /* @__PURE__ */ jsxRuntime.jsx(
508
+ "button",
509
+ {
510
+ type: "button",
511
+ onClick: () => mode === "days" ? step(-1) : setYearStart((s) => s - 12),
512
+ className: "rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground pointer-coarse:p-3",
513
+ "aria-label": mode === "days" ? l.previousMonth : l.earlierYears,
514
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" })
515
+ }
516
+ ),
517
+ mode === "days" ? /* @__PURE__ */ jsxRuntime.jsxs(
518
+ "button",
519
+ {
520
+ type: "button",
521
+ onClick: openYears,
522
+ className: "rounded px-1.5 py-0.5 text-sm font-medium hover:bg-accent hover:text-foreground",
523
+ "aria-label": l.pickYear,
524
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.caption, { testId: "fact-calendar-caption" }),
525
+ children: [
526
+ l.months[view.monthIndex],
527
+ " ",
528
+ view.year
529
+ ]
530
+ }
531
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium", children: [
532
+ yearStart,
533
+ " \u2013 ",
534
+ yearStart + 11
535
+ ] }),
536
+ /* @__PURE__ */ jsxRuntime.jsx(
537
+ "button",
538
+ {
539
+ type: "button",
540
+ onClick: () => mode === "days" ? step(1) : setYearStart((s) => s + 12),
541
+ className: "rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground pointer-coarse:p-3",
542
+ "aria-label": mode === "days" ? l.nextMonth : l.laterYears,
543
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4" })
544
+ }
545
+ )
546
+ ] }),
547
+ mode === "days" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-7 gap-0.5", children: [
548
+ l.weekdays.map((w) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-center text-xs font-medium text-muted-foreground", children: w }, w)),
549
+ cells.map((day, i) => {
550
+ if (day === null) return /* @__PURE__ */ jsxRuntime.jsx("div", {}, `blank-${i}`);
551
+ const key = dayKey(view.year, view.monthIndex, day);
552
+ const isSelected = key === selected;
553
+ const isToday = key === todayKey;
554
+ return /* @__PURE__ */ jsxRuntime.jsx(
555
+ "button",
556
+ {
557
+ type: "button",
558
+ onClick: () => onSelect(key),
559
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.day?.(key), { testId: `fact-calendar-day-${key}` }),
560
+ className: ui.cn(
561
+ "h-8 rounded text-xs transition-colors hover:bg-accent pointer-coarse:h-11",
562
+ isSelected && "bg-primary text-primary-foreground hover:bg-primary",
563
+ !isSelected && isToday && "ring-1 ring-inset ring-primary/50"
564
+ ),
565
+ children: day
566
+ },
567
+ key
568
+ );
569
+ })
570
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: years.map((y) => /* @__PURE__ */ jsxRuntime.jsx(
571
+ "button",
572
+ {
573
+ type: "button",
574
+ onClick: () => pickYear(y),
575
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.year?.(y), { testId: `fact-calendar-year-${y}` }),
576
+ className: ui.cn(
577
+ "h-9 rounded text-xs transition-colors hover:bg-accent pointer-coarse:h-11",
578
+ y === view.year && "bg-primary text-primary-foreground hover:bg-primary"
579
+ ),
580
+ children: y
581
+ },
582
+ y
583
+ )) })
584
+ ] });
585
+ }
586
+ function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
587
+ const l = { ...DEFAULT_FACT_DATE_INPUT_LABELS, ...labels };
588
+ const [open, setOpen] = react.useState(false);
589
+ const timezones = react.useMemo(() => chunkBIXHB4LV_cjs.listTimeZones(), []);
590
+ const timezoneListId = `${idPrefix}-timezone-options`;
591
+ const span = factDateFieldsToSpan(value);
592
+ const summary = value.time || value.endTime ? summarizeWithTimes(value) : chunkVPPX5XUF_cjs.formatSpan(span.date, span.date_end, span.timezone);
593
+ const setDate = (dateKey) => onChange({ ...value, date: dateKey, endDate: value.endDate && dateKey ? value.endDate : "" });
594
+ const setStartTime = (time) => onChange({
595
+ ...value,
596
+ time,
597
+ timezone: time ? value.timezone || chunkBIXHB4LV_cjs.detectTimeZone() : "",
598
+ endTime: time ? value.endTime : ""
599
+ });
600
+ const setEndTime = (endTime) => onChange({
601
+ ...value,
602
+ endTime,
603
+ endDate: endTime ? value.endDate || value.date : value.endDate
604
+ });
605
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1.5", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open, onOpenChange: setOpen, children: [
606
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
607
+ "button",
608
+ {
609
+ type: "button",
610
+ className: ui.cn(
611
+ "inline-flex h-9 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
612
+ !summary && "text-muted-foreground"
613
+ ),
614
+ "data-testid": `${idPrefix}-date-trigger`,
615
+ children: [
616
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { className: "size-4 shrink-0 text-muted-foreground" }),
617
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: summary || l.addDate })
618
+ ]
619
+ }
620
+ ) }),
621
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.PopoverContent, { className: "w-auto p-3", align: "start", children: [
622
+ /* @__PURE__ */ jsxRuntime.jsx(MonthCalendar, { selected: value.date, onSelect: setDate, labels: l, testIds }),
623
+ value.date && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex flex-col gap-2 border-t border-border pt-3", children: [
624
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
625
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex flex-col gap-1", children: [
626
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: l.startTime }),
627
+ /* @__PURE__ */ jsxRuntime.jsx(
628
+ ui.Input,
629
+ {
630
+ type: "time",
631
+ value: value.time,
632
+ onChange: (e) => setStartTime(e.target.value),
633
+ className: "h-8 text-xs",
634
+ "data-testid": `${idPrefix}-time`
635
+ }
636
+ )
637
+ ] }),
638
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex flex-col gap-1", children: [
639
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: l.endTime }),
640
+ /* @__PURE__ */ jsxRuntime.jsx(
641
+ ui.Input,
642
+ {
643
+ type: "time",
644
+ value: value.endTime,
645
+ onChange: (e) => setEndTime(e.target.value),
646
+ disabled: !value.time,
647
+ title: value.time ? void 0 : l.setStartFirst,
648
+ className: "h-8 text-xs",
649
+ "data-testid": `${idPrefix}-end-time`
650
+ }
651
+ )
652
+ ] })
653
+ ] }),
654
+ value.time && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex flex-col gap-1", children: [
655
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: l.timezone }),
656
+ /* @__PURE__ */ jsxRuntime.jsx(
657
+ ui.Input,
658
+ {
659
+ list: timezoneListId,
660
+ value: value.timezone,
661
+ onChange: (e) => onChange({ ...value, timezone: e.target.value }),
662
+ placeholder: chunkBIXHB4LV_cjs.detectTimeZone(),
663
+ className: "h-8 text-xs",
664
+ "data-testid": `${idPrefix}-timezone`
665
+ }
666
+ ),
667
+ /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: timezoneListId, children: timezones.map((tz) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: tz }, tz)) })
668
+ ] }),
669
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex flex-col gap-1", children: [
670
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: l.endDate }),
671
+ /* @__PURE__ */ jsxRuntime.jsx(
672
+ ui.Input,
673
+ {
674
+ type: "date",
675
+ value: value.endDate,
676
+ min: value.date,
677
+ onChange: (e) => onChange({ ...value, endDate: e.target.value }),
678
+ className: "h-8 text-xs",
679
+ "data-testid": `${idPrefix}-end-date`
680
+ }
681
+ )
682
+ ] }),
683
+ /* @__PURE__ */ jsxRuntime.jsxs(
684
+ ui.Button,
685
+ {
686
+ type: "button",
687
+ variant: "ghost",
688
+ size: "sm",
689
+ className: "h-7 self-start text-muted-foreground hover:text-foreground",
690
+ onClick: () => onChange(EMPTY_FACT_DATE_FIELDS),
691
+ "data-testid": `${idPrefix}-clear-date`,
692
+ children: [
693
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "mr-1 size-3.5" }),
694
+ " ",
695
+ l.clearDate
696
+ ]
697
+ }
698
+ )
699
+ ] })
700
+ ] })
701
+ ] }) });
702
+ }
703
+ var DEFAULT_FACTS_BULK_BAR_LABELS = {
704
+ removeFromChat: "Remove from Chat",
705
+ addToChat: "Add to Chat",
706
+ label: "Label",
707
+ shared: "Shared",
708
+ more: "More",
709
+ export: "Export",
710
+ delete: "Delete",
711
+ budgetHint: "Facts added to this chat are always in ARBI's context for this chat, so they share one budget. This estimates the tokens they add (\u22484 characters per token), capped at ~2,000.",
712
+ budget: (tokens, cap) => `~${tokens}/${cap} tokens`,
713
+ removeFromChatTooltip: (n) => `Remove the selected ${n} from this chat`,
714
+ addToChatTooltip: (n) => `Add the selected ${n} to this chat, so they are always in its context`,
715
+ labelTooltip: (n) => `Add or remove labels from selected ${n}`
716
+ };
717
+ function FactsBulkBar({
718
+ count,
719
+ onClear,
720
+ allSelectedInChat,
721
+ onToggleInChat,
722
+ onLabel,
723
+ sharedToggle,
724
+ onExport,
725
+ onDelete,
726
+ budget,
727
+ pluralNoun = "facts",
728
+ labels,
729
+ testIds
730
+ }) {
731
+ const l = { ...DEFAULT_FACTS_BULK_BAR_LABELS, ...labels };
732
+ const none = count === 0;
733
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3", "data-slot": "facts-bulk-bar", children: /* @__PURE__ */ jsxRuntime.jsx(
734
+ chunkV4ISCZJ7_cjs.SelectionBar,
735
+ {
736
+ count,
737
+ onClear,
738
+ status: budget ? /* @__PURE__ */ jsxRuntime.jsx(
739
+ "span",
740
+ {
741
+ className: ui.cn(
742
+ "shrink-0 text-xs tabular-nums",
743
+ budget.isOver ? "text-destructive" : "text-muted-foreground"
744
+ ),
745
+ title: l.budgetHint,
746
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.budget, { testId: "facts-page-chat-budget" }),
747
+ children: l.budget(budget.tokens.toLocaleString(), budget.cap.toLocaleString())
748
+ }
749
+ ) : null,
750
+ children: (isCompact) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
751
+ onToggleInChat && /* @__PURE__ */ jsxRuntime.jsx(
752
+ chunkV4ISCZJ7_cjs.SelectionBarAction,
753
+ {
754
+ icon: lucideReact.Paperclip,
755
+ label: allSelectedInChat ? l.removeFromChat : l.addToChat,
756
+ onClick: onToggleInChat,
757
+ disabled: none,
758
+ isCompact,
759
+ className: "border-blue-border text-blue-text hover:bg-blue-bg hover:text-blue-text",
760
+ tooltip: allSelectedInChat ? l.removeFromChatTooltip(pluralNoun) : l.addToChatTooltip(pluralNoun),
761
+ testId: chunkMHVNT4J3_cjs.testIdOr(testIds?.inChat, { testId: "bulk-in-chat-facts-button" })
762
+ }
763
+ ),
764
+ onLabel && /* @__PURE__ */ jsxRuntime.jsx(
765
+ chunkV4ISCZJ7_cjs.SelectionBarAction,
766
+ {
767
+ icon: lucideReact.Tags,
768
+ label: l.label,
769
+ onClick: onLabel,
770
+ disabled: none,
771
+ isCompact,
772
+ className: "border-green-border text-green-text hover:bg-green-bg hover:text-green-text",
773
+ tooltip: l.labelTooltip(pluralNoun),
774
+ testId: chunkMHVNT4J3_cjs.testIdOr(testIds?.label, { testId: "bulk-label-facts-button" })
775
+ }
776
+ ),
777
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1", children: [
778
+ sharedToggle,
779
+ !isCompact && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: l.shared })
780
+ ] }),
781
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
782
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
783
+ ui.Button,
784
+ {
785
+ variant: "outline",
786
+ size: "sm",
787
+ className: "h-7 gap-1.5 px-2 pointer-coarse:h-11",
788
+ disabled: none,
789
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.more, { testId: "facts-bulk-more-button" }),
790
+ children: [
791
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4" }),
792
+ !isCompact && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: l.more })
793
+ ]
794
+ }
795
+ ) }),
796
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuContent, { align: "end", children: [
797
+ onExport && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
798
+ /* @__PURE__ */ jsxRuntime.jsxs(
799
+ ui.DropdownMenuItem,
800
+ {
801
+ onClick: onExport,
802
+ disabled: none,
803
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.export, { testId: "export-facts-button" }),
804
+ children: [
805
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderUp, { className: "mr-2 size-4" }),
806
+ l.export
807
+ ]
808
+ }
809
+ ),
810
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuSeparator, {})
811
+ ] }),
812
+ /* @__PURE__ */ jsxRuntime.jsxs(
813
+ ui.DropdownMenuItem,
814
+ {
815
+ onClick: onDelete,
816
+ disabled: none,
817
+ className: "text-red-text focus:text-red-text",
818
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.delete, { testId: "bulk-delete-facts-button" }),
819
+ children: [
820
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "mr-2 size-4" }),
821
+ l.delete
822
+ ]
823
+ }
824
+ )
825
+ ] })
826
+ ] })
827
+ ] })
828
+ }
829
+ ) });
830
+ }
831
+ var DEFAULT_FACTS_EMPTY_STATE_LABELS = {
832
+ title: "Everything this workspace knows",
833
+ intro: "Facts are durable knowledge \u2014 a deadline, a decision, a preference. Write them yourself, or let the assistant distill them from your documents and chats.",
834
+ tryAdding: "Try adding a fact",
835
+ kinds: [
836
+ {
837
+ label: "Deadlines & dates",
838
+ desc: "A due date or milestone \u2014 it lands on the calendar and timeline"
839
+ },
840
+ { label: "Decisions", desc: "What was agreed, and why \u2014 so it is not lost in a thread" },
841
+ { label: "Preferences", desc: "How this workspace likes things done" }
842
+ ],
843
+ examples: [
844
+ "The renewal deadline is March 31, 2026",
845
+ "Payment terms are net 30",
846
+ "The team prefers email over phone for updates",
847
+ "Board approved the Q3 budget on May 12"
848
+ ],
849
+ loading: "Loading facts\u2026",
850
+ loadError: "Could not load facts.",
851
+ retry: "Try again"
852
+ };
853
+ var KIND_ICONS = [lucideReact.CalendarClock, lucideReact.Scale, lucideReact.Lightbulb];
854
+ function FactsEmptyState({ onUseExample, labels, testIds }) {
855
+ const l = { ...DEFAULT_FACTS_EMPTY_STATE_LABELS, ...labels };
856
+ return /* @__PURE__ */ jsxRuntime.jsx(
857
+ "div",
858
+ {
859
+ className: "flex min-h-full items-center justify-center p-10",
860
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.root, { testId: "facts-page-empty-state" }),
861
+ "data-slot": "facts-empty-state",
862
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-xl text-center", children: [
863
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto mb-4 flex size-12 items-center justify-center rounded-lg bg-accent text-accent-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Milestone, { className: "size-6" }) }),
864
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mt-2 text-xl font-semibold text-foreground", children: l.title }),
865
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: l.intro }),
866
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-7 grid gap-3 text-left @xl:grid-cols-3", children: l.kinds.map(({ label, desc }, i) => {
867
+ const KindIcon = KIND_ICONS[i % KIND_ICONS.length];
868
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-border bg-card p-3 shadow-xs", children: [
869
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-sm font-medium text-foreground", children: [
870
+ /* @__PURE__ */ jsxRuntime.jsx(KindIcon, { className: "size-4 text-primary" }),
871
+ label
872
+ ] }),
873
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs leading-snug text-muted-foreground", children: desc })
874
+ ] }, label);
875
+ }) }),
876
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-10 text-sm font-medium text-muted-foreground", children: l.tryAdding }),
877
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex flex-wrap justify-center gap-2.5", children: l.examples.map((fact) => /* @__PURE__ */ jsxRuntime.jsxs(
878
+ "button",
879
+ {
880
+ type: "button",
881
+ onClick: () => onUseExample(fact),
882
+ className: "group inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-3.5 py-2 text-sm text-foreground transition-colors hover:border-ring/50 hover:bg-accent/40 pointer-coarse:min-h-11",
883
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.example, { testId: "facts-page-example" }),
884
+ children: [
885
+ fact,
886
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "size-3.5 text-muted-foreground transition-colors group-hover:text-primary" })
887
+ ]
888
+ },
889
+ fact
890
+ )) })
891
+ ] })
892
+ }
893
+ );
894
+ }
895
+ function FactsLoading({
896
+ label = DEFAULT_FACTS_EMPTY_STATE_LABELS.loading
897
+ }) {
898
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center py-10 text-muted-foreground", children: [
899
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 size-4 animate-spin" }),
900
+ " ",
901
+ label
902
+ ] });
903
+ }
904
+ function FactsLoadError({
905
+ onRetry,
906
+ message = DEFAULT_FACTS_EMPTY_STATE_LABELS.loadError,
907
+ retryLabel = DEFAULT_FACTS_EMPTY_STATE_LABELS.retry
908
+ }) {
909
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 px-6 py-10 text-center", children: [
910
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: message }),
911
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outline", size: "sm", onClick: onRetry, children: retryLabel })
912
+ ] });
913
+ }
914
+ var DEFAULT_FACTS_FIELDS_BUTTON_LABELS = {
915
+ fields: "Fields",
916
+ defaultView: "Default view",
917
+ columns: "Columns",
918
+ columnNames: { in_chat: "In chat" }
919
+ };
920
+ function FactsFieldsButton({
921
+ getGridApi,
922
+ labels,
923
+ testIds
924
+ }) {
925
+ const l = { ...DEFAULT_FACTS_FIELDS_BUTTON_LABELS, ...labels };
926
+ const [open, setOpen] = react.useState(false);
927
+ const [version, setVersion] = react.useState(0);
928
+ const columns = react.useMemo(() => {
929
+ if (!open) return [];
930
+ const api = getGridApi();
931
+ if (!api || api.isDestroyed()) return [];
932
+ const state = api.getColumnState();
933
+ return state.filter((c) => c.colId !== "ag-Grid-SelectionColumn").map((c) => {
934
+ const def = api.getColumnDef(c.colId);
935
+ const label = def?.headerName && def.headerName.trim() || l.columnNames[c.colId] || c.colId;
936
+ return { colId: c.colId, label, visible: !c.hide };
937
+ });
938
+ }, [open, version, getGridApi, l.columnNames]);
939
+ const visibleCount = columns.filter((c) => c.visible).length;
940
+ const toggle = (colId, visible) => {
941
+ const api = getGridApi();
942
+ if (!api || api.isDestroyed()) return;
943
+ if (visible && visibleCount <= 1) return;
944
+ api.setColumnsVisible([colId], !visible);
945
+ setVersion((v) => v + 1);
946
+ };
947
+ const resetToDefault = () => {
948
+ const api = getGridApi();
949
+ if (!api || api.isDestroyed()) return;
950
+ api.resetColumnState();
951
+ setVersion((v) => v + 1);
952
+ };
953
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open, onOpenChange: setOpen, children: [
954
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
955
+ ui.Button,
956
+ {
957
+ variant: "ghost",
958
+ size: "sm",
959
+ className: "h-7 px-2 text-sm gap-1.5 text-muted-foreground hover:text-foreground font-light!",
960
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.trigger, { testId: "facts-fields-trigger" }),
961
+ children: [
962
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Columns3, { className: "size-3.5" }),
963
+ l.fields,
964
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-3" })
965
+ ]
966
+ }
967
+ ) }),
968
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { className: "w-[220px] p-0", align: "end", side: "bottom", sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Command, { shouldFilter: false, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CommandList, { className: "max-h-[60dvh]", children: [
969
+ /* @__PURE__ */ jsxRuntime.jsx(ui.CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(
970
+ ui.CommandItem,
971
+ {
972
+ onSelect: resetToDefault,
973
+ className: "cursor-pointer text-sm text-muted-foreground",
974
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.defaultView, {
975
+ testId: "facts-fields-default-view"
976
+ }),
977
+ children: [
978
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "mr-2 size-3.5" }),
979
+ l.defaultView
980
+ ]
981
+ }
982
+ ) }),
983
+ /* @__PURE__ */ jsxRuntime.jsx(ui.CommandSeparator, {}),
984
+ /* @__PURE__ */ jsxRuntime.jsx(ui.CommandGroup, { heading: l.columns, children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(
985
+ ui.CommandItem,
986
+ {
987
+ onSelect: () => toggle(col.colId, col.visible),
988
+ className: "cursor-pointer text-sm",
989
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.toggle?.(col.colId), {
990
+ testId: `facts-fields-toggle-${col.colId}`
991
+ }),
992
+ children: [
993
+ /* @__PURE__ */ jsxRuntime.jsx(
994
+ "div",
995
+ {
996
+ className: ui.cn(
997
+ "mr-2 flex size-3.5 items-center justify-center rounded-sm border border-primary",
998
+ col.visible ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
999
+ ),
1000
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3" })
1001
+ }
1002
+ ),
1003
+ col.label
1004
+ ]
1005
+ },
1006
+ col.colId
1007
+ )) })
1008
+ ] }) }) })
1009
+ ] });
1010
+ }
1011
+ var DEFAULT_FACT_TIMELINE_LABELS = {
1012
+ ganttEmpty: "Give a fact a date and it appears here."
1013
+ };
1014
+ function FactsCalendar({
1015
+ facts,
1016
+ onSelect,
1017
+ selectedId,
1018
+ navigatorContainer,
1019
+ navigatorTotal,
1020
+ testId
1021
+ }) {
1022
+ const calendarTestId = chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "facts-calendar" });
1023
+ const items = react.useMemo(
1024
+ () => facts.filter((f) => f.date_start).map((f) => ({
1025
+ id: f.external_id,
1026
+ label: f.text,
1027
+ start: f.date_start,
1028
+ end: f.date_end,
1029
+ fact: f
1030
+ })),
1031
+ [facts]
1032
+ );
1033
+ const rootRef = react.useRef(null);
1034
+ const entryId = chunkMHVNT4J3_cjs.testIdOr(testId && `${testId}-entry-${selectedId}`, {
1035
+ testId: `facts-calendar-entry-${selectedId}`
1036
+ });
1037
+ react.useEffect(() => {
1038
+ const root = rootRef.current;
1039
+ if (!root) return;
1040
+ root.querySelectorAll(".fact-cal-selected").forEach((el) => el.classList.remove("fact-cal-selected"));
1041
+ if (!selectedId) return;
1042
+ root.querySelectorAll(`[data-testid="${entryId}"]`).forEach((el) => el.classList.add("fact-cal-selected"));
1043
+ }, [selectedId, items, entryId]);
1044
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: rootRef, className: "h-full border-t border-border", "data-slot": "facts-calendar", children: /* @__PURE__ */ jsxRuntime.jsx(
1045
+ chunkVPPX5XUF_cjs.TimelineCalendar,
1046
+ {
1047
+ items,
1048
+ testId: calendarTestId,
1049
+ maxLanes: Infinity,
1050
+ selectedIds: selectedId ? [selectedId] : [],
1051
+ onSelect: (item) => onSelect?.(item.fact),
1052
+ navigatorContainer,
1053
+ navigatorTotal
1054
+ }
1055
+ ) });
1056
+ }
1057
+ function FactsGanttPane({
1058
+ testId,
1059
+ emptyMessage,
1060
+ labels,
1061
+ ...props
1062
+ }) {
1063
+ const l = { ...DEFAULT_FACT_TIMELINE_LABELS, ...labels };
1064
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "facts-gantt h-full border-t border-border", "data-slot": "facts-gantt", children: /* @__PURE__ */ jsxRuntime.jsx(
1065
+ chunkVPPX5XUF_cjs.TimelineGantt,
1066
+ {
1067
+ testId: chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "gantt" }),
1068
+ emptyMessage: emptyMessage ?? l.ganttEmpty,
1069
+ ...props
1070
+ }
1071
+ ) });
1072
+ }
1073
+ var DEFAULT_FACTS_VIEW_TOGGLE_LABELS = {
1074
+ table: "Table",
1075
+ calendar: "Calendar",
1076
+ timeline: "Timeline",
1077
+ smartSearch: "Smart Search"
1078
+ };
1079
+ var createOptions = (l) => [
1080
+ { value: "table", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table2, { className: "size-3.5" }), label: l.table },
1081
+ { value: "calendar", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarRange, { className: "size-3.5" }), label: l.calendar },
1082
+ { value: "gantt", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GanttChartSquare, { className: "size-3.5" }), label: l.timeline },
1083
+ // Facts-only semantic/keyword recall — mirrors the Files "Smart Search" view
1084
+ // (same Search icon + label), but searches this workspace's facts, not docs.
1085
+ { value: "smart_search", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-3.5" }), label: l.smartSearch }
1086
+ ];
1087
+ function FactsViewToggle({
1088
+ viewMode,
1089
+ onChange,
1090
+ collapsed = false,
1091
+ labels,
1092
+ testIdPrefix,
1093
+ testIds
1094
+ }) {
1095
+ const options = createOptions({ ...DEFAULT_FACTS_VIEW_TOGGLE_LABELS, ...labels }).map((o) => ({
1096
+ ...o,
1097
+ testId: testIds?.[o.value]
1098
+ }));
1099
+ return /* @__PURE__ */ jsxRuntime.jsx(
1100
+ chunk2WLXQGWC_cjs.ViewToggle,
1101
+ {
1102
+ options,
1103
+ value: viewMode,
1104
+ onChange: (value) => onChange(value),
1105
+ testIdPrefix: chunkMHVNT4J3_cjs.testIdOr(testIdPrefix, { testId: "facts-layout" }),
1106
+ showLabels: !collapsed,
1107
+ size: "sm"
1108
+ }
1109
+ );
1110
+ }
1111
+ var DEFAULT_FACTS_TOOLBAR_LABELS = {
1112
+ tags: "Tags",
1113
+ newFact: "New fact"
1114
+ };
1115
+ function FactsToolbar({
1116
+ count,
1117
+ hasActiveFilters,
1118
+ filterText,
1119
+ onFilterTextChange,
1120
+ searchFields,
1121
+ onSearchFieldsChange,
1122
+ quickFilter,
1123
+ onOpenTags,
1124
+ viewMode,
1125
+ onViewModeChange,
1126
+ onNewFact,
1127
+ navSlotRef,
1128
+ navigator,
1129
+ tools,
1130
+ showToolbarRow = true,
1131
+ labels,
1132
+ testIds,
1133
+ filterLabels,
1134
+ filterTestIds,
1135
+ viewToggleLabels,
1136
+ viewToggleTestIdPrefix
1137
+ }) {
1138
+ const l = { ...DEFAULT_FACTS_TOOLBAR_LABELS, ...labels };
1139
+ const headerRef = react.useRef(null);
1140
+ const [viewsCollapsed, setViewsCollapsed] = react.useState(false);
1141
+ const [isNarrow, setIsNarrow] = react.useState(false);
1142
+ react.useEffect(() => {
1143
+ const el = headerRef.current;
1144
+ if (!el) return;
1145
+ const measure = () => {
1146
+ const w = el.clientWidth;
1147
+ setViewsCollapsed((prev) => prev ? w < 990 : w < 950);
1148
+ const narrowAt = window.matchMedia?.("(pointer: coarse)")?.matches ? 820 : 640;
1149
+ setIsNarrow((prev) => prev ? w < narrowAt + 20 : w < narrowAt);
1150
+ };
1151
+ measure();
1152
+ return chunkPPCATBOY_cjs.observeResize(el, measure);
1153
+ }, []);
1154
+ const tabs = [
1155
+ {
1156
+ id: "facts",
1157
+ // No name: the page needs no self-label, but the fact glyph stays in front of the count.
1158
+ countIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Milestone, { className: "size-3.5" }),
1159
+ label: "",
1160
+ count,
1161
+ countPlacement: "leading",
1162
+ hasActiveFilters,
1163
+ testId: chunkMHVNT4J3_cjs.testIdOr(testIds?.tab, { testId: "facts-tab" }),
1164
+ presentation: "count"
1165
+ }
1166
+ ];
1167
+ const filterControls = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: isNarrow ? "flex w-full items-center gap-1.5" : "flex items-center gap-1.5", children: [
1168
+ /* @__PURE__ */ jsxRuntime.jsx(
1169
+ chunk2EI7NCUA_cjs.FilterInput,
1170
+ {
1171
+ value: filterText,
1172
+ onChange: onFilterTextChange,
1173
+ fields: searchFields,
1174
+ onFieldsChange: onSearchFieldsChange,
1175
+ filter: quickFilter,
1176
+ className: isNarrow ? "min-w-0 flex-1" : void 0,
1177
+ labels: filterLabels,
1178
+ testIds: filterTestIds
1179
+ }
1180
+ ),
1181
+ onOpenTags && /* @__PURE__ */ jsxRuntime.jsxs(
1182
+ ui.Button,
1183
+ {
1184
+ variant: "outline",
1185
+ size: "sm",
1186
+ className: "h-6 shrink-0 gap-1.5 px-2 pointer-coarse:h-11",
1187
+ onClick: onOpenTags,
1188
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.tagsButton, { testId: "facts-tags-button" }),
1189
+ children: [
1190
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookMarked, { className: "size-3.5" }),
1191
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: l.tags })
1192
+ ]
1193
+ }
1194
+ )
1195
+ ] });
1196
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: headerRef, className: "sticky top-0 z-10 bg-background", "data-slot": "facts-toolbar", children: [
1197
+ /* @__PURE__ */ jsxRuntime.jsx(
1198
+ chunk7RGLTF76_cjs.TabHeader,
1199
+ {
1200
+ tabs,
1201
+ activeTabId: "notes",
1202
+ onTabChange: () => {
1203
+ },
1204
+ firstTabContent: isNarrow ? null : filterControls,
1205
+ centerContent: isNarrow ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1206
+ FactsViewToggle,
1207
+ {
1208
+ viewMode,
1209
+ onChange: onViewModeChange,
1210
+ collapsed: viewsCollapsed,
1211
+ labels: viewToggleLabels,
1212
+ testIdPrefix: viewToggleTestIdPrefix
1213
+ }
1214
+ ) }),
1215
+ rightContent: /* @__PURE__ */ jsxRuntime.jsxs(
1216
+ ui.Button,
1217
+ {
1218
+ onClick: onNewFact,
1219
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.newFact, { testId: "facts-page-new" }),
1220
+ children: [
1221
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "mr-0.5 size-4" }),
1222
+ l.newFact
1223
+ ]
1224
+ }
1225
+ )
1226
+ }
1227
+ ),
1228
+ isNarrow && /* @__PURE__ */ jsxRuntime.jsxs(
1229
+ "div",
1230
+ {
1231
+ className: "flex flex-col gap-1.5 border-b border-border px-3 py-1.5",
1232
+ "data-slot": "facts-toolbar-stack",
1233
+ children: [
1234
+ filterControls,
1235
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1236
+ FactsViewToggle,
1237
+ {
1238
+ viewMode,
1239
+ onChange: onViewModeChange,
1240
+ collapsed: true,
1241
+ labels: viewToggleLabels,
1242
+ testIdPrefix: viewToggleTestIdPrefix
1243
+ }
1244
+ ) })
1245
+ ]
1246
+ }
1247
+ ),
1248
+ showToolbarRow && /* @__PURE__ */ jsxRuntime.jsxs(
1249
+ "div",
1250
+ {
1251
+ className: "flex min-h-8 flex-wrap items-center gap-x-1.5 border-b border-border bg-background px-3 py-0.5",
1252
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.filterBar, { testId: "facts-filter-bar" }),
1253
+ children: [
1254
+ /* @__PURE__ */ jsxRuntime.jsx(
1255
+ "div",
1256
+ {
1257
+ ref: navSlotRef,
1258
+ className: "flex shrink-0 items-center empty:hidden",
1259
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.filterBarNav, { testId: "facts-filter-bar-nav" }),
1260
+ children: navigator
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
1264
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center", children: tools })
1265
+ ]
1266
+ }
1267
+ )
1268
+ ] });
1269
+ }
1270
+
1271
+ // src/facts/fact-table-column-resize.ts
1272
+ var EDGE = 6;
1273
+ var MIN_WIDTH = 48;
1274
+ function enableFactTableColumnResize(container) {
1275
+ let drag = null;
1276
+ const cellFromEvent = (e) => {
1277
+ const el = e.target;
1278
+ const cell = el?.closest?.("td, th");
1279
+ if (!cell || cell.hasAttribute("data-tool-cell")) return null;
1280
+ if (!container.contains(cell)) return null;
1281
+ return cell;
1282
+ };
1283
+ const nearRightEdge = (cell, clientX) => {
1284
+ const rect = cell.getBoundingClientRect();
1285
+ return clientX >= rect.right - EDGE && clientX <= rect.right + 2;
1286
+ };
1287
+ const colForCell = (cell) => {
1288
+ const row = cell.parentElement;
1289
+ const table = cell.closest("table");
1290
+ const colgroup = table?.querySelector("colgroup");
1291
+ if (!row || !table || !colgroup) return null;
1292
+ const index = Array.prototype.indexOf.call(row.children, cell);
1293
+ return colgroup.children[index] ?? null;
1294
+ };
1295
+ const freezeWidths = (table) => {
1296
+ const colgroup = table.querySelector("colgroup");
1297
+ if (!colgroup) return;
1298
+ const ruler = table.querySelector("thead tr") ?? table.querySelector("tbody tr");
1299
+ const cells = ruler ? Array.from(ruler.children) : [];
1300
+ Array.from(colgroup.children).forEach((node, i) => {
1301
+ const col = node;
1302
+ const cell = cells[i];
1303
+ if (!col.style.width && cell) col.style.width = `${cell.getBoundingClientRect().width}px`;
1304
+ });
1305
+ table.style.tableLayout = "fixed";
1306
+ };
1307
+ const onPointerMove = (e) => {
1308
+ if (drag) {
1309
+ const next = Math.max(MIN_WIDTH, drag.startWidth + (e.clientX - drag.startX));
1310
+ drag.col.style.width = `${next}px`;
1311
+ e.preventDefault();
1312
+ return;
1313
+ }
1314
+ const cell = cellFromEvent(e);
1315
+ if (cell && nearRightEdge(cell, e.clientX)) {
1316
+ cell.style.cursor = "col-resize";
1317
+ } else if (cell) {
1318
+ cell.style.cursor = "";
1319
+ }
1320
+ };
1321
+ const endDrag = () => {
1322
+ if (!drag) return;
1323
+ drag = null;
1324
+ document.documentElement.classList.remove("fact-col-resizing");
1325
+ document.removeEventListener("pointermove", onPointerMove, true);
1326
+ document.removeEventListener("pointerup", endDrag, true);
1327
+ };
1328
+ const onPointerDown = (e) => {
1329
+ if (e.button !== 0) return;
1330
+ const cell = cellFromEvent(e);
1331
+ if (!cell || !nearRightEdge(cell, e.clientX)) return;
1332
+ const table = cell.closest("table");
1333
+ if (!table) return;
1334
+ freezeWidths(table);
1335
+ const col = colForCell(cell);
1336
+ if (!col) return;
1337
+ drag = {
1338
+ col,
1339
+ table,
1340
+ startX: e.clientX,
1341
+ startWidth: parseFloat(col.style.width) || cell.getBoundingClientRect().width
1342
+ };
1343
+ e.preventDefault();
1344
+ document.documentElement.classList.add("fact-col-resizing");
1345
+ document.addEventListener("pointermove", onPointerMove, true);
1346
+ document.addEventListener("pointerup", endDrag, true);
1347
+ };
1348
+ container.addEventListener("pointerdown", onPointerDown);
1349
+ container.addEventListener("pointermove", onPointerMove);
1350
+ return () => {
1351
+ endDrag();
1352
+ container.removeEventListener("pointerdown", onPointerDown);
1353
+ container.removeEventListener("pointermove", onPointerMove);
1354
+ };
1355
+ }
1356
+ var DEFAULT_FACT_LABELS_CELL_LABELS = {
1357
+ edit: "Edit labels",
1358
+ searchPlaceholder: "Search or create...",
1359
+ create: (name) => `Create \u201C${name}\u201D`,
1360
+ empty: "No labels yet"
1361
+ };
1362
+ var CHIP_ROW_H = 24;
1363
+ var CHIP_GAP = 4;
1364
+ var FactLabelsCell = react.memo(function FactLabelsCell2({
1365
+ options,
1366
+ selectedIds,
1367
+ onChange,
1368
+ onCreate,
1369
+ rowHeight = 52,
1370
+ labels,
1371
+ testIds
1372
+ }) {
1373
+ const l = { ...DEFAULT_FACT_LABELS_CELL_LABELS, ...labels };
1374
+ const [open, setOpen] = react.useState(false);
1375
+ const [search, setSearch] = react.useState("");
1376
+ const applied = react.useMemo(
1377
+ () => new Set(selectedIds.filter((id) => options.some((o) => o.id === id))),
1378
+ [selectedIds, options]
1379
+ );
1380
+ const toggle = (option) => onChange(
1381
+ applied.has(option.id) ? selectedIds.filter((id) => id !== option.id) : [...selectedIds, option.id]
1382
+ );
1383
+ const createAndApply = async (name) => {
1384
+ const trimmed = name.trim();
1385
+ if (!trimmed) return;
1386
+ const existing = options.find((o) => o.name.toLowerCase() === trimmed.toLowerCase());
1387
+ if (existing) {
1388
+ if (!applied.has(existing.id)) onChange([...selectedIds, existing.id]);
1389
+ setSearch("");
1390
+ return;
1391
+ }
1392
+ const id = await onCreate(trimmed);
1393
+ if (id) onChange([...selectedIds, id]);
1394
+ setSearch("");
1395
+ };
1396
+ const clampRows = Math.max(1, Math.floor((rowHeight + CHIP_GAP) / (CHIP_ROW_H + CHIP_GAP)));
1397
+ const appliedOptions = options.filter((o) => applied.has(o.id));
1398
+ const chipsRef = react.useRef(null);
1399
+ const [hasOverflow, setHasOverflow] = react.useState(false);
1400
+ react.useEffect(() => {
1401
+ const el = chipsRef.current;
1402
+ if (!el) return;
1403
+ const measure = () => setHasOverflow(el.scrollHeight > el.clientHeight + 1);
1404
+ measure();
1405
+ return chunkPPCATBOY_cjs.observeResize(el, measure);
1406
+ }, [applied, clampRows, rowHeight, options]);
1407
+ const searchMatchesExisting = options.some(
1408
+ (o) => o.name.toLowerCase() === search.trim().toLowerCase()
1409
+ );
1410
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1411
+ ui.Popover,
1412
+ {
1413
+ open,
1414
+ onOpenChange: (next) => {
1415
+ setOpen(next);
1416
+ if (!next) setSearch("");
1417
+ },
1418
+ children: [
1419
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1420
+ "button",
1421
+ {
1422
+ type: "button",
1423
+ "aria-label": l.edit,
1424
+ "data-slot": "fact-labels-cell",
1425
+ className: "group relative flex h-full w-full min-w-0 cursor-pointer items-center gap-1 pr-4 text-left hover:bg-muted",
1426
+ children: appliedOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-muted-foreground opacity-50", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PencilLine, { className: "size-3.5" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1427
+ /* @__PURE__ */ jsxRuntime.jsx(
1428
+ "div",
1429
+ {
1430
+ ref: chipsRef,
1431
+ className: "flex min-w-0 flex-1 flex-wrap content-start gap-1 overflow-hidden",
1432
+ style: { maxHeight: CHIP_ROW_H * clampRows + CHIP_GAP * (clampRows - 1) },
1433
+ children: appliedOptions.map((o) => /* @__PURE__ */ jsxRuntime.jsxs(
1434
+ "span",
1435
+ {
1436
+ className: "inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-xs font-medium",
1437
+ title: o.name,
1438
+ style: { borderColor: o.color },
1439
+ children: [
1440
+ /* @__PURE__ */ jsxRuntime.jsx(
1441
+ "span",
1442
+ {
1443
+ className: "flex size-3.5 shrink-0 items-center justify-center rounded",
1444
+ style: { backgroundColor: o.color },
1445
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-2.5 text-white", strokeWidth: 3 })
1446
+ }
1447
+ ),
1448
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[80px] truncate", children: o.name })
1449
+ ]
1450
+ },
1451
+ o.id
1452
+ ))
1453
+ }
1454
+ ),
1455
+ hasOverflow && /* @__PURE__ */ jsxRuntime.jsx(
1456
+ "span",
1457
+ {
1458
+ className: "pointer-events-none absolute bottom-0.5 right-0.5 text-xs font-semibold leading-none text-muted-foreground",
1459
+ "aria-hidden": true,
1460
+ children: "\u2026"
1461
+ }
1462
+ )
1463
+ ] })
1464
+ }
1465
+ ) }),
1466
+ open && /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { className: "w-[360px] p-0", align: "start", side: "bottom", sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Command, { shouldFilter: true, children: [
1467
+ /* @__PURE__ */ jsxRuntime.jsx(
1468
+ ui.CommandInput,
1469
+ {
1470
+ placeholder: l.searchPlaceholder,
1471
+ value: search,
1472
+ onValueChange: setSearch,
1473
+ onKeyDown: (e) => {
1474
+ if (e.key === "Enter" && search.trim() && !searchMatchesExisting) {
1475
+ e.preventDefault();
1476
+ void createAndApply(search);
1477
+ }
1478
+ }
1479
+ }
1480
+ ),
1481
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.CommandList, { children: [
1482
+ /* @__PURE__ */ jsxRuntime.jsx(ui.CommandEmpty, { children: search.trim() ? /* @__PURE__ */ jsxRuntime.jsx(
1483
+ "button",
1484
+ {
1485
+ type: "button",
1486
+ onClick: () => void createAndApply(search),
1487
+ onPointerDown: (e) => e.preventDefault(),
1488
+ className: "w-full cursor-pointer rounded px-2 py-1.5 text-left text-sm text-primary hover:bg-accent pointer-coarse:min-h-11",
1489
+ children: l.create(search.trim())
1490
+ }
1491
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: l.empty }) }),
1492
+ /* @__PURE__ */ jsxRuntime.jsx(ui.CommandGroup, { children: options.map((o) => {
1493
+ const isApplied = applied.has(o.id);
1494
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1495
+ ui.CommandItem,
1496
+ {
1497
+ value: o.name,
1498
+ onSelect: () => toggle(o),
1499
+ onPointerDown: (e) => e.preventDefault(),
1500
+ className: "cursor-pointer pointer-coarse:min-h-11",
1501
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.option?.(o.id), {
1502
+ testId: `fact-label-select-${o.id}`
1503
+ }),
1504
+ children: [
1505
+ /* @__PURE__ */ jsxRuntime.jsx(
1506
+ "span",
1507
+ {
1508
+ className: "mr-2 flex size-4 shrink-0 items-center justify-center rounded border-2",
1509
+ style: isApplied ? { borderColor: o.color, backgroundColor: o.color } : { borderColor: o.color },
1510
+ children: isApplied && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3 text-white", strokeWidth: 3 })
1511
+ }
1512
+ ),
1513
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-sm", children: o.name })
1514
+ ]
1515
+ },
1516
+ o.id
1517
+ );
1518
+ }) })
1519
+ ] })
1520
+ ] }) })
1521
+ ]
1522
+ }
1523
+ );
1524
+ });
1525
+ var DEFAULT_FACT_COLUMN_LABELS = {
1526
+ inChatHeaderTooltip: "Facts added to this chat are always in context for this chat",
1527
+ inChatTitle: "In this chat \u2014 always in context for it. Click to remove from chat.",
1528
+ notInChatTitle: "Add to chat \u2014 always in context for this chat",
1529
+ removeFromChat: "Remove from chat",
1530
+ addToChat: "Add to chat",
1531
+ fact: "Fact",
1532
+ dates: "Dates",
1533
+ dateTitle: "Date of the fact itself, not when this was saved",
1534
+ labels: "Labels",
1535
+ verified: "Verified",
1536
+ verifiedTooltip: "Verified by a human",
1537
+ shared: "Shared",
1538
+ sharedTooltip: "Shared with the workspace, or private to you & your agents",
1539
+ createdBy: "Created by",
1540
+ sources: "Sources",
1541
+ sourcedFrom: (n) => `Sourced from ${n} document${n === 1 ? "" : "s"} \u2014 open the fact to see them`,
1542
+ createdAt: "Created at",
1543
+ updated: "Updated",
1544
+ id: "ID"
1545
+ };
1546
+ var ISO_DATE_FILTER_PARAMS = {
1547
+ browserDatePicker: true,
1548
+ comparator: (filterDate, cellValue) => {
1549
+ if (!cellValue || typeof cellValue !== "string") return -1;
1550
+ const cell = new Date(cellValue);
1551
+ if (Number.isNaN(cell.getTime())) return -1;
1552
+ const cellDay = Date.UTC(cell.getUTCFullYear(), cell.getUTCMonth(), cell.getUTCDate());
1553
+ const filterDay = Date.UTC(
1554
+ filterDate.getFullYear(),
1555
+ filterDate.getMonth(),
1556
+ filterDate.getDate()
1557
+ );
1558
+ return cellDay < filterDay ? -1 : cellDay > filterDay ? 1 : 0;
1559
+ }
1560
+ };
1561
+ function sourceDocCount(fact) {
1562
+ return fact?.citations?.length ?? 0;
1563
+ }
1564
+ var DEFAULT_FACT_COLUMN_ORDER = [
1565
+ "in_chat",
1566
+ "text",
1567
+ "sources",
1568
+ "tags",
1569
+ "date",
1570
+ "confirmed",
1571
+ "shared",
1572
+ "created_by",
1573
+ "created_at",
1574
+ "updated_at",
1575
+ "note_id"
1576
+ ];
1577
+ function createFactColumns(slots) {
1578
+ const fieldOf = (name) => name;
1579
+ const l = { ...DEFAULT_FACT_COLUMN_LABELS, ...slots.labels };
1580
+ const ids = slots.testIds;
1581
+ const { isInChat, onToggleInChat } = slots;
1582
+ const inChatColumn = isInChat && onToggleInChat ? [
1583
+ {
1584
+ colId: "in_chat",
1585
+ headerName: "",
1586
+ headerComponent: () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Paperclip, { className: "size-3.5 text-muted-foreground" }) }),
1587
+ valueGetter: (params) => params.data ? isInChat(params.data) : false,
1588
+ width: 44,
1589
+ minWidth: 44,
1590
+ maxWidth: 44,
1591
+ sortable: true,
1592
+ resizable: false,
1593
+ headerTooltip: l.inChatHeaderTooltip,
1594
+ cellClass: "cell-hcenter",
1595
+ // A toggle, not a readout: a fact in the chat rides every message of it, so it flips
1596
+ // in place.
1597
+ cellRenderer: (params) => {
1598
+ if (!params.data) return null;
1599
+ const fact = params.data;
1600
+ const inChat = isInChat(fact);
1601
+ return /* @__PURE__ */ jsxRuntime.jsx(
1602
+ "button",
1603
+ {
1604
+ type: "button",
1605
+ onClick: () => onToggleInChat(fact),
1606
+ title: inChat ? l.inChatTitle : l.notInChatTitle,
1607
+ "aria-label": inChat ? l.removeFromChat : l.addToChat,
1608
+ "aria-pressed": inChat,
1609
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(ids?.inChat?.(fact.external_id), {
1610
+ testId: `facts-grid-in-chat-${fact.external_id}`
1611
+ }),
1612
+ className: "flex h-full items-center",
1613
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1614
+ lucideReact.Paperclip,
1615
+ {
1616
+ className: ui.cn(
1617
+ "size-3.5",
1618
+ inChat ? "text-primary" : "text-muted-foreground/30 transition-colors hover:text-muted-foreground"
1619
+ )
1620
+ }
1621
+ )
1622
+ }
1623
+ );
1624
+ }
1625
+ }
1626
+ ] : [];
1627
+ const columns = [
1628
+ ...inChatColumn,
1629
+ {
1630
+ colId: "text",
1631
+ suppressHeaderFilterButton: true,
1632
+ headerComponent: (p) => slots.renderHeader(p, "text"),
1633
+ headerName: l.fact,
1634
+ field: fieldOf("text"),
1635
+ flex: 3,
1636
+ minWidth: 280,
1637
+ sortable: true,
1638
+ filter: "agTextColumnFilter",
1639
+ // Decode the editor's whitespace entities (`&#x20;` for a trailing space) so the tooltip
1640
+ // reads as typed, not as raw markdown references.
1641
+ tooltipValueGetter: (p) => chunkRC25WMVB_cjs.decodeWhitespaceEntities(p.data?.text),
1642
+ // Editable only via the grid api (Rename in the row's menu); clicks never open the editor
1643
+ // (suppressClickEdit on the grid).
1644
+ editable: true,
1645
+ cellEditor: "agLargeTextCellEditor",
1646
+ cellEditorPopup: true,
1647
+ cellEditorParams: { rows: 8, cols: 60 },
1648
+ valueSetter: (params) => {
1649
+ if (!params.data) return false;
1650
+ params.data.text = params.newValue;
1651
+ return true;
1652
+ },
1653
+ // NOT `cell-multiline`: this cell has its OWN clamp (the `.fact-clamp` span below, sized
1654
+ // from the row height). A second clamp cut the text in half at the minimum row height.
1655
+ cellClass: "relative",
1656
+ cellRenderer: (params) => {
1657
+ if (!params.data) return null;
1658
+ const fact = params.data;
1659
+ const rowH = params.node.rowHeight ?? 52;
1660
+ const clampLines = Math.max(1, Math.floor(rowH / 20));
1661
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex size-full items-start pr-6", children: [
1662
+ /* @__PURE__ */ jsxRuntime.jsx(
1663
+ "span",
1664
+ {
1665
+ className: "fact-clamp whitespace-normal break-words text-sm leading-snug text-foreground",
1666
+ style: { ["--fact-clamp-lines"]: clampLines },
1667
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(ids?.text?.(fact.external_id), {
1668
+ testId: `facts-grid-text-${fact.external_id}`
1669
+ }),
1670
+ children: chunkRC25WMVB_cjs.decodeWhitespaceEntities(fact.text)
1671
+ }
1672
+ ),
1673
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "facts-row-kebab absolute right-0.5 top-1/2 -translate-y-1/2", children: slots.renderRowActions(fact, params) })
1674
+ ] });
1675
+ }
1676
+ },
1677
+ {
1678
+ colId: "date",
1679
+ // AG Grid's DEFAULT header, so the sort arrow and filter button are the native ones,
1680
+ // identical to the Files table's Date columns.
1681
+ headerName: l.dates,
1682
+ // Sort on the raw bound rather than the rendered string ("Oct 2019" sorts April first).
1683
+ field: fieldOf("date_start"),
1684
+ flex: 0.8,
1685
+ minWidth: 132,
1686
+ sortable: true,
1687
+ filter: "agDateColumnFilter",
1688
+ filterParams: ISO_DATE_FILTER_PARAMS,
1689
+ // The edit value is the date-only slice: a lexical sort matches a chronological one, and
1690
+ // the inline editor shows "2024-03-12" rather than a full ISO timestamp. Inline typing
1691
+ // accepts YYYY, YYYY-MM or YYYY-MM-DD; clearing the cell undates the fact.
1692
+ editable: true,
1693
+ singleClickEdit: true,
1694
+ valueGetter: (params) => params.data?.date_start ? params.data.date_start.slice(0, 10) : null,
1695
+ valueSetter: (params) => {
1696
+ if (!params.data) return false;
1697
+ params.data.date_start = params.newValue;
1698
+ return true;
1699
+ },
1700
+ cellClass: "relative cell-tnum",
1701
+ cellRenderer: (params) => {
1702
+ const when = chunkVPPX5XUF_cjs.formatSpan(
1703
+ params.data?.date_start,
1704
+ params.data?.date_end,
1705
+ params.data?.timezone
1706
+ );
1707
+ if (!when) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/50", children: "\u2014" });
1708
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1709
+ "span",
1710
+ {
1711
+ className: "inline-flex items-center gap-1",
1712
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(ids?.date?.(params.data?.external_id ?? ""), {
1713
+ testId: `facts-grid-date-${params.data?.external_id}`
1714
+ }),
1715
+ title: l.dateTitle,
1716
+ children: [
1717
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { className: "size-3 opacity-70" }),
1718
+ when
1719
+ ]
1720
+ }
1721
+ );
1722
+ }
1723
+ },
1724
+ {
1725
+ colId: "tags",
1726
+ suppressHeaderFilterButton: true,
1727
+ headerComponent: (p) => slots.renderHeader(p, "tags"),
1728
+ headerName: l.labels,
1729
+ flex: 0.9,
1730
+ // Never narrower than its own header, even with the filter button and sort indicator.
1731
+ minWidth: 160,
1732
+ sortable: true,
1733
+ filter: "agTextColumnFilter",
1734
+ cellClass: "overflow-visible",
1735
+ valueGetter: (params) => (params.data?.tags ?? []).map((t) => t.name).join(", "),
1736
+ // Editable in place: toggling a label persists immediately, no dialog round-trip.
1737
+ cellRenderer: (params) => params.data ? slots.renderLabels(params.data, params) : null
1738
+ },
1739
+ {
1740
+ colId: "confirmed",
1741
+ headerName: l.verified,
1742
+ headerTooltip: l.verifiedTooltip,
1743
+ field: fieldOf("confirmed"),
1744
+ // minWidth matches width so the header can't be clamped narrow enough to ellipsize.
1745
+ width: 116,
1746
+ minWidth: 116,
1747
+ sortable: true,
1748
+ cellDataType: "boolean",
1749
+ valueGetter: (params) => params.data?.confirmed ?? false,
1750
+ cellClass: "cell-hcenter",
1751
+ headerClass: "header-hcenter",
1752
+ cellRenderer: (params) => params.data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: slots.renderVerified(params.data) }) : null
1753
+ },
1754
+ {
1755
+ colId: "shared",
1756
+ headerName: l.shared,
1757
+ headerTooltip: l.sharedTooltip,
1758
+ field: fieldOf("shared"),
1759
+ // minWidth (not just width) is raised too: AG Grid clamps any persisted width up to it.
1760
+ width: 110,
1761
+ minWidth: 110,
1762
+ sortable: true,
1763
+ headerClass: "header-hcenter",
1764
+ cellDataType: "boolean",
1765
+ valueGetter: (params) => params.data?.shared ?? false,
1766
+ cellRenderer: (params) => params.data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: slots.renderShared(params.data, params) }) : null
1767
+ },
1768
+ {
1769
+ colId: "created_by",
1770
+ headerName: l.createdBy,
1771
+ headerTooltip: l.createdBy,
1772
+ width: 138,
1773
+ minWidth: 138,
1774
+ sortable: true,
1775
+ valueGetter: (params) => slots.getCreatorName(params),
1776
+ cellRenderer: (params) => params.data ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: slots.renderCreator(params.data, params) }) : null
1777
+ },
1778
+ {
1779
+ colId: "sources",
1780
+ headerName: l.sources,
1781
+ width: 112,
1782
+ minWidth: 104,
1783
+ sortable: true,
1784
+ // A hand-written fact has no sources, which is information rather than a gap: it reads as
1785
+ // an em dash instead of a zero.
1786
+ valueGetter: (params) => sourceDocCount(params.data),
1787
+ cellRenderer: (params) => {
1788
+ const n = sourceDocCount(params.data);
1789
+ if (n === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/40", children: "\u2014" });
1790
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1791
+ "span",
1792
+ {
1793
+ className: "inline-flex items-center gap-1 text-xs text-muted-foreground",
1794
+ title: l.sourcedFrom(n),
1795
+ children: [
1796
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Quote, { className: "size-3 opacity-70" }),
1797
+ n
1798
+ ]
1799
+ }
1800
+ );
1801
+ }
1802
+ },
1803
+ {
1804
+ colId: "created_at",
1805
+ suppressHeaderFilterButton: true,
1806
+ headerComponent: (p) => slots.renderHeader(p, "created_at"),
1807
+ headerName: l.createdAt,
1808
+ field: fieldOf("created_at"),
1809
+ width: 162,
1810
+ minWidth: 154,
1811
+ sortable: true,
1812
+ filter: "agDateColumnFilter",
1813
+ filterParams: ISO_DATE_FILTER_PARAMS,
1814
+ // Display-only: a valueFormatter avoids mounting a React component per row.
1815
+ cellClass: "text-muted-foreground",
1816
+ valueFormatter: (params) => params.value ? slots.formatDate(params.value) : ""
1817
+ },
1818
+ {
1819
+ colId: "updated_at",
1820
+ suppressHeaderFilterButton: true,
1821
+ headerComponent: (p) => slots.renderHeader(p, "updated_at"),
1822
+ headerName: l.updated,
1823
+ field: fieldOf("updated_at"),
1824
+ width: 140,
1825
+ minWidth: 140,
1826
+ // Hidden by default: a column-menu opt-in like the documents grid's long tail.
1827
+ hide: true,
1828
+ sortable: true,
1829
+ filter: "agDateColumnFilter",
1830
+ filterParams: ISO_DATE_FILTER_PARAMS,
1831
+ valueFormatter: (params) => params.value ? slots.formatDate(params.value) : ""
1832
+ },
1833
+ {
1834
+ colId: "note_id",
1835
+ headerName: l.id,
1836
+ field: fieldOf("external_id"),
1837
+ width: 120,
1838
+ minWidth: 100,
1839
+ sortable: true,
1840
+ filter: "agTextColumnFilter",
1841
+ // Hidden by default like the documents ID column: needed when quoting a fact to support.
1842
+ hide: true,
1843
+ cellClass: "font-mono text-xs text-muted-foreground"
1844
+ }
1845
+ ];
1846
+ return DEFAULT_FACT_COLUMN_ORDER.map((id) => columns.find((c) => c.colId === id)).filter(
1847
+ (c) => c !== void 0
1848
+ );
1849
+ }
1850
+ var DEFAULT_FACT_ROW_ACTIONS_LABELS = {
1851
+ actions: "Fact actions",
1852
+ edit: "Edit",
1853
+ editRestricted: "Only the creator or a workspace owner can reword this fact",
1854
+ delete: "Delete"
1855
+ };
1856
+ function FactRowActions({
1857
+ onEdit,
1858
+ canEdit = true,
1859
+ onDelete,
1860
+ labels,
1861
+ testIds
1862
+ }) {
1863
+ const l = { ...DEFAULT_FACT_ROW_ACTIONS_LABELS, ...labels };
1864
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
1865
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1866
+ "button",
1867
+ {
1868
+ type: "button",
1869
+ onClick: (e) => e.stopPropagation(),
1870
+ className: "flex size-6 pointer-coarse:size-11 items-center justify-center rounded text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground",
1871
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.trigger, { testId: "fact-row-actions" }),
1872
+ "aria-label": l.actions,
1873
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "size-4" })
1874
+ }
1875
+ ) }),
1876
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuContent, { align: "end", onClick: (e) => e.stopPropagation(), children: [
1877
+ /* @__PURE__ */ jsxRuntime.jsxs(
1878
+ ui.DropdownMenuItem,
1879
+ {
1880
+ onSelect: onEdit,
1881
+ disabled: !canEdit,
1882
+ title: canEdit ? void 0 : l.editRestricted,
1883
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.edit, { testId: "fact-action-edit" }),
1884
+ children: [
1885
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "mr-2 size-4" }),
1886
+ l.edit
1887
+ ]
1888
+ }
1889
+ ),
1890
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuSeparator, {}),
1891
+ /* @__PURE__ */ jsxRuntime.jsxs(
1892
+ ui.DropdownMenuItem,
1893
+ {
1894
+ onSelect: onDelete,
1895
+ className: "text-red-text focus:text-red-text",
1896
+ "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.delete, { testId: "fact-action-delete" }),
1897
+ children: [
1898
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "mr-2 size-4" }),
1899
+ l.delete
1900
+ ]
1901
+ }
1902
+ )
1903
+ ] })
1904
+ ] });
1905
+ }
1906
+
1907
+ exports.DEFAULT_FACTS_BULK_BAR_LABELS = DEFAULT_FACTS_BULK_BAR_LABELS;
1908
+ exports.DEFAULT_FACTS_EMPTY_STATE_LABELS = DEFAULT_FACTS_EMPTY_STATE_LABELS;
1909
+ exports.DEFAULT_FACTS_FIELDS_BUTTON_LABELS = DEFAULT_FACTS_FIELDS_BUTTON_LABELS;
1910
+ exports.DEFAULT_FACTS_TOOLBAR_LABELS = DEFAULT_FACTS_TOOLBAR_LABELS;
1911
+ exports.DEFAULT_FACTS_VIEW_TOGGLE_LABELS = DEFAULT_FACTS_VIEW_TOGGLE_LABELS;
1912
+ exports.DEFAULT_FACT_COLUMN_LABELS = DEFAULT_FACT_COLUMN_LABELS;
1913
+ exports.DEFAULT_FACT_COLUMN_ORDER = DEFAULT_FACT_COLUMN_ORDER;
1914
+ exports.DEFAULT_FACT_COMPOSER_LABELS = DEFAULT_FACT_COMPOSER_LABELS;
1915
+ exports.DEFAULT_FACT_DATE_INPUT_LABELS = DEFAULT_FACT_DATE_INPUT_LABELS;
1916
+ exports.DEFAULT_FACT_LABELS_CELL_LABELS = DEFAULT_FACT_LABELS_CELL_LABELS;
1917
+ exports.DEFAULT_FACT_ROW_ACTIONS_LABELS = DEFAULT_FACT_ROW_ACTIONS_LABELS;
1918
+ exports.DEFAULT_FACT_SOURCES_ROW_LABELS = DEFAULT_FACT_SOURCES_ROW_LABELS;
1919
+ exports.DEFAULT_FACT_SOURCE_GROUP_LABELS = DEFAULT_FACT_SOURCE_GROUP_LABELS;
1920
+ exports.DEFAULT_FACT_TIMELINE_LABELS = DEFAULT_FACT_TIMELINE_LABELS;
1921
+ exports.EMPTY_FACT_DATE_FIELDS = EMPTY_FACT_DATE_FIELDS;
1922
+ exports.FactComposer = FactComposer;
1923
+ exports.FactDateInput = FactDateInput;
1924
+ exports.FactFieldRow = FactFieldRow;
1925
+ exports.FactLabelsCell = FactLabelsCell;
1926
+ exports.FactRowActions = FactRowActions;
1927
+ exports.FactSourceGroup = FactSourceGroup;
1928
+ exports.FactSourcesRow = FactSourcesRow;
1929
+ exports.FactsBulkBar = FactsBulkBar;
1930
+ exports.FactsCalendar = FactsCalendar;
1931
+ exports.FactsEmptyState = FactsEmptyState;
1932
+ exports.FactsFieldsButton = FactsFieldsButton;
1933
+ exports.FactsGanttPane = FactsGanttPane;
1934
+ exports.FactsLoadError = FactsLoadError;
1935
+ exports.FactsLoading = FactsLoading;
1936
+ exports.FactsToolbar = FactsToolbar;
1937
+ exports.FactsViewToggle = FactsViewToggle;
1938
+ exports.ISO_DATE_FILTER_PARAMS = ISO_DATE_FILTER_PARAMS;
1939
+ exports.buildFactCitations = buildFactCitations;
1940
+ exports.chunkIdsOf = chunkIdsOf;
1941
+ exports.citedVersionRef = citedVersionRef;
1942
+ exports.createFactColumns = createFactColumns;
1943
+ exports.docIdsOf = docIdsOf;
1944
+ exports.enableFactTableColumnResize = enableFactTableColumnResize;
1945
+ exports.factDateFieldsToSpan = factDateFieldsToSpan;
1946
+ exports.factDateSpanToFields = factDateSpanToFields;
1947
+ exports.hasChunk = hasChunk;
1948
+ exports.isWholeDoc = isWholeDoc;
1949
+ exports.sourceDocCount = sourceDocCount;
1950
+ exports.toFactCitations = toFactCitations;
1951
+ exports.withChunk = withChunk;
1952
+ exports.withDoc = withDoc;
1953
+ exports.withoutChunk = withoutChunk;
1954
+ exports.withoutDoc = withoutDoc;
1955
+ //# sourceMappingURL=chunk-TAWPVD6C.cjs.map
1956
+ //# sourceMappingURL=chunk-TAWPVD6C.cjs.map