@arbidocs/blocks 0.5.153 → 0.5.154

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 (265) hide show
  1. package/dist/{ConnectedNativeDocxComparison-244UIHSM.cjs → ConnectedNativeDocxComparison-2DAQX5GX.cjs} +9 -9
  2. package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs.map → ConnectedNativeDocxComparison-2DAQX5GX.cjs.map} +1 -1
  3. package/dist/{ConnectedPresentation-JUXIXKYN.cjs → ConnectedPresentation-J42JPUVR.cjs} +13 -13
  4. package/dist/{ConnectedPresentation-JUXIXKYN.cjs.map → ConnectedPresentation-J42JPUVR.cjs.map} +1 -1
  5. package/dist/{ConnectedSlidesTab-JA3VB66W.cjs → ConnectedSlidesTab-BYS7HFNK.cjs} +12 -12
  6. package/dist/{ConnectedSlidesTab-JA3VB66W.cjs.map → ConnectedSlidesTab-BYS7HFNK.cjs.map} +1 -1
  7. package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs → ConnectedStreamedWordArtifact-LTYB62VM.cjs} +9 -9
  8. package/dist/{ConnectedNativeDocxComparison-244UIHSM.cjs.map → ConnectedStreamedWordArtifact-LTYB62VM.cjs.map} +1 -1
  9. package/dist/{DocumentReviewCard-5W2QQWKA.cjs → DocumentReviewCard-ILDLYZ5A.cjs} +15 -13
  10. package/dist/DocumentReviewCard-ILDLYZ5A.cjs.map +1 -0
  11. package/dist/{FilesViewerDialog-63QUTG4L.cjs → FilesViewerDialog-YLD5YFP2.cjs} +25 -22
  12. package/dist/FilesViewerDialog-YLD5YFP2.cjs.map +1 -0
  13. package/dist/{RechartsRenderer-NU6WUZJS.cjs → RechartsRenderer-EPVL5QZA.cjs} +2 -2
  14. package/dist/{RechartsRenderer-NU6WUZJS.cjs.map → RechartsRenderer-EPVL5QZA.cjs.map} +1 -1
  15. package/dist/{SpotlightStrip-HXQFPAAL.cjs → SpotlightStrip-JE6MXUBT.cjs} +6 -6
  16. package/dist/{SpotlightStrip-HXQFPAAL.cjs.map → SpotlightStrip-JE6MXUBT.cjs.map} +1 -1
  17. package/dist/{WorkspaceTableView-2QP2HJLK.cjs → WorkspaceTableView-V3N64LJG.cjs} +13 -11
  18. package/dist/WorkspaceTableView-V3N64LJG.cjs.map +1 -0
  19. package/dist/agents/index.cjs +245 -244
  20. package/dist/agents/workflows/WorkflowLauncher.d.ts +3 -1
  21. package/dist/agents/workflows/WorkflowLauncher.js +2 -0
  22. package/dist/agents/workflows/WorkflowLauncher.js.map +2 -2
  23. package/dist/{ai-ODGRIL6Y.cjs → ai-QFY4LYQZ.cjs} +16 -16
  24. package/dist/ai-QFY4LYQZ.cjs.map +1 -0
  25. package/dist/calls/index.cjs +25 -24
  26. package/dist/calls/index.cjs.map +1 -1
  27. package/dist/{chunk-MAKCWF45.cjs → chunk-6GKCGCMT.cjs} +4 -4
  28. package/dist/{chunk-MAKCWF45.cjs.map → chunk-6GKCGCMT.cjs.map} +1 -1
  29. package/dist/{chunk-LYKT336H.cjs → chunk-6I5HHWCD.cjs} +5 -5
  30. package/dist/{chunk-LYKT336H.cjs.map → chunk-6I5HHWCD.cjs.map} +1 -1
  31. package/dist/{chunk-KWJW5TMH.cjs → chunk-6OPDKROP.cjs} +4 -41
  32. package/dist/chunk-6OPDKROP.cjs.map +1 -0
  33. package/dist/{chunk-QWOPEBH2.cjs → chunk-6P4U63HO.cjs} +4 -4
  34. package/dist/{chunk-QWOPEBH2.cjs.map → chunk-6P4U63HO.cjs.map} +1 -1
  35. package/dist/{chunk-QKCFV36K.cjs → chunk-7UPEFZCV.cjs} +9 -9
  36. package/dist/{chunk-QKCFV36K.cjs.map → chunk-7UPEFZCV.cjs.map} +1 -1
  37. package/dist/{chunk-DUNXLT63.cjs → chunk-AHUEBRLX.cjs} +2 -238
  38. package/dist/chunk-AHUEBRLX.cjs.map +1 -0
  39. package/dist/{chunk-B5BGVPQ5.cjs → chunk-AURL2KT5.cjs} +4 -4
  40. package/dist/{chunk-B5BGVPQ5.cjs.map → chunk-AURL2KT5.cjs.map} +1 -1
  41. package/dist/chunk-BH322H5B.cjs +594 -0
  42. package/dist/chunk-BH322H5B.cjs.map +1 -0
  43. package/dist/{chunk-ZCQXQIBA.cjs → chunk-BNDIMTWJ.cjs} +28 -28
  44. package/dist/{chunk-ZCQXQIBA.cjs.map → chunk-BNDIMTWJ.cjs.map} +1 -1
  45. package/dist/{chunk-AG6KAGAX.cjs → chunk-BTQ7IAOH.cjs} +4 -4
  46. package/dist/{chunk-AG6KAGAX.cjs.map → chunk-BTQ7IAOH.cjs.map} +1 -1
  47. package/dist/{chunk-FCT62ZPE.cjs → chunk-BZVK7JW5.cjs} +5 -5
  48. package/dist/{chunk-FCT62ZPE.cjs.map → chunk-BZVK7JW5.cjs.map} +1 -1
  49. package/dist/{chunk-WUM76MJU.cjs → chunk-CNBYM5Q7.cjs} +7 -7
  50. package/dist/{chunk-WUM76MJU.cjs.map → chunk-CNBYM5Q7.cjs.map} +1 -1
  51. package/dist/{chunk-HNLNRAEU.cjs → chunk-DSLMJ24E.cjs} +2 -261
  52. package/dist/chunk-DSLMJ24E.cjs.map +1 -0
  53. package/dist/chunk-DWRUGOTQ.cjs +35 -0
  54. package/dist/chunk-DWRUGOTQ.cjs.map +1 -0
  55. package/dist/{chunk-GAA222SK.cjs → chunk-EG3DPKXM.cjs} +5 -5
  56. package/dist/{chunk-GAA222SK.cjs.map → chunk-EG3DPKXM.cjs.map} +1 -1
  57. package/dist/chunk-FEAHTNTY.cjs +1447 -0
  58. package/dist/chunk-FEAHTNTY.cjs.map +1 -0
  59. package/dist/{chunk-VSDD5TH5.cjs → chunk-G3MRW4WB.cjs} +10 -8
  60. package/dist/chunk-G3MRW4WB.cjs.map +1 -0
  61. package/dist/{chunk-TFRCNIUY.cjs → chunk-GF6AYAMI.cjs} +9 -9
  62. package/dist/{chunk-TFRCNIUY.cjs.map → chunk-GF6AYAMI.cjs.map} +1 -1
  63. package/dist/{chunk-4ZR4O5SP.cjs → chunk-GK3U3FWY.cjs} +60 -28
  64. package/dist/chunk-GK3U3FWY.cjs.map +1 -0
  65. package/dist/{chunk-3CJTO6RV.cjs → chunk-GXRD5OSU.cjs} +8 -8
  66. package/dist/{chunk-3CJTO6RV.cjs.map → chunk-GXRD5OSU.cjs.map} +1 -1
  67. package/dist/{chunk-JLNKD56X.cjs → chunk-GYI4UXX6.cjs} +4 -4
  68. package/dist/{chunk-JLNKD56X.cjs.map → chunk-GYI4UXX6.cjs.map} +1 -1
  69. package/dist/{chunk-4I2PCP7O.cjs → chunk-I3XTTTPZ.cjs} +41 -40
  70. package/dist/chunk-I3XTTTPZ.cjs.map +1 -0
  71. package/dist/chunk-JWCVA4LC.cjs +248 -0
  72. package/dist/chunk-JWCVA4LC.cjs.map +1 -0
  73. package/dist/{chunk-UM3EWCDE.cjs → chunk-K5F2VNCX.cjs} +35 -10
  74. package/dist/chunk-K5F2VNCX.cjs.map +1 -0
  75. package/dist/chunk-KD66CBYO.cjs +44 -0
  76. package/dist/chunk-KD66CBYO.cjs.map +1 -0
  77. package/dist/chunk-LLVE5TST.cjs +318 -0
  78. package/dist/chunk-LLVE5TST.cjs.map +1 -0
  79. package/dist/{chunk-JCFXS336.cjs → chunk-NRGLF4J4.cjs} +2 -466
  80. package/dist/chunk-NRGLF4J4.cjs.map +1 -0
  81. package/dist/{chunk-CVVQHFLR.cjs → chunk-O7U6KL2W.cjs} +72 -650
  82. package/dist/chunk-O7U6KL2W.cjs.map +1 -0
  83. package/dist/{chunk-Z3N32LL4.cjs → chunk-OOANNOH4.cjs} +35 -33
  84. package/dist/chunk-OOANNOH4.cjs.map +1 -0
  85. package/dist/chunk-SGYURQ23.cjs +271 -0
  86. package/dist/chunk-SGYURQ23.cjs.map +1 -0
  87. package/dist/{chunk-A5SKK3CU.cjs → chunk-SLCH5JRI.cjs} +64 -35
  88. package/dist/chunk-SLCH5JRI.cjs.map +1 -0
  89. package/dist/chunk-T26UYA6Q.cjs +64 -0
  90. package/dist/chunk-T26UYA6Q.cjs.map +1 -0
  91. package/dist/chunk-T3Y3LZ4Y.cjs +477 -0
  92. package/dist/chunk-T3Y3LZ4Y.cjs.map +1 -0
  93. package/dist/{chunk-4XNP27N4.cjs → chunk-T7BUGVSG.cjs} +36 -36
  94. package/dist/{chunk-4XNP27N4.cjs.map → chunk-T7BUGVSG.cjs.map} +1 -1
  95. package/dist/{chunk-SMO4SPPB.cjs → chunk-TD5V5BZ3.cjs} +5 -5
  96. package/dist/{chunk-SMO4SPPB.cjs.map → chunk-TD5V5BZ3.cjs.map} +1 -1
  97. package/dist/{chunk-IXTDOPSB.cjs → chunk-TSAZWUPZ.cjs} +4 -4
  98. package/dist/{chunk-IXTDOPSB.cjs.map → chunk-TSAZWUPZ.cjs.map} +1 -1
  99. package/dist/{chunk-5DGNJ6VJ.cjs → chunk-UD3LPATQ.cjs} +6 -6
  100. package/dist/{chunk-5DGNJ6VJ.cjs.map → chunk-UD3LPATQ.cjs.map} +1 -1
  101. package/dist/{chunk-OF7KMG6R.cjs → chunk-UJHQ4DA4.cjs} +5 -5
  102. package/dist/{chunk-OF7KMG6R.cjs.map → chunk-UJHQ4DA4.cjs.map} +1 -1
  103. package/dist/{chunk-NUFZFWHZ.cjs → chunk-W5QSKW7T.cjs} +3 -29
  104. package/dist/chunk-W5QSKW7T.cjs.map +1 -0
  105. package/dist/{chunk-NNZFZYTI.cjs → chunk-WOVNXJK5.cjs} +4 -54
  106. package/dist/chunk-WOVNXJK5.cjs.map +1 -0
  107. package/dist/{chunk-E6BM5ENI.cjs → chunk-WRTEKOQP.cjs} +2 -309
  108. package/dist/chunk-WRTEKOQP.cjs.map +1 -0
  109. package/dist/{chunk-KRQCUVH7.cjs → chunk-YSAUOJA7.cjs} +9 -3
  110. package/dist/chunk-YSAUOJA7.cjs.map +1 -0
  111. package/dist/{chunk-6ZZWQ3OL.cjs → chunk-YXY52OGU.cjs} +4 -4
  112. package/dist/{chunk-6ZZWQ3OL.cjs.map → chunk-YXY52OGU.cjs.map} +1 -1
  113. package/dist/{chunk-D5DOK2AE.cjs → chunk-ZW2ZFC3Q.cjs} +58 -58
  114. package/dist/{chunk-D5DOK2AE.cjs.map → chunk-ZW2ZFC3Q.cjs.map} +1 -1
  115. package/dist/components/gestures/usePointerGesture.d.ts +13 -1
  116. package/dist/components/gestures/usePointerGesture.js +33 -8
  117. package/dist/components/gestures/usePointerGesture.js.map +2 -2
  118. package/dist/connect/docx.cjs +12 -12
  119. package/dist/connect/index.cjs +1281 -2346
  120. package/dist/connect/index.cjs.map +1 -1
  121. package/dist/connect/index.d.ts +1 -0
  122. package/dist/connect/index.js +1 -0
  123. package/dist/connect/index.js.map +2 -2
  124. package/dist/connect/viewer.cjs +15 -12
  125. package/dist/connection/dashboards/DashboardPanel.d.ts +2 -0
  126. package/dist/connection/dashboards/DashboardPanel.js +4 -0
  127. package/dist/connection/dashboards/DashboardPanel.js.map +2 -2
  128. package/dist/connection/dashboards/index.d.ts +1 -1
  129. package/dist/connection/dashboards/index.js +2 -0
  130. package/dist/connection/dashboards/index.js.map +2 -2
  131. package/dist/connection/dashboards/templates.d.ts +10 -5
  132. package/dist/connection/dashboards/templates.js +7 -1
  133. package/dist/connection/dashboards/templates.js.map +2 -2
  134. package/dist/connection/live-blocks/ConnectedAgendaBlock.d.ts +13 -0
  135. package/dist/connection/live-blocks/ConnectedAgendaBlock.js +19 -0
  136. package/dist/connection/live-blocks/ConnectedAgendaBlock.js.map +7 -0
  137. package/dist/connection/live-blocks/ConnectedCarouselBlock.d.ts +7 -0
  138. package/dist/connection/live-blocks/ConnectedCarouselBlock.js +84 -0
  139. package/dist/connection/live-blocks/ConnectedCarouselBlock.js.map +7 -0
  140. package/dist/connection/live-blocks/ConnectedListBlock.d.ts +29 -0
  141. package/dist/connection/live-blocks/ConnectedListBlock.js +193 -0
  142. package/dist/connection/live-blocks/ConnectedListBlock.js.map +7 -0
  143. package/dist/connection/live-blocks/ConnectedStartBlock.d.ts +7 -0
  144. package/dist/connection/live-blocks/ConnectedStartBlock.js +16 -0
  145. package/dist/connection/live-blocks/ConnectedStartBlock.js.map +7 -0
  146. package/dist/connection/live-blocks/DashboardAgenda.d.ts +10 -0
  147. package/dist/connection/{workspace-dashboard → live-blocks}/DashboardAgenda.js +10 -2
  148. package/dist/connection/live-blocks/DashboardAgenda.js.map +7 -0
  149. package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js.map +1 -1
  150. package/dist/connection/live-blocks/LiveBlockRoot.d.ts +11 -0
  151. package/dist/connection/live-blocks/LiveBlockRoot.js +22 -0
  152. package/dist/connection/live-blocks/LiveBlockRoot.js.map +7 -0
  153. package/dist/connection/live-blocks/index.d.ts +5 -0
  154. package/dist/connection/live-blocks/index.js +20 -0
  155. package/dist/connection/live-blocks/index.js.map +7 -0
  156. package/dist/connection/{workspace-dashboard/dashboard-rows.d.ts → live-blocks/list-rows.d.ts} +22 -4
  157. package/dist/connection/{workspace-dashboard/dashboard-rows.js → live-blocks/list-rows.js} +13 -8
  158. package/dist/connection/live-blocks/list-rows.js.map +7 -0
  159. package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js.map +1 -1
  160. package/dist/connection/live-blocks/workspace-dashboard-blocks.d.ts +23 -0
  161. package/dist/connection/live-blocks/workspace-dashboard-blocks.js +58 -0
  162. package/dist/connection/live-blocks/workspace-dashboard-blocks.js.map +7 -0
  163. package/dist/connection/pages/BlockEditor.d.ts +3 -1
  164. package/dist/connection/pages/BlockEditor.js +18 -1
  165. package/dist/connection/pages/BlockEditor.js.map +2 -2
  166. package/dist/connection/pages/ConnectedPagesPage.d.ts +5 -4
  167. package/dist/connection/pages/ConnectedPagesPage.js +122 -46
  168. package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
  169. package/dist/connection/pages/EditablePageGrid.d.ts +25 -15
  170. package/dist/connection/pages/EditablePageGrid.js +145 -50
  171. package/dist/connection/pages/EditablePageGrid.js.map +2 -2
  172. package/dist/connection/pages/LiveBlockEditor.d.ts +30 -0
  173. package/dist/connection/pages/LiveBlockEditor.js +175 -0
  174. package/dist/connection/pages/LiveBlockEditor.js.map +7 -0
  175. package/dist/connection/pages/PageBlockView.d.ts +5 -3
  176. package/dist/connection/pages/PageBlockView.js +69 -4
  177. package/dist/connection/pages/PageBlockView.js.map +2 -2
  178. package/dist/connection/pages/PageGrid.d.ts +4 -3
  179. package/dist/connection/pages/PageGrid.js +4 -2
  180. package/dist/connection/pages/PageGrid.js.map +2 -2
  181. package/dist/connection/pages/PagesList.d.ts +4 -3
  182. package/dist/connection/pages/PagesList.js.map +2 -2
  183. package/dist/connection/pages/grid-layout.d.ts +44 -12
  184. package/dist/connection/pages/grid-layout.js +71 -27
  185. package/dist/connection/pages/grid-layout.js.map +2 -2
  186. package/dist/connection/pages/index.d.ts +4 -2
  187. package/dist/connection/pages/index.js +34 -5
  188. package/dist/connection/pages/index.js.map +2 -2
  189. package/dist/connection/pages/labels.js +5 -1
  190. package/dist/connection/pages/labels.js.map +2 -2
  191. package/dist/connection/pages/page-templates.d.ts +10 -0
  192. package/dist/connection/pages/page-templates.js +16 -0
  193. package/dist/connection/pages/page-templates.js.map +7 -0
  194. package/dist/connection/workflows/ConnectedWorkflowStart.d.ts +2 -0
  195. package/dist/connection/workflows/ConnectedWorkflowStart.js.map +2 -2
  196. package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.d.ts +10 -7
  197. package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js +31 -171
  198. package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js.map +3 -3
  199. package/dist/dashboards/ChartRenderer.d.ts +5 -3
  200. package/dist/dashboards/ChartRenderer.js +29 -18
  201. package/dist/dashboards/ChartRenderer.js.map +2 -2
  202. package/dist/dashboards/PanelView.d.ts +6 -1
  203. package/dist/dashboards/PanelView.js +24 -7
  204. package/dist/dashboards/PanelView.js.map +2 -2
  205. package/dist/dashboards/RechartsRenderer.d.ts +2 -1
  206. package/dist/dashboards/RechartsRenderer.js.map +2 -2
  207. package/dist/dashboards/index.cjs +25 -21
  208. package/dist/embed/index.cjs +23 -20
  209. package/dist/files/index.cjs +250 -249
  210. package/dist/home/FactsStrip.d.ts +3 -1
  211. package/dist/home/FactsStrip.js +3 -2
  212. package/dist/home/FactsStrip.js.map +2 -2
  213. package/dist/home/RecentList.d.ts +4 -2
  214. package/dist/home/RecentList.js +3 -2
  215. package/dist/home/RecentList.js.map +2 -2
  216. package/dist/home/StartTiles.d.ts +6 -1
  217. package/dist/home/StartTiles.js +55 -33
  218. package/dist/home/StartTiles.js.map +2 -2
  219. package/dist/home/index.cjs +62 -57
  220. package/dist/home/index.d.ts +1 -1
  221. package/dist/home/index.js +2 -1
  222. package/dist/home/index.js.map +2 -2
  223. package/dist/home/sections.d.ts +5 -0
  224. package/dist/home/sections.js +7 -0
  225. package/dist/home/sections.js.map +2 -2
  226. package/dist/index.cjs +339 -337
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/pages/index.cjs +620 -139
  229. package/dist/pages/index.cjs.map +1 -1
  230. package/dist/settings/index.cjs +170 -169
  231. package/dist/shell/index.cjs +35 -34
  232. package/dist/studio/index.cjs +12 -12
  233. package/dist/styles.css +1 -1
  234. package/dist/workflow-canvas/index.cjs +33 -29
  235. package/dist/workflow-canvas/index.cjs.map +1 -1
  236. package/dist/workspaces/index.cjs +49 -47
  237. package/dist/workspaces/index.cjs.map +1 -1
  238. package/node_modules/@arbidocs/coedit/package.json +1 -1
  239. package/package.json +5 -5
  240. package/dist/DocumentReviewCard-5W2QQWKA.cjs.map +0 -1
  241. package/dist/FilesViewerDialog-63QUTG4L.cjs.map +0 -1
  242. package/dist/WorkspaceTableView-2QP2HJLK.cjs.map +0 -1
  243. package/dist/ai-ODGRIL6Y.cjs.map +0 -1
  244. package/dist/chunk-4I2PCP7O.cjs.map +0 -1
  245. package/dist/chunk-4ZR4O5SP.cjs.map +0 -1
  246. package/dist/chunk-A5SKK3CU.cjs.map +0 -1
  247. package/dist/chunk-CVVQHFLR.cjs.map +0 -1
  248. package/dist/chunk-DUNXLT63.cjs.map +0 -1
  249. package/dist/chunk-E6BM5ENI.cjs.map +0 -1
  250. package/dist/chunk-HNLNRAEU.cjs.map +0 -1
  251. package/dist/chunk-JCFXS336.cjs.map +0 -1
  252. package/dist/chunk-KRQCUVH7.cjs.map +0 -1
  253. package/dist/chunk-KWJW5TMH.cjs.map +0 -1
  254. package/dist/chunk-NNZFZYTI.cjs.map +0 -1
  255. package/dist/chunk-NUFZFWHZ.cjs.map +0 -1
  256. package/dist/chunk-UM3EWCDE.cjs.map +0 -1
  257. package/dist/chunk-VSDD5TH5.cjs.map +0 -1
  258. package/dist/chunk-Z3N32LL4.cjs.map +0 -1
  259. package/dist/connection/workspace-dashboard/DashboardAgenda.d.ts +0 -1
  260. package/dist/connection/workspace-dashboard/DashboardAgenda.js.map +0 -7
  261. package/dist/connection/workspace-dashboard/dashboard-rows.js.map +0 -7
  262. /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.d.ts +0 -0
  263. /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js +0 -0
  264. /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.d.ts +0 -0
  265. /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js +0 -0
@@ -0,0 +1,1447 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkDWRUGOTQ_cjs = require('./chunk-DWRUGOTQ.cjs');
5
+ var chunk7UPEFZCV_cjs = require('./chunk-7UPEFZCV.cjs');
6
+ var chunkV27WLYTG_cjs = require('./chunk-V27WLYTG.cjs');
7
+ var chunkSGYURQ23_cjs = require('./chunk-SGYURQ23.cjs');
8
+ var chunkJWCVA4LC_cjs = require('./chunk-JWCVA4LC.cjs');
9
+ var chunkT3Y3LZ4Y_cjs = require('./chunk-T3Y3LZ4Y.cjs');
10
+ var chunk5GBM7BQB_cjs = require('./chunk-5GBM7BQB.cjs');
11
+ var chunkWRTEKOQP_cjs = require('./chunk-WRTEKOQP.cjs');
12
+ var chunkBH322H5B_cjs = require('./chunk-BH322H5B.cjs');
13
+ var chunkM55XUF4L_cjs = require('./chunk-M55XUF4L.cjs');
14
+ var chunkSLCH5JRI_cjs = require('./chunk-SLCH5JRI.cjs');
15
+ var chunk4M3OIBIS_cjs = require('./chunk-4M3OIBIS.cjs');
16
+ var chunkQUMUAJ2P_cjs = require('./chunk-QUMUAJ2P.cjs');
17
+ var chunkT26UYA6Q_cjs = require('./chunk-T26UYA6Q.cjs');
18
+ var chunkDWN5AUMH_cjs = require('./chunk-DWN5AUMH.cjs');
19
+ var chunkGB5MN5FC_cjs = require('./chunk-GB5MN5FC.cjs');
20
+ var chunkTMX7YFVM_cjs = require('./chunk-TMX7YFVM.cjs');
21
+ var chunk46LX6EQT_cjs = require('./chunk-46LX6EQT.cjs');
22
+ var react$1 = require('react');
23
+ var lucideReact = require('lucide-react');
24
+ var react = require('@arbidocs/react');
25
+ var ui = require('@arbidocs/react/ui');
26
+ var jsxRuntime = require('react/jsx-runtime');
27
+ var client = require('@arbidocs/client');
28
+ var shell = require('@arbidocs/react/shell');
29
+
30
+ function ConnectedWorkspaceEntity({
31
+ workspace,
32
+ size = 24,
33
+ isSelected = false,
34
+ className = "",
35
+ variant = "pill",
36
+ interactive = true,
37
+ showTooltip = true,
38
+ labelMaxWidth = "max-w-[10ch]",
39
+ ...shieldProps
40
+ }) {
41
+ const name = workspace.name;
42
+ const workspaceColor = chunkWRTEKOQP_cjs.workspaceKindColor(react.getWorkspaceKind(workspace));
43
+ const shield = /* @__PURE__ */ jsxRuntime.jsx(
44
+ ui.ShieldIcon,
45
+ {
46
+ char: name.charAt(0),
47
+ workspaceColor,
48
+ size: variant === "pill" ? 24 : size,
49
+ isSelected,
50
+ className: variant === "icon" ? className : "",
51
+ ...shieldProps
52
+ }
53
+ );
54
+ const documentCount = (workspace.shared_document_count ?? 0) + (workspace.private_document_count ?? 0);
55
+ const conversationCount = (workspace.shared_conversation_count ?? 0) + (workspace.private_conversation_count ?? 0);
56
+ const tooltipContent = /* @__PURE__ */ jsxRuntime.jsxs(chunkTMX7YFVM_cjs.EntityTooltip, { children: [
57
+ /* @__PURE__ */ jsxRuntime.jsx(
58
+ chunkTMX7YFVM_cjs.EntityTooltipHeader,
59
+ {
60
+ lead: /* @__PURE__ */ jsxRuntime.jsx(
61
+ ui.ShieldIcon,
62
+ {
63
+ char: name.charAt(0),
64
+ workspaceColor,
65
+ size: 24,
66
+ isSelected: false
67
+ }
68
+ ),
69
+ title: name,
70
+ subtitle: workspace.description,
71
+ trailing: /* @__PURE__ */ jsxRuntime.jsx(chunkDWRUGOTQ_cjs.WorkspaceTypeBadge, { workspace, size: "sm" })
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsxRuntime.jsx(
75
+ chunkTMX7YFVM_cjs.EntityTooltipStats,
76
+ {
77
+ stats: [
78
+ {
79
+ key: "documents",
80
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ui.EntityIcon, { entityType: "DOCUMENT", className: "h-3.5 w-3.5 text-muted-foreground" }),
81
+ label: ui.getEntityLabel("DOCUMENT", "PLURAL"),
82
+ value: documentCount
83
+ },
84
+ {
85
+ key: "conversations",
86
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ui.EntityIcon, { entityType: "CONVERSATION", className: "h-3.5 w-3.5 text-muted-foreground" }),
87
+ label: ui.getEntityLabel("CONVERSATION", "PLURAL"),
88
+ value: conversationCount
89
+ },
90
+ {
91
+ key: "storage",
92
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.HardDrive, { className: "h-3.5 w-3.5 text-muted-foreground" }),
93
+ label: "Storage",
94
+ value: `${Math.round(workspace.user_files_mb ?? 0)} MB`
95
+ }
96
+ ]
97
+ }
98
+ ),
99
+ workspace.updated_at && /* @__PURE__ */ jsxRuntime.jsxs(chunkTMX7YFVM_cjs.EntityTooltipHint, { children: [
100
+ "Updated ",
101
+ ui.formatFriendlyDate(workspace.updated_at)
102
+ ] }),
103
+ interactive && variant !== "icon" && /* @__PURE__ */ jsxRuntime.jsxs(chunkTMX7YFVM_cjs.EntityTooltipHint, { icon: /* @__PURE__ */ jsxRuntime.jsx(ui.EntityIcon, { entityType: "WORKSPACE", className: "w-3 h-3" }), children: [
104
+ "Click to open ",
105
+ ui.getEntityLabel("WORKSPACE").toLowerCase(),
106
+ " settings"
107
+ ] })
108
+ ] });
109
+ if (variant === "icon") {
110
+ if (!showTooltip) return shield;
111
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx(
113
+ ui.TooltipTrigger,
114
+ {
115
+ onFocusCapture: (e) => e.stopPropagation(),
116
+ className: "touch-hit inline-flex",
117
+ children: shield
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { className: "p-2", children: tooltipContent })
121
+ ] });
122
+ }
123
+ const pill = {
124
+ icon: shield,
125
+ label: name,
126
+ tooltipContent: showTooltip ? tooltipContent : void 0,
127
+ className,
128
+ labelMaxWidth
129
+ };
130
+ if (!interactive) return /* @__PURE__ */ jsxRuntime.jsx(ui.EntityPill, { ...pill, shape: "rounded" });
131
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenableWorkspacePill, { ...pill, workspaceId: workspace.external_id, name });
132
+ }
133
+ function OpenableWorkspacePill({
134
+ workspaceId,
135
+ name,
136
+ icon,
137
+ label,
138
+ tooltipContent,
139
+ className,
140
+ labelMaxWidth
141
+ }) {
142
+ const { openWorkspace } = chunkGB5MN5FC_cjs.useConnectedWorkspace();
143
+ const onClick = react$1.useCallback(
144
+ (e) => {
145
+ e.stopPropagation();
146
+ void openWorkspace(workspaceId, { name });
147
+ },
148
+ [openWorkspace, workspaceId, name]
149
+ );
150
+ return /* @__PURE__ */ jsxRuntime.jsx(
151
+ ui.EntityPill,
152
+ {
153
+ icon,
154
+ label,
155
+ shape: "rounded",
156
+ onClick,
157
+ tooltipContent,
158
+ className,
159
+ labelMaxWidth
160
+ }
161
+ );
162
+ }
163
+ function resolveAttendeeUsers(attendees, known, me) {
164
+ const byId = new Map(known.map((u) => [u.external_id, u]));
165
+ const byEmail = new Map(known.filter((u) => u.email).map((u) => [u.email.toLowerCase(), u]));
166
+ const out = /* @__PURE__ */ new Map();
167
+ for (const a of attendees) {
168
+ if (a.kind === "room" || a.kind === "resource") continue;
169
+ const u = a.user_id && byId.get(a.user_id) || a.email && byEmail.get(a.email.toLowerCase());
170
+ if (!u || u.is_agent || !u.encryption_public_key || u.external_id === me) continue;
171
+ out.set(chunk4M3OIBIS_cjs.attendeeKey(a), {
172
+ external_id: u.external_id,
173
+ encryption_public_key: u.encryption_public_key
174
+ });
175
+ }
176
+ return out;
177
+ }
178
+ var distinctPeers = (users) => [
179
+ ...new Map([...users.values()].map((p) => [p.external_id, p])).values()
180
+ ];
181
+ function resolveCallPeers(attendees, known, me) {
182
+ return distinctPeers(resolveAttendeeUsers(attendees, known, me));
183
+ }
184
+ async function resolveAttendeeUsersRemote(arbi, attendees, known, me) {
185
+ const people = attendees.filter((a) => a.kind !== "room" && a.kind !== "resource");
186
+ const local = resolveAttendeeUsers(people, known, me);
187
+ const have = new Set([...local.values()].map((p) => p.external_id));
188
+ const knownEmails = new Set(
189
+ known.filter((u) => have.has(u.external_id) && u.email).map((u) => u.email.toLowerCase())
190
+ );
191
+ const emails = people.map((a) => a.email?.toLowerCase()).filter((e) => !!e && !knownEmails.has(e));
192
+ const userIds = people.map((a) => a.user_id).filter((id) => !!id && !have.has(id));
193
+ if (!emails.length && !userIds.length) return local;
194
+ try {
195
+ const found = await arbi.calendar.peopleKeys({ emails, user_ids: userIds });
196
+ const extra = resolveAttendeeUsers(
197
+ people.filter((a) => !local.has(chunk4M3OIBIS_cjs.attendeeKey(a))),
198
+ found.map((f) => ({
199
+ external_id: f.user_id,
200
+ email: f.email,
201
+ encryption_public_key: f.encryption_public_key
202
+ })),
203
+ me
204
+ );
205
+ for (const [key, p] of extra) local.set(key, p);
206
+ } catch {
207
+ }
208
+ return local;
209
+ }
210
+ async function resolveCallPeersRemote(arbi, attendees, known, me) {
211
+ return distinctPeers(await resolveAttendeeUsersRemote(arbi, attendees, known, me));
212
+ }
213
+ function webinarRolesByUser(roles, users) {
214
+ const out = {};
215
+ for (const [key, peer] of users) out[peer.external_id] = roles?.[key] ?? "attendee";
216
+ return out;
217
+ }
218
+ var isTeam = (role) => role === "cohost" || role === "panelist";
219
+ function parseArbiCallUrl(url, origin = window.location.origin) {
220
+ if (!url) return null;
221
+ let u;
222
+ try {
223
+ u = new URL(url);
224
+ } catch {
225
+ return null;
226
+ }
227
+ if (u.origin !== origin) return null;
228
+ const m = /^\/call\/(call-[A-Za-z0-9_-]{4,64})\/?$/.exec(u.pathname);
229
+ if (!m) return null;
230
+ const frag = client.parseCallFragment(u.hash);
231
+ if (!frag) return null;
232
+ return { callId: m[1], key: frag.key, linkVersion: frag.linkVersion };
233
+ }
234
+ async function createEventCall(arbi, opts) {
235
+ const roles = opts.webinar?.roles;
236
+ const { call, key, title, sealedKeys } = await arbi.calls.start({
237
+ title: opts.title,
238
+ invitees: opts.peers,
239
+ mode: roles ? "webinar" : "call",
240
+ joinPolicy: "invited",
241
+ roles
242
+ });
243
+ const members = opts.peers.filter(
244
+ (p) => p.external_id in sealedKeys && (!roles || isTeam(roles[p.external_id]))
245
+ );
246
+ if (members.length) {
247
+ try {
248
+ await arbi.calls.createChat({ callExtId: call.external_id, callKey: key, title, members });
249
+ } catch (err) {
250
+ console.warn("[calendar] could not create the meeting chat; it is made on first use", err);
251
+ }
252
+ }
253
+ return { call_id: call.external_id, url: react.callLink(call.external_id, key, call.link_version) };
254
+ }
255
+ async function shareEventCall(arbi, conference, peers) {
256
+ if (conference?.type !== "arbi" || !peers.length) return 0;
257
+ const parsed = parseArbiCallUrl(conference.url);
258
+ if (!parsed) return 0;
259
+ const sealed = await arbi.calls.sealFor(parsed.key, peers);
260
+ if (!Object.keys(sealed).length) return 0;
261
+ await arbi.calls.update(parsed.callId, { sealed_keys: sealed });
262
+ return Object.keys(sealed).length;
263
+ }
264
+ async function loadEventWebinar(arbi, url, attendees) {
265
+ const parsed = parseArbiCallUrl(url);
266
+ if (!parsed) return null;
267
+ const call = await arbi.calls.get(parsed.callId);
268
+ if (call.mode !== "webinar") return null;
269
+ const roles = {};
270
+ for (const inv of call.invitees ?? []) {
271
+ const a = attendees.find(
272
+ (x) => x.user_id === inv.user_ext_id || !!x.email && x.email.toLowerCase() === inv.email?.toLowerCase()
273
+ );
274
+ if (a) roles[chunk4M3OIBIS_cjs.attendeeKey(a)] = inv.role ?? "attendee";
275
+ }
276
+ return roles;
277
+ }
278
+ async function updateEventWebinarRoles(arbi, url, roles, peers) {
279
+ const parsed = parseArbiCallUrl(url);
280
+ if (!parsed) return;
281
+ const call = await arbi.calls.get(parsed.callId);
282
+ const current = new Map((call.invitees ?? []).map((i) => [i.user_ext_id, i.role ?? "attendee"]));
283
+ const changed = Object.fromEntries(
284
+ Object.entries(roles).filter(([usr, role]) => current.has(usr) && current.get(usr) !== role)
285
+ );
286
+ if (Object.keys(changed).length) await arbi.calls.update(parsed.callId, { roles: changed });
287
+ const team = peers.filter((p) => current.has(p.external_id) && isTeam(roles[p.external_id]));
288
+ if (!team.length) return;
289
+ try {
290
+ await arbi.calls.createChat({ callExtId: parsed.callId, callKey: parsed.key, members: team });
291
+ } catch (err) {
292
+ console.warn("[calendar] could not create the webinar team chat; it is made on first use", err);
293
+ }
294
+ }
295
+ async function joinEventMeeting(arbi, url) {
296
+ if (!url) return;
297
+ const parsed = parseArbiCallUrl(url);
298
+ if (parsed) {
299
+ await react.openCall(arbi, {
300
+ callExtId: parsed.callId,
301
+ key: parsed.key,
302
+ linkVersion: parsed.linkVersion
303
+ });
304
+ return;
305
+ }
306
+ if (/^(https?:\/\/|tel:)/i.test(url)) window.open(url, "_blank", "noopener,noreferrer");
307
+ }
308
+ function useCopyToClipboard({
309
+ text,
310
+ copyMessage = "Copied to clipboard!",
311
+ failureMessage = "Failed to copy to clipboard."
312
+ }) {
313
+ const { notify } = chunk46LX6EQT_cjs.useBlocksEnvironment();
314
+ const [isCopied, setIsCopied] = react$1.useState(false);
315
+ const timeoutRef = react$1.useRef(null);
316
+ react$1.useEffect(
317
+ () => () => {
318
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
319
+ },
320
+ []
321
+ );
322
+ const handleCopy = react$1.useCallback(() => {
323
+ navigator.clipboard.writeText(text).then(() => {
324
+ notify(copyMessage, "success");
325
+ setIsCopied(true);
326
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
327
+ timeoutRef.current = setTimeout(() => {
328
+ timeoutRef.current = null;
329
+ setIsCopied(false);
330
+ }, 2e3);
331
+ }).catch(() => {
332
+ notify(failureMessage, "error");
333
+ });
334
+ }, [text, copyMessage, failureMessage, notify]);
335
+ return { isCopied, handleCopy };
336
+ }
337
+ function CopyButton({ content, copyMessage, label = "Copy to clipboard" }) {
338
+ const { isCopied, handleCopy } = useCopyToClipboard({ text: content, copyMessage });
339
+ return /* @__PURE__ */ jsxRuntime.jsxs(
340
+ ui.Button,
341
+ {
342
+ variant: "ghost",
343
+ size: "icon",
344
+ className: "relative h-6 w-6",
345
+ "aria-label": label,
346
+ onClick: handleCopy,
347
+ "data-testid": "copy-button",
348
+ children: [
349
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
350
+ lucideReact.Check,
351
+ {
352
+ className: ui.cn(
353
+ "h-4 w-4 transition-transform ease-in-out",
354
+ isCopied ? "scale-100" : "scale-0"
355
+ )
356
+ }
357
+ ) }),
358
+ /* @__PURE__ */ jsxRuntime.jsx(
359
+ lucideReact.Copy,
360
+ {
361
+ className: ui.cn(
362
+ "h-4 w-4 transition-transform ease-in-out",
363
+ isCopied ? "scale-0" : "scale-100"
364
+ )
365
+ }
366
+ )
367
+ ]
368
+ }
369
+ );
370
+ }
371
+ function displayDomain(domain) {
372
+ return domain.startsWith("www.") ? domain.slice(4) : domain;
373
+ }
374
+ var detailOf = (err) => err?.detail;
375
+ function ConnectedEmailWorkspaceDialog({
376
+ open,
377
+ onOpenChange,
378
+ workspace,
379
+ isMember,
380
+ labels
381
+ }) {
382
+ const { confirm, notify, runtimeConfig } = chunk46LX6EQT_cjs.useBlocksEnvironment();
383
+ const [isGranting, setIsGranting] = react$1.useState(false);
384
+ const domain = runtimeConfig.deploymentDomain;
385
+ const email = domain ? `${workspace.external_id}@${displayDomain(domain)}` : null;
386
+ const mailtoHref = email ? `mailto:${email}?subject=${encodeURIComponent(workspace.name || "Untitled workspace")}` : null;
387
+ const { data: agents, isLoading: isLoadingAgents } = react.useAgents({ enabled: open && isMember });
388
+ const defaultAssistant = react$1.useMemo(
389
+ () => agents?.find((a) => a.email.startsWith("assistant.")),
390
+ [agents]
391
+ );
392
+ const { data: assistantWorkspaces } = react.useAgentWorkspaces(defaultAssistant?.external_id ?? "", {
393
+ enabled: !!defaultAssistant?.external_id
394
+ });
395
+ const alreadyGranted = assistantWorkspaces?.some(
396
+ (w) => w.workspace_ext_id === workspace.external_id
397
+ );
398
+ const { data: sessions, isLoading: isLoadingSessions } = react.useSessions({
399
+ enabled: open && isMember
400
+ });
401
+ const activeSession = sessions?.find(
402
+ (s) => s.status === "agent" && s.workspaces.includes(workspace.external_id)
403
+ );
404
+ const { data: limits } = react.useAuthorizeLimits({ enabled: open && isMember });
405
+ const grantAgentAccess = react.useGrantAgentAccess();
406
+ const terminateSession = react.useTerminateSession();
407
+ const handleAuthorize = async () => {
408
+ if (!defaultAssistant) {
409
+ notify("No default Assistant found for your account", "error");
410
+ return;
411
+ }
412
+ try {
413
+ await grantAgentAccess.mutateAsync({
414
+ agentExtId: defaultAssistant.external_id,
415
+ workspaceId: workspace.external_id,
416
+ mode: { kind: "temporary" }
417
+ });
418
+ notify("Your Assistant is authorized for this workspace", "success");
419
+ } catch (err) {
420
+ notify(detailOf(err) || "Failed to authorize", "error");
421
+ }
422
+ };
423
+ const handleEndSession = async () => {
424
+ if (!activeSession) return;
425
+ try {
426
+ await terminateSession.mutateAsync(activeSession.session_id);
427
+ } catch {
428
+ notify("Failed to end session", "error");
429
+ }
430
+ };
431
+ const handleGrantAccess = async () => {
432
+ if (!defaultAssistant) {
433
+ notify("No default Assistant found for your account", "error");
434
+ return;
435
+ }
436
+ const confirmed = await confirm({
437
+ message: `Grant your Assistant standing access to "${workspace.name || "this workspace"}"? It will be able to read and act on this workspace whenever it wakes, including from email, without asking first.`,
438
+ title: "Grant standing access"
439
+ });
440
+ if (!confirmed) return;
441
+ setIsGranting(true);
442
+ try {
443
+ await grantAgentAccess.mutateAsync({
444
+ agentExtId: defaultAssistant.external_id,
445
+ workspaceId: workspace.external_id
446
+ });
447
+ notify("Your Assistant now has standing access to this workspace", "success");
448
+ } catch (err) {
449
+ notify(detailOf(err) || "Failed to grant access", "error");
450
+ } finally {
451
+ setIsGranting(false);
452
+ }
453
+ };
454
+ if (!email) return null;
455
+ const isLoadingAccess = isLoadingAgents || isLoadingSessions;
456
+ let access;
457
+ if (isMember) {
458
+ if (isLoadingAccess) access = { kind: "loading" };
459
+ else if (!defaultAssistant) access = { kind: "none" };
460
+ else if (activeSession)
461
+ access = {
462
+ kind: "session",
463
+ expiresIn: chunkJWCVA4LC_cjs.formatSessionTtl(activeSession.ttl),
464
+ isEnding: terminateSession.isPending,
465
+ onEnd: handleEndSession
466
+ };
467
+ else
468
+ access = {
469
+ kind: "idle",
470
+ defaultTtl: limits ? chunkJWCVA4LC_cjs.formatSessionTtl(limits.default_ttl_seconds) : void 0,
471
+ isAuthorizing: grantAgentAccess.isPending && grantAgentAccess.variables?.mode?.kind === "temporary",
472
+ onAuthorize: handleAuthorize
473
+ };
474
+ }
475
+ return /* @__PURE__ */ jsxRuntime.jsx(
476
+ chunkJWCVA4LC_cjs.EmailWorkspaceDialogView,
477
+ {
478
+ open,
479
+ onOpenChange,
480
+ email,
481
+ mailtoHref: mailtoHref ?? "",
482
+ paDomain: displayDomain(domain),
483
+ copyButton: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: email, copyMessage: "Email address copied" }),
484
+ access,
485
+ standing: defaultAssistant ? {
486
+ alreadyGranted: !!alreadyGranted,
487
+ isGranting,
488
+ onGrant: handleGrantAccess
489
+ } : void 0,
490
+ labels
491
+ }
492
+ );
493
+ }
494
+ function ConnectedUpcomingEvents({
495
+ timeZone,
496
+ days = 7,
497
+ limit = 8,
498
+ showDeclined,
499
+ onOpen,
500
+ onJoin,
501
+ className
502
+ }) {
503
+ const arbi = react.useArbi();
504
+ const [now] = react$1.useState(() => Math.floor(Date.now() / 6e4) * 6e4);
505
+ const range = react$1.useMemo(
506
+ () => ({
507
+ start: new Date(now).toISOString(),
508
+ end: new Date(now + days * 864e5).toISOString()
509
+ }),
510
+ [now, days]
511
+ );
512
+ const { data: events = [], isLoading } = react.useCalendarEvents(range);
513
+ const { data: calendars = [] } = react.useCalendars();
514
+ const hidden = react$1.useMemo(
515
+ () => new Set(calendars.filter((c) => c.hidden).map((c) => c.id)),
516
+ [calendars]
517
+ );
518
+ const list = chunk4M3OIBIS_cjs.upcomingOf(events, Date.now(), { showDeclined, hidden }).slice(0, limit);
519
+ let lastDay = "";
520
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ui.cn("space-y-1 text-sm", className), "data-testid": "calendar-upcoming", children: [
521
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "px-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Upcoming" }),
522
+ !isLoading && list.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "px-1 text-xs text-muted-foreground", children: [
523
+ "Nothing in the next ",
524
+ days,
525
+ " days."
526
+ ] }),
527
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-0.5", children: list.map((e) => {
528
+ const day = e.all_day ? e.start.date ?? "" : chunkQUMUAJ2P_cjs.utcToDate(e.start_utc, timeZone);
529
+ const header = day !== lastDay;
530
+ lastDay = day;
531
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
532
+ header && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-1 pt-1.5 text-[11px] font-medium text-muted-foreground", children: chunkQUMUAJ2P_cjs.formatPlainDate(day, { weekday: "short", day: "numeric", month: "short" }) }),
533
+ /* @__PURE__ */ jsxRuntime.jsxs(
534
+ "div",
535
+ {
536
+ className: "flex items-center gap-1.5 rounded-md px-1 py-0.5 hover:bg-muted/60",
537
+ "data-testid": "calendar-upcoming-item",
538
+ children: [
539
+ /* @__PURE__ */ jsxRuntime.jsxs(
540
+ "button",
541
+ {
542
+ type: "button",
543
+ className: "flex min-w-0 flex-1 items-baseline gap-1.5 text-left",
544
+ onClick: () => onOpen?.(e),
545
+ children: [
546
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-12 shrink-0 text-xs text-muted-foreground", children: e.all_day ? "All day" : chunkQUMUAJ2P_cjs.formatInZone(e.start_utc, timeZone, { hour: "numeric", minute: "2-digit" }) }),
547
+ /* @__PURE__ */ jsxRuntime.jsx(
548
+ "span",
549
+ {
550
+ className: ui.cn("min-w-0 truncate", e.my_partstat === "needs_action" && "italic"),
551
+ children: e.restricted ? "Busy" : e.title || "Untitled"
552
+ }
553
+ )
554
+ ]
555
+ }
556
+ ),
557
+ chunk4M3OIBIS_cjs.conferenceUrl(e) && /* @__PURE__ */ jsxRuntime.jsxs(
558
+ ui.Button,
559
+ {
560
+ type: "button",
561
+ size: "sm",
562
+ variant: chunk4M3OIBIS_cjs.canJoinEvent(e) ? "default" : "ghost",
563
+ className: "h-6 px-2 text-xs",
564
+ onClick: () => onJoin ? onJoin(e) : void joinEventMeeting(arbi, chunk4M3OIBIS_cjs.conferenceUrl(e)),
565
+ "aria-label": `Join ${e.title}`,
566
+ "data-testid": "calendar-upcoming-join",
567
+ children: [
568
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Video, { className: "mr-1 size-3" }),
569
+ " ",
570
+ chunk4M3OIBIS_cjs.isWebinarConference(e.conference) ? "Join webinar" : "Join"
571
+ ]
572
+ }
573
+ )
574
+ ]
575
+ }
576
+ )
577
+ ] }, e.instance_id);
578
+ }) })
579
+ ] });
580
+ }
581
+ function DashboardAgenda({
582
+ days,
583
+ limit,
584
+ className,
585
+ testId = "dashboard-agenda"
586
+ } = {}) {
587
+ const { data: settings } = react.useCalendarSettings();
588
+ const { openCalendar } = chunk46LX6EQT_cjs.useBlocksEnvironment();
589
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ui.cn("rounded-lg border border-border p-3", className), "data-testid": testId, children: [
590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1 flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(chunkT26UYA6Q_cjs.ScheduleCallButton, { variant: "label" }) }),
591
+ /* @__PURE__ */ jsxRuntime.jsx(
592
+ ConnectedUpcomingEvents,
593
+ {
594
+ timeZone: chunkQUMUAJ2P_cjs.safeZone(settings?.time_zone, chunkQUMUAJ2P_cjs.detectTimeZone()),
595
+ days,
596
+ limit,
597
+ showDeclined: !!settings?.show_declined,
598
+ onOpen: (event) => openCalendar({ event: { id: event.id, recurrenceId: event.recurrence_id } })
599
+ }
600
+ )
601
+ ] });
602
+ }
603
+ function LiveBlockRoot({
604
+ kind,
605
+ source,
606
+ children
607
+ }) {
608
+ return /* @__PURE__ */ jsxRuntime.jsx(
609
+ "div",
610
+ {
611
+ className: "contents",
612
+ "data-slot": "live-block",
613
+ "data-block-kind": kind,
614
+ "data-block-source": source,
615
+ children
616
+ }
617
+ );
618
+ }
619
+ function ConnectedAgendaBlock({ config, className, testId }) {
620
+ return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockRoot, { kind: "agenda", children: /* @__PURE__ */ jsxRuntime.jsx(
621
+ DashboardAgenda,
622
+ {
623
+ days: config.days,
624
+ limit: config.limit,
625
+ className,
626
+ testId
627
+ }
628
+ ) });
629
+ }
630
+ var PENDING_LOOKUP_MS = 3e3;
631
+ var PENDING_LOOKUP_TRIES = 40;
632
+ var PENDING_TASK_MESSAGE = "Your task has started, but its thread isn't ready yet. It opens here as soon as it appears, or press Look again.";
633
+ var LOOK_AGAIN_LABEL = "Look again";
634
+ function usePendingTaskThread({
635
+ open,
636
+ onOpenChange,
637
+ findThread
638
+ }) {
639
+ const [pending, setPending] = react$1.useState(null);
640
+ const [isLooking, setIsLooking] = react$1.useState(false);
641
+ const { notify, openConversation } = chunk46LX6EQT_cjs.useBlocksEnvironment();
642
+ const latest = react$1.useRef({ open, onOpenChange, findThread, notify, openConversation });
643
+ react$1.useEffect(() => {
644
+ latest.current = { open, onOpenChange, findThread, notify, openConversation };
645
+ });
646
+ const openThread = (conversationId) => {
647
+ setPending(null);
648
+ const { notify: notify2, openConversation: openConversation2 } = latest.current;
649
+ const navigate = (id) => openConversation2(id);
650
+ if (latest.current.open) {
651
+ navigate(conversationId);
652
+ latest.current.onOpenChange(false);
653
+ } else {
654
+ notify2("Your task is ready", "success", {
655
+ action: { label: "Open thread", onClick: () => navigate(conversationId) }
656
+ });
657
+ }
658
+ };
659
+ const openThreadRef = react$1.useRef(openThread);
660
+ react$1.useEffect(() => {
661
+ openThreadRef.current = openThread;
662
+ });
663
+ react$1.useEffect(() => {
664
+ if (!pending) return;
665
+ let cancelled = false;
666
+ let tries = 0;
667
+ const timer = setInterval(() => {
668
+ tries += 1;
669
+ if (tries > PENDING_LOOKUP_TRIES) {
670
+ clearInterval(timer);
671
+ return;
672
+ }
673
+ void latest.current.findThread(pending.messageId).then((found) => {
674
+ if (found && !cancelled) {
675
+ cancelled = true;
676
+ clearInterval(timer);
677
+ openThreadRef.current(found.conversationId);
678
+ }
679
+ }).catch(() => {
680
+ });
681
+ }, PENDING_LOOKUP_MS);
682
+ return () => {
683
+ cancelled = true;
684
+ clearInterval(timer);
685
+ };
686
+ }, [pending]);
687
+ return {
688
+ /** A started task's thread is pending: the start button looks again instead of starting. */
689
+ isPending: pending !== null,
690
+ isLooking,
691
+ /** Whether `prompt` is the one whose task already started (so it must not start again). */
692
+ isPendingFor: (prompt) => pending !== null && pending.prompt === prompt,
693
+ /** Look for the pending thread now: opens it, or throws the pending message. */
694
+ lookAgain: async () => {
695
+ if (!pending) return;
696
+ setIsLooking(true);
697
+ try {
698
+ const found = await latest.current.findThread(pending.messageId);
699
+ if (!found) throw new Error(PENDING_TASK_MESSAGE);
700
+ openThread(found.conversationId);
701
+ } finally {
702
+ setIsLooking(false);
703
+ }
704
+ },
705
+ /**
706
+ * A start failed: when its task did start and only the thread is late, remember it and return
707
+ * the message to show. Returns null for any other failure.
708
+ */
709
+ trackStartError: (error, prompt) => {
710
+ if (!(error instanceof react.TaskThreadPendingError)) return null;
711
+ setPending({ messageId: error.messageId, prompt });
712
+ return PENDING_TASK_MESSAGE;
713
+ },
714
+ clear: () => setPending(null)
715
+ };
716
+ }
717
+ function ConnectedNewThreadDialog({
718
+ open,
719
+ onOpenChange,
720
+ initialParentId
721
+ }) {
722
+ const { tasks } = react.useWorkItems();
723
+ const startQuery = react.useStartTaskQuery();
724
+ const { data: documents = [] } = react.useDocuments();
725
+ const docIds = react$1.useMemo(
726
+ () => documents.filter((d) => d.status === "completed").map((d) => d.external_id),
727
+ [documents]
728
+ );
729
+ const workspaceId = react.useArbiSessionState((s) => s.workspaceId);
730
+ const createWork = react.useCreateWork({ workspaceId });
731
+ const { notify, openConversation: navigateToConversation } = chunk46LX6EQT_cjs.useBlocksEnvironment();
732
+ const pendingThread = usePendingTaskThread({
733
+ open,
734
+ onOpenChange,
735
+ findThread: startQuery.findThread
736
+ });
737
+ const parentOptions = react$1.useMemo(() => {
738
+ const leaf = { external_id: "__new__" };
739
+ return chunkBH322H5B_cjs.moveTargets([...tasks, leaf], leaf).map((t) => ({
740
+ id: t.external_id,
741
+ name: t.title?.trim() || "Untitled task"
742
+ }));
743
+ }, [tasks]);
744
+ const submit = async (values) => {
745
+ const request = chunkM55XUF4L_cjs.newThreadToRequest(values);
746
+ try {
747
+ if (!workspaceId) throw new Error("Open a workspace to add a task.");
748
+ if (!request.startAssistant && request.todo) {
749
+ const { task, todo } = request;
750
+ await createWork.mutateAsync({
751
+ title: todo.title,
752
+ description: todo.description || null,
753
+ due_at: task?.due_at ?? null,
754
+ parent_conversation_ext_id: task?.parent_conversation_ext_id ?? null,
755
+ shared: request.shared,
756
+ // Required by the API; a to-do has no run, so there is no access to grant.
757
+ auth_mode: "run_now_temp"
758
+ });
759
+ notify(`Added \u201C${todo.title}\u201D`, "success");
760
+ onOpenChange(false);
761
+ return;
762
+ }
763
+ if (pendingThread.isPendingFor(values.prompt)) {
764
+ await pendingThread.lookAgain();
765
+ return;
766
+ }
767
+ pendingThread.clear();
768
+ const { conversationId } = await startQuery.start({
769
+ input: request.input,
770
+ workspaceId,
771
+ docIds,
772
+ task: request.task
773
+ });
774
+ navigateToConversation(conversationId);
775
+ onOpenChange(false);
776
+ } catch (error) {
777
+ const pendingMessage = pendingThread.trackStartError(error, values.prompt);
778
+ if (pendingMessage) throw new Error(pendingMessage);
779
+ if (!pendingThread.isPendingFor(values.prompt)) {
780
+ notify("Failed to add the task", "error");
781
+ }
782
+ throw error;
783
+ }
784
+ };
785
+ return /* @__PURE__ */ jsxRuntime.jsx(
786
+ chunkBH322H5B_cjs.NewThreadDialog,
787
+ {
788
+ open,
789
+ onOpenChange,
790
+ tasks: parentOptions,
791
+ initialValues: initialParentId ? { parentId: initialParentId } : void 0,
792
+ isPending: startQuery.isPending || createWork.isPending || pendingThread.isLooking,
793
+ fileCount: docIds.length,
794
+ onSubmit: submit,
795
+ labels: pendingThread.isPending ? { createTask: LOOK_AGAIN_LABEL } : void 0
796
+ }
797
+ );
798
+ }
799
+ var SOURCES = [
800
+ { source: "computer", label: "From your computer", icon: lucideReact.Monitor },
801
+ { source: "email", label: "From accounts", icon: lucideReact.Mail },
802
+ { source: "internet", label: "From URL", icon: lucideReact.Globe }
803
+ ];
804
+ function DocumentsUploadButton({
805
+ isCompact,
806
+ canUpload,
807
+ isGuest,
808
+ onSelectSource,
809
+ onEmailWorkspace,
810
+ onCreateNew,
811
+ onTakePhoto,
812
+ size = "default",
813
+ className
814
+ }) {
815
+ const isVendorVisible = react.useConnectorVendorVisibility();
816
+ const hasAccountProviders = isVendorVisible("microsoft") || isVendorVisible("gmail");
817
+ const items = react$1.useMemo(
818
+ () => [
819
+ ...SOURCES.filter(({ source }) => source !== "email" || hasAccountProviders).map(
820
+ ({ source, label, icon }) => ({
821
+ id: source,
822
+ label,
823
+ icon,
824
+ testId: `add-source-${source}`,
825
+ onSelect: () => onSelectSource(source)
826
+ })
827
+ ),
828
+ ...onTakePhoto ? [
829
+ {
830
+ id: "take-photo",
831
+ label: "Take photo",
832
+ icon: lucideReact.Camera,
833
+ testId: "add-source-take-photo",
834
+ onSelect: onTakePhoto
835
+ }
836
+ ] : [],
837
+ ...onEmailWorkspace ? [
838
+ {
839
+ id: "email-workspace",
840
+ label: "Send via email",
841
+ icon: lucideReact.Send,
842
+ testId: "add-source-email-workspace",
843
+ separatorBefore: true,
844
+ onSelect: onEmailWorkspace
845
+ }
846
+ ] : [],
847
+ ...onCreateNew ? [
848
+ {
849
+ id: "create-new",
850
+ label: "Create New",
851
+ icon: lucideReact.FilePlus2,
852
+ testId: "add-source-create-new",
853
+ separatorBefore: true,
854
+ onSelect: onCreateNew
855
+ }
856
+ ] : []
857
+ ],
858
+ [hasAccountProviders, onSelectSource, onEmailWorkspace, onCreateNew, onTakePhoto]
859
+ );
860
+ return /* @__PURE__ */ jsxRuntime.jsx(
861
+ chunkT3Y3LZ4Y_cjs.FilesAddMenu,
862
+ {
863
+ items,
864
+ isCompact,
865
+ canAdd: canUpload,
866
+ disabledReason: isGuest ? "Viewers cannot upload documents in this workspace" : "You cannot upload to this workspace",
867
+ size,
868
+ className
869
+ }
870
+ );
871
+ }
872
+ var plural = (count, one, many = `${one}s`) => count === 1 ? one : many;
873
+ function useAddFromUrls({
874
+ shared = true,
875
+ configExtId,
876
+ onZipFiles
877
+ } = {}) {
878
+ const { notify } = chunk46LX6EQT_cjs.useBlocksEnvironment();
879
+ const { workspaceId } = chunkGB5MN5FC_cjs.useConnectedWorkspace();
880
+ const uploadFromUrls = react.useUploadFromUrls();
881
+ return react$1.useCallback(
882
+ async (urls) => {
883
+ if (urls.length === 0 || !workspaceId) return false;
884
+ let result;
885
+ try {
886
+ result = await uploadFromUrls({ urls, shared, configExtId, workspaceId });
887
+ } catch {
888
+ return false;
889
+ }
890
+ const { docIds, skipped, zipFiles, oversizedInZips, failedZipUrls } = result;
891
+ if (zipFiles.length > 0) {
892
+ onZipFiles?.(zipFiles);
893
+ notify(
894
+ `Extracted ${zipFiles.length} ${plural(zipFiles.length, "file")} from ZIP. Click Add files to send.`,
895
+ "success"
896
+ );
897
+ }
898
+ if (oversizedInZips.length > 0)
899
+ notify(
900
+ `Skipped ${oversizedInZips.length} oversized ${plural(oversizedInZips.length, "file")} inside ZIP archives.`,
901
+ "warning"
902
+ );
903
+ if (failedZipUrls.length > 0)
904
+ notify(
905
+ `Failed to fetch ${failedZipUrls.length} ZIP ${plural(failedZipUrls.length, "URL")}. Browser CORS may block third-party hosts \u2014 try a CORS-enabled URL.`,
906
+ "error"
907
+ );
908
+ if (skipped.length > 0)
909
+ notify(
910
+ `${skipped.length} ${plural(skipped.length, "URL was", "URLs were")} skipped:
911
+ ${skipped.map((s) => `${s.file_name}: ${s.reason}`).join("\n")}`,
912
+ "warning"
913
+ );
914
+ if (docIds.length > 0)
915
+ notify(
916
+ `Upload complete (${docIds.length} ${plural(docIds.length, "document")}). Indexing in the background...`,
917
+ "success",
918
+ { workspaceId }
919
+ );
920
+ return true;
921
+ },
922
+ [workspaceId, uploadFromUrls, shared, configExtId, onZipFiles, notify]
923
+ );
924
+ }
925
+
926
+ // src/connection/live-blocks/list-rows.ts
927
+ var RECENT_ROWS = 5;
928
+ var FACT_ROWS = 3;
929
+ function shortDate(iso) {
930
+ return new Date(iso).toLocaleDateString(void 0, { day: "numeric", month: "short" });
931
+ }
932
+ function timeAndDate(iso) {
933
+ if (!iso) return "";
934
+ const d = new Date(iso);
935
+ if (Number.isNaN(d.getTime())) return "";
936
+ const time2 = d.toLocaleTimeString(void 0, {
937
+ hour: "2-digit",
938
+ minute: "2-digit",
939
+ hour12: false
940
+ });
941
+ return `${time2} \xB7 ${shortDate(iso)}`;
942
+ }
943
+ function humanizeStatus(status) {
944
+ const words = status.replace(/[-_]/g, " ");
945
+ return words.charAt(0).toUpperCase() + words.slice(1);
946
+ }
947
+ var time = (iso) => +new Date(iso ?? 0);
948
+ function recentConversations(conversations, limit = RECENT_ROWS) {
949
+ return [...conversations].sort((a, b) => time(b.updated_at) - time(a.updated_at)).slice(0, limit).map((c) => ({
950
+ id: c.external_id,
951
+ title: c.title?.trim() || "Untitled thread",
952
+ subtitle: c.status ? [chunkBH322H5B_cjs.STATUS_LABELS[chunkBH322H5B_cjs.asTaskStatus(c.status)], c.due_at ? `due ${shortDate(c.due_at)}` : null].filter(Boolean).join(" \xB7 ") : `${c.message_count} ${c.message_count === 1 ? "message" : "messages"}`,
953
+ time: timeAndDate(c.updated_at)
954
+ }));
955
+ }
956
+ function recentDocuments(documents, limit = RECENT_ROWS) {
957
+ return [...documents].sort((a, b) => time(b.updated_at ?? b.created_at) - time(a.updated_at ?? a.created_at)).slice(0, limit).map((d) => ({
958
+ id: d.external_id,
959
+ fileName: d.file_name,
960
+ title: d.file_name || "Untitled document",
961
+ subtitle: d.status && d.status !== "ready" && d.status !== "completed" ? humanizeStatus(d.status) : d.n_pages ? `${d.n_pages} ${d.n_pages === 1 ? "page" : "pages"}` : d.file_type ?? "Document",
962
+ time: timeAndDate(d.updated_at ?? d.created_at)
963
+ }));
964
+ }
965
+ function splitFacts(facts, now = /* @__PURE__ */ new Date(), {
966
+ limit = FACT_ROWS,
967
+ groups = "upcoming_and_newest"
968
+ } = {}) {
969
+ const startOfToday = new Date(now);
970
+ startOfToday.setHours(0, 0, 0, 0);
971
+ const dated = groups === "newest" ? [] : facts.filter((f) => f.date_start && new Date(f.date_start) >= startOfToday).sort((a, b) => time(a.date_start) - time(b.date_start)).slice(0, limit);
972
+ const datedIds = new Set(dated.map((f) => f.external_id));
973
+ const rest = groups === "upcoming" ? [] : facts.filter((f) => !datedIds.has(f.external_id)).sort((a, b) => time(b.created_at) - time(a.created_at)).slice(0, limit);
974
+ const row = (f, stamp) => ({
975
+ id: f.external_id,
976
+ title: f.text,
977
+ time: stamp
978
+ });
979
+ return {
980
+ upcoming: dated.map((f) => row(f, f.date_start ? shortDate(f.date_start) : "")),
981
+ recent: rest.map((f) => row(f, timeAndDate(f.created_at)))
982
+ };
983
+ }
984
+ function useDashboardAdd({ onCreateNew, onTakePhoto }) {
985
+ const { openUpload, openFiles } = chunk46LX6EQT_cjs.useBlocksEnvironment();
986
+ const { workspace, isMember } = react.useCurrentWorkspace();
987
+ const [urlDialogOpen, setUrlDialogOpen] = react$1.useState(false);
988
+ const [emailDialogOpen, setEmailDialogOpen] = react$1.useState(false);
989
+ const upload = (files, source) => {
990
+ if (openUpload) openUpload(files, source ? { source } : void 0);
991
+ else openFiles();
992
+ };
993
+ const uploadUrls = useAddFromUrls({ onZipFiles: (files) => upload(files, "computer") });
994
+ const selectSource = (source) => {
995
+ if (source === "internet") setUrlDialogOpen(true);
996
+ else upload(void 0, source);
997
+ };
998
+ return {
999
+ menu: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1000
+ DocumentsUploadButton,
1001
+ {
1002
+ isCompact: false,
1003
+ isGuest: false,
1004
+ size: "sm",
1005
+ onSelectSource: selectSource,
1006
+ onEmailWorkspace: () => setEmailDialogOpen(true),
1007
+ onCreateNew,
1008
+ onTakePhoto,
1009
+ ...props
1010
+ }
1011
+ ),
1012
+ addFiles: () => upload(),
1013
+ dialogs: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1014
+ /* @__PURE__ */ jsxRuntime.jsx(
1015
+ chunkT3Y3LZ4Y_cjs.UrlInputDialog,
1016
+ {
1017
+ open: urlDialogOpen,
1018
+ onOpenChange: setUrlDialogOpen,
1019
+ onUrlsSubmit: uploadUrls,
1020
+ titleWorkspaceName: workspace?.name,
1021
+ titleIcon: workspace && /* @__PURE__ */ jsxRuntime.jsx(ConnectedWorkspaceEntity, { workspace, size: 24, variant: "icon" })
1022
+ }
1023
+ ),
1024
+ workspace && /* @__PURE__ */ jsxRuntime.jsx(
1025
+ ConnectedEmailWorkspaceDialog,
1026
+ {
1027
+ open: emailDialogOpen,
1028
+ onOpenChange: setEmailDialogOpen,
1029
+ workspace,
1030
+ isMember
1031
+ }
1032
+ )
1033
+ ] })
1034
+ };
1035
+ }
1036
+ function ConnectedListBlock({ config, testId, ...rest }) {
1037
+ const id = testId ?? `list-block-${config.source}`;
1038
+ return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockRoot, { kind: "list", source: config.source, children: config.source === "documents" ? /* @__PURE__ */ jsxRuntime.jsx(DocumentsList, { ...rest, limit: config.limit, testId: id }) : config.source === "conversations" ? /* @__PURE__ */ jsxRuntime.jsx(ConversationsList, { ...rest, limit: config.limit, testId: id }) : /* @__PURE__ */ jsxRuntime.jsx(
1039
+ FactsList,
1040
+ {
1041
+ ...rest,
1042
+ limit: config.limit,
1043
+ groups: config.facts ?? "upcoming_and_newest",
1044
+ testId: id
1045
+ }
1046
+ ) });
1047
+ }
1048
+ function DocumentsList({
1049
+ limit,
1050
+ addFilesAction,
1051
+ onCreateNew,
1052
+ onTakePhoto,
1053
+ showLoading = true,
1054
+ testId
1055
+ }) {
1056
+ const { openDocument, openFiles, hrefFor } = chunk46LX6EQT_cjs.useBlocksEnvironment();
1057
+ const { workspaceId } = chunkGB5MN5FC_cjs.useConnectedWorkspace();
1058
+ const { data: documents, loaded } = chunkDWN5AUMH_cjs.useListedDocuments();
1059
+ const add = useDashboardAdd({ onCreateNew, onTakePhoto });
1060
+ const rows = react$1.useMemo(
1061
+ () => recentDocuments(documents, limit).map(({ fileName, ...row }) => ({
1062
+ ...row,
1063
+ // The file-type mark, bare: it carries its own identity.
1064
+ leading: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: ui.getDocIcon(fileName, 20) }),
1065
+ href: hrefFor({ kind: "document", documentId: row.id, workspaceId }),
1066
+ onSelect: () => openDocument(row.id)
1067
+ })),
1068
+ [documents, limit, workspaceId, openDocument, hrefFor]
1069
+ );
1070
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1071
+ /* @__PURE__ */ jsxRuntime.jsx(
1072
+ chunkSGYURQ23_cjs.RecentList,
1073
+ {
1074
+ testId,
1075
+ icon: lucideReact.FileText,
1076
+ title: ui.getEntityLabel("DOCUMENT", "PLURAL"),
1077
+ count: documents.length,
1078
+ onOpen: () => openFiles(),
1079
+ action: addFilesAction === void 0 ? add.menu({ canUpload: true, className: chunkSGYURQ23_cjs.DASHBOARD_QUIET_ACTION_CLASS }) : addFilesAction,
1080
+ rows,
1081
+ caption: "Added",
1082
+ loading: showLoading && !loaded,
1083
+ empty: {
1084
+ icon: lucideReact.Upload,
1085
+ label: "Add files or emails",
1086
+ description: "From your computer, a web link, or a connected mailbox.",
1087
+ onSelect: add.addFiles
1088
+ }
1089
+ }
1090
+ ),
1091
+ add.dialogs
1092
+ ] });
1093
+ }
1094
+ function ConversationsList({ limit, showLoading = true, testId }) {
1095
+ const { openConversation, openNewConversation, openThreads, hrefFor } = chunk46LX6EQT_cjs.useBlocksEnvironment();
1096
+ const { workspaceId } = chunkGB5MN5FC_cjs.useConnectedWorkspace();
1097
+ const { data: conversations, loaded } = chunkDWN5AUMH_cjs.useConnectedConversations();
1098
+ const assistant = shell.useAssistantCopy();
1099
+ const [newThreadOpen, setNewThreadOpen] = react$1.useState(false);
1100
+ const ask = () => openNewConversation();
1101
+ const rows = react$1.useMemo(
1102
+ () => recentConversations(conversations, limit).map((row) => ({
1103
+ ...row,
1104
+ leading: /* @__PURE__ */ jsxRuntime.jsx(ui.EntityIcon, { entityType: "CONVERSATION", className: "mt-0.5 size-5 shrink-0" }),
1105
+ href: hrefFor({ kind: "conversation", conversationId: row.id, workspaceId }),
1106
+ onSelect: () => openConversation(row.id)
1107
+ })),
1108
+ [conversations, limit, workspaceId, openConversation, hrefFor]
1109
+ );
1110
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1111
+ /* @__PURE__ */ jsxRuntime.jsx(
1112
+ chunkSGYURQ23_cjs.RecentList,
1113
+ {
1114
+ testId,
1115
+ icon: lucideReact.MessagesSquare,
1116
+ title: ui.getEntityLabel("CONVERSATION", "PLURAL"),
1117
+ count: conversations.length,
1118
+ onOpen: openThreads && (() => openThreads()),
1119
+ action: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1120
+ /* @__PURE__ */ jsxRuntime.jsx(
1121
+ chunkSGYURQ23_cjs.DashboardAction,
1122
+ {
1123
+ emphasis: "primary",
1124
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
1125
+ label: assistant.ask,
1126
+ onClick: ask,
1127
+ testId: `${testId}-ask`
1128
+ }
1129
+ ),
1130
+ /* @__PURE__ */ jsxRuntime.jsx(
1131
+ chunkSGYURQ23_cjs.DashboardAction,
1132
+ {
1133
+ emphasis: "quiet",
1134
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
1135
+ label: "New",
1136
+ onClick: () => setNewThreadOpen(true),
1137
+ testId: `${testId}-new`
1138
+ }
1139
+ )
1140
+ ] }),
1141
+ rows,
1142
+ caption: "Messaged",
1143
+ loading: showLoading && !loaded,
1144
+ empty: {
1145
+ icon: lucideReact.Plus,
1146
+ label: assistant.askAnything,
1147
+ description: "Questions are answered from this workspace's files.",
1148
+ onSelect: ask
1149
+ }
1150
+ }
1151
+ ),
1152
+ /* @__PURE__ */ jsxRuntime.jsx(ConnectedNewThreadDialog, { open: newThreadOpen, onOpenChange: setNewThreadOpen })
1153
+ ] });
1154
+ }
1155
+ function FactsList({
1156
+ limit,
1157
+ groups,
1158
+ showLoading = true,
1159
+ testId
1160
+ }) {
1161
+ const { openFacts } = chunk46LX6EQT_cjs.useBlocksEnvironment();
1162
+ const { workspaceId } = chunkGB5MN5FC_cjs.useConnectedWorkspace();
1163
+ const { data: facts = [], isLoading } = react.useFacts(workspaceId);
1164
+ const { upcoming, recent } = react$1.useMemo(() => {
1165
+ const split = splitFacts(facts, /* @__PURE__ */ new Date(), { limit, groups });
1166
+ const toRow = (row) => ({
1167
+ ...row,
1168
+ leading: /* @__PURE__ */ jsxRuntime.jsx(chunkSGYURQ23_cjs.FactMark, {}),
1169
+ // The item, not the list: the Facts page scrolls to this fact.
1170
+ onSelect: openFacts && (() => openFacts({ focusId: row.id }))
1171
+ });
1172
+ return { upcoming: split.upcoming.map(toRow), recent: split.recent.map(toRow) };
1173
+ }, [facts, limit, groups, openFacts]);
1174
+ const newFact = openFacts && (() => openFacts({ compose: true }));
1175
+ return /* @__PURE__ */ jsxRuntime.jsx(
1176
+ chunkSGYURQ23_cjs.FactsStrip,
1177
+ {
1178
+ testId,
1179
+ icon: lucideReact.Milestone,
1180
+ title: ui.getEntityLabel("FACT", "PLURAL"),
1181
+ count: facts.length,
1182
+ onOpen: openFacts && (() => openFacts()),
1183
+ action: newFact && /* @__PURE__ */ jsxRuntime.jsx(
1184
+ chunkSGYURQ23_cjs.DashboardAction,
1185
+ {
1186
+ emphasis: "quiet",
1187
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
1188
+ label: "New fact",
1189
+ onClick: newFact,
1190
+ testId: `${testId}-action`
1191
+ }
1192
+ ),
1193
+ groups: [
1194
+ { caption: "Upcoming", rows: upcoming, rowTestId: `${testId}-upcoming-row` },
1195
+ { caption: "Created", rows: recent, rowTestId: `${testId}-row` }
1196
+ ],
1197
+ loading: showLoading && !!isLoading,
1198
+ empty: {
1199
+ icon: lucideReact.Milestone,
1200
+ label: `Add your first ${ui.getEntityLabel("FACT").toLowerCase()}`,
1201
+ description: "A date, a decision, a preference \u2014 anything worth remembering.",
1202
+ onSelect: newFact,
1203
+ testId: `${testId}-empty-action`
1204
+ }
1205
+ }
1206
+ );
1207
+ }
1208
+ var TILE_TEST_IDS = {
1209
+ "deep-research": "workspace-dashboard-quick-action-research",
1210
+ timeline: "workspace-dashboard-quick-action-timeline",
1211
+ annotate: "workspace-dashboard-quick-action-annotate"
1212
+ };
1213
+ function DashboardStart({ addMenu, onCreateNew }) {
1214
+ const { dashboard: workflows } = chunkV27WLYTG_cjs.useWorkflowDefinitions();
1215
+ const { isMember, role } = react.useCurrentWorkspace();
1216
+ const canWrite = isMember && role !== "guest";
1217
+ const [activeId, setActiveId] = react$1.useState(null);
1218
+ return /* @__PURE__ */ jsxRuntime.jsx(
1219
+ chunk7UPEFZCV_cjs.ConnectedWorkflowStart,
1220
+ {
1221
+ workflows,
1222
+ caption: "Start",
1223
+ testId: "workspace-dashboard-quick-actions",
1224
+ activeId,
1225
+ onActiveIdChange: setActiveId,
1226
+ addFilesAction: addMenu({ canUpload: canWrite }),
1227
+ extraTiles: onCreateNew ? [
1228
+ {
1229
+ id: "create-file",
1230
+ icon: lucideReact.FilePlus2,
1231
+ title: "Create a file",
1232
+ description: "Write a doc, or record a voice note, photo or video",
1233
+ onSelect: onCreateNew,
1234
+ disabled: !canWrite,
1235
+ disabledReason: "Only workspace members can add files",
1236
+ testId: "workspace-dashboard-quick-action-create"
1237
+ }
1238
+ ] : void 0,
1239
+ tileTestId: (workflow) => TILE_TEST_IDS[workflow.id],
1240
+ disabledReason: (workflow) => !canWrite && workflow.id === chunkM55XUF4L_cjs.ANNOTATE_ID ? "Only workspace members can annotate files" : void 0
1241
+ }
1242
+ );
1243
+ }
1244
+ function ConnectedStartBlock({ onCreateNew, onTakePhoto }) {
1245
+ const add = useDashboardAdd({ onCreateNew, onTakePhoto });
1246
+ return /* @__PURE__ */ jsxRuntime.jsxs(LiveBlockRoot, { kind: "start", children: [
1247
+ /* @__PURE__ */ jsxRuntime.jsx(DashboardStart, { addMenu: add.menu, onCreateNew }),
1248
+ add.dialogs
1249
+ ] });
1250
+ }
1251
+
1252
+ // src/connection/live-blocks/workspace-dashboard-blocks.ts
1253
+ var START = {
1254
+ id: "start",
1255
+ kind: "start",
1256
+ layout: { x: 0, y: 0, w: 12, h: 3 },
1257
+ config: {}
1258
+ };
1259
+ var FILES = {
1260
+ id: "recent-files",
1261
+ kind: "list",
1262
+ layout: { x: 0, y: 3, w: 6, h: 6 },
1263
+ config: { source: "documents", limit: RECENT_ROWS }
1264
+ };
1265
+ var THREADS = {
1266
+ id: "recent-threads",
1267
+ kind: "list",
1268
+ layout: { x: 6, y: 3, w: 6, h: 6 },
1269
+ config: { source: "conversations", limit: RECENT_ROWS }
1270
+ };
1271
+ var FACTS = {
1272
+ id: "facts",
1273
+ kind: "list",
1274
+ layout: { x: 0, y: 9, w: 6, h: 6 },
1275
+ config: { source: "facts", limit: FACT_ROWS, facts: "upcoming_and_newest" }
1276
+ };
1277
+ var AGENDA = {
1278
+ id: "agenda",
1279
+ kind: "agenda",
1280
+ layout: { x: 6, y: 9, w: 6, h: 6 },
1281
+ config: { days: 7, limit: 8 }
1282
+ };
1283
+ var WORKSPACE_DASHBOARD_LAYOUT = {
1284
+ start: START,
1285
+ files: FILES,
1286
+ threads: THREADS,
1287
+ facts: FACTS,
1288
+ agenda: AGENDA
1289
+ };
1290
+ var WORKSPACE_DASHBOARD_BLOCKS = [
1291
+ START,
1292
+ FILES,
1293
+ THREADS,
1294
+ FACTS,
1295
+ AGENDA
1296
+ ];
1297
+ var WORKSPACE_DASHBOARD_PAGE = {
1298
+ version: 1,
1299
+ title: "Dashboard",
1300
+ description: "The workspace home: what you can start, recent files and threads, facts, agenda.",
1301
+ blocks: [...WORKSPACE_DASHBOARD_BLOCKS]
1302
+ };
1303
+ function ConnectedCarouselBlock({ config, testId }) {
1304
+ const id = testId ?? `carousel-block-${config.source}`;
1305
+ return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockRoot, { kind: "carousel", source: config.source, children: config.source === "skills" ? /* @__PURE__ */ jsxRuntime.jsx(SkillsCarousel, { limit: config.limit, testId: id }) : /* @__PURE__ */ jsxRuntime.jsx(WorkflowsCarousel, { limit: config.limit, testId: id }) });
1306
+ }
1307
+ function SkillsCarousel({ limit, testId }) {
1308
+ const { start: skills } = chunkV27WLYTG_cjs.useWorkflowDefinitions();
1309
+ const { openSkillsBrowser } = chunk46LX6EQT_cjs.useBlocksEnvironment();
1310
+ const [activeId, setActiveId] = react$1.useState(null);
1311
+ const shown = react$1.useMemo(() => skills.slice(0, limit), [skills, limit]);
1312
+ if (shown.length === 0)
1313
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col gap-3", "data-testid": testId, children: [
1314
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSLCH5JRI_cjs.SectionLabel, { children: "Skills" }),
1315
+ /* @__PURE__ */ jsxRuntime.jsx(
1316
+ chunkSLCH5JRI_cjs.EmptyStrip,
1317
+ {
1318
+ icon: lucideReact.Sparkles,
1319
+ label: "No skills yet",
1320
+ description: "The skills you can start from a chat show here.",
1321
+ onSelect: openSkillsBrowser && (() => openSkillsBrowser()),
1322
+ testId: `${testId}-empty-action`
1323
+ }
1324
+ )
1325
+ ] });
1326
+ return /* @__PURE__ */ jsxRuntime.jsx(
1327
+ chunk7UPEFZCV_cjs.ConnectedWorkflowStart,
1328
+ {
1329
+ workflows: skills,
1330
+ tileWorkflows: shown,
1331
+ tilesLayout: "carousel",
1332
+ caption: "Skills",
1333
+ testId,
1334
+ activeId,
1335
+ onActiveIdChange: setActiveId,
1336
+ tileTestId: (workflow) => `${testId}-card-${workflow.id}`
1337
+ }
1338
+ );
1339
+ }
1340
+ function WorkflowsCarousel({ limit, testId }) {
1341
+ const openWorkflow = chunk5GBM7BQB_cjs.useOpenWorkflow();
1342
+ const { data: workflows, isLoading } = react.useWorkflows({ enabled: !!openWorkflow });
1343
+ const tiles = react$1.useMemo(
1344
+ () => [...workflows ?? []].sort((a, b) => +new Date(b.updated_at) - +new Date(a.updated_at)).slice(0, limit).map((w) => ({
1345
+ id: w.external_id,
1346
+ icon: lucideReact.Workflow,
1347
+ title: w.name,
1348
+ description: w.description || (w.active ? "Switched on" : "Switched off"),
1349
+ onSelect: () => openWorkflow?.(w.external_id),
1350
+ disabled: !openWorkflow,
1351
+ testId: `${testId}-card-${w.external_id}`
1352
+ })),
1353
+ [workflows, limit, openWorkflow, testId]
1354
+ );
1355
+ if (tiles.length === 0)
1356
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col gap-3", "data-testid": testId, children: [
1357
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSLCH5JRI_cjs.SectionLabel, { children: "Workflows" }),
1358
+ openWorkflow && isLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkSLCH5JRI_cjs.LoadingRows, { testId: `${testId}-loading` }) : /* @__PURE__ */ jsxRuntime.jsx(
1359
+ chunkSLCH5JRI_cjs.EmptyStrip,
1360
+ {
1361
+ icon: lucideReact.Workflow,
1362
+ label: "No workflows yet",
1363
+ description: "Workflows run on a schedule or when something happens; yours show here.",
1364
+ onSelect: openWorkflow && (() => openWorkflow()),
1365
+ testId: `${testId}-empty-action`
1366
+ }
1367
+ )
1368
+ ] });
1369
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkSLCH5JRI_cjs.StartTiles, { items: tiles, layout: "carousel", caption: "Workflows", testId });
1370
+ }
1371
+ var ITEMS = [
1372
+ {
1373
+ id: "text",
1374
+ label: "Doc",
1375
+ description: "Write or paste text",
1376
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-7" })
1377
+ },
1378
+ { id: "audio", label: "Voice", description: "Record audio", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "size-7" }) },
1379
+ {
1380
+ id: "photo",
1381
+ label: "Photo",
1382
+ description: "Take a picture",
1383
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Camera, { className: "size-7" })
1384
+ },
1385
+ { id: "video", label: "Video", description: "Record video", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Video, { className: "size-7" }) },
1386
+ {
1387
+ id: "presentation",
1388
+ label: "Presentation",
1389
+ description: "Show parts of documents",
1390
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Presentation, { className: "size-7" })
1391
+ }
1392
+ ];
1393
+ function ConnectedNewFileMenu({ open, onOpenChange }) {
1394
+ const session = react.useArbiSessionStore();
1395
+ const pick = (id) => {
1396
+ session.startDraftDocument(id);
1397
+ onOpenChange(false);
1398
+ session.setPage("documents");
1399
+ };
1400
+ return /* @__PURE__ */ jsxRuntime.jsx(
1401
+ chunkSGYURQ23_cjs.ActionMenuDialog,
1402
+ {
1403
+ open,
1404
+ onOpenChange,
1405
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FilePlus2, { className: "size-5" }),
1406
+ title: "Create a file",
1407
+ description: "Pick what to start \u2014 write a doc, record a voice note, photo or video, or build a presentation.",
1408
+ items: ITEMS,
1409
+ onPick: pick,
1410
+ testId: "new-file-menu",
1411
+ itemTestId: "new-file-item"
1412
+ }
1413
+ );
1414
+ }
1415
+
1416
+ exports.ConnectedAgendaBlock = ConnectedAgendaBlock;
1417
+ exports.ConnectedCarouselBlock = ConnectedCarouselBlock;
1418
+ exports.ConnectedEmailWorkspaceDialog = ConnectedEmailWorkspaceDialog;
1419
+ exports.ConnectedListBlock = ConnectedListBlock;
1420
+ exports.ConnectedNewFileMenu = ConnectedNewFileMenu;
1421
+ exports.ConnectedNewThreadDialog = ConnectedNewThreadDialog;
1422
+ exports.ConnectedStartBlock = ConnectedStartBlock;
1423
+ exports.ConnectedUpcomingEvents = ConnectedUpcomingEvents;
1424
+ exports.ConnectedWorkspaceEntity = ConnectedWorkspaceEntity;
1425
+ exports.DocumentsUploadButton = DocumentsUploadButton;
1426
+ exports.LOOK_AGAIN_LABEL = LOOK_AGAIN_LABEL;
1427
+ exports.PENDING_LOOKUP_MS = PENDING_LOOKUP_MS;
1428
+ exports.PENDING_TASK_MESSAGE = PENDING_TASK_MESSAGE;
1429
+ exports.WORKSPACE_DASHBOARD_BLOCKS = WORKSPACE_DASHBOARD_BLOCKS;
1430
+ exports.WORKSPACE_DASHBOARD_LAYOUT = WORKSPACE_DASHBOARD_LAYOUT;
1431
+ exports.WORKSPACE_DASHBOARD_PAGE = WORKSPACE_DASHBOARD_PAGE;
1432
+ exports.createEventCall = createEventCall;
1433
+ exports.distinctPeers = distinctPeers;
1434
+ exports.joinEventMeeting = joinEventMeeting;
1435
+ exports.loadEventWebinar = loadEventWebinar;
1436
+ exports.parseArbiCallUrl = parseArbiCallUrl;
1437
+ exports.resolveAttendeeUsers = resolveAttendeeUsers;
1438
+ exports.resolveAttendeeUsersRemote = resolveAttendeeUsersRemote;
1439
+ exports.resolveCallPeers = resolveCallPeers;
1440
+ exports.resolveCallPeersRemote = resolveCallPeersRemote;
1441
+ exports.shareEventCall = shareEventCall;
1442
+ exports.updateEventWebinarRoles = updateEventWebinarRoles;
1443
+ exports.useAddFromUrls = useAddFromUrls;
1444
+ exports.usePendingTaskThread = usePendingTaskThread;
1445
+ exports.webinarRolesByUser = webinarRolesByUser;
1446
+ //# sourceMappingURL=chunk-FEAHTNTY.cjs.map
1447
+ //# sourceMappingURL=chunk-FEAHTNTY.cjs.map