@vertesia/ui 1.0.0-dev.20260128.144200 → 1.0.0-dev.20260203.130115Z

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 (1560) hide show
  1. package/package.json +5 -5
  2. package/src/core/components/InputList.tsx +1 -1
  3. package/src/core/components/Overlay.tsx +1 -1
  4. package/src/core/components/SidePanel.tsx +25 -13
  5. package/src/core/components/index.ts +0 -8
  6. package/src/core/components/{Panel.tsx → shadcn/Panel.tsx} +1 -1
  7. package/src/core/components/{Badge.tsx → shadcn/badge.tsx} +3 -3
  8. package/src/core/components/shadcn/command.tsx +1 -1
  9. package/src/core/components/shadcn/index.ts +5 -3
  10. package/src/core/components/{ConfirmModal.tsx → shadcn/modal/ConfirmModal.tsx} +8 -8
  11. package/src/core/components/{DeleteModal.tsx → shadcn/modal/DeleteModal.tsx} +1 -1
  12. package/src/core/components/shadcn/{dialog.tsx → modal/dialog.tsx} +43 -32
  13. package/src/core/components/shadcn/modal/index.ts +3 -0
  14. package/src/core/components/shadcn/popover.tsx +4 -2
  15. package/src/core/components/shadcn/selectBox.tsx +14 -12
  16. package/src/core/components/shadcn/tabs.tsx +16 -7
  17. package/src/core/components/shadcn/tooltip.tsx +23 -17
  18. package/src/features/agent/chat/AskUserWidget.tsx +4 -3
  19. package/src/features/agent/chat/ModernAgentConversation.tsx +8 -8
  20. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +23 -32
  21. package/src/features/store/collections/CreateCollection.tsx +8 -8
  22. package/src/features/store/collections/EditCollectionView.tsx +1 -1
  23. package/src/features/store/objects/components/ContentOverview.tsx +8 -8
  24. package/src/features/store/objects/components/PropertiesEditorModal.tsx +0 -1
  25. package/src/features/store/objects/components/SelectDocumentModal.tsx +6 -6
  26. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +13 -13
  27. package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +8 -8
  28. package/src/features/store/objects/upload/DocumentUploadModal.tsx +25 -25
  29. package/src/features/store/types/ObjectSchemaEditor.tsx +28 -27
  30. package/src/features/store/types/SelectContentType.tsx +3 -3
  31. package/src/features/store/types/TableLayoutEditor.tsx +11 -17
  32. package/src/features/user/UserInfo.tsx +158 -10
  33. package/src/layout/AppLayout.tsx +16 -44
  34. package/src/layout/Sidebar.tsx +4 -3
  35. package/src/shell/apps/AppProjectSelector.tsx +2 -2
  36. package/src/shell/apps/StandaloneApp.tsx +3 -3
  37. package/src/shell/login/InviteAcceptModal.tsx +6 -6
  38. package/src/shell/login/SignInModal.tsx +1 -1
  39. package/src/shell/login/SignupForm.tsx +3 -3
  40. package/src/shell/login/UserInfo.tsx +5 -5
  41. package/src/widgets/json-view/JSONCode.tsx +1 -3
  42. package/src/widgets/json-view/JSONDisplay.tsx +1 -1
  43. package/src/widgets/monacoEditor/MonacoEditor.tsx +2 -17
  44. package/src/widgets/schema-editor/editor/PropertyEditor.tsx +5 -5
  45. package/lib/esm/core/components/Avatar.js +0 -31
  46. package/lib/esm/core/components/Avatar.js.map +0 -1
  47. package/lib/esm/core/components/Badge.js +0 -62
  48. package/lib/esm/core/components/Badge.js.map +0 -1
  49. package/lib/esm/core/components/Button.js +0 -32
  50. package/lib/esm/core/components/Button.js.map +0 -1
  51. package/lib/esm/core/components/Center.js +0 -6
  52. package/lib/esm/core/components/Center.js.map +0 -1
  53. package/lib/esm/core/components/ComboBox.js +0 -356
  54. package/lib/esm/core/components/ComboBox.js.map +0 -1
  55. package/lib/esm/core/components/ConfirmModal.js +0 -10
  56. package/lib/esm/core/components/ConfirmModal.js.map +0 -1
  57. package/lib/esm/core/components/DeleteModal.js +0 -28
  58. package/lib/esm/core/components/DeleteModal.js.map +0 -1
  59. package/lib/esm/core/components/Divider.js +0 -6
  60. package/lib/esm/core/components/Divider.js.map +0 -1
  61. package/lib/esm/core/components/Dropdown.js +0 -16
  62. package/lib/esm/core/components/Dropdown.js.map +0 -1
  63. package/lib/esm/core/components/DropdownList.js +0 -9
  64. package/lib/esm/core/components/DropdownList.js.map +0 -1
  65. package/lib/esm/core/components/EmptyCollection.js +0 -7
  66. package/lib/esm/core/components/EmptyCollection.js.map +0 -1
  67. package/lib/esm/core/components/FileUpload.js +0 -119
  68. package/lib/esm/core/components/FileUpload.js.map +0 -1
  69. package/lib/esm/core/components/FormItem.js +0 -9
  70. package/lib/esm/core/components/FormItem.js.map +0 -1
  71. package/lib/esm/core/components/InputList.js +0 -61
  72. package/lib/esm/core/components/InputList.js.map +0 -1
  73. package/lib/esm/core/components/Link.js +0 -13
  74. package/lib/esm/core/components/Link.js.map +0 -1
  75. package/lib/esm/core/components/MenuList.js +0 -20
  76. package/lib/esm/core/components/MenuList.js.map +0 -1
  77. package/lib/esm/core/components/MessageBox.js +0 -66
  78. package/lib/esm/core/components/MessageBox.js.map +0 -1
  79. package/lib/esm/core/components/Modal.js +0 -26
  80. package/lib/esm/core/components/Modal.js.map +0 -1
  81. package/lib/esm/core/components/NumberInput.js +0 -43
  82. package/lib/esm/core/components/NumberInput.js.map +0 -1
  83. package/lib/esm/core/components/Overlay.js +0 -57
  84. package/lib/esm/core/components/Overlay.js.map +0 -1
  85. package/lib/esm/core/components/Panel.js +0 -8
  86. package/lib/esm/core/components/Panel.js.map +0 -1
  87. package/lib/esm/core/components/Portal.js +0 -28
  88. package/lib/esm/core/components/Portal.js.map +0 -1
  89. package/lib/esm/core/components/RadioGroup.js +0 -34
  90. package/lib/esm/core/components/RadioGroup.js.map +0 -1
  91. package/lib/esm/core/components/SelectBox.js +0 -67
  92. package/lib/esm/core/components/SelectBox.js.map +0 -1
  93. package/lib/esm/core/components/SelectList.js +0 -52
  94. package/lib/esm/core/components/SelectList.js.map +0 -1
  95. package/lib/esm/core/components/SelectStack.js +0 -8
  96. package/lib/esm/core/components/SelectStack.js.map +0 -1
  97. package/lib/esm/core/components/SidePanel.js +0 -33
  98. package/lib/esm/core/components/SidePanel.js.map +0 -1
  99. package/lib/esm/core/components/Spinner.js +0 -18
  100. package/lib/esm/core/components/Spinner.js.map +0 -1
  101. package/lib/esm/core/components/Switch.js +0 -12
  102. package/lib/esm/core/components/Switch.js.map +0 -1
  103. package/lib/esm/core/components/TagsInput.js +0 -194
  104. package/lib/esm/core/components/TagsInput.js.map +0 -1
  105. package/lib/esm/core/components/index.js +0 -36
  106. package/lib/esm/core/components/index.js.map +0 -1
  107. package/lib/esm/core/components/libs/utils.js +0 -6
  108. package/lib/esm/core/components/libs/utils.js.map +0 -1
  109. package/lib/esm/core/components/libs/visuallyHidden.js +0 -16
  110. package/lib/esm/core/components/libs/visuallyHidden.js.map +0 -1
  111. package/lib/esm/core/components/popup/Popup.js +0 -60
  112. package/lib/esm/core/components/popup/Popup.js.map +0 -1
  113. package/lib/esm/core/components/popup/PopupController.js +0 -149
  114. package/lib/esm/core/components/popup/PopupController.js.map +0 -1
  115. package/lib/esm/core/components/popup/index.js +0 -4
  116. package/lib/esm/core/components/popup/index.js.map +0 -1
  117. package/lib/esm/core/components/popup/position.js +0 -221
  118. package/lib/esm/core/components/popup/position.js.map +0 -1
  119. package/lib/esm/core/components/popup/utils.js +0 -74
  120. package/lib/esm/core/components/popup/utils.js.map +0 -1
  121. package/lib/esm/core/components/shadcn/breadcrumb.js +0 -51
  122. package/lib/esm/core/components/shadcn/breadcrumb.js.map +0 -1
  123. package/lib/esm/core/components/shadcn/button.js +0 -76
  124. package/lib/esm/core/components/shadcn/button.js.map +0 -1
  125. package/lib/esm/core/components/shadcn/calendar.js +0 -13
  126. package/lib/esm/core/components/shadcn/calendar.js.map +0 -1
  127. package/lib/esm/core/components/shadcn/card.js +0 -17
  128. package/lib/esm/core/components/shadcn/card.js.map +0 -1
  129. package/lib/esm/core/components/shadcn/checkbox.js +0 -9
  130. package/lib/esm/core/components/shadcn/checkbox.js.map +0 -1
  131. package/lib/esm/core/components/shadcn/command.js +0 -29
  132. package/lib/esm/core/components/shadcn/command.js.map +0 -1
  133. package/lib/esm/core/components/shadcn/dialog.js +0 -74
  134. package/lib/esm/core/components/shadcn/dialog.js.map +0 -1
  135. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js +0 -38
  136. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js.map +0 -1
  137. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js +0 -23
  138. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js.map +0 -1
  139. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js +0 -129
  140. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js.map +0 -1
  141. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js +0 -46
  142. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js.map +0 -1
  143. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js +0 -23
  144. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js.map +0 -1
  145. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js +0 -28
  146. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js.map +0 -1
  147. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js +0 -5
  148. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js.map +0 -1
  149. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +0 -98
  150. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +0 -1
  151. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js +0 -24
  152. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js.map +0 -1
  153. package/lib/esm/core/components/shadcn/filters/filter/TextFilter.js +0 -21
  154. package/lib/esm/core/components/shadcn/filters/filter/TextFilter.js.map +0 -1
  155. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js +0 -161
  156. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js.map +0 -1
  157. package/lib/esm/core/components/shadcn/filters/filter-styles.js +0 -88
  158. package/lib/esm/core/components/shadcn/filters/filter-styles.js.map +0 -1
  159. package/lib/esm/core/components/shadcn/filters/filterBar.js +0 -242
  160. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +0 -1
  161. package/lib/esm/core/components/shadcn/filters/filters.js +0 -57
  162. package/lib/esm/core/components/shadcn/filters/filters.js.map +0 -1
  163. package/lib/esm/core/components/shadcn/filters/index.js +0 -6
  164. package/lib/esm/core/components/shadcn/filters/index.js.map +0 -1
  165. package/lib/esm/core/components/shadcn/filters/types.js +0 -10
  166. package/lib/esm/core/components/shadcn/filters/types.js.map +0 -1
  167. package/lib/esm/core/components/shadcn/heading.js +0 -17
  168. package/lib/esm/core/components/shadcn/heading.js.map +0 -1
  169. package/lib/esm/core/components/shadcn/index.js +0 -23
  170. package/lib/esm/core/components/shadcn/index.js.map +0 -1
  171. package/lib/esm/core/components/shadcn/input.js +0 -41
  172. package/lib/esm/core/components/shadcn/input.js.map +0 -1
  173. package/lib/esm/core/components/shadcn/label.js +0 -10
  174. package/lib/esm/core/components/shadcn/label.js.map +0 -1
  175. package/lib/esm/core/components/shadcn/popover.js +0 -50
  176. package/lib/esm/core/components/shadcn/popover.js.map +0 -1
  177. package/lib/esm/core/components/shadcn/resizeable.js +0 -15
  178. package/lib/esm/core/components/shadcn/resizeable.js.map +0 -1
  179. package/lib/esm/core/components/shadcn/selectBox.js +0 -152
  180. package/lib/esm/core/components/shadcn/selectBox.js.map +0 -1
  181. package/lib/esm/core/components/shadcn/separator.js +0 -8
  182. package/lib/esm/core/components/shadcn/separator.js.map +0 -1
  183. package/lib/esm/core/components/shadcn/tabs.js +0 -132
  184. package/lib/esm/core/components/shadcn/tabs.js.map +0 -1
  185. package/lib/esm/core/components/shadcn/text.js +0 -30
  186. package/lib/esm/core/components/shadcn/text.js.map +0 -1
  187. package/lib/esm/core/components/shadcn/textarea.js +0 -7
  188. package/lib/esm/core/components/shadcn/textarea.js.map +0 -1
  189. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js +0 -39
  190. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js.map +0 -1
  191. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js +0 -13
  192. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js.map +0 -1
  193. package/lib/esm/core/components/shadcn/tooltip.js +0 -14
  194. package/lib/esm/core/components/shadcn/tooltip.js.map +0 -1
  195. package/lib/esm/core/components/styles.js +0 -10
  196. package/lib/esm/core/components/styles.js.map +0 -1
  197. package/lib/esm/core/components/table/index.js +0 -24
  198. package/lib/esm/core/components/table/index.js.map +0 -1
  199. package/lib/esm/core/components/tabs/Tabs.js +0 -78
  200. package/lib/esm/core/components/tabs/Tabs.js.map +0 -1
  201. package/lib/esm/core/components/tabs/TabsContext.js +0 -7
  202. package/lib/esm/core/components/tabs/TabsContext.js.map +0 -1
  203. package/lib/esm/core/components/tabs/index.js +0 -3
  204. package/lib/esm/core/components/tabs/index.js.map +0 -1
  205. package/lib/esm/core/components/toast/NotificationPanel.js +0 -43
  206. package/lib/esm/core/components/toast/NotificationPanel.js.map +0 -1
  207. package/lib/esm/core/components/toast/ToastContext.js +0 -7
  208. package/lib/esm/core/components/toast/ToastContext.js.map +0 -1
  209. package/lib/esm/core/components/toast/ToastProps.js +0 -2
  210. package/lib/esm/core/components/toast/ToastProps.js.map +0 -1
  211. package/lib/esm/core/components/toast/ToastProvider.js +0 -13
  212. package/lib/esm/core/components/toast/ToastProvider.js.map +0 -1
  213. package/lib/esm/core/components/toast/index.js +0 -3
  214. package/lib/esm/core/components/toast/index.js.map +0 -1
  215. package/lib/esm/core/hooks/CompositeState.js +0 -256
  216. package/lib/esm/core/hooks/CompositeState.js.map +0 -1
  217. package/lib/esm/core/hooks/PortalContainerProvider.js +0 -44
  218. package/lib/esm/core/hooks/PortalContainerProvider.js.map +0 -1
  219. package/lib/esm/core/hooks/SharedState.js +0 -64
  220. package/lib/esm/core/hooks/SharedState.js.map +0 -1
  221. package/lib/esm/core/hooks/index.js +0 -16
  222. package/lib/esm/core/hooks/index.js.map +0 -1
  223. package/lib/esm/core/hooks/useClickOutside.js +0 -29
  224. package/lib/esm/core/hooks/useClickOutside.js.map +0 -1
  225. package/lib/esm/core/hooks/useCopyToClipboard.js +0 -23
  226. package/lib/esm/core/hooks/useCopyToClipboard.js.map +0 -1
  227. package/lib/esm/core/hooks/useDarkMode.js +0 -11
  228. package/lib/esm/core/hooks/useDarkMode.js.map +0 -1
  229. package/lib/esm/core/hooks/useDebounce.js +0 -14
  230. package/lib/esm/core/hooks/useDebounce.js.map +0 -1
  231. package/lib/esm/core/hooks/useEventSource.js +0 -31
  232. package/lib/esm/core/hooks/useEventSource.js.map +0 -1
  233. package/lib/esm/core/hooks/useFetch.js +0 -40
  234. package/lib/esm/core/hooks/useFetch.js.map +0 -1
  235. package/lib/esm/core/hooks/useFlag.js +0 -13
  236. package/lib/esm/core/hooks/useFlag.js.map +0 -1
  237. package/lib/esm/core/hooks/useIntersectionObserver.js +0 -34
  238. package/lib/esm/core/hooks/useIntersectionObserver.js.map +0 -1
  239. package/lib/esm/core/hooks/useIsFistRendering.js +0 -14
  240. package/lib/esm/core/hooks/useIsFistRendering.js.map +0 -1
  241. package/lib/esm/core/hooks/useSafeLayoutEffect.js +0 -4
  242. package/lib/esm/core/hooks/useSafeLayoutEffect.js.map +0 -1
  243. package/lib/esm/core/hooks/useScrollableSearch.js +0 -92
  244. package/lib/esm/core/hooks/useScrollableSearch.js.map +0 -1
  245. package/lib/esm/core/hooks/useSharedValue.js +0 -21
  246. package/lib/esm/core/hooks/useSharedValue.js.map +0 -1
  247. package/lib/esm/core/index.js +0 -4
  248. package/lib/esm/core/index.js.map +0 -1
  249. package/lib/esm/core/utils/cn.js +0 -6
  250. package/lib/esm/core/utils/cn.js.map +0 -1
  251. package/lib/esm/core/utils/index.js +0 -2
  252. package/lib/esm/core/utils/index.js.map +0 -1
  253. package/lib/esm/env/index.js +0 -75
  254. package/lib/esm/env/index.js.map +0 -1
  255. package/lib/esm/features/activity-doc/ActivityDoc.js +0 -71
  256. package/lib/esm/features/activity-doc/ActivityDoc.js.map +0 -1
  257. package/lib/esm/features/activity-doc/index.js +0 -2
  258. package/lib/esm/features/activity-doc/index.js.map +0 -1
  259. package/lib/esm/features/agent/PayloadBuilder.js +0 -291
  260. package/lib/esm/features/agent/PayloadBuilder.js.map +0 -1
  261. package/lib/esm/features/agent/chat/AgentChart.js +0 -246
  262. package/lib/esm/features/agent/chat/AgentChart.js.map +0 -1
  263. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js +0 -243
  264. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js.map +0 -1
  265. package/lib/esm/features/agent/chat/AskUserWidget.js +0 -113
  266. package/lib/esm/features/agent/chat/AskUserWidget.js.map +0 -1
  267. package/lib/esm/features/agent/chat/ImageLightbox.js +0 -33
  268. package/lib/esm/features/agent/chat/ImageLightbox.js.map +0 -1
  269. package/lib/esm/features/agent/chat/JumpingDots.js +0 -6
  270. package/lib/esm/features/agent/chat/JumpingDots.js.map +0 -1
  271. package/lib/esm/features/agent/chat/ModernAgentConversation.js +0 -953
  272. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +0 -1
  273. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +0 -372
  274. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +0 -1
  275. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +0 -88
  276. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +0 -1
  277. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +0 -64
  278. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +0 -1
  279. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js +0 -29
  280. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js.map +0 -1
  281. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +0 -95
  282. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +0 -1
  283. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +0 -197
  284. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +0 -1
  285. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +0 -252
  286. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +0 -1
  287. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js +0 -20
  288. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js.map +0 -1
  289. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +0 -63
  290. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +0 -1
  291. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js +0 -23
  292. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js.map +0 -1
  293. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js +0 -52
  294. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js.map +0 -1
  295. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +0 -82
  296. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +0 -1
  297. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js +0 -13
  298. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js.map +0 -1
  299. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js +0 -201
  300. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +0 -1
  301. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +0 -374
  302. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +0 -1
  303. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +0 -105
  304. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +0 -1
  305. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +0 -415
  306. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +0 -1
  307. package/lib/esm/features/agent/chat/SkillWidgetProvider.js +0 -132
  308. package/lib/esm/features/agent/chat/SkillWidgetProvider.js.map +0 -1
  309. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js +0 -266
  310. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js.map +0 -1
  311. package/lib/esm/features/agent/chat/VegaLiteChart.js +0 -781
  312. package/lib/esm/features/agent/chat/VegaLiteChart.js.map +0 -1
  313. package/lib/esm/features/agent/chat/WaitingMessages.js +0 -60
  314. package/lib/esm/features/agent/chat/WaitingMessages.js.map +0 -1
  315. package/lib/esm/features/agent/chat/index.js +0 -17
  316. package/lib/esm/features/agent/chat/index.js.map +0 -1
  317. package/lib/esm/features/agent/chat/useArtifactUrlCache.js +0 -62
  318. package/lib/esm/features/agent/chat/useArtifactUrlCache.js.map +0 -1
  319. package/lib/esm/features/agent/createChartTool.js +0 -632
  320. package/lib/esm/features/agent/createChartTool.js.map +0 -1
  321. package/lib/esm/features/agent/examples.js +0 -295
  322. package/lib/esm/features/agent/examples.js.map +0 -1
  323. package/lib/esm/features/agent/index.js +0 -5
  324. package/lib/esm/features/agent/index.js.map +0 -1
  325. package/lib/esm/features/agent/visualization.js +0 -165
  326. package/lib/esm/features/agent/visualization.js.map +0 -1
  327. package/lib/esm/features/errors/PanelErrorBoundary.js +0 -11
  328. package/lib/esm/features/errors/PanelErrorBoundary.js.map +0 -1
  329. package/lib/esm/features/errors/RowErrorBoundary.js +0 -9
  330. package/lib/esm/features/errors/RowErrorBoundary.js.map +0 -1
  331. package/lib/esm/features/errors/VertesiaErrorBoundary.js +0 -15
  332. package/lib/esm/features/errors/VertesiaErrorBoundary.js.map +0 -1
  333. package/lib/esm/features/errors/WidgetErrorBoundary.js +0 -11
  334. package/lib/esm/features/errors/WidgetErrorBoundary.js.map +0 -1
  335. package/lib/esm/features/errors/index.js +0 -5
  336. package/lib/esm/features/errors/index.js.map +0 -1
  337. package/lib/esm/features/facets/AgentRunnerFacetsNav.js +0 -86
  338. package/lib/esm/features/facets/AgentRunnerFacetsNav.js.map +0 -1
  339. package/lib/esm/features/facets/CollectionsFacetsNav.js +0 -89
  340. package/lib/esm/features/facets/CollectionsFacetsNav.js.map +0 -1
  341. package/lib/esm/features/facets/DocumentsFacetsNav.js +0 -147
  342. package/lib/esm/features/facets/DocumentsFacetsNav.js.map +0 -1
  343. package/lib/esm/features/facets/EnvironmentFacet.js +0 -39
  344. package/lib/esm/features/facets/EnvironmentFacet.js.map +0 -1
  345. package/lib/esm/features/facets/InteractionsFacetsNav.js +0 -88
  346. package/lib/esm/features/facets/InteractionsFacetsNav.js.map +0 -1
  347. package/lib/esm/features/facets/PromptsFacetsNav.js +0 -80
  348. package/lib/esm/features/facets/PromptsFacetsNav.js.map +0 -1
  349. package/lib/esm/features/facets/RunsFacetsNav.js +0 -157
  350. package/lib/esm/features/facets/RunsFacetsNav.js.map +0 -1
  351. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js +0 -119
  352. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js.map +0 -1
  353. package/lib/esm/features/facets/index.js +0 -16
  354. package/lib/esm/features/facets/index.js.map +0 -1
  355. package/lib/esm/features/facets/utils/SearchInterface.js +0 -2
  356. package/lib/esm/features/facets/utils/SearchInterface.js.map +0 -1
  357. package/lib/esm/features/facets/utils/StringFacet.js +0 -12
  358. package/lib/esm/features/facets/utils/StringFacet.js.map +0 -1
  359. package/lib/esm/features/facets/utils/StringListFacet.js +0 -11
  360. package/lib/esm/features/facets/utils/StringListFacet.js.map +0 -1
  361. package/lib/esm/features/facets/utils/TypeFacet.js +0 -42
  362. package/lib/esm/features/facets/utils/TypeFacet.js.map +0 -1
  363. package/lib/esm/features/facets/utils/VEnvironmentFacet.js +0 -25
  364. package/lib/esm/features/facets/utils/VEnvironmentFacet.js.map +0 -1
  365. package/lib/esm/features/facets/utils/VInteractionFacet.js +0 -45
  366. package/lib/esm/features/facets/utils/VInteractionFacet.js.map +0 -1
  367. package/lib/esm/features/facets/utils/VStringFacet.js +0 -20
  368. package/lib/esm/features/facets/utils/VStringFacet.js.map +0 -1
  369. package/lib/esm/features/facets/utils/VTypeFacet.js +0 -61
  370. package/lib/esm/features/facets/utils/VTypeFacet.js.map +0 -1
  371. package/lib/esm/features/facets/utils/VUserFacet.js +0 -31
  372. package/lib/esm/features/facets/utils/VUserFacet.js.map +0 -1
  373. package/lib/esm/features/facets/utils/utils.js +0 -7
  374. package/lib/esm/features/facets/utils/utils.js.map +0 -1
  375. package/lib/esm/features/index.js +0 -12
  376. package/lib/esm/features/index.js.map +0 -1
  377. package/lib/esm/features/layout/GenericPageNavHeader.js +0 -74
  378. package/lib/esm/features/layout/GenericPageNavHeader.js.map +0 -1
  379. package/lib/esm/features/layout/NotFoundView.js +0 -5
  380. package/lib/esm/features/layout/NotFoundView.js.map +0 -1
  381. package/lib/esm/features/layout/index.js +0 -3
  382. package/lib/esm/features/layout/index.js.map +0 -1
  383. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js +0 -268
  384. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js.map +0 -1
  385. package/lib/esm/features/magic-pdf/DownloadPopover.js +0 -28
  386. package/lib/esm/features/magic-pdf/DownloadPopover.js.map +0 -1
  387. package/lib/esm/features/magic-pdf/ExtractedContentView.js +0 -77
  388. package/lib/esm/features/magic-pdf/ExtractedContentView.js.map +0 -1
  389. package/lib/esm/features/magic-pdf/MagicPdfProvider.js +0 -242
  390. package/lib/esm/features/magic-pdf/MagicPdfProvider.js.map +0 -1
  391. package/lib/esm/features/magic-pdf/MagicPdfView.js +0 -61
  392. package/lib/esm/features/magic-pdf/MagicPdfView.js.map +0 -1
  393. package/lib/esm/features/magic-pdf/index.js +0 -2
  394. package/lib/esm/features/magic-pdf/index.js.map +0 -1
  395. package/lib/esm/features/magic-pdf/types.js +0 -2
  396. package/lib/esm/features/magic-pdf/types.js.map +0 -1
  397. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js +0 -261
  398. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js.map +0 -1
  399. package/lib/esm/features/pdf-viewer/PdfPageSlider.js +0 -276
  400. package/lib/esm/features/pdf-viewer/PdfPageSlider.js.map +0 -1
  401. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js +0 -71
  402. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js.map +0 -1
  403. package/lib/esm/features/pdf-viewer/index.js +0 -4
  404. package/lib/esm/features/pdf-viewer/index.js.map +0 -1
  405. package/lib/esm/features/permissions/SecureButton.js +0 -13
  406. package/lib/esm/features/permissions/SecureButton.js.map +0 -1
  407. package/lib/esm/features/permissions/SecureSidebarItem.js +0 -14
  408. package/lib/esm/features/permissions/SecureSidebarItem.js.map +0 -1
  409. package/lib/esm/features/permissions/UserPermissionsProvider.js +0 -87
  410. package/lib/esm/features/permissions/UserPermissionsProvider.js.map +0 -1
  411. package/lib/esm/features/permissions/helpers.js +0 -12
  412. package/lib/esm/features/permissions/helpers.js.map +0 -1
  413. package/lib/esm/features/permissions/index.js +0 -5
  414. package/lib/esm/features/permissions/index.js.map +0 -1
  415. package/lib/esm/features/store/collections/BrowseCollectionView.js +0 -40
  416. package/lib/esm/features/store/collections/BrowseCollectionView.js.map +0 -1
  417. package/lib/esm/features/store/collections/CollectionsTable.js +0 -64
  418. package/lib/esm/features/store/collections/CollectionsTable.js.map +0 -1
  419. package/lib/esm/features/store/collections/CreateCollection.js +0 -87
  420. package/lib/esm/features/store/collections/CreateCollection.js.map +0 -1
  421. package/lib/esm/features/store/collections/EditCollectionView.js +0 -181
  422. package/lib/esm/features/store/collections/EditCollectionView.js.map +0 -1
  423. package/lib/esm/features/store/collections/SelectCollection.js +0 -119
  424. package/lib/esm/features/store/collections/SelectCollection.js.map +0 -1
  425. package/lib/esm/features/store/collections/SharedPropsEditor.js +0 -39
  426. package/lib/esm/features/store/collections/SharedPropsEditor.js.map +0 -1
  427. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js +0 -35
  428. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js.map +0 -1
  429. package/lib/esm/features/store/collections/index.js +0 -8
  430. package/lib/esm/features/store/collections/index.js.map +0 -1
  431. package/lib/esm/features/store/index.js +0 -4
  432. package/lib/esm/features/store/index.js.map +0 -1
  433. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +0 -147
  434. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +0 -1
  435. package/lib/esm/features/store/objects/DocumentSearchResults.js +0 -204
  436. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +0 -1
  437. package/lib/esm/features/store/objects/DocumentSelectionProvider.js +0 -81
  438. package/lib/esm/features/store/objects/DocumentSelectionProvider.js.map +0 -1
  439. package/lib/esm/features/store/objects/DocumentTable.js +0 -278
  440. package/lib/esm/features/store/objects/DocumentTable.js.map +0 -1
  441. package/lib/esm/features/store/objects/ExportPropertiesModal.js +0 -31
  442. package/lib/esm/features/store/objects/ExportPropertiesModal.js.map +0 -1
  443. package/lib/esm/features/store/objects/components/ContentDispositionButton.js +0 -31
  444. package/lib/esm/features/store/objects/components/ContentDispositionButton.js.map +0 -1
  445. package/lib/esm/features/store/objects/components/ContentOverview.js +0 -629
  446. package/lib/esm/features/store/objects/components/ContentOverview.js.map +0 -1
  447. package/lib/esm/features/store/objects/components/DocumentIcon.js +0 -33
  448. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +0 -1
  449. package/lib/esm/features/store/objects/components/DocumentInput.js +0 -51
  450. package/lib/esm/features/store/objects/components/DocumentInput.js.map +0 -1
  451. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +0 -157
  452. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +0 -1
  453. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +0 -53
  454. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +0 -1
  455. package/lib/esm/features/store/objects/components/SelectDocument.js +0 -55
  456. package/lib/esm/features/store/objects/components/SelectDocument.js.map +0 -1
  457. package/lib/esm/features/store/objects/components/SelectDocumentModal.js +0 -7
  458. package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +0 -1
  459. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +0 -90
  460. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +0 -1
  461. package/lib/esm/features/store/objects/components/index.js +0 -10
  462. package/lib/esm/features/store/objects/components/index.js.map +0 -1
  463. package/lib/esm/features/store/objects/components/useContentPanelHooks.js +0 -169
  464. package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +0 -1
  465. package/lib/esm/features/store/objects/components/useDownloadObject.js +0 -21
  466. package/lib/esm/features/store/objects/components/useDownloadObject.js.map +0 -1
  467. package/lib/esm/features/store/objects/index.js +0 -11
  468. package/lib/esm/features/store/objects/index.js.map +0 -1
  469. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +0 -86
  470. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +0 -1
  471. package/lib/esm/features/store/objects/layout/documentLayout.js +0 -15
  472. package/lib/esm/features/store/objects/layout/documentLayout.js.map +0 -1
  473. package/lib/esm/features/store/objects/layout/index.js +0 -3
  474. package/lib/esm/features/store/objects/layout/index.js.map +0 -1
  475. package/lib/esm/features/store/objects/layout/renderers.js +0 -157
  476. package/lib/esm/features/store/objects/layout/renderers.js.map +0 -1
  477. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +0 -175
  478. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +0 -1
  479. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +0 -39
  480. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +0 -1
  481. package/lib/esm/features/store/objects/search/index.js +0 -3
  482. package/lib/esm/features/store/objects/search/index.js.map +0 -1
  483. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +0 -150
  484. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +0 -1
  485. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js +0 -2
  486. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js.map +0 -1
  487. package/lib/esm/features/store/objects/selection/SelectionActions.js +0 -69
  488. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +0 -1
  489. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +0 -81
  490. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +0 -1
  491. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +0 -53
  492. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +0 -1
  493. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js +0 -30
  494. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js.map +0 -1
  495. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +0 -84
  496. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +0 -1
  497. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +0 -106
  498. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +0 -1
  499. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +0 -64
  500. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +0 -1
  501. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js +0 -72
  502. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js.map +0 -1
  503. package/lib/esm/features/store/objects/selection/actions/index.js +0 -8
  504. package/lib/esm/features/store/objects/selection/actions/index.js.map +0 -1
  505. package/lib/esm/features/store/objects/selection/index.js +0 -5
  506. package/lib/esm/features/store/objects/selection/index.js.map +0 -1
  507. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +0 -519
  508. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +0 -1
  509. package/lib/esm/features/store/objects/upload/index.js +0 -4
  510. package/lib/esm/features/store/objects/upload/index.js.map +0 -1
  511. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +0 -195
  512. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +0 -1
  513. package/lib/esm/features/store/objects/upload/useUploadHandler.js +0 -230
  514. package/lib/esm/features/store/objects/upload/useUploadHandler.js.map +0 -1
  515. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +0 -81
  516. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +0 -1
  517. package/lib/esm/features/store/types/ContentObjectTypesTable.js +0 -11
  518. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +0 -1
  519. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +0 -26
  520. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +0 -1
  521. package/lib/esm/features/store/types/ObjectSchemaEditor.js +0 -101
  522. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +0 -1
  523. package/lib/esm/features/store/types/SelectContentType.js +0 -43
  524. package/lib/esm/features/store/types/SelectContentType.js.map +0 -1
  525. package/lib/esm/features/store/types/SelectContentTypeModal.js +0 -28
  526. package/lib/esm/features/store/types/SelectContentTypeModal.js.map +0 -1
  527. package/lib/esm/features/store/types/TableLayoutEditor.js +0 -76
  528. package/lib/esm/features/store/types/TableLayoutEditor.js.map +0 -1
  529. package/lib/esm/features/store/types/index.js +0 -9
  530. package/lib/esm/features/store/types/index.js.map +0 -1
  531. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js +0 -98
  532. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js.map +0 -1
  533. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js +0 -15
  534. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js.map +0 -1
  535. package/lib/esm/features/store/types/search/index.js +0 -3
  536. package/lib/esm/features/store/types/search/index.js.map +0 -1
  537. package/lib/esm/features/user/UserAvatar.js +0 -18
  538. package/lib/esm/features/user/UserAvatar.js.map +0 -1
  539. package/lib/esm/features/user/UserInfo.js +0 -121
  540. package/lib/esm/features/user/UserInfo.js.map +0 -1
  541. package/lib/esm/features/user/index.js +0 -3
  542. package/lib/esm/features/user/index.js.map +0 -1
  543. package/lib/esm/features/utils/index.js +0 -6
  544. package/lib/esm/features/utils/index.js.map +0 -1
  545. package/lib/esm/features/utils/mimeType.js +0 -17
  546. package/lib/esm/features/utils/mimeType.js.map +0 -1
  547. package/lib/esm/features/utils/print.js +0 -181
  548. package/lib/esm/features/utils/print.js.map +0 -1
  549. package/lib/esm/features/utils/rendition.js +0 -67
  550. package/lib/esm/features/utils/rendition.js.map +0 -1
  551. package/lib/esm/features/utils/text.js +0 -10
  552. package/lib/esm/features/utils/text.js.map +0 -1
  553. package/lib/esm/features/utils/workflowStatus.js +0 -43
  554. package/lib/esm/features/utils/workflowStatus.js.map +0 -1
  555. package/lib/esm/layout/AppLayout.js +0 -46
  556. package/lib/esm/layout/AppLayout.js.map +0 -1
  557. package/lib/esm/layout/FullHeightLayout.js +0 -18
  558. package/lib/esm/layout/FullHeightLayout.js.map +0 -1
  559. package/lib/esm/layout/Navbar.js +0 -40
  560. package/lib/esm/layout/Navbar.js.map +0 -1
  561. package/lib/esm/layout/Sidebar.js +0 -45
  562. package/lib/esm/layout/Sidebar.js.map +0 -1
  563. package/lib/esm/layout/SidebarContext.js +0 -10
  564. package/lib/esm/layout/SidebarContext.js.map +0 -1
  565. package/lib/esm/layout/TitleBar.js +0 -5
  566. package/lib/esm/layout/TitleBar.js.map +0 -1
  567. package/lib/esm/layout/index.js +0 -7
  568. package/lib/esm/layout/index.js.map +0 -1
  569. package/lib/esm/router/FixLinks.js +0 -23
  570. package/lib/esm/router/FixLinks.js.map +0 -1
  571. package/lib/esm/router/HistoryNavigator.js +0 -192
  572. package/lib/esm/router/HistoryNavigator.js.map +0 -1
  573. package/lib/esm/router/Nav.js +0 -26
  574. package/lib/esm/router/Nav.js.map +0 -1
  575. package/lib/esm/router/NestedNavigationContext.js +0 -19
  576. package/lib/esm/router/NestedNavigationContext.js.map +0 -1
  577. package/lib/esm/router/NestedRouterProvider.js +0 -44
  578. package/lib/esm/router/NestedRouterProvider.js.map +0 -1
  579. package/lib/esm/router/PathMatcher.js +0 -159
  580. package/lib/esm/router/PathMatcher.js.map +0 -1
  581. package/lib/esm/router/PathWithParams.js +0 -34
  582. package/lib/esm/router/PathWithParams.js.map +0 -1
  583. package/lib/esm/router/Route404.js +0 -18
  584. package/lib/esm/router/Route404.js.map +0 -1
  585. package/lib/esm/router/RouteComponent.js +0 -32
  586. package/lib/esm/router/RouteComponent.js.map +0 -1
  587. package/lib/esm/router/Router.js +0 -161
  588. package/lib/esm/router/Router.js.map +0 -1
  589. package/lib/esm/router/RouterProvider.js +0 -41
  590. package/lib/esm/router/RouterProvider.js.map +0 -1
  591. package/lib/esm/router/index.js +0 -11
  592. package/lib/esm/router/index.js.map +0 -1
  593. package/lib/esm/router/path.js +0 -140
  594. package/lib/esm/router/path.js.map +0 -1
  595. package/lib/esm/session/TypeRegistry.js +0 -24
  596. package/lib/esm/session/TypeRegistry.js.map +0 -1
  597. package/lib/esm/session/UserSession.js +0 -192
  598. package/lib/esm/session/UserSession.js.map +0 -1
  599. package/lib/esm/session/UserSessionProvider.js +0 -179
  600. package/lib/esm/session/UserSessionProvider.js.map +0 -1
  601. package/lib/esm/session/auth/composable.js +0 -255
  602. package/lib/esm/session/auth/composable.js.map +0 -1
  603. package/lib/esm/session/auth/firebase.js +0 -158
  604. package/lib/esm/session/auth/firebase.js.map +0 -1
  605. package/lib/esm/session/auth/useAuthState.js +0 -46
  606. package/lib/esm/session/auth/useAuthState.js.map +0 -1
  607. package/lib/esm/session/auth/useCurrentTenant.js +0 -63
  608. package/lib/esm/session/auth/useCurrentTenant.js.map +0 -1
  609. package/lib/esm/session/constants.js +0 -3
  610. package/lib/esm/session/constants.js.map +0 -1
  611. package/lib/esm/session/index.js +0 -9
  612. package/lib/esm/session/index.js.map +0 -1
  613. package/lib/esm/session/useUXTracking.js +0 -29
  614. package/lib/esm/session/useUXTracking.js.map +0 -1
  615. package/lib/esm/shell/SplashScreen.js +0 -26
  616. package/lib/esm/shell/SplashScreen.js.map +0 -1
  617. package/lib/esm/shell/VertesiaShell.js +0 -10
  618. package/lib/esm/shell/VertesiaShell.js.map +0 -1
  619. package/lib/esm/shell/apps/AppInstallationProvider.js +0 -13
  620. package/lib/esm/shell/apps/AppInstallationProvider.js.map +0 -1
  621. package/lib/esm/shell/apps/AppProjectSelector.js +0 -36
  622. package/lib/esm/shell/apps/AppProjectSelector.js.map +0 -1
  623. package/lib/esm/shell/apps/StandaloneApp.js +0 -87
  624. package/lib/esm/shell/apps/StandaloneApp.js.map +0 -1
  625. package/lib/esm/shell/apps/index.js +0 -4
  626. package/lib/esm/shell/apps/index.js.map +0 -1
  627. package/lib/esm/shell/index.js +0 -8
  628. package/lib/esm/shell/index.js.map +0 -1
  629. package/lib/esm/shell/login/EnterpriseSigninButton.js +0 -84
  630. package/lib/esm/shell/login/EnterpriseSigninButton.js.map +0 -1
  631. package/lib/esm/shell/login/GitHubSignInButton.js +0 -24
  632. package/lib/esm/shell/login/GitHubSignInButton.js.map +0 -1
  633. package/lib/esm/shell/login/GoogleSignInButton.js +0 -25
  634. package/lib/esm/shell/login/GoogleSignInButton.js.map +0 -1
  635. package/lib/esm/shell/login/InviteAcceptModal.js +0 -62
  636. package/lib/esm/shell/login/InviteAcceptModal.js.map +0 -1
  637. package/lib/esm/shell/login/MicrosoftSigninButton.js +0 -19
  638. package/lib/esm/shell/login/MicrosoftSigninButton.js.map +0 -1
  639. package/lib/esm/shell/login/PreviewIcon.js +0 -23
  640. package/lib/esm/shell/login/PreviewIcon.js.map +0 -1
  641. package/lib/esm/shell/login/SignInModal.js +0 -9
  642. package/lib/esm/shell/login/SignInModal.js.map +0 -1
  643. package/lib/esm/shell/login/SigninScreen.js +0 -64
  644. package/lib/esm/shell/login/SigninScreen.js.map +0 -1
  645. package/lib/esm/shell/login/SignupForm.js +0 -91
  646. package/lib/esm/shell/login/SignupForm.js.map +0 -1
  647. package/lib/esm/shell/login/TerminalLogin.js +0 -208
  648. package/lib/esm/shell/login/TerminalLogin.js.map +0 -1
  649. package/lib/esm/shell/login/UserInfo.js +0 -41
  650. package/lib/esm/shell/login/UserInfo.js.map +0 -1
  651. package/lib/esm/shell/login/UserSessionMenu.js +0 -37
  652. package/lib/esm/shell/login/UserSessionMenu.js.map +0 -1
  653. package/lib/esm/shell/utils.js +0 -6
  654. package/lib/esm/shell/utils.js.map +0 -1
  655. package/lib/esm/widgets/Progress.js +0 -5
  656. package/lib/esm/widgets/Progress.js.map +0 -1
  657. package/lib/esm/widgets/SvgIcon.js +0 -36
  658. package/lib/esm/widgets/SvgIcon.js.map +0 -1
  659. package/lib/esm/widgets/form/Form.js +0 -100
  660. package/lib/esm/widgets/form/Form.js.map +0 -1
  661. package/lib/esm/widgets/form/FormContext.js +0 -31
  662. package/lib/esm/widgets/form/FormContext.js.map +0 -1
  663. package/lib/esm/widgets/form/ManagedObject.js +0 -287
  664. package/lib/esm/widgets/form/ManagedObject.js.map +0 -1
  665. package/lib/esm/widgets/form/fields.js +0 -12
  666. package/lib/esm/widgets/form/fields.js.map +0 -1
  667. package/lib/esm/widgets/form/index.js +0 -7
  668. package/lib/esm/widgets/form/index.js.map +0 -1
  669. package/lib/esm/widgets/form/inputs.js +0 -38
  670. package/lib/esm/widgets/form/inputs.js.map +0 -1
  671. package/lib/esm/widgets/form/schema.js +0 -199
  672. package/lib/esm/widgets/form/schema.js.map +0 -1
  673. package/lib/esm/widgets/index.js +0 -12
  674. package/lib/esm/widgets/index.js.map +0 -1
  675. package/lib/esm/widgets/json-view/JSONCode.js +0 -22
  676. package/lib/esm/widgets/json-view/JSONCode.js.map +0 -1
  677. package/lib/esm/widgets/json-view/JSONDisplay.js +0 -10
  678. package/lib/esm/widgets/json-view/JSONDisplay.js.map +0 -1
  679. package/lib/esm/widgets/json-view/JSONView.js +0 -106
  680. package/lib/esm/widgets/json-view/JSONView.js.map +0 -1
  681. package/lib/esm/widgets/json-view/index.js +0 -4
  682. package/lib/esm/widgets/json-view/index.js.map +0 -1
  683. package/lib/esm/widgets/json-view/types.js +0 -2
  684. package/lib/esm/widgets/json-view/types.js.map +0 -1
  685. package/lib/esm/widgets/markdown/ArtifactContentRenderer.js +0 -157
  686. package/lib/esm/widgets/markdown/ArtifactContentRenderer.js.map +0 -1
  687. package/lib/esm/widgets/markdown/CodeBlockPlaceholder.js +0 -56
  688. package/lib/esm/widgets/markdown/CodeBlockPlaceholder.js.map +0 -1
  689. package/lib/esm/widgets/markdown/CodeBlockPlaceholder.test.js +0 -50
  690. package/lib/esm/widgets/markdown/CodeBlockPlaceholder.test.js.map +0 -1
  691. package/lib/esm/widgets/markdown/CodeBlockRendering.js +0 -38
  692. package/lib/esm/widgets/markdown/CodeBlockRendering.js.map +0 -1
  693. package/lib/esm/widgets/markdown/MarkdownImage.js +0 -41
  694. package/lib/esm/widgets/markdown/MarkdownImage.js.map +0 -1
  695. package/lib/esm/widgets/markdown/MarkdownLink.js +0 -46
  696. package/lib/esm/widgets/markdown/MarkdownLink.js.map +0 -1
  697. package/lib/esm/widgets/markdown/MarkdownRenderer.js +0 -126
  698. package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +0 -1
  699. package/lib/esm/widgets/markdown/MermaidDiagram.js +0 -73
  700. package/lib/esm/widgets/markdown/MermaidDiagram.js.map +0 -1
  701. package/lib/esm/widgets/markdown/codeBlockHandlers.js +0 -330
  702. package/lib/esm/widgets/markdown/codeBlockHandlers.js.map +0 -1
  703. package/lib/esm/widgets/markdown/codeBlockHandlers.test.js +0 -206
  704. package/lib/esm/widgets/markdown/codeBlockHandlers.test.js.map +0 -1
  705. package/lib/esm/widgets/markdown/index.js +0 -11
  706. package/lib/esm/widgets/markdown/index.js.map +0 -1
  707. package/lib/esm/widgets/markdown/useArtifactContent.js +0 -174
  708. package/lib/esm/widgets/markdown/useArtifactContent.js.map +0 -1
  709. package/lib/esm/widgets/markdown/useResolvedUrl.js +0 -175
  710. package/lib/esm/widgets/markdown/useResolvedUrl.js.map +0 -1
  711. package/lib/esm/widgets/monacoEditor/MonacoEditor.js +0 -140
  712. package/lib/esm/widgets/monacoEditor/MonacoEditor.js.map +0 -1
  713. package/lib/esm/widgets/monacoEditor/index.js +0 -2
  714. package/lib/esm/widgets/monacoEditor/index.js.map +0 -1
  715. package/lib/esm/widgets/popover/Popover.js +0 -73
  716. package/lib/esm/widgets/popover/Popover.js.map +0 -1
  717. package/lib/esm/widgets/popover/context.js +0 -7
  718. package/lib/esm/widgets/popover/context.js.map +0 -1
  719. package/lib/esm/widgets/popover/index.js +0 -3
  720. package/lib/esm/widgets/popover/index.js.map +0 -1
  721. package/lib/esm/widgets/popover/slots.js +0 -22
  722. package/lib/esm/widgets/popover/slots.js.map +0 -1
  723. package/lib/esm/widgets/properties/PropertiesView.js +0 -8
  724. package/lib/esm/widgets/properties/PropertiesView.js.map +0 -1
  725. package/lib/esm/widgets/properties/index.js +0 -2
  726. package/lib/esm/widgets/properties/index.js.map +0 -1
  727. package/lib/esm/widgets/schema-editor/ManagedSchema.js +0 -300
  728. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +0 -1
  729. package/lib/esm/widgets/schema-editor/editor/Editable.js +0 -110
  730. package/lib/esm/widgets/schema-editor/editor/Editable.js.map +0 -1
  731. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js +0 -8
  732. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js.map +0 -1
  733. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +0 -81
  734. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +0 -1
  735. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js +0 -7
  736. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js.map +0 -1
  737. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js +0 -9
  738. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js.map +0 -1
  739. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +0 -84
  740. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +0 -1
  741. package/lib/esm/widgets/schema-editor/index.js +0 -7
  742. package/lib/esm/widgets/schema-editor/index.js.map +0 -1
  743. package/lib/esm/widgets/schema-editor/json-schema4-utils.js +0 -188
  744. package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +0 -1
  745. package/lib/esm/widgets/schema-editor/type-signature.js +0 -30
  746. package/lib/esm/widgets/schema-editor/type-signature.js.map +0 -1
  747. package/lib/esm/widgets/upload/DropZone.js +0 -175
  748. package/lib/esm/widgets/upload/DropZone.js.map +0 -1
  749. package/lib/esm/widgets/upload/UploadResultCategory.js +0 -19
  750. package/lib/esm/widgets/upload/UploadResultCategory.js.map +0 -1
  751. package/lib/esm/widgets/upload/UploadSummary.js +0 -30
  752. package/lib/esm/widgets/upload/UploadSummary.js.map +0 -1
  753. package/lib/esm/widgets/upload/index.js +0 -4
  754. package/lib/esm/widgets/upload/index.js.map +0 -1
  755. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js +0 -11
  756. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js.map +0 -1
  757. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js +0 -8
  758. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js.map +0 -1
  759. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js +0 -11
  760. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js.map +0 -1
  761. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js +0 -11
  762. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js.map +0 -1
  763. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js +0 -9
  764. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js.map +0 -1
  765. package/lib/esm/widgets/xml-viewer/components/Elements/index.js +0 -36
  766. package/lib/esm/widgets/xml-viewer/components/Elements/index.js.map +0 -1
  767. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js +0 -5
  768. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js.map +0 -1
  769. package/lib/esm/widgets/xml-viewer/components/Tag/index.js +0 -13
  770. package/lib/esm/widgets/xml-viewer/components/Tag/index.js.map +0 -1
  771. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js +0 -13
  772. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js.map +0 -1
  773. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +0 -39
  774. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +0 -1
  775. package/lib/esm/widgets/xml-viewer/components/types.js +0 -2
  776. package/lib/esm/widgets/xml-viewer/components/types.js.map +0 -1
  777. package/lib/esm/widgets/xml-viewer/constants/index.js +0 -27
  778. package/lib/esm/widgets/xml-viewer/constants/index.js.map +0 -1
  779. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js +0 -10
  780. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js.map +0 -1
  781. package/lib/esm/widgets/xml-viewer/helpers/index.js +0 -40
  782. package/lib/esm/widgets/xml-viewer/helpers/index.js.map +0 -1
  783. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js +0 -22
  784. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js.map +0 -1
  785. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js +0 -31
  786. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js.map +0 -1
  787. package/lib/esm/widgets/xml-viewer/index.js +0 -3
  788. package/lib/esm/widgets/xml-viewer/index.js.map +0 -1
  789. package/lib/esm/widgets/xml-viewer/types/index.js +0 -2
  790. package/lib/esm/widgets/xml-viewer/types/index.js.map +0 -1
  791. package/lib/tsconfig.tsbuildinfo +0 -1
  792. package/lib/types/core/components/Avatar.d.ts +0 -16
  793. package/lib/types/core/components/Avatar.d.ts.map +0 -1
  794. package/lib/types/core/components/Badge.d.ts +0 -21
  795. package/lib/types/core/components/Badge.d.ts.map +0 -1
  796. package/lib/types/core/components/Button.d.ts +0 -14
  797. package/lib/types/core/components/Button.d.ts.map +0 -1
  798. package/lib/types/core/components/Center.d.ts +0 -8
  799. package/lib/types/core/components/Center.d.ts.map +0 -1
  800. package/lib/types/core/components/ComboBox.d.ts +0 -124
  801. package/lib/types/core/components/ComboBox.d.ts.map +0 -1
  802. package/lib/types/core/components/ConfirmModal.d.ts +0 -11
  803. package/lib/types/core/components/ConfirmModal.d.ts.map +0 -1
  804. package/lib/types/core/components/DeleteModal.d.ts +0 -11
  805. package/lib/types/core/components/DeleteModal.d.ts.map +0 -1
  806. package/lib/types/core/components/Divider.d.ts +0 -6
  807. package/lib/types/core/components/Divider.d.ts.map +0 -1
  808. package/lib/types/core/components/Dropdown.d.ts +0 -15
  809. package/lib/types/core/components/Dropdown.d.ts.map +0 -1
  810. package/lib/types/core/components/DropdownList.d.ts +0 -13
  811. package/lib/types/core/components/DropdownList.d.ts.map +0 -1
  812. package/lib/types/core/components/EmptyCollection.d.ts +0 -9
  813. package/lib/types/core/components/EmptyCollection.d.ts.map +0 -1
  814. package/lib/types/core/components/FileUpload.d.ts +0 -29
  815. package/lib/types/core/components/FileUpload.d.ts.map +0 -1
  816. package/lib/types/core/components/FormItem.d.ts +0 -13
  817. package/lib/types/core/components/FormItem.d.ts.map +0 -1
  818. package/lib/types/core/components/InputList.d.ts +0 -12
  819. package/lib/types/core/components/InputList.d.ts.map +0 -1
  820. package/lib/types/core/components/Link.d.ts +0 -7
  821. package/lib/types/core/components/Link.d.ts.map +0 -1
  822. package/lib/types/core/components/MenuList.d.ts +0 -14
  823. package/lib/types/core/components/MenuList.d.ts.map +0 -1
  824. package/lib/types/core/components/MessageBox.d.ts +0 -36
  825. package/lib/types/core/components/MessageBox.d.ts.map +0 -1
  826. package/lib/types/core/components/Modal.d.ts +0 -30
  827. package/lib/types/core/components/Modal.d.ts.map +0 -1
  828. package/lib/types/core/components/NumberInput.d.ts +0 -16
  829. package/lib/types/core/components/NumberInput.d.ts.map +0 -1
  830. package/lib/types/core/components/Overlay.d.ts +0 -25
  831. package/lib/types/core/components/Overlay.d.ts.map +0 -1
  832. package/lib/types/core/components/Panel.d.ts +0 -11
  833. package/lib/types/core/components/Panel.d.ts.map +0 -1
  834. package/lib/types/core/components/Portal.d.ts +0 -6
  835. package/lib/types/core/components/Portal.d.ts.map +0 -1
  836. package/lib/types/core/components/RadioGroup.d.ts +0 -26
  837. package/lib/types/core/components/RadioGroup.d.ts.map +0 -1
  838. package/lib/types/core/components/SelectBox.d.ts +0 -36
  839. package/lib/types/core/components/SelectBox.d.ts.map +0 -1
  840. package/lib/types/core/components/SelectList.d.ts +0 -19
  841. package/lib/types/core/components/SelectList.d.ts.map +0 -1
  842. package/lib/types/core/components/SelectStack.d.ts +0 -13
  843. package/lib/types/core/components/SelectStack.d.ts.map +0 -1
  844. package/lib/types/core/components/SidePanel.d.ts +0 -11
  845. package/lib/types/core/components/SidePanel.d.ts.map +0 -1
  846. package/lib/types/core/components/Spinner.d.ts +0 -7
  847. package/lib/types/core/components/Spinner.d.ts.map +0 -1
  848. package/lib/types/core/components/Switch.d.ts +0 -11
  849. package/lib/types/core/components/Switch.d.ts.map +0 -1
  850. package/lib/types/core/components/TagsInput.d.ts +0 -16
  851. package/lib/types/core/components/TagsInput.d.ts.map +0 -1
  852. package/lib/types/core/components/index.d.ts +0 -40
  853. package/lib/types/core/components/index.d.ts.map +0 -1
  854. package/lib/types/core/components/libs/utils.d.ts +0 -3
  855. package/lib/types/core/components/libs/utils.d.ts.map +0 -1
  856. package/lib/types/core/components/libs/visuallyHidden.d.ts +0 -7
  857. package/lib/types/core/components/libs/visuallyHidden.d.ts.map +0 -1
  858. package/lib/types/core/components/popup/Popup.d.ts +0 -26
  859. package/lib/types/core/components/popup/Popup.d.ts.map +0 -1
  860. package/lib/types/core/components/popup/PopupController.d.ts +0 -41
  861. package/lib/types/core/components/popup/PopupController.d.ts.map +0 -1
  862. package/lib/types/core/components/popup/index.d.ts +0 -4
  863. package/lib/types/core/components/popup/index.d.ts.map +0 -1
  864. package/lib/types/core/components/popup/position.d.ts +0 -59
  865. package/lib/types/core/components/popup/position.d.ts.map +0 -1
  866. package/lib/types/core/components/popup/utils.d.ts +0 -30
  867. package/lib/types/core/components/popup/utils.d.ts.map +0 -1
  868. package/lib/types/core/components/shadcn/breadcrumb.d.ts +0 -15
  869. package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +0 -1
  870. package/lib/types/core/components/shadcn/button.d.ts +0 -27
  871. package/lib/types/core/components/shadcn/button.d.ts.map +0 -1
  872. package/lib/types/core/components/shadcn/calendar.d.ts +0 -11
  873. package/lib/types/core/components/shadcn/calendar.d.ts.map +0 -1
  874. package/lib/types/core/components/shadcn/card.d.ts +0 -9
  875. package/lib/types/core/components/shadcn/card.d.ts.map +0 -1
  876. package/lib/types/core/components/shadcn/checkbox.d.ts +0 -5
  877. package/lib/types/core/components/shadcn/checkbox.d.ts.map +0 -1
  878. package/lib/types/core/components/shadcn/command.d.ts +0 -17
  879. package/lib/types/core/components/shadcn/command.d.ts.map +0 -1
  880. package/lib/types/core/components/shadcn/dialog.d.ts +0 -38
  881. package/lib/types/core/components/shadcn/dialog.d.ts.map +0 -1
  882. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts +0 -9
  883. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts.map +0 -1
  884. package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts +0 -7
  885. package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts.map +0 -1
  886. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts +0 -6
  887. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts.map +0 -1
  888. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts +0 -9
  889. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts.map +0 -1
  890. package/lib/types/core/components/shadcn/filters/comboBox/StringListCombobox.d.ts +0 -6
  891. package/lib/types/core/components/shadcn/filters/comboBox/StringListCombobox.d.ts.map +0 -1
  892. package/lib/types/core/components/shadcn/filters/comboBox/TextCombobox.d.ts +0 -6
  893. package/lib/types/core/components/shadcn/filters/comboBox/TextCombobox.d.ts.map +0 -1
  894. package/lib/types/core/components/shadcn/filters/comboBox/comboBox.d.ts +0 -5
  895. package/lib/types/core/components/shadcn/filters/comboBox/comboBox.d.ts.map +0 -1
  896. package/lib/types/core/components/shadcn/filters/filter/SelectFilter.d.ts +0 -12
  897. package/lib/types/core/components/shadcn/filters/filter/SelectFilter.d.ts.map +0 -1
  898. package/lib/types/core/components/shadcn/filters/filter/StringListFilter.d.ts +0 -11
  899. package/lib/types/core/components/shadcn/filters/filter/StringListFilter.d.ts.map +0 -1
  900. package/lib/types/core/components/shadcn/filters/filter/TextFilter.d.ts +0 -13
  901. package/lib/types/core/components/shadcn/filters/filter/TextFilter.d.ts.map +0 -1
  902. package/lib/types/core/components/shadcn/filters/filter/dateFilter.d.ts +0 -14
  903. package/lib/types/core/components/shadcn/filters/filter/dateFilter.d.ts.map +0 -1
  904. package/lib/types/core/components/shadcn/filters/filter-styles.d.ts +0 -2
  905. package/lib/types/core/components/shadcn/filters/filter-styles.d.ts.map +0 -1
  906. package/lib/types/core/components/shadcn/filters/filterBar.d.ts +0 -20
  907. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +0 -1
  908. package/lib/types/core/components/shadcn/filters/filters.d.ts +0 -10
  909. package/lib/types/core/components/shadcn/filters/filters.d.ts.map +0 -1
  910. package/lib/types/core/components/shadcn/filters/index.d.ts +0 -6
  911. package/lib/types/core/components/shadcn/filters/index.d.ts.map +0 -1
  912. package/lib/types/core/components/shadcn/filters/types.d.ts +0 -35
  913. package/lib/types/core/components/shadcn/filters/types.d.ts.map +0 -1
  914. package/lib/types/core/components/shadcn/heading.d.ts +0 -6
  915. package/lib/types/core/components/shadcn/heading.d.ts.map +0 -1
  916. package/lib/types/core/components/shadcn/index.d.ts +0 -23
  917. package/lib/types/core/components/shadcn/index.d.ts.map +0 -1
  918. package/lib/types/core/components/shadcn/input.d.ts +0 -17
  919. package/lib/types/core/components/shadcn/input.d.ts.map +0 -1
  920. package/lib/types/core/components/shadcn/label.d.ts +0 -10
  921. package/lib/types/core/components/shadcn/label.d.ts.map +0 -1
  922. package/lib/types/core/components/shadcn/popover.d.ts +0 -24
  923. package/lib/types/core/components/shadcn/popover.d.ts.map +0 -1
  924. package/lib/types/core/components/shadcn/resizeable.d.ts +0 -9
  925. package/lib/types/core/components/shadcn/resizeable.d.ts.map +0 -1
  926. package/lib/types/core/components/shadcn/selectBox.d.ts +0 -36
  927. package/lib/types/core/components/shadcn/selectBox.d.ts.map +0 -1
  928. package/lib/types/core/components/shadcn/separator.d.ts +0 -6
  929. package/lib/types/core/components/shadcn/separator.d.ts.map +0 -1
  930. package/lib/types/core/components/shadcn/tabs.d.ts +0 -36
  931. package/lib/types/core/components/shadcn/tabs.d.ts.map +0 -1
  932. package/lib/types/core/components/shadcn/text.d.ts +0 -11
  933. package/lib/types/core/components/shadcn/text.d.ts.map +0 -1
  934. package/lib/types/core/components/shadcn/textarea.d.ts +0 -4
  935. package/lib/types/core/components/shadcn/textarea.d.ts.map +0 -1
  936. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts +0 -15
  937. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts.map +0 -1
  938. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts +0 -10
  939. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts.map +0 -1
  940. package/lib/types/core/components/shadcn/tooltip.d.ts +0 -21
  941. package/lib/types/core/components/shadcn/tooltip.d.ts.map +0 -1
  942. package/lib/types/core/components/styles.d.ts +0 -7
  943. package/lib/types/core/components/styles.d.ts.map +0 -1
  944. package/lib/types/core/components/table/index.d.ts +0 -19
  945. package/lib/types/core/components/table/index.d.ts.map +0 -1
  946. package/lib/types/core/components/tabs/Tabs.d.ts +0 -25
  947. package/lib/types/core/components/tabs/Tabs.d.ts.map +0 -1
  948. package/lib/types/core/components/tabs/TabsContext.d.ts +0 -17
  949. package/lib/types/core/components/tabs/TabsContext.d.ts.map +0 -1
  950. package/lib/types/core/components/tabs/index.d.ts +0 -3
  951. package/lib/types/core/components/tabs/index.d.ts.map +0 -1
  952. package/lib/types/core/components/toast/NotificationPanel.d.ts +0 -8
  953. package/lib/types/core/components/toast/NotificationPanel.d.ts.map +0 -1
  954. package/lib/types/core/components/toast/ToastContext.d.ts +0 -6
  955. package/lib/types/core/components/toast/ToastContext.d.ts.map +0 -1
  956. package/lib/types/core/components/toast/ToastProps.d.ts +0 -7
  957. package/lib/types/core/components/toast/ToastProps.d.ts.map +0 -1
  958. package/lib/types/core/components/toast/ToastProvider.d.ts +0 -6
  959. package/lib/types/core/components/toast/ToastProvider.d.ts.map +0 -1
  960. package/lib/types/core/components/toast/index.d.ts +0 -3
  961. package/lib/types/core/components/toast/index.d.ts.map +0 -1
  962. package/lib/types/core/hooks/CompositeState.d.ts +0 -137
  963. package/lib/types/core/hooks/CompositeState.d.ts.map +0 -1
  964. package/lib/types/core/hooks/PortalContainerProvider.d.ts +0 -7
  965. package/lib/types/core/hooks/PortalContainerProvider.d.ts.map +0 -1
  966. package/lib/types/core/hooks/SharedState.d.ts +0 -10
  967. package/lib/types/core/hooks/SharedState.d.ts.map +0 -1
  968. package/lib/types/core/hooks/index.d.ts +0 -16
  969. package/lib/types/core/hooks/index.d.ts.map +0 -1
  970. package/lib/types/core/hooks/useClickOutside.d.ts +0 -8
  971. package/lib/types/core/hooks/useClickOutside.d.ts.map +0 -1
  972. package/lib/types/core/hooks/useCopyToClipboard.d.ts +0 -5
  973. package/lib/types/core/hooks/useCopyToClipboard.d.ts.map +0 -1
  974. package/lib/types/core/hooks/useDarkMode.d.ts +0 -2
  975. package/lib/types/core/hooks/useDarkMode.d.ts.map +0 -1
  976. package/lib/types/core/hooks/useDebounce.d.ts +0 -2
  977. package/lib/types/core/hooks/useDebounce.d.ts.map +0 -1
  978. package/lib/types/core/hooks/useEventSource.d.ts +0 -2
  979. package/lib/types/core/hooks/useEventSource.d.ts.map +0 -1
  980. package/lib/types/core/hooks/useFetch.d.ts +0 -24
  981. package/lib/types/core/hooks/useFetch.d.ts.map +0 -1
  982. package/lib/types/core/hooks/useFlag.d.ts +0 -9
  983. package/lib/types/core/hooks/useFlag.d.ts.map +0 -1
  984. package/lib/types/core/hooks/useIntersectionObserver.d.ts +0 -14
  985. package/lib/types/core/hooks/useIntersectionObserver.d.ts.map +0 -1
  986. package/lib/types/core/hooks/useIsFistRendering.d.ts +0 -2
  987. package/lib/types/core/hooks/useIsFistRendering.d.ts.map +0 -1
  988. package/lib/types/core/hooks/useSafeLayoutEffect.d.ts +0 -4
  989. package/lib/types/core/hooks/useSafeLayoutEffect.d.ts.map +0 -1
  990. package/lib/types/core/hooks/useScrollableSearch.d.ts +0 -82
  991. package/lib/types/core/hooks/useScrollableSearch.d.ts.map +0 -1
  992. package/lib/types/core/hooks/useSharedValue.d.ts +0 -12
  993. package/lib/types/core/hooks/useSharedValue.d.ts.map +0 -1
  994. package/lib/types/core/index.d.ts +0 -4
  995. package/lib/types/core/index.d.ts.map +0 -1
  996. package/lib/types/core/utils/cn.d.ts +0 -3
  997. package/lib/types/core/utils/cn.d.ts.map +0 -1
  998. package/lib/types/core/utils/index.d.ts +0 -2
  999. package/lib/types/core/utils/index.d.ts.map +0 -1
  1000. package/lib/types/env/index.d.ts +0 -76
  1001. package/lib/types/env/index.d.ts.map +0 -1
  1002. package/lib/types/features/activity-doc/ActivityDoc.d.ts +0 -14
  1003. package/lib/types/features/activity-doc/ActivityDoc.d.ts.map +0 -1
  1004. package/lib/types/features/activity-doc/index.d.ts +0 -2
  1005. package/lib/types/features/activity-doc/index.d.ts.map +0 -1
  1006. package/lib/types/features/agent/PayloadBuilder.d.ts +0 -69
  1007. package/lib/types/features/agent/PayloadBuilder.d.ts.map +0 -1
  1008. package/lib/types/features/agent/chat/AgentChart.d.ts +0 -75
  1009. package/lib/types/features/agent/chat/AgentChart.d.ts.map +0 -1
  1010. package/lib/types/features/agent/chat/AnimatedThinkingDots.d.ts +0 -38
  1011. package/lib/types/features/agent/chat/AnimatedThinkingDots.d.ts.map +0 -1
  1012. package/lib/types/features/agent/chat/AskUserWidget.d.ts +0 -84
  1013. package/lib/types/features/agent/chat/AskUserWidget.d.ts.map +0 -1
  1014. package/lib/types/features/agent/chat/ImageLightbox.d.ts +0 -18
  1015. package/lib/types/features/agent/chat/ImageLightbox.d.ts.map +0 -1
  1016. package/lib/types/features/agent/chat/JumpingDots.d.ts +0 -7
  1017. package/lib/types/features/agent/chat/JumpingDots.d.ts.map +0 -1
  1018. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts +0 -64
  1019. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +0 -1
  1020. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +0 -29
  1021. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +0 -1
  1022. package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts +0 -10
  1023. package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts.map +0 -1
  1024. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +0 -27
  1025. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +0 -1
  1026. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.d.ts +0 -11
  1027. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.d.ts.map +0 -1
  1028. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +0 -18
  1029. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +0 -1
  1030. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +0 -61
  1031. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +0 -1
  1032. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +0 -30
  1033. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +0 -1
  1034. package/lib/types/features/agent/chat/ModernAgentOutput/MessagesContainer.d.ts +0 -15
  1035. package/lib/types/features/agent/chat/ModernAgentOutput/MessagesContainer.d.ts.map +0 -1
  1036. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts +0 -9
  1037. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +0 -1
  1038. package/lib/types/features/agent/chat/ModernAgentOutput/SlideInPanel.d.ts +0 -11
  1039. package/lib/types/features/agent/chat/ModernAgentOutput/SlideInPanel.d.ts.map +0 -1
  1040. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingMessages.d.ts +0 -8
  1041. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingMessages.d.ts.map +0 -1
  1042. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts +0 -10
  1043. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts.map +0 -1
  1044. package/lib/types/features/agent/chat/ModernAgentOutput/StackedMessages.d.ts +0 -8
  1045. package/lib/types/features/agent/chat/ModernAgentOutput/StackedMessages.d.ts.map +0 -1
  1046. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts +0 -26
  1047. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +0 -1
  1048. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts +0 -12
  1049. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts.map +0 -1
  1050. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts +0 -22
  1051. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +0 -1
  1052. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +0 -107
  1053. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts.map +0 -1
  1054. package/lib/types/features/agent/chat/SkillWidgetProvider.d.ts +0 -11
  1055. package/lib/types/features/agent/chat/SkillWidgetProvider.d.ts.map +0 -1
  1056. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts +0 -18
  1057. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts.map +0 -1
  1058. package/lib/types/features/agent/chat/VegaLiteChart.d.ts +0 -18
  1059. package/lib/types/features/agent/chat/VegaLiteChart.d.ts.map +0 -1
  1060. package/lib/types/features/agent/chat/WaitingMessages.d.ts +0 -2
  1061. package/lib/types/features/agent/chat/WaitingMessages.d.ts.map +0 -1
  1062. package/lib/types/features/agent/chat/index.d.ts +0 -17
  1063. package/lib/types/features/agent/chat/index.d.ts.map +0 -1
  1064. package/lib/types/features/agent/chat/useArtifactUrlCache.d.ts +0 -28
  1065. package/lib/types/features/agent/chat/useArtifactUrlCache.d.ts.map +0 -1
  1066. package/lib/types/features/agent/createChartTool.d.ts +0 -178
  1067. package/lib/types/features/agent/createChartTool.d.ts.map +0 -1
  1068. package/lib/types/features/agent/examples.d.ts +0 -59
  1069. package/lib/types/features/agent/examples.d.ts.map +0 -1
  1070. package/lib/types/features/agent/index.d.ts +0 -5
  1071. package/lib/types/features/agent/index.d.ts.map +0 -1
  1072. package/lib/types/features/agent/visualization.d.ts +0 -95
  1073. package/lib/types/features/agent/visualization.d.ts.map +0 -1
  1074. package/lib/types/features/errors/PanelErrorBoundary.d.ts +0 -5
  1075. package/lib/types/features/errors/PanelErrorBoundary.d.ts.map +0 -1
  1076. package/lib/types/features/errors/RowErrorBoundary.d.ts +0 -8
  1077. package/lib/types/features/errors/RowErrorBoundary.d.ts.map +0 -1
  1078. package/lib/types/features/errors/VertesiaErrorBoundary.d.ts +0 -12
  1079. package/lib/types/features/errors/VertesiaErrorBoundary.d.ts.map +0 -1
  1080. package/lib/types/features/errors/WidgetErrorBoundary.d.ts +0 -5
  1081. package/lib/types/features/errors/WidgetErrorBoundary.d.ts.map +0 -1
  1082. package/lib/types/features/errors/index.d.ts +0 -5
  1083. package/lib/types/features/errors/index.d.ts.map +0 -1
  1084. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts +0 -14
  1085. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts.map +0 -1
  1086. package/lib/types/features/facets/CollectionsFacetsNav.d.ts +0 -14
  1087. package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +0 -1
  1088. package/lib/types/features/facets/DocumentsFacetsNav.d.ts +0 -17
  1089. package/lib/types/features/facets/DocumentsFacetsNav.d.ts.map +0 -1
  1090. package/lib/types/features/facets/EnvironmentFacet.d.ts +0 -10
  1091. package/lib/types/features/facets/EnvironmentFacet.d.ts.map +0 -1
  1092. package/lib/types/features/facets/InteractionsFacetsNav.d.ts +0 -14
  1093. package/lib/types/features/facets/InteractionsFacetsNav.d.ts.map +0 -1
  1094. package/lib/types/features/facets/PromptsFacetsNav.d.ts +0 -15
  1095. package/lib/types/features/facets/PromptsFacetsNav.d.ts.map +0 -1
  1096. package/lib/types/features/facets/RunsFacetsNav.d.ts +0 -20
  1097. package/lib/types/features/facets/RunsFacetsNav.d.ts.map +0 -1
  1098. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts +0 -14
  1099. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +0 -1
  1100. package/lib/types/features/facets/index.d.ts +0 -16
  1101. package/lib/types/features/facets/index.d.ts.map +0 -1
  1102. package/lib/types/features/facets/utils/SearchInterface.d.ts +0 -14
  1103. package/lib/types/features/facets/utils/SearchInterface.d.ts.map +0 -1
  1104. package/lib/types/features/facets/utils/StringFacet.d.ts +0 -11
  1105. package/lib/types/features/facets/utils/StringFacet.d.ts.map +0 -1
  1106. package/lib/types/features/facets/utils/StringListFacet.d.ts +0 -11
  1107. package/lib/types/features/facets/utils/StringListFacet.d.ts.map +0 -1
  1108. package/lib/types/features/facets/utils/TypeFacet.d.ts +0 -16
  1109. package/lib/types/features/facets/utils/TypeFacet.d.ts.map +0 -1
  1110. package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts +0 -12
  1111. package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts.map +0 -1
  1112. package/lib/types/features/facets/utils/VInteractionFacet.d.ts +0 -15
  1113. package/lib/types/features/facets/utils/VInteractionFacet.d.ts.map +0 -1
  1114. package/lib/types/features/facets/utils/VStringFacet.d.ts +0 -21
  1115. package/lib/types/features/facets/utils/VStringFacet.d.ts.map +0 -1
  1116. package/lib/types/features/facets/utils/VTypeFacet.d.ts +0 -12
  1117. package/lib/types/features/facets/utils/VTypeFacet.d.ts.map +0 -1
  1118. package/lib/types/features/facets/utils/VUserFacet.d.ts +0 -11
  1119. package/lib/types/features/facets/utils/VUserFacet.d.ts.map +0 -1
  1120. package/lib/types/features/facets/utils/utils.d.ts +0 -4
  1121. package/lib/types/features/facets/utils/utils.d.ts.map +0 -1
  1122. package/lib/types/features/index.d.ts +0 -12
  1123. package/lib/types/features/index.d.ts.map +0 -1
  1124. package/lib/types/features/layout/GenericPageNavHeader.d.ts +0 -14
  1125. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +0 -1
  1126. package/lib/types/features/layout/NotFoundView.d.ts +0 -5
  1127. package/lib/types/features/layout/NotFoundView.d.ts.map +0 -1
  1128. package/lib/types/features/layout/index.d.ts +0 -3
  1129. package/lib/types/features/layout/index.d.ts.map +0 -1
  1130. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts +0 -13
  1131. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts.map +0 -1
  1132. package/lib/types/features/magic-pdf/DownloadPopover.d.ts +0 -7
  1133. package/lib/types/features/magic-pdf/DownloadPopover.d.ts.map +0 -1
  1134. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts +0 -8
  1135. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts.map +0 -1
  1136. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts +0 -58
  1137. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts.map +0 -1
  1138. package/lib/types/features/magic-pdf/MagicPdfView.d.ts +0 -7
  1139. package/lib/types/features/magic-pdf/MagicPdfView.d.ts.map +0 -1
  1140. package/lib/types/features/magic-pdf/index.d.ts +0 -2
  1141. package/lib/types/features/magic-pdf/index.d.ts.map +0 -1
  1142. package/lib/types/features/magic-pdf/types.d.ts +0 -2
  1143. package/lib/types/features/magic-pdf/types.d.ts.map +0 -1
  1144. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts +0 -83
  1145. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts.map +0 -1
  1146. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts +0 -29
  1147. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts.map +0 -1
  1148. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts +0 -19
  1149. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts.map +0 -1
  1150. package/lib/types/features/pdf-viewer/index.d.ts +0 -4
  1151. package/lib/types/features/pdf-viewer/index.d.ts.map +0 -1
  1152. package/lib/types/features/permissions/SecureButton.d.ts +0 -8
  1153. package/lib/types/features/permissions/SecureButton.d.ts.map +0 -1
  1154. package/lib/types/features/permissions/SecureSidebarItem.d.ts +0 -8
  1155. package/lib/types/features/permissions/SecureSidebarItem.d.ts.map +0 -1
  1156. package/lib/types/features/permissions/UserPermissionsProvider.d.ts +0 -21
  1157. package/lib/types/features/permissions/UserPermissionsProvider.d.ts.map +0 -1
  1158. package/lib/types/features/permissions/helpers.d.ts +0 -5
  1159. package/lib/types/features/permissions/helpers.d.ts.map +0 -1
  1160. package/lib/types/features/permissions/index.d.ts +0 -5
  1161. package/lib/types/features/permissions/index.d.ts.map +0 -1
  1162. package/lib/types/features/store/collections/BrowseCollectionView.d.ts +0 -7
  1163. package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +0 -1
  1164. package/lib/types/features/store/collections/CollectionsTable.d.ts +0 -6
  1165. package/lib/types/features/store/collections/CollectionsTable.d.ts.map +0 -1
  1166. package/lib/types/features/store/collections/CreateCollection.d.ts +0 -13
  1167. package/lib/types/features/store/collections/CreateCollection.d.ts.map +0 -1
  1168. package/lib/types/features/store/collections/EditCollectionView.d.ts +0 -8
  1169. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +0 -1
  1170. package/lib/types/features/store/collections/SelectCollection.d.ts +0 -20
  1171. package/lib/types/features/store/collections/SelectCollection.d.ts.map +0 -1
  1172. package/lib/types/features/store/collections/SharedPropsEditor.d.ts +0 -7
  1173. package/lib/types/features/store/collections/SharedPropsEditor.d.ts.map +0 -1
  1174. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts +0 -7
  1175. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts.map +0 -1
  1176. package/lib/types/features/store/collections/index.d.ts +0 -8
  1177. package/lib/types/features/store/collections/index.d.ts.map +0 -1
  1178. package/lib/types/features/store/index.d.ts +0 -4
  1179. package/lib/types/features/store/index.d.ts.map +0 -1
  1180. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts +0 -8
  1181. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts.map +0 -1
  1182. package/lib/types/features/store/objects/DocumentSearchResults.d.ts +0 -20
  1183. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +0 -1
  1184. package/lib/types/features/store/objects/DocumentSelectionProvider.d.ts +0 -33
  1185. package/lib/types/features/store/objects/DocumentSelectionProvider.d.ts.map +0 -1
  1186. package/lib/types/features/store/objects/DocumentTable.d.ts +0 -25
  1187. package/lib/types/features/store/objects/DocumentTable.d.ts.map +0 -1
  1188. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts +0 -12
  1189. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts.map +0 -1
  1190. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts +0 -9
  1191. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts.map +0 -1
  1192. package/lib/types/features/store/objects/components/ContentOverview.d.ts +0 -9
  1193. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +0 -1
  1194. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +0 -18
  1195. package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +0 -1
  1196. package/lib/types/features/store/objects/components/DocumentInput.d.ts +0 -8
  1197. package/lib/types/features/store/objects/components/DocumentInput.d.ts.map +0 -1
  1198. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts +0 -9
  1199. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts.map +0 -1
  1200. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts +0 -9
  1201. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +0 -1
  1202. package/lib/types/features/store/objects/components/SelectDocument.d.ts +0 -9
  1203. package/lib/types/features/store/objects/components/SelectDocument.d.ts.map +0 -1
  1204. package/lib/types/features/store/objects/components/SelectDocumentModal.d.ts +0 -9
  1205. package/lib/types/features/store/objects/components/SelectDocumentModal.d.ts.map +0 -1
  1206. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts +0 -12
  1207. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts.map +0 -1
  1208. package/lib/types/features/store/objects/components/index.d.ts +0 -10
  1209. package/lib/types/features/store/objects/components/index.d.ts.map +0 -1
  1210. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts +0 -30
  1211. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +0 -1
  1212. package/lib/types/features/store/objects/components/useDownloadObject.d.ts +0 -4
  1213. package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +0 -1
  1214. package/lib/types/features/store/objects/index.d.ts +0 -11
  1215. package/lib/types/features/store/objects/index.d.ts.map +0 -1
  1216. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +0 -18
  1217. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts.map +0 -1
  1218. package/lib/types/features/store/objects/layout/documentLayout.d.ts +0 -20
  1219. package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +0 -1
  1220. package/lib/types/features/store/objects/layout/index.d.ts +0 -3
  1221. package/lib/types/features/store/objects/layout/index.d.ts.map +0 -1
  1222. package/lib/types/features/store/objects/layout/renderers.d.ts +0 -3
  1223. package/lib/types/features/store/objects/layout/renderers.d.ts.map +0 -1
  1224. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +0 -52
  1225. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +0 -1
  1226. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts +0 -14
  1227. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts.map +0 -1
  1228. package/lib/types/features/store/objects/search/index.d.ts +0 -3
  1229. package/lib/types/features/store/objects/search/index.d.ts.map +0 -1
  1230. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts +0 -26
  1231. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +0 -1
  1232. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts +0 -28
  1233. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts.map +0 -1
  1234. package/lib/types/features/store/objects/selection/SelectionActions.d.ts +0 -6
  1235. package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +0 -1
  1236. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts +0 -4
  1237. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts.map +0 -1
  1238. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts +0 -4
  1239. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts.map +0 -1
  1240. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts +0 -16
  1241. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts.map +0 -1
  1242. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +0 -5
  1243. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +0 -1
  1244. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts +0 -4
  1245. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts.map +0 -1
  1246. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts +0 -4
  1247. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts.map +0 -1
  1248. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts +0 -4
  1249. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts.map +0 -1
  1250. package/lib/types/features/store/objects/selection/actions/index.d.ts +0 -8
  1251. package/lib/types/features/store/objects/selection/actions/index.d.ts.map +0 -1
  1252. package/lib/types/features/store/objects/selection/index.d.ts +0 -5
  1253. package/lib/types/features/store/objects/selection/index.d.ts.map +0 -1
  1254. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts +0 -39
  1255. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +0 -1
  1256. package/lib/types/features/store/objects/upload/index.d.ts +0 -4
  1257. package/lib/types/features/store/objects/upload/index.d.ts.map +0 -1
  1258. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts +0 -30
  1259. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +0 -1
  1260. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts +0 -50
  1261. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts.map +0 -1
  1262. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts +0 -6
  1263. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts.map +0 -1
  1264. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts +0 -8
  1265. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts.map +0 -1
  1266. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts +0 -15
  1267. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts.map +0 -1
  1268. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts +0 -8
  1269. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts.map +0 -1
  1270. package/lib/types/features/store/types/SelectContentType.d.ts +0 -11
  1271. package/lib/types/features/store/types/SelectContentType.d.ts.map +0 -1
  1272. package/lib/types/features/store/types/SelectContentTypeModal.d.ts +0 -33
  1273. package/lib/types/features/store/types/SelectContentTypeModal.d.ts.map +0 -1
  1274. package/lib/types/features/store/types/TableLayoutEditor.d.ts +0 -9
  1275. package/lib/types/features/store/types/TableLayoutEditor.d.ts.map +0 -1
  1276. package/lib/types/features/store/types/index.d.ts +0 -9
  1277. package/lib/types/features/store/types/index.d.ts.map +0 -1
  1278. package/lib/types/features/store/types/search/ObjectTypeSearchContext.d.ts +0 -36
  1279. package/lib/types/features/store/types/search/ObjectTypeSearchContext.d.ts.map +0 -1
  1280. package/lib/types/features/store/types/search/ObjectTypeSearchProvider.d.ts +0 -11
  1281. package/lib/types/features/store/types/search/ObjectTypeSearchProvider.d.ts.map +0 -1
  1282. package/lib/types/features/store/types/search/index.d.ts +0 -3
  1283. package/lib/types/features/store/types/search/index.d.ts.map +0 -1
  1284. package/lib/types/features/user/UserAvatar.d.ts +0 -9
  1285. package/lib/types/features/user/UserAvatar.d.ts.map +0 -1
  1286. package/lib/types/features/user/UserInfo.d.ts +0 -48
  1287. package/lib/types/features/user/UserInfo.d.ts.map +0 -1
  1288. package/lib/types/features/user/index.d.ts +0 -3
  1289. package/lib/types/features/user/index.d.ts.map +0 -1
  1290. package/lib/types/features/utils/index.d.ts +0 -6
  1291. package/lib/types/features/utils/index.d.ts.map +0 -1
  1292. package/lib/types/features/utils/mimeType.d.ts +0 -6
  1293. package/lib/types/features/utils/mimeType.d.ts.map +0 -1
  1294. package/lib/types/features/utils/print.d.ts +0 -10
  1295. package/lib/types/features/utils/print.d.ts.map +0 -1
  1296. package/lib/types/features/utils/rendition.d.ts +0 -4
  1297. package/lib/types/features/utils/rendition.d.ts.map +0 -1
  1298. package/lib/types/features/utils/text.d.ts +0 -3
  1299. package/lib/types/features/utils/text.d.ts.map +0 -1
  1300. package/lib/types/features/utils/workflowStatus.d.ts +0 -10
  1301. package/lib/types/features/utils/workflowStatus.d.ts.map +0 -1
  1302. package/lib/types/layout/AppLayout.d.ts +0 -13
  1303. package/lib/types/layout/AppLayout.d.ts.map +0 -1
  1304. package/lib/types/layout/FullHeightLayout.d.ts +0 -27
  1305. package/lib/types/layout/FullHeightLayout.d.ts.map +0 -1
  1306. package/lib/types/layout/Navbar.d.ts +0 -33
  1307. package/lib/types/layout/Navbar.d.ts.map +0 -1
  1308. package/lib/types/layout/Sidebar.d.ts +0 -31
  1309. package/lib/types/layout/Sidebar.d.ts.map +0 -1
  1310. package/lib/types/layout/SidebarContext.d.ts +0 -9
  1311. package/lib/types/layout/SidebarContext.d.ts.map +0 -1
  1312. package/lib/types/layout/TitleBar.d.ts +0 -6
  1313. package/lib/types/layout/TitleBar.d.ts.map +0 -1
  1314. package/lib/types/layout/index.d.ts +0 -7
  1315. package/lib/types/layout/index.d.ts.map +0 -1
  1316. package/lib/types/router/FixLinks.d.ts +0 -7
  1317. package/lib/types/router/FixLinks.d.ts.map +0 -1
  1318. package/lib/types/router/HistoryNavigator.d.ts +0 -59
  1319. package/lib/types/router/HistoryNavigator.d.ts.map +0 -1
  1320. package/lib/types/router/Nav.d.ts +0 -30
  1321. package/lib/types/router/Nav.d.ts.map +0 -1
  1322. package/lib/types/router/NestedNavigationContext.d.ts +0 -9
  1323. package/lib/types/router/NestedNavigationContext.d.ts.map +0 -1
  1324. package/lib/types/router/NestedRouterProvider.d.ts +0 -14
  1325. package/lib/types/router/NestedRouterProvider.d.ts.map +0 -1
  1326. package/lib/types/router/PathMatcher.d.ts +0 -36
  1327. package/lib/types/router/PathMatcher.d.ts.map +0 -1
  1328. package/lib/types/router/PathWithParams.d.ts +0 -9
  1329. package/lib/types/router/PathWithParams.d.ts.map +0 -1
  1330. package/lib/types/router/Route404.d.ts +0 -4
  1331. package/lib/types/router/Route404.d.ts.map +0 -1
  1332. package/lib/types/router/RouteComponent.d.ts +0 -6
  1333. package/lib/types/router/RouteComponent.d.ts.map +0 -1
  1334. package/lib/types/router/Router.d.ts +0 -74
  1335. package/lib/types/router/Router.d.ts.map +0 -1
  1336. package/lib/types/router/RouterProvider.d.ts +0 -15
  1337. package/lib/types/router/RouterProvider.d.ts.map +0 -1
  1338. package/lib/types/router/index.d.ts +0 -11
  1339. package/lib/types/router/index.d.ts.map +0 -1
  1340. package/lib/types/router/path.d.ts +0 -8
  1341. package/lib/types/router/path.d.ts.map +0 -1
  1342. package/lib/types/session/TypeRegistry.d.ts +0 -10
  1343. package/lib/types/session/TypeRegistry.d.ts.map +0 -1
  1344. package/lib/types/session/UserSession.d.ts +0 -40
  1345. package/lib/types/session/UserSession.d.ts.map +0 -1
  1346. package/lib/types/session/UserSessionProvider.d.ts +0 -7
  1347. package/lib/types/session/UserSessionProvider.d.ts.map +0 -1
  1348. package/lib/types/session/auth/composable.d.ts +0 -26
  1349. package/lib/types/session/auth/composable.d.ts.map +0 -1
  1350. package/lib/types/session/auth/firebase.d.ts +0 -10
  1351. package/lib/types/session/auth/firebase.d.ts.map +0 -1
  1352. package/lib/types/session/auth/useAuthState.d.ts +0 -10
  1353. package/lib/types/session/auth/useAuthState.d.ts.map +0 -1
  1354. package/lib/types/session/auth/useCurrentTenant.d.ts +0 -15
  1355. package/lib/types/session/auth/useCurrentTenant.d.ts.map +0 -1
  1356. package/lib/types/session/constants.d.ts +0 -3
  1357. package/lib/types/session/constants.d.ts.map +0 -1
  1358. package/lib/types/session/index.d.ts +0 -9
  1359. package/lib/types/session/index.d.ts.map +0 -1
  1360. package/lib/types/session/useUXTracking.d.ts +0 -6
  1361. package/lib/types/session/useUXTracking.d.ts.map +0 -1
  1362. package/lib/types/shell/SplashScreen.d.ts +0 -7
  1363. package/lib/types/shell/SplashScreen.d.ts.map +0 -1
  1364. package/lib/types/shell/VertesiaShell.d.ts +0 -10
  1365. package/lib/types/shell/VertesiaShell.d.ts.map +0 -1
  1366. package/lib/types/shell/apps/AppInstallationProvider.d.ts +0 -12
  1367. package/lib/types/shell/apps/AppInstallationProvider.d.ts.map +0 -1
  1368. package/lib/types/shell/apps/AppProjectSelector.d.ts +0 -12
  1369. package/lib/types/shell/apps/AppProjectSelector.d.ts.map +0 -1
  1370. package/lib/types/shell/apps/StandaloneApp.d.ts +0 -23
  1371. package/lib/types/shell/apps/StandaloneApp.d.ts.map +0 -1
  1372. package/lib/types/shell/apps/index.d.ts +0 -4
  1373. package/lib/types/shell/apps/index.d.ts.map +0 -1
  1374. package/lib/types/shell/index.d.ts +0 -8
  1375. package/lib/types/shell/index.d.ts.map +0 -1
  1376. package/lib/types/shell/login/EnterpriseSigninButton.d.ts +0 -6
  1377. package/lib/types/shell/login/EnterpriseSigninButton.d.ts.map +0 -1
  1378. package/lib/types/shell/login/GitHubSignInButton.d.ts +0 -6
  1379. package/lib/types/shell/login/GitHubSignInButton.d.ts.map +0 -1
  1380. package/lib/types/shell/login/GoogleSignInButton.d.ts +0 -6
  1381. package/lib/types/shell/login/GoogleSignInButton.d.ts.map +0 -1
  1382. package/lib/types/shell/login/InviteAcceptModal.d.ts +0 -2
  1383. package/lib/types/shell/login/InviteAcceptModal.d.ts.map +0 -1
  1384. package/lib/types/shell/login/MicrosoftSigninButton.d.ts +0 -6
  1385. package/lib/types/shell/login/MicrosoftSigninButton.d.ts.map +0 -1
  1386. package/lib/types/shell/login/PreviewIcon.d.ts +0 -6
  1387. package/lib/types/shell/login/PreviewIcon.d.ts.map +0 -1
  1388. package/lib/types/shell/login/SignInModal.d.ts +0 -7
  1389. package/lib/types/shell/login/SignInModal.d.ts.map +0 -1
  1390. package/lib/types/shell/login/SigninScreen.d.ts +0 -9
  1391. package/lib/types/shell/login/SigninScreen.d.ts.map +0 -1
  1392. package/lib/types/shell/login/SignupForm.d.ts +0 -8
  1393. package/lib/types/shell/login/SignupForm.d.ts.map +0 -1
  1394. package/lib/types/shell/login/TerminalLogin.d.ts +0 -2
  1395. package/lib/types/shell/login/TerminalLogin.d.ts.map +0 -1
  1396. package/lib/types/shell/login/UserInfo.d.ts +0 -6
  1397. package/lib/types/shell/login/UserInfo.d.ts.map +0 -1
  1398. package/lib/types/shell/login/UserSessionMenu.d.ts +0 -9
  1399. package/lib/types/shell/login/UserSessionMenu.d.ts.map +0 -1
  1400. package/lib/types/shell/utils.d.ts +0 -2
  1401. package/lib/types/shell/utils.d.ts.map +0 -1
  1402. package/lib/types/widgets/Progress.d.ts +0 -6
  1403. package/lib/types/widgets/Progress.d.ts.map +0 -1
  1404. package/lib/types/widgets/SvgIcon.d.ts +0 -7
  1405. package/lib/types/widgets/SvgIcon.d.ts.map +0 -1
  1406. package/lib/types/widgets/form/Form.d.ts +0 -22
  1407. package/lib/types/widgets/form/Form.d.ts.map +0 -1
  1408. package/lib/types/widgets/form/FormContext.d.ts +0 -20
  1409. package/lib/types/widgets/form/FormContext.d.ts.map +0 -1
  1410. package/lib/types/widgets/form/ManagedObject.d.ts +0 -82
  1411. package/lib/types/widgets/form/ManagedObject.d.ts.map +0 -1
  1412. package/lib/types/widgets/form/fields.d.ts +0 -16
  1413. package/lib/types/widgets/form/fields.d.ts.map +0 -1
  1414. package/lib/types/widgets/form/index.d.ts +0 -7
  1415. package/lib/types/widgets/form/index.d.ts.map +0 -1
  1416. package/lib/types/widgets/form/inputs.d.ts +0 -8
  1417. package/lib/types/widgets/form/inputs.d.ts.map +0 -1
  1418. package/lib/types/widgets/form/schema.d.ts +0 -47
  1419. package/lib/types/widgets/form/schema.d.ts.map +0 -1
  1420. package/lib/types/widgets/index.d.ts +0 -12
  1421. package/lib/types/widgets/index.d.ts.map +0 -1
  1422. package/lib/types/widgets/json-view/JSONCode.d.ts +0 -5
  1423. package/lib/types/widgets/json-view/JSONCode.d.ts.map +0 -1
  1424. package/lib/types/widgets/json-view/JSONDisplay.d.ts +0 -8
  1425. package/lib/types/widgets/json-view/JSONDisplay.d.ts.map +0 -1
  1426. package/lib/types/widgets/json-view/JSONView.d.ts +0 -7
  1427. package/lib/types/widgets/json-view/JSONView.d.ts.map +0 -1
  1428. package/lib/types/widgets/json-view/index.d.ts +0 -5
  1429. package/lib/types/widgets/json-view/index.d.ts.map +0 -1
  1430. package/lib/types/widgets/json-view/types.d.ts +0 -8
  1431. package/lib/types/widgets/json-view/types.d.ts.map +0 -1
  1432. package/lib/types/widgets/markdown/ArtifactContentRenderer.d.ts +0 -26
  1433. package/lib/types/widgets/markdown/ArtifactContentRenderer.d.ts.map +0 -1
  1434. package/lib/types/widgets/markdown/CodeBlockPlaceholder.d.ts +0 -42
  1435. package/lib/types/widgets/markdown/CodeBlockPlaceholder.d.ts.map +0 -1
  1436. package/lib/types/widgets/markdown/CodeBlockPlaceholder.test.d.ts +0 -2
  1437. package/lib/types/widgets/markdown/CodeBlockPlaceholder.test.d.ts.map +0 -1
  1438. package/lib/types/widgets/markdown/CodeBlockRendering.d.ts +0 -23
  1439. package/lib/types/widgets/markdown/CodeBlockRendering.d.ts.map +0 -1
  1440. package/lib/types/widgets/markdown/MarkdownImage.d.ts +0 -16
  1441. package/lib/types/widgets/markdown/MarkdownImage.d.ts.map +0 -1
  1442. package/lib/types/widgets/markdown/MarkdownLink.d.ts +0 -17
  1443. package/lib/types/widgets/markdown/MarkdownLink.d.ts.map +0 -1
  1444. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts +0 -26
  1445. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +0 -1
  1446. package/lib/types/widgets/markdown/MermaidDiagram.d.ts +0 -23
  1447. package/lib/types/widgets/markdown/MermaidDiagram.d.ts.map +0 -1
  1448. package/lib/types/widgets/markdown/codeBlockHandlers.d.ts +0 -66
  1449. package/lib/types/widgets/markdown/codeBlockHandlers.d.ts.map +0 -1
  1450. package/lib/types/widgets/markdown/codeBlockHandlers.test.d.ts +0 -2
  1451. package/lib/types/widgets/markdown/codeBlockHandlers.test.d.ts.map +0 -1
  1452. package/lib/types/widgets/markdown/index.d.ts +0 -11
  1453. package/lib/types/widgets/markdown/index.d.ts.map +0 -1
  1454. package/lib/types/widgets/markdown/useArtifactContent.d.ts +0 -41
  1455. package/lib/types/widgets/markdown/useArtifactContent.d.ts.map +0 -1
  1456. package/lib/types/widgets/markdown/useResolvedUrl.d.ts +0 -38
  1457. package/lib/types/widgets/markdown/useResolvedUrl.d.ts.map +0 -1
  1458. package/lib/types/widgets/monacoEditor/MonacoEditor.d.ts +0 -41
  1459. package/lib/types/widgets/monacoEditor/MonacoEditor.d.ts.map +0 -1
  1460. package/lib/types/widgets/monacoEditor/index.d.ts +0 -3
  1461. package/lib/types/widgets/monacoEditor/index.d.ts.map +0 -1
  1462. package/lib/types/widgets/popover/Popover.d.ts +0 -38
  1463. package/lib/types/widgets/popover/Popover.d.ts.map +0 -1
  1464. package/lib/types/widgets/popover/context.d.ts +0 -8
  1465. package/lib/types/widgets/popover/context.d.ts.map +0 -1
  1466. package/lib/types/widgets/popover/index.d.ts +0 -3
  1467. package/lib/types/widgets/popover/index.d.ts.map +0 -1
  1468. package/lib/types/widgets/popover/slots.d.ts +0 -5
  1469. package/lib/types/widgets/popover/slots.d.ts.map +0 -1
  1470. package/lib/types/widgets/properties/PropertiesView.d.ts +0 -11
  1471. package/lib/types/widgets/properties/PropertiesView.d.ts.map +0 -1
  1472. package/lib/types/widgets/properties/index.d.ts +0 -2
  1473. package/lib/types/widgets/properties/index.d.ts.map +0 -1
  1474. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +0 -75
  1475. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +0 -1
  1476. package/lib/types/widgets/schema-editor/editor/Editable.d.ts +0 -40
  1477. package/lib/types/widgets/schema-editor/editor/Editable.d.ts.map +0 -1
  1478. package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +0 -8
  1479. package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +0 -1
  1480. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts +0 -5
  1481. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts.map +0 -1
  1482. package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts +0 -4
  1483. package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts.map +0 -1
  1484. package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts +0 -3
  1485. package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts.map +0 -1
  1486. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts +0 -9
  1487. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts.map +0 -1
  1488. package/lib/types/widgets/schema-editor/index.d.ts +0 -7
  1489. package/lib/types/widgets/schema-editor/index.d.ts.map +0 -1
  1490. package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts +0 -16
  1491. package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts.map +0 -1
  1492. package/lib/types/widgets/schema-editor/type-signature.d.ts +0 -19
  1493. package/lib/types/widgets/schema-editor/type-signature.d.ts.map +0 -1
  1494. package/lib/types/widgets/upload/DropZone.d.ts +0 -41
  1495. package/lib/types/widgets/upload/DropZone.d.ts.map +0 -1
  1496. package/lib/types/widgets/upload/UploadResultCategory.d.ts +0 -26
  1497. package/lib/types/widgets/upload/UploadResultCategory.d.ts.map +0 -1
  1498. package/lib/types/widgets/upload/UploadSummary.d.ts +0 -38
  1499. package/lib/types/widgets/upload/UploadSummary.d.ts.map +0 -1
  1500. package/lib/types/widgets/upload/index.d.ts +0 -4
  1501. package/lib/types/widgets/upload/index.d.ts.map +0 -1
  1502. package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts +0 -6
  1503. package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts.map +0 -1
  1504. package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts +0 -8
  1505. package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts.map +0 -1
  1506. package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts +0 -5
  1507. package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts.map +0 -1
  1508. package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts +0 -9
  1509. package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts.map +0 -1
  1510. package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts +0 -8
  1511. package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts.map +0 -1
  1512. package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts +0 -8
  1513. package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts.map +0 -1
  1514. package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts +0 -2
  1515. package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts.map +0 -1
  1516. package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts +0 -13
  1517. package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts.map +0 -1
  1518. package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts +0 -8
  1519. package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts.map +0 -1
  1520. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts +0 -3
  1521. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts.map +0 -1
  1522. package/lib/types/widgets/xml-viewer/components/types.d.ts +0 -104
  1523. package/lib/types/widgets/xml-viewer/components/types.d.ts.map +0 -1
  1524. package/lib/types/widgets/xml-viewer/constants/index.d.ts +0 -27
  1525. package/lib/types/widgets/xml-viewer/constants/index.d.ts.map +0 -1
  1526. package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts +0 -4
  1527. package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts.map +0 -1
  1528. package/lib/types/widgets/xml-viewer/helpers/index.d.ts +0 -13
  1529. package/lib/types/widgets/xml-viewer/helpers/index.d.ts.map +0 -1
  1530. package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts +0 -15
  1531. package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts.map +0 -1
  1532. package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts +0 -10
  1533. package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts.map +0 -1
  1534. package/lib/types/widgets/xml-viewer/index.d.ts +0 -3
  1535. package/lib/types/widgets/xml-viewer/index.d.ts.map +0 -1
  1536. package/lib/types/widgets/xml-viewer/types/index.d.ts +0 -16
  1537. package/lib/types/widgets/xml-viewer/types/index.d.ts.map +0 -1
  1538. package/lib/vertesia-ui-core.js +0 -2
  1539. package/lib/vertesia-ui-core.js.map +0 -1
  1540. package/lib/vertesia-ui-env.js +0 -2
  1541. package/lib/vertesia-ui-env.js.map +0 -1
  1542. package/lib/vertesia-ui-features.js +0 -2
  1543. package/lib/vertesia-ui-features.js.map +0 -1
  1544. package/lib/vertesia-ui-layout.js +0 -2
  1545. package/lib/vertesia-ui-layout.js.map +0 -1
  1546. package/lib/vertesia-ui-router.js +0 -2
  1547. package/lib/vertesia-ui-router.js.map +0 -1
  1548. package/lib/vertesia-ui-session.js +0 -2
  1549. package/lib/vertesia-ui-session.js.map +0 -1
  1550. package/lib/vertesia-ui-shell.js +0 -2
  1551. package/lib/vertesia-ui-shell.js.map +0 -1
  1552. package/lib/vertesia-ui-widgets.js +0 -2
  1553. package/lib/vertesia-ui-widgets.js.map +0 -1
  1554. package/src/core/components/Button.tsx +0 -63
  1555. package/src/core/components/Modal.tsx +0 -144
  1556. package/src/core/components/SelectBox.tsx +0 -188
  1557. package/src/core/components/tabs/Tabs.tsx +0 -132
  1558. package/src/core/components/tabs/TabsContext.ts +0 -25
  1559. package/src/core/components/tabs/index.ts +0 -2
  1560. /package/src/core/components/{MessageBox.tsx → shadcn/MessageBox.tsx} +0 -0
@@ -1,2 +0,0 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{clsx as a}from"clsx";import{AnimatePresence as s,motion as i}from"motion/react";import l,{useMemo as o,useState as c,useEffect as d,useRef as u,createContext as m,useContext as p,useCallback as h,memo as g,Component as f}from"react";import{cn as y,useToast as b,Button as v,Badge as x,Popover as w,PopoverTrigger as N,PopoverContent as k,Command as C,CommandList as S,CommandGroup as _,CommandItem as j,Modal as I,ModalTitle as P,ModalBody as T,RadioGroup as A,FormItem as z,Input as F,ModalFooter as E,RadioOptionAdapter as D,useTheme as $,Center as R,VTooltip as O,useFetch as L,ErrorBox as U,ResizablePanelGroup as M,ResizablePanel as V,ResizableHandle as q,Spinner as B,Portal as W,VModal as K,VModalTitle as H,VModalBody as G,VModalFooter as J,Card as Y,Separator as Z,CardContent as Q,SelectBox as X,InputList as ee,Avatar as te,Table as ne,FilterProvider as re,FilterBtn as ae,FilterBar as se,FilterClear as ie,TBody as le,SharedState as oe,useWatchSharedState as ce,MessageBox as de,VSelectBox as ue,useIntersectionObserver as me,useFlag as pe,Styles as he,Checkbox as ge,NumberInput as fe,SidePanel as ye,Divider as be,Textarea as ve,Switch as xe,TR as we,EmptyCollection as Ne,ConfirmModal as ke,THead as Ce,useDebounce as Se,Panel as _e,CommandInput as je,CommandEmpty as Ie,TagsInput as Pe,SelectList as Te,DialogDescription as Ae,Heading as ze,VTabs as Fe,VTabsBar as Ee,VTabsPanel as De,Breadcrumbs as $e}from"@vertesia/ui/core";import{X as Re,ExternalLink as Oe,ChevronDown as Le,ChevronRight as Ue,CopyIcon as Me,CheckCircle as Ve,AlertCircle as qe,Loader2 as Be,Layers as We,MessageSquare as Ke,HelpCircle as He,Send as Ge,XCircle as Je,Bot as Ye,Info as Ze,User as Qe,Clock as Xe,AlertTriangle as et,ClipboardList as tt,XIcon as nt,MoreVertical as rt,DownloadCloudIcon as at,TableProperties as st,LayoutGrid as it,ChevronsUp as lt,ChevronsDown as ot,Minus as ct,Plus as dt,Maximize as ut,Image as mt,ScanSearch as pt,Download as ht,Maximize2 as gt,Copy as ft,SquarePen as yt,FileSearch as bt,Eye as vt,Users as xt,RefreshCw as wt,UploadIcon as Nt,CheckCircleIcon as kt,AlertCircleIcon as Ct,FileIcon as St,XCircleIcon as _t,FolderIcon as jt,ChevronsUpDown as It,FileText as Pt,Settings as Tt,Trash2 as At,Search as zt,FolderClosed as Ft,Check as Et,EllipsisVertical as Dt,HelpCircleIcon as $t,FileTextIcon as Rt,CheckIcon as Ot,PaperclipIcon as Lt,StopCircleIcon as Ut,SendIcon as Mt,Activity as Vt,Circle as qt,Minimize2 as Bt,Cpu as Wt}from"lucide-react";import{useUserSession as Kt}from"@vertesia/ui/session";import{AgentMessageType as Ht,AgentSearchScope as Gt,mergeInCodePromptSchemas as Jt,supportsToolUse as Yt,ImageRenditionFormat as Zt,WorkflowExecutionStatus as Qt,PDF_RENDITION_NAME as Xt,MarkdownRenditionFormat as en,ContentObjectStatus as tn,ContentNature as nn,POSTER_RENDITION_NAME as rn,AUDIO_RENDITION_NAME as an,PrincipalType as sn,InteractionStatus as ln,SearchTypes as on,SupportedEmbeddingTypes as cn,FileProcessingStatus as dn,normalizeToolCollection as un}from"@vertesia/common";import{FusionFragmentHandler as mn,FusionFragmentProvider as pn}from"@vertesia/fusion-ux";import hn from"dayjs";import{NavLink as gn,useNavigate as fn}from"@vertesia/ui/router";import{MarkdownRenderer as yn,MonacoEditor as bn,Popover as vn,XMLViewer as xn,JSONCode as wn,JSONDisplay as Nn,Progress as kn,DropZone as Cn,UploadSummary as Sn,useSchema as _n,SchemaEditor as jn,ManagedObject as In,GeneratedForm as Pn,CodeBlockRendererProvider as Tn}from"@vertesia/ui/widgets";import An,{Ajv as zn}from"ajv";import{pdfjs as Fn,Document as En,Page as Dn}from"react-pdf";import $n from"dayjs/plugin/localizedFormat";import Rn from"dayjs/plugin/relativeTime";import{Md5 as On}from"ts-md5";import{UserInfo as Ln,SyncMemberHeadsToggle as Un,SharedPropsEditor as Mn}from"@vertesia/ui/features";import{toPng as Vn}from"html-to-image";import*as qn from"@radix-ui/react-dialog";import Bn from"papaparse";import{VegaEmbed as Wn}from"react-vega";import{twMerge as Kn}from"tailwind-merge";import{XAxis as Hn,YAxis as Gn,CartesianGrid as Jn,Tooltip as Yn,Legend as Zn,ReferenceLine as Qn,ResponsiveContainer as Xn,ComposedChart as er,AreaChart as tr,LineChart as nr,BarChart as rr,Line as ar,Area as sr,Bar as ir,PieChart as lr,Pie as or,Cell as cr,ScatterChart as dr,Scatter as ur,RadarChart as mr,PolarGrid as pr,PolarAngleAxis as hr,PolarRadiusAxis as gr,Radar as fr,RadialBarChart as yr,RadialBar as br,FunnelChart as vr,Funnel as xr,LabelList as wr,Treemap as Nr}from"recharts";import{ErrorBoundary as kr}from"react-error-boundary";import{capitalize as Cr}from"lodash-es";import{SidebarItem as Sr}from"@vertesia/ui/layout";function _r({children:t,secondary:n=!1}){return e("span",{className:n?"bg-secondary text-primary":"text-foreground bg-muted",children:t})}function jr(e){return e?"array"===e.name?jr(e.innerType):e:void 0}function Ir({property:n}){return t("div",{className:"flex items-center gap-x-2",children:[e("div",{className:"font-semibold text-gray-600",children:n.name}),n.optional&&e(_r,{children:"optional"}),e(_r,{children:n.type.value})]})}function Pr({activities:t}){return e("div",{className:"flex flex-col gap-y-4 divide-y divide-gray-200",children:t.map(t=>e(Ar,{activity:t},t.name))})}function Tr({code:n,children:r}){return t("div",{className:"flex gap-2 items-center border-b border-b-gray-200 mb-2",children:[e("div",{className:"text-lg font-medium text-gray-900 py-2 ",children:r}),n&&e("div",{children:e(_r,{children:n})})]})}function Ar({activity:n,headingClass:r,headingRef:a}){return t("div",{className:r,id:n.name,ref:a,children:[e("div",{className:"text-xl font-semibold pt-8",children:n.title}),e("div",{className:"pb-4",children:e(_r,{children:n.name})}),n.doc&&e("div",{className:"text-gray-700 pb-2",children:n.doc}),t("div",{className:"pb-4",children:[e(Tr,{code:n.paramsType,children:"Parameters"}),e("div",{className:"divide-y divide-gray-100",children:n.params.map(t=>e(zr,{property:t},t.name))})]}),t("div",{className:"pb-4",children:[e(Tr,{children:"Returns"}),e("div",{children:n.returnType?n.returnType.value:"void"})]})]})}function zr({property:n,className:a}){const s=o(()=>{const t=jr(n.type.innerType)??n.type;return"object"===t.name&&t.members?e(Er,{members:t.members}):"enum"===t.name&&t.enum?e(Fr,{values:t.enum}):null},[n.type.innerType]);return t("div",{className:r("py-2",a),children:[e(Ir,{property:n}),n.doc&&e("div",{className:"text-gray-700 text-sm pt-2",children:n.doc}),s&&e("div",{className:"my-2 overflow-hidden",children:s})]})}function Fr({values:t}){return e("div",{className:"flex flex-wrap items-center gap-2",children:t.map((t,n)=>e(_r,{secondary:!0,children:t},n))})}function Er({members:n}){return e($r,{className:"rounded-md border border-gray-200",button:n=>t("div",{className:"px-4 py-2 flex items-center gap-x-2 text-sm font-medium hover:text-blue-600",children:[e(Rr,{isOpen:n}),e("div",n?{children:"Hide child properties"}:{children:"Show child properties"})]}),body:e(Dr,{properties:n})})}function Dr({properties:t}){return e("div",{className:"border-l-2 border-l-blue-200 flex flex-col divide-y divide-gray-100 border-t border-t-gray-200",children:t.map(t=>e(zr,{property:t,className:"px-4 py-2"},t.name))})}function $r({button:n,body:a,className:l,isInitiallyOpen:o}){const[d,u]=c(o||!1);return t("div",{className:r(d?"block":"inline-block",l),children:[e("button",{className:"p-0 m-0 bg-transparent",onClick:()=>u(!d),children:e(s,{children:n(d)})}),e(s,{children:d&&e(i.div,{className:"overflow-hidden",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:"easeOut"},children:a})})]})}function Rr({isOpen:t}){return e(s,{propagate:!0,mode:"wait",children:e(i.div,{className:"font-mono font-semibold text-gray-400 text-lg",initial:{rotate:0},animate:{rotate:t?45:0},transition:{duration:.2},children:"+"},"closeIcon")})}function Or({className:n,inline:r=!1}){return t("div",{className:y("flex items-center gap-1",r?"inline-flex":"",n),children:[e("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-[jumping_1s_infinite_ease-in-out] hover:bg-blue-600",style:{transform:"translateY(0)",animationRange:"0px -8px"}}),e("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-[jumping_1s_0.3s_infinite_ease-in-out] hover:bg-blue-600",style:{transform:"translateY(0)",animationRange:"0px -8px"}}),e("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-[jumping_1s_0.6s_infinite_ease-in-out] hover:bg-blue-600",style:{transform:"translateY(0)",animationRange:"0px -8px"}})]})}function Lr({className:n,inline:r=!1,color:a="blue"}){const s={blue:"from-blue-400 to-indigo-500 dark:from-blue-500 dark:to-indigo-400",purple:"from-purple-400 to-violet-500 dark:from-purple-500 dark:to-violet-400",teal:"from-teal-400 to-emerald-500 dark:from-teal-500 dark:to-emerald-400",green:"from-green-400 to-emerald-500 dark:from-green-500 dark:to-emerald-400",amber:"from-amber-400 to-orange-500 dark:from-amber-500 dark:to-orange-400"}[a];return t("div",{className:y("flex items-center gap-1.5",r?"inline-flex":"",n),children:[e("div",{className:`w-2 h-2 bg-gradient-to-r ${s} rounded-full animate-[bounce_1.2s_ease-in-out_infinite]`}),e("div",{className:`w-2 h-2 bg-gradient-to-r ${s} rounded-full animate-[bounce_1.2s_ease-in-out_0.2s_infinite]`}),e("div",{className:`w-2 h-2 bg-gradient-to-r ${s} rounded-full animate-[bounce_1.2s_ease-in-out_0.4s_infinite]`})]})}function Ur({className:n,size:r="md",color:a="blue"}){const s={blue:"bg-blue-500 dark:bg-blue-400",purple:"bg-purple-500 dark:bg-purple-400",teal:"bg-teal-500 dark:bg-teal-400",green:"bg-green-500 dark:bg-green-400",amber:"bg-amber-500 dark:bg-amber-400"};return t("span",{className:y("relative flex",n),children:[e("span",{className:y("animate-ping absolute inline-flex h-full w-full rounded-full opacity-60",s[a])}),e("span",{className:y("animate-pulse absolute inline-flex h-[80%] w-[80%] rounded-full opacity-80",s[a]),style:{left:"10%",top:"10%",animationDuration:"2s"}}),e("span",{className:y("relative inline-flex rounded-full",s[a],{sm:"w-3 h-3",md:"w-5 h-5",lg:"w-7 h-7"}[r])})]})}function Mr({className:t,color:n="blue"}){const[r,a]=c(".");return d(()=>{const e=setInterval(()=>{a(e=>"."===e?"..":".."===e?"...":".")},500);return()=>clearInterval(e)},[]),e("span",{className:y({blue:"text-blue-600 dark:text-blue-400",purple:"text-purple-600 dark:text-purple-400",teal:"text-teal-600 dark:text-teal-400",green:"text-green-600 dark:text-green-400",amber:"text-amber-600 dark:text-amber-400"}[n],"font-bold",t),children:r})}function Vr({message:n,className:r,color:a="blue"}){const s={blue:{dot:"bg-blue-500 dark:bg-blue-400",text:"text-blue-700 dark:text-blue-300"},purple:{dot:"bg-purple-500 dark:bg-purple-400",text:"text-purple-700 dark:text-purple-300"},teal:{dot:"bg-teal-500 dark:bg-teal-400",text:"text-teal-700 dark:text-teal-300"},green:{dot:"bg-green-500 dark:bg-green-400",text:"text-green-700 dark:text-green-300"},amber:{dot:"bg-amber-500 dark:bg-amber-400",text:"text-amber-700 dark:text-amber-300"}};return t("div",{className:y("flex items-center gap-2 py-1",r),children:[t("div",{className:"flex space-x-1",children:[e("div",{className:`w-1.5 h-1.5 ${s[a].dot} rounded-full animate-bounce`}),e("div",{className:`w-1.5 h-1.5 ${s[a].dot} rounded-full animate-bounce`,style:{animationDelay:"0.2s"}}),e("div",{className:`w-1.5 h-1.5 ${s[a].dot} rounded-full animate-bounce`,style:{animationDelay:"0.4s"}})]}),e("div",{className:`${s[a].text} font-medium text-xs`,children:n})]})}function qr({className:n,color:r="blue",width:a="md",message:s}){const[i,l]=c(15),[o,m]=c("increasing"),[p,h]=c(.4),g=u(null),f=u(!0);d(()=>{const e=g.current;if(!e)return;const t=new IntersectionObserver(([e])=>{f.current=e.isIntersecting},{threshold:0});return t.observe(e),()=>t.disconnect()},[]);return d(()=>{let e,t=Date.now();const n=()=>{if(!f.current)return void(e=requestAnimationFrame(n));const r=Date.now(),a=r-t;t=r,l(e=>{const t=p*(a/16);let n="increasing"===o?e+t:e-t;return n>=85?(m("decreasing"),h(.3+.2*Math.random()),85):n<=15?(m("increasing"),h(.3+.2*Math.random()),15):(Math.random()>.99&&h(e=>Math.max(.2,Math.min(.5,e+(.1*Math.random()-.05)))),n)}),e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{cancelAnimationFrame(e)}},[o,p]),t("div",{ref:g,className:y("flex flex-col gap-1",n),children:[s&&e("div",{className:`text-xs font-medium ${{blue:"text-blue-700 dark:text-blue-300",purple:"text-purple-700 dark:text-purple-300",teal:"text-teal-700 dark:text-teal-300",green:"text-green-700 dark:text-green-300",amber:"text-amber-700 dark:text-amber-300"}[r]} mb-1`,children:s}),e("div",{className:y("h-1.5 rounded-full overflow-hidden shadow-inner",{blue:"bg-blue-200 dark:bg-blue-900/30",purple:"bg-purple-200 dark:bg-purple-900/30",teal:"bg-teal-200 dark:bg-teal-900/30",green:"bg-green-200 dark:bg-green-900/30",amber:"bg-amber-200 dark:bg-amber-900/30"}[r],{sm:"w-24",md:"w-32",lg:"w-48",xl:"w-64",full:"w-full"}[a]),children:e("div",{className:y("h-full rounded-full",{blue:"bg-gradient-to-r from-blue-400 to-blue-500 dark:from-blue-500 dark:to-blue-400",purple:"bg-gradient-to-r from-purple-400 to-purple-500 dark:from-purple-500 dark:to-purple-400",teal:"bg-gradient-to-r from-teal-400 to-teal-500 dark:from-teal-500 dark:to-teal-400",green:"bg-gradient-to-r from-green-400 to-green-500 dark:from-green-500 dark:to-green-400",amber:"bg-gradient-to-r from-amber-400 to-amber-500 dark:from-amber-500 dark:to-amber-400"}[r]),style:{width:`${i}%`,transition:"width 150ms cubic-bezier(0.4, 0.0, 0.2, 1)"}})})]})}function Br({className:t,color:n="blue",size:r="md"}){const[a,s]=c(Array(7).fill(50)),i=u(null),l=u(!0);d(()=>{const e=i.current;if(!e)return;const t=new IntersectionObserver(([e])=>{l.current=e.isIntersecting},{threshold:0});return t.observe(e),()=>t.disconnect()},[]);const o={sm:{width:"w-16",height:"h-4",barWidth:"w-0.5",gap:"gap-[2px]"},md:{width:"w-20",height:"h-5",barWidth:"w-1",gap:"gap-[3px]"},lg:{width:"w-24",height:"h-6",barWidth:"w-1.5",gap:"gap-1"}},m={blue:"bg-gradient-to-b from-blue-400 to-blue-500 dark:from-blue-400 dark:to-blue-500",purple:"bg-gradient-to-b from-purple-400 to-purple-500 dark:from-purple-400 dark:to-purple-500",teal:"bg-gradient-to-b from-teal-400 to-teal-500 dark:from-teal-400 dark:to-teal-500",green:"bg-gradient-to-b from-green-400 to-green-500 dark:from-green-400 dark:to-green-500",amber:"bg-gradient-to-b from-amber-400 to-amber-500 dark:from-amber-400 dark:to-amber-500"};return d(()=>{let e;const t=[1.2,1,1.5,.8,1.3,.9,1.1],n=[0,.5,1,1.5,2,2.5,3];let r=0;const a=()=>{if(!l.current)return void(e=requestAnimationFrame(a));r+=.02;const i=Array(7).fill(0).map((e,a)=>10+40*(Math.sin(r*t[a]+n[a])+1));s(i),e=requestAnimationFrame(a)};return e=requestAnimationFrame(a),()=>{cancelAnimationFrame(e)}},[]),e("div",{ref:i,className:y("flex items-end justify-center",o[r].width,o[r].height,o[r].gap,t),children:a.map((t,a)=>e("div",{className:y(o[r].barWidth,"rounded-full transform-gpu",m[n]),style:{height:`${t}%`,transition:"height 100ms cubic-bezier(0.4, 0.0, 0.2, 1)",opacity:.9}},a))})}const Wr=m(null);function Kr(){const e=p(Wr);return e||{openImage:e=>window.open(e,"_blank"),closeImage:()=>{}}}function Hr({children:n}){const[r,a]=c(null),s=h((e,t)=>{a({src:e,alt:t})},[]),i=h(()=>{a(null)},[]);return t(Wr.Provider,{value:{openImage:s,closeImage:i},children:[n,r&&e("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:i,children:t("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[e("img",{src:r.src,alt:r.alt||"Enlarged view",className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"}),e("button",{className:"absolute top-2 right-2 text-white bg-black/50 rounded-full p-2 hover:bg-black/70 transition-colors",onClick:i,title:"Close",children:e(Re,{className:"size-6"})}),e("a",{href:r.src,target:"_blank",rel:"noopener noreferrer",className:"absolute bottom-2 right-2 text-white bg-black/50 rounded-full p-2 hover:bg-black/70 transition-colors",onClick:e=>e.stopPropagation(),title:"Open in new tab",children:e(Oe,{className:"size-5"})})]})})]})}const Gr=g(function({message:n,batchData:r,isRunning:a=!1}){const[s,i]=c(!1),l=b(),{tool_name:o,total:d,completed:u,succeeded:m,failed:p,items:h,started_at:g,completed_at:f}=r,y=d>0?u/d*100:0,x=p>0,w=u===d&&!a,N=a||!w?"running":p===d?"error":p>0?"warning":"completed",k=((f?f-g:Date.now()-g)/1e3).toFixed(1);return t("div",{className:`border-l-4 ${"completed"===N?"border-l-success":"error"===N?"border-l-destructive":"warning"===N?"border-l-attention":"border-l-blue-500"} shadow-md overflow-hidden bg-white dark:bg-gray-900 mb-5`,children:[t("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-100/80 dark:border-gray-800/80 bg-blue-50/50 dark:bg-blue-900/10 cursor-pointer",onClick:()=>i(!s),children:[t("div",{className:"flex items-center gap-2",children:[a||!w?e(Ur,{size:"sm",color:"blue"}):"completed"===N?e(Ve,{className:"size-4 text-success"}):"error"===N||"warning"===N?e(qe,{className:"size-4 text-destructive"}):e(We,{className:"size-4 text-purple-600"}),e("span",{className:"text-xs font-medium text-muted",children:"Batch"}),e("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-medium",children:o}),t("span",{className:"text-xs text-muted",children:[u,"/",d]}),e(s?Le:Ue,{className:"size-3 text-muted"})]}),t("div",{className:"flex items-center gap-2",children:[t("span",{className:"text-xs text-muted",children:[k,"s"]}),e("span",{className:"text-xs text-muted",children:hn(g).format("HH:mm:ss")}),e(v,{variant:"ghost",size:"xs",onClick:e=>{e.stopPropagation(),(()=>{const e=JSON.stringify(r,null,2);navigator.clipboard.writeText(e).then(()=>{l({status:"success",title:"Copied batch details to clipboard",duration:2e3})})})()},className:"text-muted",title:"Copy batch details",children:e(Me,{className:"size-3"})})]})]}),e("div",{className:"px-4 py-2 bg-gray-50/50 dark:bg-gray-800/30",children:t("div",{className:"flex items-center gap-3",children:[e("div",{className:"flex-1 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:e("div",{className:`h-full ${x?"bg-attention":w?"bg-success":"bg-blue-500"} transition-all duration-300 ease-out`,style:{width:`${y}%`}})}),t("div",{className:"flex items-center gap-2 text-xs",children:[m>0&&t("span",{className:"text-success flex items-center gap-1",children:[e(Ve,{className:"size-3"}),m]}),p>0&&t("span",{className:"text-destructive flex items-center gap-1",children:[e(qe,{className:"size-3"}),p]}),a&&u<d&&t("span",{className:"text-blue-500 flex items-center gap-1",children:[e(Be,{className:"size-3 animate-spin"}),d-u]})]})]})}),s&&h.length>0&&e("div",{className:"max-h-64 overflow-y-auto",children:h.map(n=>t("div",{className:"flex items-center gap-2 px-4 py-1.5 text-xs border-b border-gray-100 dark:border-gray-800 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[t("div",{className:"w-4 flex-shrink-0",children:["success"===n.status&&e(Ve,{className:"size-3 text-success"}),"error"===n.status&&e(qe,{className:"size-3 text-destructive"}),"running"===n.status&&e(Be,{className:"size-3 text-blue-500 animate-spin"}),"pending"===n.status&&e("div",{className:"size-3 rounded-full border border-gray-300 dark:border-gray-600"})]}),e("span",{className:"font-mono text-muted w-24 truncate flex-shrink-0",title:n.id,children:n.id}),e("span",{className:"text-muted truncate flex-1",title:n.message,children:n.message||("pending"===n.status?"Waiting...":"")}),void 0!==n.duration_ms&&t("span",{className:"text-muted flex-shrink-0",children:[(n.duration_ms/1e3).toFixed(1),"s"]})]},n.id))}),!s&&n.message&&e("div",{className:"px-4 py-2 text-xs text-muted",children:n.message})]})},(e,t)=>e.isRunning===t.isRunning&&(e.batchData.completed===t.batchData.completed&&(e.batchData.succeeded===t.batchData.succeeded&&e.batchData.failed===t.batchData.failed))),Jr={default:{border:"border-l-attention",bg:"bg-amber-50 dark:bg-amber-900/20",icon:"text-attention"},warning:{border:"border-l-destructive",bg:"bg-red-50 dark:bg-red-900/20",icon:"text-destructive"},info:{border:"border-l-info",bg:"bg-blue-50 dark:bg-blue-900/20",icon:"text-info"},success:{border:"border-l-success",bg:"bg-green-50 dark:bg-green-900/20",icon:"text-success"}},Yr={default:He,warning:qe,info:Ke,success:Ve};function Zr({question:n,description:r,options:a,onSelect:s,onMultiSelect:i,onSubmit:o,allowFreeResponse:c=!1,multiSelect:d=!1,placeholder:u="Type your response...",isLoading:m=!1,icon:p,variant:h="default",hideIcon:g=!1,hideBorder:f=!1,className:y,cardClassName:b,headerClassName:x,iconClassName:w,questionClassName:N,descriptionClassName:k,optionsClassName:C,buttonClassName:S,inputContainerClassName:_,inputClassName:j,submitButtonClassName:I}){const[P,T]=l.useState(""),[A,z]=l.useState(new Set),F=l.useRef(null),E=Jr[h],D=Yr[h],$=()=>{P.trim()&&o&&(o(P.trim()),T(""))},R=f?"":`border-l-4 ${E.border}`;return e("div",{className:`my-4 font-sans ${y||""}`,children:t("div",{className:`${R} ${E.bg} rounded-r-lg shadow-sm ${b||""}`,children:[e("div",{className:`px-4 py-3 ${x||""}`,children:t("div",{className:"flex items-start gap-3",children:[!g&&e("div",{className:`flex-shrink-0 mt-0.5 ${E.icon} ${w||""}`,children:p||e(D,{className:"size-5"})}),t("div",{className:"flex-1 min-w-0",children:[e("h4",{className:`text-sm font-semibold text-gray-900 dark:text-gray-100 ${N||""}`,children:n}),r&&e("p",{className:`mt-1 text-sm text-gray-600 dark:text-gray-400 ${k||""}`,children:r})]})]})}),a&&a.length>0&&e("div",{className:`px-4 pb-3 pt-1 ${C||""}`,children:d?t("div",{className:"space-y-2",children:[a.map(n=>t("label",{className:`flex items-start gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors\n ${A.has(n.id)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-300 dark:border-blue-700":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700"}\n ${m?"opacity-50 cursor-not-allowed":""}`,children:[e("input",{type:"checkbox",checked:A.has(n.id),onChange:()=>{return e=n.id,void z(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e},disabled:m,className:"mt-0.5 w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"}),t("div",{className:"flex-1 overflow-hidden",children:[t("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-gray-100 break-words",children:[n.icon,e("span",{className:"break-words",children:n.label})]}),n.description&&e("div",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap",children:n.description})]})]},n.id)),e("div",{className:"pt-2",children:t(v,{size:"sm",onClick:()=>{A.size>0&&i&&(i(Array.from(A)),z(new Set))},disabled:m||0===A.size,className:"flex items-center gap-2",children:[e(Ge,{className:"size-4"}),"Submit Selection",A.size>0?` (${A.size})`:""]})})]}):e("div",{className:"flex flex-col gap-2 w-full",children:a.map(n=>e("button",{onClick:()=>s?.(n.id),disabled:m,className:`w-full text-left px-4 py-3 rounded-lg border border-gray-200 dark:border-gray-700\n bg-white dark:bg-gray-800\n hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1\n transition-colors\n ${m?"opacity-50 cursor-not-allowed":"cursor-pointer"}\n ${S||""}`,children:t("div",{className:"flex items-start gap-3",children:[n.icon&&e("span",{className:"flex-shrink-0 mt-0.5 text-gray-500 dark:text-gray-400",children:n.icon}),t("div",{className:"flex-1 overflow-hidden",children:[e("div",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 break-words",children:n.label}),n.description&&e("div",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap",children:n.description})]})]})},n.id))})}),c&&e("div",{className:`px-4 pb-3 pt-1 ${_||""}`,children:t("div",{className:"flex gap-2",children:[e("input",{ref:F,type:"text",value:P,onChange:e=>T(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),$())},placeholder:u,disabled:m,className:`flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent ${j||""}`}),e(v,{size:"sm",onClick:$,disabled:m||!P.trim(),className:I,children:m?"...":"Send"})]})})]})})}function Qr({question:t,description:n,onConfirm:r,onCancel:a,confirmLabel:s="Yes",cancelLabel:i="No",isLoading:l=!1,variant:o="default",className:c}){return e(Zr,{question:t,description:n,variant:o,isLoading:l,className:c,options:[{id:"confirm",label:s,icon:e(Ve,{className:"size-4"})},{id:"cancel",label:i,icon:e(Je,{className:"size-4"})}],onSelect:e=>{"confirm"===e?r():a()}})}const Xr=["Brewing some code magic...","Doing the robot dance...","Cooking up something good...","Working my gears...","Parsing the possibilities...","Crunching the numbers...","Connecting the digital dots...","Processing at maximum capacity...","Searching through my circuits...","Running advanced algorithms...","Computing optimal solutions...","Loading brilliance.exe...","Scanning the knowledge base...","Optimizing response protocols...","Having a quick brainstorm...","Thinking cap firmly on...","Pondering the digital universe...","Consulting my silicon wisdom...","Untangling the logic knots...","Assembling clever responses...","Mixing thoughtful ingredients...","Polishing the perfect answer...","Taking a momentary mind sprint...","Connecting virtual synapses...","Baking fresh ideas...","Stirring the thought pot...","Simmering solutions slowly...","Whipping up a smart response...","Adding a dash of intelligence...","Preparing a gourmet answer...","Growing brilliant ideas...","Cultivating the perfect response...","Gathering digital nectar...","Planting seeds of solutions...","Exploring the data landscape...","Mapping the solution path...","Navigating through possibilities...","Charting the course to answers...","Embarking on a thought expedition...","Sketching out concepts...","Painting with digital brushstrokes...","Composing my response symphony...","Crafting precision answers...","Weaving threads of information...","Just a moment of processing...","Taking a quick thinking break...","Almost there, final touches...","Putting the pieces together...","Making progress, hold tight..."];function ea(e,t){const n="number"==typeof t.timestamp?t.timestamp:new Date(t.timestamp).getTime(),r=e.findIndex(e=>("number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime())>n);-1===r?e.push(t):e.splice(r,0,t)}const ta=[Ht.COMPLETE,Ht.IDLE,Ht.REQUEST_INPUT,Ht.TERMINATED];function na(e){return e.workstream_id?(e.type===Ht.COMPLETE&&console.log("[getWorkstreamId] COMPLETE message with workstream_id:",e.workstream_id),e.workstream_id):(e.type===Ht.COMPLETE&&console.log("[getWorkstreamId] COMPLETE message without workstream_id, defaulting to 'main'"),"main")}function ra(e){return e.type===Ht.THOUGHT&&!!e.details?.tool}function aa(e){return e.details?.tool_run_id}function sa(e){return e.details?.tool_iteration}function ia(e){return e.details?.tool_status}function la(e){return"number"==typeof e?e:new Date(e).getTime()}function oa(e,t,n){const r=new Map,a=new Map,s=[];for(const t of e)if(ra(t)){const e=sa(t),n=aa(t);void 0!==e?(r.has(e)||r.set(e,{messages:[],firstTimestamp:la(t.timestamp)}),r.get(e).messages.push(t)):n?(a.has(n)||a.set(n,{messages:[],firstTimestamp:la(t.timestamp)}),a.get(n).messages.push(t)):s.push(t)}else s.push(t);const i=[];r.forEach((e,t)=>{i.push({kind:"iteration_group",iteration:t,messages:e.messages,timestamp:e.firstTimestamp})}),a.forEach((e,t)=>{i.push({kind:"tool_run",toolRunId:t,messages:e.messages,timestamp:e.firstTimestamp})});for(const e of s)i.push({kind:"message",message:e,timestamp:la(e.timestamp)});t.forEach((e,t)=>{if(e.text){if(n&&"all"!==n){const t=e.workstreamId||"main";if(n!==t)return}i.push({kind:"streaming",streamingId:t,data:e,timestamp:e.startTimestamp})}}),i.sort((e,t)=>{const n="streaming"===e.kind&&!e.data.isComplete,r="streaming"===t.kind&&!t.data.isComplete;return n&&!r?1:r&&!n?-1:e.timestamp-t.timestamp});const l=[];let o=[];const c=()=>{o.length>0&&(1===o.length?l.push({type:"single",message:o[0]}):l.push({type:"tool_group",messages:o,firstTimestamp:la(o[0].timestamp)}),o=[])};for(const e of i)if("streaming"===e.kind)c(),l.push({type:"streaming",streamingId:e.streamingId,text:e.data.text,workstreamId:e.data.workstreamId,startTimestamp:e.data.startTimestamp,isComplete:e.data.isComplete});else if("iteration_group"===e.kind){c();const t=[...e.messages].sort((e,t)=>la(e.timestamp)-la(t.timestamp)),n=t.reduce((e,t)=>ia(t)||e,void 0);l.push({type:"tool_group",messages:t,firstTimestamp:e.timestamp,toolStatus:n})}else if("tool_run"===e.kind){c();const t=[...e.messages].sort((e,t)=>la(e.timestamp)-la(t.timestamp)),n=t.reduce((e,t)=>ia(t)||e,void 0);l.push({type:"tool_group",messages:t,firstTimestamp:e.timestamp,toolRunId:e.toolRunId,toolStatus:n})}else ra(e.message)?o.push(e.message):(c(),l.push({type:"single",message:e.message}));return c(),l}const ca=m(null);function da({children:t}){const n=u(new Map),r=u(new Map),a=h(e=>n.current.get(e),[]),s=h((e,t)=>{n.current.set(e,t)},[]),i=h(async(e,t)=>{const a=n.current.get(e);if(a)return a;const s=r.current.get(e);if(s)return s;const i=t().then(t=>(n.current.set(e,t),r.current.delete(e),t)).catch(t=>{throw r.current.delete(e),t});return r.current.set(e,i),i},[]),o=l.useMemo(()=>({getUrl:a,setUrl:s,getOrFetch:i}),[a,s,i]);return e(ca.Provider,{value:o,children:t})}function ua(){return p(ca)}function ma(e,t,n="inline"){return`artifact:${e}:${t}:${n}`}function pa(e){return`file:${e}`}const ha={[Ht.ANSWER]:{borderColor:"border-l-info",bgColor:"bg-info",iconColor:"text-info",sender:"Agent",Icon:Ye},[Ht.COMPLETE]:{borderColor:"border-l-success",bgColor:"bg-success",iconColor:"text-success",sender:"Completed",Icon:Ve},[Ht.IDLE]:{borderColor:"border-l-info",bgColor:"bg-info/50",iconColor:"text-info",sender:"Ready",Icon:Xe},[Ht.REQUEST_INPUT]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Input",Icon:Qe},[Ht.QUESTION]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"User",Icon:Qe},[Ht.THOUGHT]:{borderColor:"border-l-purple-500",bgColor:"bg-purple-50/50 dark:bg-purple-900/10",iconColor:"text-purple-600 dark:text-purple-400",sender:"Agent",Icon:Ye},[Ht.ERROR]:{borderColor:"border-l-destructive",bgColor:"bg-destructive",iconColor:"text-destructive",sender:"Error",Icon:qe},[Ht.UPDATE]:{borderColor:"border-l-success",bgColor:"bg-success",iconColor:"text-success",sender:"Update",Icon:Ze},[Ht.PLAN]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Plan",Icon:Ke},[Ht.TERMINATED]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"Terminated",Icon:Ve},[Ht.WARNING]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Warning",Icon:qe},[Ht.SYSTEM]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"System",Icon:Ze},[Ht.STREAMING_CHUNK]:{borderColor:"border-l-info",bgColor:"bg-info",iconColor:"text-info",sender:"Agent",Icon:Ye},[Ht.BATCH_PROGRESS]:{borderColor:"border-l-blue-500",bgColor:"bg-blue-50/50 dark:bg-blue-900/10",iconColor:"text-blue-600 dark:text-blue-400",sender:"Batch",Icon:We},default:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"Agent",Icon:Ye}};const ga=g(function({message:n,showPulsatingCircle:r=!1,onSendMessage:a,className:s,cardClassName:i,headerClassName:l,contentClassName:m,timestampClassName:p,senderClassName:h,iconClassName:g,detailsClassName:f,artifactsClassName:y}){const[w,N]=c(!1),{client:k}=Kt(),C=b(),S=ua(),{openImage:_}=Kr(),j=u(k);j.current=k;const I=u(S);I.current=S;const P=ha[n.type]||ha.default,T=o(()=>{let e="";if(n.message&&(e="object"==typeof n.message?JSON.stringify(n.message,null,2):n.message.trim?n.message.trim():String(n.message)),"string"==typeof e&&e.includes("%thinking_message%")){const t=Math.floor(Math.random()*Xr.length);e=e.replace(/%thinking_message%/g,Xr[t])}return e},[n.message]),A=o(()=>T?function(e,t,n){if("string"!=typeof e)return e;if(t===Ht.THOUGHT||"string"==typeof n&&(n.toLowerCase().includes("thinking about")||n.toLowerCase().includes("i'm thinking")||n.toLowerCase().includes("💭"))){let t=e;return/\d+\.\s+.+/.test(t)&&(t=t.replace(/(\d+\.\s+.+?)(?=\s+\d+\.\s+|$)/g,"$1\n\n"),t=t.replace(/(\d+\.\s+.+\n)([^\d\n][^:])/g,"$1 $2")),t.includes(":")&&!t.includes("\n\n")&&(t=t.replace(/\b(First|Next|Then|Finally|Lastly|Additionally|Step \d+):\s+/gi,"\n\n$&")),t.includes(" - ")&&(t=t.replace(/\s+-\s+/g,"\n- ")),t}return/\d+\.\s+.+/.test(e)&&!e.includes("\n\n")?e.replace(/(\d+\.\s+.+?)(?=\s+\d+\.\s+|$)/g,"$1\n\n"):e}(T,n.type,"string"==typeof n.message?n.message:void 0):"",[T,n.type,n.message]),z=t=>{if("object"==typeof t)return e("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto bg-gray-100 dark:bg-gray-800 p-2 rounded text-gray-700 ",children:JSON.stringify(t,null,2)});const r=n.workflow_run_id;return e("div",{className:"vprose prose prose-slate dark:prose-invert prose-p:leading-relaxed prose-p:my-3 prose-headings:font-semibold prose-headings:tracking-normal prose-headings:mt-6 prose-headings:mb-3 prose-h1:text-xl prose-h2:text-lg prose-h3:text-base prose-li:my-1 prose-ul:my-3 prose-ol:my-3 prose-table:my-5 prose-pre:my-4 prose-hr:my-6 max-w-none text-[15px] break-words",style:{overflowWrap:"anywhere"},children:e(yn,{artifactRunId:r,onProposalSelect:e=>a?.(e),onProposalSubmit:e=>a?.(e),components:{a:({node:t,ref:n,...r})=>{const a=r.href||"";return a.includes("/store/objects")?e(gn,{href:a,topLevelNav:!0,children:r.children}):e("a",{...r,target:"_blank",rel:"noopener noreferrer"})},img:({node:t,ref:n,...r})=>e("img",{...r,className:"max-w-full h-auto rounded-lg shadow-md my-3 cursor-pointer hover:shadow-lg transition-shadow",loading:"lazy",onClick:()=>r.src&&_(r.src,r.alt)})},children:t})})},[F,E]=c([]),D=n.workflow_run_id,$=n.details,R=$?.outputFiles??$?.files,O=Array.isArray(R)?R.join(","):"";d(()=>{(async()=>{if(!D||!Array.isArray(R)||0===R.length)return void E([]);const e=j.current,t=I.current;try{const n=await Promise.all(R.map(async n=>{if("string"!=typeof n||!n.trim())return null;const r=n.trim(),a=r.startsWith("out/")||r.startsWith("files/")||r.startsWith("scripts/")?r:`out/${r}`,s=a.split(".").pop()?.toLowerCase()||"",i=new Set(["png","jpg","jpeg","gif","webp","bmp","svg"]).has(s),l=i?"inline":"attachment";try{const n=ma(D,a,l);let s;if(t)s=await t.getOrFetch(n,async()=>(await e.files.getArtifactDownloadUrl(D,a,l)).url);else{s=(await e.files.getArtifactDownloadUrl(D,a,l)).url}return{displayName:r,artifactPath:a,url:s,isImage:i}}catch(e){return console.error(`Failed to resolve artifact URL for ${a}`,e),null}}));E(n.filter(e=>!!e))}catch(e){console.error("Error loading artifact URLs from message details",e),E([])}})()},[D,O]);const L=na(n),{Icon:U}=P;return e("div",{className:`w-full max-w-full ${s||""}`,children:t("div",{className:`border-l-4 bg-white dark:bg-gray-900 mb-4 w-full max-w-full overflow-hidden ${P.borderColor} ${i||""}`,"data-workstream-id":L,children:[t("div",{className:`flex items-center justify-between px-4 py-1.5 ${l||""}`,children:[t("div",{className:"flex items-center gap-1.5",children:[e("div",{className:`${r?"animate-fadeIn":""} ${g||""}`,children:r?e(Ur,{size:"sm",color:"blue"}):e(U,{className:`size-4 ${P.iconColor}`})}),e("span",{className:`text-xs font-medium text-muted ${h||""}`,children:P.sender}),"main"!==L&&"all"!==L&&e(x,{variant:"default",className:"text-xs text-muted ml-1",children:L})]}),t("div",{className:"flex items-center gap-1.5 print:hidden",children:[e("span",{className:`text-[11px] text-muted/70 ${p||""}`,children:hn(n.timestamp).format("HH:mm:ss")}),e(v,{variant:"ghost",size:"xs",onClick:()=>{const e=T||"",t="string"==typeof n.details?n.details:n.details?JSON.stringify(n.details,null,2):"",r=[e,t?"\n\nDetails:\n"+t:""].join("").trim();navigator.clipboard.writeText(r).then(()=>{C({status:"success",title:"Copied to clipboard",duration:2e3})})},className:"text-muted/50 hover:text-muted h-5 w-5 p-0",title:"Copy message",children:e(Me,{className:"size-3"})})]})]}),t("div",{className:`px-4 pb-3 bg-white dark:bg-gray-900 overflow-hidden ${m||""}`,children:[n.type===Ht.REQUEST_INPUT&&n.details?.ux?(()=>{const t=n.details.ux;return e(Zr,{question:"string"==typeof T?T:"",options:t.options,variant:t.variant,multiSelect:t.multiSelect,allowFreeResponse:t.allowFreeResponse,placeholder:t.placeholder,onSelect:e=>a?.(e),onMultiSelect:e=>a?.(e.join(", ")),onSubmit:e=>a?.(e),hideBorder:!0})})():T&&e("div",{className:"message-content break-words w-full",style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:z(A||T)}),F.length>0&&t("div",{className:`mt-3 text-xs ${y||""}`,children:[e("div",{className:"font-medium text-muted mb-1",children:"Artifacts"}),F.some(e=>e.isImage)&&e("div",{className:"mb-2 flex flex-wrap gap-3",children:F.filter(e=>e.isImage).map(({displayName:n,artifactPath:r,url:a})=>t("div",{className:"max-w-xs cursor-pointer",onClick:()=>_(a,n),children:[e("img",{src:a,alt:n,className:"max-w-full h-auto rounded-lg shadow-sm hover:shadow-md transition-shadow"}),e("div",{className:"mt-1 text-[11px] text-muted truncate",children:n})]},`${r}-preview`))}),e("div",{className:"flex flex-wrap gap-2 print:hidden",children:F.map(({displayName:t,artifactPath:n,url:r})=>e(v,{variant:"outline",size:"xs",className:"px-2 py-1 text-xs",onClick:()=>window.open(r,"_blank"),title:n,children:t},n+r))})]}),n.details&&t("div",{className:`mt-2 print:hidden ${f||""}`,children:[t("button",{onClick:()=>N(!w),className:"text-xs text-muted flex items-center",children:[w?"Hide":"Show"," details",e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 ml-1 transition-transform "+(w?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),w&&e("div",{className:"mt-2 p-2 bg-muted border border-mixer-muted/40 rounded text-sm",children:"string"==typeof n.details?z(n.details):e("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto bg-muted p-2 rounded text-muted ",children:JSON.stringify(n.details,null,2)})})]})]})]})})},(e,t)=>e.message.timestamp===t.message.timestamp&&e.showPulsatingCircle===t.showPulsatingCircle&&e.onSendMessage===t.onSendMessage&&e.className===t.className&&e.cardClassName===t.cardClassName&&e.headerClassName===t.headerClassName&&e.contentClassName===t.contentClassName&&e.timestampClassName===t.timestampClassName&&e.senderClassName===t.senderClassName&&e.iconClassName===t.iconClassName&&e.detailsClassName===t.detailsClassName&&e.artifactsClassName===t.artifactsClassName);const fa=l.memo(function({text:n,workstreamId:r,revealSpeed:a=300,isComplete:s=!1,timestamp:i,className:l,headerClassName:m,contentClassName:p}){const[g,f]=c(0),[x,w]=c(""),N=u(null),k=u(n.length),C=u(0),S=u(i||Date.now()),_=u(n),j=u(0),I=u(performance.now()),P=u(a),T=u(0);d(()=>{const e=performance.now(),t=n.length-j.current,r=e-I.current;if(t>0&&r>30){const e=t/r*1e3,n=.2;P.current=P.current*(1-n)+e*n,P.current=Math.max(50,Math.min(2e3,P.current))}j.current=n.length,I.current=e},[n.length]),k.current=n.length,_.current=n;const A=h(()=>{let e=performance.now();const t=n=>{const r=n-e;e=n;const a=k.current-C.current;if(a<=0)return T.current=0,void(N.current=null);let i;if(s)i=Math.max(500,2*P.current);else if(a<20)i=.85*P.current;else if(a<100)i=P.current;else if(a<500){const e=(a-100)/400;i=P.current*(1+.5*e)}else i=2*P.current;const l=i*r/1e3+T.current,o=Math.floor(l);T.current=l-o,o>0&&(C.current=Math.min(C.current+o,k.current),f(C.current)),N.current=requestAnimationFrame(t)};N.current=requestAnimationFrame(t)},[s]);d(()=>(n.length>C.current&&!N.current&&A(),()=>{N.current&&(cancelAnimationFrame(N.current),N.current=null)}),[n.length,A]),d(()=>{s&&C.current<n.length&&(N.current&&(cancelAnimationFrame(N.current),N.current=null),A())},[s,n.length,A]);const z=u(null),F=u(0);d(()=>{(g>=k.current||s)&&(w(_.current.slice(0,g)),F.current=g)},[g,s]);const E=g<n.length&&!s;d(()=>{if(E)return z.current||(z.current=window.setInterval(()=>{const e=C.current;e>F.current&&(w(_.current.slice(0,e)),F.current=e)},33)),()=>{z.current&&(clearInterval(z.current),z.current=null)};z.current&&(clearInterval(z.current),z.current=null)},[E]);const D=b(),$=o(()=>hn(S.current).format("HH:mm:ss"),[]),R=g<n.length,O=o(()=>{const e=x||n.slice(0,g);return R?e+"│":e},[x,n,g,R]);return n?e("div",{className:y("w-full max-w-full",l),children:t("div",{className:"border-l-4 bg-white dark:bg-gray-900 mb-4 border-l-purple-500 w-full max-w-full overflow-hidden","data-workstream-id":r,children:[t("div",{className:y("flex items-center justify-between px-4 py-1.5",m),children:[t("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"animate-fadeIn",children:R?e("span",{className:"size-2 rounded-full bg-blue-500 animate-pulse inline-block"}):e(Ye,{className:"size-4 text-purple-600 dark:text-purple-400"})}),e("span",{className:"text-xs font-medium text-muted",children:"Agent"}),r&&"main"!==r&&t("span",{className:"text-xs text-muted",children:["• Task ",r]})]}),t("div",{className:"flex items-center gap-2 text-muted",children:[e("span",{className:"text-[11px]",children:$}),e(v,{variant:"ghost",size:"xs",onClick:()=>{navigator.clipboard.writeText(n).then(()=>{D({status:"success",title:"Copied to clipboard",duration:2e3})})},className:"size-6 p-0 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Copy message",children:e(Me,{className:"size-3"})})]})]}),t("div",{className:y("px-4 pb-3 streaming-content",R&&"streaming-active",p),children:[e("div",{className:"vprose prose prose-slate dark:prose-invert prose-p:leading-relaxed prose-p:my-3 prose-headings:font-semibold prose-headings:tracking-normal prose-headings:mt-6 prose-headings:mb-3 prose-h1:text-xl prose-h2:text-lg prose-h3:text-base prose-li:my-1 prose-ul:my-3 prose-ol:my-3 prose-table:my-5 prose-pre:my-4 prose-hr:my-6 max-w-none text-[15px] break-words",style:{overflowWrap:"anywhere"},children:e(yn,{children:O})}),e("style",{children:"\n /* Ensure inline elements flow properly */\n .streaming-content p:last-child,\n .streaming-content li:last-child {\n display: inline;\n }\n /* Soft fade at reveal edge */\n .streaming-active .vprose {\n mask-image: linear-gradient(to right, black 97%, transparent 100%);\n -webkit-mask-image: linear-gradient(to right, black 97%, transparent 100%);\n }\n "})]})]})}):null}),ya=e=>/\.(png|jpg|jpeg|gif|webp|svg)(\?|$)/i.test(e);function ba({files:n}){const{openImage:r}=Kr();return n&&0!==n.length?e("div",{className:"mt-2 flex flex-wrap gap-2",children:n.map((n,a)=>{const s=n.split("/").pop()?.split("?")[0]||"file";return ya(n)?e("div",{className:"cursor-pointer",onClick:()=>r(n,s),title:"Click to enlarge",children:e("img",{src:n,alt:s,className:"max-w-[300px] max-h-[200px] rounded border hover:opacity-80 transition-opacity hover:shadow-lg"})},a):t("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-1 bg-muted rounded text-xs hover:bg-muted/80",children:["📎 ",s]},a)})}):null}const va=e=>{if(!e)return;const t=e.files??e.outputFiles;return Array.isArray(t)?t:void 0};function xa({message:n,isExpanded:r,onToggle:a,artifactRunId:s}){const[i,l]=c([]),o=b(),{client:u}=Kt(),m=ua(),p=n.details,h=p?.tool||"Tool",g=va(p),f="string"==typeof n.message?n.message:"";d(()=>{if(!g||0===g.length||!s)return void l([]);let e=!1;return(async()=>{const t=await Promise.all(g.map(async e=>{if(!e||"string"!=typeof e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;const t=e.startsWith("out/")||e.startsWith("files/")||e.startsWith("scripts/")?e:`out/${e}`,n=t.split(".").pop()?.toLowerCase()||"",r=new Set(["png","jpg","jpeg","gif","webp","bmp","svg"]).has(n)?"inline":"attachment";try{const e=ma(s,t,r);if(m)return await m.getOrFetch(e,async()=>(await u.files.getArtifactDownloadUrl(s,t,r)).url);return(await u.files.getArtifactDownloadUrl(s,t,r)).url}catch(e){return console.error(`Failed to resolve artifact URL for ${t}`,e),null}}));e||l(t.filter(e=>!!e))})(),()=>{e=!0}},[g,s,u,m]);const y=i.filter(e=>ya(e)),x=i.filter(e=>!ya(e));return t("div",{className:"border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[t("div",{className:"flex items-start justify-between px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:a,children:[t("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[e("div",{className:"flex-shrink-0 pt-0.5",children:e(r?Le:Ue,{className:"size-3 text-muted"})}),e("div",{className:"flex-1 min-w-0",children:f?e("span",{className:"text-xs text-foreground line-clamp-2",children:f}):t("span",{className:"text-xs text-muted italic",children:["Tool: ",h]})})]}),t("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!r&&e("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-purple-50 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800 font-medium",children:h}),e(v,{variant:"ghost",size:"xs",onClick:e=>{e.stopPropagation(),(()=>{const e=[f,p?"\n\nDetails:\n"+JSON.stringify(p,null,2):""].join("").trim();navigator.clipboard.writeText(e).then(()=>{o({status:"success",title:"Copied to clipboard",duration:2e3})})})()},className:"text-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy message",children:e(Me,{className:"size-3"})})]})]}),y.length>0&&e("div",{className:"px-4 pb-2",children:e(ba,{files:y})}),r&&t("div",{className:"px-4 py-2 bg-gray-50/50 dark:bg-gray-800/30",children:[e("div",{className:"mb-2",children:e("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-purple-50 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800 font-medium",children:h})}),f&&e("div",{className:"vprose prose prose-slate dark:prose-invert prose-p:leading-relaxed prose-p:my-1.5 max-w-none text-sm",children:e(yn,{artifactRunId:s,children:f})}),x.length>0&&e(ba,{files:x}),p&&Object.keys(p).length>1&&t("details",{className:"mt-3 text-xs border rounded p-2 bg-muted/30",onClick:e=>e.stopPropagation(),children:[e("summary",{className:"cursor-pointer text-muted",children:"Technical Details"}),e("pre",{className:"mt-2 p-2 bg-muted rounded text-xs overflow-x-auto font-mono whitespace-pre-wrap",children:JSON.stringify(p,null,2)})]})]})]})}function wa({files:t,artifactRunId:n}){const[r,a]=c([]),{client:s}=Kt(),i=ua();return d(()=>{if(!t||0===t.length||!n)return void a([]);let e=!1;return(async()=>{const r=await Promise.all(t.map(async e=>{if(!e||"string"!=typeof e)return null;const t=e.split(".").pop()?.toLowerCase()||"";if(new Set(["png","jpg","jpeg","gif","webp","bmp","svg"]).has(t))return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;const r=e.startsWith("out/")||e.startsWith("files/")||e.startsWith("scripts/")?e:`out/${e}`;try{const e=ma(n,r,"attachment");if(i)return await i.getOrFetch(e,async()=>(await s.files.getArtifactDownloadUrl(n,r,"attachment")).url);return(await s.files.getArtifactDownloadUrl(n,r,"attachment")).url}catch(e){return console.error(`Failed to resolve artifact URL for ${r}`,e),null}}));e||a(r.filter(e=>!!e))})(),()=>{e=!0}},[t,n,s,i]),0===r.length?null:e("div",{className:"pl-5 pr-3 pb-2",children:e(ba,{files:r})})}function Na({messages:t,artifactRunId:n}){const[r,a]=c([]),{client:s}=Kt(),i=ua();return d(()=>{if(!n||0===t.length)return void a([]);const e=t[t.length-1].details,r=va(e);if(!r||0===r.length)return void a([]);let l=!1;return(async()=>{const e=await Promise.all(r.map(async e=>{if(!e||"string"!=typeof e)return null;const t=e.split(".").pop()?.toLowerCase()||"";if(!new Set(["png","jpg","jpeg","gif","webp","bmp","svg"]).has(t))return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;const r=e.startsWith("out/")||e.startsWith("files/")||e.startsWith("scripts/")?e:`out/${e}`;try{const e=ma(n,r,"inline");if(i)return await i.getOrFetch(e,async()=>(await s.files.getArtifactDownloadUrl(n,r,"inline")).url);return(await s.files.getArtifactDownloadUrl(n,r,"inline")).url}catch(e){return console.error(`Failed to resolve artifact URL for ${r}`,e),null}}));l||a(e.filter(e=>!!e))})(),()=>{l=!0}},[t,n,s,i]),0===r.length?null:e("div",{className:"px-4 py-2 border-b border-gray-100 dark:border-gray-800",children:e(ba,{files:r})})}const ka=g(function({messages:n,showPulsatingCircle:r=!1,toolRunId:a,toolStatus:s}){const[i,l]=c(!0),[o,m]=c(new Set),[p,h]=c(new Set),g=u(n.length),f=b(),y=n.find(e=>e.workflow_run_id)?.workflow_run_id??n[0]?.workflow_run_id;d(()=>{const e=g.current,t=n.length;if(t>e){const n=new Set;for(let r=e;r<t;r++)n.add(r);h(n);const r=setTimeout(()=>{h(new Set)},500);return g.current=t,()=>clearTimeout(r)}g.current=t},[n.length]);const x=n[0],w=n[n.length-1],N=x.timestamp,k=w.timestamp,C=n.map(e=>{const t=e.details;return t?.tool||"tool"}),S=1===new Set(C).size?`${n.length}× ${C[0]}`:`${n.length} tool calls`,_=e=>{m(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return t("div",{className:`border-l-4 ${"completed"===s?"border-l-success":"error"===s?"border-l-destructive":"warning"===s?"border-l-attention":"border-l-purple-500"} overflow-hidden bg-white dark:bg-gray-900 mb-4`,children:[t("div",{className:"flex items-center justify-between px-4 py-1.5 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:()=>l(!i),children:[t("div",{className:"flex items-center gap-1.5",children:[r||"running"===s?e(Ur,{size:"sm",color:"blue"}):"completed"===s?e(Ve,{className:"size-4 text-success"}):"error"===s?e(qe,{className:"size-4 text-destructive"}):"warning"===s?e(et,{className:"size-4 text-attention"}):e(Ye,{className:"size-4 text-purple-600 dark:text-purple-400"}),e("span",{className:"text-xs font-medium text-muted",children:"Agent"}),e("span",{className:"text-xs text-purple-600 dark:text-purple-400 font-medium",children:S}),e(i?Ue:Le,{className:"size-3 text-muted"})]}),t("div",{className:"flex items-center gap-1.5",children:[t("span",{className:"text-[11px] text-muted/70",children:[hn(N).format("HH:mm:ss"),n.length>1&&` - ${hn(k).format("HH:mm:ss")}`]}),e(v,{variant:"ghost",size:"xs",onClick:e=>{e.stopPropagation(),(()=>{const e=n.map(e=>{const t=e.details;return`[${t?.tool||"tool"}] ${e.message||""}\n${t?JSON.stringify(t,null,2):""}`}).join("\n\n---\n\n");navigator.clipboard.writeText(e).then(()=>{f({status:"success",title:"Copied all tool calls to clipboard",duration:2e3})})})()},className:"text-muted/50 hover:text-muted h-5 w-5 p-0",title:"Copy all tool calls",children:e(Me,{className:"size-3"})})]})]}),e(Na,{messages:n,artifactRunId:y}),i&&e("div",{className:"px-4 py-1 space-y-0",children:n.map((r,a)=>{const s=r.details,i=s?.tool||"tool",l="string"==typeof r.message?r.message:"",c=p.has(a),d=o.has(a),u=va(s);return t("div",{className:"border-b border-gray-100 dark:border-gray-800 last:border-b-0",style:{opacity:c?0:1,transform:c?"translateX(-10px)":"translateX(0)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",transitionDelay:100*(a-(n.length-p.size))+"ms",animation:c?"slideInFade 0.4s ease-out forwards":"none",animationDelay:100*(a-(n.length-p.size))+"ms"},children:[t("div",{className:"flex items-start gap-2 py-2 text-xs cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50",onClick:()=>_(a),title:l,children:[e("div",{className:"flex-shrink-0 pt-0.5",children:e(d?Le:Ue,{className:"size-3 text-muted"})}),e("div",{className:"flex-1 min-w-0",children:l?e("span",{className:"text-foreground line-clamp-2",children:l}):t("span",{className:"text-muted italic",children:["Tool: ",i]})}),!d&&e("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-purple-50 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800 font-medium flex-shrink-0",children:i})]}),e(wa,{files:u,artifactRunId:y}),d&&t("div",{className:"pl-5 pr-3 pb-2 text-sm",children:[e("div",{className:"vprose prose prose-slate dark:prose-invert prose-p:leading-relaxed prose-p:my-1.5 max-w-none text-sm",children:e(yn,{artifactRunId:y,children:l})}),s&&Object.keys(s).length>1&&t("details",{className:"mt-2 text-xs",children:[e("summary",{className:"text-muted cursor-pointer",children:"Show details"}),e("pre",{className:"mt-1 p-2 bg-muted rounded text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})]})]})]},`${r.timestamp}-${a}`)})}),e("style",{children:"\n @keyframes slideInFade {\n from {\n opacity: 0;\n transform: translateX(-10px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n "}),!i&&e("div",{className:"group",children:n.map((t,n)=>e(xa,{message:t,isExpanded:o.has(n),onToggle:()=>_(n),artifactRunId:y},`${t.timestamp}-${n}`))})]})},(e,t)=>e.messages.length===t.messages.length&&(e.showPulsatingCircle===t.showPulsatingCircle&&(e.toolRunId===t.toolRunId&&(e.toolStatus===t.toolStatus&&(e.messages[0]?.timestamp===t.messages[0]?.timestamp&&e.messages[e.messages.length-1]?.timestamp===t.messages[t.messages.length-1]?.timestamp)))));function Ca({workstreams:n,activeWorkstream:r,onSelectWorkstream:a,count:s,completionStatus:i}){const l=new Map;l.set("all","All Messages"),l.set("main","Main"),n.forEach((e,t)=>{"all"!==t&&"main"!==t&&"research_france"!==t&&"statistics"!==t&&l.set(t,e)}),n=l;const o=Array.from(n.entries()).sort(([e],[t])=>"all"===e?-1:"all"===t?1:"main"===e?-1:"main"===t?1:e.localeCompare(t)),c=o.length>2;return e("div",c?{className:"flex overflow-x-auto space-x-1 mb-2 bg-muted border-b-2 border-muted/20 sticky top-0 z-10",children:o.map(([n,l])=>t("button",{className:"px-2 py-1 text-xs font-medium whitespace-nowrap transition-colors flex items-center gap-1.5\n "+(r===n?"bg-info text-info border-b-2 border-info":"text-muted hover:bg-muted border-b-2 border-transparent"),onClick:()=>a(n),title:l.length>20?l:void 0,children:[l.length>20?l.substring(0,18)+"...":l,s&&s.has(n)&&s.get(n)>0&&t("div",{className:"flex items-center space-x-1",children:[e("span",{className:"inline-flex items-center justify-center p-1 text-xs rounded-full\n "+(r===n?"bg-info text-info":"bg-muted text-muted"),children:s.get(n)}),i&&"all"!==n&&(i.get(n)?e(Ve,{className:"size-3 text-success"}):e(Xe,{className:"size-3 text-attention"}))]})]},n))}:{className:"py-1"})}function Sa(e,t){return"all"===t?[...e]:"main"===t?e.filter(e=>"main"===na(e)):e.filter(e=>na(e)===t)}const _a=(e,t)=>e.includes("%thinking_message%")?e.replace(/%thinking_message%/g,Xr[t]):e,ja=e=>e.type===Ht.BATCH_PROGRESS&&!!e.details?.batch_id;class Ia extends f{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return console.error("Message render error:",e),{hasError:!0,error:e}}componentDidUpdate(e){this.state.hasError&&e.children!==this.props.children&&this.setState({hasError:!1,error:void 0})}render(){return this.state.hasError?t("div",{className:"border-l-4 border-l-destructive bg-destructive/10 px-4 py-2 my-2 rounded-r",children:[e("p",{className:"text-sm text-destructive font-medium",children:"Failed to render message"}),e("p",{className:"text-xs text-muted mt-1 truncate",children:this.state.error?.message||"Unknown error"})]}):this.props.children}}const Pa=l.memo(function({messages:r,bottomRef:a,viewMode:s="stacked",isCompleted:i=!1,streamingMessages:m=new Map,onSendMessage:p,thinkingMessageIndex:g=0}){const f=u(null),[y,b]=c("all"),v=u(0),x=u(null),w=m.size>0,N=o(()=>{let e=0;return m.forEach(t=>{e+=t.text?.length||0}),Math.floor(e/200)},[m]),k=h(()=>{a.current&&(a.current.scrollIntoView({behavior:w?"instant":"smooth"}),v.current=Date.now()),x.current=null},[a,w]);d(()=>{const e=Date.now()-v.current;if(e>=100)k();else if(null===x.current){const t=100-e;x.current=window.setTimeout(k,t)}return()=>{null!==x.current&&(clearTimeout(x.current),x.current=null)}},[r.length,m.size,N,k]);const C=l.useMemo(()=>[...r].filter(e=>!(e=>{if(e.type!==Ht.UPDATE)return!1;const t=e.message?.toString()||"";return!!t.startsWith("Tools enabled:")||!!t.startsWith("Starting work with interaction")})(e)).sort((e,t)=>("number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime())-("number"==typeof t.timestamp?t.timestamp:new Date(t.timestamp).getTime())),[r]),S=l.useMemo(()=>{const e=function(e){const t=new Map;return t.set("all","All Messages"),t.set("main","Main"),e.forEach(e=>{e.workstream_id&&"main"!==e.workstream_id&&"all"!==e.workstream_id&&!t.has(e.workstream_id)&&(t.set(e.workstream_id,e.workstream_id),console.log(`Found workstream: ${e.workstream_id}`))}),t.size<=2&&!t.has("main")&&t.set("main","Main"),console.log("Final workstreams map:",t),t}(C);return e},[C]),_=l.useMemo(()=>{const e=new Map;e.set("all",C.length);const t=Sa(C,"main");return e.set("main",t.length),C.forEach(t=>{const n=na(t);"main"!==n&&e.set(n,(e.get(n)||0)+1)}),e},[C]),j=l.useMemo(()=>"all"===y?C:Sa(C,y),[C,y]),{importantMessages:I,recentThinking:P}=l.useMemo(()=>{const e=m.size>0;return{importantMessages:j.filter(e=>e.type===Ht.ANSWER||e.type===Ht.QUESTION||e.type===Ht.COMPLETE||e.type===Ht.IDLE||e.type===Ht.REQUEST_INPUT||e.type===Ht.TERMINATED||e.type===Ht.ERROR||e.type===Ht.THOUGHT&&(e.details?.tool||e.details?.tools||e.details?.streamed)||e.type===Ht.SYSTEM&&"toolkit_ready"===e.details?.system_type),recentThinking:i||e?[]:j.filter(e=>e.type===Ht.UPDATE||e.type===Ht.PLAN||e.type===Ht.THOUGHT&&!e.details?.tool&&!e.details?.tools&&!e.details?.streamed).slice(-1)}},[j,i,m.size]),{completeStreaming:T,incompleteStreaming:A}=l.useMemo(()=>{const e=new Map,t=[];return m.forEach((n,r)=>{if(y&&"all"!==y){const e=n.workstreamId||"main";if(y!==e)return}n.isComplete?e.set(r,n):n.text&&t.push({id:r,data:n})}),{completeStreaming:e,incompleteStreaming:t}},[m,y]),z=l.useMemo(()=>oa(j,T,y),[j,T,y]),F=l.useMemo(()=>oa(I,T,y),[I,T,y]),E=o(()=>!i&&(m.size>0||P.length>0||!j.some(e=>e.type===Ht.COMPLETE||e.type===Ht.IDLE||e.type===Ht.TERMINATED)),[i,m.size,P.length,j]),D=o(()=>{const e=new Map,t=new Map;C.forEach(e=>{const n=na(e);t.has(n)||t.set(n,[]),t.get(n).push(e)});for(const[n,r]of t.entries())if(r.length>0){const t=r[r.length-1];e.set(n,[Ht.COMPLETE,Ht.IDLE,Ht.REQUEST_INPUT,Ht.TERMINATED].includes(t.type))}return e},[C]);return t("div",{ref:f,tabIndex:0,className:"flex-1 min-h-0 h-full w-full max-w-full overflow-y-auto overflow-x-hidden px-2 sm:px-3 lg:px-4 flex flex-col relative focus:outline-none","data-testid":"all-messages-mixed",children:[e("style",{children:"\n /* Better vertical rhythm for markdown */\n .vprose > * + * {\n margin-top: 0.875rem;\n }\n .vprose > h1 + *,\n .vprose > h2 + *,\n .vprose > h3 + * {\n margin-top: 0.5rem;\n }\n /* Tables need more separation and better styling */\n .vprose table {\n margin-top: 1.25rem;\n margin-bottom: 1.25rem;\n border-collapse: collapse;\n width: 100%;\n }\n .vprose th,\n .vprose td {\n padding: 0.625rem 0.875rem;\n border: 1px solid var(--gray-6, #e5e7eb);\n text-align: left;\n }\n .vprose thead th {\n background-color: var(--gray-3, #f3f4f6);\n font-weight: 600;\n color: var(--gray-11, #6b7280);\n font-size: 0.75rem;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n .vprose tbody tr:hover {\n background-color: var(--gray-2, #f9fafb);\n }\n /* Dark mode table styles */\n .dark .vprose th,\n .dark .vprose td {\n border-color: var(--gray-7, #374151);\n }\n .dark .vprose thead th {\n background-color: var(--gray-4, #1f2937);\n color: var(--gray-11, #9ca3af);\n }\n .dark .vprose tbody tr:hover {\n background-color: var(--gray-3, #111827);\n }\n /* Horizontal rules as section dividers */\n .vprose hr {\n margin-top: 1.5rem;\n margin-bottom: 1.5rem;\n border-color: var(--gray-5, #d1d5db);\n }\n /* Better blockquote styling */\n .vprose blockquote {\n margin-top: 1.25rem;\n margin-bottom: 1.25rem;\n padding-left: 1rem;\n border-left-width: 3px;\n border-left-color: var(--gray-6, #d1d5db);\n color: var(--gray-11, #6b7280);\n }\n /* Code blocks */\n .vprose pre {\n margin-top: 1rem;\n margin-bottom: 1rem;\n padding: 1rem;\n border-radius: 0.5rem;\n overflow-x: auto;\n }\n "}),e("div",{className:"sticky top-0 z-10",children:e(Ca,{workstreams:S,activeWorkstream:y,onSelectWorkstream:b,count:_,completionStatus:D})}),0===j.length?e("div",{className:"flex items-center justify-center h-full text-center py-8",children:e("div",{className:"flex items-center px-4 py-3 text-muted",children:"all"===y?"Waiting for agent response...":"No messages in this workstream yet..."})}):t("div",{className:"flex-1 flex flex-col justify-start pb-4 space-y-2 w-full max-w-full",children:[t(n,"stacked"===s?{children:[z.map((t,n)=>{const r=n===z.length-1;if("tool_group"===t.type){const a=t.messages[t.messages.length-1],s=!i&&r&&!ta.includes(a.type)&&"completed"!==t.toolStatus;return e(Ia,{children:e(ka,{messages:t.messages,showPulsatingCircle:s,toolRunId:t.toolRunId,toolStatus:t.toolStatus})},`group-${t.toolRunId||t.firstTimestamp}-${n}`)}if("streaming"===t.type)return e(fa,{text:t.text,workstreamId:t.workstreamId,isComplete:t.isComplete,timestamp:t.startTimestamp},`streaming-${t.streamingId}-${n}`);{const a=t.message,s=!i&&r&&!ta.includes(a.type);return ja(a)?e(Ia,{children:e(Gr,{message:a,batchData:a.details,isRunning:!a.details.completed_at})},`batch-${a.details.batch_id}-${a.timestamp}-${n}`):e(Ia,{children:e(ga,{message:a,showPulsatingCircle:s,onSendMessage:p})},`${a.timestamp}-${n}`)}}),A.map(({id:t,data:n})=>e(fa,{text:n.text,workstreamId:n.workstreamId,isComplete:!1,timestamp:n.startTimestamp},`streaming-incomplete-${t}`)),E&&0===A.length&&t("div",{className:"flex items-center gap-3 pl-4 py-2 border-l-2 border-l-purple-500",children:[e(Ur,{size:"sm",color:"blue"}),e("span",{className:"text-sm text-muted",children:"Working..."})]})]}:{children:[F.map((t,n)=>{const r=n===F.length-1;if("tool_group"===t.type){const a=t.messages[t.messages.length-1],s=!i&&0===P.length&&r&&!ta.includes(a.type)&&"completed"!==t.toolStatus;return e(Ia,{children:e(ka,{messages:t.messages,showPulsatingCircle:s,toolRunId:t.toolRunId,toolStatus:t.toolStatus})},`group-${t.toolRunId||t.firstTimestamp}-${n}`)}if("streaming"===t.type)return e(fa,{text:t.text,workstreamId:t.workstreamId,isComplete:t.isComplete,timestamp:t.startTimestamp},`streaming-${t.streamingId}-${n}`);{const a=t.message,s=!i&&0===P.length&&r&&!ta.includes(a.type);return ja(a)?e(Ia,{children:e(Gr,{message:a,batchData:a.details,isRunning:!a.details.completed_at})},`batch-${a.details.batch_id}-${a.timestamp}-${n}`):e(Ia,{children:e(ga,{message:a,showPulsatingCircle:s,onSendMessage:p})},`${a.timestamp}-${n}`)}}),P.map((t,n)=>e(fa,{text:_a(t.message||"",g),workstreamId:na(t),isComplete:n<P.length-1,timestamp:t.timestamp},`thinking-${t.timestamp}-${n}`)),A.map(({id:t,data:n})=>e(fa,{text:n.text,workstreamId:n.workstreamId,isComplete:!1,timestamp:n.startTimestamp},`streaming-incomplete-${t}`)),E&&0===P.length&&0===A.length&&t("div",{className:"flex items-center gap-3 pl-4 py-2 border-l-2 border-l-purple-500",children:[e(Ur,{size:"sm",color:"blue"}),e("span",{className:"text-sm text-muted",children:"Working..."})]})]}),e("div",{ref:a,className:"h-4"})]})]})});class Ta{vertesia;updateState;_interactive=!0;_debug_mode=!1;_user_channels;_collection;_start=!1;_preserveRunValues=!1;_interaction;_environment;_model="";_tool_names=[];_data;_interactionParamsSchema;_inputValidator;constructor(e,t){this.vertesia=e,this.updateState=t}onStateChanged(){const e=this.clone();this.updateState(e)}clone(){const e=new Ta(this.vertesia,this.updateState);return e._interactionParamsSchema=this._interactionParamsSchema,e._interaction=this._interaction,e._data=this._data,e._environment=this._environment,e._model=this._model,e._tool_names=[...this._tool_names],e._interactive=this._interactive,e._debug_mode=this._debug_mode,e._user_channels=this._user_channels?[...this._user_channels]:void 0,e._inputValidator=this._inputValidator,e._start=this._start,e._collection=this._collection,e._preserveRunValues=this._preserveRunValues,e}get interactive(){return this._interactive}set interactive(e){e!==this._interactive&&(this._interactive=e,this.onStateChanged())}get debug_mode(){return this._debug_mode}set debug_mode(e){e!==this._debug_mode&&(this._debug_mode=e,this.onStateChanged())}get user_channels(){return this._user_channels}set user_channels(e){this._user_channels=e,this.onStateChanged()}get collection(){return this._collection}set collection(e){e!==this._collection&&(this._collection=e,this.onStateChanged())}get search_scope(){return this._collection?Gt.Collection:void 0}async restoreConversation(e){let t=e.interaction;if(e.version){/^[a-fA-F0-9]{24}$/.test(t)||(t=`${t}@${e.version}`)}const n=await this.vertesia.interactions.catalog.resolve(t),r=n.runtime?.environment||e.config?.environment,a=e.config?.model,s=await(r?this.vertesia.environments.retrieve(e.config?.environment):Promise.resolve(void 0));this.interactionParamsSchema=e.interactionParamsSchema??null,this.interaction=n,this._tool_names=e.tool_names||[],this._data=e.data,this._interactive=e.interactive,this._debug_mode=e.debug_mode??!1,this._user_channels=e.user_channels,this.collection=e.collection_id??void 0,this.environment=s,a&&(this._model=a),this.onStateChanged()}get interaction(){return this._interaction}set interaction(e){if(e?.id!==this._interaction?.id){if(this._interaction=e,this.interactionParamsSchema=e?Jt(e.prompts):void 0,this._inputValidator=void 0,e&&!this._preserveRunValues&&e.runtime?.environment){const t=e.runtime.environment;this.vertesia.environments.retrieve(t).then(e=>this.environment=e)}this.onStateChanged()}}get environment(){return this._environment}set environment(e){if(e?.id!==this._environment?.id){if(this._environment=e,!this._preserveRunValues){const t=this.interaction?.runtime?.model;t&&e&&Yt(t,e.provider)?this._model=t:this._model=e?.default_model&&Yt(e.default_model,e.provider)?e.default_model:""}this.onStateChanged()}}get model(){return this._model}set model(e){e!==this._model&&(this._model=e||"",this.onStateChanged())}get tool_names(){return this._tool_names}set tool_names(e){this._tool_names=e,this.onStateChanged()}get data(){return this._data}set data(e){this._data=e,this.onStateChanged()}set run(e){console.log("run",e),this.onStateChanged()}set start(e){this._start!==e&&(this._start=e,this.onStateChanged())}get start(){return this._start}get preserveRunValues(){return this._preserveRunValues}set preserveRunValues(e){this._preserveRunValues=e}get interactionParamsSchema(){return this._interactionParamsSchema}set interactionParamsSchema(e){this._interactionParamsSchema!==e&&(this._interactionParamsSchema=e,e&&(this._data=this.initializeBooleanDefaults(this._data||{},e)),this.onStateChanged())}initializeBooleanDefaults(e,t){if(!t.properties)return e;const n={...e};for(const[e,r]of Object.entries(t.properties)){const t=r;"boolean"===t.type&&void 0===n[e]?n[e]=!1:"object"===t.type&&t.properties&&(n[e]=this.initializeBooleanDefaults(n[e]||{},t))}return n}reset(){if(this._start=!1,this._interactive=!0,this._debug_mode=!1,this._user_channels=void 0,this._collection=void 0,this._preserveRunValues=!1,this._model="",this._environment=void 0,this._tool_names=[],this._interaction=void 0,this._data=void 0,this._interactionParamsSchema=null,this._inputValidator=void 0,this.model=void 0,this.environment=void 0,this.onStateChanged(),location.hash){const e=window.location.origin+window.location.pathname+window.location.search;history.replaceState(null,"",e),location.hash=""}}validateInput(){if(!this._interactionParamsSchema)return{isValid:!0};if(!this._inputValidator||this._inputValidator.schema!==this._interactionParamsSchema){const e=new An({strict:!1});this._inputValidator={validate:e.compile(this._interactionParamsSchema),schema:this._interactionParamsSchema}}const e=this._data||{};if(!this._inputValidator.validate(e)){return{isValid:!1,errorMessage:this._inputValidator.validate.errors?this._inputValidator.validate.errors.map(e=>`${e.instancePath}: ${e.message}`).join(", "):"Invalid payload data"}}return{isValid:!0}}}const Aa=m(void 0);function za({children:t}){const{client:n}=Kt(),[r,a]=c();return d(()=>{a(new Ta(n,a))},[]),r&&e(Aa.Provider,{value:r,children:t})}function Fa(){const e=p(Aa);if(!e)throw new Error("usePayloadBuilder must be used within a PayloadProvider");return e}function Ea({title:n,onClose:r,isModal:a,run:s,viewMode:i,onViewModeChange:l,showPlanPanel:o,hasPlan:c=!1,onTogglePlanPanel:d,onDownload:u,onCopyRunId:m,resetWorkflow:p,onExportPdf:h,isReceivingChunks:g=!1,className:f,titleClassName:y,actionsClassName:b}){return e(za,{children:t("div",{className:`flex flex-wrap items-end justify-between py-1.5 px-2 border-b shadow-sm flex-shrink-0 ${f||""}`,children:[t("div",{className:`flex flex-wrap items-center space-x-2 ${y||""}`,children:[t("div",{className:"flex items-center space-x-1",children:[e(Ye,{className:"size-5 text-muted"}),e("span",{className:"font-medium",children:n})]}),t("span",{className:"text-xs text-muted ml-1 flex items-center gap-1.5",children:["(Run ID: ",s.runId.substring(0,8),"...)",e("span",{className:"w-2 h-2 rounded-full transition-colors duration-200 "+(g?"bg-purple-500 shadow-[0_0_6px_2px_rgba(168,85,247,0.6)]":"bg-gray-400")})]})]}),t("div",{className:`flex justify-end items-center space-x-2 ml-auto ${b||""}`,children:[t("div",{className:"flex items-center space-x-1 bg-muted rounded p-0.5 mt-2 lg:mt-0",children:[e(v,{variant:"stacked"===i?"outline":"ghost",size:"xs",className:"rounded-l-md",onClick:()=>l("stacked"),children:"Details"}),e(v,{variant:"sliding"===i?"outline":"ghost",size:"xs",className:"rounded-r-md",onClick:()=>l("sliding"),children:"Summary"})]}),t("div",{className:"relative",children:[c&&!o&&e("span",{className:"absolute -top-1 -right-1 w-2.5 h-2.5 bg-primary rounded-full border border-border z-10"}),t(v,{size:"sm",variant:o?"primary":"secondary",onClick:d,className:"transition-all duration-200 rounded-md",title:"Toggle plan panel",children:[e(tt,{className:"size-4 mr-1.5"}),e("span",{className:"font-medium text-xs",children:o?"Hide Plan":"Show Plan"})]})]}),e(Da,{run:s,isModal:a,onClose:r,onDownload:u,onCopyRunId:m,resetWorkflow:p,onExportPdf:h}),r&&!a&&e(v,{size:"xs",variant:"ghost",onClick:r,children:e(nt,{className:"size-4"})})]})]})})}function Da({run:n,isModal:r,onClose:a,onDownload:s,onCopyRunId:i,resetWorkflow:l,onExportPdf:o}){const c=b(),{client:d}=Kt(),u=Fa();return t(w,{hover:!0,children:[e(N,{children:e(v,{size:"xs",variant:"ghost",title:"More actions",children:e(rt,{className:"size-4"})})}),e(k,{className:"w-48",align:"end",children:e("div",{className:"rounded-md shadow-lg z-50",children:e("div",{className:"py-1 min-w-36",children:e(C,{children:e(S,{children:t(_,{children:[e("div",{className:"flex items-center px-3 py-1.5 text-xs text-gray-700 dark:text-gray-300",children:e("span",{className:"text-muted",children:"Actions"})}),r&&t(j,{className:"text-xs",onSelect:()=>{return e=`/store/agent-runner?agentId=${n.runId}__${n.workflowId}`,window.open(e,"_blank"),e;var e},children:[e(Oe,{className:"size-3.5 mr-2 text-muted"})," Open in new tab"]}),t(j,{className:"text-xs",onSelect:()=>{i?i():(navigator.clipboard.writeText(n.runId),c({status:"success",title:"Run ID copied",duration:2e3}))},children:[e(Me,{className:"size-3.5 mr-2 text-muted"})," Copy Run ID"]}),t(j,{className:"text-xs",onSelect:()=>{s?s():async function(e,t){return e.files.getDownloadUrl(`agents/${t}/conversation.json`).then(e=>e.url)}(d,n.runId).then(e=>window.open(e,"_blank"))},children:[e(at,{className:"size-3.5 mr-2 text-muted"})," Download Conversation"]}),o&&t(j,{className:"text-xs",onSelect:o,children:[e(at,{className:"size-3.5 mr-2 text-muted"})," Export as PDF"]}),a&&r&&t(j,{className:"text-xs",onSelect:a,children:[e(nt,{className:"size-3.5 mr-2 text-muted"})," Close"]}),t(j,{className:"text-xs text-destructive",onSelect:()=>{(async e=>{try{return await d.store.workflows.terminate(e.workflowId,e.runId,"cancel"),c({status:"success",title:"Workflow cancelled",duration:2e3}),u.reset(),l?.(),!0}catch(e){return c({status:"error",title:"Failed to cancel workflow",duration:2e3}),!1}})(n)},children:[e(nt,{className:"size-3.5 mr-2 text-destructive"})," Cancel Workflow"]})]})})})})})})]})}const $a="vertesia.content_store.lastDisplayedView";function Ra({onUpdate:t}){const[n,r]=c("grid"===localStorage.getItem($a)),a=()=>{localStorage.setItem($a,"grid"),r(!0),t(!0)},s=()=>{localStorage.setItem($a,"table"),r(!1),t(!1)};return e(v,{variant:"outline",onClick:()=>{n?s():a()},alt:n?"Table View":"Thumbnail View",children:e(n?st:it,{})})}function Oa(e,t=7){return e?"~"+e.slice(-t):""}function La(e,t){return e.length>t?e.substring(0,t)+"...":e}Ra.LAST_DISPLAYED_VIEW=$a;const Ua="text/csv",Ma="image/",Va="application/pdf",qa="video/",Ba=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.ms-powerpoint"],Wa=e=>e===Ua||Ua.includes(e),Ka=e=>e.startsWith(Ma)||Ma.includes(e),Ha=e=>e===Va||Va.includes(e),Ga=e=>e.startsWith(qa)||qa.includes(e),Ja=e=>Ba.includes(e),Ya=import.meta.env,Za={max_hw:Ya?.VITE_RENDITION_HW||256,format:Zt.jpeg,generate_if_missing:!0},Qa="vertesia.content_store.renditionId";async function Xa(e,t,n,r,a){if(!t?.content?.type||!(Ka(t.content.type)||Ga(t.content.type)||Ha(t.content.type)))return void a("No preview available");a("Preparing preview...");const s=(new Date).getTime()/1e3,i=localStorage.getItem(`${Qa}_${t.id}_${Za.max_hw}`),l=localStorage.getItem(`${Qa}_${t.id}_${Za.max_hw}_time`);if(i?.length&&l&&Math.abs(s-parseInt(l))<=900)return n(i),r(`${t.name} Rendition`),a("ready"),i;a("Preparing preview..."),e.objects.getRendition(t.id,Za).then(s=>{if("generating"===s.status)a("Preparing preview..."),n(""),r(""),setTimeout(()=>Xa(e,t,n,r,a),6e4);else{if("failed"===s.status)return a("No preview available"),n(""),void r("");{if(!s?.renditions?.length)return a("No preview available"),n(""),void r("");const e=s.renditions[0];localStorage.setItem(`${Qa}_${t.id}_${Za.max_hw}`,e),localStorage.setItem(`${Qa}_${t.id}_${Za.max_hw}_time`,((new Date).getTime()/1e3).toString()),n(e),r(`${t.name} Rendition`),a("ready"),console.log(`Rendition for document ${t.id} retrieved successfully: ${e}`)}}}).catch(e=>{a("No preview available"),console.warn("Failed to retrieve rendition:",e),n(""),r("")})}function es(e,t){if("undefined"==typeof window||"undefined"==typeof document)return!1;const n=document.createElement("iframe");n.style.position="fixed",n.style.right="0",n.style.bottom="0",n.style.width="0",n.style.height="0",n.style.border="0",n.style.visibility="hidden",document.body.appendChild(n);const r=n.contentWindow;if(!r)return n.parentNode?.removeChild(n),!1;const a=r.document;a.open(),a.write(`<!doctype html><html><head><title>${t}</title></head><body></body></html>`),a.close(),a.title=t;document.querySelectorAll('link[rel="stylesheet"], style').forEach(e=>{a.head.appendChild(e.cloneNode(!0))});const s=a.createElement("style");return s.textContent='\n@media print {\n body {\n margin: 24px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;\n font-size: 14px;\n line-height: 1.5;\n color: #111827;\n background-color: #ffffff;\n }\n\n .vprose {\n max-width: 800px;\n margin: 0 auto;\n }\n\n .vprose h1 {\n font-size: 24px;\n font-weight: 700;\n margin: 1.5rem 0 0.75rem;\n }\n\n .vprose h2 {\n font-size: 20px;\n font-weight: 600;\n margin: 1.25rem 0 0.75rem;\n }\n\n .vprose h3 {\n font-size: 18px;\n font-weight: 600;\n margin: 1rem 0 0.5rem;\n }\n\n .vprose p {\n margin: 0 0 0.5rem;\n }\n\n .vprose ul,\n .vprose ol {\n margin: 0.5rem 0 0.5rem 1.5rem;\n padding: 0;\n }\n\n .vprose li {\n margin: 0.25rem 0;\n }\n\n .vprose table {\n width: 100%;\n border-collapse: collapse;\n margin: 1rem 0;\n }\n\n .vprose th,\n .vprose td {\n border: 1px solid #d1d5db;\n padding: 0.5rem 0.75rem;\n vertical-align: top;\n }\n\n .vprose thead th {\n background-color: #f3f4f6;\n font-weight: 600;\n }\n\n .vprose pre,\n .vprose code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n font-size: 12px;\n }\n\n .vprose pre {\n padding: 0.75rem;\n border-radius: 4px;\n border: 1px solid #e5e7eb;\n background-color: #f9fafb;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n /* Hide chart action buttons when printing */\n .chart-actions {\n display: none !important;\n }\n\n /* Hide interactive elements in agent conversation when printing */\n .print-hidden,\n [class*="print:hidden"],\n button[title="Copy message"],\n button[title="Copy to clipboard"],\n button[title="Export as PNG"],\n .message-actions {\n display: none !important;\n }\n\n /* Prevent page breaks inside elements */\n .vprose table,\n .vprose pre,\n .vprose blockquote,\n .vprose figure,\n .vprose img,\n .recharts-wrapper,\n [class*="chart"],\n [class*="Chart"] {\n break-inside: avoid;\n page-break-inside: avoid;\n }\n\n /* Keep headings with following content */\n .vprose h1,\n .vprose h2,\n .vprose h3,\n .vprose h4,\n .vprose h5,\n .vprose h6 {\n break-after: avoid;\n page-break-after: avoid;\n }\n\n /* Keep list items together when possible */\n .vprose li {\n break-inside: avoid;\n page-break-inside: avoid;\n }\n}\n',a.head.appendChild(s),a.body.innerHTML=e.innerHTML,r.focus(),r.print(),setTimeout(()=>{n.parentNode?.removeChild(n)},1e3),!0}function ts(e){switch(e){case Qt.RUNNING:return"text-info";case Qt.COMPLETED:return"text-success";case Qt.FAILED:return"text-destructive";case Qt.TERMINATED:case Qt.CANCELED:return"text-attention";default:return"text-muted"}}function ns(e){switch(e){case Qt.RUNNING:return"Running";case Qt.COMPLETED:return"Completed";case Qt.FAILED:return"Failed";case Qt.CONTINUED_AS_NEW:return"Continued As New";case Qt.TERMINATED:return"Terminated";case Qt.TIMED_OUT:return"Timed Out";case Qt.CANCELED:return"Canceled";default:return"Unknown"}}class rs extends D{labelOf(e){return e.label}idOf(e){return e.id}renderOption(n){return t("div",{children:[e("div",{className:"font-medium",children:n.label}),e("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n.description})]})}}function as({isOpen:n,onClose:r,onConfirm:a,isLoading:s,uploadedFileName:i}){const l=[{id:"update",label:"Update current version",description:i?"Replace the content file and modify properties directly in the current revision.":"Modify the properties directly in the current revision."},{id:"new-version",label:"Create new version",description:i?"Create a new revision with the replacement file while preserving the original.":"Create a new revision with these property changes while preserving the original."}],o=i?l[1]:l[0],[u,m]=c(o),[p,h]=c(""),g=new rs;d(()=>{n&&(m(o),h(""))},[n,i]);const f="new-version"===u?.id;return t(I,{isOpen:n,onClose:r,className:"sm:max-w-md",children:[e(P,{children:"Save Changes"}),e(T,{children:t("div",{className:"space-y-4",children:[i&&e("div",{className:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:t("p",{className:"text-sm text-blue-700 dark:text-blue-300 font-medium",children:["You're about to replace the content file with: ",e("span",{className:"font-bold",children:i})]})}),e("p",{className:"text-sm text-mixer-muted/5",children:"How would you like to save these changes?"}),e(A,{adapter:g,options:l,value:u,onChange:e=>{m(e)},gap:"gap-4"}),f&&e(z,{label:"Version Label (Optional)",description:"Optional label for the new version.",className:"mt-3 pl-8",children:e(F,{value:p,onChange:h,placeholder:"e.g., v1.2, approved, post-review",className:"w-full"})})]})}),t(E,{children:[e(v,{variant:"secondary",onClick:r,disabled:s,children:"Cancel"}),e(v,{variant:"primary",onClick:async()=>{await a(f,f?p:void 0)},isLoading:s,children:"Save"})]})]})}function ss({isOpen:r,onClose:a,object:s,refetch:i}){const{client:l,store:o}=Kt(),m=b(),{theme:p}=$(),h=fn(),[g,f]=c(!1),[y,x]=c(""),[w,N]=c(!1),[k,C]=c(null),S=u(void 0),[_,j]=c(null),[A,z]=c(null);d(()=>{r&&(x(JSON.stringify(s.properties||{},null,2)),s.type?.id&&async function(e){try{const t=await o.types.retrieve(e);t.object_schema&&j(t.object_schema)}catch(e){console.error("Failed to fetch JSON schema:",e)}}(s.type.id))},[r,s]);return t(n,{children:[t(I,{isOpen:r,onClose:a,className:"sm:max-w-[90%] md:max-w-[80%] lg:max-w-[75%] xl:max-w-[70%]",children:[e(P,{children:"Edit Properties"}),t(T,{children:[t("div",{className:"mb-2 text-sm text-gray-500",children:[s.type?.name?t("span",{children:["Editing properties for object type: ",e("strong",{children:s.type.name})]}):e("span",{children:"Editing properties for generic document"}),_&&e("span",{className:"ml-2 text-green-600",children:"(JSON schema validation enabled)"})]}),e("div",{className:"h-[75vh] border rounded-md overflow-hidden",children:e(bn,{value:y,language:"json",editorRef:S,onChange:e=>{return t=e.state.doc.toString(),void x(t);var t},beforeMount:e=>{_&&e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"http://myserver/object-schema.json",fileMatch:["*"],schema:_}]})},theme:"dark"===p?"vs-dark":"vs",minLines:40})})]}),t(E,{children:[e(v,{variant:"secondary",onClick:a,children:"Cancel"}),e(v,{variant:"primary",onClick:function(){if(!S.current)return;const e=S.current.getValue();try{const t=JSON.parse(e);C(t),N(!0)}catch(e){m({status:"error",title:"Invalid JSON",description:"Please fix the JSON syntax errors before saving.",duration:5e3})}},children:"Save Changes"})]})]}),e(as,{isOpen:w,onClose:function(){N(!1)},onConfirm:async function(e,t){try{f(!0);const n=k||JSON.parse(y);if(e){const e=await l.objects.update(s.id,{properties:n},{createRevision:!0,revisionLabel:t});e.id!==s.id&&z(e.id),m({status:"success",title:"New version created",description:"A new version with updated properties has been created.",duration:2e3}),N(!1),a(),e.id!==s.id&&setTimeout(()=>{h(`/objects/${e.id}`),m({status:"info",title:"Viewing New Version",description:t?`Now viewing version '${t}'`:"Now viewing the new version",duration:3e3})},100)}else await o.objects.update(s.id,{properties:n}),m({status:"success",title:"Properties updated",description:"The object properties have been updated successfully.",duration:2e3}),i&&await i(),N(!1),a()}catch(e){m({status:"error",title:"Error updating properties",description:e.message||"An error occurred while updating the properties.",duration:5e3}),f(!1)}},isLoading:g})]})}function is({className:t,size:n="md"}){return e("div",{className:`flex items-center justify-center ${t||""}`,children:e(Be,{className:`${{sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"}[n]} animate-spin text-muted-foreground`})})}function ls({pdfUrl:n,pageNumber:r,width:a,className:s,renderTextLayer:i=!1,renderAnnotationLayer:l=!1,onLoadSuccess:o,onError:d}){const[u,m]=c(!0),[p,h]=c(null);return p?e("div",{className:`flex items-center justify-center text-destructive text-sm ${s||""}`,children:"Failed to load PDF"}):t("div",{className:s,children:[u&&e(is,{className:"py-4",size:"md"}),e(En,{file:n,onLoadSuccess:({numPages:e})=>{m(!1),o?.(e)},onLoadError:e=>{m(!1),h(e),d?.(e)},loading:null,children:e(Dn,{pageNumber:r,width:a,renderTextLayer:i,renderAnnotationLayer:l,loading:e(is,{className:"py-4",size:"sm"})})})]})}Fn.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${Fn.version}/build/pdf.worker.min.mjs`;const os=m(null);function cs({pdfUrl:t,urlLoading:n=!1,children:r,onLoadSuccess:a}){const[s,i]=c(0),[l,o]=c(!0),[d,u]=c(null),[m,p]=c(null),h={pdfUrl:t,numPages:s,loading:n||!t||l,error:d,pageDimensions:m};return d?e("div",{className:"flex items-center justify-center text-destructive text-sm py-4",children:"Failed to load PDF"}):e(os.Provider,{value:h,children:t?e(En,{file:t,onLoadSuccess:async e=>{i(e.numPages),a?.(e.numPages);try{const t=(await e.getPage(1)).getViewport({scale:1});p({width:t.width,height:t.height,aspectRatio:t.width/t.height})}catch(e){console.error("Failed to get page dimensions:",e)}o(!1)},onLoadError:e=>{o(!1),u(e)},loading:e(is,{className:"py-4",size:"md"}),children:r((t,n)=>e(Dn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e(is,{className:"py-4",size:"sm"})},t))}):e(is,{className:"py-4",size:"md"})})}function ds(){return p(os)}const us=210/297;function ms({pageNumber:t,width:n,className:r}){const a=ds(),s=a?.pageDimensions?.aspectRatio??us,i=n?Math.round(n/s):200;return e("div",a?.loading?{className:`flex items-center justify-center bg-muted ${r||""}`,style:{height:i,width:n||"100%"},children:e(is,{size:"md"})}:{className:r,children:e(Dn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e(is,{className:"py-4",size:"sm"})})})}function ps({pageNumber:t,width:n,isSelected:r,onSelect:a,renderThumbnail:s,aspectRatio:i=us,rootMargin:l="200px 0px"}){const o=u(null),[m,p]=c(!1);d(()=>{const e=o.current;if(!e)return;const t=new IntersectionObserver(e=>{const t=e[0];t?.isIntersecting&&p(!0)},{rootMargin:l,threshold:0});return t.observe(e),()=>t.disconnect()},[l]);const h=n?Math.round(n/i):200,g=m?e(Dn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e("div",{className:"flex items-center justify-center bg-muted",style:{height:h},children:e(is,{size:"sm"})})}):e("div",{className:"flex items-center justify-center bg-muted",style:{height:h,width:n||"100%"},children:e("span",{className:"text-muted-foreground text-xs",children:t})});return e("div",{ref:o,children:s({pageNumber:t,isSelected:r,pageElement:g,onSelect:a})})}function hs({pdfUrl:r,urlLoading:a=!1,pageCount:s,currentPage:i,thumbnailWidth:l,onPageSelect:o,renderThumbnail:m,scrollContainerRef:p,onAspectRatioChange:g,onItemHeightChange:f,calculateItemHeight:y,onPageCountChange:b}){const[v,x]=c(null),[w,N]=c({start:0,end:Math.min(15,s)}),[k,C]=c(null),S=u(null),_=h(e=>{x(e)},[]),j=h(async e=>{b?.(e.numPages);try{const t=(await e.getPage(1)).getViewport({scale:1}),n=t.width/t.height;C(n),g?.(n)}catch(e){console.error("Failed to get page dimensions:",e),C(us),g?.(us)}},[g,b]),I=k??us,P=l?Math.round(l/I):200,T=y?y(P):P+16+24+8;d(()=>{T>0&&null!==k&&f?.(T)},[T,k,f]);if(d(()=>{const e=p?.current||function(e){if(!e)return null;let t=e.parentElement;for(;t;){const e=window.getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)return t;t=t.parentElement}return null}(S.current);if(!e)return;const t=()=>{const t=e.scrollTop,n=e.clientHeight,r=Math.floor(t/T),a=Math.ceil((t+n)/T),i=Math.max(0,r-5),l=Math.min(s,a+5);N(e=>e.start!==i||e.end!==l?{start:i,end:l}:e)};return t(),e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[T,s,p]),v)return e("div",{className:"flex items-center justify-center text-destructive text-sm py-4",children:"Failed to load PDF"});if(a||!r)return e(is,{className:"py-4",size:"md"});const A=w.start*T,z=(s-w.end)*T,F=null!==k;return e("div",{ref:S,children:e(En,{file:r,onLoadSuccess:j,onLoadError:_,loading:e(is,{className:"py-4",size:"md"}),children:F?t(n,{children:[A>0&&e("div",{style:{height:A}}),Array.from({length:w.end-w.start},(t,n)=>{const r=w.start+n+1;return e("div",{"data-page-index":r-1,style:{height:T,overflow:"hidden"},children:e(ps,{pageNumber:r,width:l,isSelected:r===i,onSelect:()=>o(r),renderThumbnail:m,aspectRatio:I})},r)}),z>0&&e("div",{style:{height:z}})]}):e(is,{className:"py-4",size:"md"})})})}function gs({pdfUrl:n,pageNumber:r,width:a,height:s,className:i,renderTextLayer:l=!1,renderAnnotationLayer:o=!1,onPageChange:u}){const[m,p]=c(0),[h,g]=c(!0),[f,y]=c(null);d(()=>{m>0&&u?.(r,m)},[r,m,u]);return f?e("div",{className:`flex items-center justify-center text-destructive ${i||""}`,children:t("span",{children:["Failed to load PDF: ",f.message]})}):t("div",{className:i,children:[h&&e(is,{className:"py-8",size:"lg"}),e(En,{file:n,onLoadSuccess:({numPages:e})=>{p(e),g(!1)},onLoadError:e=>{g(!1),y(e)},loading:null,children:e(Dn,{pageNumber:Math.min(r,m||1),width:a,height:s,renderTextLayer:l,renderAnnotationLayer:o,loading:e(is,{className:"py-8",size:"md"})})})]})}const fs=210/297,ys=[50,75,100,125,150,200,300];function bs({pdfUrl:a,pdfUrlLoading:s=!1,pageCount:i,currentPage:l,onChange:o,onPageCountChange:m,className:p,compact:g=!1,headerExtra:f}){const y=u(null),b=u(null),[x,w]=c(void 0),[N,k]=c(100),[C,S]=c(fs),[_,j]=c(null),I=u(null),P=x?Math.round(x*N/100):void 0,T=h(()=>{let e=ys.findIndex(e=>e>=N);-1===e&&(e=ys.length-1);const t=Math.min(e+1,ys.length-1);k(ys[t])},[N]),A=h(()=>{let e=ys.findIndex(e=>e>=N);-1===e&&(e=ys.length-1);const t=Math.max(e-1,0);k(ys[t])},[N]),z=h(()=>{k(100)},[]),F=h(e=>e+(g?28:48),[g]),E=(e,t)=>{const n=e?Math.round(e/t):200;return F(n)};d(()=>{const e=b.current;if(!e)return;let t=null;const n=()=>e.clientWidth-16-16-4,r=()=>{const t=n();if(t<=0)return;const r=I.current;if(r&&r>0){const n=e.scrollTop,a=Math.round(n/r),s=E(t,C),i=a*s;w(t),requestAnimationFrame(()=>{e.scrollTo({top:i,behavior:"instant"})}),I.current=s}else w(t),I.current=E(t,C)},a=n();a>0&&(w(a),I.current=E(a,C));const s=new ResizeObserver(()=>{t&&clearTimeout(t),t=setTimeout(r,150)});return s.observe(e),()=>{t&&clearTimeout(t),s.disconnect()}},[C]);const D=u(!1),$=u(null),O=u(N);d(()=>{O.current!==N&&(O.current=N,$.current={targetPage:l},D.current=!0)},[N,l]),d(()=>{const e=b.current,t=$.current;if(t&&e&&_){$.current=null;const n=(t.targetPage-1)*_;requestAnimationFrame(()=>{e.scrollTo({top:n,behavior:"instant"}),requestAnimationFrame(()=>{D.current=!1})})}},[_]);const L=u(!1);d(()=>{const e=b.current;if(e&&_&&!L.current)if(l>1){L.current=!0,D.current=!0;const t=(l-1)*_;e.scrollTo({top:t,behavior:"instant"}),requestAnimationFrame(()=>{D.current=!1})}else L.current=!0},[_,l]);const U=u(l);d(()=>{const e=b.current;if(e&&_&&U.current!==l){U.current=l,D.current=!0;const t=(l-1)*_;e.scrollTo({top:t,behavior:"instant"}),requestAnimationFrame(()=>{D.current=!1})}},[l,_]),d(()=>{const e=b.current;if(!e||!_)return;let t=null;const n=()=>{D.current||(t&&clearTimeout(t),t=setTimeout(()=>{const t=e.scrollTop,n=Math.round(t/_)+1,r=Math.max(1,Math.min(n,i));r!==l&&(U.current=r,o(r))},50))};return e.addEventListener("scroll",n,{passive:!0}),()=>{t&&clearTimeout(t),e.removeEventListener("scroll",n)}},[_,i,l,o]);return t("div",{ref:y,className:r("flex flex-col items-stretch",g?"gap-y-1":"gap-y-2",p),children:[t("div",{className:r("relative flex items-center justify-center px-2",g?"h-6":"h-9"),children:[e(v,{variant:"ghost",size:"xs",onClick:()=>{l>1&&o(l-1)},alt:"Previous page",children:e(lt,{className:"size-4"})}),t("div",{className:"absolute left-2 flex items-center gap-x-1",children:[e(xs,{zoom:N,onZoomIn:T,onZoomOut:A,onFitToView:z,canZoomIn:N<ys[ys.length-1],canZoomOut:N>ys[0]}),f&&t(n,{children:[e("div",{className:"w-px h-4 bg-border mx-1"}),f]})]}),e("div",{className:"absolute right-2",children:e(vs,{currentPage:l,totalPages:i,onChange:o})})]}),e("div",{ref:b,className:r("flex flex-col items-center flex-1 overflow-y-auto px-2",g?"gap-1":"gap-2"),children:e(hs,{pdfUrl:a,urlLoading:s,pageCount:i,currentPage:l,thumbnailWidth:P,onPageSelect:o,onPageCountChange:m,scrollContainerRef:b,onAspectRatioChange:S,onItemHeightChange:j,calculateItemHeight:F,renderThumbnail:({pageNumber:n,isSelected:a,pageElement:s,onSelect:i})=>t("div",{className:r("hover:bg-muted rounded-md w-full",g?"p-1":"p-2"),children:[e("div",{className:r("relative border-[2px] cursor-pointer overflow-hidden",a?"border-primary":"border-border"),onClick:i,children:s}),e(R,{className:r("text-muted-foreground font-semibold",g?"text-xs pt-0.5":"text-sm pt-1"),children:n})]},n)})}),e("div",{className:r("flex items-center justify-center",g?"h-6":"h-9"),children:e(v,{variant:"ghost",size:"xs",onClick:()=>{l<i&&o(l+1)},alt:"Next page",children:e(ot,{className:"size-4"})})})]})}function vs({currentPage:n,totalPages:r,onChange:a}){const s=u(null),[i,l]=c(String(n));d(()=>{l(String(n))},[n]);const o=()=>{const e=parseInt(i,10);!isNaN(e)&&e>=1&&e<=r?a(e):l(String(n))};return t("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e("span",{children:"Page"}),e("input",{ref:s,type:"text",value:i,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key?(o(),s.current?.blur()):"Escape"===e.key&&(l(String(n)),s.current?.blur())},onBlur:()=>{o()},className:"w-8 h-5 text-center text-xs px-1 py-0 bg-background border border-border rounded focus:outline-none focus:border-primary"}),t("span",{children:["/ ",r]})]})}function xs({zoom:n,onZoomIn:a,onZoomOut:s,onFitToView:i,canZoomIn:l,canZoomOut:o}){return t("div",{className:"flex items-center gap-x-0.5",children:[e(O,{description:"Zoom out",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",o?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40 cursor-not-allowed"),onClick:s,disabled:!o,children:e(ct,{className:"size-4"})})}),t("span",{className:"text-xs text-muted-foreground min-w-[32px] text-center",children:[n,"%"]}),e(O,{description:"Zoom in",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",l?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40 cursor-not-allowed"),onClick:a,disabled:!l,children:e(dt,{className:"size-4"})})}),e(O,{description:"Fit to width",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",100!==n?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40"),onClick:i,children:e(ut,{className:"size-4"})})})]})}const ws="magic-pdf";var Ns;!function(e){e.original="original",e.instrumented="instrumented"}(Ns||(Ns={}));class ks{client;objectId;totalPages;cache=new Map;pending=new Map;constructor(e,t,n){this.client=e,this.objectId=t,this.totalPages=n}getCacheKey(e,t){return`${t}-${e}`}async getPageImageUrl(e,t){const n=this.getCacheKey(e,t),r=this.cache.get(n);if(r)return r;const a=this.pending.get(n);if(a)return a;const s=this.fetchImageUrl(e,t);this.pending.set(n,s);try{const e=await s;return this.cache.set(n,e),e}finally{this.pending.delete(n)}}async fetchImageUrl(e,t){const n=this.getImagePath(e,t);return(await this.client.files.getDownloadUrl(n)).url}getImagePath(e,t){const n=`${ws}/${this.objectId}/pages`;switch(t){case Ns.original:return`${n}/page-${e}.original.jpg`;case Ns.instrumented:return`${n}/page-${e}.instrumented.jpg`}}}class Cs{client;objectId;totalPages;cache=new Map;pending=new Map;constructor(e,t,n){this.client=e,this.objectId=t,this.totalPages=n}async getPageLayout(e){const t=this.cache.get(e);if(void 0!==t)return t;const n=this.pending.get(e);if(n)return n;const r=this.fetchPageLayout(e);this.pending.set(e,r);try{const t=await r;return this.cache.set(e,t),t}finally{this.pending.delete(e)}}async fetchPageLayout(e){const t=`${ws}/${this.objectId}/pages/page-${e}.layout.json`,n=await this.client.files.getDownloadUrl(t),r=await fetch(n.url,{method:"GET"});if(!r.ok)throw new Error("Failed to fetch json layout: "+r.statusText);return r.text()}}class Ss{totalPages;pages=[];constructor(e){this.totalPages=e}initFromContent(e){this.pages=function(e,t){const n=new Array(t).fill(""),r=/<!--\s*\{\s*"page"\s*:\s*(\d+)\s*\}\s*-->/g,a=[];let s;for(;null!==(s=r.exec(e));)a.push({page:parseInt(s[1],10),index:s.index+s[0].length});for(let r=0;r<a.length;r++){const s=a[r],i=s.page-1;if(i<0||i>=t)continue;const l=s.index,o=e.slice(l).match(/<!--\s*\{\s*"page"\s*:\s*\d+\s*\}\s*-->/),c=o?l+o.index:e.length;let d=e.slice(l,c).trim();d=d.replace(/\n---\s*$/,"").trim(),n[i]=d}return n}(e,this.totalPages)}async loadUrls(e,t){}async getPageMarkdown(e){const t=e-1;return t<0||t>=this.pages.length?"":this.pages[t]}}const _s=m(void 0);function js({children:t,object:n}){const{client:r}=Kt(),a=n.metadata.page_count||10,s="markdown"===n.metadata?.content_processor?.type,[i,l]=c(()=>{const e=new Ss(a);s&&n.text&&e.initFromContent(n.text);const t=n.text?Ts(n.text):"";return{count:a,layoutProvider:new Cs(r,n.id,a),markdownProvider:e,imageProvider:new ks(r,n.id,a),xml:t,xmlPages:n.text?Ps(t):[],pdfUrl:"",pdfUrlLoading:!0}});return d(()=>{if(s){const e=n.metadata,t=e?.renditions?.find(e=>e.name===Xt),a="application/pdf"===n.content?.type,s=t?.content?.source||(a?n.content?.source:void 0);s?r.store.objects.getDownloadUrl(s,void 0,"inline").then(e=>{l(t=>({...t,pdfUrl:e.url,pdfUrlLoading:!1}))}).catch(e=>{console.warn("Failed to get PDF URL:",e),l(e=>({...e,pdfUrlLoading:!1}))}):l(e=>({...e,pdfUrlLoading:!1}))}else l(e=>({...e,pdfUrlLoading:!1}))},[n.id,r,s,a]),e(_s.Provider,{value:i,children:t})}function Is(){const e=l.useContext(_s);if(!e)throw new Error("useMagicPdfContext must be used within a MagicPdfProvider");return e}function Ps(e){const t=(new DOMParser).parseFromString(Ts(e),"text/xml").getElementsByTagName("page"),n=new XMLSerializer;return Array.from(t).map(e=>n.serializeToString(e))}function Ts(e){return e.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").replace(/<\?xml.*?\?>/g,"")}const As=[50,75,100,125,150,200,300],zs=11/8.5;function Fs({className:n,currentPage:a,onChange:s}){const[i,l]=c(Ns.instrumented),[o,m]=c(zs),[p,g]=c(new Map),[f,y]=c(100),b=u(new Set),x=u(null),w=u(null),N=u(!1),{imageProvider:k,count:C}=Is(),S=h(()=>{let e=As.findIndex(e=>e>=f);-1===e&&(e=As.length-1);const t=Math.min(e+1,As.length-1);y(As[t])},[f]),_=h(()=>{let e=As.findIndex(e=>e>=f);-1===e&&(e=As.length-1);const t=Math.max(e-1,0);y(As[t])},[f]),j=h(()=>{y(100)},[]);d(()=>{k.getPageImageUrl(1,i).then(e=>{const t=new window.Image;t.onload=()=>{t.width>0&&t.height>0&&m(t.height/t.width)},t.src=e}).catch(()=>{})},[k,i]);const I=u(i);d(()=>{let e=!1;I.current!==i&&(I.current=i,b.current=new Set,g(new Map));const t=function(e,t){const n=[e];let r=1;for(;n.length<t;){const a=e+r,s=e-r;a<=t&&n.push(a),s>=1&&n.push(s),r++}return n}(a,C);return t.forEach(t=>(async t=>{if(!e&&!b.current.has(t))try{const n=await k.getPageImageUrl(t,i);e||(b.current.add(t),g(e=>new Map(e).set(t,n)))}catch{}})(t)),()=>{e=!0}},[a,C,i,k]);const P=u(f);d(()=>{if(P.current!==f&&w.current){P.current=f,N.current=!0;const e=w.current.querySelector(`[data-page="${a}"]`);e?requestAnimationFrame(()=>{e.scrollIntoView({behavior:"instant",block:"center"}),requestAnimationFrame(()=>{N.current=!1})}):N.current=!1}},[f,a]);const T=u(a);d(()=>{if(T.current!==a&&w.current){T.current=a,N.current=!0;const e=w.current.querySelector(`[data-page="${a}"]`);e&&e.scrollIntoView({behavior:"instant",block:"nearest"}),requestAnimationFrame(()=>{N.current=!1})}},[a]),d(()=>{const e=w.current;if(!e)return;let t=null;const n=()=>{N.current||(t&&clearTimeout(t),t=setTimeout(()=>{const t=e.getBoundingClientRect(),n=t.top+t.height/2;let r=a,i=1/0;for(let t=1;t<=C;t++){const a=e.querySelector(`[data-page="${t}"]`);if(a){const e=a.getBoundingClientRect(),s=e.top+e.height/2,l=Math.abs(s-n);l<i&&(i=l,r=t)}}r!==a&&(T.current=r,s(r))},50))};return e.addEventListener("scroll",n,{passive:!0}),()=>{t&&clearTimeout(t),e.removeEventListener("scroll",n)}},[C,a,s]);return t("div",{ref:x,className:r("flex flex-col items-stretch gap-y-2",n),children:[t("div",{className:"relative flex items-center justify-center px-2 h-9",children:[e(v,{variant:"ghost",size:"xs",onClick:()=>{a>1&&s(a-1)},alt:"Previous page",children:e(lt,{className:"size-4"})}),t("div",{className:"absolute left-2 flex items-center gap-x-1",children:[e(Es,{type:Ns.original,currentType:i,onClick:()=>l(Ns.original),icon:e(mt,{className:"size-4"}),tooltip:"Original images"}),e(Es,{type:Ns.instrumented,currentType:i,onClick:()=>l(Ns.instrumented),icon:e(pt,{className:"size-4"}),tooltip:"Instrumented images"}),e("div",{className:"w-px h-4 bg-border mx-1"}),e(Ds,{zoom:f,onZoomIn:S,onZoomOut:_,onFitToView:j,canZoomIn:f<As[As.length-1],canZoomOut:f>As[0]})]}),e("div",{className:"absolute right-2",children:e(Rs,{currentPage:a,totalPages:C,onChange:s})})]}),e("div",{ref:w,className:"flex flex-col items-center gap-2 flex-1 overflow-y-auto px-2",children:Array.from({length:C},(t,n)=>e($s,{currentPage:a,pageNumber:n+1,aspectRatio:o,zoom:f,url:p.get(n+1),onSelect:()=>s(n+1)},n))}),e("div",{className:"flex items-center justify-center h-9",children:e(v,{variant:"ghost",size:"xs",onClick:()=>{a<C&&s(a+1)},alt:"Next page",children:e(ot,{className:"size-4"})})})]})}function Es({type:t,currentType:n,onClick:a,icon:s,tooltip:i}){return e(O,{description:i,placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",t===n?"text-primary bg-primary/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:a,children:s})})}function Ds({zoom:n,onZoomIn:a,onZoomOut:s,onFitToView:i,canZoomIn:l,canZoomOut:o}){return t("div",{className:"flex items-center gap-x-0.5",children:[e(O,{description:"Zoom out",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",o?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40 cursor-not-allowed"),onClick:s,disabled:!o,children:e(ct,{className:"size-4"})})}),t("span",{className:"text-xs text-muted-foreground min-w-[32px] text-center",children:[n,"%"]}),e(O,{description:"Zoom in",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",l?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40 cursor-not-allowed"),onClick:a,disabled:!l,children:e(dt,{className:"size-4"})})}),e(O,{description:"Fit to width",placement:"bottom",size:"xs",children:e("button",{className:r("p-1 rounded cursor-pointer transition-colors",100!==n?"text-muted-foreground hover:text-foreground hover:bg-muted":"text-muted-foreground/40"),onClick:i,children:e(ut,{className:"size-4"})})})]})}function $s({pageNumber:n,currentPage:a,aspectRatio:s,zoom:i,url:l,onSelect:o}){return t("div",{className:"p-2 hover:bg-muted rounded-md flex flex-col items-center","data-page":n,style:{width:`${i}%`},children:[e("div",{className:r("relative border-[2px] cursor-pointer overflow-hidden flex items-center justify-center bg-muted/50 w-full",n===a?"border-primary":"border-border"),style:{aspectRatio:`1 / ${s}`},onClick:o,children:l?e("img",{src:l,alt:`Page ${n}`,className:"w-full"}):e(Be,{className:"w-6 h-6 animate-spin text-muted-foreground"})}),e(R,{className:"text-sm text-muted-foreground pt-1 font-semibold",children:n})]})}function Rs({currentPage:n,totalPages:r,onChange:a}){const s=u(null),[i,l]=c(String(n));d(()=>{l(String(n))},[n]);const o=()=>{const e=parseInt(i,10);!isNaN(e)&&e>=1&&e<=r?a(e):l(String(n))};return t("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e("span",{children:"Page"}),e("input",{ref:s,type:"text",value:i,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key?(o(),s.current?.blur()):"Escape"===e.key&&(l(String(n)),s.current?.blur())},onBlur:()=>{o()},className:"w-8 h-5 text-center text-xs px-1 py-0 bg-background border border-border rounded focus:outline-none focus:border-primary"}),t("span",{children:["/ ",r]})]})}function Os({object:n}){const{client:r}=Kt(),a=e=>{(function(e,t,n){return e.files.getDownloadUrl(`${ws}/${t}/${n}`).then(e=>e.url)})(r,n.id,e).then(e=>window.open(e,"_blank"))},s="p-2 cursor-pointer hover:bg-muted text-left text-sm";return"markdown"===(()=>{if("document"===n.metadata?.type){const e=n.metadata;return e.content_processor?.type||"xml"}return"xml"})()?e(v,{variant:"ghost",size:"xs",onClick:()=>a("document.md"),alt:"Download",children:e(ht,{className:"size-4"})}):t(vn,{strategy:"absolute",placement:"bottom-start",zIndex:100,offset:8,children:[e(vn.Trigger,{click:!0,children:e(v,{variant:"ghost",size:"xs",alt:"Download",children:e(ht,{className:"size-4"})})}),e(vn.Content,{children:t("div",{className:"rounded-md shadow-md border border-border bg-popover min-w-[200px] flex flex-col divide-y divide-border",children:[e("button",{className:s,onClick:()=>a("annotated.pdf"),children:"annotated.pdf"}),e("button",{className:s,onClick:()=>a("document.xml"),children:"document.xml"}),e("button",{className:s,onClick:()=>a("analyzed-pages.json"),children:"analyzed-pages.json"})]})})]})}function Ls({className:t}){return e("div",{className:`flex items-center justify-center ${t||""}`,children:e(Be,{className:"w-6 h-6 animate-spin text-gray-400"})})}function Us({viewType:t,pageNumber:n}){switch(t){case"json":return e(Vs,{pageNumber:n});case"markdown":return e(qs,{pageNumber:n});default:return e(Ms,{pageNumber:n})}}function Ms({pageNumber:t}){const{xmlPages:n}=Is();return e("div",{className:"px-4 py-2",children:e(xn,{xml:n[t-1],collapsible:!0})})}function Vs({pageNumber:t}){const[n,r]=c(null),[a,s]=c(!0),[i,l]=c(null),{layoutProvider:o}=Is();return d(()=>{s(!0),l(null),o.getPageLayout(t).then(e=>{r(e?JSON.parse(e):null),s(!1)}).catch(e=>{console.error(e),l(e.message||"Failed to load layout"),s(!1)})},[t,o]),a?e("div",{className:"px-4 py-8",children:e(Ls,{})}):i?e("div",{className:"px-4 py-2 text-red-500 text-sm",children:i}):n?e(wn,{className:"w-full",data:n}):null}function qs({pageNumber:n}){const[r,a]=c(null),[s,i]=c(!0),[l,o]=c(null),{markdownProvider:u}=Is();return d(()=>{i(!0),o(null),u.getPageMarkdown(n).then(e=>{a(e),i(!1)}).catch(e=>{console.error(e),o(e.message||"Failed to load markdown"),i(!1)})},[n,u]),s?t("div",{className:"h-full flex flex-col items-center justify-center gap-2",children:[e(Ls,{}),e("span",{className:"text-sm text-muted-foreground",children:"Loading..."})]}):e("div",l?{className:"px-4 py-2 text-red-500 text-sm",children:l}:{className:"px-4 py-2 prose prose-sm max-w-none dark:prose-invert",children:r?e(yn,{children:r}):e("div",{children:"No markdown content available"})})}class Bs extends f{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("PDF View error:",e,t)}render(){return this.state.hasError?e("div",{className:"fixed inset-0 bg-background z-50 flex items-center justify-center",children:t("div",{className:"flex flex-col items-center gap-4 p-8 max-w-md",children:[e(U,{title:"Failed to load PDF viewer",children:this.state.error?.message||"An unexpected error occurred"}),this.props.onClose&&e(v,{variant:"outline",onClick:this.props.onClose,children:"Close"})]})}):this.props.children}}function Ws({objectId:n,onClose:r}){const{client:a}=Kt(),{data:s,error:i}=L(()=>a.store.objects.retrieve(n,"+text"),[n]);return i?e("div",{className:"fixed inset-0 bg-background z-50 flex items-center justify-center",children:t("div",{className:"flex flex-col items-center gap-4 p-8 max-w-md",children:[e(U,{title:"Fetching document failed",children:i.message}),r&&e(v,{variant:"outline",onClick:r,children:"Close"})]})}):s?e(Bs,{onClose:r,children:e("div",{className:"fixed inset-0 bg-background z-50 flex items-center justify-center",children:e(js,{object:s,children:e(Ks,{object:s,onClose:r})})})}):t("div",{className:"fixed inset-0 bg-background z-50 flex flex-col",children:[e("div",{className:"flex h-9 items-center justify-end shrink-0 bg-sidebar px-2 border-b border-sidebar-border",children:r&&e(v,{variant:"ghost",size:"xs",onClick:r,alt:"Close",children:e(Re,{className:"size-4"})})}),e("div",{className:"flex-1 flex items-center justify-center",children:e("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})]})}function Ks({object:n,onClose:r}){const{count:a,pdfUrl:s,pdfUrlLoading:i}=Is(),[l,o]=c(1),d=(()=>{if("document"===n.metadata?.type){const e=n.metadata,t=e.content_processor?.type;if("markdown"===t)return"markdown"}return"xml"})();return t(M,"xml"===d?{direction:"horizontal",className:"absolute inset-0",children:[e(V,{defaultSize:50,minSize:20,maxSize:80,className:"bg-muted",children:e(Fs,{className:"h-full",currentPage:l,onChange:o})}),e(q,{className:"w-[4px] bg-border cursor-ew-resize"}),t(V,{defaultSize:50,minSize:20,className:"flex flex-col",children:[t("div",{className:"flex h-9 items-center justify-between shrink-0 bg-sidebar px-2 border-b border-sidebar-border",children:[e("div",{className:"flex items-center gap-x-2",children:e(Os,{object:n})}),t("span",{className:"text-xs text-muted-foreground",children:["Page ",l," / ",a]}),e("div",{className:"flex items-center gap-x-2",children:!!r&&e(v,{variant:"ghost",size:"xs",onClick:r,alt:"Close",children:e(Re,{className:"size-4"})})})]}),e("div",{className:"flex-1 overflow-auto px-2",children:e(Us,{pageNumber:l,viewType:"xml"})})]})]}:{direction:"horizontal",className:"absolute inset-0",children:[e(V,{defaultSize:50,minSize:20,maxSize:80,className:"bg-muted",children:e(bs,{pdfUrl:s,pdfUrlLoading:i,pageCount:a,className:"h-full",currentPage:l,onChange:o})}),e(q,{className:"w-[4px] bg-border cursor-ew-resize"}),t(V,{defaultSize:50,minSize:20,className:"flex flex-col",children:[t("div",{className:"flex h-9 items-center justify-between shrink-0 bg-sidebar px-2 border-b border-sidebar-border",children:[e("div",{className:"flex items-center gap-x-2",children:e(Os,{object:n})}),t("span",{className:"text-xs text-muted-foreground",children:["Page ",l," / ",a]}),e("div",{className:"flex items-center gap-x-2",children:!!r&&e(v,{variant:"ghost",size:"xs",onClick:r,alt:"Close",children:e(Re,{className:"size-4"})})})]}),e("div",{className:"flex-1 overflow-auto px-2",children:e(Us,{pageNumber:l,viewType:"markdown"})})]})]})}function Hs({object:n,url:r,source:a,className:s}){const{client:i}=Kt(),[l,o]=c(1),[u,m]=c(r||""),[p,h]=c(!r),[g,f]=c(0),[y,b]=c(!1);d(()=>{if(r)return m(r),void h(!1);const e=a||n?.content?.source;e?(h(!0),i.files.getDownloadUrl(e).then(e=>{m(e.url)}).catch(e=>{console.error("Failed to get PDF URL:",e)}).finally(()=>{h(!1)})):h(!1)},[r,a,n?.content?.source,i]),d(()=>{const e=n?.metadata,t=e?.pages||e?.page_count||0;t>0&&f(t)},[n?.metadata]);const x=e=>{f(e)};return p?e("div",{className:"flex items-center justify-center h-full",children:e(B,{size:"lg"})}):u?y?t("div",{className:"fixed inset-0 bg-background z-50 flex flex-col overflow-hidden",children:[e("div",{className:"flex h-9 items-center justify-end shrink-0 bg-sidebar px-2 border-b border-sidebar-border",children:e(v,{variant:"ghost",size:"xs",onClick:()=>b(!1),alt:"Close fullscreen",children:e(Re,{className:"size-4"})})}),e(bs,{pdfUrl:u,pdfUrlLoading:p,pageCount:g||100,currentPage:l,onChange:o,onPageCountChange:x,className:"flex-1 min-h-0"})]}):e("div",{className:"relative h-full flex flex-col",children:e(bs,{pdfUrl:u,pdfUrlLoading:p,pageCount:g||100,currentPage:l,onChange:o,onPageCountChange:x,className:s,compact:!0,headerExtra:e(O,{description:"Fullscreen",placement:"bottom",size:"xs",children:e("button",{className:"p-1 rounded cursor-pointer transition-colors text-muted-foreground hover:text-foreground hover:bg-muted",onClick:()=>b(!0),children:e(gt,{className:"size-4"})})})})}):e("div",{className:"flex items-center justify-center h-full text-muted",children:"No PDF available"})}const Gs=131072;const Js=["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/svg+xml"],Ys=["video/mp4","video/webm"],Zs=["audio/mp4","audio/m4a","audio/x-m4a","audio/mpeg","audio/ogg","audio/wav","audio/webm"],Qs="h-[calc(100vh-208px)]",Xs="h-[calc(100vh-228px)]",ei="h-[calc(100vh-218px)]",ti="max-h-[calc(100vh-268px)]";function ni(e){return e===tn.created||e===tn.processing}function ri(e){return e.metadata?.content_processor?.type}function ai(e){return e?"":"hidden"}var si;function ii({object:r,loadText:a,refetch:s}){const i=b(),l=async(e,t)=>{try{await navigator.clipboard.writeText(e),i({status:"success",title:("text"===t?"Content":"Properties")+" copied",description:`Successfully copied ${t} to clipboard`,duration:2e3})}catch(e){console.error(`Failed to copy ${t}:`,e),i({status:"error",title:"Copy failed",description:`Failed to copy ${t} to clipboard`,duration:5e3})}};return e(n,{children:t(M,{direction:"horizontal",className:Qs,children:[e(V,{className:"min-w-[100px]",children:e(li,{object:r,refetch:s??(()=>Promise.resolve()),handleCopyContent:l})}),e(q,{withHandle:!0}),e(V,{className:"min-w-[100px]",children:e(oi,{object:r,loadText:a??!1,handleCopyContent:l,refetch:s})})]})})}function li({object:r,refetch:a,handleCopyContent:s}){const[i,l]=c(!1),[o,d]=c(!1);return t(n,{children:[t("div",{className:"flex justify-between items-center px-2",children:[t("div",{className:"flex items-center gap-1 bg-muted mb-2 p-1 rounded",children:[e(v,{variant:""+(i?"ghost":"primary"),size:"sm",alt:"Preview properties",onClick:()=>l(!i),children:"Properties"}),e(v,{variant:""+(i?"primary":"ghost"),size:"sm",alt:"View in JSON format",onClick:()=>l(!i),children:"JSON"})]}),t("div",{className:"flex items-center gap-2",children:[r.properties&&e(v,{variant:"ghost",size:"sm",title:"Copy properties",onClick:()=>s(JSON.stringify(r.properties,null,2),"properties"),children:e(ft,{className:"size-4"})}),e(v,{variant:"ghost",size:"sm",onClick:()=>{d(!0)},title:"Edit properties",className:"flex items-center gap-2",children:e(yt,{className:"size-4"})})]})]}),r.properties?e("div",{className:`${Xs} overflow-auto px-2`,children:e(Nn,{value:r.properties,viewCode:i})}):e("div",{className:`${Xs} overflow-auto px-2`,children:e("div",{children:"No properties defined"})}),e(ss,{isOpen:o,onClose:()=>{d(!1)},object:r,refetch:a})]})}function oi({object:n,loadText:r,handleCopyContent:a,refetch:s}){const i=n?.metadata?.type===nn.Image,l=n?.metadata?.type===nn.Video,o=n?.metadata?.type===nn.Audio,m="application/pdf"===n?.content?.type,p=!!n?.content?.type&&Ja(n.content.type),g=ni(n?.status),f=!(!n.transcript||!l&&!o),y=n.metadata,b=y?.renditions?.find(e=>e.name===Xt),[x,w]=c(l?si.Video:o?si.Audio:i?si.Image:si.Text),{fullText:N,displayText:k,isLoading:C,isCropped:S}=function(e,t,n=!1){const{store:r}=Kt(),[a,s]=c(t),[i,l]=c(()=>t&&t.length>Gs?t.substring(0,Gs):t),[o,u]=c(!1),[m,p]=c(()=>!!t&&t.length>Gs),g=h(()=>{u(!0),r.objects.getObjectText(e).then(e=>{s(e.text),e.text&&e.text.length>Gs?(l(e.text.substring(0,Gs)),p(!0)):(l(e.text),p(!1))}).catch(e=>{console.error("Failed to load text",e),s(void 0),l(void 0),p(!1)}).finally(()=>{u(!1)})},[e,r]);return d(()=>{t&&t.length>Gs?(s(t),l(t.substring(0,Gs)),p(!0)):(s(t),l(t),p(!1)),n&&!t&&g()},[e,t,n,g]),{fullText:a,displayText:i,isLoading:o,isCropped:m,loadText:g}}(n.id,n.text,r),_=(m||p)&&g,{progress:j,status:I,outputFormat:P,isComplete:T}=function(e,t){const{client:n}=Kt(),[r,a]=c(),[s,i]=c(),[l,o]=c(),[u,m]=c(!1);return d(()=>{if(!t)return;let r=!1;return function t(){r||n.objects.analyze(e).getStatus().then(e=>{a(e.progress),i(e.status),o(e.output_format??e.progress?.output_format),e.status===Qt.RUNNING?r||setTimeout(t,2e3):m(!0)}).catch(()=>{r||setTimeout(t,1e4)})}(),()=>{r=!0}},[t,e,n]),{progress:r,status:s,outputFormat:l,isComplete:u}}(n.id,_),{pdfUrl:A,isConverting:z,error:F,triggerConversion:E}=function(e,t){const{client:n}=Kt(),[r,a]=c(),[s,i]=c(!1),[l,o]=c(),d=h(async()=>{if(!t||s)return;i(!0),o(void 0);const r=async t=>{try{const s=await n.objects.getRendition(e,{format:en.pdf,generate_if_missing:t,sign_url:!0,block_on_generation:!1});"generating"===s.status?setTimeout(()=>r(!1),5e3):"found"===s.status&&s.renditions?.length?(a(s.renditions[0]),i(!1)):"failed"===s.status&&(o("PDF conversion failed"),i(!1))}catch(e){console.error("Failed to convert Office document to PDF:",e),o("Failed to convert to PDF"),i(!1)}};await r(!0)},[e,t,s,n]);return{pdfUrl:r,isConverting:s,error:l,triggerConversion:d}}(n.id,p);d(()=>{T&&I===Qt.COMPLETED&&s?.()},[T,I,s]);const D=(m||p)&&g&&!T&&I===Qt.RUNNING,$=u(null);return t("div",{className:"flex flex-col h-full",children:[t("div",{className:"flex justify-between items-center px-2 shrink-0",children:[t("div",{className:"flex items-center gap-2 mb-2",children:[t("div",{className:"flex items-center gap-1 bg-muted p-1 rounded",children:[i&&e(v,{variant:x===si.Image?"primary":"ghost",size:"sm",alt:"View Image",onClick:()=>w(si.Image),children:"Image"}),l&&e(v,{variant:x===si.Video?"primary":"ghost",size:"sm",alt:"View Video",onClick:()=>w(si.Video),children:"Video"}),o&&e(v,{variant:x===si.Audio?"primary":"ghost",size:"sm",alt:"View Audio",onClick:()=>w(si.Audio),children:"Audio"}),f&&e(v,{variant:x===si.Transcript?"primary":"ghost",size:"sm",alt:"View Transcript",onClick:()=>w(si.Transcript),children:"Transcript"}),e(v,{variant:x===si.Text?"primary":"ghost",size:"sm",alt:"View Text",onClick:()=>w(si.Text),children:"Text"}),m&&e(v,{variant:x===si.Pdf?"primary":"ghost",size:"sm",alt:"View PDF",onClick:()=>w(si.Pdf),children:"PDF"}),p&&e(v,{variant:x===si.Pdf?"primary":"ghost",size:"sm",alt:"View as PDF",onClick:()=>{w(si.Pdf),b||A||z||E()},disabled:z,children:z?e(B,{size:"sm"}):"PDF"})]}),e(fi,{object:n})]}),x===si.Text&&!D&&e(ci,{object:n,text:k,fullText:N,handleCopyContent:a,textContainerRef:$}),x===si.Pdf&&p&&(b||A)&&e(yi,{object:n,pdfRendition:b,officePdfUrl:A})]}),e("div",{className:ai(x===si.Image),children:e(ui,{object:n})}),e("div",{className:ai(x===si.Video),children:e(mi,{object:n})}),e("div",{className:ai(x===si.Audio),children:e(pi,{object:n})}),f&&e("div",{className:ai(x===si.Transcript),children:e(gi,{object:n,handleCopyContent:a})}),m&&e("div",{className:ai(x===si.Pdf),children:e(bi,{object:n})}),p&&e("div",{className:ai(x===si.Pdf),children:e(vi,{pdfRendition:b,officePdfUrl:A,officePdfConverting:z,officePdfError:F,onConvert:E})}),D&&e("div",{className:ai(x===si.Text),children:e(xi,{progress:j,status:I,outputFormat:P})}),e("div",{className:ai(x===si.Text&&!D&&C),children:e("div",{className:"flex justify-center items-center flex-1",children:e(B,{size:"lg"})})}),e("div",{className:ai(x===si.Text&&!D&&!C),children:e(di,{object:n,text:k,isTextCropped:S,textContainerRef:$})})]})}function ci({object:r,text:a,fullText:s,handleCopyContent:i,textContainerRef:l}){const{client:o}=Kt(),d=b(),[u,m]=c(null),[p,h]=c(!1),g=r.content,f=g&&g.type&&"text/markdown"===g.type,y=ri(r),x=async e=>{if(!u){m(e),d({status:"info",title:`Preparing ${e.toUpperCase()}`,description:"Fetching your document...",duration:2e3});try{const t=await o.objects.getRendition(r.id,{format:e,generate_if_missing:!0,sign_url:!0});if("generating"===t.status)return d({status:"info",title:"Generating document",description:`Please wait while we prepare your ${e.toUpperCase()} file...`,duration:5e3}),void setTimeout(()=>x(e),3e3);if("failed"===t.status)throw new Error("Document generation failed");if(t.renditions&&t.renditions.length>0){const n=t.renditions[0];if("pdf"===e);else{const t=document.createElement("a");t.href=n,t.download=`${r.name||"document"}.${e}`,document.body.appendChild(t),t.click(),document.body.removeChild(t),d({status:"success",title:"Document exported",description:`Successfully exported to ${e.toUpperCase()} format`,duration:2e3})}}}catch(t){console.error(`Failed to export document as ${e}:`,t),d({status:"error",title:"Export failed",description:`Failed to export document to ${e.toUpperCase()} format`,duration:5e3})}finally{m(null)}}};return t(n,{children:[e("div",{className:"h-[41px] text-lg font-semibold flex justify-between items-center px-2",children:t("div",{className:"flex items-center gap-2",children:[s&&t(n,{children:[e(v,{variant:"ghost",size:"sm",title:"Copy text",onClick:()=>i(s,"text"),children:e(ft,{className:"size-4"})}),e(v,{variant:"ghost",size:"sm",title:"Download text",onClick:e=>{if(e.preventDefault(),e.stopPropagation(),!s)return;let t="txt",n="text/plain";"xml"===y?(t="xml",n="text/xml"):("markdown"===y||f)&&(t="md",n="text/markdown");const a=new Blob([s],{type:n}),i=URL.createObjectURL(a),l=`${r.name||"document"}.${t}`,o=document.createElement("a");o.href=i,o.download=l,o.style.display="none",setTimeout(()=>{o.click(),URL.revokeObjectURL(i)},0)},children:e(ht,{className:"size-4"})})]}),f&&a&&t(n,{children:[t(v,{variant:"ghost",size:"sm",onClick:()=>x("docx"),disabled:null!==u,className:"flex items-center gap-2",children:["docx"===u?e(B,{size:"sm"}):e(ht,{className:"size-4"}),"DOCX"]}),t(v,{variant:"ghost",size:"sm",onClick:()=>{l.current?h(!0):d({status:"error",title:"PDF export failed",description:"No content available to export",duration:3e3})},className:"flex items-center gap-2",children:[e(ht,{className:"size-4"}),"PDF"]})]})]})}),t(K,{isOpen:p,onClose:()=>h(!1),children:[e(H,{children:"Export document as PDF"}),t(G,{children:[e("p",{className:"mb-2",children:"This will open your browser's print dialog with the current document content."}),e("p",{className:"text-sm text-muted",children:'To save a PDF, choose "Save as PDF" or a similar option in the print dialog.'})]}),t(J,{align:"right",children:[e(v,{variant:"ghost",size:"sm",onClick:()=>h(!1),children:"Cancel"}),e(v,{size:"sm",onClick:()=>{if(!l.current)return void d({status:"error",title:"PDF export failed",description:"No content available to export",duration:3e3});const e=`${r.name||r.id||"document"} - content`;es(l.current,e)?(d({status:"success",title:"PDF export ready",description:"Use your browser's Print dialog to save as PDF",duration:4e3}),h(!1)):d({status:"error",title:"PDF export failed",description:"Unable to open print preview",duration:4e3})},children:"Open print dialog"})]})]})]})}!function(e){e.Text="text",e.Image="image",e.Video="video",e.Audio="audio",e.Pdf="pdf",e.Transcript="transcript"}(si||(si={}));const di=g(({object:r,text:a,isTextCropped:s,textContainerRef:i})=>{const l=r.content,o=ni(r?.status),c="xml"===ri(r),d=l&&l.type&&("text/markdown"===l.type||"text/plain"===l.type),u=!c&&(d||function(e){return!!e&&(e.includes("\n# ")||e.includes("\n## ")||e.includes("\n### ")||e.includes("\n* ")||e.includes("\n- ")||e.includes("\n+ ")||e.includes("![")||e.includes("]("))}(a));return a?t(n,{children:[s&&e("div",{className:"px-2 py-2 bg-attention/10 border-l-4 border-attention mx-2 mb-2 rounded",children:t("div",{className:"flex items-center gap-2 text-attention",children:[e(et,{className:"size-4"}),e("span",{className:"text-sm font-semibold",children:"Showing first 128K characters only"})]})}),e("div",{className:`max-w-7xl px-2 ${ei} overflow-auto`,ref:i,children:c?e("div",{className:"px-4 py-2",children:e(xn,{xml:a,collapsible:!0})}):u?e("div",{className:"vprose prose-sm p-1",children:e(yn,{components:{a:({node:t,...n})=>{const r=n.href||"";return r.includes("/store/objects/")?e(gn,{topLevelNav:!0,href:r,className:"text-info",children:n.children}):e("a",{...n,target:"_blank",rel:"noopener noreferrer"})},p:({node:t,...n})=>e("p",{...n,className:"my-0"}),pre:({node:t,...n})=>e("pre",{...n,className:"my-2 p-2 rounded"}),code:({node:t,className:n,children:r,...a})=>{const s=/language-(\w+)/.exec(n||"");return e("code",{...a,className:s?"text-muted":"px-1.5 py-0.5 rounded",children:r})},h1:({node:t,...n})=>e("h1",{...n,className:"font-bold text-2xl my-2"}),h2:({node:t,...n})=>e("h2",{...n,className:"font-bold text-xl my-2"}),h3:({node:t,...n})=>e("h3",{...n,className:"font-bold text-lg my-2"}),li:({node:t,...n})=>e("li",{...n})},children:a})}):e("pre",{className:"text-wrap bg-muted text-muted p-2",children:a})})]}):e("div",{className:"px-2",children:e("div",{children:o?"Extracting content...":"No content"})})});function ui({object:t}){const{client:n}=Kt(),[r,a]=c(),s=t.content,i=t.metadata&&t.metadata.type===nn.Image;return d(()=>{if(i){a(void 0);(async()=>{const e=s?.type&&Js.includes(s.type);try{const r=await n.objects.getRendition(t.id,{format:Zt.jpeg,generate_if_missing:!1,sign_url:!0});if("found"===r.status&&r.renditions?.length)a(r.renditions[0]);else if(e){const e=await n.files.getDownloadUrl(t.content.source);a(e.url)}}catch(r){if(e){const e=await n.files.getDownloadUrl(t.content.source);a(e.url)}}})()}},[t.id,i,s?.type,s?.source,n]),e("div",{className:"mb-4 px-2",children:r?e("img",{src:r,alt:t.name,className:"w-full object-contain"}):e(B,{size:"md"})})}function mi({object:n}){const{client:r}=Kt(),[a,s]=c(),[i,l]=c(),[o,u]=c(!0),m=n.content,p=n.metadata?.type===nn.Video,h=n.metadata,g=h?.renditions||[],f=g.find(e=>"video/mp4"===e.content.type)||g.find(e=>"video/webm"===e.content.type),y=m?.type&&Ys.includes(m.type),b=g.find(e=>e.name===rn);return d(()=>{s(void 0),l(void 0),u(!0)},[n.id]),d(()=>{(async()=>{if(b?.content?.source)try{const e=await r.files.getDownloadUrl(b.content.source);l(e.url)}catch(e){console.error("Failed to load poster image",e)}})()},[b,r]),d(()=>{if(p&&(f?.content?.source||y)){(async()=>{try{let e;f?.content?.source?e=await r.files.getDownloadUrl(f.content.source):y&&m?.source&&(e=await r.files.getDownloadUrl(m.source)),e&&s(e.url)}catch(e){console.error("Failed to get video URL",e)}finally{u(!1)}})()}else u(!1)},[p,f,y,m?.source,r]),e("div",{className:"mb-4 px-2",children:f||y?o?e("div",{className:"flex justify-center items-center h-[400px]",children:e(B,{size:"md"})}):a?e("video",{src:a,poster:i,controls:!0,className:`w-full ${ti} object-contain`,children:"Your browser does not support the video tag."}):e("div",{className:"flex justify-center items-center h-[400px] text-muted",children:"Failed to load video"}):e("div",{className:"flex justify-center items-center h-[400px] text-muted",children:t("div",{className:"text-center",children:[e("p",{children:"No web-compatible video rendition available"}),e("p",{className:"text-sm mt-2",children:"MP4 or WebM format required"})]})})})}function pi({object:n}){const{client:r}=Kt(),[a,s]=c(),[i,l]=c(!0),o=n.content,u=n.metadata?.type===nn.Audio,m=n.metadata,p=(m?.renditions||[]).find(e=>e.name===an),h=o?.type&&Zs.includes(o.type);return d(()=>{s(void 0),l(!0)},[n.id]),d(()=>{if(u&&(p?.content?.source||h)){(async()=>{try{let e;p?.content?.source?e=await r.files.getDownloadUrl(p.content.source):h&&o?.source&&(e=await r.files.getDownloadUrl(o.source)),e&&s(e.url)}catch(e){console.error("Failed to get audio URL",e)}finally{l(!1)}})()}else l(!1)},[u,p,h,o?.source,r]),e("div",{className:"mb-4 px-2",children:p||h?i?e("div",{className:"flex justify-center items-center h-[200px]",children:e(B,{size:"md"})}):a?t("div",{className:"flex flex-col items-center gap-4",children:[e("audio",{src:a,controls:!0,className:"w-full max-w-2xl",children:"Your browser does not support the audio tag."}),m?.duration&&t("div",{className:"text-sm text-muted",children:["Duration: ",hi(m.duration)]})]}):e("div",{className:"flex justify-center items-center h-[200px] text-muted",children:"Failed to load audio"}):e("div",{className:"flex justify-center items-center h-[200px] text-muted",children:t("div",{className:"text-center",children:[e("p",{children:"No web-compatible audio rendition available"}),e("p",{className:"text-sm mt-2",children:"MP3, M4A, OGG, WAV, or WebM format required"})]})})})}function hi(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${n}:${r.toString().padStart(2,"0")}`}function gi({object:n,handleCopyContent:r}){const a=n.transcript,s=a?.text,i=a?.segments,l=s||(i?i.map(e=>e.text).join(" "):""),o=e=>{const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${n}:${r.toString().padStart(2,"0")}`};return t("div",{className:"flex flex-col h-full",children:[e("div",{className:"flex justify-end items-center px-2 mb-2",children:l&&e(v,{variant:"ghost",size:"sm",title:"Copy transcript",onClick:()=>r(l,"text"),children:e(ft,{className:"size-4"})})}),e("div",{className:`${ei} overflow-auto px-2`,children:i&&i.length>0?e("div",{className:"space-y-2",children:i.map((n,r)=>t("div",{className:"flex gap-3 text-sm",children:[t("span",{className:"text-muted font-mono text-xs shrink-0 pt-0.5",children:[o(n.start),n.end&&` - ${o(n.end)}`]}),e("span",{className:"flex-1",children:n.text})]},r))}):s?e("pre",{className:"text-wrap bg-muted text-muted p-2 whitespace-pre-wrap",children:s}):e("div",{className:"text-muted",children:"No transcript available"})})]})}function fi({object:r}){const[a,s]=c(!1),i=ri(r);return"xml"===i||"markdown"===i?t(n,{children:[e(v,{variant:"ghost",size:"sm",onClick:()=>s(!0),title:"Side by side view",children:e(bt,{className:"size-4"})}),a&&e(W,{children:e(Ws,{objectId:r.id,onClose:()=>s(!1)})})]}):null}function yi({object:t,pdfRendition:n,officePdfUrl:r}){const{client:a}=Kt(),s=b(),[i,l]=c(!1);return e("div",{className:"flex items-center gap-2",children:e(v,{variant:"ghost",size:"sm",onClick:async()=>{l(!0);try{let e=r;if(!e&&n?.content?.source){e=(await a.files.getDownloadUrl(n.content.source,`${t.name||"document"}.pdf`,"attachment")).url}e&&window.open(e,"_blank")}catch(e){console.error("Failed to download PDF:",e),s({status:"error",title:"Download failed",description:"Failed to download the PDF file",duration:5e3})}finally{l(!1)}},disabled:i,title:"Download PDF",children:i?e(B,{size:"sm"}):e(ht,{className:"size-4"})})})}function bi({object:t}){return e("div",{className:ei,children:e(Hs,{object:t,className:"h-full"})})}function vi({pdfRendition:n,officePdfUrl:r,officePdfConverting:a,officePdfError:s,onConvert:i}){return a?t("div",{className:"flex flex-col justify-center items-center flex-1 gap-2",children:[e(B,{size:"lg"}),e("span",{className:"text-muted",children:"Converting to PDF..."})]}):s?t("div",{className:"flex flex-col justify-center items-center flex-1 gap-2 text-destructive",children:[e(et,{className:"size-8"}),e("span",{children:s})]}):e("div",n?.content?.source?{className:ei,children:e(Hs,{source:n.content.source,className:"h-full"})}:r?{className:ei,children:e(Hs,{url:r,className:"h-full"})}:{className:"flex flex-col justify-center items-center flex-1 gap-2",children:e(v,{onClick:i,children:"Convert to PDF"})})}function xi({progress:r,status:a,outputFormat:s}){const i=ts(a),l=ns(a),o="xml"===s,c=null==r?.percent||isNaN(r.percent)?0:r.percent;return t("div",{className:"px-4 py-4",children:[r&&t("div",{className:"space-y-2",children:[t("div",{className:"flex flex-col gap-1",children:[e(wi,{name:o?"Analyze Layouts":"Analyze Page",progress:r.pages}),o&&t(n,{children:[e(wi,{name:"Extract Tables",progress:r.tables}),e(wi,{name:"Describe Images",progress:r.images}),e(wi,{name:"Process Visually",progress:r.visuals})]})]}),t("div",{className:"pt-2 text-sm text-muted",children:["Progress: ",c,"%",e("span",{className:"px-2",children:"•"}),e("span",{className:i,children:l}),r.started_at&&t(n,{children:[e("span",{className:"px-2",children:"•"}),t("span",{children:[((Date.now()-r.started_at)/1e3).toFixed(0)," sec. elapsed"]})]})]}),e(kn,{percent:c})]}),!r&&t("div",{className:"flex items-center gap-2 text-muted",children:[e(B,{size:"sm"}),e("span",{children:"Loading processing status..."})]})]})}function wi({name:e,progress:n}){return t("div",{className:"flex gap-2 text-sm",children:[t("span",{className:"text-muted min-w-36",children:[e,":"]}),t("span",{children:[n.processed," of ",n.total]})]})}function Ni({isLoading:n=!1,counts:r=6}){return n?e("div",{className:"flex flex-wrap gap-2 justify-between",children:Array(r).fill(0).map((n,r)=>e("div",{className:"w-[15vw] animate-pulse",children:t(Y,{className:"relative flex flex-col border h-fit",children:[e("div",{className:"h-48 bg-muted rounded-t-xl flex items-center justify-center text-muted",children:" "}),e(Z,{className:"bg-muted h-[2px]"}),t(Q,{className:"p-2 flex flex-col",children:[t("div",{className:"flex flex-col overflow-hidden",children:[e("div",{className:"h-5 bg-muted rounded w-3/4 mb-2"}),e("div",{className:"h-4 bg-muted rounded w-1/2"})]}),e("div",{className:"text-xs text-muted w-full flex justify-end mt-2",children:e("div",{className:"h-3 bg-muted rounded w-1/4"})})]})]})},r))}):null}function ki({selection:n,document:r,onSelectionChange:a,onRowClick:s,previewObject:i,selectedObject:l}){const{client:o}=Kt(),[u,m]=c(void 0),[p,h]=c(void 0),[g,f]=c(void 0);return d(()=>{r?.content&&Xa(o,r,m,h,f)},[r]),t(Y,{className:"relative flex flex-col border h-fit w-full "+(l?.id===r.id?"border-attention border-4":""),onClick:()=>s&&s(r),children:[n&&e("div",{className:"absolute top-2 left-2 z-10 flex flex-col items-center gap-1",children:e("input",{checked:n.isSelected(r.id),type:"checkbox",onChange:e=>{e.stopPropagation(),a(r,e)},onClick:e=>e.stopPropagation()})}),e("div",{className:"absolute top-1 right-1 z-10 flex flex-col items-center",children:e(v,{variant:"ghost",size:"sm",title:"Preivew Object",onClick:e=>{e.stopPropagation(),i?.(r.id)},children:e(vt,{className:"size-4 "+("ready"===g?"text-muted":"text-white")})})}),u&&"ready"==g?e("img",{src:u,alt:p,className:"w-auto h-48 object-cover rounded-t-xl"}):e("div",{className:"h-48 bg-gray-700 rounded-t-xl flex items-center justify-center text-muted",children:g}),e(Z,{className:"bg-gray-200 h-[2px]"}),t(Q,{className:"p-2 flex flex-col",children:[t("div",{className:"flex flex-col overflow-hidden",children:[e(O,{placement:"top",description:r.properties?.title??r.name,children:e("h3",{className:"text-start font-medium leading-none truncate",children:r.properties?.title??r.name})}),r?.type?.name?e(O,{placement:"bottom",size:"xs",description:r?.type?.name,children:e("p",{className:"text-start text-xs text-muted truncate",children:r?.type?.name})}):e("p",{className:"text-xs text-muted",children:" "})]}),r.score&&t("div",{className:"text-xs text-muted w-full flex justify-end",children:["Score: ",r.score.toFixed(4)??"-"]})]})]})}function Ci(e){return`${e._id} (${e.count})`}function Si(e){return`${e.name} (${e.count})`}function _i({search:t,buckets:n,name:r,placeholder:a,className:s}){const i=t.getFilterValue(r),l=n?.find(e=>JSON.stringify(e._id)===JSON.stringify(i));return e(X,{filterBy:"_id",className:s,isClearable:!0,optionLabel:Ci,options:n,value:l,onChange:e=>{t.setFilterValue(r,e?._id)},by:"_id",placeholder:a})}function ji({search:t,name:n,placeholder:r,className:a}){const[s,i]=c([]);return d(()=>{t.setFilterValue(n,s)},[s]),e(ee,{className:a,value:s,onChange:i,placeholder:r})}function Ii(e){return`${e.name} (${e.count})`}function Pi({search:t,buckets:n,placeholder:r="Filter by Type",className:a}){const[s,i]=c([]),{typeRegistry:l}=Kt(),o=t.getFilterValue("type");d(()=>{if(l){const e=n.map(e=>{let t;return null==e._id?(e._id="Document",t="Document"):(t=l.getTypeName(e._id),t||(console.warn("Content Object Type not found",e._id),t=e._id)),{...e,name:t}});e.sort((e,t)=>e.name.localeCompare(t.name)),i(e)}},[n,l]);const u=s?.find(e=>e._id===o);return e(X,{filterBy:"name",className:a,isClearable:!0,optionLabel:Ii,options:s,value:u,onChange:e=>{t.setFilterValue("type",e?._id)},by:"_id",placeholder:r})}function Ti({buckets:e,name:t,placeholder:n,type:r,multiple:a}){return function({buckets:e,name:t,placeholder:n,type:r="select",multiple:a=!1}){return{name:t,options:e.map(e=>({label:Ci(e),value:e._id})),type:r,multiple:a,placeholder:`${n??`${t.charAt(0).toUpperCase()+t.slice(1)}`}`,allowCreate:!1}}({buckets:e,name:t,placeholder:n,type:r,multiple:a})}function Ai({buckets:n,typeRegistry:r,type:a="select",multiple:s=!1}){const i=new Map;r||console.warn("Type names cannot be resolved"),n.forEach(e=>{let t,n=e._id;null==e._id?(n="Document",t="Document"):(t=r?.getTypeName(e._id),t||(console.warn("Content Object Type not found",e._id),t=e._id)),i.set(n,{name:t,count:e.count})});return{name:"types",placeholder:"Types",type:a,multiple:s,options:n.map(e=>{const t=e._id,n=t||"Document",r=i.get(n);return{value:t,label:r?`${r.name} (${r.count})`:`Unknown (${e.count})`}}),labelRenderer:n=>{const r=i.get(n);return r?t("div",{className:"w-full flex items-center",children:[e("span",{className:"text-sm truncate",children:r.name}),t("span",{className:"ml-2 text-xs",children:["(",r.count,")"]})]}):(console.warn(`Type data not found for ${n}`),n)},filterBy:(e,t)=>{const n=i.get(e);return n?n.name.toLowerCase().includes(t.toLowerCase()):(console.warn(`Type name not found for ${e}`),!1)}}}const zi={},Fi={};function Ei(e){const{client:t}=Kt();return L(()=>{let n=zi[e];return n||(n=t.users.retrieve(e).then(e=>e),zi[e]=n),n},[e])}function Di(e){const{client:t}=Kt();return L(()=>{let n=Fi[e];return n||(n=t.iam.groups.retrieve(e).then(e=>e),Fi[e]=n),n},[e])}function $i(){return e("div",{className:"size-8"})}function Ri({showTitle:n=!1,size:r="md"}){return e(Wi,{title:"System User",description:"The system user is used to initialize built-in objects.",children:t("div",{className:"flex gap-2 items-center",children:[e(te,{src:"/icon.svg",size:r}),n&&e("div",{className:"text-sm font-semibold pl-2",children:"System User"})]})})}function Oi({accountId:r,showTitle:a=!1,size:s="md"}){const i=t(n,{children:[e("div",{children:"This user is used by robots like workflow workers."}),t("div",{className:"text-gray-800 dark:text-gray-500 text-sm",children:[e("span",{className:"font-semibold",children:"ID:"})," ",r]})]});return e(Wi,{title:"Service Account",description:i,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(te,{src:"/cloud.svg",name:"SA",color:"bg-amber-500",className:"px-[5px] text-white",size:s}),a&&t("div",{className:"text-sm font-semibold pl-2 truncate",children:["Service Account : ",r]})]})})}function Li({title:t="Error",error:n,showTitle:r=!1,size:a="md"}){return e(Mi,{title:t,message:"string"==typeof n?n:n.message,color:"bg-red-500",showTitle:r,size:a})}function Ui({userRef:t,showTitle:n=!1,size:r="md"}){if(!t)return e(Mi,{title:"Unknown User",message:"User information is not available.",showTitle:n,size:r});const[a,s]=t?t.split(":"):["unknown"];switch(a){case sn.User:return e(qi,{userId:s,showTitle:n,size:r});case sn.Group:return e(Vi,{userId:s,showTitle:n,size:r});case"system":return e(Ri,{showTitle:n,size:r});case sn.ServiceAccount:case sn.Agent:return e(Oi,{accountId:s,showTitle:n,size:r});case sn.ApiKey:return e(Bi,{keyId:s,size:r,showTitle:n});default:return e(Li,{title:"Unknown User",error:`Invalid user ref type: ${a}`,showTitle:n,size:r})}}function Mi({title:n,message:r,color:a,size:s="md",showTitle:i=!1}){return e(Wi,{title:n,description:r,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(te,{color:a,size:s}),i&&e("div",{className:"text-sm font-semibold pl-1",children:n})]})})}function Vi({userId:n,showTitle:r=!1,size:a="md"}){const{data:s,error:i}=Di(n);if(i)return e(Li,{title:"Failed to fetch group",error:i,showTitle:r,size:a});if(!s)return e($i,{});const l=t("div",{className:"space-y-1",children:[s.description&&e("div",{className:"text-sm",children:s.description}),t("div",{className:"text-xs text-muted-foreground",children:["Group ID: ",s.id]}),s.tags&&s.tags.length>0&&e("div",{className:"flex flex-wrap gap-1",children:s.tags.map(t=>e("span",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:t},t))})]});return e(Wi,{title:s.name||"Unnamed Group",description:l,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(xt,{className:"size-6 text-indigo-500",size:a}),r&&e("div",{className:"text-sm font-semibold pl-2",children:s.name||"Unnamed Group"})]})})}function qi({userId:n,showTitle:r=!1,size:a="md"}){const{data:s,error:i}=Ei(n);if(i)return e(Li,{title:"Failed to fetch user",error:i,showTitle:r,size:a});if(!s)return e($i,{});const l=e("div",{className:"truncate",title:s.email,children:s.email});return e(Wi,{title:s.name||s.email||s.username||"unknown",description:l,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(te,{src:s.picture,name:s.name,color:"bg-indigo-500",size:a}),r&&e("div",{className:"text-sm font-semibold pl-2",children:s.name||s.email||s.username||"unknown"})]})})}function Bi({keyId:n,showTitle:r=!1,size:a="md"}){const{client:s}=Kt(),{data:i,error:l}=L(()=>s.apikeys.retrieve(n),[]);if(l)return e(Li,{title:"Failed to fetch the apikey",error:l,showTitle:r,size:a});if(!i)return e($i,{});const o=e(te,{name:"PK",color:"bg-pink-500",size:a}),c=t(ne,{className:"dark:bg-gray-800 dark:text-gray-200 table-fixed w-full",children:[t("tr",{children:[e("td",{className:"font-semibold w-20",children:"Key:"}),e("td",{className:"truncate max-w-0",children:i?.name})]}),t("tr",{children:[e("td",{className:"font-semibold w-20",children:"Account:"}),e("td",{className:"truncate max-w-0",children:i?.account})]}),t("tr",{children:[e("td",{className:"font-semibold w-20",children:"Project:"}),e("td",{className:"truncate max-w-0",children:i?.project.name})]})]});return e(Wi,{title:"Private Key",description:c,children:t("div",{className:"flex flex-row items-center gap-2",children:[o,r&&e("div",{className:"text-sm font-semibold",children:i?.name||i?.account||i?.project.name||"unknown"})]})})}function Wi({title:n,description:r,children:a}){return t(w,{hover:!0,children:[e(N,{className:"cursor-pointer flex items-center inline-block",children:e("div",{children:a})}),e(k,{align:"center",sideOffset:8,side:"right",children:t("div",{className:"flex flex-col gap-1 rounded-md shadow-md p-2",children:[e("div",{className:"text-md font-semibold",children:n}),r]})})]})}function Ki({buckets:n,name:r,placeholder:a}){return function({buckets:n,name:r,placeholder:a}){const s=n.map(e=>({value:e._id,label:`(${e.count})`}));return{name:r,placeholder:a||`${r.charAt(0).toUpperCase()+r.slice(1)}`,options:s,labelRenderer:r=>{if("Unknown User"===r||!r){const e=n.find(e=>e._id===r);return`Unknown User (${e?.count||0})`}const a=n.find(e=>e._id===r);return t("div",{className:"flex items-center w-full gap-2",children:[e("div",{className:"flex-1 min-w-0 flex items-center truncate",children:e(Ui,{userRef:r,showTitle:!0,size:"sm"})}),t("span",{className:"text-muted-foreground flex-shrink-0",children:["(",a?.count||0,")"]})]})}}}({buckets:n,name:r,placeholder:a})}function Hi({search:t,buckets:n,placeholder:r="All Environments",className:a}){const{client:s}=Kt(),[i,l]=c([]),o=t.getFilterValue("environment");d(()=>{if(s){const e=n.map(async e=>{let t;return await s.environments.retrieve(e._id).then(e=>{t=e.name}).catch(()=>{t=`${e._id} (deleted)`}),t||(t=e._id),{...e,name:t}});Promise.all(e).then(e=>{e.sort((e,t)=>e.name.localeCompare(t.name)),l(e)})}},[n,s]);const u=i?.find(e=>e._id===o);return e(X,{filterBy:"name",className:a,isClearable:!0,optionLabel:Si,options:i,value:u,onChange:e=>{t.setFilterValue("environment",e?._id)},by:"_id",placeholder:r})}function Gi(n){const r=[];if(r.push({name:"run_ids",placeholder:"Run ID",type:"text",multiple:!1}),n.interactions){const a=function({buckets:n,name:r,placeholder:a}){return{name:r,placeholder:a,options:n.map(e=>({label:`(${e.count})`,value:e._id})),type:"select",labelRenderer:r=>{const a=n.find(e=>e._id===r),s=a?.name||r;let i="success";if(a?.status)switch(a.status){case ln.published:i="success";break;case ln.archived:i="destructive";break;default:i="attention"}const l=a?.version&&a?.status?`v${a.version} ${a.status}`:a?.status||(a?.version?`v${a.version}`:"");return t("div",{className:"w-full flex items-center justify-between",children:[t("div",{className:"flex flex-row flex-wrap items-center gap-2 min-w-0 flex-1",children:[e("span",{className:"text-sm truncate",children:s}),l&&e(x,{variant:i,className:"text-xs w-fit",children:l})]}),t("span",{className:"ml-2 text-xs shrink-0",children:["(",a?.count||0,")"]})]})},filterBy:(e,t)=>{const r=n.find(t=>t._id===e);return(r?.name||e).toLowerCase().includes(t.toLowerCase())}}}({buckets:n.interactions||[],name:"interaction",placeholder:"Interactions"});r.push(a)}if(n.environments){const a=function({buckets:n,name:r}){const a=n.map(e=>({label:`(${e.count})`,value:e._id}));return{name:"environment",placeholder:r.charAt(0).toUpperCase()+r.slice(1),options:a,type:"select",labelRenderer:r=>{const a=n.find(e=>e._id===r);return t("div",{className:"w-full flex items-center",children:[e("span",{className:"text-sm truncate",children:a?.name||r}),t("span",{className:"ml-2 text-xs",children:["(",a?.count||0,")"]})]})},filterBy:(e,t)=>{const r=n.find(t=>t._id===e);return(r?.name||e).toLowerCase().includes(t.toLowerCase())}}}({buckets:n.environments||[],name:"environments"});r.push(a)}if(r.push({name:"tags",placeholder:"Tags",type:"stringList",multiple:!0}),n.models){const e=Ti({buckets:n.models||[],name:"model"});r.push(e)}if(n.statuses){const e=Ti({buckets:n.statuses||[],name:"status"});r.push(e)}if(n.finish_reason){const e=Ti({buckets:n.finish_reason.map(e=>({...e,_id:null===e._id?"none":e._id})),name:"finish_reason",placeholder:"Finish Reason"});r.push(e)}if(n.created_by){const e=Ki({buckets:n.created_by||[],name:"created_by",placeholder:"Created By"});r.push(e)}r.push({name:"start",placeholder:"Date After",type:"date",multiple:!1});r.push({name:"end",placeholder:"Date Before",type:"date",multiple:!1});return r.push({name:"workflow_run_ids",placeholder:"Workflow Run ID",type:"text",multiple:!1}),r}function Ji(e){return t=>{0!==t.length?(e.clearFilters(!1,!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;r="stringList"===t.type?t.value.map(e=>"string"==typeof e?e:e.value):t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,"run_ids"!==n&&"workflow_run_ids"!==n||Array.isArray(r)||(r=[r]),e.query[n]=r}}),e.search()):e.clearFilters(!0,!1)}}function Yi({facets:n,search:r}){const[a,s]=c([]),i=Gi(n),l=Ji(r);return t(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:[t("div",{className:"flex justify-between mb-1",children:[e(ae,{}),e(v,{onClick:()=>{r.search()},variant:"outline",title:"Refresh",children:e(wt,{className:"size-5"})})]}),t("div",{className:"flex gap-2 items-center",children:[e(se,{}),e(ie,{})]})]})}function Zi(e){const t=[];if(t.push({placeholder:"Workflow or Run ID",name:"name",type:"text",options:[]}),e.status){const n=Ti({buckets:e.status||[],name:"status",placeholder:"Status"});t.push(n)}if(e.initiated_by){const n=Ki({buckets:e.initiated_by||[],name:"initiated_by",placeholder:"Initiated By"});t.push(n)}t.push({name:"start",placeholder:"Date After",type:"date",multiple:!1});t.push({name:"end",placeholder:"Date Before",type:"date",multiple:!1});return t.push({name:"has_reported_errors",placeholder:"Has Reported Errors",type:"select",multiple:!1,options:[{label:"Yes",value:"true"},{label:"No",value:"false"}]}),t}function Qi(e){return t=>{0!==t.length?(e.clearFilters(!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;if(r="stringList"===t.type?t.value.map(e=>"string"==typeof e?e:e.value):t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,"name"===n)e.query.search_term=r,e.query.name=r;else if("has_reported_errors"===n){const t=Array.isArray(r)?r[0]:r;"true"!==t&&"false"!==t||(e.query[n]="true"===t)}else e.query[n]=r}}),e.search()):e.clearFilters()}}function Xi({facets:n,search:r}){const[a,s]=c([]),i=Zi(n),l=Qi(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]})})}function el(e){const{typeRegistry:t}=Kt(),n=[];if(n.push({placeholder:"ID",name:"id",type:"text",options:[]}),n.push({placeholder:"Name",name:"name",type:"text",options:[]}),e.type){const r=Ai({buckets:e.type||[],typeRegistry:t,type:"select",multiple:!0});n.push(r)}if(e.status){const t=Ti({buckets:e.status||[],name:"status",placeholder:"Status",type:"select",multiple:!0});n.push(t)}return e.tags&&n.push({name:"tags",placeholder:"Tags",type:"stringList",options:e.tags.map(e=>({label:e,value:e}))}),n.push({name:"created_at",placeholder:"Created Date",type:"date",multiple:!0,options:[]}),n.push({name:"updated_at",placeholder:"Updated Date",type:"date",multiple:!0,options:[]}),n}function tl(e){return t=>{0!==t.length?(e.clearFilters(!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;if("date"===t.type&&t.multiple){if(Array.isArray(t.value)&&t.value.length>0)if(1===t.value.length){const e="object"==typeof t.value[0]?t.value[0].value:t.value[0];r={gte:e,lte:e}}else if(2===t.value.length){r={gte:"object"==typeof t.value[0]?t.value[0].value:t.value[0],lte:"object"==typeof t.value[1]?t.value[1].value:t.value[1]}}}else if(t.multiple)if(Array.isArray(t.value))r=t.value.map(e=>"object"==typeof e&&e.value?e.value:e);else{r=["object"==typeof t.value&&t.value.value?t.value.value:t.value]}else r=Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value;"name"===n?e.query.name=r:"id"===n?e.query.id=r:e.query[n]=r}}),e.search()):e.clearFilters()}}function nl({facets:n,search:r}){const[a,s]=c([]),i=el(n),l=tl(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]})})}function rl(e){const t=[];t.push({name:"name",placeholder:"Name",type:"text",multiple:!1});t.push({name:"prompt",placeholder:"Prompt Name",type:"text",multiple:!1});t.push({name:"model",placeholder:"Model",type:"text",multiple:!1});return t.push({name:"tags",placeholder:"Tags",type:"stringList",multiple:!0}),t}function al(e){return t=>{0!==t.length?(e.clearFilters(!1,!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;r="stringList"===t.type?t.value.map(e=>"string"==typeof e?e:e.value):t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,e.query[n]=r}}),e.search(!0)):e.clearFilters(!0,!0)}}function sl({facets:n,search:r}){const[a,s]=c([]),i=rl(),l=al(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]})})}function il(e){const t=[];if(t.push({name:"name",placeholder:"Name",type:"text",multiple:!1}),e.role&&e.role.length>0){const n={name:"role",placeholder:"Role",type:"select",options:e.role.map(e=>({label:e._id,value:e._id,count:e.count}))};t.push(n)}return t}function ll(e){return t=>{0!==t.length?(e.clearFilters(!1,!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;r="stringList"===t.type?t.value.map(e=>"string"==typeof e?e:e.value):t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,e.query[n]=r}}),e.search()):e.clearFilters(!0,!1)}}function ol({facets:n,search:r}){const[a,s]=c([]),i=il(n),l=ll(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]})})}function cl(e){const{typeRegistry:t}=Kt(),n=[];if(n.push({name:"name",placeholder:"Name",type:"text",multiple:!1}),t){const e=t.types.map(e=>({label:e.name,value:e.id})),r={name:"types",placeholder:"Type",type:"select",multiple:!0,options:e,filterBy:(t,n)=>{const r=e.find(e=>e.value===t);return r?.label?.toLowerCase().includes(n.toLowerCase())??!1}};n.push(r)}return n}function dl(e){return t=>{0!==t.length?(e.clearFilters(!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;r="stringList"===t.type?t.value.map(e=>"string"==typeof e?e:e.value):t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,e.query[n]=r}}),e.search()):e.clearFilters(!0)}}function ul({facets:n,search:r}){const[a,s]=c([]),i=cl(),l=dl(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]})})}function ml(e){const t=[];if(e.statuses){const n=Ti({buckets:e.statuses||[],name:"status",placeholder:"Status"});t.push(n)}if(e.initiated_by){const n=Ki({buckets:e.initiated_by||[],name:"initiated_by",placeholder:"Initiated By"});t.push(n)}t.push({name:"start",placeholder:"Started After",type:"date",multiple:!1});return t.push({name:"end",placeholder:"Started Before",type:"date",multiple:!1}),t}function pl(e){return t=>{e.clearFilters(!1,!1),t.forEach(t=>{if(t.value&&t.value.length>0){const n=t.name;let r;r=t.multiple?Array.isArray(t.value)?t.value.map(e=>"object"==typeof e&&e.value?e.value:e):["object"==typeof t.value&&t.value.value?t.value.value:t.value]:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]?t.value[0].value:Array.isArray(t.value)&&t.value[0]?t.value[0]:t.value,e.query[n]=r}}),e.search()}}function hl({facets:n,search:r}){const[a,s]=c([]),i=ml(n),l=pl(r);return e(re,{filterGroups:i,filters:a,setFilters:e=>{const t="function"==typeof e?e(a):e;s(t),l(t)},children:t("div",{className:"flex justify-between mb-1",children:[t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{}),e(ie,{})]}),e(v,{onClick:()=>{r.search()},variant:"outline",title:"Refresh",children:e(wt,{className:"size-5"})})]})})}class gl{object;objects;setState;collectionId;singleSelection=!1;constructor(e,t,n,r){this.object=e,this.objects=n,this.setState=r,this.singleSelection=0===Object.keys(this.objects).length,this.collectionId=t}isSingleSelection(){return this.singleSelection}hasSelection(){return void 0!==this.object||0!==this.size()}size(){return Object.keys(this.objects).length}getObjectIds(){return Object.keys(this.objects)}getObjectId(){return this.object?.id}clone(){return new gl(this.object,this.collectionId,this.objects,this.setState)}add(e){this.objects[e.id]=e,this.singleSelection=0===Object.keys(this.objects).length,this.setState(this.clone())}remove(e){delete this.objects[e],this.singleSelection=0===Object.keys(this.objects).length,this.setState(this.clone())}addAll(e){for(const t of e)this.objects[t.id]=t;this.setState(this.clone())}isSelected(e){return void 0!==this.objects[e]}removeAll(){this.objects={},this.singleSelection=!0,this.setState(this.clone())}}const fl=m(void 0);function yl(){const e=p(fl);if(!e)throw new Error("useObjectSelection must be used within a ObjectSelectionProvider");return e}function bl(){return p(fl)}function vl({value:t,collectionId:n,children:r}){const[a,s]=c();return d(()=>{const e=new gl(t,n,{},s);s(e)},[t]),a&&e(fl.Provider,{value:a,children:r})}hn.extend(Rn),hn.extend($n);const xl={string(t,n){let r=[];if(t){const e=t.get("slice");e&&r.push(t=>t.slice(parseInt(e)));const n=t.get("max_length");n&&r.push(e=>e.slice(0,parseInt(n))),t.has("upper")&&r.push(e=>e.toUpperCase()),t.has("lower")&&r.push(e=>e.toLowerCase()),t.has("capitalize")&&r.push(e=>e[0].toUpperCase()+e.substring(1)),t.has("ellipsis")&&r.push(e=>e+"...")}return(t,n)=>{let a;if(t){if(a=String(t),r.length>0)for(const e of r)a=e(a)}else a="";return e("td",{children:a},n)}},fileSize:(t,n)=>(t,n)=>{let r="";if(t){const e=Number(t);if(isNaN(e))r=String(t);else{const t=["Bytes","KB","MB","GB","TB"];if(0===e)r="0 Bytes";else{const n=Math.floor(Math.log(e)/Math.log(1024));r=`${(e/Math.pow(1024,n)).toFixed(2)} ${t[n]}`}}}return e("td",{children:r},n)},number(t,n){let r,a;t&&(r=t.get("currency")||void 0,a=t.get("decimals")||void 0);const s=a?parseInt(a):2;return(t,n)=>{let a=new Intl.NumberFormat("en-US",{style:r?"currency":"decimal",currency:r,maximumFractionDigits:s}).format(t);return e("td",{children:a},n)}},objectId(n,r){let a=[],s=!1;if(n){const e=n.get("slice");e&&(s=!0,a.push(t=>t.slice(parseInt(e))))}return(n,i)=>{const l=a.reduce((e,t)=>t(e),n.id);return t("td",{className:"flex justify-between items-center gap-2",children:[s?"~":"",l,e(v,{variant:"ghost",alt:"Preview Object",onClick:e=>{e.stopPropagation(),r?.(n.id)},children:e(vt,{className:"size-4"})})]},i)}},objectName(t,n){let r="title";return t&&(r=t.get("title")||"title"),(t,n)=>e("td",{children:t.properties?.[r]||t.name||Oa(t.id)},n)},objectLink(n,r){const a=[];return a.push(e=>e.slice(-7)),(n,s)=>{const i=a.reduce((e,t)=>t(e),n.id);return t("td",{className:"flex justify-between items-center gap-2 max-w-48",children:["~",i,e(v,{variant:"ghost",alt:"Preview Object",onClick:e=>{e.stopPropagation(),r?.(n.id)},children:e(vt,{className:"size-4"})})]},s)}},typeLink:(t,n)=>(t,n)=>e("td",{children:t?.name||"n/a"},n),date(t,n){let r="format",a="LLL";if(t){const e=t.get("localized");if(e)a=e;else{const e=t.get("relative");e&&(r=e,a=void 0)}}return(t,n)=>e("td",{children:hn(t)[r](a)},n)}},wl=xl.string();function Nl(e,t){let n=e;if(!n)return;if(!t.length)return n;const r=t.length-1;for(let e=0;e<r;e++)if(n=n[t[e]],!n)return;return n[t[r]]}function kl(e){return e&&"."!==e?e.split("."):[]}class Cl{layout;renderer=wl;path;fallbackPath;previewObject;constructor(e,t){if(this.layout=e,this.path=kl(e.field||""),this.fallbackPath=e.fallback?kl(e.fallback):void 0,this.previewObject=t,e.render)this.renderer=(e,t)=>null;else{const t=e.type||"string",n=t.indexOf("?");if(n>0){const e=t.substring(0,n),r=new URLSearchParams(t.substring(n+1));this.renderer=xl[e](r)}else this.renderer=xl[t]()}}get name(){return this.layout.name}resolveValue(e){let t=Nl(e,this.path);return void 0===t&&this.fallbackPath&&(t=Nl(e,this.fallbackPath)),void 0===t&&(t=this.layout.default),t}render(t,n){if(this.layout.render)return e("td",{className:"whitespace-nowrap px-3 py-4 text-sm",children:this.layout.render(t)},n);const r=this.layout.type||"string",a=r.indexOf("?")>0?r.substring(0,r.indexOf("?")):r;if(("objectId"===a||"objectLink"===a)&&this.previewObject){const e=r.indexOf("?"),s=e>0?new URLSearchParams(r.substring(e+1)):void 0;return xl[a](s,e=>{this.previewObject(t.id)})(t,n)}return this.renderer(this.resolveValue(t),n)}}function Sl({objects:n,selection:r,isLoading:a,columns:s,onRowClick:i,selectedObject:l,toggleAll:o,onSelectionChange:c}){return t(ne,{className:"w-full border-t",children:[e("thead",{children:t("tr",{children:[r&&e("th",{children:e("input",{type:"checkbox",onChange:o})}),s.map(t=>e("th",{children:t.name},t.name))]})}),t(le,{isLoading:a,columns:s.length+1,children:[n?.map(n=>t("tr",{className:"cursor-pointer hover:bg-muted group "+(l?.id===n.id?"bg-muted":""),onClick:()=>{i&&i(n)},children:[r&&e("td",{onClick:e=>e.stopPropagation(),children:e("input",{checked:r.isSelected(n.id),type:"checkbox",className:""+(r.isSelected(n.id)?"":"hidden group-hover:block"),onChange:e=>c(n,e)})}),s.map((e,t)=>e.render(n,t))]},n.id)),0===n.length&&e("tr",{children:e("td",{colSpan:s.length+(r?1:0),className:"text-center",children:"No objects. Just drag and drop documents or images here to create content objects."})})]})]})}function _l({objects:r,selection:a,isLoading:s,onSelectionChange:i,onRowClick:l,previewObject:o,selectedObject:c}){return t(n,{children:[e(Ni,{isLoading:s}),e("div",{className:"w-full gap-2 grid xs:grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-6 @xs:grid-cols-1 @sm:grid-cols-2 @md:grid-cols-3 @lg:grid-cols-4",children:r.map(t=>e(ki,{document:t,selection:a,onSelectionChange:i,onRowClick:l,previewObject:o,selectedObject:c},t.id))})]})}class jl{client;limit;collectionId;facets=new oe({});result=new oe({objects:[],isLoading:!1});facetSpecs=[];query={};constructor(e,t=100){this.client=e,this.limit=t}withFacets(e){return this.facetSpecs=e,this}get objects(){return this.result.value.objects}get error(){return this.result.value.error}get isRunning(){return this.result.value.isLoading}get hasMore(){return this.result.value.hasMore||!1}getFilterValue(e){return this.query[e]}setFilterValue(e,t){this.query[e]=t,this.search()}setDefaultKeys(e){}clearFilters(e=!0){const{parent:t,full_text:n,vector:r,weights:a,score_aggregation:s,dynamic_scaling:i,limit:l,all_revisions:o}=this.query;this.query={parent:t,...void 0!==n&&{full_text:n},...void 0!==r&&{vector:r},...void 0!==a&&{weights:a},...void 0!==s&&{score_aggregation:s},...void 0!==i&&{dynamic_scaling:i},...void 0!==o&&{all_revisions:o},...void 0!==l&&{limit:l}},e&&this.search()}getFacetBuckets(e){return this.facets.value[e]?.buckets||[]}resetFacets(){this.query={}}reset(e=!1){this.result.value={objects:[],isLoading:e,hasMore:!0}}_updateRunningState(e){const t=this.result.value;this.result.value={objects:t.objects,isLoading:e,error:t.error,hasMore:t.hasMore}}_searchRequest(e,t,n,r=!0){const a={limit:t,offset:n,query:e,facets:r?this.facetSpecs:void 0};return this.collectionId?this.client.collections.searchMembers(this.collectionId,a):this.client.objects.search(a)}_facetsRequest(){const e={facets:this.facetSpecs,query:this.query};return this.collectionId?this.client.collections.computeFacets(this.collectionId,e):this.client.objects.computeFacets(e)}computeFacets(e){this._facetsRequest().then(e=>{this.facets.value=e})}_search(e=!1,t=!1){if(this.isRunning&&e)return Promise.resolve(!1);this.result.value={isLoading:!0,objects:e?this.objects:[],hasMore:!e||this.result.value.hasMore};const n=this.limit,r=e?this.objects.length:0;return this._searchRequest(this.query,n,r,!t).then(async r=>{const a=r.results||[],s=r.facets||{};return this.result.value={isLoading:!1,objects:e?this.objects.concat(a):a,hasMore:a.length===n},!t&&s&&Object.keys(s).length>0&&(this.facets.value=s),!0}).catch(e=>{throw this.result.value={error:e,isLoading:!1,objects:this.objects,hasMore:this.result.value.hasMore},e})}search(e=!1){return this.isRunning&&this.objects.length>0?Promise.resolve(!1):this._search(!1,e)}loadMore(e=!1){return this.isRunning||!this.hasMore||this.query.vector?Promise.resolve(!1):(this.objects.length>0&&(e=!0),this._search(!0,e))}}const Il=m(void 0);function Pl(){return p(Il)}function Tl(){return ce(Pl().facets)}function Al(){const e=Pl();return{...ce(e.result),search:e}}function zl(){const e=Pl();return ce(e.facets).total}var Fl;async function El(e){try{const t=await e.arrayBuffer(),n=new On;n.appendByteArray(new Uint8Array(t));const r=n.end();return r?.toString()}catch(e){return void console.error("Error calculating file hash:",e)}}function Dl(){const{client:e}=Kt(),t=b();return{checkDocumentProcessing:async(n,r,a)=>{try{console.log(`Preparing metadata for ${n.length} files...`);const t=await async function(e,t){const n=[];for(let r=0;r<e.length;r+=5){const a=e.slice(r,r+5),s=await Promise.all(a.map(async e=>{let n=t||"/";if(e.webkitRelativePath){const r=e.webkitRelativePath.split("/");if(r.length>1){const e=r.slice(0,-1).join("/");n=t?`${t}/${e}`:e}}return{file:e,hash:await El(e),name:e.name,size:e.size,location:n}}));n.push(...s)}return n}(n,r),s=async()=>{let n;const r={query:{match:{"content.etag":{$in:t.map(e=>e.hash)}}},select:"id content.etag"};n=a?(await e.store.collections.searchMembers(a,r)).results:(await e.store.objects.search(r)).results;for(const e of n){const n=t.find(t=>t.hash===e.content.etag);n&&(n.existingId=e.id,n.action=Fl.SKIP)}},i=async()=>{const n=t.filter(e=>e.action!==Fl.SKIP),r=n.map(e=>e.location),s=Array.from(new Set(r)),i=[];for(const t of s){const r={"content.name":{$in:n.filter(e=>e.location===t).map(e=>e.name)},location:t||"/"};if(a){const t=e.store.collections.searchMembers(a,{query:{match:r},select:"id content.name location"}).then(e=>e.results);i.push(t)}else{const t=e.store.objects.find({query:r,select:"id content.name location"});i.push(t)}}const l=(await Promise.all(i)).flat();console.log(`Found ${l.length} document to update`,l);for(const e of l){const n=t.find(t=>t.name===e.content.name&&(t.location?t.location===e.location:"/"===e.location));n&&(n.existingId=e.id,n.action=Fl.UPDATE)}console.log(`Reconciled ${t.filter(e=>e.action===Fl.UPDATE).length}`)};return await s(),await i(),t.forEach(e=>{e.action||(e.action=Fl.CREATE)}),console.log("Document processing check results:",{totalFiles:n.length,toCreate:t.filter(e=>e.action===Fl.CREATE).length,toUpdate:t.filter(e=>e.action===Fl.UPDATE).length,toSkip:t.filter(e=>e.action===Fl.SKIP).length}),t}catch(e){throw t({title:"Error in file upload processing check",status:"error",description:e.message}),console.log("Error in file upload processing check",e),new Error("Error in file upload processing check: "+e.message)}}}}function $l({isOpen:r,onClose:a,files:s,collectionId:i,selectedFolder:l,title:u="Upload Files",children:m,onUploadComplete:p,hideFileSelection:h=!1,showTypeSelectionOnly:g=!1,allowFolders:f=!0}){const{client:y,typeRegistry:x}=Kt(),w=b(),[N,k]=c([]),[C,S]=c([]),[_,j]=c(!1),[I,P]=c(null),[T,A]=c([]),[z,F]=c(!1),[E,D]=c(!1),[$,R]=c(0),[L,U]=c(Date.now()),[M,V]=c(void 0),[q,W]=c(null),[Y,Z]=c(u),[Q,X]=c("");d(()=>{i&&y.store.collections.retrieve(i).then(V)},[i]),d(()=>{z?(Z("Uploading Files"),X(`${Math.round($)}% complete`)):E?(Z("Upload Complete"),X("")):_?(Z("File Analysis Results"),X(`${N.length} file${1!==N.length?"s":""}`)):N.length>0?(Z(u),X("Checking for duplicates and updates")):(Z(u),X(""))},[z,E,_,u,$,N.length]);const ee=()=>M||l?t(de,{className:"mb-4",status:"default",icon:e(jt,{className:"size-5"}),children:[e("div",{className:"flex items-center",children:e("span",{className:"font-medium",children:"Upload Location:"})}),t("div",{className:"text-sm mt-1",children:[M&&t("div",{className:"flex items-center",children:[e("span",{className:"mr-1",children:"Collection:"}),e("span",{className:"font-medium",children:M.name})]}),l&&t("div",{className:"flex items-center mt-1",children:[e("span",{className:"mr-1",children:"Folder:"}),e("span",{className:"font-medium",children:l})]})]})]}):null,[te,ne]=c({toCreate:0,toUpdate:0,toSkip:0}),{checkDocumentProcessing:re}=Dl(),ae=o(()=>x?.types||[],[x?.types]);d(()=>{r&&(S([]),j(!1),P(null),A([]),F(!1),D(!1),R(0),ne({toCreate:0,toUpdate:0,toSkip:0}),W(null),Z(u),X(""),s&&s.length>0?(k(s),le(s)):k([]),U(Date.now()))},[r,s]);const se=()=>{k([]),S([]),j(!1),P(null),A([]),F(!1),D(!1),R(0),ne({toCreate:0,toUpdate:0,toSkip:0}),W(null),Z(u),X(""),U(Date.now()),a()},ie=e=>{e&&e.length>0&&(k(e),le(e))},le=async e=>{if(e.length)try{console.log(`Processing ${e.length} files to determine required actions...`);const t=await re(e,l,i);S(t);const n=t.filter(e=>e.action===Fl.CREATE).length,r=t.filter(e=>e.action===Fl.UPDATE).length,a=t.filter(e=>e.action===Fl.SKIP).length;ne({toCreate:n,toUpdate:r,toSkip:a}),w({title:"Files analyzed",description:`${e.length} file(s): ${n} new, ${r} to update, ${a} to skip`,status:"info",duration:4e3}),j(!0)}catch(e){console.error("Error processing files:",e),w({title:"Error",description:"There was an error analyzing the files",status:"error",duration:5e3})}},oe=async()=>{if(!C.length)return;const e=I?.id||null,t=C.map(e=>({file:e.file,status:"pending",progress:0,action:e.action===Fl.CREATE?"create":e.action===Fl.UPDATE?"update":"skip"}));A(t),F(!0),D(!1);const n=C.filter(e=>e.action===Fl.SKIP),r=C.filter(e=>e.action===Fl.UPDATE),a=C.filter(e=>e.action===Fl.CREATE),s={success:!0,objectIds:[],uploadedFiles:[],skippedFiles:[],failedFiles:[]};for(const t of n)t.existingId&&(s.objectIds.push(t.existingId),s.skippedFiles.push({id:t.existingId,name:t.name,type:e,status:"skipped",location:t.location}),A(e=>e.map(e=>e.file===t.file?{...e,status:"success",progress:100,id:t.existingId}:e)));const l=async(t,n)=>{const r=[];for(let e=0;e<t.length;e+=50)r.push(t.slice(e,e+50));for(let a=0;a<r.length;a++){const l=r[a];if(console.log(`Processing ${n} batch ${a+1}/${r.length} (${l.length} files)`),t.length>50){w({title:`Processing files (${n})`,description:`Processed ${50*a}/${t.length} files...`,status:"info",duration:2e3})}let o=0;await Promise.all(l.map(async t=>{try{if(A(e=>e.map(e=>e.file===t.file?{...e,status:"uploading",progress:20}:e)),"update"===n&&t.existingId)await y.store.objects.update(t.existingId,{type:e||void 0,content:t.file,location:t.location,name:t.name},{createRevision:!0,revisionLabel:"upload on "+(new Date).toISOString()}),A(e=>e.map(e=>e.file===t.file?{...e,status:"success",progress:100,id:t.existingId}:e)),s.objectIds.push(t.existingId),s.uploadedFiles.push({id:t.existingId,name:t.name,type:e,status:"updated",location:t.location});else{const n=await y.store.objects.create({type:e||void 0,content:t.file,location:t.location||t.file.webkitRelativePath||t.name},{collection_id:i});A(e=>e.map(e=>e.file===t.file?{...e,status:"success",progress:100,id:n.id}:e)),s.objectIds.push(n.id),s.uploadedFiles.push({id:n.id,name:t.name,type:e,status:"created",location:t.location})}}catch(n){console.error(`Failed to process file ${t.name}:`,n),A(e=>e.map(e=>e.file===t.file?{...e,status:"error",progress:100,message:n.message||"Unknown error"}:e)),s.failedFiles.push({name:t.name,error:n.message||"Unknown error",status:"failed",location:t.location,type:e}),s.success=!1}o++,o%5!=0&&o!==l.length||A(e=>{const t=e.filter(e=>"success"===e.status||"error"===e.status).length,n=e.length,r=n>0?Math.round(t/n*100):0;return R(r),e})}))}};r.length>0&&await l(r,"update"),a.length>0&&await l(a,"create"),A(e=>{const t=e.filter(e=>"pending"===e.status).map(e=>({...e,status:"error",progress:100,message:"Upload process interrupted"}));return t.length>0?(t.forEach(e=>{s.failedFiles.push({name:e.file.name,error:"Upload process interrupted",status:"failed",type:I?.id||null})}),s.success=!1,e.map(e=>"pending"===e.status?{...e,status:"error",progress:100,message:"Upload process interrupted"}:e)):e}),F(!1),D(!0);const o=s.uploadedFiles.filter(e=>"created"===e.status).length,c=s.uploadedFiles.filter(e=>"updated"===e.status).length,d=s.skippedFiles.length,u=s.failedFiles.length;let m="";o>0&&(m+=`${o} file${1!==o?"s":""} uploaded`),c>0&&(m+=m?", ":"",m+=`${c} file${1!==c?"s":""} updated`),d>0&&(m+=m?", ":"",m+=`${d} file${1!==d?"s":""} skipped`),u>0&&(m+=m?", ":"",m+=`${u} file${1!==u?"s":""} failed`),w({title:"Upload Complete",description:m,status:u>0?"warning":"success",duration:5e3}),W(s)},ce=()=>t("div",{className:"mb-4",children:[t("label",{className:"block text-sm font-medium mb-2",children:["Content Type ",e("span",{className:"text-muted font-normal",children:"(Optional)"}),e(O,{description:"Select a content type to apply to the uploaded files. If left empty, Vertesia will automatically detect the type based on file content.",placement:"top",size:"xs",children:e(Ze,{className:"size-3 ml-2"})})]}),e(ue,{options:ae,value:I,optionLabel:e=>e?e.name:"Select a content type",placeholder:"Select a content type or leave empty for automatic detection",onChange:e=>P(void 0===e?null:e),filterBy:"name",isClearable:!0}),I?e(n,{}):e("div",{className:"p-2 rounded-md",children:t("div",{className:"flex items-center text-attention",children:[e(kt,{className:"size-4 mr-1"}),"Automatic Type Detection",e(O,{description:"Vertesia will analyze the content and select the most appropriate type. This is recommended for most uploads and ensures optimal processing.",placement:"top",size:"xs",children:e(Ze,{className:"size-3 ml-2"})})]})})]});return t(K,{isOpen:r,onClose:se,className:"mx-auto",disableCloseOnClickOutside:!0,children:[e(H,{description:Q,children:Y}),g?t(G,{children:[m,ee(),ce()]}):0!==N.length||h?z||E?z?t(G,{children:[ee(),e("div",{className:"mb-4",children:e("div",{className:"h-2 bg-muted/20 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-primary rounded-full",style:{width:`${$}%`}})})}),e("div",{className:"max-h-96 overflow-y-auto",children:T.map((n,r)=>t("div",{className:"flex items-center py-2 border-b border-border last:border-b-0",children:[t("div",{className:"mr-3",children:["pending"===n.status&&e(St,{className:"size-5 text-muted"}),"uploading"===n.status&&e(B,{size:"sm"}),"success"===n.status&&e(kt,{className:"size-5 text-success"}),"error"===n.status&&e(_t,{className:"size-5 text-destructive"})]}),t("div",{className:"flex-1 min-w-0",children:[e("div",{className:"truncate font-medium",children:n.file.name}),t("div",{className:"text-xs text-muted",children:["pending"===n.status&&"Waiting...","uploading"===n.status&&"Uploading...","success"===n.status&&("create"===n.action?"Created":"update"===n.action?"Updated":"Skipped"),"error"===n.status&&n.message]})]})]},`${n.file.name}-${r}`))})]}):e(G,{children:t("div",{className:"mb-4",children:[ee(),e(Sn,{files:T.map(e=>{let t;return t="success"===e.status?"create"===e.action?"success":"update"===e.action?"updated":"skipped":"failed",{name:e.file.name,status:t,error:"error"===e.status?e.message:void 0}}),location:l||void 0,collection:M?.name})]})}):e(G,{children:_?t(n,{children:[ee(),e("div",{className:"mb-4",children:e("div",{className:"p-4 rounded-md mb-4",children:t("div",{className:"grid grid-cols-3 gap-4",children:[t("div",{className:"flex flex-col items-center",children:[t("div",{className:"flex items-center gap-2",children:[e(Nt,{className:"size-5 text-primary"}),e("span",{className:"font-medium",children:"New"})]}),e("div",{className:"text-2xl font-semibold",children:te.toCreate})]}),t("div",{className:"flex flex-col items-center",children:[t("div",{className:"flex items-center gap-2",children:[e(kt,{className:"size-5 text-success"}),e("span",{className:"font-medium",children:"Update"})]}),e("div",{className:"text-2xl font-semibold",children:te.toUpdate})]}),t("div",{className:"flex flex-col items-center",children:[t("div",{className:"flex items-center gap-2",children:[e(Ct,{className:"size-5 text-mixer-attention/40"}),e("span",{className:"font-medium",children:"Skip"})]}),e("div",{className:"text-2xl font-semibold",children:te.toSkip})]})]})})}),ce(),e(de,{className:"mb-4",status:"info",children:te.toCreate+te.toUpdate>0?t("div",{className:"space-y-1",children:[t("p",{children:[te.toCreate+te.toUpdate," file",te.toCreate+te.toUpdate>1?"s are":" is"," ready to process"]}),e("p",{children:te.toSkip>0&&`${te.toSkip} file${te.toSkip>1?"s are":" is"} already in the system and will be skipped.`})]}):te.toSkip>0?t("span",{children:["All ",te.toSkip," file(s) already exist in the system and will be skipped. You can proceed to view the results."]}):e("span",{children:"No files to process."})})]}):t("div",{className:"flex flex-col items-center justify-center py-4",children:[e(B,{size:"lg",className:"mb-4"}),e("div",{className:"text-lg font-medium",children:"Analyzing files..."})]})}):t(G,{className:"flex flex-col items-center justify-center p-8",children:[ee(),e(Cn,{onDrop:ie,message:"Drag and drop files here or click to select",buttonLabel:"Select Files",className:"w-full h-64",allowFolders:f}),m]}),(()=>{if(g)return t(J,{children:[e(v,{variant:"ghost",onClick:se,children:"Cancel"}),e(v,{onClick:()=>{p&&p({success:!0,objectIds:[],uploadedFiles:[{name:"type-selection",type:I?.id||null,status:"created"}],skippedFiles:[],failedFiles:[]}),se()},children:I?`Use ${I.name}`:"Use Automatic Type Detection"})]});if(0===N.length&&!h)return e(J,{children:e(v,{variant:"ghost",onClick:se,children:"Cancel"})});if(!z&&!E){const n=_;return t(J,{children:[e(v,{variant:"ghost",onClick:se,children:"Cancel"}),e(v,{disabled:!n,onClick:oe,children:te.toCreate+te.toUpdate>0?"Upload":"Continue"})]})}return z?e(J,{children:e(v,{variant:"ghost",disabled:!0,children:"Uploading..."})}):t(J,{children:[e(v,{variant:"ghost",onClick:()=>{k([]),S([]),j(!1),P(null),A([]),F(!1),D(!1),R(0),ne({toCreate:0,toUpdate:0,toSkip:0})},children:"Upload More"}),e(v,{onClick:()=>{p&&q&&p(q),se()},children:"Close"})]})})()]},L)}function Rl(e){const t="function"==typeof e?e:e.onUploadDone,{client:n,project:r,store:a}=Kt(),s=Pl(),i=b(),{checkDocumentProcessing:l}=Dl();return async(e,o,c)=>{const d={success:!1,objectIds:[],uploadedFiles:[],skippedFiles:[],failedFiles:[]};if(!r)return i({status:"error",title:"No project selected",duration:3e3}),d;if(!e||0===e.length)return i({status:"warning",title:"No files selected",duration:3e3}),d;const u=Array.from(e).filter(e=>e.size>0);if(0===u.length)return i({status:"error",title:"No valid files selected",description:"Please select files with valid content.",duration:5e3}),d;const m=[],p=[],h=[];console.log(`Processing ${u.length} files with smart file processing...`);const g=await l(u,null,c),f=g.filter(e=>e.action===Fl.CREATE).length,y=g.filter(e=>e.action===Fl.UPDATE).length,b=g.filter(e=>e.action===Fl.SKIP).length;i({title:"Files analyzed",description:`${u.length} file(s): ${f} new, ${y} to update, ${b} to skip`,status:"info",duration:4e3});for(const e of g.filter(e=>e.action===Fl.SKIP&&e.existingId))m.push({id:e.existingId,name:e.name,type:o,status:"skipped",location:e.location});const v=g.filter(e=>(e.action===Fl.CREATE||e.action===Fl.UPDATE)&&e.file);if(v.length>0){console.log(`Processing ${v.length} files (${v.filter(e=>e.action===Fl.CREATE).length} create, ${v.filter(e=>e.action===Fl.UPDATE).length} update)...`);const e=50,t=[];for(let n=0;n<v.length;n+=e)t.push(v.slice(n,n+e));for(let r=0;r<t.length;r++){const s=t[r],l=r*e;console.log(`Processing batch ${r+1}/${t.length} (${s.length} files)`),v.length>e&&i({title:"Processing files",description:`Processed ${l}/${v.length} files...`,status:"info",duration:2e3});const u=await Promise.all(s.map(async e=>{try{if(e.action===Fl.UPDATE&&e.existingId){const t=await n.store.objects.update(e.existingId,{type:o||void 0,content:e.file,location:e.location,name:e.name},{createRevision:!0,revisionLabel:"upload on "+(new Date).toISOString()});return p.push({id:e.existingId,name:e.name,type:o,status:"updated",location:e.location}),d.objectIds.push(e.existingId),{success:!0,id:t.id,name:e.name,action:"update"}}{const t=c?{collection_id:c}:void 0,n=await a.objects.create({type:o||void 0,content:e.file,location:e.location||e.file.webkitRelativePath||e.name},t);p.push({id:n.id,name:e.name,type:o,status:"created",location:e.location})}}catch(t){console.error(`Failed to process file ${e.name}:`,t),h.push({name:e.name,error:t.message||"Unknown error",status:"failed",location:e.location,type:o}),i({status:"error",title:`Processing failed for ${e.name}`,description:t.message,duration:4e3})}})),m=p.filter(e=>"created"===e.status),g=p.filter(e=>"updated"===e.status),f=p.filter(e=>"failed"===e.status);console.log(`Batch ${r+1} results:`,{creates:m,updates:g,failures:f,total:u.length})}}const x=p.filter(e=>"created"===e.status).length,w=p.filter(e=>"updated"===e.status).length,N=p.filter(e=>"failed"===e.status).length,k=p.filter(e=>"skipped"===e.status).length;t&&(console.log("Upload complete:",{totalObjectIds:d.objectIds.length,uploadedFiles:x,updatedFiles:w,skippedFiles:k,failedFiles:N}),await t(d.objectIds));let C="";return x>0&&(C+=`${x} file${1!==x?"s":""} uploaded`),w>0&&(C+=C?", ":"",C+=`${w} file${1!==w?"s":""} updated`),k>0&&(C+=C?", ":"",C+=`${k} file${1!==k?"s":""} skipped (already existed)`),N>0&&(C+=C?", ":"",C+=`${N} file${1!==N?"s":""} failed`),C&&i({status:N>0?"warning":"success",title:C,duration:4e3}),s.search(),d}}!function(e){e.CREATE="create",e.SKIP="skip",e.UPDATE="update"}(Fl||(Fl={}));const Ol=[{name:"ID",field:"id",type:"objectId?slice=-7"},{name:"Name",field:".",type:"objectName"},{name:"Type",field:"type.name",type:"string"},{name:"Status",field:"status",type:"string"},{name:"Updated At",field:"updated_at",type:"date"}];function Ll({isGridView:t=!1,onUpload:n,collectionId:r,...a}){return n?e(Ul,{...a,onUpload:n,isGridView:t,collectionId:r}):e(Ml,{...a,isGridView:t})}function Ul({isGridView:n,onUpload:a,collectionId:s,skipTypeModal:i=!1,...l}){const[o,d]=c(!1),[u,m]=c([]),[p,h]=c(!1),[g,f]=c(null),[y,v]=c(!1),x=Pl(),w=b(),{checkDocumentProcessing:N}=Dl(),k=async(e,t)=>{console.log("Files dropped on ObjectTable:",e.length,t),d(!0);try{if(s){const t=await N(e,null,s);f(t);const n=t.filter(e=>"create"===e.action).length,r=t.filter(e=>"update"===e.action).length,a=t.filter(e=>"skip"===e.action).length;w({title:"Files ready to process",description:`${e.length} file(s): ${n} new, ${r} to update, ${a} to skip`,status:"info",duration:4e3})}else f(null)}catch(e){console.error("Error processing files:",e),w({title:"Error processing files",description:"There was an error checking for duplicate files",status:"error",duration:4e3}),f(null)}finally{if(d(!1),m(e),h(!1),i){console.log("Skipping type modal and calling onUpload directly",{filesLength:e.length,processedFilesLength:g?.length});const t=a(e,null,s);t&&"object"==typeof t&&(t.processedFiles=g)}else console.log("Setting typeSelectionOpen to true",{filesLength:e.length}),v(!0)}},C=e=>{const t=[...u];m([]),f(null),v(!1),t.length>0&&void 0!==e&&(d(!0),console.log("Starting upload with",{typeId:e,filesCount:t.length,hasProcessingResults:!!g,collectionId:s}),a(t,e,s).finally(()=>{d(!1),x.search()}))},S=e=>{e.preventDefault(),e.stopPropagation(),h(!0)};return t("div",{className:"min-h-[400px] relative",onDragOver:S,onDragEnter:S,onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),h(!1),e.dataTransfer.items){const t=[];for(let n=0;n<e.dataTransfer.items.length;n++){const r=e.dataTransfer.items[n];if("file"===r.kind){const e=r.getAsFile();e&&t.push(e)}}if(t.length>0){const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};k(t,e)}}},children:[e("div",{className:r("bg-white dark:bg-gray-800 opacity-40 absolute inset-0 z-50 flex justify-center items-center",o?"block":"hidden"),children:e(B,{size:"xl"})}),e(Ml,{...l,isGridView:n}),e("div",{className:r("absolute inset-0 pointer-events-none",p?"z-40":"-z-10"),children:e("div",{className:"w-full h-full relative",children:e(Cn,{onDrop:k,message:"Drop files or folders here to upload",className:r("absolute inset-0 bg-white/90 dark:bg-gray-800/90 pointer-events-auto",p?"flex":"hidden"),buttonLabel:"Select Files or Folders",allowFolders:!0})})}),e($l,{isOpen:y&&u.length>0,onClose:()=>{m([]),f(null),v(!1),C(void 0)},files:u,collectionId:s,selectedFolder:null,title:"Upload Files",onUploadComplete:e=>{if(e){if(e.failedFiles&&e.failedFiles.length>0&&w({title:"Upload Issues",description:`${e.failedFiles.length} file(s) failed to upload`,status:"warning",duration:5e3}),e.success){const t=e.uploadedFiles.filter(e=>"created"===e.status).length,n=e.uploadedFiles.filter(e=>"updated"===e.status).length,r=e.skippedFiles.length;(t>0||n>0)&&w({title:"Upload Complete",description:`${t>0?`${t} created`:""}${t>0&&n>0?", ":""}${n>0?`${n} updated`:""}${r>0?`, ${r} skipped`:""}`,status:"success",duration:5e3})}x.search()}m([]),f(null),v(!1),e&&e.success&&e.objectIds.length>0?C(null):C(void 0)}})]})}function Ml({objects:t,layout:n=Ol,isLoading:r,onRowClick:a,onSelectionChange:s,previewObject:i,selectedObject:l,isGridView:c}){const d=bl(),u=(e,n)=>{if(d){const r=n.nativeEvent.shiftKey;if(n.target.checked){if(d.add(e),r){const n=t.findIndex(t=>t.id===e.id),r=function(e,t,n){for(let r=t-1;r>=0;r--)if(n.isSelected(e[r].id))return r;return-1}(t,n,d);if(r>-1&&r<n-1){const e=[];for(let a=r+1;a<n;a++)e.push(t[a]);d.addAll(e)}else{const e=function(e,t,n){const r=e.length;for(let a=t+1;a<r;a++)if(n.isSelected(e[a].id))return a;return-1}(t,n,d);if(e>-1&&e>n+1){const r=[];for(let a=n+1;a<e;a++)r.push(t[a]);d.addAll(r)}}}}else d.remove(e.id);s&&s(d)}},m=e=>{if(d){e.target.checked?d.addAll(t):d.removeAll()}},p=o(()=>(n.length>0?n:Ol).map(e=>new Cl(e,i)),[n,i]);return e(c?_l:Sl,{objects:t,isLoading:r,columns:p,onRowClick:a,previewObject:i,selectedObject:l,selection:d,toggleAll:m,onSelectionChange:u})}function Vl({children:t,limit:n,parent:r,typeId:a,facets:s,name:i,collectionId:l}){const{store:c}=Kt(),d=o(()=>{let e;s?e=s:(e=[{name:"status",field:"status"},{name:"location",field:"location"}],a||e.unshift({name:"type",field:"type"}));const t=new jl(c,n).withFacets(e);return t.collectionId=l,t.query.type=a,t.query.parent=r,t.query.name=i,t},[a,n,l]);return e(Il.Provider,{value:d,children:t})}const ql=[{name:"Name",field:"properties.title",type:"string",fallback:"name"},{name:"Type",field:"type.name",type:"string"},{name:"Status",field:"status",type:"string"},{name:"Created At",field:"created_at",type:"date"}];function Bl({onChange:t}){return e(Vl,{children:e(Wl,{onRowClick:e=>{t(e||void 0)}})})}function Wl({onRowClick:n}){const[r,s]=c(!1),[i,l]=c("grid"===localStorage.getItem("vertesia.content_store.lastDisplayedView")),{search:o,isLoading:m,error:p,objects:h,hasMore:g}=Al(),f=u(null);me(f,()=>{r&&g&&!m&&(s(!1),o.loadMore(!0).finally(()=>{s(!0)}))},{threshold:.1,deps:[r,g,m]}),d(()=>{o.search().finally(()=>{s(!0)})},[]);const y=Tl(),b=Pl();return p?e(U,{title:"Search failed",children:p.message}):t("div",{className:"flex flex-col gap-2 h-full w-full",children:[t("div",{className:"flex justify-between items-center flex-shrink-0",children:[e(nl,{facets:y,search:b}),t("div",{className:"flex items-center gap-2",children:[e(v,{variant:"outline",onClick:()=>{s(!1),o.search().then(()=>s(!0))},alt:"Refresh",children:e(wt,{size:16})}),e(Ra,{onUpdate:l})]})]}),t("div",{className:"@container flex-1 overflow-y-auto",children:[e(Ll,{objects:h||[],isLoading:!1,layout:ql,onRowClick:n,isGridView:i}),e("div",{ref:f,className:"h-4 w-full"}),e("div",{className:a("bg-white dark:bg-gray-800 opacity-80 absolute inset-0 z-50 flex justify-center items-center rounded",m?"block":"hidden"),children:e(B,{size:"xl"})})]})]})}function Kl({isOpen:n,onClose:r}){return t(K,{onClose:()=>r(),isOpen:!!n,className:"min-w-[60vw]",children:[e(H,{children:"Select Content"}),e(G,{className:"pt-0 overflow-y-auto max-h-[80vh] min-h-[80vh]",children:n&&e(Bl,{onChange:r})})]})}const Hl=/store:([a-f0-9]+)/;function Gl({object:n}){const{client:a}=Kt(),{off:s,on:i,isOn:l}=pe(),[o,u]=c(null!=n.value?String(n.value):""),[m,p]=c(void 0),h=()=>{u(""),n.value="",p(void 0)};return d(()=>{if(!o||m)return;const e=o.match(Hl);e&&a.objects.get(e[1]).then(e=>{p(e)}).catch(()=>{h()})},[o]),t("div",{children:[t("div",{className:"relative",children:[e("input",{value:o,onChange:e=>{const t=e.target.value;u(t),n.value=t},className:r(he.INPUT,"pr-10 w-full")}),m&&e("div",{className:"absolute inset-y-0 right-10 flex items-center justify-center ",children:e(v,{onClick:h,variant:"unstyled",className:"hover:text-red-500 hover:bg-gray-100 dark:hover:bg-gray-600",children:e(Re,{className:"size-5"})})}),e("div",{className:"absolute inset-y-0 right-0 flex items-center justify-center",children:e(v,{onClick:i,variant:"unstyled",className:"hover:bg-gray-100 dark:hover:bg-gray-600",children:e(It,{className:"size-5"})})}),e(Kl,{value:o,isOpen:l,onClose:e=>{if(e){const t="store:"+e.id;u(t),p(e||void 0),n.value=t}s()}})]}),m&&e("div",{className:"p-1 semibold text-sm text-gray-600 dark:text-slate-300",children:m.properties?.title||m.name})]})}function Jl(e,t,n,r){return()=>{n&&e.files.getDownloadUrlWithOptions({file:n,name:r}).then(e=>{window.open(e.url,"_blank")}).catch(e=>{t({status:"error",title:"Failed to get download URL",description:e.message,duration:5e3})})}}function Yl({objectId:n,isOpen:r,onClose:a}){const s=fn(),{client:i,store:l}=Kt(),[o,u]=c(null),[m,p]=c(!1),[h,g]=c(!1),[f,y]=c(),[x,w]=c(),[N,k]=c("preview"),C=b();d(()=>{n&&r?(p(!0),l.objects.retrieve(n,"+embeddings").then(e=>{u(e),e.text?y(e.text):S(e.id);const t=e.content;t&&t.source&&t.type&&t.type.startsWith("image/")&&_(e)}).catch(e=>{console.error("Error loading object:",e),C({title:"Error",description:"Failed to load document",status:"error",duration:3e3})}).finally(()=>{p(!1)})):(u(null),y(void 0),w(void 0))},[n,r,l.objects]);const S=async e=>{g(!0);try{const t=await l.objects.getObjectText(e);y(t.text)}catch(e){console.error("Error loading text:",e)}finally{g(!1)}},_=async e=>{try{"found"===(await i.objects.getRendition(e.id,{format:Zt.jpeg,generate_if_missing:!1})).status&&console.log("Found rendition");const t=await i.files.getDownloadUrl(e.content.source);w(t.url)}catch(e){console.error("Error loading image:",e)}},j=()=>{o&&(s(`/legal/objects/${o.id}`),a())},I=f&&(f.startsWith("#")||f.includes("\n#")||f.includes("\n*")),P=o?.content?.type&&o.content.type.startsWith("image/"),T="application/pdf"===o?.content?.type;return r?t("div",{className:"fixed inset-y-0 right-0 w-2/5 dark:bg-slate-900 shadow-xl z-50 flex flex-col transition-transform duration-300 transform "+(r?"translate-x-0":"translate-x-full"),children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b dark:border-gray-700 bg-gradient-to-r from-indigo-50 to-gray-50 dark:from-gray-800 dark:to-gray-900",children:[t("div",{className:"flex items-center",children:[e(Pt,{className:"h-5 w-5 text-indigo-600 mr-2"}),e("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200 truncate",children:m?"Loading document...":o?.name||"Document Preview"})]}),t("div",{className:"flex items-center space-x-2",children:[t(v,{variant:"ghost",size:"sm",onClick:j,className:"flex items-center gap-1 text-indigo-600 hover:text-indigo-800",children:[e(gt,{className:"h-4 w-4"}),e("span",{children:"Full View"})]}),e(v,{variant:"ghost",size:"sm",onClick:a,className:"flex items-center text-gray-600 hover:text-gray-800 dark:text-gray-300 dark:hover:text-gray-100",children:e(Re,{className:"h-5 w-5"})})]})]}),m?e("div",{className:"flex-1 flex items-center justify-center",children:t("div",{className:"text-center",children:[e(B,{size:"lg",className:"text-indigo-600 dark:text-indigo-400 mb-2"}),e("p",{className:"text-gray-600 dark:text-gray-400",children:"Loading document..."})]})}):t("div",{className:"flex-1 flex flex-col h-full",children:[e("div",{className:"border-b",children:t("div",{className:"flex px-4",children:[e("button",{className:"py-2 px-4 font-medium border-b-2 "+("preview"===N?"border-indigo-600 text-indigo-700 dark:text-indigo-300":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"),onClick:()=>k("preview"),children:t("div",{className:"flex items-center gap-1",children:[e(it,{className:"h-4 w-4"}),e("span",{children:"Preview"})]})}),e("button",{className:"py-2 px-4 font-medium border-b-2 "+("properties"===N?"border-indigo-600 text-indigo-700 dark:text-indigo-300":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"),onClick:()=>k("properties"),children:t("div",{className:"flex items-center gap-1",children:[e(Ze,{className:"h-4 w-4"}),e("span",{children:"Properties"})]})})]})}),t("div",{className:"flex-1 overflow-auto p-4",children:["preview"===N&&t("div",{className:"h-full",children:[h?e("div",{className:"flex items-center justify-center h-40",children:e(B,{size:"md",className:"text-indigo-600 dark:text-indigo-400"})}):f?e("div",{className:"shadow rounded-md p-4 border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:I?e("div",{className:"prose prose-sm max-w-none prose-p:my-2 prose-pre:bg-gray-800 prose-pre:my-2 prose-headings:text-indigo-700 dark:prose-invert dark:prose-headings:text-indigo-300",children:e(yn,{children:f})}):e("pre",{className:"text-wrap whitespace-pre-wrap dark:text-gray-200",children:f})}):null,P&&e("div",{className:"mt-4",children:e("div",x?{className:"border border-gray-200 dark:border-gray-700 rounded-md p-2 bg-white dark:bg-gray-800",children:e("img",{src:x,alt:o?.name,className:"mx-auto max-h-[70vh] object-contain"})}:{className:"flex items-center justify-center h-40",children:e(B,{size:"md",className:"text-indigo-600 dark:text-indigo-400"})})}),T&&t("div",{className:"flex flex-col items-center justify-center h-64 border border-gray-200 dark:border-gray-700 rounded-md p-4 bg-gray-50 dark:bg-gray-800",children:[e(Pt,{className:"h-16 w-16 text-indigo-300 dark:text-indigo-400 mb-4"}),t("p",{className:"text-gray-600 dark:text-gray-400 text-center mb-4",children:["PDF document preview is available in full view. TODO"," "]}),e(v,{onClick:j,className:"bg-indigo-600 hover:bg-indigo-700 text-white",children:"Open Full Document View"})]}),!P&&!f&&!T&&!h&&t("div",{className:"flex flex-col items-center justify-center h-64 border border-gray-200 dark:border-gray-700 rounded-md p-4 bg-gray-50 dark:bg-gray-800",children:[e(Pt,{className:"h-16 w-16 text-gray-300 dark:text-gray-600 mb-4"}),e("p",{className:"text-gray-600 dark:text-gray-400 text-center",children:"No preview available for this document type."})]})]}),"properties"===N&&o&&t("div",{className:"h-full",children:[o.properties?e("div",{className:"shadow rounded-md p-4 border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:e(Nn,{value:o.properties})}):t("div",{className:"flex flex-col items-center justify-center h-64 border border-gray-200 dark:border-gray-700 rounded-md p-4 bg-gray-50 dark:bg-gray-800",children:[e(Ze,{className:"h-16 w-16 text-gray-300 dark:text-gray-600 mb-4"}),e("p",{className:"text-gray-600 dark:text-gray-400 text-center",children:"No properties available for this document."})]}),t("div",{className:"mt-4",children:[e("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"Document Information"}),e("div",{className:"shadow rounded-md p-4 border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:t("div",{className:"grid grid-cols-2 gap-y-2 gap-x-4 text-sm",children:[e("div",{className:"text-gray-500 dark:text-gray-400",children:"ID"}),e("div",{className:"font-medium dark:text-gray-200",children:o.id}),e("div",{className:"text-gray-500 dark:text-gray-400",children:"Type"}),e("div",{className:"font-medium dark:text-gray-200",children:o.type?.name||"Unknown"}),e("div",{className:"text-gray-500 dark:text-gray-400",children:"Content Type"}),e("div",{className:"font-medium dark:text-gray-200",children:o.content?.type||"N/A"}),e("div",{className:"text-gray-500",children:"Size"}),e("div",{className:"font-medium",children:o.content&&"size"in o.content?Zl(o.content.size):"Unknown"}),e("div",{className:"text-gray-500",children:"Created"}),e("div",{className:"font-medium",children:o.created_at?new Date(o.created_at).toLocaleString():"N/A"}),e("div",{className:"text-gray-500",children:"Updated"}),e("div",{className:"font-medium",children:o.updated_at?new Date(o.updated_at).toLocaleString():"N/A"})]})})]})]})]})]}),t("div",{className:"flex items-center justify-between p-4 border-t bg-gray-50 dark:bg-gray-800 dark:border-gray-700",children:[e("div",{children:o?.content?.source&&t(v,{onClick:()=>{o?.content?.source&&i.files.getDownloadUrl(o.content.source).then(e=>{window.open(e.url,"_blank")}).catch(e=>{console.error("Error getting download URL:",e),C({title:"Error",description:"Failed to download file",status:"error",duration:3e3})})},variant:"outline",className:"text-indigo-600 border-indigo-300 hover:bg-indigo-50",children:[e(ht,{className:"h-4 w-4 mr-2"}),"Download"]})}),t(v,{onClick:j,className:"bg-indigo-600 hover:bg-indigo-700 text-white",children:["Open Full Document",e(Ue,{className:"h-4 w-4 ml-2"})]})]})]}):null}function Zl(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]}const Ql=Object.values(on),Xl=Object.values(cn);function eo({onChange:n,isLoading:r,refresh:a,searchTypes:s}){const{client:i,project:l}=Kt(),o=b(),[u,m]=c(void 0),[p,h]=c(void 0),g=!(!l||!p?.embeddings.text&&!p?.embeddings.image),[f,y]=c(void 0),[x,w]=c(!1),[N,k]=c(s||Ql),[C,S]=c(100);d(()=>{s&&k(s)},[s]);const _={};let j=!1,A=!1;N.forEach(e=>{e===on.full_text?j=!0:A=!0,Xl.includes(e)&&(_[e]=!0)}),d(()=>{m(void 0),y(void 0)},[a]),d(()=>{l&&i.projects.retrieve(l.id).then(e=>{h(e.configuration)})},[l]),d(()=>{f&&o({title:f,status:"success",duration:2e3})},[f]),d(()=>{u&&0!==u.length||n(void 0)},[u]);const z=()=>{if(!g||!u)return;n({vector:A?{text:u,config:_}:void 0,full_text:j?u:void 0,limit:C}),y("Searching...")},D=e=>t=>{k(t?t=>Array.from(new Set([...t,e])):t=>t.filter(t=>t!==e))};return t("div",{className:"flex gap-1 items-center w-1/2",children:[e(F,{placeholder:"Type what you are looking for, or select a filter",value:u,onChange:m,onKeyDown:e=>{"Enter"===e.key&&z()}}),e(v,{variant:"ghost",onClick:()=>w(!0),alt:"Semantic search settings",className:"ml-1",children:e(Tt,{size:18})}),t(I,{isOpen:x,onClose:()=>w(!1),children:[e(P,{children:"Search Types"}),e(T,{children:t("div",{className:"flex flex-col gap-2",children:[t("label",{className:"flex items-center gap-2",children:[e(ge,{checked:N.includes(on.full_text),onCheckedChange:D(on.full_text)}),e("span",{children:"Full Text"})]}),e("div",{className:"font-semibold mt-2 mb-1",children:"Embeddings"}),Xl.map(n=>t("label",{className:"flex items-center gap-2",children:[e(ge,{checked:N.includes(n),onCheckedChange:D(n)}),e("span",{children:n.charAt(0).toUpperCase()+n.slice(1)})]},n)),t("div",{className:"mt-3",children:[e("span",{className:"mr-2",children:"Limit"}),e(fe,{type:"number",min:1,value:C,onChange:e=>S(Number(e??100)),style:{width:80}})]})]})}),e(E,{children:e(v,{variant:"outline",onClick:()=>w(!1),children:"Close"})})]}),e(v,{variant:"secondary",isLoading:r,onClick:z,isDisabled:!g,alt:"Semantic search",children:"Search"})]})}const to=[{name:"ID",field:"id",type:"objectId?slice=-7"},{name:"Name",field:".",type:"objectName"},{name:"Type",field:"type.name",type:"string"},{name:"Status",field:"status",type:"string"},{name:"Updated At",field:"updated_at",type:"date"}];function no({onUploadDone:t=async()=>{},layout:n}){const r=Pl(),a=b(),s=Rl(async e=>{await t(e),setTimeout(()=>{console.log("Delayed refresh after upload to ensure backend consistency"),r.search().then(()=>{a({title:"Document list refreshed",description:"The document list has been updated with your uploaded files.",status:"info",duration:3e3})}).catch(e=>{console.error("Failed to refresh search results:",e)})},1e3)});return e(ro,{layout:n,onUpload:(e,t)=>{const n=r.collectionId;return s(e,t,n)}})}function ro({layout:n,onUpload:r,allowFilter:a=!0,allowSearch:s=!0}){const i=Pl(),[l,o]=c(!1),[m,p]=c(null),{typeRegistry:h}=Kt(),{search:g,isLoading:f,error:y,objects:b,hasMore:v}=Al(),[x,w]=c(h?n||(N=h,((k=g.query.type)?N.getTypeLayout(k):to)??to):to);var N,k;const[C,S]=c(0),[_,j]=c(0),[I,P]=c("grid"===localStorage.getItem(Ra.LAST_DISPLAYED_VIEW)),[T,A]=c([]),z=u(null);d(()=>{l||0!==b.length||(j(0),g._updateRunningState(!0),g.search().then(()=>{o(!0)}).catch(e=>{console.error("Initial search failed:",e),g._updateRunningState(!1)}))},[]),d(()=>{b.length<_&&j(b.length)},[b.length,_]),me(z,()=>{l&&b.length>0&&b.length!=_&&(o(!1),g.loadMore().finally(()=>{j(b.length),o(!0)}))},{deps:[l,b.length]});const F=Tl(),E=Pl(),D=el(F),$=tl(E),R=new URL(window.location.href),O=R.searchParams.get("filters");if(O)try{const e=O.split(";"),t=e.filter(e=>{const[t]=e.split(":"),n=decodeURIComponent(t);return"start"!==n&&"end"!==n});if(t.length!==e.length){const e=t.length>0?t.join(";"):"";e?R.searchParams.set("filters",e):R.searchParams.delete("filters"),window.history.replaceState(window.history.state||{},"",R.toString())}}catch(y){console.error("Failed to clean start/end filters from URL:",y)}const L=fn();return t("div",{className:"flex flex-col gap-y-2",children:[e(so,{object:m,onClose:()=>p(null)}),y&&e(U,{title:"Error",children:y.message}),e(ao,{isLoading:f,refreshTrigger:C,allowFilter:a,allowSearch:s,filterGroups:D,filters:T,handleFilterChange:e=>{const t="function"==typeof e?e(T):e;A(t),$(t)},handleVectorSearch:e=>{if(e&&e.vector){if(g.query.vector=e.vector,g.query.full_text=e.full_text,g.query.weights=e.weights,g.query.score_aggregation=e.score_aggregation,g.query.dynamic_scaling=e.dynamic_scaling,void 0!==e.limit&&(g.limit=e.limit,g.query.limit=e.limit),!x.find(e=>"Search Score"===e.name)){const e=[...x,{name:"Search Score",field:"score",render:e=>e.score?.toFixed(4)||"0.0000"}];w(e)}g.search().then(()=>o(!0))}else e&&e.full_text?(g.query.full_text=e.full_text,void 0!==e.limit&&(g.limit=e.limit,g.query.limit=e.limit),g.search().then(()=>o(!0))):void 0===e&&l&&(delete g.query.vector,delete g.query.full_text,g.search().then(()=>o(!0)))},handleRefetch:()=>{g.search().then(()=>o(!0))},setIsGridView:P}),e(Ll,{objects:b,isLoading:!b.length&&f,layout:x,onRowClick:e=>{L(`/objects/${e.id}`)},previewObject:e=>{const t=b.find(t=>t.id===e)||null;p(t)},selectedObject:m,onUpload:r,isGridView:I,collectionId:i.collectionId}),e("div",v?{ref:z,className:"w-full flex justify-center",children:e(B,{size:"xl"})}:{className:"text-muted text-center text-sm py-1",children:`All ${b.length} objects loaded.`})]})}function ao(n){const{isLoading:r,refreshTrigger:a,allowFilter:s,allowSearch:i,filterGroups:l,filters:o,handleFilterChange:c,handleVectorSearch:d,handleRefetch:u,setIsGridView:m}=n;return t("div",{className:"sticky top-0 z-10 bg-background py-2",children:[s&&t(re,{filterGroups:l,filters:o,setFilters:c,children:[t("div",{className:"flex flex-row gap-4 items-center justify-between w-full",children:[t("div",{className:"flex gap-2 items-center w-2/3",children:[i&&e(eo,{onChange:d,isLoading:r,refresh:a,className:"w-full"}),e(ae,{})]}),t("div",{className:"flex gap-1 items-center",children:[e(v,{variant:"outline",onClick:u,alt:"Refresh",children:e(wt,{size:16})}),e(Ra,{onUpdate:m})]})]}),t("div",{className:"flex gap-2 items-center pt-2",children:[e(se,{}),e(ie,{})]})]}),!s&&t("div",{className:"flex flex-row gap-4 items-center justify-between w-full",children:[e("div",{className:"flex gap-2 items-center w-2/3",children:i&&e(eo,{onChange:d,isLoading:r,refresh:a})}),t("div",{className:"flex gap-1 items-center",children:[e(v,{variant:"outline",onClick:u,alt:"Refresh",children:e(wt,{size:16})}),e(Ra,{onUpdate:m})]})]})]})}function so({object:n,onClose:r}){const{store:a}=Kt(),s=b(),i=fn(),l=Jl(a,s,n?.content?.source,n?.name||n?.content?.name);return n?t(ye,{title:n.properties?.title||n.name,isOpen:!0,onClose:r,children:[t("div",{className:"flex items-center gap-x-2",children:[e(v,{variant:"ghost",size:"sm",title:"Open Object",onClick:()=>i(`/objects/${n.id}`),children:e(Oe,{className:"size-4"})}),n.content?.source&&e(v,{variant:"ghost",size:"sm",title:"Download",onClick:l,children:e(ht,{className:"size-4"})})]}),e(be,{className:"my-2"}),e("div",{className:"pt-2",children:e(ii,{object:n,loadText:!0},n.id)})]}):null}var io;function lo({isExporting:n,isOpen:r,onClose:a}){return t(I,{onClose:()=>a(void 0),isOpen:r,className:"relative overflow-visible",children:[e(P,{children:"Export Object Properties"}),!n&&e(oo,{onClose:a}),n&&e(co,{})]})}function oo({onClose:n}){const[r,a]=c(void 0),[s,i]=c(void 0),l=["Export selected objects","Export all objects"];return t(T,{className:"min-h-[104px] pt-0 flex flex-col gap-y-4",children:[e("div",{className:"h-1/3",children:e(X,{options:l,value:s,onChange:i,placeholder:"Choose what to export",className:"h-full w-full text-sm",filterBy:"name",isClearable:!0})}),t("div",{className:"h-1/2 flex flex-col gap-y-8 content-between",children:[e(X,{options:Object.values(io),value:r,onChange:a,placeholder:"Choose a format",className:"h-full w-full text-sm",filterBy:"name",isClearable:!0}),e(v,{className:"w-full",isDisabled:!r||!s,onClick:()=>{n(r,s==l[1])},children:"Export Properties"})]})]})}function co({}){return e(T,{className:"min-h-[84px] pt-0",children:t("div",{className:"h-full grid flex-col gap-y-2 content-between justify-items-center",children:[t("div",{className:"text-sm flex flex-col gap-x-2",children:[e("p",{children:"EXPORT IS IN PROGRESS"}),e("p",{className:"pt-2 grid justify-items-center",children:"PLEASE WAIT"})]}),e(B,{size:"lg"})]})})}function uo({collection:t}){const n=b(),{client:r,typeRegistry:a}=Kt();Pl().query.all_revisions=!0;const s=function(e,t){let n=e.table_layout;if(n&&n.length>0)return n;e.type&&t&&(n=t?.getTypeLayout(e.type.id));return n&&n.length>0?n:void 0}(t,a);return t.dynamic?e(ro,{layout:s}):e(no,{onUploadDone:async e=>{e.length>0&&await r.store.collections.addMembers(t.id,e).catch(e=>{n({title:"Failed to add objects to collection",description:e.message,status:"error"})})},layout:s})}!function(e){e.CSV="CSV",e.JSON="JSON"}(io||(io={}));const mo=n=>null===n?"None":t("div",{children:[e("div",{className:"text-sm",children:n.name}),e("div",{className:"text-xs text-gray-500",children:n.description})]});function po({className:t,defaultValue:n,onChange:r,isClearable:a,multiple:s}){const i=Kt(),[l,o]=c(!1),[u,m]=c(),[p,h]=c([]);d(()=>{if(!l&&(o(!0),i.typeRegistry&&n)){if(s&&Array.isArray(n)){const e=i.typeRegistry.types.filter(e=>n.includes(e.id));h(e)}const e=i.typeRegistry.types.find(e=>e.id===n);e&&m(e)}},[i.typeRegistry,n,s]);const g=e=>{h(e),r(e)};return e("div",s?{className:"flex flex-col gap-4 content-between",children:e(ue,{options:i.typeRegistry?.types||[],value:p,onChange:g,placeholder:"Choose Content Types...",optionLabel:mo,className:t||"text-sm bg-background",filterBy:"name",isClearable:a||!1,multiple:!0})}:{className:"flex flex-col gap-4 content-between",children:e(ue,{options:i.typeRegistry?.types||[],value:u,onChange:e=>{m(e||void 0),r(e)},placeholder:"Choose a Content Type...",optionLabel:mo,className:t||"text-sm bg-background",filterBy:"name",isClearable:a||!1})})}function ho({onClose:n,redirect:r=!0,onAddToCollection:a}){const s=fn(),i=b(),[l,o]=c(!1),{client:d}=Kt(),[u,m]=c({dynamic:!1,name:"",description:""});function p(e,t){m({...u,[e]:t})}return t("form",{onSubmit:e=>e.preventDefault(),children:[t(G,{children:[e(z,{label:"Name",required:!0,children:e(F,{type:"text",value:u.name||"",onChange:e=>p("name",e)})}),e(z,{label:"Description",className:"mt-2",children:e(ve,{value:u.description||"",onChange:e=>p("description",e.target.value)})}),e(z,{label:"Dynamic Collection",className:"mt-2",direction:"row",description:"Dynamically fetch content for the collection based on a query. If not enabled, then content must be added by users or agents.",children:e(xe,{value:u.dynamic||!1,onChange:e=>p("dynamic",e)})}),!u.dynamic&&e(z,{label:"Allowed Content Types",className:"mt-4",description:"Optionally select which content types can be added to the collection. If not set, then all content types are allowed.",children:e(po,{defaultValue:u.allowed_types||null,onChange:e=>{Array.isArray(e)?p("allowed_types",e.map(e=>e.id)):p("allowed_types",e?[e.id]:[])},isClearable:!0,multiple:!0})}),e(z,{label:"Type",className:"mt-2",description:"Optionally select a content type to assign custom properties and data to the collection.",children:e(po,{defaultValue:u.type||null,onChange:e=>{Array.isArray(e)?p("type",e.length>0?e[0].id:null):p("type",e?.id||null)},isClearable:!0})})]}),e(J,{children:e(v,{isDisabled:l,onClick:()=>{u?.name&&u.name.trim()?(u.name=u.name.trim(),u.description&&(u.description=u.description.trim()),null==u.dynamic&&(u.dynamic=!1),o(!0),d.store.collections.create(u).then(e=>{n(),i({title:"Collection created",description:`Collection "${e.name}" created successfully`,status:"success",duration:3e3}),r&&s(`/collections/${e.id}`),a&&a(e.id)}).catch(e=>{i({title:"Failed to create collection",description:e.message,status:"error",duration:5e3})}).finally(()=>o(!1))):i({title:"Name is required",description:"Please provide a name for the collection",status:"error",duration:5e3})},children:"Create Collection"})})]})}function go({isOpen:n,onClose:r}){return t(K,{onClose:r,isOpen:n,children:[e(H,{children:"Create a Collection"}),e(ho,{onClose:r})]})}function fo({}){const{client:r}=Kt(),a=b(),[s,i]=c(),[l,o]=c(!0),[u,m]=c(!1),{data:p,error:h,refetch:g}=L(()=>r.store.collections.search({}),[]);if(d(()=>{(p||h)&&o(!1)},[p,h]),h)return e(U,{title:"Collections fetch failed",children:h.message});return t(n,{children:[p&&(p.length>0?t(ne,{className:"w-full",children:[e("thead",{children:t("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Type"}),e("th",{children:"Created"}),e("th",{})]})}),e(le,{columns:4,isLoading:l,children:p.map(n=>t(we,{children:[e("td",{children:t("div",{className:"flex items-center gap-2",children:[yo(n.dynamic),e(gn,{href:`/collections/${n.id}`,children:n.name})]})}),e("td",{children:n.type?.name||"-"}),e("td",{children:hn(n.created_at).fromNow()}),e("td",{className:"text-right",children:e(v,{variant:"destructive",size:"sm",onClick:()=>i(n.id),children:e(At,{className:"size-4"})})})]},n.id))})]}):e(Ne,{title:"No Collections",buttonLabel:"New Collections",onClick:()=>m(!0),children:"Get started by creating a new Collections."})),e(go,{isOpen:u,onClose:()=>m(!1)}),e(ke,{isOpen:!!s,title:"Delete Collection",content:"Are you sure you want to delete this collection? This action cannot be undone.",onConfirm:async()=>{if(s)try{await r.store.collections.delete(s),a({title:"Collection deleted",status:"success",duration:3e3}),g()}catch(e){console.error("Failed to delete collection:",e),a({title:"Failed to delete collection",description:e.message||"An error occurred",status:"error",duration:5e3})}finally{i(void 0)}},onCancel:()=>i(void 0)})]})}function yo(t){const n=t?"Dynamic Collection":"Static Collection",r=e(t?zt:Ft,{className:"size-5"});return e(O,{description:n,className:"mr-2",children:r})}function bo({objects:n,isLoading:r}){const a=fn();return t(ne,{className:"w-full",children:[e(Ce,{children:t("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Strict Mode"}),e("th",{children:"Semantic Chunking"}),e("th",{children:"Updated At"})]})}),e(le,{isLoading:r&&(!n||0===n.length),columns:4,children:n?.map(n=>t("tr",{onClick:()=>a(`/types/${n.id}`),className:"cursor-pointer hover:bg-muted",children:[e("td",{children:n.name}),e("td",{children:n.strict_mode?"Yes":"No"}),e("td",{children:n.is_chunkable?"Yes":"No"}),e("td",{children:hn(n.updated_at).fromNow()})]},n.id))})]})}hn.extend(Rn),hn.extend(Rn);class vo{client;limit;result=new oe({objects:[],isLoading:!1});query={};constructor(e,t=100){this.client=e,this.limit=t}get objects(){return this.result.value.objects}get error(){return this.result.value.error}get isRunning(){return this.result.value.isLoading}getFilterValue(e){return this.query[e]}setFilterValue(e,t){this.query[e]=t,this.search()}reset(e=!1){this.result.value={objects:[],isLoading:e}}_updateRunningState(e){const t=this.result.value;this.result.value={objects:t.objects,isLoading:e,error:t.error}}async _search(e=!1){if(this.isRunning)return Promise.resolve(!1);this.result.value={isLoading:!0,objects:e?this.objects:[]};const t=this.limit,n=this.objects.length;return this.client.types.list({limit:t,offset:n,query:this.query}).then(async e=>(this.result.value={isLoading:!1,objects:this.objects.concat(e)},!0)).catch(e=>{throw this.result.value={error:e,isLoading:!1,objects:this.objects},e})}search(){return this.isRunning?Promise.resolve(!1):this._search(!1)}loadMore(){return this.isRunning?Promise.resolve(!1):this._search(!0)}}const xo=m(void 0);function wo(){return p(xo)}function No(){const e=wo();return{...ce(e.result),search:e}}function ko(){return wo().objects.length}function Co({title:n,isOpen:r,onClose:a,okLabel:s,initialPayload:i}){const l=b(),[o,d]=c(i?.name),[u,m]=c(i?.description),[p,h]=c(i?.strict_mode??!1);return t(I,{isOpen:r,onClose:()=>a(),children:[e(P,{children:n}),e(T,{className:"pt-0",children:t("div",{className:"h-full flex flex-col gap-4 content-between",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-muted",children:"Name"}),e(F,{value:o,onChange:d})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-muted",children:"Description"}),e(ve,{value:u,onChange:e=>m(e.target.value)})]})]})}),e(E,{children:t("div",{className:"flex justify-end gap-4",children:[e(v,{variant:"secondary",onClick:()=>a(),children:"Cancel"}),e(v,{variant:"primary",onClick:()=>(()=>{if(!o)return void l({status:"error",title:"Name is required",duration:5e3});a({name:o,description:u,strict_mode:p}).then(()=>a()),d(void 0),m(void 0),h(!1)})(),children:s})]})})]})}var So;function _o({isDirty:n=!1}){const r=Kt(),{store:a}=r,s=b(),[i,l]=c(!1),{search:o,isLoading:m,error:p,objects:h}=No(),[g,f]=c(""),y=Se(g,500),v=u(null);me(v,()=>{i&&o.loadMore()},{deps:[i]}),d(()=>{o.search().then(()=>l(!0))},[]),d(()=>{o.query.name=g,o.search().then(()=>l(!0))},[y]);const[x,w]=c(void 0);d(()=>{o.query.chunkable=x?"Yes"==x:void 0,o.search().then(()=>l(!0))},[x]),d(()=>{n&&i&&o.search().then(()=>l(!0))},[n]);const[N,k]=c(!1);if(p)return e(U,{title:"Failed to fetch ObjectTypes",children:p.message});return t("div",{className:"flex flex-col gap-4 h-full",children:[t("div",{className:"flex flex-shrink-0 gap-4",children:[e(F,{placeholder:"Filter by Name",value:g,onChange:f}),e(X,{className:"w-60",isClearable:!0,options:Object.values(So),value:x,onChange:e=>{w(e)},placeholder:"Is Chunkable"})]}),t("div",{className:"flex-1 overflow-y-auto",children:[m||0!==h?.length?e(bo,{objects:h,isLoading:m}):e(Ne,{title:"No Type",buttonLabel:"Create Type",onClick:()=>{k(!0)},children:"Get started by creating a new Type."}),e(Co,{okLabel:"Create",title:"Create Type",isOpen:N,onClose:async e=>e?a.types.create(e).then(async()=>{s({status:"success",title:"Type created",duration:2e3}),r.reloadTypes(),o.search().then(()=>l(!0))}).catch(e=>{s({status:"error",title:"Error creating type",description:e.message,duration:5e3})}):(k(!1),Promise.resolve())})]})]})}function jo({objectType:n,onSchemaUpdate:r}){const{store:a}=Kt(),s=b(),{theme:i}=$(),[l,d]=c(!1),m=_n(n.object_schema),p=u(void 0),[h,g]=c(!1),f=o(()=>function(e){if(!e)return"";return JSON.stringify(e,null,2)}(m.schema),[m]),y=()=>{if(p.current){const e=p.current.getValue();try{const t=function(e){if(!e?.trim())return;return JSON.parse(e.trim())}(e);Io(t),m.replaceSchema(t)}catch(e){return s({status:"error",title:"Invalid JSON Schema",description:e.message,duration:5e3}),!1}}return!0};return t("div",{className:"mx-2 my-2 rounded-2xl border border-solid shadow-md border-spacing-2",children:[t("div",{className:"flex items-center rounded-t-md border-b gap-x-2 py-2 pl-4 pr-2",children:[e("div",{className:"text-base font-semibold",children:"Schema Editor"}),e("div",{children:e(v,{variant:"outline",size:"sm",onClick:()=>{h&&!y()||g(e=>!e)},children:h?"Edit Schema":"Edit Json"})}),e("div",{className:"ml-auto flex gap-x-2",children:e(v,{isLoading:l,variant:"outline",size:"sm",onClick:()=>{h&&!y()||(d(!0),a.types.update(n.id,{object_schema:m.schema}).then(()=>{r(m),s({status:"success",title:"Schema updated",description:"The schema has been updated successfully",duration:2e3})}).catch(e=>{s({status:"error",title:"Failed to update schema",description:e.message,duration:5e3})}).finally(()=>{d(!1)}))},children:"Save Changes"})})]}),e("div",{className:"px-4 py-2",children:h?e(bn,{value:f,language:"json",editorRef:p,theme:"dark"===i?"vs-dark":"vs"}):e(jn,{schema:m})})]})}!function(e){e.true="Yes",e.false="No"}(So||(So={}));const Io=e=>{try{new zn({strict:!1}).compile(e)}catch(e){throw new Error(`Invalid JSON Schema definition: ${e.message}`)}};function Po({children:t,limit:n,name:r,chunkable:a}){const{store:s}=Kt(),i=o(()=>{const e=new vo(s,n);return e.query.name=r,e.query.chunkable=a,e},[n]);return e(xo.Provider,{value:i,children:t})}function To({isOpen:n,onClose:r,title:a="Select Content Type",children:s,initialSelectedType:i=null,confirmLabel:l="Select Type",allowNone:o=!0}){const{typeRegistry:d}=Kt(),[u,m]=c(i),p=d?.types||[],h=()=>{r(void 0)};return t(I,{isOpen:n,onClose:h,className:"w-full max-w-xl mx-auto",children:[e(P,{children:a}),t(T,{className:"p-6",children:[s,t("div",{className:"mb-4 mt-4",children:[t("label",{className:"block text-sm font-medium mb-2",children:["Content Type ",o&&e("span",{className:"text-gray-500 font-normal",children:"(Optional)"})]}),e(X,o?{options:p,value:u,optionLabel:e=>e?e.name:"Select a content type",placeholder:"Select a content type or leave empty for automatic detection",onChange:e=>m(e||null),filterBy:"name",isClearable:!0}:{options:p,value:u,optionLabel:e=>e?e.name:"Select a content type",placeholder:"Select a content type",onChange:e=>m(e||null),filterBy:"name"}),o&&t("div",{className:"mt-2 text-sm text-blue-600 flex items-center",children:[e(kt,{className:"h-4 w-4 mr-1"}),t("span",{children:[e("strong",{children:"Type selection is optional."})," Leave empty to let Vertesia choose the appropriate type"]})]})]}),u?t("div",{className:"text-sm text-gray-500 bg-gray-50 p-3 rounded-md mb-4",children:[e("div",{className:"font-medium",children:u.name}),u.description&&e("div",{className:"mt-1",children:u.description})]}):o&&t("div",{className:"text-sm text-blue-600 bg-blue-50 p-3 rounded-md mb-4",children:[e("div",{className:"font-medium",children:"Automatic Type Detection"}),t("div",{className:"mt-1",children:["Vertesia will analyze each file's content and automatically select the most appropriate type.",e("br",{}),e("span",{className:"mt-1 block font-medium",children:"This is recommended for most uploads."})]})]})]}),t(E,{children:[e(v,{variant:"ghost",onClick:h,children:"Cancel"}),e(v,{onClick:()=>{r(u?.id??null)},children:u?`${l}: ${u.name}`:o?"Let Vertesia Choose":l})]})]})}function Ao({objectType:n,onLayoutUpdate:r}){const a=b(),{theme:s}=$(),[i,l]=c(!1),{store:d}=Kt(),m=u(void 0),p=o(()=>zo(n.table_layout),[n.table_layout]),h=(e,t)=>{a({status:"error",title:e,description:t,duration:5e3})};return t("div",{className:"mx-2 my-2 rounded-2xl border border-solid shadow-xs",children:[t("div",{className:"flex items-center rounded-t-md border-b gap-x-2 py-2 pl-4 pr-2",children:[e("div",{className:"text-base font-semibold ",children:"Table Layout Editor"}),e("div",{className:"ml-auto flex gap-x-2",children:e(v,{isLoading:i,variant:"outline",size:"sm",onClick:()=>{if(!m.current)return;const e=m.current.getValue();let t;if(e)try{t=JSON.parse(e)}catch(e){return h("Invalid JSON",e.message)}else t=null;return Array.isArray(t)?t.some(e=>!e||!e.name||!e.field)?h("Invalid JSON","A table layout entry must contain the following properties:] {field, name, converter?}"):(l(!0),void d.types.update(n.id,{table_layout:t}).then(e=>{a({status:"success",title:"Table Layout updated",description:"The table layout has been updated successfully",duration:2e3}),r(e.table_layout)}).catch(e=>{a({status:"error",title:"Failed to update table layout",description:e.message,duration:5e3})}).finally(()=>{l(!1)})):h("Invalid JSON","The table layout must be an array")},children:"Save Changes"})})]}),e("div",{className:"px-4 py-2",children:e(bn,{value:p,language:"json",editorRef:m,theme:"dark"===s?"vs-dark":"vs"})})]})}function zo(e){return e?JSON.stringify(e,null,2):"[\n\n]"}function Fo({refetch:r,collection:a}){const s=a.type?.id,i=u(void 0),l=b(),{theme:d}=$(),{client:m}=Kt(),[p,h]=c(!1),[g,f]=c({name:a.name,description:a.description||"",query:a.query?JSON.stringify(a.query,null,2):"",tags:a.tags||[],type:a.type?.id||"",allowed_types:a.allowed_types||[]}),y=o(()=>zo(a.table_layout),[a.table_layout]),x=(e,t)=>{f({...g,[e]:t})};return t("div",{className:"flex flex-col gap-4 py-2",children:[t(_e,{title:"Configuration",action:e(v,{size:"lg",isDisabled:p,onClick:()=>{let e;try{e=g.query?JSON.parse(g.query):void 0}catch(e){return void l({title:"Invalid Query JSON",description:e.message,status:"error",duration:5e3})}const t={name:g.name,description:g.description,query:e,tags:g.tags,type:g.type,allowed_types:g.allowed_types};let n;if(t.name||(n="Name is required"),t.type||(t.type=null),n)l({title:"Validation failed",description:n,status:"error",duration:5e3});else{if(i.current){const e=i.current.getValue();if(e)try{t.table_layout=JSON.parse(e)}catch(e){return void l({title:"Invalid Table Layout",description:e.message,status:"error",duration:5e3})}else t.table_layout=null}h(!0),m.store.collections.update(a.id,t).then(()=>{r(),l({title:"Collection updated",description:"Collection has been updated successfully",status:"success",duration:3e3})}).catch(e=>{l({title:"Failed to update collection",description:e.message,status:"error",duration:5e3})}).finally(()=>{h(!1)})}},children:"Save"}),children:[t("div",{className:"flex justify-between mb-2",children:[t("div",{className:"w-1/2 gap-2 flex flex-col",children:[e("div",{className:"text-sm font-medium mb-1",children:"Created By"}),t("div",{className:"gap-2 flex items-center",children:[e(Ln,{userRef:a.created_by,showTitle:!0}),t("span",{children:["at ",hn(a.created_at).format("YYYY-MM-DD HH:mm:ss")]})]})]}),t("div",{className:"w-1/2 gap-2 flex flex-col",children:[e("div",{className:"text-sm font-medium mb-1",children:"Updated By"}),t("div",{className:"gap-2 flex items-center",children:[e(Ln,{userRef:a.updated_by,showTitle:!0}),t("span",{children:["at ",hn(a.updated_at).format("YYYY-MM-DD HH:mm:ss")]})]})]})]}),e(z,{label:"Name",required:!0,children:e(F,{value:g.name,onChange:e=>x("name",e)})}),e(z,{label:"Description",children:e(ve,{value:g.description,onChange:e=>x("description",e.target.value)})}),!a.dynamic&&e(z,{label:"Allowed Content Types",description:"Select which content types can be added to the collection. If not set, then all content types are allowed.",children:e(po,{defaultValue:g.allowed_types||null,onChange:e=>{Array.isArray(e)?x("allowed_types",e.map(e=>e.id)):x("allowed_types",e?[e.id]:[])},isClearable:!0,multiple:!0})}),a.dynamic&&e(z,{label:"Query",description:"Define the query to dynamically fetch content for the collection.",children:e(ve,{className:he.INPUT,value:g.query,onChange:e=>x("query",e.target.value)})}),e(z,{label:"Table Layout",description:"Define a custom layout for displaying the collection in tables.",children:e(bn,{className:"border-1 rounded-md border-border",value:y,language:"json",editorRef:i,theme:"dark"===d?"vs-dark":"vs"})}),e(z,{label:"Type",description:"Select a content type to assign custom properties and data to the collection.",children:e(po,{defaultValue:g.type||null,onChange:e=>{Array.isArray(e)?x("type",e.length>0?e[0].id:null):x("type",e?.id||null)},isClearable:!0})})]}),s&&e(Eo,{typeId:s,collection:a}),!a.dynamic&&t(n,{children:[e(Un,{collection:a}),e(Mn,{collection:a})]})]})}function Eo({typeId:t,collection:n}){const[r,a]=c({}),s=b(),{client:i}=Kt(),[l,d]=c(!1),{data:u,error:m}=L(()=>i.store.types.retrieve(t),[t]),p=u?.object_schema||{},h=o(()=>new In(p,n.properties||{}),[p,n.properties]);if(m)return e(U,{title:"Failed to load type",children:m.message});if(!u)return null;return e(_e,{title:"Properties",action:e(v,{size:"lg",isLoading:l,type:"submit",onClick:()=>(e=>{if(!e||!Object.keys(e).length)return;const t={properties:e||{}};d(!0),i.store.collections.update(n.id,t).then(()=>{s({title:"Collection properties updated",description:"Collection has been updated successfully",status:"success",duration:3e3})}).catch(e=>{s({title:"Failed to update collection properties",description:e.message,status:"error",duration:5e3})}).finally(()=>{d(!1)})})(r),children:"Save"}),children:e(Pn,{object:h,onChange:e=>{e instanceof In&&a(e.value)}})})}function Do({onChange:n,value:r,disabled:a=!1,placeholder:s="Select a collection",searchPlaceholder:i="Search collections",filterOut:l,allowDynamic:d=!0,multiple:u=!1}){const{client:m}=Kt(),[p,g]=c(""),[f,b]=c(!1),[x,S]=c(!1),I=Se(p,300),P=h(async e=>{b(!0);const t=e.trim(),n=await m.store.collections.search({dynamic:!!d&&void 0,name:x&&t||void 0});return b(!1),!x&&n.length>=1e3&&S(!0),l&&l.length>0?n.filter(e=>!l.includes(e.id)):n},[m,d,l,x]),{data:T,error:A}=L(()=>P(x?I:""),[x?I:"",P]),z=o(()=>T?u&&Array.isArray(r)?T.filter(e=>r.includes(e.id)):u||"string"!=typeof r?u?[]:void 0:T.find(e=>e.id===r):u?[]:void 0,[T,r,u]),F=h(e=>{if(u){const t=Array.isArray(r)?r:[];if(t.includes(e.id)){const r=t.filter(t=>t!==e.id),a=T?.filter(e=>r.includes(e.id))||[];n(r,a)}else{const r=[...t,e.id],a=T?.filter(e=>r.includes(e.id))||[];n(r,a)}}else n(e.id,e)},[n,r,T,u]),E=h(()=>{n(void 0,void 0)},[n]),D=h(e=>{g(e)},[]),$=p.trim().length>0,R=o(()=>{if(!T)return[];if(x)return T;if(!$)return T;const e=p.toLowerCase();return T.filter(t=>t.name.toLowerCase().includes(e))},[T,x,$,p]),O=z&&$;if(A)return e(U,{title:"Collection fetch failed",children:A.message});return t(w,{children:[e(N,{asChild:!0,children:t(v,{variant:"outline",role:"combobox","aria-haspopup":"listbox",className:y("w-full justify-between min-w-0"),disabled:a,children:[e("span",{className:"truncate flex-1 text-left min-w-0",children:u&&Array.isArray(z)&&z.length>0?1===z.length?z[0].name:`${z.length} collections selected`:u||!z||Array.isArray(z)?s:z.name}),e(It,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(k,{className:"mt-2 mb-2 w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:t(C,{shouldFilter:!1,children:[t("div",{className:"flex justify-between items-center border-b px-3","cmdk-input-wrapper":"",children:[e(je,{placeholder:i,value:p,onValueChange:D,className:"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"}),f&&e("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"})]}),e(Ie,{children:f?"Searching...":$?"No collections found.":"No collections available."}),t(_,{className:"max-h-[300px] overflow-auto",children:[O&&!u&&e(j,{value:"__clear__",onSelect:E,className:"text-muted-foreground",children:"Clear selection"}),R.map(n=>{const a=u&&Array.isArray(r)?r.includes(n.id):r===n.id;return t(j,{value:n.id,onSelect:()=>F(n),className:"flex items-center justify-between",children:[e("span",{className:"truncate",children:n.name}),a&&e(Et,{className:"ml-2 h-4 w-4 shrink-0"})]},n.id)})]})]})})]})}function $o({collection:t}){const{client:n}=Kt(),[r,a]=c(void 0),[s,i]=c(t.shared_properties||[]),l=b();d(()=>{t.type?.id&&n.store.types.retrieve(t.type.id).then(a)},[t.type?.id]);const o=r?Object.keys(r.object_schema?.properties||{}):[];return e(_e,{title:"Shared Properties",description:"Add properties to share across all members in the collection. This feature requires to enable shared property synchronization on the project.",action:e(v,{size:"lg",isLoading:!1,onClick:()=>{n.store.collections.update(t.id,{shared_properties:s}).then(()=>{l({title:"Updated shared properties",status:"success"})}).catch(e=>{l({title:"Failed to update shared properties",description:e.message,status:"error"})})},children:"Save"}),children:e("div",{className:"",children:e(Pe,{value:s,onChange:e=>{i(e)},options:o,placeholder:"Select properties to share"})})})}function Ro({collection:t}){const{client:n}=Kt(),[r,a]=c(t.skip_head_sync??!1),[s,i]=c(!1),l=b();return e(_e,{title:"Synchronize Member Heads",description:"When a new HEAD version of a member is created the colleciton will be updated to point to the new HEAD.",children:e(xe,{disabled:s,value:!r,onChange:e=>{const r=!e;i(!0),n.store.collections.update(t.id,{skip_head_sync:r}).then(()=>{l({title:"Updated skip head sync setting",status:"success"}),a(r)}).catch(e=>{l({title:"Failed to update skip head sync",description:e.message,status:"error"})}).finally(()=>{i(!1)})},children:"Enable synchronizing member heads"})})}function Oo({action:n,objectIds:r,children:a}){const{store:s}=Kt(),i=b(),[l,o]=c(!1),d=h(()=>(o(!0),Promise.resolve(!0)),[]);ac(n.id,d);return t("div",{children:[a,e(To,{isOpen:l,onClose:e=>{o(!1),void 0!==e&&s.runOperation({name:"change_type",ids:r,params:{typeId:e}}).then(e=>{i({status:"success",title:"Change Type",description:`Change the type of ${r.length} objects is ${"in_progress"===e.status?"in progress":"completed"}`,duration:2e3})}).catch(e=>{i({status:"error",title:"Error changing type",description:e.message,duration:5e3})})},title:"Change Content Type",confirmLabel:"Change Type",children:t("div",{className:"text-sm flex flex-col gap-x-2",children:[t("p",{children:["Choose a new Content Type for the selected object",r.length>1?"s":" ","or let the system choose or generate a type based on the content."]}),t("p",{className:"pt-2 text-xs",children:["Note: This action will raise the ",e("code",{children:"change_type"})," event and will trigger the standard intake workflows which may reset the object properties."]})]})})]})}const Lo={id:"changeType",name:"Change Content Type",description:"Change the Content Type of the selected documents",confirm:!1,component:Oo};function Uo({action:r,callback:a,children:s}){const[i,l]=c(!1),o=r.confirmationText||`Are you sure you want to ${r.name}?`,d=h(e=>r.confirm?(l(!0),Promise.resolve(!0)):a(e),[r.confirm,a]),u=ac(r.id,d);return t(n,{children:[s,e(ke,{onConfirm:()=>{l(!1),a({...u.params,action:r})},onCancel:()=>l(!1),title:"Are you sure?",content:o,isOpen:i})]})}function Mo({action:t,objectIds:n,children:r}){const a=rc(),s=b(),{client:i}=Kt(),l=Pl(),o=fn(),c=h(()=>{if(!n||!n.length)return s({status:"error",title:"No objects selected",description:"Please select objects to delete",duration:3e3}),Promise.resolve(!1);function e(e,t){if(e.length<=t)return e;const n=e.lastIndexOf("."),r=-1!==n?e.substring(n):"";return`${(-1!==n?e.substring(0,n):e).substring(0,t-r.length-3)}...${r}`}return Promise.all(n.map(e=>i.store.objects.delete(e))).then(t=>{const r=t.length>1?"s":"";if(s({status:"success",title:`${t.length} object${r} deleted`,description:`Objects ${e(t.map(e=>e.id).join(", "),100)} have been deleted`,duration:2e3}),l){a.params?.selection?.removeAll();const e=JSON.parse(JSON.stringify(l.facets));n.length===e._value.total&&l.resetFacets(),l.search()}else o("/objects")}).catch(e=>{s({status:"error",title:"Error deleting objects",description:e.message,duration:5e3})})},[n]);return e(Uo,{action:t,callback:c,children:r})}const Vo={id:"delete",name:"Delete",description:"Delete the selected objects",confirm:!0,confirmationText:"Are you sure you want to delete all the selected objects? This action cannot be undone.",component:Mo,destructive:!0},qo={id:"deleteFromCollections",name:"Delete Objects",description:"Delete the selected objects",confirm:!0,confirmationText:"Are you sure you want to delete the selected objects?\nThis is not removable from collections.",component:Mo,destructive:!0};function Bo({action:t,objectIds:n}){const{store:r}=Kt(),a=b(),[s,i]=c(!1),[l,o]=c(!1),d=h(()=>(i(!0),Promise.resolve(!0)),[]),u=ac(t.id,d);return e("div",{children:e(lo,{isExporting:l,isOpen:s,onClose:(e,t)=>{if(e&&(t||n.length>0)){o(!0);const s=u.params?.search?.query||{},l=u.params?.search?.result?.value?.objects?.map(e=>e.id)||void 0,c=async e=>r.objects.list({query:{parent:e}}).then(e=>e.map(e=>e.id));(async()=>t?l?s.vector?l:[]:0===n.length?[]:(await c(n[0])).concat(n):n)().then(l=>{r.objects.exportProperties({objectIds:l,type:e,query:t&&!s.vector?s:{type:s.type}}).then(r=>{let s;if(e===io.CSV)s=new Blob([r.data],{type:r.type});else if(e===io.JSON)s=new Blob([JSON.stringify(r.data)],{type:r.type});else{const e=r.data;s=new Blob([new Uint8Array(e.data)],{type:r.type})}const i=window.URL.createObjectURL(s),l=document.createElement("a");l.download=r.name,l.href=i,l.click(),a({status:"success",title:"Export Properties",description:t?"Export the properties of all objects completed":`Export the properties of ${n.length} object${n.length>1?"s":""} is completed`,duration:2e3})}).catch(e=>{a({status:"error",title:"Error Export Properties",description:e.message,duration:5e3})}).finally(()=>{o(!1),i(!1)})})}else i(!1)}})})}const Wo={id:"exportProperties",name:"Export Properties",description:"Export all Object Properties",confirm:!1,component:Bo};function Ko({action:t,objectIds:n,collectionId:r}){const a=rc(),s=b(),{client:i}=Kt(),l=Pl(),o=h(()=>n&&n.length?r?i.store.collections.deleteMembers(r,n).then(()=>{const e=n.length>1?"s":"";s({status:"success",title:`${n.length} object${e} removed from collection`,description:"Objects have been removed from the collection",duration:2e3}),l&&(a.params?.selection?.removeAll(),l.search())}).catch(e=>{s({status:"error",title:"Error removing objects from collection",description:e.message,duration:5e3})}):(s({status:"error",title:"No collection context",description:"Cannot remove objects: no collection specified",duration:3e3}),Promise.resolve(!1)):(s({status:"error",title:"No objects selected",description:"Please select objects to remove from collection",duration:3e3}),Promise.resolve(!1)),[n,r]);return e(Uo,{action:t,callback:o})}const Ho={id:"removeFromCollection",name:"Remove from Collection",description:"Remove the selected objects from this collection",confirm:!0,confirmationText:"Are you sure you want to remove the selected objects from this collection?",component:Ko,destructive:!0};function Go({action:t,objectIds:n,collectionId:r}){const a=b(),{client:s}=Kt(),[i,l]=c(!1),o=h(()=>(l(!0),Promise.resolve(!0)),[]);return ac(t.id,o),e(Yo,{isOpen:i,onClose:e=>{if(l(!1),e)return s.store.workflows.rules.execute(e,n,{collection_id:r}).then(()=>{a({title:"Workflow started",status:"success",duration:3e3})}).catch(e=>{a({title:"Error starting workflow",status:"error",description:e.message,duration:9e3})})}})}const Jo={id:"startWorkflow",name:"Start Workflow",description:"Start an workflow on the selected objects",confirm:!1,hideInList:!0,component:Go};function Yo({isOpen:n,onClose:r}){return t(K,{onClose:()=>r(void 0),isOpen:n,className:"",children:[e(H,{children:"Start a Workflow by Rule"}),e(Qo,{onClose:r})]})}function Zo(n){return{label:t("div",{children:[e("div",{children:n.name}),e("div",{className:"text-sm text-muted",children:n.description})]}),reverse:!0}}function Qo({onClose:n}){const[r,a]=c(void 0),s=rc();return t("div",{children:[t(G,{children:[e("div",{className:"pb-2",children:"Choose a workflow rule to start:"}),e("div",{className:"max-h-[420px] overflow-y-scroll border-border border rounded-md",children:e(Te,{options:s.wfRules,optionLayout:Zo,onChange:e=>{a(e)},value:r})})]}),t(J,{children:[e(v,{variant:"secondary",onClick:()=>n(),children:"Cancel"}),e(v,{onClick:()=>{r&&n(r.id)},isDisabled:!r,children:"Start"})]})]})}class Xo{params;allActions=[Wo,Lo,Jo,lc,Vo,Ho,qo];wfRules=[];callbacks={};startWorkflow;constructor(e){this.params=e}get actions(){return!!this.params.selection?.collectionId?this.allActions.filter(e=>"addToCollection"!==e.id&&"delete"!==e.id):this.allActions.filter(e=>"removeFromCollection"!==e.id&&"deleteFromCollections"!==e.id)}async loadWorkflows(){return this.params.client.workflows.rules.list().then(e=>{this.wfRules=e.map(e=>({id:e.id,name:e.name,description:e.description,confirm:!1,isWorkflow:!0,component:Go})).sort((e,t)=>e.name.localeCompare(t.name))}),this.wfRules}registerCallback(e,t){return this.callbacks[e]=t,()=>{delete this.callbacks[e]}}unregisterCallback(e){delete this.callbacks[e]}findAction(e){let t=this.allActions.find(t=>t.id===e);return t||(t=this.wfRules.find(t=>t.id===e)),t}async run(e){const t=this.findAction(e);if(!t)throw new Error(`Action ${e} not found`);const n={...this.params,action:t},r=this.callbacks[e];if(r)return r(n);throw new Error("No action callback set")}}const ec=m(void 0);function tc({children:n}){const r=yl(),a=b(),{client:s}=Kt(),i=Pl(),{data:l,error:c}=L(()=>s.workflows.rules.list().then(e=>e.map(e=>({id:e.id,name:e.name,description:e.description,confirm:!1,isWorkflow:!0,component:Go})).sort((e,t)=>e.name.localeCompare(t.name))),[]),d=o(()=>{const e=new Xo({selection:r,toast:a,client:s,search:i});return e.wfRules=l,e},[r,l]);return c?e(U,{title:"Failed to fetch workflows",children:c.message}):d&&t(ec.Provider,{value:d,children:[e(nc,{}),n]})}function nc({}){const t=rc(),n=t.params.selection,r=n.getObjectId(),a=n.isSingleSelection()&&r?[r]:n.getObjectIds();return e("div",{style:{display:"none"},children:t.allActions.map(t=>e(t.component,{action:t,objectIds:a,collectionId:n.collectionId},t.id))})}function rc(){const e=p(ec);if(!e)throw new Error("You cannot use useActionContext outside an ActionProvider");return e}function ac(e,t){const n=rc();return d(()=>n.registerCallback(e,t),[n,e,t]),n}function sc(e){const t=rc();return d(()=>(t.startWorkflow=e,()=>{t.startWorkflow=void 0}),[e,t]),t}function ic({action:t,objectIds:n}){const[r,a]=c(!1),s=h(()=>(n.length>0&&a(!0),Promise.resolve(!0)),[n]);return ac(t.id,s),r&&e(W,{children:e(oc,{objectIds:n,isOpen:r,onClose:()=>{a(!1)}})})}const lc={id:"addToCollection",name:"Add to Collection",description:"Add documents to a collection",confirm:!1,component:ic};function oc({isOpen:n,onClose:r,objectIds:a}){return t(K,{isOpen:n,onClose:r,className:"max-w-lg w-full min-w-0 overflow-hidden",children:[e(H,{className:"flex flex-col min-w-0 overflow-hidden",children:"Add to a Collection"}),e(Ae,{className:"min-w-0 overflow-hidden",children:"Add the selected objects to an existing collection or create a new one."}),e("div",{className:"min-w-0 max-w-full overflow-hidden",children:e(cc,{onClose:r,objectIds:a})})]})}function cc({onClose:n,objectIds:r}){const a=b(),{client:s}=Kt(),[i,l]=c(),o=({collectionId:e})=>{e&&r?.length&&s.store.collections.addMembers(e,r).then(()=>{a({title:"Add to collection success",status:"success",description:`Added ${r.length} objects to the selected collection`,duration:3e3}),n()}).catch(()=>{a({title:"Add to collection failure",status:"error",description:"Failed to add the selected objects to the collection",duration:5e3})})},d=[{name:"select",label:"Select Collection",content:t("div",{className:"p-4 min-w-0 max-w-full overflow-hidden",children:[e(ze,{level:5,children:"Choose from existing collections"}),e(G,{className:"min-w-0 max-w-full overflow-hidden",children:e("div",{className:"mb-4 min-w-0 max-w-full overflow-hidden",children:e(Do,{onChange:(e,t)=>{"string"==typeof e||void 0===e?l(e):Array.isArray(e)&&e.length>0?l(e[0]):l(void 0)},value:i})})}),e(J,{children:e(v,{isDisabled:!i,onClick:()=>i&&o({collectionId:i}),children:"Add to Collection"})})]})},{name:"create",label:"Create new",content:e("div",{className:"p-4",children:e(ho,{onClose:n,onAddToCollection:e=>o({collectionId:e}),redirect:!1})})}];return t(Fe,{defaultValue:"select",tabs:d,fullWidth:!0,children:[e(Ee,{}),e(De,{})]})}function dc(){const n=yl(),r=n.size(),a=r>1?"s":"",s=n?.hasSelection(),i=n?.isSingleSelection();return e(tc,{children:t("div",{className:"flex items-center gap-x-2",children:[s&&!i&&t("div",{className:"flex items-center gap-x-1 shrink-0",children:[t("div",{className:"text-sm nowrap",children:[r," document",a," selected"]}),e(v,{title:"Clear selection",variant:"ghost",onClick:()=>{n?.removeAll()},children:e(Re,{className:"size-4"})})]}),e(gc,{selection:n,children:e(v,{variant:"ghost",alt:"More action",size:"sm",children:e(Dt,{size:16})})}),s&&e(uc,{selection:n})]})})}function uc({}){return e(pc,{})}function mc({collectionId:r,allowFolders:a=!0}){const[s,i]=c([]),[l,o]=c(!1),d=yl(),u=d?.hasSelection();return!u&&t(n,{children:[e(v,{onClick:()=>o(!0),children:"Upload"}),e($l,{collectionId:r??"",isOpen:l,onClose:()=>{o(!1),i([])},files:s,title:"Upload Files",onUploadComplete:e=>{e&&e.success&&i([])},allowFolders:a})]})}function pc(){const t=rc();return t.params.selection.hasSelection()&&e(v,{onClick:()=>t.run(Jo.id),children:"Start Workflow"})}function hc(e){return{label:e.name,className:r("flex-1 px-2 py-2 hover:bg-accent nowrap",e.destructive?"text-destructive":"")}}function gc({selection:n,children:r}){const a=rc();return t(w,{hover:!0,children:[e(N,{children:r}),e(k,{className:"p-0 w-50",align:"end",sideOffset:6,children:e(fc,{executeAction:e=>{a.run(e.id)},selection:n})})]})}function fc({executeAction:t,selection:n}){const r=rc(),a=n?.hasSelection()?r.actions.filter(e=>!e.hideInList):[Wo];return e("div",{className:"rounded-md shadow-md py-2",children:e("div",{className:"px-1 text-sm",children:e(Te,{options:a,optionLayout:hc,onChange:e=>{t(e)},noCheck:!0})})})}function yc({onSend:n,onStop:r,disabled:a=!1,isSending:s=!1,isStopping:i=!1,isStreaming:l=!1,isCompleted:o=!1,activeTaskCount:m=0,placeholder:p="Type your message...",onFilesSelected:g,uploadedFiles:f=[],onRemoveFile:y,acceptedFileTypes:b=".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.png,.jpg,.jpeg,.gif,.webp",maxFiles:x=5,processingFiles:w,hasProcessingFiles:N=!1,renderDocumentSearch:k,selectedDocuments:C=[],onRemoveDocument:S,hideObjectLinking:_=!1,className:j,inputClassName:I}){const P=u(null),T=u(null),[A,z]=c(""),[F,E]=c(!1),[D,$]=c(!1),[R,L]=c(!1);d(()=>{!a&&o&&P.current?.focus()},[a,o]);const U=h(e=>{if(!g)return;const t=Array.from(e),n=x-f.length,r=t.slice(0,n);r.length>0&&g(r)},[g,x,f.length]),M=h(e=>{e.preventDefault(),e.stopPropagation(),g&&L(!0)},[g]),V=h(e=>{e.preventDefault(),e.stopPropagation(),L(!1)},[]),q=h(e=>{e.preventDefault(),e.stopPropagation(),L(!1),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&U(e.dataTransfer.files)},[U]),W=h(e=>{if(!g)return;const t=e.clipboardData?.items;if(!t)return;const n=[];for(let e=0;e<t.length;e++){const r=t[e];if("file"===r.kind){const e=r.getAsFile();if(e)if(!r.type.startsWith("image/")||e.name&&"image.png"!==e.name)n.push(e);else{const t=r.type.split("/")[1]||"png",a=new File([e],`pasted-image-${Date.now()}.${t}`,{type:e.type});n.push(a)}}}n.length>0&&U(n)},[g,U]),J=h(e=>{e.target.files&&e.target.files.length>0&&(U(e.target.files),e.target.value="")},[U]),Y=h(()=>{T.current?.click()},[]),Z=h(e=>{const t=`[📄 ${e.name}](doc:${e.id})`,n=A||"",r=P.current?.selectionStart||n.length,a=n.substring(0,r)+t+n.substring(r);z(a),$(!1)},[A]),Q=()=>{const e=A.trim();!e||a||s||(n(e),z(""))},X=()=>{r&&!i&&r()},ee=u(0),te=h(()=>{const e=P.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[]);d(()=>{te()},[A,te]);const ne=f.length>0||C.length>0||w&&w.size>0;return t("div",{className:`p-3 border-t border-muted flex-shrink-0 transition-all fixed lg:sticky bottom-0 left-0 right-0 lg:left-auto lg:right-auto w-full bg-background z-10 ${R?"bg-blue-50 dark:bg-blue-900/20 border-blue-400":""} ${j||""}`,style:{minHeight:"120px"},onDragOver:M,onDragLeave:V,onDrop:q,children:[R&&e("div",{className:"absolute inset-0 flex items-center justify-center bg-blue-100/80 dark:bg-blue-900/40 rounded-lg z-10 pointer-events-none",children:t("div",{className:"text-blue-600 dark:text-blue-400 font-medium flex items-center gap-2",children:[e(Nt,{className:"size-5"}),"Drop files to upload"]})}),g&&e("input",{ref:T,type:"file",multiple:!0,accept:b,onChange:J,className:"hidden"}),ne&&t("div",{className:"flex flex-col gap-2 mb-3",children:[(f.length>0||w&&w.size>0)&&t("div",{children:[t("div",{className:"flex items-center gap-1 mb-1",children:[e("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Uploaded Files"}),e(O,{description:"Files uploaded to this conversation remain available throughout. The agent can access them anytime.",placement:"top",size:"md",children:e($t,{className:"size-3 text-gray-400 dark:text-gray-500"})})]}),t("div",{className:"flex flex-wrap gap-2",children:[f.map(n=>t("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-gray-100 dark:bg-gray-800 rounded-md text-sm",children:[e(Rt,{className:"size-3.5 text-gray-500"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),y&&e("button",{onClick:()=>y(n.id),className:"ml-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:e(nt,{className:"size-3"})})]},n.id)),w&&Array.from(w.values()).map(n=>t("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-sm "+(n.status===dn.ERROR?"bg-destructive/10 text-destructive":n.status===dn.READY?"bg-success/10 text-success":"bg-attention/10 text-attention"),children:[n.status===dn.UPLOADING&&e(B,{size:"xs"}),n.status===dn.PROCESSING&&e(B,{size:"xs"}),n.status===dn.READY&&e(Ot,{className:"size-3.5"}),n.status===dn.ERROR&&e(nt,{className:"size-3.5"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),t("span",{className:"text-xs opacity-70",children:[n.status===dn.UPLOADING&&"Uploading...",n.status===dn.PROCESSING&&"Processing...",n.status===dn.READY&&"Ready",n.status===dn.ERROR&&(n.error||"Error")]})]},n.id))]})]}),C.length>0&&t("div",{children:[t("div",{className:"flex items-center gap-1 mb-1",children:[e("span",{className:"text-xs font-medium text-blue-600 dark:text-blue-400",children:"Document Attachments"}),e(O,{description:"Documents from the store attached to this message. The agent can re-fetch them by ID anytime, or re-attach to include content directly.",placement:"top",size:"md",children:e($t,{className:"size-3 text-blue-400 dark:text-blue-500"})})]}),e("div",{className:"flex flex-wrap gap-2",children:C.map(n=>t("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-blue-100 dark:bg-blue-900/30 rounded-md text-sm text-blue-700 dark:text-blue-300",children:[e(Rt,{className:"size-3.5"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),S&&e("button",{onClick:()=>S(n.id),className:"ml-1 p-0.5 hover:bg-blue-200 dark:hover:bg-blue-800 rounded",children:e(nt,{className:"size-3"})})]},n.id))})]})]}),(g||k)&&t("div",{className:"flex gap-2 mb-2",children:[g&&t(v,{variant:"outline",size:"sm",onClick:Y,disabled:a||f.length>=x,className:"text-xs",children:[e(Nt,{className:"size-3.5 mr-1.5"}),"Upload"]}),k&&t(v,{variant:"outline",size:"sm",onClick:()=>$(!0),disabled:a,className:"text-xs",children:[e(Rt,{className:"size-3.5 mr-1.5"}),"Search Documents"]})]}),t("div",{className:"flex items-end space-x-2",children:[t("div",{className:"flex flex-1 items-end space-x-1",children:[e("textarea",{ref:P,value:A,onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey){e.preventDefault();A.trim().length>0&&Q()}if("Escape"===e.key&&l&&r){const e=Date.now();e-ee.current<500?(X(),ee.current=0):ee.current=e}},onChange:e=>z(e.target.value),onPaste:W,disabled:a,placeholder:l?"Agent is working... (Esc Esc to stop)":g?"Ask anything... (drop or paste files)":p,className:`flex-1 w-full px-3 py-2.5 text-sm border border-gray-200 dark:border-gray-700 dark:bg-gray-800 dark:text-white focus:border-gray-300 dark:focus:border-gray-600 focus:outline-none focus:ring-1 focus:ring-gray-300 dark:focus:ring-gray-600 rounded-md resize-none overflow-hidden ${I||""}`,rows:2,style:{minHeight:"60px",maxHeight:"200px"}}),!_&&e(v,{variant:"ghost",className:"rounded-full",disabled:!o,onClick:()=>E(!0),alt:"Link Object",children:e(Lt,{className:"size-4"})})]}),l&&r&&!A.trim()?t(v,{onClick:X,disabled:i,className:"px-4 py-2.5 bg-red-600 hover:bg-red-700 text-white",title:"Stop the agent",children:[i?e(B,{size:"sm",className:"mr-2"}):e(Ut,{className:"size-4 mr-2"})," Stop"]}):t(v,{onClick:Q,disabled:a||s||!A.trim()||N,className:"px-4 py-2.5",title:N?"Wait for files to finish processing":void 0,children:[s?e(B,{size:"sm",className:"mr-2"}):e(Mt,{className:"size-4 mr-2"}),N?"Processing...":"Send"]})]}),e("div",{className:"text-xs text-muted mt-2 text-center",children:m>0?t("div",{className:"flex items-center justify-center",children:[e(Vt,{className:"h-3 w-3 mr-1 text-attention"}),t("span",{children:["Agent has ",m," active workstream",1!==m?"s":""," running"]})]}):l?"Agent is working... Press Esc twice or click Stop to interrupt":a?"Agent is processing, you can continue once it completes...":"Enter to send • Shift+Enter for new line"}),!_&&t(K,{isOpen:F,onClose:()=>E(!1),className:"min-w-[60vw]",children:[e(H,{children:"Link Object"}),e(G,{className:"pb-6",children:e(Bl,{onChange:e=>{const t=`[${e.properties?.title||e.name||"Object"}](store:${e.id})`,n=A||"",r=P.current?.selectionStart||n.length,a=n.substring(0,r)+t+n.substring(r);z(a),E(!1),setTimeout(()=>{if(P.current){P.current.focus();const e=r+t.length;P.current.setSelectionRange(e,e)}},100)}})})]}),k&&k({isOpen:D,onClose:()=>$(!1),onSelect:Z})]})}const bc=l.memo(function({plan:r,workstreamStatus:a,isOpen:s,onClose:i,plans:l=[],activePlanIndex:o=0,onChangePlan:c=()=>{}}){return s?t("div",{className:"h-full shadow-xl border border-muted/20 overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 border-b border-muted/20",children:[e("h3",{className:"font-bold text-base",children:"Plan"}),t(v,{variant:"ghost",onClick:i,children:[e(Re,{className:"size-4"}),e("span",{className:"sr-only",children:"Close"})]})]}),t("div",{className:"p-3 overflow-y-auto",style:{height:"calc(100% - 44px)",maxHeight:"calc(100vh - 150px)"},children:[t("div",{className:"mb-3 p-2 bg-info rounded-md border border-info",children:[e("div",{className:"text-xs font-medium text-info mb-1",children:"Task Progress"}),e("div",{className:"flex items-center gap-2",children:(()=>{const s=r.plan||[],i=s.length;let l=0;i>0&&s.forEach(e=>{if(e&&e.id){const t=e.id.toString();"completed"===a.get(t)&&l++}});const o=i>0?Math.round(l/i*100):0;return t(n,{children:[e("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5",children:e("div",{className:"bg-info h-2.5 rounded-full transition-all duration-300",style:{width:`${o}%`}})}),e("span",{className:"text-xs text-foreground font-medium whitespace-nowrap",children:i>0?`${l}/${i}`:"0/0"})]})})()})]}),l.length>1&&t("div",{className:"mb-3 flex items-center justify-between",children:[e(v,{variant:"ghost",onClick:()=>c(Math.min(l.length-1,o+1)),disabled:o>=l.length-1,children:"Older Plan"}),e("div",{className:"text-xs text-muted",children:l[o]?.timestamp?new Date(l[o].timestamp).toLocaleTimeString():"Unknown time"}),e(v,{variant:"ghost",onClick:()=>c(Math.max(0,o-1)),disabled:o<=0,children:"Newer Plan"})]}),t("div",{className:"rounded-md border border-muted/30",children:[e("div",{className:"p-2 border-b border-muted/30 bg-muted",children:e("div",{className:"font-medium text-xs",children:"Step-by-Step Plan"})}),e("div",{className:"divide-y divide-muted/20 max-h-[calc(100vh-350px)] overflow-y-auto",children:r.plan&&r.plan.length>0?r.plan.map((n,r)=>{const s=n.id?n.id.toString():`task-${r}`,i=n.goal||`Task ${r+1}`;let l=n.status||"pending";a.has(s)&&(l=a.get(s));let o=qt,c="text-muted";return"in_progress"===l?(o=Xe,c="text-info"):"completed"===l&&(o=Ve,c="text-success"),t("div",{className:"flex p-3 my-1",children:[e("div",{className:"mr-2 mt-0.5 flex-shrink-0 text-muted",children:s}),t("div",{className:"w-full",children:[e("div",{className:"text-sm font-medium mb-2 text-muted",children:i}),t("div",{className:"mt-1 flex justify-end items-center",children:[e("div",{className:`mr-2 mt-0.5 flex-shrink-0 ${c}`,children:e(o,{className:"size-3.5"})}),e(x,{variant:"completed"===l?"success":"in_progress"===l?"info":"default",children:"completed"===l?"Completed":"in_progress"===l?"In Progress":"Pending"})]})]})]},r)}):t("div",{className:"p-3 text-center text-muted italic",children:[e(qe,{className:"size-4 mx-auto mb-2 text-attention"}),e("p",{className:"text-xs",children:"No plan has been detected yet"}),e("p",{className:"text-xs mt-1",children:"Plans will appear here when the agent creates one"})]})})]}),(()=>{const n=new Set((r.plan||[]).filter(e=>e&&e.id).map(e=>e.id.toString())),s=Array.from(a.entries()).filter(([e])=>"main"!==e&&!n.has(e));return s.length>0?t("div",{className:"mt-3 rounded-md border border-gray-200 dark:border-gray-800",children:[e("div",{className:"p-2 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:e("div",{className:"font-medium text-xs",children:"Workstreams"})}),e("div",{className:"p-3",children:e("div",{className:"grid grid-cols-1 gap-2",children:s.map(([n,r])=>{let a=qt,s="text-gray-400",i="bg-gray-100 dark:bg-gray-800",l="Pending";return"in_progress"===r?(a=Xe,s="text-info",i="bg-info/20",l="In Progress"):"completed"===r&&(a=Ve,s="text-success",i="bg-success/20",l="Completed"),t("div",{className:`flex items-center p-1.5 rounded ${i}`,children:[e("div",{className:`mr-1.5 ${s}`,children:e(a,{className:"h-3.5 w-3.5"})}),e("div",{className:"flex-1",children:e("span",{className:"text-xs font-medium text-gray-800 dark:text-gray-300",children:n})}),e("span",{className:"text-xs font-medium",children:l})]},n)})})})]}):null})()]})]}):null});function vc(...e){return Kn(a(e))}function xc({error:n,chartTitle:r}){return e("div",{className:"flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4",children:t("div",{className:"text-center",children:[t("p",{className:"text-sm font-medium text-red-600 dark:text-red-400",children:["Cannot render ",r||"Vega-Lite"," chart"]}),e("p",{className:"text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate",children:n})]})})}function wc({isOpen:n,onClose:r,title:a,description:s,children:i}){return e(qn.Root,{open:n,onOpenChange:e=>!e&&r(),children:t(qn.Portal,{children:[e(qn.Overlay,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm transition-all duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),t(qn.Content,{className:"fixed inset-2 sm:inset-4 z-50 flex flex-col bg-white dark:bg-gray-900 rounded-xl shadow-2xl transition-all duration-300 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2",onEscapeKeyDown:r,children:[e(qn.Close,{asChild:!0,children:e("button",{onClick:r,className:"absolute top-3 right-3 z-10 p-2 rounded-lg bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-150 shadow-sm","aria-label":"Close fullscreen",children:e(Re,{className:"w-5 h-5 text-gray-600 dark:text-gray-300"})})}),e("div",{className:"flex-1 overflow-auto p-4 sm:p-6 animate-in fade-in-0 duration-500 delay-150",children:i}),e("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50 rounded-b-xl",children:t("div",{className:"flex flex-col",children:[e(qn.Title,{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a||"Dashboard"}),s&&e(qn.Description,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:s})]})})]})]})})}const Nc={categorical:["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"],blues:["#dbeafe","#93c5fd","#3b82f6","#1d4ed8","#1e3a8a"],purples:["#f3e8ff","#c4b5fd","#8b5cf6","#6d28d9","#4c1d95"],diverging:["#ef4444","#fca5a5","#fef3c7","#86efac","#22c55e"]};function kc(e,t){if(!e||!e.encoding)return!1;for(const n of t)for(const t of Object.values(e.encoding))if(t&&"object"==typeof t&&t.field===n)return!0;if(Array.isArray(e.layer))for(const n of e.layer)if(kc(n,t))return!0;return!1}function Cc(e,t){if(!e)return!1;const n=e=>{if(!e)return!1;const n=e.color?.field;return n&&t.includes(n)};if(n(e.encoding))return!0;if(Array.isArray(e.layer))for(const t of e.layer)if(n(t.encoding))return!0;return!1}function Sc(e,t=[]){const n=[];if(!e||"object"!=typeof e)return n;if(e.data&&"object"==typeof e.data){const r=e.data.url;"string"==typeof r&&r.startsWith("artifact:")&&n.push({path:[...t,"data"],artifactPath:r.replace(/^artifact:/,"").trim()})}const r=["layer","vconcat","hconcat","concat","spec","repeat","facet"];for(const a of r)if(a in e){const r=e[a];Array.isArray(r)?r.forEach((e,r)=>{n.push(...Sc(e,[...t,a,String(r)]))}):"object"==typeof r&&null!==r&&n.push(...Sc(r,[...t,a]))}return n}const _c=g(function({spec:r,artifactRunId:a}){const{title:s,description:i,spec:l,options:m}=r,[p,g]=c(!1),[f,y]=c(!1),[b,v]=c(null),[x,w]=c(!1),N=u(null),k=u(null),C=u(null),{client:S}=Kt(),_=ua(),j=u(S);j.current=S;const I=u(_);I.current=_;const[P,T]=c(null),[A,z]=c(!1),[F,E]=c(null),D=m?.mode||"chart",$="dashboard"===D,R=m?.enableFullscreen??$,O=m?.height||function(e,t){if("chart"===t)return 280;let n=1;if(e.vconcat)n=Array.isArray(e.vconcat)?e.vconcat.length:1;else if(e.concat){const t=e.columns||2,r=Array.isArray(e.concat)?e.concat.length:1;n=Math.ceil(r/t)}else e.facet&&(n=2);return Math.max(500,280*n+40)}(l,D);d(()=>{const e=Sc(l);if(0===e.length)return T(l),z(!1),void E(null);let t=!1;z(!0),E(null);return(async()=>{const n=new Map,r=j.current,s=I.current;for(const i of e)try{const e=i.path.join(".");let t;if(a&&!i.artifactPath.startsWith("agents/")){const e=ma(a,i.artifactPath,"inline");if(s)t=await s.getOrFetch(e,async()=>(await r.files.getArtifactDownloadUrl(a,i.artifactPath,"inline")).url);else{t=(await r.files.getArtifactDownloadUrl(a,i.artifactPath,"inline")).url}}else{const e=pa(i.artifactPath);if(s)t=await s.getOrFetch(e,async()=>(await r.files.getDownloadUrl(i.artifactPath)).url);else{t=(await r.files.getDownloadUrl(i.artifactPath)).url}}const l=await fetch(t);if(!l.ok)throw new Error(`Failed to fetch artifact data: ${l.statusText}`);let o;if(i.artifactPath.toLowerCase().endsWith(".csv")){const e=await l.text();o=Bn.parse(e,{header:!0,skipEmptyLines:!0,dynamicTyping:!0}).data}else{const e=await l.json();o=Array.isArray(e)?e:[e]}n.set(e,o)}catch(e){return console.error(`Failed to resolve artifact: ${i.artifactPath}`,e),void(t||E(`Failed to load data from artifact: ${i.artifactPath}`))}if(!t){const e=function(e,t){const n=JSON.parse(JSON.stringify(e));for(const[e,r]of t){const t=e.split(".");let a=n;for(let e=0;e<t.length-1&&void 0!==a[t[e]];e++)a=a[t[e]];const s=t[t.length-1];a[s]&&"object"==typeof a[s]&&(delete a[s].url,a[s].values=r)}return n}(l,n);T(e),z(!1)}})(),()=>{t=!0}},[l,a]);const[L,U]=c(!1),M=u(!1);d(()=>{const e=()=>{const e=document.documentElement.classList.contains("dark");e!==M.current&&(M.current=e,U(e))};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const[V,q]=c(0),B=u(0);d(()=>{if(!C.current)return;let e;const t=new ResizeObserver(t=>{clearTimeout(e),e=setTimeout(()=>{const e=t[0]?.contentRect.width;e&&e!==B.current&&(B.current=e,q(e))},100)});t.observe(C.current);const n=C.current.clientWidth;return B.current=n,q(n),()=>{clearTimeout(e),t.disconnect()}},[]);const W=o(()=>Sc(l).length>0,[l]),K=o(()=>{if(W&&!P)return null;let e=P||l;return e?(m?.parameterValues&&(e=function(e,t){if(!t||0===Object.keys(t).length)return e;const n=JSON.parse(JSON.stringify(e)),r=e=>{for(const n of e)n&&"object"==typeof n&&n.name&&n.name in t&&(n.value=t[n.name])};Array.isArray(n.params)&&r(n.params);const a=e=>{if(Array.isArray(e))for(const t of e)if(t&&Array.isArray(t.params)&&r(t.params),t.vconcat&&a(t.vconcat),t.hconcat&&a(t.hconcat),t.concat&&a(t.concat),Array.isArray(t.layer))for(const e of t.layer)e&&Array.isArray(e.params)&&r(e.params)};if(n.vconcat&&a(n.vconcat),n.hconcat&&a(n.hconcat),n.concat&&a(n.concat),Array.isArray(n.layer))for(const e of n.layer)e&&Array.isArray(e.params)&&r(e.params);return n}(e,m.parameterValues)),function(e){const t=JSON.parse(JSON.stringify(e)),n=["vconcat","hconcat","concat"];if(!n.some(e=>Array.isArray(t[e])))return t;const r=[];if(Array.isArray(t.params))for(const e of t.params)e&&"object"==typeof e&&e.name&&e.select&&r.push({name:e.name,param:e});if(0===r.length)return t;for(const{name:e,param:a}of r){const r=a.select?.fields||[],s="legend"===a.select?.bind;let i=null;for(const e of n)if(Array.isArray(t[e])){i=t[e];break}if(!i||0===i.length)continue;let l=0;for(let e=0;e<i.length;e++){const t=i[e];if(kc(t,r)||s&&Cc(t,r)){l=e;break}}const o=i[l];o.params||(o.params=[]),o.params.push(a),t.params=t.params.filter(t=>t.name!==e)}return Array.isArray(t.params)&&0===t.params.length&&delete t.params,t}(e)):null},[P,l,W,m?.parameterValues]),H=h((e,t)=>{if(!e||"object"!=typeof e)return e;if(e.hconcat&&Array.isArray(e.hconcat)){const n=e.hconcat.length,r=(e.spacing??10)*(n-1),a=Math.floor((t-r)/n);return{...e,hconcat:e.hconcat.map(e=>H(e,a))}}if(e.vconcat&&Array.isArray(e.vconcat))return{...e,vconcat:e.vconcat.map(e=>H(e,t))};if(e.concat&&Array.isArray(e.concat)){const n=e.columns??e.concat.length,r=(e.spacing??10)*(n-1),a=Math.floor((t-r)/n);return{...e,concat:e.concat.map(e=>H(e,a))}}const n=e.width;return"container"===n||"number"==typeof n&&n>t?{...e,width:t}:e},[]),G=h((e,t=!1)=>{if(!K)return null;const n=function(e){const t={background:"transparent",view:{stroke:"transparent"},range:{category:Nc.categorical,diverging:Nc.diverging,heatmap:Nc.purples,ramp:Nc.blues},mark:{tooltip:!0},bar:{tooltip:!0,cornerRadiusTopLeft:4,cornerRadiusTopRight:4},line:{tooltip:!0,strokeWidth:2.5,strokeCap:"round"},point:{tooltip:!0,size:60,filled:!0},area:{tooltip:!0,fillOpacity:.7,line:!0},rect:{tooltip:!0,cornerRadius:2},arc:{tooltip:!0,cornerRadius:4},circle:{tooltip:!0,size:80}};return e?{...t,axis:{labelColor:"#a1a1aa",titleColor:"#e4e4e7",gridColor:"#3f3f46",domainColor:"#52525b",tickColor:"#52525b",labelFont:"Inter, system-ui, sans-serif",titleFont:"Inter, system-ui, sans-serif",labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:"#a1a1aa",titleColor:"#e4e4e7",labelFont:"Inter, system-ui, sans-serif",titleFont:"Inter, system-ui, sans-serif",labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:"#fafafa",font:"Inter, system-ui, sans-serif",fontSize:14,fontWeight:600}}:{...t,axis:{labelColor:"#71717a",titleColor:"#3f3f46",gridColor:"#e4e4e7",domainColor:"#d4d4d8",tickColor:"#d4d4d8",labelFont:"Inter, system-ui, sans-serif",titleFont:"Inter, system-ui, sans-serif",labelFontSize:11,titleFontSize:12,titleFontWeight:500},legend:{labelColor:"#71717a",titleColor:"#3f3f46",labelFont:"Inter, system-ui, sans-serif",titleFont:"Inter, system-ui, sans-serif",labelFontSize:11,titleFontSize:12,symbolSize:100},title:{color:"#18181b",font:"Inter, system-ui, sans-serif",fontSize:14,fontWeight:600}}}(L),r=t?"undefined"!=typeof window?Math.min(window.innerWidth-80,1400):1200:V>0?V-24:500,a="vconcat"in K||"hconcat"in K||"concat"in K,i=a?{type:"pad",contains:"padding"}:{type:"fit",contains:"padding"};let l=K;a&&r&&(l=H(K,r));const o=l.width,c=a?void 0:"container"===o?r:o??r,{width:d,...u}=l;return{$schema:"https://vega.github.io/schema/vega-lite/v6.json",...!a&&c?{width:c}:{},height:t?void 0:e,autosize:i,...a?l:u,...s&&!K.title?{title:s}:{},config:{...n,...K.config}}},[K,s,L,V,H]),J=h(async()=>{const e=x?k.current:N.current;if(e&&!f)try{(await e.toCanvas(2)).toBlob(async e=>{e&&(await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),y(!0),setTimeout(()=>y(!1),2e3))},"image/png")}catch(e){console.error("Failed to copy chart:",e)}},[f,x]),Y=h(async()=>{const e=x?k.current:N.current;if(e&&!p){g(!0);try{const t=await e.toImageURL("png",2),n=document.createElement("a");n.download=`${s||"chart"}.png`,n.href=t,n.click()}catch(e){console.error("Failed to export chart:",e)}finally{g(!1)}}},[s,p,x]),Z=h(e=>{N.current=e,v(null)},[]),Q=h(e=>{k.current=e},[]),X=h(e=>{console.error("Vega-Lite rendering error:",e),v(e instanceof Error?e.message:"Unknown error")},[]),ee=h(()=>{w(e=>!e)},[]);d(()=>{v(null)},[l]);const te=({className:n})=>t("div",{className:vc("flex items-center gap-2",n),children:[t("button",{onClick:J,disabled:f,className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1",title:"Copy to clipboard",children:[e(f?Et:ft,{className:"w-3 h-3"}),f?"Copied":"Copy"]}),t("button",{onClick:Y,disabled:p,className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1",title:"Export as PNG",children:[e(ht,{className:"w-3 h-3"}),p?"Exporting...":"Export"]}),R&&t("button",{onClick:ee,className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors flex items-center gap-1",title:x?"Exit fullscreen":"Fullscreen",children:[e(x?Bt:gt,{className:"w-3 h-3"}),x?"Exit":"Fullscreen"]})]});if(A||W&&!P)return e("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm",children:t("div",{className:"flex flex-col gap-2 p-3",children:[e("div",{className:"flex items-center justify-between",children:e("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:s||"Chart"})}),e("div",{className:"flex items-center justify-center bg-gray-50 dark:bg-gray-800 rounded",style:{width:"100%",height:O},children:t("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e(Be,{className:"w-5 h-5 animate-spin"}),e("span",{className:"text-sm",children:"Loading data from artifacts..."})]})})]})});if(F)return e("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm",children:t("div",{className:"flex flex-col gap-2 p-3",children:[e("div",{className:"flex items-center justify-between",children:e("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:s||"Chart"})}),e("div",{style:{width:"100%",height:O},children:e(xc,{error:F,chartTitle:s})})]})});if(b)return e("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm",children:t("div",{className:"flex flex-col gap-2 p-3",children:[e("div",{className:"flex items-center justify-between",children:e("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:s||"Chart"})}),e("div",{style:{width:"100%",height:O},children:e(xc,{error:b,chartTitle:s})})]})});const ne=G(O),re=G(0,!0);return ne?("undefined"!=typeof window&&localStorage.getItem("DEBUG_VEGA_RENDERS")&&console.log("VegaLite rendering with spec:",{title:s,hasData:!!ne.data?.values,dataLength:ne.data?.values?.length}),t(n,{children:[e("div",{className:vc("bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm",$&&"border-2"),children:t("div",{className:"flex flex-col gap-2 p-3",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:s||($?"Dashboard":"Chart")}),$&&e("span",{className:"text-xs px-2 py-0.5 rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300",children:"Interactive"})]}),e(te,{})]}),i&&e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:i}),e("div",{ref:C,className:"bg-white dark:bg-gray-900 rounded overflow-hidden",style:{width:"100%",height:O,minWidth:0},children:e(Wn,{spec:ne,onEmbed:e=>Z(e.view),onError:X,options:{renderer:m?.renderer||"canvas",actions:!1}})})]})}),t(wc,{isOpen:x,onClose:()=>w(!1),title:s||($?"Dashboard":"Chart"),description:i,children:[e("div",{className:"w-full h-full min-h-[calc(100vh-200px)]",children:re&&e(Wn,{spec:re,onEmbed:e=>Q(e.view),onError:X,options:{renderer:m?.renderer||"canvas",actions:!1}})}),e("div",{className:"absolute bottom-6 right-6",children:e(te,{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700"})})]})]})):null},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId),jc=["#4f46e5","#06b6d4","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6"];class Ic extends f{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`Chart rendering error (${this.props.chartType}):`,e,t)}render(){return this.state.hasError?e("div",{className:"flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4",children:t("div",{className:"text-center",children:[t("p",{className:"text-sm font-medium text-red-600 dark:text-red-400",children:["Cannot render ",this.props.chartType," chart"]}),e("p",{className:"text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate",children:this.state.error?.message||"Unknown error"})]})}):this.props.children}}function Pc(e){return"vega-lite"===e.library}function Tc(e){return("recharts"===e.library||void 0===e.library)&&!("spec"in e)}function Ac(e){if(!isFinite(e))return String(e);const t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+"B":t>=1e6?(e/1e6).toFixed(1)+"M":t>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}const zc=g(function({spec:t,artifactRunId:n}){return Pc(t)?e(_c,{spec:t,artifactRunId:n}):e(Ec,{spec:t})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId);function Fc(e){if(e.chart)return e.chart;const t={BarChart:"bar",LineChart:"line",AreaChart:"area",PieChart:"pie",ScatterChart:"scatter",RadarChart:"radar",FunnelChart:"funnel",Treemap:"treemap",ComposedChart:"composed",RadialBarChart:"radialBar"};return e.type&&t[e.type]?t[e.type]:"bar"}const Ec=g(function({spec:r}){const a={...r,chart:Fc(r),xKey:r.xKey||r.x_axis?.data_key||"name",series:r.series||r.bars?.map(e=>({key:e.data_key||e.dataKey,color:e.fill||e.color,label:e.name}))||r.lines?.map(e=>({key:e.data_key||e.dataKey,color:e.stroke||e.color,label:e.name}))||[]},{chart:s,title:i,description:l,data:o,xKey:d,series:m,yAxis:p,options:g,nameKey:f,valueKey:y,yKey:b,axisKey:v,dataKey:x}=a,[w,N]=c(!1),[k,C]=c(!1),S=u(null),_=h(async()=>{if(S.current&&!k)try{const e=await Vn(S.current,{backgroundColor:"#ffffff",pixelRatio:2}),t=await fetch(e),n=await t.blob();await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error("Failed to copy chart:",e)}},[k]),j=h(async()=>{if(S.current&&!w){N(!0);try{const e=await Vn(S.current,{backgroundColor:"#ffffff",pixelRatio:2}),t=document.createElement("a");t.download=`${i||"chart"}.png`,t.href=e,t.click()}catch(e){console.error("Failed to export chart:",e)}finally{N(!1)}}},[i,w]),I=m||[],P=o||[],T=t(n,{children:[e(Hn,{dataKey:d,tick:{fontSize:12}}),e(Gn,{yAxisId:"left",tickFormatter:Ac,label:p?.left?.label?{value:p.left.label,angle:-90,position:"insideLeft"}:void 0}),I.some(e=>"right"===e.yAxisId)&&e(Gn,{yAxisId:"right",orientation:"right",tickFormatter:Ac,label:p?.right?.label?{value:p.right.label,angle:-90,position:"insideRight"}:void 0})]}),A=t(n,{children:[e(Jn,{strokeDasharray:"3 3"}),e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),e(Zn,{}),g?.referenceZero&&e(Qn,{y:0,stroke:"#999",strokeDasharray:"3 3"})]}),z=()=>I.map((t,n)=>{const r=t.color||jc[n%jc.length],a=t.yAxisId||"left";return"line"===s?e(ar,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:r,dot:t.dot??!1,yAxisId:a},t.key):"area"===s?e(sr,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:r,fill:r,fillOpacity:.3,stackId:g?.stacked?t.stackId||"stack":void 0,yAxisId:a},t.key):"bar"===s||"bar"===t.type?e(ir,{dataKey:t.key,name:t.label||t.key,fill:r,stackId:g?.stacked?t.stackId||"stack":void 0,yAxisId:a},t.key):"area"===t.type?e(sr,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:r,fill:r,fillOpacity:.3,stackId:g?.stacked?t.stackId||"stack":void 0,yAxisId:a},t.key):e(ar,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:r,dot:t.dot??!1,yAxisId:a},t.key)});return e("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm my-5",children:t("div",{className:"flex flex-col gap-2 p-4",children:[t("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:i||"Chart"}),t("div",{className:"flex items-center gap-2 print:hidden chart-actions",children:[t("button",{onClick:_,disabled:k,className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1",title:"Copy to clipboard",children:[e(k?Et:ft,{className:"w-3 h-3"}),k?"Copied":"Copy"]}),t("button",{onClick:j,disabled:w,className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1",title:"Export as PNG",children:[e(ht,{className:"w-3 h-3"}),w?"Exporting...":"Export"]})]})]}),l&&e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:l}),e("div",{ref:S,className:"bg-white dark:bg-gray-900 rounded",style:{width:"100%",height:280,minWidth:0},children:e(Ic,{chartType:s,children:e(Xn,{width:"100%",height:"100%",children:(()=>{switch(s){case"bar":return t(rr,{data:P,children:[T,A,z()]});case"line":return t(nr,{data:P,children:[T,A,z()]});case"area":return t(tr,{data:P,children:[T,A,z()]});case"composed":default:return t(er,{data:P,children:[T,A,z()]});case"pie":return t(lr,{children:[e(or,{data:P,dataKey:y||"value",nameKey:f||"name",cx:"50%",cy:"50%",innerRadius:g?.innerRadius||0,outerRadius:100,label:!1!==g?.showLabels,children:P.map((t,n)=>e(cr,{fill:jc[n%jc.length]},`cell-${n}`))}),e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),e(Zn,{})]});case"scatter":return(()=>{const n=d,r=b||"y";return t(dr,{children:[e(Jn,{strokeDasharray:"3 3"}),e(Hn,{dataKey:n,name:n,tick:{fontSize:12}}),e(Gn,{dataKey:r,name:r,tickFormatter:Ac}),e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),e(Zn,{}),I.length>0?I.map((t,n)=>e(ur,{name:t.label||t.key,data:P,fill:t.color||jc[n%jc.length]},t.key)):e(ur,{name:"Data",data:P,fill:jc[0]})]})})();case"radar":return(()=>{const n=v||d;return t(mr,{cx:"50%",cy:"50%",outerRadius:100,data:P,children:[e(pr,{}),e(hr,{dataKey:n,tick:{fontSize:11}}),e(gr,{tickFormatter:Ac}),I.map((t,n)=>e(fr,{name:t.label||t.key,dataKey:t.key,stroke:t.color||jc[n%jc.length],fill:t.color||jc[n%jc.length],fillOpacity:.3},t.key)),e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),e(Zn,{})]})})();case"radialBar":return(()=>{const n=f||"name",r=y||"value",a=g?.startAngle??180,s=g?.endAngle??0;return t(yr,{cx:"50%",cy:"50%",innerRadius:g?.innerRadius??30,outerRadius:100,barSize:15,data:P,startAngle:a,endAngle:s,children:[e(br,{label:{position:"insideStart",fill:"#fff",fontSize:11},background:!0,dataKey:r,children:P.map((t,n)=>e(cr,{fill:jc[n%jc.length]},`cell-${n}`))}),e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),e(Zn,{iconSize:10,layout:"vertical",verticalAlign:"middle",align:"right",formatter:(e,t)=>{const a=P.find(a=>a[n]===e||a[r]===t.payload?.value);return a?a[n]:e}})]})})();case"funnel":return(()=>{const n=f||"name",r=y||"value";return t(vr,{children:[e(Yn,{formatter:e=>"number"==typeof e?Ac(e):String(e)}),t(xr,{dataKey:r,data:P,isAnimationActive:!0,children:[P.map((t,n)=>e(cr,{fill:jc[n%jc.length]},`cell-${n}`)),!1!==g?.showLabels&&e(wr,{position:"center",fill:"#fff",stroke:"none",dataKey:n})]})]})})();case"treemap":return e(Nr,{data:P,dataKey:x||y||"value",aspectRatio:4/3,stroke:"#fff",fill:"#4f46e5",content:({x:r,y:a,width:s,height:i,name:l,value:o,index:c})=>t("g",{children:[e("rect",{x:r,y:a,width:s,height:i,style:{fill:jc[c%jc.length],stroke:"#fff",strokeWidth:2}}),s>50&&i>30&&t(n,{children:[e("text",{x:r+s/2,y:a+i/2-7,textAnchor:"middle",fill:"#fff",fontSize:12,children:l}),e("text",{x:r+s/2,y:a+i/2+10,textAnchor:"middle",fill:"#fff",fontSize:11,children:Ac(o)})]})]})})}})()})})})]})})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)),Dc=g(function({code:t}){const n=o(()=>{try{return JSON.parse(t)}catch{return null}},[t]);return n?e(zc,{spec:n}):null}),$c=g(function({code:t}){const n=o(()=>{try{return{library:"vega-lite",spec:JSON.parse(t)}}catch{return null}},[t]);return n?e(_c,{spec:n}):null}),Rc={chart:Dc,"vega-lite":$c,vegalite:$c,"fusion-fragment":mn};function Oc({url:t,code:n}){const[r,a]=c(null);return d(()=>{import(t).then(e=>{a(()=>e.default)}).catch(e=>{console.error("Failed to load remote widget component from ",t,e)})},[t]),r?e(r,{code:n}):null}function Lc({children:t}){const{client:n}=Kt(),[r,a]=c(Rc);return d(()=>{(async function(t){const n=await t.apps.getInstalledApps("tools"),r=new Set;for(const e of n)for(const t of e.manifest.tool_collections||[]){const e=un(t).url;if(e.startsWith("http://")||e.startsWith("https://")){const t=e.indexOf("/api/");if(t>0){const n=e.substring(0,t);r.add(n+"/api/widgets")}}}const a=await Promise.all(Array.from(r).map(t=>fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch widgets: ${e.status} ${e.statusText}`);return e.json()}).then(t=>{const n=[],r=t.widgets;for(const[t,a]of Object.entries(r))n.push({name:t,component:t=>e(Oc,{url:a.url,code:t.code})});return n}).catch(()=>(console.error("Failed to fetch skill widgets from ",t),null)))),s={};for(const e of a.flat())e&&(s[e.name]=e.component);return s})(n).then(e=>{a({...Rc,...e})})},[]),e(Tn,{components:r,children:t})}function Uc(t){const{run:n,startWorkflow:r}=t;if(n){const r="runId"in n?n:{runId:n.run_id,workflowId:n.workflow_id};return e(Lc,{children:e(qc,{...t,run:r})})}return r?e(Vc,{...t}):e(Mc,{})}function Mc(){return t(de,{status:"info",icon:e(Ye,{className:"size-16 text-muted mb-4"}),children:[e("div",{className:"text-base font-medium text-muted",children:"No agent currently running"}),e("div",{className:"mt-3 text-sm text-muted",children:"Select an interaction and click Start to start an agent"})]})}function Vc({initialMessage:n,startWorkflow:r,onClose:a,isModal:s=!1,fullWidth:i=!1,placeholder:l="Type your message...",startButtonText:o="Start Agent",title:m="Start New Conversation",getAttachedDocs:p,onAttachmentsSent:g,acceptedFileTypes:f=".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.png,.jpg,.jpeg,.gif,.webp",maxFiles:y=5}){const{client:x}=Kt(),[w,N]=c(""),[k,C]=c(!1),[S,_]=c(),j=b(),I=u(null),P=u(null),[T,A]=c([]),[z,F]=c(!1),E=u(0),D=h(e=>{e.preventDefault(),e.stopPropagation(),E.current++,e.dataTransfer?.types?.includes("Files")&&F(!0)},[]),$=h(e=>{e.preventDefault(),e.stopPropagation()},[]),R=h(e=>{e.preventDefault(),e.stopPropagation(),E.current--,0===E.current&&F(!1)},[]),O=h(e=>{if(e.preventDefault(),e.stopPropagation(),E.current=0,F(!1),e.dataTransfer?.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);A(e=>[...e,...t].slice(0,y))}},[y]),L=h(e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);A(e=>[...e,...t].slice(0,y))}e.target.value=""},[y]),U=h(e=>{A(t=>t.filter((t,n)=>n!==e))},[]);d(()=>{I.current&&I.current.focus()},[]);const M=async()=>{if(!r)return;const e=w.trim();if(e&&!k){C(!0);try{sessionStorage.removeItem("plan-panel-shown"),j({title:T.length>0?"Starting agent and uploading files...":"Starting agent...",status:"info",duration:3e3});const t=p?.()||[];let n=e;if(t.length>0&&!/store:\S+/.test(e)){n=[e,"","Attachments:",...t.map(e=>`store:${e}`)].join("\n")}if(T.length>0){const e=T.map(e=>e.name).join(", ");n=[n,"",`[System: ${T.length} file(s) are being uploaded: ${e}. Please wait for the "Files Ready" notification before processing them.]`].join("\n")}const a=await r(n);if(a){const e=[];if(T.length>0){for(const t of T)try{const n=`files/${t.name}`;await x.files.uploadArtifact(a.run_id,n,t),await x.store.workflows.sendSignal(a.workflow_id,a.run_id,"FileUploaded",{id:`file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:t.name,content_type:t.type||"application/octet-stream",reference:`artifact:${n}`,artifact_path:n}),e.push(t.name)}catch(e){console.error(`Failed to upload staged file ${t.name}:`,e)}if(e.length>0)try{await x.store.workflows.sendSignal(a.workflow_id,a.run_id,"UserInput",{message:`[Files Ready] All ${e.length} file(s) have been uploaded and are now available: ${e.join(", ")}. You can now process them.`,metadata:{type:"files_ready",files:e}})}catch(e){console.error("Failed to send files ready signal:",e)}A([])}g?.(),_({runId:a.run_id,workflowId:a.workflow_id}),N(""),j({title:"Agent started",status:"success",duration:3e3})}}catch(e){j({title:"Error starting workflow",status:"error",duration:3e3,description:e instanceof Error?e.message:"Unknown error"})}finally{C(!1)}}},V=h(()=>{const e=I.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[]);return d(()=>{V()},[w,V]),S?e(qc,{onClose:a,isModal:s,initialMessage:n,placeholder:l,run:S,title:m}):t("div",{className:"flex flex-col h-full bg-white dark:bg-gray-900 overflow-hidden border-0 relative "+(z?"ring-2 ring-blue-400 ring-inset":""),onDragEnter:D,onDragOver:$,onDragLeave:R,onDrop:O,children:[z&&e("div",{className:"absolute inset-0 flex items-center justify-center bg-blue-100/80 dark:bg-blue-900/40 z-50 pointer-events-none rounded-lg",children:t("div",{className:"text-blue-600 dark:text-blue-400 font-medium flex items-center gap-2 text-lg",children:[e(Nt,{className:"size-6"}),"Drop files to stage for upload"]})}),e("input",{ref:P,type:"file",multiple:!0,accept:f,onChange:L,className:"hidden"}),t("div",{className:"flex items-center justify-between py-2 px-3 border-b border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-900",children:[t("div",{className:"flex items-center space-x-2",children:[e("div",{className:"p-1",children:e(Wt,{className:"size-3.5 text-muted"})}),e("span",{className:"font-medium text-sm text-gray-700 dark:text-gray-300",children:m})]}),a&&!s&&e(v,{size:"xs",variant:"ghost",onClick:a,title:"Close",className:"text-slate-500 hover:text-slate-700",children:e(nt,{className:"size-4"})})]}),t("div",{className:"flex-1 overflow-y-auto px-4 py-6 bg-white dark:bg-gray-900 flex flex-col "+(i?"items-start justify-start":"items-center justify-center"),children:[n&&e("div",{className:"px-4 py-3 mb-4 bg-blue-50/80 dark:bg-blue-900/30 border-l-2 border-blue-400 dark:border-blue-500 text-blue-700 dark:text-blue-300 "+(i?"w-full":"max-w-md"),children:n}),t("div",{className:"bg-white dark:bg-slate-800 p-4 border-l-2 border-blue-400 dark:border-blue-500 "+(i?"w-full":"max-w-md"),children:[e("div",{className:"text-base text-slate-600 dark:text-slate-300 font-medium",children:"Enter a message to start a conversation"}),t("div",{className:"mt-3 text-sm text-slate-500 dark:text-slate-400",children:["Type your question below and press Enter or click ",o," ","to begin"]})]})]}),t("div",{className:"py-3 px-3 border-t border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-900",children:[T.length>0&&e("div",{className:"flex flex-wrap gap-2 mb-3",children:T.map((n,r)=>t("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-attention/10 text-attention rounded-md text-sm",children:[e(Rt,{className:"size-3.5"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),e("span",{className:"text-xs opacity-70",children:"Staged"}),e("button",{onClick:()=>U(r),className:"ml-1 p-0.5 hover:bg-attention/20 rounded",children:e(nt,{className:"size-3"})})]},`${n.name}-${r}`))}),e("div",{className:"flex gap-2 mb-2",children:t(v,{variant:"outline",size:"sm",onClick:()=>P.current?.click(),disabled:k||T.length>=y,className:"text-xs",children:[e(Nt,{className:"size-3.5 mr-1.5"}),"Upload"]})}),t("div",{className:"flex items-end gap-2",children:[e("div",{className:"flex-1",children:e("textarea",{ref:I,value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),M())},placeholder:l,disabled:k,rows:2,className:"w-full py-2.5 px-3 text-sm border border-gray-200 dark:border-gray-700 dark:bg-gray-800 dark:text-white focus:border-gray-300 dark:focus:border-gray-600 focus:outline-none focus:ring-1 focus:ring-gray-300 dark:focus:ring-gray-600 rounded-md resize-none overflow-hidden",style:{minHeight:"60px",maxHeight:"200px"}})}),t(v,{onClick:M,disabled:!w.trim()||k,className:"px-3 py-2.5 bg-gray-800 dark:bg-gray-700 hover:bg-gray-700 dark:hover:bg-gray-600 text-white text-xs rounded-md transition-colors",children:[k?e(B,{size:"sm",className:"mr-1.5"}):e(Mt,{className:"size-3.5 mr-1.5"}),o]})]}),e("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2 text-center",children:T.length>0?`${T.length} file${T.length>1?"s":""} staged - will upload when conversation starts`:"Enter to send • Shift+Enter for new line"})]})]})}function qc({run:n,title:r,interactive:a=!0,onClose:s,isModal:i=!1,fullWidth:l=!1,placeholder:m="Type your message...",resetWorkflow:p,uploadedFiles:g,onRemoveFile:f,acceptedFileTypes:y,maxFiles:x,renderDocumentSearch:w,selectedDocuments:N,onRemoveDocument:k,hideObjectLinking:C,getAttachedDocs:S,onAttachmentsSent:_,isUploading:j=!1,getMessageContext:I,inputContainerClassName:P,inputClassName:T,fusionData:A}){const{client:z}=Kt(),F=u(null),E=u(null),[D,$]=c([]),[R,O]=c(!1),[L,U]=c(!1),[M,V]=c("sliding"),[q,B]=c(!i),[W,Y]=c(!1),[Z,Q]=c([]),[X,ee]=c(0),[te,ne]=c(new Map),[re,ae]=c(0),se=b(),[ie,le]=c(a),[oe,ce]=c(null),[ue,me]=c(new Map),[pe,he]=c(new Map),ge=o(()=>Array.from(pe.values()).some(e=>e.status===dn.UPLOADING||e.status===dn.PROCESSING),[pe]),fe=u(new Map),ye=u(null),[be,ve]=c(0),[xe,we]=c(0),[Ne,ke]=c(!1),Ce=u(null),Se=h(()=>{fe.current.size>0&&(me(new Map(fe.current)),we(e=>e+1)),ye.current=null},[]),[_e,je]=c(!1),Ie=u(0),Pe=o(()=>{const e=Z[X]||{plan:{plan:[]},timestamp:0},t=te.get(e.timestamp)||new Map;return{plan:e.plan,workstreamStatus:t}},[Z,X,te]),Te=h(()=>{B(e=>(e||sessionStorage.setItem("plan-panel-shown","true"),!e))},[]),Ae=h(e=>{ee(e)},[]),ze=h(()=>{B(!1)},[]);d(()=>{if(!R){const e=setInterval(()=>{ae(()=>Math.floor(Math.random()*(Xr.length-1)))},4e3);return()=>clearInterval(e)}},[R]);d(()=>($([]),Q([]),ee(0),ne(new Map),B(!1),ce(null),me(new Map),(async()=>{try{const e=await z.store.workflows.getRunDetails(n.runId,n.workflowId);ce(e.status)}catch(e){console.error("Failed to check workflow status:",e)}})(),z.store.workflows.streamMessages(n.workflowId,n.runId,e=>{if(e.type===Ht.STREAMING_CHUNK){const t=e.details,n=t?.activity_id||t?.streaming_id;if(!n)return;ve(e=>e+1),ke(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>ke(!1),50);const r=fe.current.get(n)||{text:"",workstreamId:e.workstream_id,startTimestamp:Date.now(),activityId:t?.activity_id},a=r.text+(e.message||"");return fe.current.set(n,{text:a,workstreamId:e.workstream_id,isComplete:t.is_final,startTimestamp:r.startTimestamp,activityId:t?.activity_id}),void(null===ye.current&&(ye.current=requestAnimationFrame(Se)))}if(e.type===Ht.SYSTEM){const t=e.details;if("file_processing"===t?.system_type&&t.files)return void he(e=>{const n=new Map(e);for(const e of t.files)n.set(e.id,e);return n})}if((e.type===Ht.THOUGHT||e.type===Ht.ANSWER)&&e.details?.activity_id){const t=e.details.activity_id;fe.current.delete(t),me(e=>{if(e.has(t)){const n=new Map(e);return n.delete(t),n}return e})}e.type!==Ht.COMPLETE&&e.type!==Ht.IDLE||fe.current.size>0&&Se(),e.message&&$(t=>{if(t.find(t=>t.timestamp===e.timestamp))return t;if(e.type===Ht.QUESTION&&!e.details?._optimistic){const n=t.filter(t=>!(t.type===Ht.QUESTION&&t.details?._optimistic&&t.message===e.message));return ea(n,e),[...n]}return ea(t,e),[...t]})}),()=>{$([]),null!==ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),fe.current.clear()}),[n.runId,z.store.workflows,Se]),d(()=>{O(!function(e){if(!e.length)return!0;const t=new Map;if(e.forEach(e=>{const n=na(e);t.has(n)||t.set(n,[]),t.get(n).push(e)}),console.log("[isInProgress] Workstreams found:",Array.from(t.keys())),1===t.size&&!t.has("main")){const e=t.keys().next().value||"unknown";console.log(`[isInProgress] Only one workstream found (${e}), treating as main`);const n=t.get(e),r=n[n.length-1];return console.log(`[isInProgress] Last message type in only workstream: ${r.type}`),ta.includes(r.type)?(console.log("[isInProgress] Only workstream is completed"),!1):(console.log("[isInProgress] Only workstream is still in progress"),!0)}if(t.has("main")){const e=t.get("main");if(0===e.length)return console.log("[isInProgress] Main workstream exists but has no messages, still in progress"),!0;const n=e[e.length-1];return console.log(`[isInProgress] Last message type in main workstream: ${n.type}`),ta.includes(n.type)?(console.log("[isInProgress] Main workstream is completed"),!1):(console.log("[isInProgress] Main workstream is still in progress"),!0)}console.log("[isInProgress] Multiple workstreams but no main, checking if any are still active");for(const[e,n]of t.entries())if(n.length>0){const t=n[n.length-1];if(!ta.includes(t.type))return console.log(`[isInProgress] Workstream ${e} is still active`),!0}return console.log("[isInProgress] All workstreams are completed"),!1}(D)),0===Z.length&&B(!1)},[D,Z.length]),d(()=>{if(1===Z.length&&!q&&!sessionStorage.getItem("plan-panel-shown")){const e=setTimeout(()=>{B(!0),sessionStorage.setItem("plan-panel-shown","true")},500);return()=>clearTimeout(e)}D.forEach(e=>{if(e.type===Ht.PLAN)try{console.log("PLAN message received:",e.type);let t=null;if(e.details&&"object"==typeof e.details&&e.details.plan&&Array.isArray(e.details.plan)&&(console.log("Valid plan array found in message.details.plan"),t={plan:e.details.plan}),t){const n="number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime();if(-1===Z.findIndex(e=>e.timestamp===n)&&t){console.log("Adding new plan to plans array");const e={plan:t,timestamp:n};console.log("Adding plan to plans array:",e),Q(t=>{const n=[e,...t];return console.log("New plans array:",n),n}),ee(0),console.log("Setting showSlidingPanel to true"),B(!0);const r=new Map;r.set("main","in_progress"),Array.isArray(t.plan)&&t.plan.forEach(e=>{if(e&&"object"==typeof e&&e.id){const t=e.id.toString();r.set(t,e.status||"pending")}}),ne(e=>{const t=new Map(e);return t.set(n,r),t})}}}catch(e){console.error("Failed to parse plan from message:",e)}e.type===Ht.UPDATE&&e.details&&e.details.updates&&Array.isArray(e.details.updates)&&console.log("Ignoring UPDATE message with details.updates - waiting for PLAN message with full plan")});const e=D[D.length-1];e&&(e.type===Ht.TERMINATED?(le(!1),ce("TERMINATED")):le(!!a||e.type===Ht.REQUEST_INPUT))},[D,Z,X]);const Fe=e=>{const t=e.trim();if(!t||L)return;if(ge)return void se({status:"warning",title:"Files Still Processing",description:"Please wait for all files to finish processing before sending",duration:3e3});U(!0);const r=Date.now(),a={timestamp:r,workflow_run_id:n.runId,type:Ht.QUESTION,message:t,workstream_id:"main",details:{_optimistic:!0}};console.log("[Optimistic] Adding user message:",t),$(e=>{const t=[...e,a];return t.sort((e,t)=>("number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime())-("number"==typeof t.timestamp?t.timestamp:new Date(t.timestamp).getTime())),console.log("[Optimistic] Messages after add:",t.length,"messages"),t});const s=S?.()||[],i=I?.()||{};let l=t;if(s.length>0&&!/store:\S+/.test(t)){l=[t,"","Attachments:",...s.map(e=>`store:${e}`)].join("\n")}const o={...s.length>0?{attached_docs:s}:{},...i};z.store.workflows.sendSignal(n.workflowId,n.runId,"UserInput",{message:l,metadata:Object.keys(o).length>0?o:void 0}).then(()=>{O(!1),_?.()}).catch(e=>{$(e=>e.filter(e=>e.timestamp!==r)),se({status:"error",title:"Failed to Send Message",description:e instanceof Error?e.message:"Unknown error",duration:3e3})}).finally(()=>{U(!1)})},Ee=h(async e=>{for(const t of e){const e=`file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,r=`files/${t.name}`,a={id:e,name:t.name,content_type:t.type||"application/octet-stream",size:t.size,status:dn.UPLOADING,started_at:Date.now()};he(t=>new Map(t).set(e,a));try{await z.files.uploadArtifact(n.runId,r,t),he(t=>{const n=new Map(t),a=n.get(e);return a&&(a.status=dn.PROCESSING,a.artifact_path=r,a.reference=`artifact:${r}`),n}),await z.store.workflows.sendSignal(n.workflowId,n.runId,"FileUploaded",{id:e,name:t.name,content_type:t.type||"application/octet-stream",reference:`artifact:${r}`,artifact_path:r})}catch(t){he(n=>{const r=new Map(n),a=r.get(e);return a&&(a.status=dn.ERROR,a.error=t instanceof Error?t.message:"Upload failed",a.completed_at=Date.now()),r}),se({status:"error",title:"Upload Failed",description:t instanceof Error?t.message:"Failed to upload file",duration:3e3})}}},[z,n,se]),De=h(e=>{e.preventDefault(),e.stopPropagation(),Ie.current++,n&&e.dataTransfer?.types?.includes("Files")&&je(!0)},[n]),$e=h(e=>{e.preventDefault(),e.stopPropagation()},[]),Re=h(e=>{e.preventDefault(),e.stopPropagation(),Ie.current--,0===Ie.current&&je(!1)},[]),Oe=h(e=>{if(e.preventDefault(),e.stopPropagation(),Ie.current=0,je(!1),n&&e.dataTransfer?.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);Ee(t)}},[n,Ee]),Le=r||n.workflowId.split(":")[2]||"Agent Conversation",[Ue,Me]=c(!1),Ve=e(da,{children:e(Hr,{children:t("div",{className:"flex flex-col lg:flex-row gap-2 h-full relative overflow-hidden "+(_e?"ring-2 ring-blue-400 ring-inset":""),onDragEnter:De,onDragOver:$e,onDragLeave:Re,onDrop:Oe,children:[_e&&e("div",{className:"absolute inset-0 flex items-center justify-center bg-blue-100/80 dark:bg-blue-900/40 z-50 pointer-events-none rounded-lg",children:t("div",{className:"text-blue-600 dark:text-blue-400 font-medium flex items-center gap-2 text-lg",children:[e(Nt,{className:"size-6"}),"Drop files to upload"]})}),t("div",{ref:E,className:"flex flex-col min-h-0 border-0 "+(q?"w-full lg:w-2/3 flex-1 min-h-[50vh]":l?"flex-1 w-full":"flex-1 mx-auto "+(i?"":"max-w-4xl")),children:[e("div",{className:"flex-shrink-0",children:e(Ea,{title:Le,isCompleted:R,onClose:s,isModal:i,run:n,viewMode:M,onViewModeChange:V,showPlanPanel:q,hasPlan:Z.length>0,onTogglePlanPanel:Te,onDownload:async()=>{try{const e=await async function(e,t){return e.files.getDownloadUrl(`agents/${t}/conversation.json`).then(e=>e.url)}(z,n.runId);e&&window.open(e,"_blank")}catch(e){console.error("Failed to download conversation",e),se({status:"error",title:"Failed to download conversation",duration:3e3})}},onCopyRunId:()=>{navigator.clipboard.writeText(n.runId),se({status:"success",title:"Run ID copied",duration:2e3})},resetWorkflow:p,onExportPdf:()=>{E.current?Me(!0):se({status:"error",title:"PDF export failed",description:"No conversation content available to export",duration:3e3})},isReceivingChunks:Ne})}),0!==D.length||R?e(Pa,{messages:D,bottomRef:F,viewMode:M,isCompleted:R,plan:Pe.plan,workstreamStatus:Pe.workstreamStatus,showPlanPanel:q,onTogglePlanPanel:Te,plans:Z,activePlanIndex:X,onChangePlan:Ae,taskLabels:Pe.plan.plan?.reduce((e,t)=>(t.id&&t.goal&&e.set(t.id.toString(),t.goal),e),new Map),streamingMessages:ue,onSendMessage:Fe,thinkingMessageIndex:re}):e("div",{className:"flex-1 flex flex-col items-center justify-center h-full text-center py-6",children:t("div",{className:"p-5 max-w-md border border-info rounded-lg shadow-sm",children:[t("div",{className:"flex items-center space-x-3 mb-3",children:[e(Ur,{size:"sm",color:"blue"}),e("div",{className:"text-sm text-muted font-medium",children:Xr[re]})]}),e("div",{className:"mt-4 flex justify-center",children:e(Lr,{color:"blue",className:"mt-1"})})]})}),e("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:oe&&"RUNNING"!==oe?t(de,{status:"COMPLETED"===oe?"success":"done",icon:null,className:"m-2",children:["This Workflow is ",oe]}):ie&&e(yc,{onSend:Fe,onStop:async()=>{if(!W){Y(!0);try{await z.store.workflows.sendSignal(n.workflowId,n.runId,"Stop",{message:"User requested stop"}),se({status:"info",title:"Agent Interrupted",description:"Type your message to give new instructions",duration:3e3}),O(!0)}catch(e){se({status:"error",title:"Failed to Interrupt",description:e instanceof Error?e.message:"Unknown error",duration:3e3})}finally{Y(!1)}}},disabled:j,isSending:L||j,isStopping:W,isStreaming:!R,isCompleted:R,activeTaskCount:(()=>{if(!D.length)return 0;const e=new Map;D.forEach(t=>{const n=na(t);"main"!==n&&"all"!==n&&(e.has(n)||e.set(n,[]),e.get(n).push(t))});let t=0;for(const[n,r]of e.entries())if(r.length>0){const e=r[r.length-1];[Ht.COMPLETE,Ht.IDLE].includes(e.type)||t++}return t})(),placeholder:m,onFilesSelected:Ee,uploadedFiles:g,onRemoveFile:f,acceptedFileTypes:y,maxFiles:x,processingFiles:pe,hasProcessingFiles:ge,renderDocumentSearch:w,selectedDocuments:N,onRemoveDocument:k,hideObjectLinking:C,className:P,inputClassName:T})})]}),q&&e("div",{className:"w-full lg:w-1/3 min-h-[50vh] lg:h-full border-t lg:border-t-0 lg:border-l",children:e(bc,{plan:Pe.plan,workstreamStatus:Pe.workstreamStatus,isOpen:q,onClose:ze,plans:Z,activePlanIndex:X,onChangePlan:Ae})}),t(K,{isOpen:Ue,onClose:()=>Me(!1),children:[e(H,{children:"Export conversation as PDF"}),t(G,{children:[e("p",{className:"mb-2",children:"This will open your browser's print dialog with the current conversation."}),e("p",{className:"text-sm text-muted",children:'To save a PDF, choose "Save as PDF" or a similar option in the print dialog.'})]}),t(J,{align:"right",children:[e(v,{variant:"ghost",size:"sm",onClick:()=>Me(!1),children:"Cancel"}),e(v,{size:"sm",onClick:()=>{if(!E.current)return void se({status:"error",title:"PDF export failed",description:"No conversation content available to export",duration:3e3});const e=`${Le} - ${n.runId}`,t=function(e,t){if("undefined"==typeof window||"undefined"==typeof document)return!1;const n=document.createElement("iframe");n.style.position="fixed",n.style.right="0",n.style.bottom="0",n.style.width="0",n.style.height="0",n.style.border="0",n.style.visibility="hidden",document.body.appendChild(n);const r=n.contentWindow;if(!r)return n.parentNode?.removeChild(n),!1;const a=r.document;return a.open(),a.write(`<!doctype html><html><head><title>${t}</title></head><body></body></html>`),a.close(),a.title=t,document.querySelectorAll('link[rel="stylesheet"], style').forEach(e=>{a.head.appendChild(e.cloneNode(!0))}),a.body.innerHTML=e.innerHTML,r.focus(),r.print(),setTimeout(()=>{n.parentNode?.removeChild(n)},1e3),!0}(E.current,e);t?(se({status:"success",title:"PDF export ready",description:"Use your browser's Print dialog to save as PDF",duration:4e3}),Me(!1)):se({status:"error",title:"PDF export failed",description:"Unable to open print preview",duration:4e3})},children:"Open print dialog"})]})]})]})})});return A?e(pn,{data:A,sendMessage:Fe,ChartComponent:_c,artifactRunId:n.runId,children:Ve}):Ve}function Bc({messages:t}){const n=l.useMemo(()=>[...t].sort((e,t)=>("number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime())-("number"==typeof t.timestamp?t.timestamp:new Date(t.timestamp).getTime())),[t]);return e("div",{className:"flex flex-col overflow-y-auto space-y-6 py-4",children:n.map((t,n)=>e(ga,{message:t,showPulsatingCircle:!1},`${t.timestamp}-${n}`))})}function Wc({messages:t,bottomRef:n,className:r,messagesClassName:a,emptyClassName:s}){const i=l.useRef(null);d(()=>{n.current&&n.current.scrollIntoView({behavior:"smooth"})},[t,n]);const o=l.useMemo(()=>[...t].sort((e,t)=>("number"==typeof e.timestamp?e.timestamp:new Date(e.timestamp).getTime())-("number"==typeof t.timestamp?t.timestamp:new Date(t.timestamp).getTime())),[t]);return e("div",{ref:i,className:`flex-1 min-h-0 h-full overflow-y-auto py-4 px-4 sm:px-6 lg:px-8 bg-white flex flex-col ${r||""}`,"data-testid":"messages-container",children:0===o.length?e("div",{className:`flex items-center justify-center h-full text-center py-8 ${s||""}`,children:e("div",{className:"flex items-center px-4 py-3 text-gray-500",children:"Waiting for agent response..."})}):e("div",{className:`flex-1 flex flex-col justify-start h-full min-h-0 ${a||""}`,children:e(Bc,{messages:o,isCompleted:!1})})})}function Kc(e){const{title:t,leftLabel:n,rightLabel:r,metrics:a,description:s,collapseInitially:i}=e;return{version:"1.0",library:"recharts",chart:"bar",title:t||"Scenario Comparison",description:s,data:a.map(e=>({label:e.label,left:e.left,right:e.right})),xKey:"label",series:[{key:"left",label:n,type:"bar"},{key:"right",label:r,type:"bar"}],yAxis:{left:{label:"Value"}},options:{stacked:!1,referenceZero:!1,collapseInitially:i}}}function Hc(e){const{title:t,metrics:n,description:r,collapseInitially:a}=e;return{version:"1.0",library:"recharts",chart:"bar",title:t||"Change vs. Baseline (%)",description:r,data:n.map(e=>({label:e.label,deltaPct:0!==e.left?(e.right-e.left)/e.left*100:0})),xKey:"label",series:[{key:"deltaPct",label:"% Change",type:"bar"}],yAxis:{left:{label:"% Change"}},options:{stacked:!1,referenceZero:!0,collapseInitially:a}}}function Gc(e){return["```chart",JSON.stringify(e,null,2),"```"].join("\n")}function Jc(e){const{title:t,description:n,rows:r,collapseInitially:a}=e;return{version:"1.0",library:"recharts",chart:"composed",title:t||"Cashflow Timeline",description:n,data:r.map(e=>({period:e.period,calls:e.calls,distributions:e.distributions,netCashflow:e.netCashflow??e.distributions-e.calls})),xKey:"period",series:[{key:"calls",label:"Calls",type:"bar",color:"#ef4444"},{key:"distributions",label:"Distributions",type:"bar",color:"#22c55e"},{key:"netCashflow",label:"Net Cashflow",type:"line",color:"#0ea5e9",yAxisId:"right",dot:!1}],yAxis:{left:{label:"Amount"},right:{label:"Net"}},options:{stacked:!1,referenceZero:!0,collapseInitially:a}}}function Yc(e){const{title:t,description:n,rows:r,collapseInitially:a}=e;return{version:"1.0",library:"recharts",chart:"line",title:t||"Performance (J‑Curve)",description:n,data:r.map(e=>({period:e.period,tvpi:e.tvpi??null,dpi:e.dpi??null,rvpi:e.rvpi??null})),xKey:"period",series:[{key:"tvpi",label:"TVPI",type:"line",color:"#4f46e5",dot:!1},{key:"dpi",label:"DPI",type:"line",color:"#16a34a",dot:!1},{key:"rvpi",label:"RVPI",type:"line",color:"#f59e0b",dot:!1}],yAxis:{left:{label:"Multiple (x)"}},options:{stacked:!1,referenceZero:!0,collapseInitially:a}}}function Zc(e){const{title:t,description:n,rows:r,leftLabel:a,rightLabel:s,collapseInitially:i}=e;return{version:"1.0",library:"recharts",chart:"line",title:t||"TVPI Over Time",description:n,data:r,xKey:"period",series:[{key:"tvpi_left",label:`TVPI – ${a}`,type:"line",color:"#4f46e5",dot:!1},{key:"tvpi_right",label:`TVPI – ${s}`,type:"line",color:"#6366f1",dot:!1}],yAxis:{left:{label:"Multiple (x)"}},options:{stacked:!1,referenceZero:!0,collapseInitially:i}}}function Qc(e){const{title:t,description:n,rows:r,collapseInitially:a}=e;return{version:"1.0",library:"recharts",chart:"line",title:t||"NAV Over Time",description:n,data:r.map(e=>({period:e.period,nav:e.nav})),xKey:"period",series:[{key:"nav",label:"NAV",type:"line",color:"#0ea5e9",dot:!1}],yAxis:{left:{label:"NAV"}},options:{stacked:!1,referenceZero:!0,collapseInitially:a}}}const Xc={name:"create_chart",description:'Create an interactive chart visualization that will be rendered in the UI.\n\nIMPORTANT: You don\'t actually "call" this tool. Instead, you include a markdown code block with language "chart" in your response.\n\n## CHART LIBRARIES\n\nTwo chart libraries are available:\n\n### 1. Recharts (Default) - Simple Charts\nFor standard bar, line, pie, area charts. Use when you need quick, simple visualizations.\n\n```chart\n{\n "library": "recharts",\n "chart": "bar|line|area|composed|pie|scatter|radar|radialBar|funnel|treemap",\n "title": "Chart Title",\n "data": [...],\n "xKey": "...",\n "series": [...]\n}\n```\n\n### 2. Vega-Lite (Advanced) - Complex Visualizations\nFor heatmaps, geographic maps, layered charts, faceted charts, statistical plots.\n\n```chart\n{\n "library": "vega-lite",\n "title": "Chart Title",\n "spec": {\n "data": {"values": [...]},\n "mark": "bar|line|point|rect|arc|...",\n "encoding": {...}\n }\n}\n```\n\n## WHEN TO USE EACH LIBRARY\n\n| Use Case | Library |\n|----------|---------|\n| Simple bar, line, pie charts | recharts (default) |\n| Heatmaps / correlation matrices | **vega-lite** |\n| Geographic maps | **vega-lite** |\n| Faceted / small multiples | **vega-lite** |\n| Layered charts (scatter + regression) | **vega-lite** |\n| Statistical plots (boxplot, violin) | **vega-lite** |\n| Standard business charts | recharts |\n\n---\n\n## RECHARTS EXAMPLES\n\n## CHART TYPES & WHEN TO USE\n\n| Type | Use Case | Data Shape |\n|------|----------|------------|\n| bar | Category comparisons | `[{x, y1, y2}]` |\n| line | Trends over time | `[{x, y1, y2}]` |\n| area | Trends with volume emphasis | `[{x, y1, y2}]` |\n| composed | Mix bars + lines | `[{x, y1, y2}]` with series.type |\n| pie | Part-to-whole (%) | `[{name, value}]` |\n| scatter | Correlation analysis | `[{x, y}]` |\n| radar | Multi-dimensional comparison | `[{axis, A, B}]` |\n| radialBar | Progress/gauges | `[{name, value}]` |\n| funnel | Conversion stages | `[{name, value}]` |\n| treemap | Hierarchical proportions | `[{name, value}]` |\n\n## EXAMPLES\n\n### Bar Chart\n```chart\n{"chart":"bar","title":"Revenue by Quarter","data":[{"quarter":"Q1","revenue":100000},{"quarter":"Q2","revenue":150000}],"xKey":"quarter","series":[{"key":"revenue","label":"Revenue"}]}\n```\n\n### Line Chart\n```chart\n{"chart":"line","title":"Performance","data":[{"period":"Q1","tvpi":1.2},{"period":"Q2","tvpi":1.5}],"xKey":"period","series":[{"key":"tvpi","label":"TVPI","color":"#4f46e5"}]}\n```\n\n### Area Chart\n```chart\n{"chart":"area","title":"Sales Volume","data":[{"month":"Jan","sales":1000},{"month":"Feb","sales":1500}],"xKey":"month","series":[{"key":"sales","label":"Sales"}],"options":{"stacked":true}}\n```\n\n### Composed Chart (Bar + Line)\n```chart\n{"chart":"composed","title":"Cashflow","data":[{"period":"Q1","calls":1000000,"net":-500000}],"xKey":"period","series":[{"key":"calls","type":"bar","color":"#ef4444"},{"key":"net","type":"line","yAxisId":"right"}],"yAxis":{"left":{"label":"Amount"},"right":{"label":"Net"}}}\n```\n\n### Pie Chart\n```chart\n{"chart":"pie","title":"Market Share","data":[{"name":"Product A","value":400},{"name":"Product B","value":300},{"name":"Product C","value":200}],"nameKey":"name","valueKey":"value"}\n```\n\n### Donut Chart (Pie with innerRadius)\n```chart\n{"chart":"pie","title":"Revenue Split","data":[{"name":"Services","value":60},{"name":"Products","value":40}],"nameKey":"name","valueKey":"value","options":{"innerRadius":50}}\n```\n\n### Scatter Chart\n```chart\n{"chart":"scatter","title":"Price vs Volume","data":[{"price":100,"volume":500},{"price":150,"volume":400}],"xKey":"price","yKey":"volume","series":[{"key":"data","label":"Products"}]}\n```\n\n### Radar Chart\n```chart\n{"chart":"radar","title":"Skills Comparison","data":[{"skill":"Speed","A":120,"B":110},{"skill":"Power","A":98,"B":130}],"axisKey":"skill","series":[{"key":"A","label":"Team A"},{"key":"B","label":"Team B"}]}\n```\n\n### RadialBar Chart (Progress)\n```chart\n{"chart":"radialBar","title":"Goal Progress","data":[{"name":"Sales","value":80},{"name":"Users","value":65}],"nameKey":"name","valueKey":"value"}\n```\n\n### Funnel Chart\n```chart\n{"chart":"funnel","title":"Conversion Funnel","data":[{"name":"Visits","value":5000},{"name":"Cart","value":2500},{"name":"Purchase","value":1000}],"nameKey":"name","valueKey":"value"}\n```\n\n### Treemap\n```chart\n{"chart":"treemap","title":"Budget Allocation","data":[{"name":"Engineering","value":500000},{"name":"Marketing","value":200000},{"name":"Sales","value":300000}],"nameKey":"name","dataKey":"value"}\n```\n\n## CONFIGURATION\n\n### Series (for bar/line/area/composed/radar)\n- key: (required) Field name in data\n- label: Display name\n- type: "bar"|"line"|"area" (composed only)\n- color: Hex color\n- yAxisId: "left"|"right"\n- dot: Show dots on lines\n\n### Keys (for pie/scatter/radar/funnel/treemap)\n- nameKey: Field for labels (default: "name")\n- valueKey: Field for values (default: "value")\n- xKey/yKey: For scatter charts\n- axisKey: For radar axis labels\n- dataKey: For treemap values\n\n### Options\n- stacked: Stack bars/areas\n- referenceZero: Show y=0 line\n- innerRadius: For donut charts (0-100)\n- showLabels: Show value labels\n- startAngle/endAngle: For radialBar\n\n## COLORS\n- Blue #4f46e5 - Primary\n- Cyan #06b6d4 - Secondary\n- Green #22c55e - Positive\n- Amber #f59e0b - Warning\n- Red #ef4444 - Negative\n- Purple #8b5cf6 - Accent\n- Pink #ec4899 - Highlight\n- Teal #14b8a6 - Alternative\n\nNumbers auto-format: 1K, 1M, 1B\n\n---\n\n## VEGA-LITE EXAMPLES\n\n### Heatmap\n```chart\n{"library":"vega-lite","title":"Correlation Matrix","spec":{"data":{"values":[{"x":"A","y":"A","v":1},{"x":"A","y":"B","v":0.7},{"x":"B","y":"A","v":0.7},{"x":"B","y":"B","v":1}]},"mark":"rect","encoding":{"x":{"field":"x","type":"nominal"},"y":{"field":"y","type":"nominal"},"color":{"field":"v","type":"quantitative","scale":{"scheme":"redblue","domain":[-1,1]}}}}}\n```\n\n### Layered Chart (Scatter + Trend Line)\n```chart\n{"library":"vega-lite","title":"Sales Trend","spec":{"data":{"values":[{"x":1,"y":10},{"x":2,"y":18},{"x":3,"y":25},{"x":4,"y":31}]},"layer":[{"mark":"point","encoding":{"x":{"field":"x"},"y":{"field":"y"}}},{"mark":{"type":"line","color":"red"},"transform":[{"regression":"y","on":"x"}],"encoding":{"x":{"field":"x"},"y":{"field":"y"}}}]}}\n```\n\n### Faceted Chart\n```chart\n{"library":"vega-lite","title":"Sales by Category","spec":{"data":{"values":[{"cat":"A","region":"N","val":10},{"cat":"A","region":"S","val":15},{"cat":"B","region":"N","val":8},{"cat":"B","region":"S","val":12}]},"mark":"bar","encoding":{"x":{"field":"region"},"y":{"field":"val"},"color":{"field":"region"}},"facet":{"field":"cat","columns":2}}}\n```\n\n### Box Plot\n```chart\n{"library":"vega-lite","title":"Distribution","spec":{"data":{"values":[{"group":"A","val":10},{"group":"A","val":15},{"group":"A","val":12},{"group":"B","val":20},{"group":"B","val":25}]},"mark":"boxplot","encoding":{"x":{"field":"group"},"y":{"field":"val","type":"quantitative"}}}}\n```\n\n## VEGA-LITE REFERENCE\n\n### Mark Types\n- bar, line, point, area, rect, arc, circle, text, boxplot, errorbar\n\n### Encoding Types\n- quantitative (Q): Numbers\n- nominal (N): Categories\n- ordinal (O): Ordered categories\n- temporal (T): Dates\n\n### Color Schemes\n- Sequential: blues, greens, viridis\n- Diverging: redblue, redyellowgreen\n- Categorical: category10, tableau10\n\n---\n\n## INTERACTIVE DASHBOARDS\n\nFor interactive dashboards with cross-filtering and linked views, use `options.mode: "dashboard"`.\nDashboard mode enables:\n- Larger default height (500px vs 280px)\n- Fullscreen button for exploration\n- "Interactive" badge indicator\n\n### Dashboard with Cross-Filter Selection\nClick on a bar to filter the line chart below:\n\n```chart\n{\n "library": "vega-lite",\n "title": "Sales Dashboard",\n "description": "Click a category to filter the trend",\n "options": {"mode": "dashboard", "height": 600},\n "spec": {\n "data": {"values": [\n {"category": "Electronics", "month": "Jan", "sales": 100},\n {"category": "Electronics", "month": "Feb", "sales": 120},\n {"category": "Electronics", "month": "Mar", "sales": 140},\n {"category": "Clothing", "month": "Jan", "sales": 80},\n {"category": "Clothing", "month": "Feb", "sales": 95},\n {"category": "Clothing", "month": "Mar", "sales": 110},\n {"category": "Food", "month": "Jan", "sales": 60},\n {"category": "Food", "month": "Feb", "sales": 70},\n {"category": "Food", "month": "Mar", "sales": 85}\n ]},\n "params": [{"name": "categorySelect", "select": {"type": "point", "fields": ["category"]}}],\n "vconcat": [\n {\n "mark": "bar",\n "encoding": {\n "x": {"field": "category", "type": "nominal"},\n "y": {"aggregate": "sum", "field": "sales"},\n "color": {"condition": {"param": "categorySelect", "field": "category"}, "value": "lightgray"},\n "opacity": {"condition": {"param": "categorySelect", "value": 1}, "value": 0.5}\n }\n },\n {\n "mark": "line",\n "transform": [{"filter": {"param": "categorySelect"}}],\n "encoding": {\n "x": {"field": "month", "type": "ordinal"},\n "y": {"field": "sales", "type": "quantitative"},\n "color": {"field": "category", "type": "nominal"}\n }\n }\n ]\n }\n}\n```\n\n### Dashboard with Interval Brush Selection\nBrush to select a time range in the overview, detail view updates:\n\n```chart\n{\n "library": "vega-lite",\n "title": "Focus + Context",\n "options": {"mode": "dashboard", "height": 500},\n "spec": {\n "data": {"values": [\n {"date": "2024-01-01", "value": 28}, {"date": "2024-02-01", "value": 55},\n {"date": "2024-03-01", "value": 43}, {"date": "2024-04-01", "value": 91},\n {"date": "2024-05-01", "value": 81}, {"date": "2024-06-01", "value": 53},\n {"date": "2024-07-01", "value": 19}, {"date": "2024-08-01", "value": 87},\n {"date": "2024-09-01", "value": 52}, {"date": "2024-10-01", "value": 48}\n ]},\n "vconcat": [\n {\n "height": 250,\n "mark": "area",\n "encoding": {\n "x": {"field": "date", "type": "temporal", "scale": {"domain": {"param": "brush"}}, "axis": {"title": ""}},\n "y": {"field": "value", "type": "quantitative"}\n }\n },\n {\n "height": 60,\n "params": [{"name": "brush", "select": {"type": "interval", "encodings": ["x"]}}],\n "mark": "area",\n "encoding": {\n "x": {"field": "date", "type": "temporal"},\n "y": {"field": "value", "type": "quantitative", "axis": {"tickCount": 3}}\n }\n }\n ]\n }\n}\n```\n\n### Dashboard with Legend Filter\nClick legend items to filter:\n\n```chart\n{\n "library": "vega-lite",\n "title": "Multi-Series with Legend Filter",\n "options": {"mode": "dashboard"},\n "spec": {\n "data": {"values": [\n {"series": "A", "x": 1, "y": 10}, {"series": "A", "x": 2, "y": 15},\n {"series": "B", "x": 1, "y": 20}, {"series": "B", "x": 2, "y": 12},\n {"series": "C", "x": 1, "y": 8}, {"series": "C", "x": 2, "y": 18}\n ]},\n "params": [{"name": "seriesFilter", "select": {"type": "point", "fields": ["series"]}, "bind": "legend"}],\n "mark": "line",\n "encoding": {\n "x": {"field": "x", "type": "quantitative"},\n "y": {"field": "y", "type": "quantitative"},\n "color": {"field": "series", "type": "nominal"},\n "opacity": {"condition": {"param": "seriesFilter", "value": 1}, "value": 0.2}\n }\n }\n}\n```\n\n### Dashboard with Input Widgets\nBind parameters to sliders and dropdowns:\n\n```chart\n{\n "library": "vega-lite",\n "title": "Interactive Controls",\n "options": {"mode": "dashboard"},\n "spec": {\n "params": [\n {"name": "threshold", "value": 50, "bind": {"input": "range", "min": 0, "max": 100, "step": 5}},\n {"name": "colorScheme", "value": "category10", "bind": {"input": "select", "options": ["category10", "tableau10", "set1"]}}\n ],\n "data": {"values": [{"x": "A", "y": 30}, {"x": "B", "y": 60}, {"x": "C", "y": 80}, {"x": "D", "y": 45}]},\n "mark": "bar",\n "encoding": {\n "x": {"field": "x", "type": "nominal"},\n "y": {"field": "y", "type": "quantitative"},\n "color": {\n "condition": {"test": "datum.y > threshold", "value": "steelblue"},\n "value": "lightgray"\n }\n }\n }\n}\n```\n\n### DASHBOARD OPTIONS\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| mode | "chart" \\| "dashboard" | "chart" | Dashboard mode enables fullscreen + larger height |\n| height | number | 280/500 | Explicit height (auto-calculated for vconcat) |\n| enableFullscreen | boolean | true (dashboard) | Show fullscreen button |\n| renderer | "canvas" \\| "svg" | "canvas" | SVG for print quality |\n| parameterValues | object | {} | Set initial param values (see below) |\n\n### SETTING PARAMETER VALUES\n\nOverride default param values to test different configurations:\n\n```chart\n{\n "library": "vega-lite",\n "options": {\n "mode": "dashboard",\n "parameterValues": {"threshold": 75, "colorScheme": "tableau10"}\n },\n "spec": {\n "params": [\n {"name": "threshold", "value": 50, "bind": {"input": "range", "min": 0, "max": 100}},\n {"name": "colorScheme", "value": "category10", "bind": {"input": "select", "options": ["category10", "tableau10"]}}\n ],\n ...\n }\n}\n```\n\nThe chart renders with threshold=75 (instead of default 50). Interactive controls still work.\n\n### INTERACTIVE FEATURES (params)\n\n| Selection Type | Use Case | Example |\n|---------------|----------|---------|\n| point | Click to select | `{"select": {"type": "point", "fields": ["category"]}}` |\n| interval | Brush selection | `{"select": {"type": "interval", "encodings": ["x"]}}` |\n| bind: "legend" | Legend toggle | `{"select": {...}, "bind": "legend"}` |\n| bind: input | Widgets | `{"bind": {"input": "range", "min": 0, "max": 100}}` |',input_schema:{type:"object",properties:{chart:{type:"string",enum:["bar","line","area","composed","pie","scatter","radar","radialBar","funnel","treemap"],description:"Type of chart to create"},title:{type:"string",description:"Chart title"},description:{type:"string",description:"Optional description shown below the title"},data:{type:"array",description:"Array of data objects",items:{type:"object",additionalProperties:!0}},xKey:{type:"string",description:"Field name to use for X-axis (for bar/line/area/composed/scatter)"},yKey:{type:"string",description:"Field name for Y values (for scatter charts)"},nameKey:{type:"string",description:'Field name for labels (for pie/funnel/radialBar/treemap, default: "name")'},valueKey:{type:"string",description:'Field name for values (for pie/funnel/radialBar, default: "value")'},axisKey:{type:"string",description:"Field name for radar axis labels"},dataKey:{type:"string",description:"Field name for treemap values"},series:{type:"array",description:"Array of series to plot (for bar/line/area/composed/radar)",items:{type:"object",properties:{key:{type:"string",description:"Field name in data"},label:{type:"string",description:"Display name"},type:{type:"string",enum:["bar","line","area"],description:"Series type (for composed charts)"},color:{type:"string",description:"Hex color code"},yAxisId:{type:"string",enum:["left","right"],description:"Which Y-axis to use"},dot:{type:"boolean",description:"Show dots on line (default: false)"}},required:["key"]}},yAxis:{type:"object",description:"Y-axis configuration",properties:{left:{type:"object",properties:{label:{type:"string"}}},right:{type:"object",properties:{label:{type:"string"}}}}},options:{type:"object",description:"Chart options",properties:{stacked:{type:"boolean",description:"Stack bars/areas"},referenceZero:{type:"boolean",description:"Show reference line at y=0"},collapsible:{type:"boolean",description:"Allow user to collapse chart"},collapseInitially:{type:"boolean",description:"Start collapsed"},innerRadius:{type:"number",description:"Inner radius for donut/radialBar charts (0-100)"},showLabels:{type:"boolean",description:"Show value labels on pie/funnel"},startAngle:{type:"number",description:"Start angle for radialBar (default: 180)"},endAngle:{type:"number",description:"End angle for radialBar (default: 0)"}}}},required:["chart","data"]}},ed='\n# Chart Visualization Capability\n\nYou can create interactive charts by including markdown code blocks with the language "chart".\n\n## Chart Types\n\n| Type | Use Case | Required Fields |\n|------|----------|-----------------|\n| bar | Category comparisons | xKey, series |\n| line | Trends over time | xKey, series |\n| area | Trends with volume | xKey, series |\n| composed | Mix bars + lines | xKey, series with type |\n| pie | Part-to-whole | nameKey, valueKey |\n| scatter | Correlation | xKey, yKey |\n| radar | Multi-dimensional | axisKey, series |\n| radialBar | Progress/gauges | nameKey, valueKey |\n| funnel | Conversion stages | nameKey, valueKey |\n| treemap | Hierarchical data | nameKey, dataKey |\n\n## Quick Examples\n\nBar: `{"chart":"bar","data":[{"x":"A","y":10}],"xKey":"x","series":[{"key":"y"}]}`\nPie: `{"chart":"pie","data":[{"name":"A","value":60},{"name":"B","value":40}]}`\nScatter: `{"chart":"scatter","data":[{"x":1,"y":2}],"xKey":"x","yKey":"y"}`\n\nUse charts when:\n- User requests visualization\n- 3+ data points to display\n- Visual form clarifies comparisons/trends\n\nColors: Blue #4f46e5 (primary), Green #22c55e (positive), Red #ef4444 (negative)\n';function td(e){if("vega-lite"===e.library){if(!e.spec)throw new Error('Invalid Vega-Lite chart spec: missing required "spec" field');return`\`\`\`chart\n${JSON.stringify(e,null,2)}\n\`\`\``}const t=e;if(!(t.chart&&t.data&&t.xKey&&t.series))throw new Error("Invalid chart spec: missing required fields (chart, data, xKey, series)");if(!Array.isArray(t.data))throw new Error("Invalid chart spec: data must be an array");if(!Array.isArray(t.series)||0===t.series.length)throw new Error("Invalid chart spec: series must be a non-empty array");return`\`\`\`chart\n${JSON.stringify(e,null,2)}\n\`\`\``}function nd(e){const t=/```chart\s*\n([\s\S]*?)\n```/g,n=[];let r;for(;null!==(r=t.exec(e));)try{const e=JSON.parse(r[1]);n.push(e)}catch(e){console.warn("Failed to parse chart spec:",e)}return n}function rd({children:t,fallback:n}){return ad?e(ad,{fallback:n,children:t}):e(kr,{FallbackComponent:n,children:t})}let ad=null;function sd(e){ad=e}function id({children:t}){return e(rd,{fallback:ld,children:t})}function ld({error:n}){return t(de,{status:"error",title:"Sorry, something went wrong...",children:[t("div",{className:"mb-4",children:["Our team has been notified and will be quickly working on resolving it. If you'd like to escalate or simply contact us, please email us at ",e("a",{className:"text-info",href:"mailto:support@vertesiahq.com",children:"support@vertesiahq.com"}),"."]}),n?.message&&e("code",{className:"w-full mt-4 text-sm text-muted break-words",children:n.message})]})}function od({children:t}){return e(rd,{fallback:cd,children:t})}function cd({error:n}){return e("tr",{children:t("td",{colSpan:100,children:[e("span",{className:"text-xs",children:" Cannot display row"}),e("br",{}),e("span",{className:"bg-gray-400",children:n?.message})]})})}function dd({children:t}){return e(rd,{fallback:ud,children:t})}function ud({error:n}){return console.log("WidgetError",n),t("div",{className:"text-sm",children:["Sorry, this area cannot be loaded or rendered.",n?.message&&e("pre",{children:n.message})]})}function md({className:n,children:a,title:s,description:i,actions:l,breadcrumbs:o,isCompact:c=!1,useDynamicBreadcrumbs:d=!0}){const u=fn();function m(e){return e.replace(/[-_]/g," ").split(" ").map(e=>Cr(e)).join(" ")}const p=e=>{const t=e?.href||"";if(!t)return"Page";const n=t.split("#")[0].split("?")[0].split("/").filter(e=>e.length>0);if(3===n.length){if(e.title!==document.title&&e.title)return e.title;return`${m(n[1])} Detail (...${n[2].slice(-6)})`}return n.length>=2?m(n[n.length-1]):1===n.length?m(n[0]):"Page"},h=(()=>{const e=[];if(d&&"undefined"!=typeof window&&window.history.state?.historyChain){const t=window.history.state.historyChain;t.forEach((n,r)=>{const a=t.length-r;e.push({label:p(n),href:n.href,onClick:()=>u(n.href,{stepsBack:a})})})}return o&&o.length>0&&o.forEach(t=>{const n="string"==typeof t?.props?.children?t.props.children:"Page";e.push(t?.props?.href?{href:t?.props?.href,label:n,onClick:()=>u(t.props.href,{replace:t.props.clearBreadcrumbs})}:{label:n})}),e})();return t("div",{className:r(c?"pb-0":"pb-2","p-4 flex flex-col",n),children:[t("div",{className:"flex items-start gap-4",children:[t("div",{className:"w-full flex place-content-between h-auto min-h-8 flex-col items-start",children:[e("nav",{className:"flex-1 flex justify-start text-xs",children:h.length>0&&e($e,{path:h,separator:e(Ue,{className:"w-3.5 h-3.5"}),maxItems:4})}),t("div",{className:"flex gap-2 items-center",children:[e("h1",{className:"text-xl font-semibold break-all",children:s}),i&&e(O,{description:i,children:e(Ze,{className:"size-4 text-muted"})})]})]}),e("div",{className:"flex gap-x-2 shrink-0",children:l})]}),a&&e("div",{className:"w-full flex items-center",children:a})]})}function pd({}){return t("div",{className:"text-center pt-32",children:[e("h1",{className:"text-3xl font-bold text-red-500",children:"404"}),e("p",{className:"text-2xl",children:"Page Not Found"})]})}function hd(...e){const t=Array.from(e);return t.__AnyOf__=!0,t}function gd(...e){return Array.from(e)}function fd(e){return!0===e.__AnyOf__}class yd{system_roles;roles;permissions;constructor(e,t){if(!e.authToken)throw new Error("No auth token found in user session");this.system_roles=t;const n=new Set(e.authToken.account_roles||[]);if(e.authToken.project_roles)for(const t of e.authToken.project_roles)n.add(t);this.roles=n;const r={};for(const e of t)r[e.name]=e.permissions;const a=new Set;for(const e of n){const t=r[e];if(t)for(const e of t)a.add(e)}this.permissions=a}hasPermission(e){if("string"==typeof e)return this.permissions.has(e);if(fd(e))return e.some(e=>this.permissions.has(e));for(const t of e)if(!this.permissions.has(t))return!1;return!0}}const bd=m(void 0);function vd(){const e=p(bd);if(!e)throw new Error("UserPermissionContext cannot be used outside UserPermissionProvider");return e}function xd({children:t}){const n=Kt(),{data:r,error:a,isLoading:s}=L(()=>n.user?n.client.iam.roles.list():Promise.resolve(void 0),[n.user]),i=o(()=>n.authToken&&r&&!s?new yd(n,r):void 0,[n,r,s]);return a?e(U,{title:"Failed to fetch role mappings",children:a.message}):i&&e(bd.Provider,{value:i,children:t})}function wd({permission:t,isDisabled:n,title:r,children:a,...s}){return vd().hasPermission(t)||(n=!0,r="You do not have permission to perform this action"),e(v,{isDisabled:n,title:r,...s,children:a})}function Nd({permission:t,...n}){return vd().hasPermission(t)?e(Sr,{...n}):null}function kd({user:n}){return t("div",{className:"flex items-center",children:[e("div",{className:"w-9 h-9",children:(()=>{if(n.picture)return e("img",{className:"inline-block h-9 w-9 rounded-full",src:n.picture,alt:n.name});{const t=n.name.split(" ").map(e=>e[0]).join("");return e("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-indigo-600",children:e("span",{className:"text-sm font-medium leading-none text-white",children:t})})}})()}),t("div",{className:"ml-3",children:[e("p",{className:"text-sm font-medium text-gray-700 dark:text-slate-50 group-hover:text-gray-900",children:n.name??"Deleted User"}),e("p",{className:"text-xs font-medium text-gray-500 dark:text-slate-300 group-hover:text-gray-700",children:n.email??"Deleted User"})]})]})}export{Pr as ActivitiesDoc,Ar as ActivityDoc,lc as AddToCollectionAction,ic as AddToCollectionActionComponent,zc as AgentChart,hl as AgentRunnerFacetsNav,gd as AllOf,Lr as AnimatedThinkingDots,hd as AnyOf,Bi as ApiKeyAvatar,Zr as AskUserWidget,uo as BrowseCollectionView,Lo as ChangeTypeAction,Oo as ChangeTypeActionComponent,ul as CollectionsFacetsNav,fo as CollectionsTable,Qr as ConfirmationWidget,Ra as ContentDispositionButton,_o as ContentObjectTypesSearch,bo as ContentObjectTypesTable,ii as ContentOverview,ho as CreateCollectionForm,go as CreateCollectionModal,Co as CreateOrUpdateTypeModal,Vo as DeleteObjectsAction,Mo as DeleteObjectsActionComponent,qo as DeleteObjectsFromCollectionsAction,_l as DocumentGridView,ki as DocumentIcon,Ni as DocumentIconSkeleton,Gl as DocumentInput,Yl as DocumentPreviewPanel,jl as DocumentSearch,Vl as DocumentSearchProvider,ro as DocumentSearchResults,no as DocumentSearchResultsWithDropZone,gl as DocumentSelection,vl as DocumentSelectionProvider,Ll as DocumentTable,Cl as DocumentTableColumn,Sl as DocumentTableView,$l as DocumentUploadModal,nl as DocumentsFacetsNav,Fo as EditCollectionView,Hi as EnvironmentFacet,Wo as ExportPropertiesAction,Bo as ExportPropertiesComponent,lo as ExportPropertiesModal,io as ExportTypes,Fl as FileUploadAction,md as GenericPageNavHeader,Ea as Header,sl as InteractionsFacetsNav,Or as JumpingDots,Ws as MagicPdfView,ga as MessageItem,Wc as MessagesContainer,Uc as ModernAgentConversation,pd as NotFoundView,jo as ObjectSchemaEditor,vo as ObjectTypeSearch,xo as ObjectTypeSearchContext,Po as ObjectTypeSearchProvider,Xo as ObjectsActionContext,tc as ObjectsActionContextProvider,id as PanelErrorBoundary,Ta as PayloadBuilder,za as PayloadBuilderProvider,Aa as PayloadContext,gs as PdfDocumentRenderer,ls as PdfPageRenderer,bs as PdfPageSlider,hs as PdfThumbnailList,ol as PromptsFacetsNav,ss as PropertiesEditorModal,Ur as PulsatingCircle,Vr as PulsingMessageLoader,Ho as RemoveFromCollectionAction,Ko as RemoveFromCollectionActionComponent,od as RowErrorBoundary,Yi as RunsFacetsNav,as as SaveVersionConfirmModal,Il as SearchContext,wd as SecureButton,Nd as SecureSidebarItem,Do as SelectCollection,po as SelectContentType,To as SelectContentTypeModal,Bl as SelectDocument,Kl as SelectDocumentModal,dc as SelectionActions,cs as SharedPdfProvider,$o as SharedPropsEditor,ms as SimplePdfPage,Hs as SimplePdfViewer,Jo as StartWorkflowAction,Go as StartWorkflowComponent,fa as StreamingMessage,_i as StringFacet,ji as StringListFacet,Ro as SyncMemberHeadsToggle,Ao as TableLayoutEditor,qr as ThinkingBar,Xr as ThinkingMessages,Pi as TypeFacet,Mr as TypedDots,mc as UploadObjectsButton,kd as UserAvatar,Ui as UserInfo,xd as UserPermissionProvider,yd as UserPermissions,bd as UserPermissionsContext,Ti as VStringFacet,Ai as VTypeFacet,Ki as VUserFacet,_c as VegaLiteChart,rd as VertesiaErrorBoundary,Br as WavyThinking,dd as WidgetErrorBoundary,Xi as WorkflowExecutionsFacetsNav,Jc as buildCashflowComposedChart,td as buildChartSpec,Qc as buildNavLineChart,Yc as buildPerformanceLineChart,Kc as buildScenarioComparisonBarChart,Hc as buildScenarioDeltaPercentChart,Zc as buildTvpiOverlayChart,ed as chartSystemPromptAddition,yo as collectionIcon,Xc as createChartToolDefinition,nd as extractChartSpecs,ts as getWorkflowStatusColor,ns as getWorkflowStatusName,fd as isAnyOf,Wa as isCsv,Ka as isImage,Ha as isPdf,Ja as isPreviewableAsPdf,Tc as isRechartsSpec,Pc as isVegaLiteSpec,Ga as isVideo,es as printElementToPdf,Xa as retrieveRendition,sd as setErrorBoundaryComponent,Oa as shortId,La as shortenString,zo as stringifyTableLayout,Gc as toChartMarkdown,ml as useAgentRunnerFilterGroups,pl as useAgentRunnerFilterHandler,cl as useCollectionsFilterGroups,dl as useCollectionsFilterHandler,el as useDocumentFilterGroups,tl as useDocumentFilterHandler,Pl as useDocumentSearch,zl as useDocumentSearchCount,yl as useDocumentSelection,Rl as useDocumentUploadHandler,Jl as useDownloadDocument,Di as useFetchGroupInfo,Ei as useFetchUserInfo,rl as useInteractionsFilterGroups,al as useInteractionsFilterHandler,ac as useObjectsActionCallback,rc as useObjectsActionContext,bl as useOptionalDocumentSelection,Fa as usePayloadBuilder,il as usePromptsFilterGroups,ll as usePromptsFilterHandler,Gi as useRunsFilterGroups,Ji as useRunsFilterHandler,wo as useSearch,ko as useSearchCount,ds as useSharedPdf,Dl as useSmartFileUploadProcessing,sc as useStartWorkflowCallback,vd as useUserPermissions,Tl as useWatchDocumentSearchFacets,Al as useWatchDocumentSearchResult,No as useWatchSearchResult,Zi as useWorkflowExecutionsFilterGroups,Qi as useWorkflowExecutionsFilterHandler};
2
- //# sourceMappingURL=vertesia-ui-features.js.map