@vertesia/ui 0.24.0-dev.202601221707

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 (1854) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +105 -0
  3. package/lib/esm/core/components/Avatar.js +31 -0
  4. package/lib/esm/core/components/Avatar.js.map +1 -0
  5. package/lib/esm/core/components/Badge.js +62 -0
  6. package/lib/esm/core/components/Badge.js.map +1 -0
  7. package/lib/esm/core/components/Button.js +32 -0
  8. package/lib/esm/core/components/Button.js.map +1 -0
  9. package/lib/esm/core/components/Center.js +6 -0
  10. package/lib/esm/core/components/Center.js.map +1 -0
  11. package/lib/esm/core/components/ComboBox.js +356 -0
  12. package/lib/esm/core/components/ComboBox.js.map +1 -0
  13. package/lib/esm/core/components/ConfirmModal.js +10 -0
  14. package/lib/esm/core/components/ConfirmModal.js.map +1 -0
  15. package/lib/esm/core/components/DeleteModal.js +28 -0
  16. package/lib/esm/core/components/DeleteModal.js.map +1 -0
  17. package/lib/esm/core/components/Divider.js +6 -0
  18. package/lib/esm/core/components/Divider.js.map +1 -0
  19. package/lib/esm/core/components/Dropdown.js +16 -0
  20. package/lib/esm/core/components/Dropdown.js.map +1 -0
  21. package/lib/esm/core/components/DropdownList.js +9 -0
  22. package/lib/esm/core/components/DropdownList.js.map +1 -0
  23. package/lib/esm/core/components/EmptyCollection.js +7 -0
  24. package/lib/esm/core/components/EmptyCollection.js.map +1 -0
  25. package/lib/esm/core/components/FileUpload.js +119 -0
  26. package/lib/esm/core/components/FileUpload.js.map +1 -0
  27. package/lib/esm/core/components/FormItem.js +9 -0
  28. package/lib/esm/core/components/FormItem.js.map +1 -0
  29. package/lib/esm/core/components/InputList.js +61 -0
  30. package/lib/esm/core/components/InputList.js.map +1 -0
  31. package/lib/esm/core/components/Link.js +13 -0
  32. package/lib/esm/core/components/Link.js.map +1 -0
  33. package/lib/esm/core/components/MenuList.js +20 -0
  34. package/lib/esm/core/components/MenuList.js.map +1 -0
  35. package/lib/esm/core/components/MessageBox.js +66 -0
  36. package/lib/esm/core/components/MessageBox.js.map +1 -0
  37. package/lib/esm/core/components/Modal.js +26 -0
  38. package/lib/esm/core/components/Modal.js.map +1 -0
  39. package/lib/esm/core/components/NumberInput.js +43 -0
  40. package/lib/esm/core/components/NumberInput.js.map +1 -0
  41. package/lib/esm/core/components/Overlay.js +57 -0
  42. package/lib/esm/core/components/Overlay.js.map +1 -0
  43. package/lib/esm/core/components/Panel.js +8 -0
  44. package/lib/esm/core/components/Panel.js.map +1 -0
  45. package/lib/esm/core/components/Portal.js +28 -0
  46. package/lib/esm/core/components/Portal.js.map +1 -0
  47. package/lib/esm/core/components/RadioGroup.js +34 -0
  48. package/lib/esm/core/components/RadioGroup.js.map +1 -0
  49. package/lib/esm/core/components/SelectBox.js +67 -0
  50. package/lib/esm/core/components/SelectBox.js.map +1 -0
  51. package/lib/esm/core/components/SelectList.js +52 -0
  52. package/lib/esm/core/components/SelectList.js.map +1 -0
  53. package/lib/esm/core/components/SelectStack.js +8 -0
  54. package/lib/esm/core/components/SelectStack.js.map +1 -0
  55. package/lib/esm/core/components/SidePanel.js +33 -0
  56. package/lib/esm/core/components/SidePanel.js.map +1 -0
  57. package/lib/esm/core/components/Spinner.js +18 -0
  58. package/lib/esm/core/components/Spinner.js.map +1 -0
  59. package/lib/esm/core/components/Switch.js +12 -0
  60. package/lib/esm/core/components/Switch.js.map +1 -0
  61. package/lib/esm/core/components/TagsInput.js +194 -0
  62. package/lib/esm/core/components/TagsInput.js.map +1 -0
  63. package/lib/esm/core/components/index.js +36 -0
  64. package/lib/esm/core/components/index.js.map +1 -0
  65. package/lib/esm/core/components/libs/utils.js +6 -0
  66. package/lib/esm/core/components/libs/utils.js.map +1 -0
  67. package/lib/esm/core/components/libs/visuallyHidden.js +16 -0
  68. package/lib/esm/core/components/libs/visuallyHidden.js.map +1 -0
  69. package/lib/esm/core/components/popup/Popup.js +60 -0
  70. package/lib/esm/core/components/popup/Popup.js.map +1 -0
  71. package/lib/esm/core/components/popup/PopupController.js +149 -0
  72. package/lib/esm/core/components/popup/PopupController.js.map +1 -0
  73. package/lib/esm/core/components/popup/index.js +4 -0
  74. package/lib/esm/core/components/popup/index.js.map +1 -0
  75. package/lib/esm/core/components/popup/position.js +221 -0
  76. package/lib/esm/core/components/popup/position.js.map +1 -0
  77. package/lib/esm/core/components/popup/utils.js +74 -0
  78. package/lib/esm/core/components/popup/utils.js.map +1 -0
  79. package/lib/esm/core/components/shadcn/breadcrumb.js +51 -0
  80. package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -0
  81. package/lib/esm/core/components/shadcn/button.js +76 -0
  82. package/lib/esm/core/components/shadcn/button.js.map +1 -0
  83. package/lib/esm/core/components/shadcn/calendar.js +13 -0
  84. package/lib/esm/core/components/shadcn/calendar.js.map +1 -0
  85. package/lib/esm/core/components/shadcn/card.js +17 -0
  86. package/lib/esm/core/components/shadcn/card.js.map +1 -0
  87. package/lib/esm/core/components/shadcn/checkbox.js +9 -0
  88. package/lib/esm/core/components/shadcn/checkbox.js.map +1 -0
  89. package/lib/esm/core/components/shadcn/command.js +29 -0
  90. package/lib/esm/core/components/shadcn/command.js.map +1 -0
  91. package/lib/esm/core/components/shadcn/dialog.js +74 -0
  92. package/lib/esm/core/components/shadcn/dialog.js.map +1 -0
  93. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js +38 -0
  94. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js.map +1 -0
  95. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js +23 -0
  96. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js.map +1 -0
  97. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js +129 -0
  98. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -0
  99. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js +46 -0
  100. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js.map +1 -0
  101. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js +23 -0
  102. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js.map +1 -0
  103. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js +28 -0
  104. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js.map +1 -0
  105. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js +5 -0
  106. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js.map +1 -0
  107. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +98 -0
  108. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +1 -0
  109. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js +24 -0
  110. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js.map +1 -0
  111. package/lib/esm/core/components/shadcn/filters/filter/TextFilter.js +21 -0
  112. package/lib/esm/core/components/shadcn/filters/filter/TextFilter.js.map +1 -0
  113. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js +161 -0
  114. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js.map +1 -0
  115. package/lib/esm/core/components/shadcn/filters/filter-styles.js +88 -0
  116. package/lib/esm/core/components/shadcn/filters/filter-styles.js.map +1 -0
  117. package/lib/esm/core/components/shadcn/filters/filterBar.js +242 -0
  118. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -0
  119. package/lib/esm/core/components/shadcn/filters/filters.js +57 -0
  120. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -0
  121. package/lib/esm/core/components/shadcn/filters/index.js +6 -0
  122. package/lib/esm/core/components/shadcn/filters/index.js.map +1 -0
  123. package/lib/esm/core/components/shadcn/filters/types.js +10 -0
  124. package/lib/esm/core/components/shadcn/filters/types.js.map +1 -0
  125. package/lib/esm/core/components/shadcn/heading.js +17 -0
  126. package/lib/esm/core/components/shadcn/heading.js.map +1 -0
  127. package/lib/esm/core/components/shadcn/index.js +23 -0
  128. package/lib/esm/core/components/shadcn/index.js.map +1 -0
  129. package/lib/esm/core/components/shadcn/input.js +41 -0
  130. package/lib/esm/core/components/shadcn/input.js.map +1 -0
  131. package/lib/esm/core/components/shadcn/label.js +10 -0
  132. package/lib/esm/core/components/shadcn/label.js.map +1 -0
  133. package/lib/esm/core/components/shadcn/popover.js +50 -0
  134. package/lib/esm/core/components/shadcn/popover.js.map +1 -0
  135. package/lib/esm/core/components/shadcn/resizeable.js +15 -0
  136. package/lib/esm/core/components/shadcn/resizeable.js.map +1 -0
  137. package/lib/esm/core/components/shadcn/selectBox.js +152 -0
  138. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -0
  139. package/lib/esm/core/components/shadcn/separator.js +8 -0
  140. package/lib/esm/core/components/shadcn/separator.js.map +1 -0
  141. package/lib/esm/core/components/shadcn/tabs.js +132 -0
  142. package/lib/esm/core/components/shadcn/tabs.js.map +1 -0
  143. package/lib/esm/core/components/shadcn/text.js +30 -0
  144. package/lib/esm/core/components/shadcn/text.js.map +1 -0
  145. package/lib/esm/core/components/shadcn/textarea.js +7 -0
  146. package/lib/esm/core/components/shadcn/textarea.js.map +1 -0
  147. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js +39 -0
  148. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js.map +1 -0
  149. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js +13 -0
  150. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -0
  151. package/lib/esm/core/components/shadcn/tooltip.js +14 -0
  152. package/lib/esm/core/components/shadcn/tooltip.js.map +1 -0
  153. package/lib/esm/core/components/styles.js +10 -0
  154. package/lib/esm/core/components/styles.js.map +1 -0
  155. package/lib/esm/core/components/table/index.js +24 -0
  156. package/lib/esm/core/components/table/index.js.map +1 -0
  157. package/lib/esm/core/components/tabs/Tabs.js +78 -0
  158. package/lib/esm/core/components/tabs/Tabs.js.map +1 -0
  159. package/lib/esm/core/components/tabs/TabsContext.js +7 -0
  160. package/lib/esm/core/components/tabs/TabsContext.js.map +1 -0
  161. package/lib/esm/core/components/tabs/index.js +3 -0
  162. package/lib/esm/core/components/tabs/index.js.map +1 -0
  163. package/lib/esm/core/components/toast/NotificationPanel.js +43 -0
  164. package/lib/esm/core/components/toast/NotificationPanel.js.map +1 -0
  165. package/lib/esm/core/components/toast/ToastContext.js +7 -0
  166. package/lib/esm/core/components/toast/ToastContext.js.map +1 -0
  167. package/lib/esm/core/components/toast/ToastProps.js +2 -0
  168. package/lib/esm/core/components/toast/ToastProps.js.map +1 -0
  169. package/lib/esm/core/components/toast/ToastProvider.js +13 -0
  170. package/lib/esm/core/components/toast/ToastProvider.js.map +1 -0
  171. package/lib/esm/core/components/toast/index.js +3 -0
  172. package/lib/esm/core/components/toast/index.js.map +1 -0
  173. package/lib/esm/core/hooks/CompositeState.js +256 -0
  174. package/lib/esm/core/hooks/CompositeState.js.map +1 -0
  175. package/lib/esm/core/hooks/PortalContainerProvider.js +44 -0
  176. package/lib/esm/core/hooks/PortalContainerProvider.js.map +1 -0
  177. package/lib/esm/core/hooks/SharedState.js +64 -0
  178. package/lib/esm/core/hooks/SharedState.js.map +1 -0
  179. package/lib/esm/core/hooks/index.js +16 -0
  180. package/lib/esm/core/hooks/index.js.map +1 -0
  181. package/lib/esm/core/hooks/useClickOutside.js +29 -0
  182. package/lib/esm/core/hooks/useClickOutside.js.map +1 -0
  183. package/lib/esm/core/hooks/useCopyToClipboard.js +23 -0
  184. package/lib/esm/core/hooks/useCopyToClipboard.js.map +1 -0
  185. package/lib/esm/core/hooks/useDarkMode.js +11 -0
  186. package/lib/esm/core/hooks/useDarkMode.js.map +1 -0
  187. package/lib/esm/core/hooks/useDebounce.js +14 -0
  188. package/lib/esm/core/hooks/useDebounce.js.map +1 -0
  189. package/lib/esm/core/hooks/useEventSource.js +31 -0
  190. package/lib/esm/core/hooks/useEventSource.js.map +1 -0
  191. package/lib/esm/core/hooks/useFetch.js +40 -0
  192. package/lib/esm/core/hooks/useFetch.js.map +1 -0
  193. package/lib/esm/core/hooks/useFlag.js +13 -0
  194. package/lib/esm/core/hooks/useFlag.js.map +1 -0
  195. package/lib/esm/core/hooks/useIntersectionObserver.js +34 -0
  196. package/lib/esm/core/hooks/useIntersectionObserver.js.map +1 -0
  197. package/lib/esm/core/hooks/useIsFistRendering.js +14 -0
  198. package/lib/esm/core/hooks/useIsFistRendering.js.map +1 -0
  199. package/lib/esm/core/hooks/useSafeLayoutEffect.js +4 -0
  200. package/lib/esm/core/hooks/useSafeLayoutEffect.js.map +1 -0
  201. package/lib/esm/core/hooks/useScrollableSearch.js +92 -0
  202. package/lib/esm/core/hooks/useScrollableSearch.js.map +1 -0
  203. package/lib/esm/core/hooks/useSharedValue.js +21 -0
  204. package/lib/esm/core/hooks/useSharedValue.js.map +1 -0
  205. package/lib/esm/core/index.js +4 -0
  206. package/lib/esm/core/index.js.map +1 -0
  207. package/lib/esm/core/utils/cn.js +6 -0
  208. package/lib/esm/core/utils/cn.js.map +1 -0
  209. package/lib/esm/core/utils/index.js +2 -0
  210. package/lib/esm/core/utils/index.js.map +1 -0
  211. package/lib/esm/env/index.js +75 -0
  212. package/lib/esm/env/index.js.map +1 -0
  213. package/lib/esm/features/activity-doc/ActivityDoc.js +71 -0
  214. package/lib/esm/features/activity-doc/ActivityDoc.js.map +1 -0
  215. package/lib/esm/features/activity-doc/index.js +2 -0
  216. package/lib/esm/features/activity-doc/index.js.map +1 -0
  217. package/lib/esm/features/agent/PayloadBuilder.js +269 -0
  218. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -0
  219. package/lib/esm/features/agent/chat/AgentChart.js +246 -0
  220. package/lib/esm/features/agent/chat/AgentChart.js.map +1 -0
  221. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js +207 -0
  222. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js.map +1 -0
  223. package/lib/esm/features/agent/chat/AskUserWidget.js +113 -0
  224. package/lib/esm/features/agent/chat/AskUserWidget.js.map +1 -0
  225. package/lib/esm/features/agent/chat/ImageLightbox.js +33 -0
  226. package/lib/esm/features/agent/chat/ImageLightbox.js.map +1 -0
  227. package/lib/esm/features/agent/chat/JumpingDots.js +6 -0
  228. package/lib/esm/features/agent/chat/JumpingDots.js.map +1 -0
  229. package/lib/esm/features/agent/chat/ModernAgentConversation.js +888 -0
  230. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -0
  231. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +273 -0
  232. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -0
  233. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +88 -0
  234. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +1 -0
  235. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +62 -0
  236. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -0
  237. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js +29 -0
  238. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js.map +1 -0
  239. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +95 -0
  240. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -0
  241. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +197 -0
  242. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -0
  243. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +245 -0
  244. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -0
  245. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js +20 -0
  246. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js.map +1 -0
  247. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +63 -0
  248. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -0
  249. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js +23 -0
  250. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js.map +1 -0
  251. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js +52 -0
  252. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js.map +1 -0
  253. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +82 -0
  254. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -0
  255. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js +13 -0
  256. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js.map +1 -0
  257. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js +214 -0
  258. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +1 -0
  259. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +302 -0
  260. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -0
  261. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +105 -0
  262. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -0
  263. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +412 -0
  264. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +1 -0
  265. package/lib/esm/features/agent/chat/SkillWidgetProvider.js +90 -0
  266. package/lib/esm/features/agent/chat/SkillWidgetProvider.js.map +1 -0
  267. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js +266 -0
  268. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js.map +1 -0
  269. package/lib/esm/features/agent/chat/VegaLiteChart.js +778 -0
  270. package/lib/esm/features/agent/chat/VegaLiteChart.js.map +1 -0
  271. package/lib/esm/features/agent/chat/WaitingMessages.js +60 -0
  272. package/lib/esm/features/agent/chat/WaitingMessages.js.map +1 -0
  273. package/lib/esm/features/agent/chat/index.js +17 -0
  274. package/lib/esm/features/agent/chat/index.js.map +1 -0
  275. package/lib/esm/features/agent/chat/useArtifactUrlCache.js +62 -0
  276. package/lib/esm/features/agent/chat/useArtifactUrlCache.js.map +1 -0
  277. package/lib/esm/features/agent/createChartTool.js +632 -0
  278. package/lib/esm/features/agent/createChartTool.js.map +1 -0
  279. package/lib/esm/features/agent/examples.js +295 -0
  280. package/lib/esm/features/agent/examples.js.map +1 -0
  281. package/lib/esm/features/agent/index.js +5 -0
  282. package/lib/esm/features/agent/index.js.map +1 -0
  283. package/lib/esm/features/agent/visualization.js +165 -0
  284. package/lib/esm/features/agent/visualization.js.map +1 -0
  285. package/lib/esm/features/errors/PanelErrorBoundary.js +11 -0
  286. package/lib/esm/features/errors/PanelErrorBoundary.js.map +1 -0
  287. package/lib/esm/features/errors/RowErrorBoundary.js +9 -0
  288. package/lib/esm/features/errors/RowErrorBoundary.js.map +1 -0
  289. package/lib/esm/features/errors/VertesiaErrorBoundary.js +15 -0
  290. package/lib/esm/features/errors/VertesiaErrorBoundary.js.map +1 -0
  291. package/lib/esm/features/errors/WidgetErrorBoundary.js +11 -0
  292. package/lib/esm/features/errors/WidgetErrorBoundary.js.map +1 -0
  293. package/lib/esm/features/errors/index.js +5 -0
  294. package/lib/esm/features/errors/index.js.map +1 -0
  295. package/lib/esm/features/facets/CollectionsFacetsNav.js +89 -0
  296. package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -0
  297. package/lib/esm/features/facets/DocumentsFacetsNav.js +147 -0
  298. package/lib/esm/features/facets/DocumentsFacetsNav.js.map +1 -0
  299. package/lib/esm/features/facets/EnvironmentFacet.js +39 -0
  300. package/lib/esm/features/facets/EnvironmentFacet.js.map +1 -0
  301. package/lib/esm/features/facets/InteractionsFacetsNav.js +88 -0
  302. package/lib/esm/features/facets/InteractionsFacetsNav.js.map +1 -0
  303. package/lib/esm/features/facets/PromptsFacetsNav.js +80 -0
  304. package/lib/esm/features/facets/PromptsFacetsNav.js.map +1 -0
  305. package/lib/esm/features/facets/RunsFacetsNav.js +157 -0
  306. package/lib/esm/features/facets/RunsFacetsNav.js.map +1 -0
  307. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js +100 -0
  308. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -0
  309. package/lib/esm/features/facets/index.js +15 -0
  310. package/lib/esm/features/facets/index.js.map +1 -0
  311. package/lib/esm/features/facets/utils/SearchInterface.js +2 -0
  312. package/lib/esm/features/facets/utils/SearchInterface.js.map +1 -0
  313. package/lib/esm/features/facets/utils/StringFacet.js +12 -0
  314. package/lib/esm/features/facets/utils/StringFacet.js.map +1 -0
  315. package/lib/esm/features/facets/utils/StringListFacet.js +11 -0
  316. package/lib/esm/features/facets/utils/StringListFacet.js.map +1 -0
  317. package/lib/esm/features/facets/utils/TypeFacet.js +42 -0
  318. package/lib/esm/features/facets/utils/TypeFacet.js.map +1 -0
  319. package/lib/esm/features/facets/utils/VEnvironmentFacet.js +25 -0
  320. package/lib/esm/features/facets/utils/VEnvironmentFacet.js.map +1 -0
  321. package/lib/esm/features/facets/utils/VInteractionFacet.js +45 -0
  322. package/lib/esm/features/facets/utils/VInteractionFacet.js.map +1 -0
  323. package/lib/esm/features/facets/utils/VStringFacet.js +20 -0
  324. package/lib/esm/features/facets/utils/VStringFacet.js.map +1 -0
  325. package/lib/esm/features/facets/utils/VTypeFacet.js +61 -0
  326. package/lib/esm/features/facets/utils/VTypeFacet.js.map +1 -0
  327. package/lib/esm/features/facets/utils/VUserFacet.js +31 -0
  328. package/lib/esm/features/facets/utils/VUserFacet.js.map +1 -0
  329. package/lib/esm/features/facets/utils/utils.js +7 -0
  330. package/lib/esm/features/facets/utils/utils.js.map +1 -0
  331. package/lib/esm/features/index.js +12 -0
  332. package/lib/esm/features/index.js.map +1 -0
  333. package/lib/esm/features/layout/GenericPageNavHeader.js +74 -0
  334. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -0
  335. package/lib/esm/features/layout/NotFoundView.js +5 -0
  336. package/lib/esm/features/layout/NotFoundView.js.map +1 -0
  337. package/lib/esm/features/layout/index.js +3 -0
  338. package/lib/esm/features/layout/index.js.map +1 -0
  339. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js +268 -0
  340. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js.map +1 -0
  341. package/lib/esm/features/magic-pdf/DownloadPopover.js +28 -0
  342. package/lib/esm/features/magic-pdf/DownloadPopover.js.map +1 -0
  343. package/lib/esm/features/magic-pdf/ExtractedContentView.js +77 -0
  344. package/lib/esm/features/magic-pdf/ExtractedContentView.js.map +1 -0
  345. package/lib/esm/features/magic-pdf/MagicPdfProvider.js +242 -0
  346. package/lib/esm/features/magic-pdf/MagicPdfProvider.js.map +1 -0
  347. package/lib/esm/features/magic-pdf/MagicPdfView.js +61 -0
  348. package/lib/esm/features/magic-pdf/MagicPdfView.js.map +1 -0
  349. package/lib/esm/features/magic-pdf/index.js +2 -0
  350. package/lib/esm/features/magic-pdf/index.js.map +1 -0
  351. package/lib/esm/features/magic-pdf/types.js +2 -0
  352. package/lib/esm/features/magic-pdf/types.js.map +1 -0
  353. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js +261 -0
  354. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js.map +1 -0
  355. package/lib/esm/features/pdf-viewer/PdfPageSlider.js +276 -0
  356. package/lib/esm/features/pdf-viewer/PdfPageSlider.js.map +1 -0
  357. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js +71 -0
  358. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js.map +1 -0
  359. package/lib/esm/features/pdf-viewer/index.js +4 -0
  360. package/lib/esm/features/pdf-viewer/index.js.map +1 -0
  361. package/lib/esm/features/permissions/SecureButton.js +13 -0
  362. package/lib/esm/features/permissions/SecureButton.js.map +1 -0
  363. package/lib/esm/features/permissions/SecureSidebarItem.js +14 -0
  364. package/lib/esm/features/permissions/SecureSidebarItem.js.map +1 -0
  365. package/lib/esm/features/permissions/UserPermissionsProvider.js +87 -0
  366. package/lib/esm/features/permissions/UserPermissionsProvider.js.map +1 -0
  367. package/lib/esm/features/permissions/helpers.js +12 -0
  368. package/lib/esm/features/permissions/helpers.js.map +1 -0
  369. package/lib/esm/features/permissions/index.js +5 -0
  370. package/lib/esm/features/permissions/index.js.map +1 -0
  371. package/lib/esm/features/store/collections/BrowseCollectionView.js +40 -0
  372. package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -0
  373. package/lib/esm/features/store/collections/CollectionsTable.js +64 -0
  374. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -0
  375. package/lib/esm/features/store/collections/CreateCollection.js +87 -0
  376. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -0
  377. package/lib/esm/features/store/collections/EditCollectionView.js +183 -0
  378. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -0
  379. package/lib/esm/features/store/collections/SelectCollection.js +119 -0
  380. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -0
  381. package/lib/esm/features/store/collections/SharedPropsEditor.js +39 -0
  382. package/lib/esm/features/store/collections/SharedPropsEditor.js.map +1 -0
  383. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js +35 -0
  384. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js.map +1 -0
  385. package/lib/esm/features/store/collections/index.js +8 -0
  386. package/lib/esm/features/store/collections/index.js.map +1 -0
  387. package/lib/esm/features/store/index.js +4 -0
  388. package/lib/esm/features/store/index.js.map +1 -0
  389. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +147 -0
  390. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +1 -0
  391. package/lib/esm/features/store/objects/DocumentSearchResults.js +204 -0
  392. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -0
  393. package/lib/esm/features/store/objects/DocumentSelectionProvider.js +81 -0
  394. package/lib/esm/features/store/objects/DocumentSelectionProvider.js.map +1 -0
  395. package/lib/esm/features/store/objects/DocumentTable.js +278 -0
  396. package/lib/esm/features/store/objects/DocumentTable.js.map +1 -0
  397. package/lib/esm/features/store/objects/ExportPropertiesModal.js +31 -0
  398. package/lib/esm/features/store/objects/ExportPropertiesModal.js.map +1 -0
  399. package/lib/esm/features/store/objects/components/ContentDispositionButton.js +31 -0
  400. package/lib/esm/features/store/objects/components/ContentDispositionButton.js.map +1 -0
  401. package/lib/esm/features/store/objects/components/ContentOverview.js +629 -0
  402. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -0
  403. package/lib/esm/features/store/objects/components/DocumentIcon.js +33 -0
  404. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -0
  405. package/lib/esm/features/store/objects/components/DocumentInput.js +51 -0
  406. package/lib/esm/features/store/objects/components/DocumentInput.js.map +1 -0
  407. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +171 -0
  408. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -0
  409. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +53 -0
  410. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -0
  411. package/lib/esm/features/store/objects/components/SelectDocument.js +55 -0
  412. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -0
  413. package/lib/esm/features/store/objects/components/SelectDocumentModal.js +7 -0
  414. package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +1 -0
  415. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +90 -0
  416. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -0
  417. package/lib/esm/features/store/objects/components/index.js +10 -0
  418. package/lib/esm/features/store/objects/components/index.js.map +1 -0
  419. package/lib/esm/features/store/objects/components/useContentPanelHooks.js +169 -0
  420. package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +1 -0
  421. package/lib/esm/features/store/objects/components/useDownloadObject.js +21 -0
  422. package/lib/esm/features/store/objects/components/useDownloadObject.js.map +1 -0
  423. package/lib/esm/features/store/objects/index.js +11 -0
  424. package/lib/esm/features/store/objects/index.js.map +1 -0
  425. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +86 -0
  426. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -0
  427. package/lib/esm/features/store/objects/layout/documentLayout.js +15 -0
  428. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -0
  429. package/lib/esm/features/store/objects/layout/index.js +3 -0
  430. package/lib/esm/features/store/objects/layout/index.js.map +1 -0
  431. package/lib/esm/features/store/objects/layout/renderers.js +157 -0
  432. package/lib/esm/features/store/objects/layout/renderers.js.map +1 -0
  433. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +175 -0
  434. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -0
  435. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +39 -0
  436. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -0
  437. package/lib/esm/features/store/objects/search/index.js +3 -0
  438. package/lib/esm/features/store/objects/search/index.js.map +1 -0
  439. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +150 -0
  440. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -0
  441. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js +2 -0
  442. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js.map +1 -0
  443. package/lib/esm/features/store/objects/selection/SelectionActions.js +69 -0
  444. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -0
  445. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +81 -0
  446. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -0
  447. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +53 -0
  448. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -0
  449. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js +30 -0
  450. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js.map +1 -0
  451. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +84 -0
  452. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -0
  453. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +106 -0
  454. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -0
  455. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +64 -0
  456. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +1 -0
  457. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js +72 -0
  458. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js.map +1 -0
  459. package/lib/esm/features/store/objects/selection/actions/index.js +8 -0
  460. package/lib/esm/features/store/objects/selection/actions/index.js.map +1 -0
  461. package/lib/esm/features/store/objects/selection/index.js +5 -0
  462. package/lib/esm/features/store/objects/selection/index.js.map +1 -0
  463. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +519 -0
  464. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -0
  465. package/lib/esm/features/store/objects/upload/index.js +4 -0
  466. package/lib/esm/features/store/objects/upload/index.js.map +1 -0
  467. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +195 -0
  468. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -0
  469. package/lib/esm/features/store/objects/upload/useUploadHandler.js +230 -0
  470. package/lib/esm/features/store/objects/upload/useUploadHandler.js.map +1 -0
  471. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +81 -0
  472. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +1 -0
  473. package/lib/esm/features/store/types/ContentObjectTypesTable.js +11 -0
  474. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +1 -0
  475. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +26 -0
  476. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -0
  477. package/lib/esm/features/store/types/ObjectSchemaEditor.js +103 -0
  478. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -0
  479. package/lib/esm/features/store/types/SelectContentType.js +43 -0
  480. package/lib/esm/features/store/types/SelectContentType.js.map +1 -0
  481. package/lib/esm/features/store/types/SelectContentTypeModal.js +28 -0
  482. package/lib/esm/features/store/types/SelectContentTypeModal.js.map +1 -0
  483. package/lib/esm/features/store/types/TableLayoutEditor.js +78 -0
  484. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -0
  485. package/lib/esm/features/store/types/index.js +9 -0
  486. package/lib/esm/features/store/types/index.js.map +1 -0
  487. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js +98 -0
  488. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js.map +1 -0
  489. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js +15 -0
  490. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js.map +1 -0
  491. package/lib/esm/features/store/types/search/index.js +3 -0
  492. package/lib/esm/features/store/types/search/index.js.map +1 -0
  493. package/lib/esm/features/user/UserAvatar.js +18 -0
  494. package/lib/esm/features/user/UserAvatar.js.map +1 -0
  495. package/lib/esm/features/user/UserInfo.js +121 -0
  496. package/lib/esm/features/user/UserInfo.js.map +1 -0
  497. package/lib/esm/features/user/index.js +3 -0
  498. package/lib/esm/features/user/index.js.map +1 -0
  499. package/lib/esm/features/utils/index.js +6 -0
  500. package/lib/esm/features/utils/index.js.map +1 -0
  501. package/lib/esm/features/utils/mimeType.js +17 -0
  502. package/lib/esm/features/utils/mimeType.js.map +1 -0
  503. package/lib/esm/features/utils/print.js +181 -0
  504. package/lib/esm/features/utils/print.js.map +1 -0
  505. package/lib/esm/features/utils/rendition.js +67 -0
  506. package/lib/esm/features/utils/rendition.js.map +1 -0
  507. package/lib/esm/features/utils/text.js +10 -0
  508. package/lib/esm/features/utils/text.js.map +1 -0
  509. package/lib/esm/features/utils/workflowStatus.js +43 -0
  510. package/lib/esm/features/utils/workflowStatus.js.map +1 -0
  511. package/lib/esm/layout/AppLayout.js +46 -0
  512. package/lib/esm/layout/AppLayout.js.map +1 -0
  513. package/lib/esm/layout/FullHeightLayout.js +18 -0
  514. package/lib/esm/layout/FullHeightLayout.js.map +1 -0
  515. package/lib/esm/layout/Navbar.js +40 -0
  516. package/lib/esm/layout/Navbar.js.map +1 -0
  517. package/lib/esm/layout/Sidebar.js +45 -0
  518. package/lib/esm/layout/Sidebar.js.map +1 -0
  519. package/lib/esm/layout/SidebarContext.js +10 -0
  520. package/lib/esm/layout/SidebarContext.js.map +1 -0
  521. package/lib/esm/layout/TitleBar.js +5 -0
  522. package/lib/esm/layout/TitleBar.js.map +1 -0
  523. package/lib/esm/layout/index.js +7 -0
  524. package/lib/esm/layout/index.js.map +1 -0
  525. package/lib/esm/router/FixLinks.js +23 -0
  526. package/lib/esm/router/FixLinks.js.map +1 -0
  527. package/lib/esm/router/HistoryNavigator.js +192 -0
  528. package/lib/esm/router/HistoryNavigator.js.map +1 -0
  529. package/lib/esm/router/Nav.js +26 -0
  530. package/lib/esm/router/Nav.js.map +1 -0
  531. package/lib/esm/router/NestedNavigationContext.js +19 -0
  532. package/lib/esm/router/NestedNavigationContext.js.map +1 -0
  533. package/lib/esm/router/NestedRouterProvider.js +44 -0
  534. package/lib/esm/router/NestedRouterProvider.js.map +1 -0
  535. package/lib/esm/router/PathMatcher.js +159 -0
  536. package/lib/esm/router/PathMatcher.js.map +1 -0
  537. package/lib/esm/router/PathWithParams.js +34 -0
  538. package/lib/esm/router/PathWithParams.js.map +1 -0
  539. package/lib/esm/router/Route404.js +18 -0
  540. package/lib/esm/router/Route404.js.map +1 -0
  541. package/lib/esm/router/RouteComponent.js +32 -0
  542. package/lib/esm/router/RouteComponent.js.map +1 -0
  543. package/lib/esm/router/Router.js +161 -0
  544. package/lib/esm/router/Router.js.map +1 -0
  545. package/lib/esm/router/RouterProvider.js +41 -0
  546. package/lib/esm/router/RouterProvider.js.map +1 -0
  547. package/lib/esm/router/index.js +11 -0
  548. package/lib/esm/router/index.js.map +1 -0
  549. package/lib/esm/router/path.js +140 -0
  550. package/lib/esm/router/path.js.map +1 -0
  551. package/lib/esm/session/TypeRegistry.js +24 -0
  552. package/lib/esm/session/TypeRegistry.js.map +1 -0
  553. package/lib/esm/session/UserSession.js +192 -0
  554. package/lib/esm/session/UserSession.js.map +1 -0
  555. package/lib/esm/session/UserSessionProvider.js +179 -0
  556. package/lib/esm/session/UserSessionProvider.js.map +1 -0
  557. package/lib/esm/session/auth/composable.js +255 -0
  558. package/lib/esm/session/auth/composable.js.map +1 -0
  559. package/lib/esm/session/auth/firebase.js +158 -0
  560. package/lib/esm/session/auth/firebase.js.map +1 -0
  561. package/lib/esm/session/auth/useAuthState.js +46 -0
  562. package/lib/esm/session/auth/useAuthState.js.map +1 -0
  563. package/lib/esm/session/auth/useCurrentTenant.js +63 -0
  564. package/lib/esm/session/auth/useCurrentTenant.js.map +1 -0
  565. package/lib/esm/session/constants.js +3 -0
  566. package/lib/esm/session/constants.js.map +1 -0
  567. package/lib/esm/session/index.js +9 -0
  568. package/lib/esm/session/index.js.map +1 -0
  569. package/lib/esm/session/useUXTracking.js +29 -0
  570. package/lib/esm/session/useUXTracking.js.map +1 -0
  571. package/lib/esm/shell/SplashScreen.js +26 -0
  572. package/lib/esm/shell/SplashScreen.js.map +1 -0
  573. package/lib/esm/shell/VertesiaShell.js +10 -0
  574. package/lib/esm/shell/VertesiaShell.js.map +1 -0
  575. package/lib/esm/shell/apps/AppInstallationProvider.js +13 -0
  576. package/lib/esm/shell/apps/AppInstallationProvider.js.map +1 -0
  577. package/lib/esm/shell/apps/AppProjectSelector.js +36 -0
  578. package/lib/esm/shell/apps/AppProjectSelector.js.map +1 -0
  579. package/lib/esm/shell/apps/StandaloneApp.js +87 -0
  580. package/lib/esm/shell/apps/StandaloneApp.js.map +1 -0
  581. package/lib/esm/shell/apps/index.js +4 -0
  582. package/lib/esm/shell/apps/index.js.map +1 -0
  583. package/lib/esm/shell/index.js +8 -0
  584. package/lib/esm/shell/index.js.map +1 -0
  585. package/lib/esm/shell/login/EnterpriseSigninButton.js +84 -0
  586. package/lib/esm/shell/login/EnterpriseSigninButton.js.map +1 -0
  587. package/lib/esm/shell/login/GitHubSignInButton.js +24 -0
  588. package/lib/esm/shell/login/GitHubSignInButton.js.map +1 -0
  589. package/lib/esm/shell/login/GoogleSignInButton.js +25 -0
  590. package/lib/esm/shell/login/GoogleSignInButton.js.map +1 -0
  591. package/lib/esm/shell/login/InviteAcceptModal.js +62 -0
  592. package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -0
  593. package/lib/esm/shell/login/MicrosoftSigninButton.js +19 -0
  594. package/lib/esm/shell/login/MicrosoftSigninButton.js.map +1 -0
  595. package/lib/esm/shell/login/PreviewIcon.js +23 -0
  596. package/lib/esm/shell/login/PreviewIcon.js.map +1 -0
  597. package/lib/esm/shell/login/SignInModal.js +9 -0
  598. package/lib/esm/shell/login/SignInModal.js.map +1 -0
  599. package/lib/esm/shell/login/SigninScreen.js +64 -0
  600. package/lib/esm/shell/login/SigninScreen.js.map +1 -0
  601. package/lib/esm/shell/login/SignupForm.js +91 -0
  602. package/lib/esm/shell/login/SignupForm.js.map +1 -0
  603. package/lib/esm/shell/login/TerminalLogin.js +208 -0
  604. package/lib/esm/shell/login/TerminalLogin.js.map +1 -0
  605. package/lib/esm/shell/login/UserInfo.js +41 -0
  606. package/lib/esm/shell/login/UserInfo.js.map +1 -0
  607. package/lib/esm/shell/login/UserSessionMenu.js +37 -0
  608. package/lib/esm/shell/login/UserSessionMenu.js.map +1 -0
  609. package/lib/esm/shell/utils.js +6 -0
  610. package/lib/esm/shell/utils.js.map +1 -0
  611. package/lib/esm/widgets/Progress.js +5 -0
  612. package/lib/esm/widgets/Progress.js.map +1 -0
  613. package/lib/esm/widgets/SvgIcon.js +36 -0
  614. package/lib/esm/widgets/SvgIcon.js.map +1 -0
  615. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +103 -0
  616. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -0
  617. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js +33 -0
  618. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js.map +1 -0
  619. package/lib/esm/widgets/codemirror/MonacoEditor.js +128 -0
  620. package/lib/esm/widgets/codemirror/MonacoEditor.js.map +1 -0
  621. package/lib/esm/widgets/codemirror/index.js +3 -0
  622. package/lib/esm/widgets/codemirror/index.js.map +1 -0
  623. package/lib/esm/widgets/form/Form.js +100 -0
  624. package/lib/esm/widgets/form/Form.js.map +1 -0
  625. package/lib/esm/widgets/form/FormContext.js +31 -0
  626. package/lib/esm/widgets/form/FormContext.js.map +1 -0
  627. package/lib/esm/widgets/form/ManagedObject.js +287 -0
  628. package/lib/esm/widgets/form/ManagedObject.js.map +1 -0
  629. package/lib/esm/widgets/form/fields.js +12 -0
  630. package/lib/esm/widgets/form/fields.js.map +1 -0
  631. package/lib/esm/widgets/form/index.js +7 -0
  632. package/lib/esm/widgets/form/index.js.map +1 -0
  633. package/lib/esm/widgets/form/inputs.js +38 -0
  634. package/lib/esm/widgets/form/inputs.js.map +1 -0
  635. package/lib/esm/widgets/form/schema.js +197 -0
  636. package/lib/esm/widgets/form/schema.js.map +1 -0
  637. package/lib/esm/widgets/index.js +12 -0
  638. package/lib/esm/widgets/index.js.map +1 -0
  639. package/lib/esm/widgets/json-view/JSONCode.js +157 -0
  640. package/lib/esm/widgets/json-view/JSONCode.js.map +1 -0
  641. package/lib/esm/widgets/json-view/JSONDisplay.js +10 -0
  642. package/lib/esm/widgets/json-view/JSONDisplay.js.map +1 -0
  643. package/lib/esm/widgets/json-view/JSONView.js +106 -0
  644. package/lib/esm/widgets/json-view/JSONView.js.map +1 -0
  645. package/lib/esm/widgets/json-view/index.js +4 -0
  646. package/lib/esm/widgets/json-view/index.js.map +1 -0
  647. package/lib/esm/widgets/json-view/types.js +2 -0
  648. package/lib/esm/widgets/json-view/types.js.map +1 -0
  649. package/lib/esm/widgets/markdown/CodeBlockRendering.js +38 -0
  650. package/lib/esm/widgets/markdown/CodeBlockRendering.js.map +1 -0
  651. package/lib/esm/widgets/markdown/MarkdownRenderer.js +424 -0
  652. package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -0
  653. package/lib/esm/widgets/markdown/MermaidDiagram.js +71 -0
  654. package/lib/esm/widgets/markdown/MermaidDiagram.js.map +1 -0
  655. package/lib/esm/widgets/markdown/index.js +3 -0
  656. package/lib/esm/widgets/markdown/index.js.map +1 -0
  657. package/lib/esm/widgets/popover/Popover.js +73 -0
  658. package/lib/esm/widgets/popover/Popover.js.map +1 -0
  659. package/lib/esm/widgets/popover/context.js +7 -0
  660. package/lib/esm/widgets/popover/context.js.map +1 -0
  661. package/lib/esm/widgets/popover/index.js +3 -0
  662. package/lib/esm/widgets/popover/index.js.map +1 -0
  663. package/lib/esm/widgets/popover/slots.js +22 -0
  664. package/lib/esm/widgets/popover/slots.js.map +1 -0
  665. package/lib/esm/widgets/properties/PropertiesView.js +8 -0
  666. package/lib/esm/widgets/properties/PropertiesView.js.map +1 -0
  667. package/lib/esm/widgets/properties/index.js +2 -0
  668. package/lib/esm/widgets/properties/index.js.map +1 -0
  669. package/lib/esm/widgets/schema-editor/ManagedSchema.js +300 -0
  670. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -0
  671. package/lib/esm/widgets/schema-editor/editor/Editable.js +110 -0
  672. package/lib/esm/widgets/schema-editor/editor/Editable.js.map +1 -0
  673. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js +8 -0
  674. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -0
  675. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +81 -0
  676. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +1 -0
  677. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js +7 -0
  678. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js.map +1 -0
  679. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js +9 -0
  680. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js.map +1 -0
  681. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +84 -0
  682. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -0
  683. package/lib/esm/widgets/schema-editor/index.js +7 -0
  684. package/lib/esm/widgets/schema-editor/index.js.map +1 -0
  685. package/lib/esm/widgets/schema-editor/json-schema4-utils.js +188 -0
  686. package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -0
  687. package/lib/esm/widgets/schema-editor/type-signature.js +30 -0
  688. package/lib/esm/widgets/schema-editor/type-signature.js.map +1 -0
  689. package/lib/esm/widgets/upload/DropZone.js +175 -0
  690. package/lib/esm/widgets/upload/DropZone.js.map +1 -0
  691. package/lib/esm/widgets/upload/UploadResultCategory.js +19 -0
  692. package/lib/esm/widgets/upload/UploadResultCategory.js.map +1 -0
  693. package/lib/esm/widgets/upload/UploadSummary.js +30 -0
  694. package/lib/esm/widgets/upload/UploadSummary.js.map +1 -0
  695. package/lib/esm/widgets/upload/index.js +4 -0
  696. package/lib/esm/widgets/upload/index.js.map +1 -0
  697. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js +11 -0
  698. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js.map +1 -0
  699. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js +8 -0
  700. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js.map +1 -0
  701. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js +11 -0
  702. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js.map +1 -0
  703. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js +11 -0
  704. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js.map +1 -0
  705. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js +9 -0
  706. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js.map +1 -0
  707. package/lib/esm/widgets/xml-viewer/components/Elements/index.js +36 -0
  708. package/lib/esm/widgets/xml-viewer/components/Elements/index.js.map +1 -0
  709. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js +5 -0
  710. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js.map +1 -0
  711. package/lib/esm/widgets/xml-viewer/components/Tag/index.js +13 -0
  712. package/lib/esm/widgets/xml-viewer/components/Tag/index.js.map +1 -0
  713. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js +13 -0
  714. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js.map +1 -0
  715. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +39 -0
  716. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +1 -0
  717. package/lib/esm/widgets/xml-viewer/components/types.js +2 -0
  718. package/lib/esm/widgets/xml-viewer/components/types.js.map +1 -0
  719. package/lib/esm/widgets/xml-viewer/constants/index.js +27 -0
  720. package/lib/esm/widgets/xml-viewer/constants/index.js.map +1 -0
  721. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js +10 -0
  722. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js.map +1 -0
  723. package/lib/esm/widgets/xml-viewer/helpers/index.js +40 -0
  724. package/lib/esm/widgets/xml-viewer/helpers/index.js.map +1 -0
  725. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js +22 -0
  726. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js.map +1 -0
  727. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js +31 -0
  728. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js.map +1 -0
  729. package/lib/esm/widgets/xml-viewer/index.js +3 -0
  730. package/lib/esm/widgets/xml-viewer/index.js.map +1 -0
  731. package/lib/esm/widgets/xml-viewer/types/index.js +2 -0
  732. package/lib/esm/widgets/xml-viewer/types/index.js.map +1 -0
  733. package/lib/tsconfig.tsbuildinfo +1 -0
  734. package/lib/types/core/components/Avatar.d.ts +16 -0
  735. package/lib/types/core/components/Avatar.d.ts.map +1 -0
  736. package/lib/types/core/components/Badge.d.ts +21 -0
  737. package/lib/types/core/components/Badge.d.ts.map +1 -0
  738. package/lib/types/core/components/Button.d.ts +14 -0
  739. package/lib/types/core/components/Button.d.ts.map +1 -0
  740. package/lib/types/core/components/Center.d.ts +8 -0
  741. package/lib/types/core/components/Center.d.ts.map +1 -0
  742. package/lib/types/core/components/ComboBox.d.ts +124 -0
  743. package/lib/types/core/components/ComboBox.d.ts.map +1 -0
  744. package/lib/types/core/components/ConfirmModal.d.ts +11 -0
  745. package/lib/types/core/components/ConfirmModal.d.ts.map +1 -0
  746. package/lib/types/core/components/DeleteModal.d.ts +11 -0
  747. package/lib/types/core/components/DeleteModal.d.ts.map +1 -0
  748. package/lib/types/core/components/Divider.d.ts +6 -0
  749. package/lib/types/core/components/Divider.d.ts.map +1 -0
  750. package/lib/types/core/components/Dropdown.d.ts +15 -0
  751. package/lib/types/core/components/Dropdown.d.ts.map +1 -0
  752. package/lib/types/core/components/DropdownList.d.ts +13 -0
  753. package/lib/types/core/components/DropdownList.d.ts.map +1 -0
  754. package/lib/types/core/components/EmptyCollection.d.ts +9 -0
  755. package/lib/types/core/components/EmptyCollection.d.ts.map +1 -0
  756. package/lib/types/core/components/FileUpload.d.ts +29 -0
  757. package/lib/types/core/components/FileUpload.d.ts.map +1 -0
  758. package/lib/types/core/components/FormItem.d.ts +13 -0
  759. package/lib/types/core/components/FormItem.d.ts.map +1 -0
  760. package/lib/types/core/components/InputList.d.ts +12 -0
  761. package/lib/types/core/components/InputList.d.ts.map +1 -0
  762. package/lib/types/core/components/Link.d.ts +7 -0
  763. package/lib/types/core/components/Link.d.ts.map +1 -0
  764. package/lib/types/core/components/MenuList.d.ts +14 -0
  765. package/lib/types/core/components/MenuList.d.ts.map +1 -0
  766. package/lib/types/core/components/MessageBox.d.ts +36 -0
  767. package/lib/types/core/components/MessageBox.d.ts.map +1 -0
  768. package/lib/types/core/components/Modal.d.ts +30 -0
  769. package/lib/types/core/components/Modal.d.ts.map +1 -0
  770. package/lib/types/core/components/NumberInput.d.ts +16 -0
  771. package/lib/types/core/components/NumberInput.d.ts.map +1 -0
  772. package/lib/types/core/components/Overlay.d.ts +25 -0
  773. package/lib/types/core/components/Overlay.d.ts.map +1 -0
  774. package/lib/types/core/components/Panel.d.ts +11 -0
  775. package/lib/types/core/components/Panel.d.ts.map +1 -0
  776. package/lib/types/core/components/Portal.d.ts +6 -0
  777. package/lib/types/core/components/Portal.d.ts.map +1 -0
  778. package/lib/types/core/components/RadioGroup.d.ts +26 -0
  779. package/lib/types/core/components/RadioGroup.d.ts.map +1 -0
  780. package/lib/types/core/components/SelectBox.d.ts +36 -0
  781. package/lib/types/core/components/SelectBox.d.ts.map +1 -0
  782. package/lib/types/core/components/SelectList.d.ts +19 -0
  783. package/lib/types/core/components/SelectList.d.ts.map +1 -0
  784. package/lib/types/core/components/SelectStack.d.ts +13 -0
  785. package/lib/types/core/components/SelectStack.d.ts.map +1 -0
  786. package/lib/types/core/components/SidePanel.d.ts +11 -0
  787. package/lib/types/core/components/SidePanel.d.ts.map +1 -0
  788. package/lib/types/core/components/Spinner.d.ts +7 -0
  789. package/lib/types/core/components/Spinner.d.ts.map +1 -0
  790. package/lib/types/core/components/Switch.d.ts +11 -0
  791. package/lib/types/core/components/Switch.d.ts.map +1 -0
  792. package/lib/types/core/components/TagsInput.d.ts +16 -0
  793. package/lib/types/core/components/TagsInput.d.ts.map +1 -0
  794. package/lib/types/core/components/index.d.ts +40 -0
  795. package/lib/types/core/components/index.d.ts.map +1 -0
  796. package/lib/types/core/components/libs/utils.d.ts +3 -0
  797. package/lib/types/core/components/libs/utils.d.ts.map +1 -0
  798. package/lib/types/core/components/libs/visuallyHidden.d.ts +7 -0
  799. package/lib/types/core/components/libs/visuallyHidden.d.ts.map +1 -0
  800. package/lib/types/core/components/popup/Popup.d.ts +26 -0
  801. package/lib/types/core/components/popup/Popup.d.ts.map +1 -0
  802. package/lib/types/core/components/popup/PopupController.d.ts +41 -0
  803. package/lib/types/core/components/popup/PopupController.d.ts.map +1 -0
  804. package/lib/types/core/components/popup/index.d.ts +4 -0
  805. package/lib/types/core/components/popup/index.d.ts.map +1 -0
  806. package/lib/types/core/components/popup/position.d.ts +59 -0
  807. package/lib/types/core/components/popup/position.d.ts.map +1 -0
  808. package/lib/types/core/components/popup/utils.d.ts +30 -0
  809. package/lib/types/core/components/popup/utils.d.ts.map +1 -0
  810. package/lib/types/core/components/shadcn/breadcrumb.d.ts +15 -0
  811. package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +1 -0
  812. package/lib/types/core/components/shadcn/button.d.ts +27 -0
  813. package/lib/types/core/components/shadcn/button.d.ts.map +1 -0
  814. package/lib/types/core/components/shadcn/calendar.d.ts +11 -0
  815. package/lib/types/core/components/shadcn/calendar.d.ts.map +1 -0
  816. package/lib/types/core/components/shadcn/card.d.ts +9 -0
  817. package/lib/types/core/components/shadcn/card.d.ts.map +1 -0
  818. package/lib/types/core/components/shadcn/checkbox.d.ts +5 -0
  819. package/lib/types/core/components/shadcn/checkbox.d.ts.map +1 -0
  820. package/lib/types/core/components/shadcn/command.d.ts +17 -0
  821. package/lib/types/core/components/shadcn/command.d.ts.map +1 -0
  822. package/lib/types/core/components/shadcn/dialog.d.ts +38 -0
  823. package/lib/types/core/components/shadcn/dialog.d.ts.map +1 -0
  824. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts +9 -0
  825. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts.map +1 -0
  826. package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts +7 -0
  827. package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts.map +1 -0
  828. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts +6 -0
  829. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts.map +1 -0
  830. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts +9 -0
  831. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts.map +1 -0
  832. package/lib/types/core/components/shadcn/filters/comboBox/StringListCombobox.d.ts +6 -0
  833. package/lib/types/core/components/shadcn/filters/comboBox/StringListCombobox.d.ts.map +1 -0
  834. package/lib/types/core/components/shadcn/filters/comboBox/TextCombobox.d.ts +6 -0
  835. package/lib/types/core/components/shadcn/filters/comboBox/TextCombobox.d.ts.map +1 -0
  836. package/lib/types/core/components/shadcn/filters/comboBox/comboBox.d.ts +5 -0
  837. package/lib/types/core/components/shadcn/filters/comboBox/comboBox.d.ts.map +1 -0
  838. package/lib/types/core/components/shadcn/filters/filter/SelectFilter.d.ts +12 -0
  839. package/lib/types/core/components/shadcn/filters/filter/SelectFilter.d.ts.map +1 -0
  840. package/lib/types/core/components/shadcn/filters/filter/StringListFilter.d.ts +11 -0
  841. package/lib/types/core/components/shadcn/filters/filter/StringListFilter.d.ts.map +1 -0
  842. package/lib/types/core/components/shadcn/filters/filter/TextFilter.d.ts +13 -0
  843. package/lib/types/core/components/shadcn/filters/filter/TextFilter.d.ts.map +1 -0
  844. package/lib/types/core/components/shadcn/filters/filter/dateFilter.d.ts +14 -0
  845. package/lib/types/core/components/shadcn/filters/filter/dateFilter.d.ts.map +1 -0
  846. package/lib/types/core/components/shadcn/filters/filter-styles.d.ts +2 -0
  847. package/lib/types/core/components/shadcn/filters/filter-styles.d.ts.map +1 -0
  848. package/lib/types/core/components/shadcn/filters/filterBar.d.ts +20 -0
  849. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -0
  850. package/lib/types/core/components/shadcn/filters/filters.d.ts +10 -0
  851. package/lib/types/core/components/shadcn/filters/filters.d.ts.map +1 -0
  852. package/lib/types/core/components/shadcn/filters/index.d.ts +6 -0
  853. package/lib/types/core/components/shadcn/filters/index.d.ts.map +1 -0
  854. package/lib/types/core/components/shadcn/filters/types.d.ts +35 -0
  855. package/lib/types/core/components/shadcn/filters/types.d.ts.map +1 -0
  856. package/lib/types/core/components/shadcn/heading.d.ts +6 -0
  857. package/lib/types/core/components/shadcn/heading.d.ts.map +1 -0
  858. package/lib/types/core/components/shadcn/index.d.ts +23 -0
  859. package/lib/types/core/components/shadcn/index.d.ts.map +1 -0
  860. package/lib/types/core/components/shadcn/input.d.ts +17 -0
  861. package/lib/types/core/components/shadcn/input.d.ts.map +1 -0
  862. package/lib/types/core/components/shadcn/label.d.ts +10 -0
  863. package/lib/types/core/components/shadcn/label.d.ts.map +1 -0
  864. package/lib/types/core/components/shadcn/popover.d.ts +24 -0
  865. package/lib/types/core/components/shadcn/popover.d.ts.map +1 -0
  866. package/lib/types/core/components/shadcn/resizeable.d.ts +9 -0
  867. package/lib/types/core/components/shadcn/resizeable.d.ts.map +1 -0
  868. package/lib/types/core/components/shadcn/selectBox.d.ts +36 -0
  869. package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -0
  870. package/lib/types/core/components/shadcn/separator.d.ts +6 -0
  871. package/lib/types/core/components/shadcn/separator.d.ts.map +1 -0
  872. package/lib/types/core/components/shadcn/tabs.d.ts +36 -0
  873. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -0
  874. package/lib/types/core/components/shadcn/text.d.ts +11 -0
  875. package/lib/types/core/components/shadcn/text.d.ts.map +1 -0
  876. package/lib/types/core/components/shadcn/textarea.d.ts +4 -0
  877. package/lib/types/core/components/shadcn/textarea.d.ts.map +1 -0
  878. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts +15 -0
  879. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts.map +1 -0
  880. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts +10 -0
  881. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts.map +1 -0
  882. package/lib/types/core/components/shadcn/tooltip.d.ts +21 -0
  883. package/lib/types/core/components/shadcn/tooltip.d.ts.map +1 -0
  884. package/lib/types/core/components/styles.d.ts +7 -0
  885. package/lib/types/core/components/styles.d.ts.map +1 -0
  886. package/lib/types/core/components/table/index.d.ts +19 -0
  887. package/lib/types/core/components/table/index.d.ts.map +1 -0
  888. package/lib/types/core/components/tabs/Tabs.d.ts +25 -0
  889. package/lib/types/core/components/tabs/Tabs.d.ts.map +1 -0
  890. package/lib/types/core/components/tabs/TabsContext.d.ts +17 -0
  891. package/lib/types/core/components/tabs/TabsContext.d.ts.map +1 -0
  892. package/lib/types/core/components/tabs/index.d.ts +3 -0
  893. package/lib/types/core/components/tabs/index.d.ts.map +1 -0
  894. package/lib/types/core/components/toast/NotificationPanel.d.ts +8 -0
  895. package/lib/types/core/components/toast/NotificationPanel.d.ts.map +1 -0
  896. package/lib/types/core/components/toast/ToastContext.d.ts +6 -0
  897. package/lib/types/core/components/toast/ToastContext.d.ts.map +1 -0
  898. package/lib/types/core/components/toast/ToastProps.d.ts +7 -0
  899. package/lib/types/core/components/toast/ToastProps.d.ts.map +1 -0
  900. package/lib/types/core/components/toast/ToastProvider.d.ts +6 -0
  901. package/lib/types/core/components/toast/ToastProvider.d.ts.map +1 -0
  902. package/lib/types/core/components/toast/index.d.ts +3 -0
  903. package/lib/types/core/components/toast/index.d.ts.map +1 -0
  904. package/lib/types/core/hooks/CompositeState.d.ts +137 -0
  905. package/lib/types/core/hooks/CompositeState.d.ts.map +1 -0
  906. package/lib/types/core/hooks/PortalContainerProvider.d.ts +7 -0
  907. package/lib/types/core/hooks/PortalContainerProvider.d.ts.map +1 -0
  908. package/lib/types/core/hooks/SharedState.d.ts +10 -0
  909. package/lib/types/core/hooks/SharedState.d.ts.map +1 -0
  910. package/lib/types/core/hooks/index.d.ts +16 -0
  911. package/lib/types/core/hooks/index.d.ts.map +1 -0
  912. package/lib/types/core/hooks/useClickOutside.d.ts +8 -0
  913. package/lib/types/core/hooks/useClickOutside.d.ts.map +1 -0
  914. package/lib/types/core/hooks/useCopyToClipboard.d.ts +5 -0
  915. package/lib/types/core/hooks/useCopyToClipboard.d.ts.map +1 -0
  916. package/lib/types/core/hooks/useDarkMode.d.ts +2 -0
  917. package/lib/types/core/hooks/useDarkMode.d.ts.map +1 -0
  918. package/lib/types/core/hooks/useDebounce.d.ts +2 -0
  919. package/lib/types/core/hooks/useDebounce.d.ts.map +1 -0
  920. package/lib/types/core/hooks/useEventSource.d.ts +2 -0
  921. package/lib/types/core/hooks/useEventSource.d.ts.map +1 -0
  922. package/lib/types/core/hooks/useFetch.d.ts +24 -0
  923. package/lib/types/core/hooks/useFetch.d.ts.map +1 -0
  924. package/lib/types/core/hooks/useFlag.d.ts +9 -0
  925. package/lib/types/core/hooks/useFlag.d.ts.map +1 -0
  926. package/lib/types/core/hooks/useIntersectionObserver.d.ts +14 -0
  927. package/lib/types/core/hooks/useIntersectionObserver.d.ts.map +1 -0
  928. package/lib/types/core/hooks/useIsFistRendering.d.ts +2 -0
  929. package/lib/types/core/hooks/useIsFistRendering.d.ts.map +1 -0
  930. package/lib/types/core/hooks/useSafeLayoutEffect.d.ts +4 -0
  931. package/lib/types/core/hooks/useSafeLayoutEffect.d.ts.map +1 -0
  932. package/lib/types/core/hooks/useScrollableSearch.d.ts +82 -0
  933. package/lib/types/core/hooks/useScrollableSearch.d.ts.map +1 -0
  934. package/lib/types/core/hooks/useSharedValue.d.ts +12 -0
  935. package/lib/types/core/hooks/useSharedValue.d.ts.map +1 -0
  936. package/lib/types/core/index.d.ts +4 -0
  937. package/lib/types/core/index.d.ts.map +1 -0
  938. package/lib/types/core/utils/cn.d.ts +3 -0
  939. package/lib/types/core/utils/cn.d.ts.map +1 -0
  940. package/lib/types/core/utils/index.d.ts +2 -0
  941. package/lib/types/core/utils/index.d.ts.map +1 -0
  942. package/lib/types/env/index.d.ts +76 -0
  943. package/lib/types/env/index.d.ts.map +1 -0
  944. package/lib/types/features/activity-doc/ActivityDoc.d.ts +14 -0
  945. package/lib/types/features/activity-doc/ActivityDoc.d.ts.map +1 -0
  946. package/lib/types/features/activity-doc/index.d.ts +2 -0
  947. package/lib/types/features/activity-doc/index.d.ts.map +1 -0
  948. package/lib/types/features/agent/PayloadBuilder.d.ts +68 -0
  949. package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -0
  950. package/lib/types/features/agent/chat/AgentChart.d.ts +75 -0
  951. package/lib/types/features/agent/chat/AgentChart.d.ts.map +1 -0
  952. package/lib/types/features/agent/chat/AnimatedThinkingDots.d.ts +38 -0
  953. package/lib/types/features/agent/chat/AnimatedThinkingDots.d.ts.map +1 -0
  954. package/lib/types/features/agent/chat/AskUserWidget.d.ts +84 -0
  955. package/lib/types/features/agent/chat/AskUserWidget.d.ts.map +1 -0
  956. package/lib/types/features/agent/chat/ImageLightbox.d.ts +18 -0
  957. package/lib/types/features/agent/chat/ImageLightbox.d.ts.map +1 -0
  958. package/lib/types/features/agent/chat/JumpingDots.d.ts +7 -0
  959. package/lib/types/features/agent/chat/JumpingDots.d.ts.map +1 -0
  960. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts +56 -0
  961. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -0
  962. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +29 -0
  963. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -0
  964. package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts +10 -0
  965. package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts.map +1 -0
  966. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +25 -0
  967. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -0
  968. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.d.ts +11 -0
  969. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.d.ts.map +1 -0
  970. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +18 -0
  971. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -0
  972. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +61 -0
  973. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -0
  974. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +30 -0
  975. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -0
  976. package/lib/types/features/agent/chat/ModernAgentOutput/MessagesContainer.d.ts +15 -0
  977. package/lib/types/features/agent/chat/ModernAgentOutput/MessagesContainer.d.ts.map +1 -0
  978. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts +9 -0
  979. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -0
  980. package/lib/types/features/agent/chat/ModernAgentOutput/SlideInPanel.d.ts +11 -0
  981. package/lib/types/features/agent/chat/ModernAgentOutput/SlideInPanel.d.ts.map +1 -0
  982. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingMessages.d.ts +8 -0
  983. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingMessages.d.ts.map +1 -0
  984. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts +10 -0
  985. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts.map +1 -0
  986. package/lib/types/features/agent/chat/ModernAgentOutput/StackedMessages.d.ts +8 -0
  987. package/lib/types/features/agent/chat/ModernAgentOutput/StackedMessages.d.ts.map +1 -0
  988. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts +26 -0
  989. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +1 -0
  990. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts +12 -0
  991. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts.map +1 -0
  992. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts +22 -0
  993. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -0
  994. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +107 -0
  995. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -0
  996. package/lib/types/features/agent/chat/SkillWidgetProvider.d.ts +11 -0
  997. package/lib/types/features/agent/chat/SkillWidgetProvider.d.ts.map +1 -0
  998. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts +18 -0
  999. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts.map +1 -0
  1000. package/lib/types/features/agent/chat/VegaLiteChart.d.ts +18 -0
  1001. package/lib/types/features/agent/chat/VegaLiteChart.d.ts.map +1 -0
  1002. package/lib/types/features/agent/chat/WaitingMessages.d.ts +2 -0
  1003. package/lib/types/features/agent/chat/WaitingMessages.d.ts.map +1 -0
  1004. package/lib/types/features/agent/chat/index.d.ts +17 -0
  1005. package/lib/types/features/agent/chat/index.d.ts.map +1 -0
  1006. package/lib/types/features/agent/chat/useArtifactUrlCache.d.ts +28 -0
  1007. package/lib/types/features/agent/chat/useArtifactUrlCache.d.ts.map +1 -0
  1008. package/lib/types/features/agent/createChartTool.d.ts +178 -0
  1009. package/lib/types/features/agent/createChartTool.d.ts.map +1 -0
  1010. package/lib/types/features/agent/examples.d.ts +59 -0
  1011. package/lib/types/features/agent/examples.d.ts.map +1 -0
  1012. package/lib/types/features/agent/index.d.ts +5 -0
  1013. package/lib/types/features/agent/index.d.ts.map +1 -0
  1014. package/lib/types/features/agent/visualization.d.ts +95 -0
  1015. package/lib/types/features/agent/visualization.d.ts.map +1 -0
  1016. package/lib/types/features/errors/PanelErrorBoundary.d.ts +5 -0
  1017. package/lib/types/features/errors/PanelErrorBoundary.d.ts.map +1 -0
  1018. package/lib/types/features/errors/RowErrorBoundary.d.ts +8 -0
  1019. package/lib/types/features/errors/RowErrorBoundary.d.ts.map +1 -0
  1020. package/lib/types/features/errors/VertesiaErrorBoundary.d.ts +12 -0
  1021. package/lib/types/features/errors/VertesiaErrorBoundary.d.ts.map +1 -0
  1022. package/lib/types/features/errors/WidgetErrorBoundary.d.ts +5 -0
  1023. package/lib/types/features/errors/WidgetErrorBoundary.d.ts.map +1 -0
  1024. package/lib/types/features/errors/index.d.ts +5 -0
  1025. package/lib/types/features/errors/index.d.ts.map +1 -0
  1026. package/lib/types/features/facets/CollectionsFacetsNav.d.ts +14 -0
  1027. package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -0
  1028. package/lib/types/features/facets/DocumentsFacetsNav.d.ts +17 -0
  1029. package/lib/types/features/facets/DocumentsFacetsNav.d.ts.map +1 -0
  1030. package/lib/types/features/facets/EnvironmentFacet.d.ts +10 -0
  1031. package/lib/types/features/facets/EnvironmentFacet.d.ts.map +1 -0
  1032. package/lib/types/features/facets/InteractionsFacetsNav.d.ts +14 -0
  1033. package/lib/types/features/facets/InteractionsFacetsNav.d.ts.map +1 -0
  1034. package/lib/types/features/facets/PromptsFacetsNav.d.ts +15 -0
  1035. package/lib/types/features/facets/PromptsFacetsNav.d.ts.map +1 -0
  1036. package/lib/types/features/facets/RunsFacetsNav.d.ts +20 -0
  1037. package/lib/types/features/facets/RunsFacetsNav.d.ts.map +1 -0
  1038. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts +14 -0
  1039. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +1 -0
  1040. package/lib/types/features/facets/index.d.ts +15 -0
  1041. package/lib/types/features/facets/index.d.ts.map +1 -0
  1042. package/lib/types/features/facets/utils/SearchInterface.d.ts +14 -0
  1043. package/lib/types/features/facets/utils/SearchInterface.d.ts.map +1 -0
  1044. package/lib/types/features/facets/utils/StringFacet.d.ts +11 -0
  1045. package/lib/types/features/facets/utils/StringFacet.d.ts.map +1 -0
  1046. package/lib/types/features/facets/utils/StringListFacet.d.ts +11 -0
  1047. package/lib/types/features/facets/utils/StringListFacet.d.ts.map +1 -0
  1048. package/lib/types/features/facets/utils/TypeFacet.d.ts +16 -0
  1049. package/lib/types/features/facets/utils/TypeFacet.d.ts.map +1 -0
  1050. package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts +12 -0
  1051. package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts.map +1 -0
  1052. package/lib/types/features/facets/utils/VInteractionFacet.d.ts +15 -0
  1053. package/lib/types/features/facets/utils/VInteractionFacet.d.ts.map +1 -0
  1054. package/lib/types/features/facets/utils/VStringFacet.d.ts +21 -0
  1055. package/lib/types/features/facets/utils/VStringFacet.d.ts.map +1 -0
  1056. package/lib/types/features/facets/utils/VTypeFacet.d.ts +12 -0
  1057. package/lib/types/features/facets/utils/VTypeFacet.d.ts.map +1 -0
  1058. package/lib/types/features/facets/utils/VUserFacet.d.ts +11 -0
  1059. package/lib/types/features/facets/utils/VUserFacet.d.ts.map +1 -0
  1060. package/lib/types/features/facets/utils/utils.d.ts +4 -0
  1061. package/lib/types/features/facets/utils/utils.d.ts.map +1 -0
  1062. package/lib/types/features/index.d.ts +12 -0
  1063. package/lib/types/features/index.d.ts.map +1 -0
  1064. package/lib/types/features/layout/GenericPageNavHeader.d.ts +14 -0
  1065. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -0
  1066. package/lib/types/features/layout/NotFoundView.d.ts +5 -0
  1067. package/lib/types/features/layout/NotFoundView.d.ts.map +1 -0
  1068. package/lib/types/features/layout/index.d.ts +3 -0
  1069. package/lib/types/features/layout/index.d.ts.map +1 -0
  1070. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts +13 -0
  1071. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts.map +1 -0
  1072. package/lib/types/features/magic-pdf/DownloadPopover.d.ts +7 -0
  1073. package/lib/types/features/magic-pdf/DownloadPopover.d.ts.map +1 -0
  1074. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts +8 -0
  1075. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts.map +1 -0
  1076. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts +58 -0
  1077. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -0
  1078. package/lib/types/features/magic-pdf/MagicPdfView.d.ts +7 -0
  1079. package/lib/types/features/magic-pdf/MagicPdfView.d.ts.map +1 -0
  1080. package/lib/types/features/magic-pdf/index.d.ts +2 -0
  1081. package/lib/types/features/magic-pdf/index.d.ts.map +1 -0
  1082. package/lib/types/features/magic-pdf/types.d.ts +2 -0
  1083. package/lib/types/features/magic-pdf/types.d.ts.map +1 -0
  1084. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts +83 -0
  1085. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts.map +1 -0
  1086. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts +29 -0
  1087. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts.map +1 -0
  1088. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts +19 -0
  1089. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -0
  1090. package/lib/types/features/pdf-viewer/index.d.ts +4 -0
  1091. package/lib/types/features/pdf-viewer/index.d.ts.map +1 -0
  1092. package/lib/types/features/permissions/SecureButton.d.ts +8 -0
  1093. package/lib/types/features/permissions/SecureButton.d.ts.map +1 -0
  1094. package/lib/types/features/permissions/SecureSidebarItem.d.ts +8 -0
  1095. package/lib/types/features/permissions/SecureSidebarItem.d.ts.map +1 -0
  1096. package/lib/types/features/permissions/UserPermissionsProvider.d.ts +21 -0
  1097. package/lib/types/features/permissions/UserPermissionsProvider.d.ts.map +1 -0
  1098. package/lib/types/features/permissions/helpers.d.ts +5 -0
  1099. package/lib/types/features/permissions/helpers.d.ts.map +1 -0
  1100. package/lib/types/features/permissions/index.d.ts +5 -0
  1101. package/lib/types/features/permissions/index.d.ts.map +1 -0
  1102. package/lib/types/features/store/collections/BrowseCollectionView.d.ts +7 -0
  1103. package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -0
  1104. package/lib/types/features/store/collections/CollectionsTable.d.ts +6 -0
  1105. package/lib/types/features/store/collections/CollectionsTable.d.ts.map +1 -0
  1106. package/lib/types/features/store/collections/CreateCollection.d.ts +13 -0
  1107. package/lib/types/features/store/collections/CreateCollection.d.ts.map +1 -0
  1108. package/lib/types/features/store/collections/EditCollectionView.d.ts +8 -0
  1109. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -0
  1110. package/lib/types/features/store/collections/SelectCollection.d.ts +20 -0
  1111. package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -0
  1112. package/lib/types/features/store/collections/SharedPropsEditor.d.ts +7 -0
  1113. package/lib/types/features/store/collections/SharedPropsEditor.d.ts.map +1 -0
  1114. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts +7 -0
  1115. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts.map +1 -0
  1116. package/lib/types/features/store/collections/index.d.ts +8 -0
  1117. package/lib/types/features/store/collections/index.d.ts.map +1 -0
  1118. package/lib/types/features/store/index.d.ts +4 -0
  1119. package/lib/types/features/store/index.d.ts.map +1 -0
  1120. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts +8 -0
  1121. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts.map +1 -0
  1122. package/lib/types/features/store/objects/DocumentSearchResults.d.ts +20 -0
  1123. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -0
  1124. package/lib/types/features/store/objects/DocumentSelectionProvider.d.ts +33 -0
  1125. package/lib/types/features/store/objects/DocumentSelectionProvider.d.ts.map +1 -0
  1126. package/lib/types/features/store/objects/DocumentTable.d.ts +25 -0
  1127. package/lib/types/features/store/objects/DocumentTable.d.ts.map +1 -0
  1128. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts +12 -0
  1129. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts.map +1 -0
  1130. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts +9 -0
  1131. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -0
  1132. package/lib/types/features/store/objects/components/ContentOverview.d.ts +9 -0
  1133. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -0
  1134. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +18 -0
  1135. package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +1 -0
  1136. package/lib/types/features/store/objects/components/DocumentInput.d.ts +8 -0
  1137. package/lib/types/features/store/objects/components/DocumentInput.d.ts.map +1 -0
  1138. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts +9 -0
  1139. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts.map +1 -0
  1140. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts +9 -0
  1141. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +1 -0
  1142. package/lib/types/features/store/objects/components/SelectDocument.d.ts +9 -0
  1143. package/lib/types/features/store/objects/components/SelectDocument.d.ts.map +1 -0
  1144. package/lib/types/features/store/objects/components/SelectDocumentModal.d.ts +9 -0
  1145. package/lib/types/features/store/objects/components/SelectDocumentModal.d.ts.map +1 -0
  1146. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts +12 -0
  1147. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts.map +1 -0
  1148. package/lib/types/features/store/objects/components/index.d.ts +10 -0
  1149. package/lib/types/features/store/objects/components/index.d.ts.map +1 -0
  1150. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts +30 -0
  1151. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -0
  1152. package/lib/types/features/store/objects/components/useDownloadObject.d.ts +4 -0
  1153. package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +1 -0
  1154. package/lib/types/features/store/objects/index.d.ts +11 -0
  1155. package/lib/types/features/store/objects/index.d.ts.map +1 -0
  1156. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +18 -0
  1157. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts.map +1 -0
  1158. package/lib/types/features/store/objects/layout/documentLayout.d.ts +20 -0
  1159. package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +1 -0
  1160. package/lib/types/features/store/objects/layout/index.d.ts +3 -0
  1161. package/lib/types/features/store/objects/layout/index.d.ts.map +1 -0
  1162. package/lib/types/features/store/objects/layout/renderers.d.ts +3 -0
  1163. package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -0
  1164. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +52 -0
  1165. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -0
  1166. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts +14 -0
  1167. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts.map +1 -0
  1168. package/lib/types/features/store/objects/search/index.d.ts +3 -0
  1169. package/lib/types/features/store/objects/search/index.d.ts.map +1 -0
  1170. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts +26 -0
  1171. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -0
  1172. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts +28 -0
  1173. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts.map +1 -0
  1174. package/lib/types/features/store/objects/selection/SelectionActions.d.ts +6 -0
  1175. package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -0
  1176. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts +4 -0
  1177. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts.map +1 -0
  1178. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts +4 -0
  1179. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts.map +1 -0
  1180. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts +16 -0
  1181. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts.map +1 -0
  1182. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +5 -0
  1183. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -0
  1184. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts +4 -0
  1185. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts.map +1 -0
  1186. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts +4 -0
  1187. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts.map +1 -0
  1188. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts +4 -0
  1189. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts.map +1 -0
  1190. package/lib/types/features/store/objects/selection/actions/index.d.ts +8 -0
  1191. package/lib/types/features/store/objects/selection/actions/index.d.ts.map +1 -0
  1192. package/lib/types/features/store/objects/selection/index.d.ts +5 -0
  1193. package/lib/types/features/store/objects/selection/index.d.ts.map +1 -0
  1194. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts +39 -0
  1195. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -0
  1196. package/lib/types/features/store/objects/upload/index.d.ts +4 -0
  1197. package/lib/types/features/store/objects/upload/index.d.ts.map +1 -0
  1198. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts +30 -0
  1199. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -0
  1200. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts +50 -0
  1201. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts.map +1 -0
  1202. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts +6 -0
  1203. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts.map +1 -0
  1204. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts +8 -0
  1205. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts.map +1 -0
  1206. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts +15 -0
  1207. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts.map +1 -0
  1208. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts +8 -0
  1209. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts.map +1 -0
  1210. package/lib/types/features/store/types/SelectContentType.d.ts +11 -0
  1211. package/lib/types/features/store/types/SelectContentType.d.ts.map +1 -0
  1212. package/lib/types/features/store/types/SelectContentTypeModal.d.ts +33 -0
  1213. package/lib/types/features/store/types/SelectContentTypeModal.d.ts.map +1 -0
  1214. package/lib/types/features/store/types/TableLayoutEditor.d.ts +9 -0
  1215. package/lib/types/features/store/types/TableLayoutEditor.d.ts.map +1 -0
  1216. package/lib/types/features/store/types/index.d.ts +9 -0
  1217. package/lib/types/features/store/types/index.d.ts.map +1 -0
  1218. package/lib/types/features/store/types/search/ObjectTypeSearchContext.d.ts +36 -0
  1219. package/lib/types/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -0
  1220. package/lib/types/features/store/types/search/ObjectTypeSearchProvider.d.ts +11 -0
  1221. package/lib/types/features/store/types/search/ObjectTypeSearchProvider.d.ts.map +1 -0
  1222. package/lib/types/features/store/types/search/index.d.ts +3 -0
  1223. package/lib/types/features/store/types/search/index.d.ts.map +1 -0
  1224. package/lib/types/features/user/UserAvatar.d.ts +9 -0
  1225. package/lib/types/features/user/UserAvatar.d.ts.map +1 -0
  1226. package/lib/types/features/user/UserInfo.d.ts +48 -0
  1227. package/lib/types/features/user/UserInfo.d.ts.map +1 -0
  1228. package/lib/types/features/user/index.d.ts +3 -0
  1229. package/lib/types/features/user/index.d.ts.map +1 -0
  1230. package/lib/types/features/utils/index.d.ts +6 -0
  1231. package/lib/types/features/utils/index.d.ts.map +1 -0
  1232. package/lib/types/features/utils/mimeType.d.ts +6 -0
  1233. package/lib/types/features/utils/mimeType.d.ts.map +1 -0
  1234. package/lib/types/features/utils/print.d.ts +10 -0
  1235. package/lib/types/features/utils/print.d.ts.map +1 -0
  1236. package/lib/types/features/utils/rendition.d.ts +4 -0
  1237. package/lib/types/features/utils/rendition.d.ts.map +1 -0
  1238. package/lib/types/features/utils/text.d.ts +3 -0
  1239. package/lib/types/features/utils/text.d.ts.map +1 -0
  1240. package/lib/types/features/utils/workflowStatus.d.ts +10 -0
  1241. package/lib/types/features/utils/workflowStatus.d.ts.map +1 -0
  1242. package/lib/types/layout/AppLayout.d.ts +13 -0
  1243. package/lib/types/layout/AppLayout.d.ts.map +1 -0
  1244. package/lib/types/layout/FullHeightLayout.d.ts +27 -0
  1245. package/lib/types/layout/FullHeightLayout.d.ts.map +1 -0
  1246. package/lib/types/layout/Navbar.d.ts +33 -0
  1247. package/lib/types/layout/Navbar.d.ts.map +1 -0
  1248. package/lib/types/layout/Sidebar.d.ts +31 -0
  1249. package/lib/types/layout/Sidebar.d.ts.map +1 -0
  1250. package/lib/types/layout/SidebarContext.d.ts +9 -0
  1251. package/lib/types/layout/SidebarContext.d.ts.map +1 -0
  1252. package/lib/types/layout/TitleBar.d.ts +6 -0
  1253. package/lib/types/layout/TitleBar.d.ts.map +1 -0
  1254. package/lib/types/layout/index.d.ts +7 -0
  1255. package/lib/types/layout/index.d.ts.map +1 -0
  1256. package/lib/types/router/FixLinks.d.ts +7 -0
  1257. package/lib/types/router/FixLinks.d.ts.map +1 -0
  1258. package/lib/types/router/HistoryNavigator.d.ts +59 -0
  1259. package/lib/types/router/HistoryNavigator.d.ts.map +1 -0
  1260. package/lib/types/router/Nav.d.ts +30 -0
  1261. package/lib/types/router/Nav.d.ts.map +1 -0
  1262. package/lib/types/router/NestedNavigationContext.d.ts +9 -0
  1263. package/lib/types/router/NestedNavigationContext.d.ts.map +1 -0
  1264. package/lib/types/router/NestedRouterProvider.d.ts +14 -0
  1265. package/lib/types/router/NestedRouterProvider.d.ts.map +1 -0
  1266. package/lib/types/router/PathMatcher.d.ts +36 -0
  1267. package/lib/types/router/PathMatcher.d.ts.map +1 -0
  1268. package/lib/types/router/PathWithParams.d.ts +9 -0
  1269. package/lib/types/router/PathWithParams.d.ts.map +1 -0
  1270. package/lib/types/router/Route404.d.ts +4 -0
  1271. package/lib/types/router/Route404.d.ts.map +1 -0
  1272. package/lib/types/router/RouteComponent.d.ts +6 -0
  1273. package/lib/types/router/RouteComponent.d.ts.map +1 -0
  1274. package/lib/types/router/Router.d.ts +74 -0
  1275. package/lib/types/router/Router.d.ts.map +1 -0
  1276. package/lib/types/router/RouterProvider.d.ts +15 -0
  1277. package/lib/types/router/RouterProvider.d.ts.map +1 -0
  1278. package/lib/types/router/index.d.ts +11 -0
  1279. package/lib/types/router/index.d.ts.map +1 -0
  1280. package/lib/types/router/path.d.ts +8 -0
  1281. package/lib/types/router/path.d.ts.map +1 -0
  1282. package/lib/types/session/TypeRegistry.d.ts +10 -0
  1283. package/lib/types/session/TypeRegistry.d.ts.map +1 -0
  1284. package/lib/types/session/UserSession.d.ts +40 -0
  1285. package/lib/types/session/UserSession.d.ts.map +1 -0
  1286. package/lib/types/session/UserSessionProvider.d.ts +7 -0
  1287. package/lib/types/session/UserSessionProvider.d.ts.map +1 -0
  1288. package/lib/types/session/auth/composable.d.ts +26 -0
  1289. package/lib/types/session/auth/composable.d.ts.map +1 -0
  1290. package/lib/types/session/auth/firebase.d.ts +10 -0
  1291. package/lib/types/session/auth/firebase.d.ts.map +1 -0
  1292. package/lib/types/session/auth/useAuthState.d.ts +10 -0
  1293. package/lib/types/session/auth/useAuthState.d.ts.map +1 -0
  1294. package/lib/types/session/auth/useCurrentTenant.d.ts +15 -0
  1295. package/lib/types/session/auth/useCurrentTenant.d.ts.map +1 -0
  1296. package/lib/types/session/constants.d.ts +3 -0
  1297. package/lib/types/session/constants.d.ts.map +1 -0
  1298. package/lib/types/session/index.d.ts +9 -0
  1299. package/lib/types/session/index.d.ts.map +1 -0
  1300. package/lib/types/session/useUXTracking.d.ts +6 -0
  1301. package/lib/types/session/useUXTracking.d.ts.map +1 -0
  1302. package/lib/types/shell/SplashScreen.d.ts +7 -0
  1303. package/lib/types/shell/SplashScreen.d.ts.map +1 -0
  1304. package/lib/types/shell/VertesiaShell.d.ts +10 -0
  1305. package/lib/types/shell/VertesiaShell.d.ts.map +1 -0
  1306. package/lib/types/shell/apps/AppInstallationProvider.d.ts +12 -0
  1307. package/lib/types/shell/apps/AppInstallationProvider.d.ts.map +1 -0
  1308. package/lib/types/shell/apps/AppProjectSelector.d.ts +12 -0
  1309. package/lib/types/shell/apps/AppProjectSelector.d.ts.map +1 -0
  1310. package/lib/types/shell/apps/StandaloneApp.d.ts +23 -0
  1311. package/lib/types/shell/apps/StandaloneApp.d.ts.map +1 -0
  1312. package/lib/types/shell/apps/index.d.ts +4 -0
  1313. package/lib/types/shell/apps/index.d.ts.map +1 -0
  1314. package/lib/types/shell/index.d.ts +8 -0
  1315. package/lib/types/shell/index.d.ts.map +1 -0
  1316. package/lib/types/shell/login/EnterpriseSigninButton.d.ts +6 -0
  1317. package/lib/types/shell/login/EnterpriseSigninButton.d.ts.map +1 -0
  1318. package/lib/types/shell/login/GitHubSignInButton.d.ts +6 -0
  1319. package/lib/types/shell/login/GitHubSignInButton.d.ts.map +1 -0
  1320. package/lib/types/shell/login/GoogleSignInButton.d.ts +6 -0
  1321. package/lib/types/shell/login/GoogleSignInButton.d.ts.map +1 -0
  1322. package/lib/types/shell/login/InviteAcceptModal.d.ts +2 -0
  1323. package/lib/types/shell/login/InviteAcceptModal.d.ts.map +1 -0
  1324. package/lib/types/shell/login/MicrosoftSigninButton.d.ts +6 -0
  1325. package/lib/types/shell/login/MicrosoftSigninButton.d.ts.map +1 -0
  1326. package/lib/types/shell/login/PreviewIcon.d.ts +6 -0
  1327. package/lib/types/shell/login/PreviewIcon.d.ts.map +1 -0
  1328. package/lib/types/shell/login/SignInModal.d.ts +7 -0
  1329. package/lib/types/shell/login/SignInModal.d.ts.map +1 -0
  1330. package/lib/types/shell/login/SigninScreen.d.ts +9 -0
  1331. package/lib/types/shell/login/SigninScreen.d.ts.map +1 -0
  1332. package/lib/types/shell/login/SignupForm.d.ts +8 -0
  1333. package/lib/types/shell/login/SignupForm.d.ts.map +1 -0
  1334. package/lib/types/shell/login/TerminalLogin.d.ts +2 -0
  1335. package/lib/types/shell/login/TerminalLogin.d.ts.map +1 -0
  1336. package/lib/types/shell/login/UserInfo.d.ts +6 -0
  1337. package/lib/types/shell/login/UserInfo.d.ts.map +1 -0
  1338. package/lib/types/shell/login/UserSessionMenu.d.ts +9 -0
  1339. package/lib/types/shell/login/UserSessionMenu.d.ts.map +1 -0
  1340. package/lib/types/shell/utils.d.ts +2 -0
  1341. package/lib/types/shell/utils.d.ts.map +1 -0
  1342. package/lib/types/widgets/Progress.d.ts +6 -0
  1343. package/lib/types/widgets/Progress.d.ts.map +1 -0
  1344. package/lib/types/widgets/SvgIcon.d.ts +7 -0
  1345. package/lib/types/widgets/SvgIcon.d.ts.map +1 -0
  1346. package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts +24 -0
  1347. package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts.map +1 -0
  1348. package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts +15 -0
  1349. package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts.map +1 -0
  1350. package/lib/types/widgets/codemirror/MonacoEditor.d.ts +38 -0
  1351. package/lib/types/widgets/codemirror/MonacoEditor.d.ts.map +1 -0
  1352. package/lib/types/widgets/codemirror/index.d.ts +5 -0
  1353. package/lib/types/widgets/codemirror/index.d.ts.map +1 -0
  1354. package/lib/types/widgets/form/Form.d.ts +22 -0
  1355. package/lib/types/widgets/form/Form.d.ts.map +1 -0
  1356. package/lib/types/widgets/form/FormContext.d.ts +20 -0
  1357. package/lib/types/widgets/form/FormContext.d.ts.map +1 -0
  1358. package/lib/types/widgets/form/ManagedObject.d.ts +82 -0
  1359. package/lib/types/widgets/form/ManagedObject.d.ts.map +1 -0
  1360. package/lib/types/widgets/form/fields.d.ts +16 -0
  1361. package/lib/types/widgets/form/fields.d.ts.map +1 -0
  1362. package/lib/types/widgets/form/index.d.ts +7 -0
  1363. package/lib/types/widgets/form/index.d.ts.map +1 -0
  1364. package/lib/types/widgets/form/inputs.d.ts +8 -0
  1365. package/lib/types/widgets/form/inputs.d.ts.map +1 -0
  1366. package/lib/types/widgets/form/schema.d.ts +47 -0
  1367. package/lib/types/widgets/form/schema.d.ts.map +1 -0
  1368. package/lib/types/widgets/index.d.ts +12 -0
  1369. package/lib/types/widgets/index.d.ts.map +1 -0
  1370. package/lib/types/widgets/json-view/JSONCode.d.ts +22 -0
  1371. package/lib/types/widgets/json-view/JSONCode.d.ts.map +1 -0
  1372. package/lib/types/widgets/json-view/JSONDisplay.d.ts +8 -0
  1373. package/lib/types/widgets/json-view/JSONDisplay.d.ts.map +1 -0
  1374. package/lib/types/widgets/json-view/JSONView.d.ts +7 -0
  1375. package/lib/types/widgets/json-view/JSONView.d.ts.map +1 -0
  1376. package/lib/types/widgets/json-view/index.d.ts +5 -0
  1377. package/lib/types/widgets/json-view/index.d.ts.map +1 -0
  1378. package/lib/types/widgets/json-view/types.d.ts +8 -0
  1379. package/lib/types/widgets/json-view/types.d.ts.map +1 -0
  1380. package/lib/types/widgets/markdown/CodeBlockRendering.d.ts +22 -0
  1381. package/lib/types/widgets/markdown/CodeBlockRendering.d.ts.map +1 -0
  1382. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts +26 -0
  1383. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -0
  1384. package/lib/types/widgets/markdown/MermaidDiagram.d.ts +23 -0
  1385. package/lib/types/widgets/markdown/MermaidDiagram.d.ts.map +1 -0
  1386. package/lib/types/widgets/markdown/index.d.ts +3 -0
  1387. package/lib/types/widgets/markdown/index.d.ts.map +1 -0
  1388. package/lib/types/widgets/popover/Popover.d.ts +38 -0
  1389. package/lib/types/widgets/popover/Popover.d.ts.map +1 -0
  1390. package/lib/types/widgets/popover/context.d.ts +8 -0
  1391. package/lib/types/widgets/popover/context.d.ts.map +1 -0
  1392. package/lib/types/widgets/popover/index.d.ts +3 -0
  1393. package/lib/types/widgets/popover/index.d.ts.map +1 -0
  1394. package/lib/types/widgets/popover/slots.d.ts +5 -0
  1395. package/lib/types/widgets/popover/slots.d.ts.map +1 -0
  1396. package/lib/types/widgets/properties/PropertiesView.d.ts +11 -0
  1397. package/lib/types/widgets/properties/PropertiesView.d.ts.map +1 -0
  1398. package/lib/types/widgets/properties/index.d.ts +2 -0
  1399. package/lib/types/widgets/properties/index.d.ts.map +1 -0
  1400. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +75 -0
  1401. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +1 -0
  1402. package/lib/types/widgets/schema-editor/editor/Editable.d.ts +40 -0
  1403. package/lib/types/widgets/schema-editor/editor/Editable.d.ts.map +1 -0
  1404. package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +8 -0
  1405. package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +1 -0
  1406. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts +5 -0
  1407. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts.map +1 -0
  1408. package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts +4 -0
  1409. package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts.map +1 -0
  1410. package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts +3 -0
  1411. package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts.map +1 -0
  1412. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts +9 -0
  1413. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -0
  1414. package/lib/types/widgets/schema-editor/index.d.ts +7 -0
  1415. package/lib/types/widgets/schema-editor/index.d.ts.map +1 -0
  1416. package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts +16 -0
  1417. package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts.map +1 -0
  1418. package/lib/types/widgets/schema-editor/type-signature.d.ts +19 -0
  1419. package/lib/types/widgets/schema-editor/type-signature.d.ts.map +1 -0
  1420. package/lib/types/widgets/upload/DropZone.d.ts +41 -0
  1421. package/lib/types/widgets/upload/DropZone.d.ts.map +1 -0
  1422. package/lib/types/widgets/upload/UploadResultCategory.d.ts +26 -0
  1423. package/lib/types/widgets/upload/UploadResultCategory.d.ts.map +1 -0
  1424. package/lib/types/widgets/upload/UploadSummary.d.ts +38 -0
  1425. package/lib/types/widgets/upload/UploadSummary.d.ts.map +1 -0
  1426. package/lib/types/widgets/upload/index.d.ts +4 -0
  1427. package/lib/types/widgets/upload/index.d.ts.map +1 -0
  1428. package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts +6 -0
  1429. package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts.map +1 -0
  1430. package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts +8 -0
  1431. package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts.map +1 -0
  1432. package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts +5 -0
  1433. package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts.map +1 -0
  1434. package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts +9 -0
  1435. package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts.map +1 -0
  1436. package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts +8 -0
  1437. package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts.map +1 -0
  1438. package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts +8 -0
  1439. package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts.map +1 -0
  1440. package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts +2 -0
  1441. package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts.map +1 -0
  1442. package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts +13 -0
  1443. package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts.map +1 -0
  1444. package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts +8 -0
  1445. package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts.map +1 -0
  1446. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts +3 -0
  1447. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts.map +1 -0
  1448. package/lib/types/widgets/xml-viewer/components/types.d.ts +104 -0
  1449. package/lib/types/widgets/xml-viewer/components/types.d.ts.map +1 -0
  1450. package/lib/types/widgets/xml-viewer/constants/index.d.ts +27 -0
  1451. package/lib/types/widgets/xml-viewer/constants/index.d.ts.map +1 -0
  1452. package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts +4 -0
  1453. package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts.map +1 -0
  1454. package/lib/types/widgets/xml-viewer/helpers/index.d.ts +13 -0
  1455. package/lib/types/widgets/xml-viewer/helpers/index.d.ts.map +1 -0
  1456. package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts +15 -0
  1457. package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts.map +1 -0
  1458. package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts +10 -0
  1459. package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts.map +1 -0
  1460. package/lib/types/widgets/xml-viewer/index.d.ts +3 -0
  1461. package/lib/types/widgets/xml-viewer/index.d.ts.map +1 -0
  1462. package/lib/types/widgets/xml-viewer/types/index.d.ts +16 -0
  1463. package/lib/types/widgets/xml-viewer/types/index.d.ts.map +1 -0
  1464. package/lib/vertesia-ui-core.js +2 -0
  1465. package/lib/vertesia-ui-core.js.map +1 -0
  1466. package/lib/vertesia-ui-env.js +2 -0
  1467. package/lib/vertesia-ui-env.js.map +1 -0
  1468. package/lib/vertesia-ui-features.js +2 -0
  1469. package/lib/vertesia-ui-features.js.map +1 -0
  1470. package/lib/vertesia-ui-layout.js +2 -0
  1471. package/lib/vertesia-ui-layout.js.map +1 -0
  1472. package/lib/vertesia-ui-router.js +2 -0
  1473. package/lib/vertesia-ui-router.js.map +1 -0
  1474. package/lib/vertesia-ui-session.js +2 -0
  1475. package/lib/vertesia-ui-session.js.map +1 -0
  1476. package/lib/vertesia-ui-shell.js +2 -0
  1477. package/lib/vertesia-ui-shell.js.map +1 -0
  1478. package/lib/vertesia-ui-widgets.js +2 -0
  1479. package/lib/vertesia-ui-widgets.js.map +1 -0
  1480. package/llms.txt +494 -0
  1481. package/package.json +189 -0
  1482. package/src/core/components/Avatar.tsx +67 -0
  1483. package/src/core/components/Badge.tsx +118 -0
  1484. package/src/core/components/Button.tsx +63 -0
  1485. package/src/core/components/Center.tsx +12 -0
  1486. package/src/core/components/ComboBox.tsx +488 -0
  1487. package/src/core/components/ConfirmModal.tsx +51 -0
  1488. package/src/core/components/DeleteModal.tsx +45 -0
  1489. package/src/core/components/Divider.tsx +11 -0
  1490. package/src/core/components/Dropdown.tsx +63 -0
  1491. package/src/core/components/DropdownList.tsx +72 -0
  1492. package/src/core/components/EmptyCollection.tsx +41 -0
  1493. package/src/core/components/FileUpload.tsx +196 -0
  1494. package/src/core/components/FormItem.tsx +36 -0
  1495. package/src/core/components/InputList.tsx +112 -0
  1496. package/src/core/components/Link.tsx +16 -0
  1497. package/src/core/components/MenuList.tsx +41 -0
  1498. package/src/core/components/MessageBox.tsx +101 -0
  1499. package/src/core/components/Modal.tsx +144 -0
  1500. package/src/core/components/NumberInput.tsx +64 -0
  1501. package/src/core/components/Overlay.tsx +129 -0
  1502. package/src/core/components/Panel.tsx +34 -0
  1503. package/src/core/components/Portal.tsx +33 -0
  1504. package/src/core/components/RadioGroup.tsx +100 -0
  1505. package/src/core/components/SelectBox.tsx +188 -0
  1506. package/src/core/components/SelectList.tsx +95 -0
  1507. package/src/core/components/SelectStack.tsx +63 -0
  1508. package/src/core/components/SidePanel.tsx +114 -0
  1509. package/src/core/components/Spinner.tsx +33 -0
  1510. package/src/core/components/Switch.tsx +30 -0
  1511. package/src/core/components/TagsInput.tsx +388 -0
  1512. package/src/core/components/index.ts +41 -0
  1513. package/src/core/components/libs/utils.tsx +6 -0
  1514. package/src/core/components/libs/visuallyHidden.tsx +25 -0
  1515. package/src/core/components/popup/Popup.tsx +94 -0
  1516. package/src/core/components/popup/PopupController.ts +182 -0
  1517. package/src/core/components/popup/index.ts +3 -0
  1518. package/src/core/components/popup/position.ts +277 -0
  1519. package/src/core/components/popup/utils.ts +82 -0
  1520. package/src/core/components/shadcn/breadcrumb.tsx +193 -0
  1521. package/src/core/components/shadcn/button.tsx +156 -0
  1522. package/src/core/components/shadcn/calendar.tsx +29 -0
  1523. package/src/core/components/shadcn/card.tsx +76 -0
  1524. package/src/core/components/shadcn/checkbox.tsx +28 -0
  1525. package/src/core/components/shadcn/command.tsx +176 -0
  1526. package/src/core/components/shadcn/dialog.tsx +266 -0
  1527. package/src/core/components/shadcn/filters/DynamicLabel.tsx +44 -0
  1528. package/src/core/components/shadcn/filters/animateChangeInHeight.tsx +41 -0
  1529. package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +211 -0
  1530. package/src/core/components/shadcn/filters/comboBox/SelectCombobox.tsx +145 -0
  1531. package/src/core/components/shadcn/filters/comboBox/StringListCombobox.tsx +76 -0
  1532. package/src/core/components/shadcn/filters/comboBox/TextCombobox.tsx +81 -0
  1533. package/src/core/components/shadcn/filters/comboBox/comboBox.tsx +4 -0
  1534. package/src/core/components/shadcn/filters/filter/SelectFilter.tsx +161 -0
  1535. package/src/core/components/shadcn/filters/filter/StringListFilter.tsx +58 -0
  1536. package/src/core/components/shadcn/filters/filter/TextFilter.tsx +69 -0
  1537. package/src/core/components/shadcn/filters/filter/dateFilter.tsx +256 -0
  1538. package/src/core/components/shadcn/filters/filter-styles.ts +87 -0
  1539. package/src/core/components/shadcn/filters/filterBar.tsx +375 -0
  1540. package/src/core/components/shadcn/filters/filters.tsx +141 -0
  1541. package/src/core/components/shadcn/filters/index.ts +5 -0
  1542. package/src/core/components/shadcn/filters/types.ts +38 -0
  1543. package/src/core/components/shadcn/heading.tsx +23 -0
  1544. package/src/core/components/shadcn/index.ts +23 -0
  1545. package/src/core/components/shadcn/input.tsx +92 -0
  1546. package/src/core/components/shadcn/label.tsx +31 -0
  1547. package/src/core/components/shadcn/popover.tsx +115 -0
  1548. package/src/core/components/shadcn/resizeable.tsx +54 -0
  1549. package/src/core/components/shadcn/selectBox.tsx +337 -0
  1550. package/src/core/components/shadcn/separator.tsx +31 -0
  1551. package/src/core/components/shadcn/tabs.tsx +302 -0
  1552. package/src/core/components/shadcn/text.tsx +33 -0
  1553. package/src/core/components/shadcn/textarea.tsx +21 -0
  1554. package/src/core/components/shadcn/theme/ThemeProvider.tsx +75 -0
  1555. package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +35 -0
  1556. package/src/core/components/shadcn/tooltip.tsx +59 -0
  1557. package/src/core/components/styles.ts +11 -0
  1558. package/src/core/components/table/index.tsx +70 -0
  1559. package/src/core/components/tabs/Tabs.tsx +132 -0
  1560. package/src/core/components/tabs/TabsContext.ts +25 -0
  1561. package/src/core/components/tabs/index.ts +2 -0
  1562. package/src/core/components/toast/NotificationPanel.tsx +107 -0
  1563. package/src/core/components/toast/ToastContext.ts +12 -0
  1564. package/src/core/components/toast/ToastProps.ts +6 -0
  1565. package/src/core/components/toast/ToastProvider.tsx +26 -0
  1566. package/src/core/components/toast/index.ts +2 -0
  1567. package/src/core/hooks/CompositeState.tsx +292 -0
  1568. package/src/core/hooks/PortalContainerProvider.tsx +59 -0
  1569. package/src/core/hooks/SharedState.tsx +69 -0
  1570. package/src/core/hooks/index.ts +15 -0
  1571. package/src/core/hooks/useClickOutside.tsx +29 -0
  1572. package/src/core/hooks/useCopyToClipboard.tsx +28 -0
  1573. package/src/core/hooks/useDarkMode.ts +11 -0
  1574. package/src/core/hooks/useDebounce.tsx +15 -0
  1575. package/src/core/hooks/useEventSource.ts +35 -0
  1576. package/src/core/hooks/useFetch.ts +51 -0
  1577. package/src/core/hooks/useFlag.tsx +13 -0
  1578. package/src/core/hooks/useIntersectionObserver.tsx +40 -0
  1579. package/src/core/hooks/useIsFistRendering.ts +17 -0
  1580. package/src/core/hooks/useSafeLayoutEffect.ts +5 -0
  1581. package/src/core/hooks/useScrollableSearch.tsx +193 -0
  1582. package/src/core/hooks/useSharedValue.ts +22 -0
  1583. package/src/core/index.ts +3 -0
  1584. package/src/core/utils/cn.ts +6 -0
  1585. package/src/core/utils/index.ts +1 -0
  1586. package/src/env/index.ts +126 -0
  1587. package/src/features/activity-doc/ActivityDoc.tsx +199 -0
  1588. package/src/features/activity-doc/index.ts +1 -0
  1589. package/src/features/agent/CHART_INSTRUCTIONS.md +228 -0
  1590. package/src/features/agent/PayloadBuilder.tsx +319 -0
  1591. package/src/features/agent/chat/AgentChart.tsx +702 -0
  1592. package/src/features/agent/chat/AnimatedThinkingDots.tsx +350 -0
  1593. package/src/features/agent/chat/AskUserWidget.tsx +362 -0
  1594. package/src/features/agent/chat/ImageLightbox.tsx +99 -0
  1595. package/src/features/agent/chat/JumpingDots.tsx +16 -0
  1596. package/src/features/agent/chat/ModernAgentConversation.tsx +1465 -0
  1597. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +483 -0
  1598. package/src/features/agent/chat/ModernAgentOutput/BatchProgressPanel.tsx +228 -0
  1599. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +231 -0
  1600. package/src/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.tsx +66 -0
  1601. package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +271 -0
  1602. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +550 -0
  1603. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +512 -0
  1604. package/src/features/agent/chat/ModernAgentOutput/MessagesContainer.tsx +63 -0
  1605. package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +124 -0
  1606. package/src/features/agent/chat/ModernAgentOutput/README-image-support.md +43 -0
  1607. package/src/features/agent/chat/ModernAgentOutput/SlideInPanel.tsx +72 -0
  1608. package/src/features/agent/chat/ModernAgentOutput/SlidingMessages.tsx +97 -0
  1609. package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +185 -0
  1610. package/src/features/agent/chat/ModernAgentOutput/StackedMessages.tsx +33 -0
  1611. package/src/features/agent/chat/ModernAgentOutput/StreamingMessage.tsx +323 -0
  1612. package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +583 -0
  1613. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +167 -0
  1614. package/src/features/agent/chat/ModernAgentOutput/utils.ts +527 -0
  1615. package/src/features/agent/chat/ModernAgentOutput/with-types.d.ts +15 -0
  1616. package/src/features/agent/chat/SkillWidgetProvider.tsx +106 -0
  1617. package/src/features/agent/chat/SlidingThinkingIndicator.tsx +459 -0
  1618. package/src/features/agent/chat/VegaLiteChart.tsx +1081 -0
  1619. package/src/features/agent/chat/WaitingMessages.ts +66 -0
  1620. package/src/features/agent/chat/applyParameterValues.test.ts +258 -0
  1621. package/src/features/agent/chat/index.ts +35 -0
  1622. package/src/features/agent/chat/useArtifactUrlCache.tsx +92 -0
  1623. package/src/features/agent/createChartTool.ts +643 -0
  1624. package/src/features/agent/examples.ts +321 -0
  1625. package/src/features/agent/index.ts +4 -0
  1626. package/src/features/agent/visualization.ts +227 -0
  1627. package/src/features/errors/PanelErrorBoundary.tsx +30 -0
  1628. package/src/features/errors/RowErrorBoundary.tsx +28 -0
  1629. package/src/features/errors/VertesiaErrorBoundary.tsx +28 -0
  1630. package/src/features/errors/WidgetErrorBoundary.tsx +27 -0
  1631. package/src/features/errors/index.ts +4 -0
  1632. package/src/features/facets/CollectionsFacetsNav.tsx +119 -0
  1633. package/src/features/facets/DocumentsFacetsNav.tsx +184 -0
  1634. package/src/features/facets/EnvironmentFacet.tsx +53 -0
  1635. package/src/features/facets/InteractionsFacetsNav.tsx +121 -0
  1636. package/src/features/facets/PromptsFacetsNav.tsx +110 -0
  1637. package/src/features/facets/RunsFacetsNav.tsx +209 -0
  1638. package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +134 -0
  1639. package/src/features/facets/index.ts +16 -0
  1640. package/src/features/facets/utils/SearchInterface.tsx +12 -0
  1641. package/src/features/facets/utils/StringFacet.tsx +23 -0
  1642. package/src/features/facets/utils/StringListFacet.tsx +22 -0
  1643. package/src/features/facets/utils/TypeFacet.tsx +59 -0
  1644. package/src/features/facets/utils/VEnvironmentFacet.tsx +43 -0
  1645. package/src/features/facets/utils/VInteractionFacet.tsx +73 -0
  1646. package/src/features/facets/utils/VStringFacet.tsx +41 -0
  1647. package/src/features/facets/utils/VTypeFacet.tsx +81 -0
  1648. package/src/features/facets/utils/VUserFacet.tsx +50 -0
  1649. package/src/features/facets/utils/utils.tsx +9 -0
  1650. package/src/features/index.ts +11 -0
  1651. package/src/features/layout/GenericPageNavHeader.tsx +122 -0
  1652. package/src/features/layout/NotFoundView.tsx +11 -0
  1653. package/src/features/layout/index.ts +2 -0
  1654. package/src/features/magic-pdf/AnnotatedImageSlider.tsx +482 -0
  1655. package/src/features/magic-pdf/DownloadPopover.tsx +70 -0
  1656. package/src/features/magic-pdf/ExtractedContentView.tsx +132 -0
  1657. package/src/features/magic-pdf/MagicPdfProvider.tsx +297 -0
  1658. package/src/features/magic-pdf/MagicPdfView.tsx +221 -0
  1659. package/src/features/magic-pdf/index.ts +1 -0
  1660. package/src/features/magic-pdf/types.ts +1 -0
  1661. package/src/features/pdf-viewer/PdfPageRenderer.tsx +612 -0
  1662. package/src/features/pdf-viewer/PdfPageSlider.tsx +473 -0
  1663. package/src/features/pdf-viewer/SimplePdfViewer.tsx +142 -0
  1664. package/src/features/pdf-viewer/index.ts +3 -0
  1665. package/src/features/permissions/SecureButton.tsx +18 -0
  1666. package/src/features/permissions/SecureSidebarItem.tsx +19 -0
  1667. package/src/features/permissions/UserPermissionsProvider.tsx +103 -0
  1668. package/src/features/permissions/helpers.ts +16 -0
  1669. package/src/features/permissions/index.ts +4 -0
  1670. package/src/features/store/collections/BrowseCollectionView.tsx +49 -0
  1671. package/src/features/store/collections/CollectionsTable.tsx +125 -0
  1672. package/src/features/store/collections/CreateCollection.tsx +140 -0
  1673. package/src/features/store/collections/EditCollectionView.tsx +294 -0
  1674. package/src/features/store/collections/SelectCollection.tsx +231 -0
  1675. package/src/features/store/collections/SharedPropsEditor.tsx +60 -0
  1676. package/src/features/store/collections/SyncMemberHeadsToggle.tsx +48 -0
  1677. package/src/features/store/collections/index.ts +7 -0
  1678. package/src/features/store/index.ts +3 -0
  1679. package/src/features/store/objects/DocumentPreviewPanel.tsx +414 -0
  1680. package/src/features/store/objects/DocumentSearchResults.tsx +382 -0
  1681. package/src/features/store/objects/DocumentSelectionProvider.tsx +99 -0
  1682. package/src/features/store/objects/DocumentTable.tsx +419 -0
  1683. package/src/features/store/objects/ExportPropertiesModal.tsx +89 -0
  1684. package/src/features/store/objects/components/ContentDispositionButton.tsx +45 -0
  1685. package/src/features/store/objects/components/ContentOverview.tsx +1362 -0
  1686. package/src/features/store/objects/components/DocumentIcon.tsx +134 -0
  1687. package/src/features/store/objects/components/DocumentInput.tsx +89 -0
  1688. package/src/features/store/objects/components/PropertiesEditorModal.tsx +257 -0
  1689. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +146 -0
  1690. package/src/features/store/objects/components/SelectDocument.tsx +109 -0
  1691. package/src/features/store/objects/components/SelectDocumentModal.tsx +20 -0
  1692. package/src/features/store/objects/components/VectorSearchWidget.tsx +143 -0
  1693. package/src/features/store/objects/components/index.ts +9 -0
  1694. package/src/features/store/objects/components/useContentPanelHooks.ts +185 -0
  1695. package/src/features/store/objects/components/useDownloadObject.ts +29 -0
  1696. package/src/features/store/objects/index.ts +10 -0
  1697. package/src/features/store/objects/layout/DocumentTableColumn.tsx +99 -0
  1698. package/src/features/store/objects/layout/documentLayout.tsx +69 -0
  1699. package/src/features/store/objects/layout/index.ts +2 -0
  1700. package/src/features/store/objects/layout/knowledge.md +239 -0
  1701. package/src/features/store/objects/layout/renderers.tsx +185 -0
  1702. package/src/features/store/objects/search/DocumentSearchContext.ts +215 -0
  1703. package/src/features/store/objects/search/DocumentSearchProvider.tsx +50 -0
  1704. package/src/features/store/objects/search/index.ts +2 -0
  1705. package/src/features/store/objects/selection/ObjectsActionContext.tsx +197 -0
  1706. package/src/features/store/objects/selection/ObjectsActionSpec.ts +31 -0
  1707. package/src/features/store/objects/selection/SelectionActions.tsx +150 -0
  1708. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +137 -0
  1709. package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +76 -0
  1710. package/src/features/store/objects/selection/actions/ConfirmAction.tsx +46 -0
  1711. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +97 -0
  1712. package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +117 -0
  1713. package/src/features/store/objects/selection/actions/RemoveFromCollectionAction.tsx +77 -0
  1714. package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +122 -0
  1715. package/src/features/store/objects/selection/actions/index.ts +7 -0
  1716. package/src/features/store/objects/selection/index.ts +4 -0
  1717. package/src/features/store/objects/upload/DocumentUploadModal.tsx +927 -0
  1718. package/src/features/store/objects/upload/index.ts +3 -0
  1719. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +245 -0
  1720. package/src/features/store/objects/upload/useUploadHandler.ts +325 -0
  1721. package/src/features/store/types/ContentObjectTypesSearch.tsx +115 -0
  1722. package/src/features/store/types/ContentObjectTypesTable.tsx +41 -0
  1723. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +63 -0
  1724. package/src/features/store/types/ObjectSchemaEditor.tsx +141 -0
  1725. package/src/features/store/types/SelectContentType.tsx +88 -0
  1726. package/src/features/store/types/SelectContentTypeModal.tsx +142 -0
  1727. package/src/features/store/types/TableLayoutEditor.tsx +104 -0
  1728. package/src/features/store/types/index.ts +8 -0
  1729. package/src/features/store/types/search/ObjectTypeSearchContext.tsx +119 -0
  1730. package/src/features/store/types/search/ObjectTypeSearchProvider.tsx +24 -0
  1731. package/src/features/store/types/search/index.ts +2 -0
  1732. package/src/features/user/UserAvatar.tsx +34 -0
  1733. package/src/features/user/UserInfo.tsx +282 -0
  1734. package/src/features/user/index.ts +2 -0
  1735. package/src/features/utils/index.ts +5 -0
  1736. package/src/features/utils/mimeType.ts +18 -0
  1737. package/src/features/utils/print.ts +189 -0
  1738. package/src/features/utils/rendition.ts +97 -0
  1739. package/src/features/utils/text.ts +10 -0
  1740. package/src/features/utils/workflowStatus.ts +44 -0
  1741. package/src/layout/AppLayout.tsx +132 -0
  1742. package/src/layout/FullHeightLayout.tsx +74 -0
  1743. package/src/layout/Navbar.tsx +127 -0
  1744. package/src/layout/Sidebar.tsx +139 -0
  1745. package/src/layout/SidebarContext.ts +17 -0
  1746. package/src/layout/TitleBar.tsx +7 -0
  1747. package/src/layout/index.ts +6 -0
  1748. package/src/router/FixLinks.tsx +28 -0
  1749. package/src/router/HistoryNavigator.ts +237 -0
  1750. package/src/router/Nav.tsx +56 -0
  1751. package/src/router/NestedNavigationContext.tsx +32 -0
  1752. package/src/router/NestedRouterProvider.tsx +64 -0
  1753. package/src/router/PathMatcher.ts +166 -0
  1754. package/src/router/PathWithParams.ts +34 -0
  1755. package/src/router/Route404.tsx +18 -0
  1756. package/src/router/RouteComponent.tsx +41 -0
  1757. package/src/router/Router.tsx +216 -0
  1758. package/src/router/RouterProvider.tsx +55 -0
  1759. package/src/router/index.ts +10 -0
  1760. package/src/router/path.ts +154 -0
  1761. package/src/session/TypeRegistry.ts +27 -0
  1762. package/src/session/UserSession.ts +228 -0
  1763. package/src/session/UserSessionProvider.tsx +189 -0
  1764. package/src/session/auth/composable.ts +295 -0
  1765. package/src/session/auth/firebase.ts +168 -0
  1766. package/src/session/auth/useAuthState.ts +57 -0
  1767. package/src/session/auth/useCurrentTenant.ts +73 -0
  1768. package/src/session/constants.ts +2 -0
  1769. package/src/session/index.ts +8 -0
  1770. package/src/session/useUXTracking.tsx +38 -0
  1771. package/src/shell/SplashScreen.tsx +74 -0
  1772. package/src/shell/VertesiaShell.tsx +29 -0
  1773. package/src/shell/apps/AppInstallationProvider.tsx +22 -0
  1774. package/src/shell/apps/AppProjectSelector.tsx +58 -0
  1775. package/src/shell/apps/StandaloneApp.tsx +174 -0
  1776. package/src/shell/apps/index.ts +3 -0
  1777. package/src/shell/index.tsx +7 -0
  1778. package/src/shell/login/EnterpriseSigninButton.tsx +109 -0
  1779. package/src/shell/login/GitHubSignInButton.tsx +40 -0
  1780. package/src/shell/login/GoogleSignInButton.tsx +36 -0
  1781. package/src/shell/login/InviteAcceptModal.tsx +94 -0
  1782. package/src/shell/login/MicrosoftSigninButton.tsx +30 -0
  1783. package/src/shell/login/PreviewIcon.tsx +29 -0
  1784. package/src/shell/login/SignInModal.tsx +28 -0
  1785. package/src/shell/login/SigninScreen.tsx +162 -0
  1786. package/src/shell/login/SignupForm.tsx +179 -0
  1787. package/src/shell/login/TerminalLogin.tsx +338 -0
  1788. package/src/shell/login/UserInfo.tsx +78 -0
  1789. package/src/shell/login/UserSessionMenu.tsx +92 -0
  1790. package/src/shell/utils.tsx +7 -0
  1791. package/src/vite-env.d.ts +2 -0
  1792. package/src/widgets/Progress.tsx +10 -0
  1793. package/src/widgets/SvgIcon.tsx +44 -0
  1794. package/src/widgets/codemirror/CodeMirrorEditor.tsx +122 -0
  1795. package/src/widgets/codemirror/CodemirrorStateSingleton.tsx +39 -0
  1796. package/src/widgets/codemirror/MonacoEditor.tsx +200 -0
  1797. package/src/widgets/codemirror/index.ts +6 -0
  1798. package/src/widgets/form/Form.tsx +180 -0
  1799. package/src/widgets/form/FormContext.ts +41 -0
  1800. package/src/widgets/form/ManagedObject.ts +336 -0
  1801. package/src/widgets/form/fields.tsx +36 -0
  1802. package/src/widgets/form/index.ts +6 -0
  1803. package/src/widgets/form/inputs.tsx +45 -0
  1804. package/src/widgets/form/schema.ts +222 -0
  1805. package/src/widgets/index.ts +11 -0
  1806. package/src/widgets/json-view/JSONCode.tsx +176 -0
  1807. package/src/widgets/json-view/JSONDisplay.tsx +24 -0
  1808. package/src/widgets/json-view/JSONView.tsx +183 -0
  1809. package/src/widgets/json-view/index.ts +4 -0
  1810. package/src/widgets/json-view/types.ts +5 -0
  1811. package/src/widgets/markdown/CodeBlockRendering.tsx +56 -0
  1812. package/src/widgets/markdown/MarkdownRenderer.tsx +588 -0
  1813. package/src/widgets/markdown/MermaidDiagram.tsx +115 -0
  1814. package/src/widgets/markdown/index.ts +2 -0
  1815. package/src/widgets/popover/Popover.tsx +171 -0
  1816. package/src/widgets/popover/context.ts +15 -0
  1817. package/src/widgets/popover/index.ts +2 -0
  1818. package/src/widgets/popover/slots.ts +24 -0
  1819. package/src/widgets/properties/PropertiesView.tsx +34 -0
  1820. package/src/widgets/properties/index.ts +1 -0
  1821. package/src/widgets/schema-editor/ManagedSchema.ts +337 -0
  1822. package/src/widgets/schema-editor/editor/Editable.tsx +251 -0
  1823. package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +15 -0
  1824. package/src/widgets/schema-editor/editor/PropertyEditor.tsx +150 -0
  1825. package/src/widgets/schema-editor/editor/PropertyViewer.tsx +15 -0
  1826. package/src/widgets/schema-editor/editor/SchemaContext.tsx +9 -0
  1827. package/src/widgets/schema-editor/editor/SchemaEditor.test.ts +48 -0
  1828. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +161 -0
  1829. package/src/widgets/schema-editor/index.ts +6 -0
  1830. package/src/widgets/schema-editor/json-schema4-utils.ts +187 -0
  1831. package/src/widgets/schema-editor/type-signature.ts +39 -0
  1832. package/src/widgets/upload/DropZone.tsx +259 -0
  1833. package/src/widgets/upload/UploadResultCategory.tsx +81 -0
  1834. package/src/widgets/upload/UploadSummary.tsx +115 -0
  1835. package/src/widgets/upload/index.ts +3 -0
  1836. package/src/widgets/xml-viewer/components/Attributes/index.tsx +27 -0
  1837. package/src/widgets/xml-viewer/components/CDataTag/index.tsx +21 -0
  1838. package/src/widgets/xml-viewer/components/CollapseIcon/index.tsx +32 -0
  1839. package/src/widgets/xml-viewer/components/CommentTag/index.tsx +30 -0
  1840. package/src/widgets/xml-viewer/components/DeclarationTag/index.tsx +23 -0
  1841. package/src/widgets/xml-viewer/components/Elements/index.tsx +83 -0
  1842. package/src/widgets/xml-viewer/components/InvalidXml/index.tsx +3 -0
  1843. package/src/widgets/xml-viewer/components/Tag/index.tsx +47 -0
  1844. package/src/widgets/xml-viewer/components/TextElement/index.tsx +28 -0
  1845. package/src/widgets/xml-viewer/components/XMLViewer.tsx +65 -0
  1846. package/src/widgets/xml-viewer/components/types.ts +104 -0
  1847. package/src/widgets/xml-viewer/constants/index.ts +28 -0
  1848. package/src/widgets/xml-viewer/context/xml-viewer-context.ts +12 -0
  1849. package/src/widgets/xml-viewer/helpers/index.ts +56 -0
  1850. package/src/widgets/xml-viewer/hooks/useCollapsible.ts +28 -0
  1851. package/src/widgets/xml-viewer/hooks/useXMLViewer.ts +34 -0
  1852. package/src/widgets/xml-viewer/index.ts +2 -0
  1853. package/src/widgets/xml-viewer/types/index.ts +21 -0
  1854. package/tsconfig.dist.json +20 -0
@@ -0,0 +1,2 @@
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,createContext as u,useContext as m,useCallback as p,memo as h,useRef as g,Component as f}from"react";import{cn as y,useToast as b,Button as v,VTooltip as x,Badge as w,Popover as N,PopoverTrigger as k,PopoverContent as C,Command as S,CommandList as P,CommandGroup as j,CommandItem as _,Modal as I,ModalTitle as T,ModalBody as A,RadioGroup as z,FormItem as F,Input as E,ModalFooter as $,RadioOptionAdapter as D,Center as R,useFetch as O,ErrorBox as L,ResizablePanelGroup as U,ResizablePanel as M,ResizableHandle as V,Spinner as q,Portal as B,VModal as K,VModalTitle as W,VModalBody as H,VModalFooter as G,Card as J,Separator as Y,CardContent as Z,SelectBox as Q,InputList as X,Avatar as ee,Table as te,FilterProvider as ne,FilterBtn as re,FilterBar as ae,FilterClear as se,TBody as ie,SharedState as le,useWatchSharedState as oe,MessageBox as ce,VSelectBox as de,useIntersectionObserver as ue,useFlag as me,Styles as pe,Checkbox as he,NumberInput as ge,SidePanel as fe,Divider as ye,Textarea as be,Switch as ve,TR as xe,EmptyCollection as we,ConfirmModal as Ne,THead as ke,useDebounce as Ce,Panel as Se,CommandInput as Pe,CommandEmpty as je,TagsInput as _e,SelectList as Ie,DialogDescription as Te,Heading as Ae,VTabs as ze,VTabsBar as Fe,VTabsPanel as Ee,Breadcrumbs as $e}from"@vertesia/ui/core";import{X as De,ExternalLink as Re,ChevronDown as Oe,ChevronRight as Le,CopyIcon as Ue,CheckCircle as Me,AlertCircle as Ve,Loader2 as qe,Layers as Be,MessageSquare as Ke,HelpCircle as We,Send as He,XCircle as Ge,Bot as Je,Info as Ye,User as Ze,Clock as Qe,AlertTriangle as Xe,ClipboardList as et,XIcon as tt,MoreVertical as nt,DownloadCloudIcon as rt,TableProperties as at,LayoutGrid as st,ChevronsUp as it,ChevronsDown as lt,Minus as ot,Plus as ct,Maximize as dt,Image as ut,ScanSearch as mt,Download as pt,Maximize2 as ht,Copy as gt,SquarePen as ft,FileSearch as yt,Eye as bt,Users as vt,RefreshCw as xt,UploadIcon as wt,CheckCircleIcon as Nt,AlertCircleIcon as kt,FileIcon as Ct,XCircleIcon as St,FolderIcon as Pt,ChevronsUpDown as jt,FileText as _t,Settings as It,Trash2 as Tt,Search as At,FolderClosed as zt,Check as Ft,EllipsisVertical as Et,HelpCircleIcon as $t,FileTextIcon as Dt,CheckIcon as Rt,PaperclipIcon as Ot,StopCircleIcon as Lt,SendIcon as Ut,Activity as Mt,Circle as Vt,Minimize2 as qt,Cpu as Bt}from"lucide-react";import{useUserSession as Kt}from"@vertesia/ui/session";import{AgentMessageType as Wt,AgentSearchScope as Ht,mergeInCodePromptSchemas as Gt,supportsToolUse as Jt,ImageRenditionFormat as Yt,WorkflowExecutionStatus as Zt,PDF_RENDITION_NAME as Qt,MarkdownRenditionFormat as Xt,ContentObjectStatus as en,ContentNature as tn,POSTER_RENDITION_NAME as nn,AUDIO_RENDITION_NAME as rn,PrincipalType as an,InteractionStatus as sn,SearchTypes as ln,SupportedEmbeddingTypes as on,FileProcessingStatus as cn,normalizeToolCollection as dn}from"@vertesia/common";import un from"dayjs";import{NavLink as mn,useNavigate as pn}from"@vertesia/ui/router";import{MarkdownRenderer as hn,Popover as gn,XMLViewer as fn,JSONCode as yn,JSONDisplay as bn,Progress as vn,DropZone as xn,UploadSummary as wn,useSchema as Nn,CodeMirrorEditor as kn,SchemaEditor as Cn,ManagedObject as Sn,GeneratedForm as Pn,CodeBlockRendererProvider as jn}from"@vertesia/ui/widgets";import _n,{Ajv as In}from"ajv";import Tn from"@monaco-editor/react";import{pdfjs as An,Document as zn,Page as Fn}from"react-pdf";import En from"dayjs/plugin/localizedFormat";import $n from"dayjs/plugin/relativeTime";import{Md5 as Dn}from"ts-md5";import{json as Rn}from"@codemirror/lang-json";import{UserInfo as On,SyncMemberHeadsToggle as Ln,SharedPropsEditor as Un}from"@vertesia/ui/features";import{basicSetup as Mn}from"codemirror";import{toPng as Vn}from"html-to-image";import*as qn from"@radix-ui/react-dialog";import Bn from"papaparse";import{VegaEmbed as Kn}from"react-vega";import{twMerge as Wn}from"tailwind-merge";import"jwt-decode";import"@vertesia/ui/env";import"firebase/analytics";import"firebase/app";import"firebase/auth";import"@vertesia/client";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 Pr({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 _r({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(Pr,{children:"optional"}),e(Pr,{children:n.type.value})]})}function Ir({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(Pr,{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(Pr,{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(_r,{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(Pr,{secondary:!0,children:t},n))})}function Er({members:n}){return e(Dr,{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($r,{properties:n})})}function $r({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 Dr({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,u]=c("increasing"),[m,p]=c(.4);return d(()=>{let e,t=Date.now();const n=()=>{const r=Date.now(),a=r-t;t=r,l(e=>{const t=m*(a/16);let n="increasing"===o?e+t:e-t;return n>=85?(u("decreasing"),p(.3+.2*Math.random()),85):n<=15?(u("increasing"),p(.3+.2*Math.random()),15):(Math.random()>.99&&p(e=>Math.max(.2,Math.min(.5,e+(.1*Math.random()-.05)))),n)}),e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{cancelAnimationFrame(e)}},[o,m]),t("div",{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={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"}},l={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 i=()=>{r+=.02;const l=a.map((e,a)=>10+40*(Math.sin(r*t[a]+n[a])+1));s(l),e=requestAnimationFrame(i)};return e=requestAnimationFrame(i),()=>{cancelAnimationFrame(e)}},[]),e("div",{className:y("flex items-end justify-center",i[r].width,i[r].height,i[r].gap,t),children:a.map((t,a)=>e("div",{className:y(i[r].barWidth,"rounded-full transform-gpu",l[n]),style:{height:`${t}%`,transition:"height 100ms cubic-bezier(0.4, 0.0, 0.2, 1)",opacity:.9}},a))})}const Kr=u(null);function Wr(){const e=m(Kr);return e||{openImage:e=>window.open(e,"_blank"),closeImage:()=>{}}}function Hr({children:n}){const[r,a]=c(null),s=p((e,t)=>{a({src:e,alt:t})},[]),i=p(()=>{a(null)},[]);return t(Kr.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(De,{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(Re,{className:"size-5"})})]})})]})}const Gr=h(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(Me,{className:"size-4 text-success"}):"error"===N||"warning"===N?e(Ve,{className:"size-4 text-destructive"}):e(Be,{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?Oe:Le,{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:un(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(Ue,{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(Me,{className:"size-3"}),m]}),p>0&&t("span",{className:"text-destructive flex items-center gap-1",children:[e(Ve,{className:"size-3"}),p]}),a&&u<d&&t("span",{className:"text-blue-500 flex items-center gap-1",children:[e(qe,{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(Me,{className:"size-3 text-success"}),"error"===n.status&&e(Ve,{className:"size-3 text-destructive"}),"running"===n.status&&e(qe,{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:We,warning:Ve,info:Ke,success:Me};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:w,iconClassName:N,questionClassName:k,descriptionClassName:C,optionsClassName:S,buttonClassName:P,inputContainerClassName:j,inputClassName:_,submitButtonClassName:I}){const[T,A]=l.useState(""),[z,F]=l.useState(new Set),E=l.useRef(null),$=Jr[h],D=Yr[h],R=()=>{T.trim()&&o&&(o(T.trim()),A(""))},O=f?"":`border-l-4 ${$.border}`;return e("div",{className:`my-4 ${y||""}`,children:t("div",{className:`${O} ${$.bg} rounded-r-lg shadow-sm ${b||""}`,children:[e("div",{className:`px-4 py-3 ${w||""}`,children:t("div",{className:"flex items-start gap-3",children:[!g&&e("div",{className:`flex-shrink-0 mt-0.5 ${$.icon} ${N||""}`,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 ${k||""}`,children:n}),r&&e("p",{className:`mt-1 text-sm text-gray-600 dark:text-gray-400 ${C||""}`,children:r})]})]})}),a&&a.length>0&&e("div",{className:`px-4 pb-3 pt-1 ${S||""}`,children:d?t("div",{className:"space-y-2",children:[a.map(n=>{const r=t("label",{className:`flex items-center gap-3 px-3 py-2 rounded-md cursor-pointer transition-colors\n ${z.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:z.has(n.id),onChange:()=>{return e=n.id,void F(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e},disabled:m,className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"}),t("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-gray-100",children:[n.icon,n.label]})]});return n.description?e(x,{description:n.description,placement:"right",asChild:!0,children:r},n.id):e(l.Fragment,{children:r},n.id)}),e("div",{className:"pt-2",children:t(v,{size:"sm",onClick:()=>{z.size>0&&i&&(i(Array.from(z)),F(new Set))},disabled:m||0===z.size,className:"flex items-center gap-2",children:[e(He,{className:"size-4"}),"Submit Selection",z.size>0?` (${z.size})`:""]})})]}):e("div",{className:"flex flex-wrap gap-2",children:a.map(n=>{const r=t(v,{variant:"outline",size:"sm",onClick:()=>s?.(n.id),disabled:m,className:`flex items-center gap-2 ${P||""}`,children:[n.icon,n.label]});return n.description?e(x,{description:n.description,placement:"top",asChild:!0,children:r},n.id):e(l.Fragment,{children:r},n.id)})})}),c&&e("div",{className:`px-4 pb-3 pt-1 ${j||""}`,children:t("div",{className:"flex gap-2",children:[e("input",{ref:E,type:"text",value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),R())},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 ${_||""}`}),e(v,{size:"sm",onClick:R,disabled:m||!T.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(Me,{className:"size-4"})},{id:"cancel",label:i,icon:e(Ge,{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=[Wt.COMPLETE,Wt.IDLE,Wt.REQUEST_INPUT,Wt.TERMINATED];function na(e){return e.workstream_id?(e.type===Wt.COMPLETE&&console.log("[getWorkstreamId] COMPLETE message with workstream_id:",e.workstream_id),e.workstream_id):(e.type===Wt.COMPLETE&&console.log("[getWorkstreamId] COMPLETE message without workstream_id, defaulting to 'main'"),"main")}function ra(e){return e.type===Wt.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)=>"streaming"===e.kind&&"streaming"!==t.kind?1:"streaming"===t.kind&&"streaming"!==e.kind?-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=u(null);function da({children:t}){const n=g(new Map),r=g(new Map),a=p(e=>n.current.get(e),[]),s=p((e,t)=>{n.current.set(e,t)},[]),i=p(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 m(ca)}function ma(e,t,n="inline"){return`artifact:${e}:${t}:${n}`}function pa(e){return`file:${e}`}const ha={[Wt.ANSWER]:{borderColor:"border-l-info",bgColor:"bg-info",iconColor:"text-info",sender:"Agent",Icon:Je},[Wt.COMPLETE]:{borderColor:"border-l-success",bgColor:"bg-success",iconColor:"text-success",sender:"Completed",Icon:Me},[Wt.IDLE]:{borderColor:"border-l-info",bgColor:"bg-info/50",iconColor:"text-info",sender:"Ready",Icon:Qe},[Wt.REQUEST_INPUT]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Input",Icon:Ze},[Wt.QUESTION]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"User",Icon:Ze},[Wt.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:Je},[Wt.ERROR]:{borderColor:"border-l-destructive",bgColor:"bg-destructive",iconColor:"text-destructive",sender:"Error",Icon:Ve},[Wt.UPDATE]:{borderColor:"border-l-success",bgColor:"bg-success",iconColor:"text-success",sender:"Update",Icon:Ye},[Wt.PLAN]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Plan",Icon:Ke},[Wt.TERMINATED]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"Terminated",Icon:Me},[Wt.WARNING]:{borderColor:"border-l-attention",bgColor:"bg-attention",iconColor:"text-attention",sender:"Warning",Icon:Ve},[Wt.SYSTEM]:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"System",Icon:Ye},[Wt.STREAMING_CHUNK]:{borderColor:"border-l-info",bgColor:"bg-info",iconColor:"text-info",sender:"Agent",Icon:Je},[Wt.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:Be},default:{borderColor:"border-l-muted",bgColor:"bg-muted",iconColor:"text-muted",sender:"Agent",Icon:Je}};const ga=h(function({message:n,showPulsatingCircle:r=!1,onSendMessage:a,className:s,cardClassName:i,headerClassName:l,contentClassName:u,timestampClassName:m,senderClassName:p,iconClassName:h,detailsClassName:g,artifactsClassName:f}){const[y,x]=c(!1),{client:N}=Kt(),k=b(),C=ua(),{openImage:S}=Wr(),P=ha[n.type]||ha.default,j=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]),_=o(()=>j?function(e,t,n){if("string"!=typeof e)return e;if(t===Wt.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}(j,n.type,"string"==typeof n.message?n.message:void 0):"",[j,n.type,n.message]),I=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-2 prose-headings:font-semibold prose-headings:tracking-tight prose-li:my-0.5 prose-ul:my-2 prose-ol:my-2 max-w-none text-[15px]",children:e(hn,{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(mn,{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&&S(r.src,r.alt)})},children:t})})},[T,A]=c([]),z=n.workflow_run_id,F=n.details,E=F?.outputFiles??F?.files,$=Array.isArray(E)?E.join(","):"";d(()=>{(async()=>{if(z&&Array.isArray(E)&&0!==E.length)try{const e=await Promise.all(E.map(async e=>{if("string"!=typeof e||!e.trim())return null;const t=e.trim(),n=t.startsWith("out/")||t.startsWith("files/")||t.startsWith("scripts/")?t:`out/${t}`,r=n.split(".").pop()?.toLowerCase()||"",a=new Set(["png","jpg","jpeg","gif","webp","bmp","svg"]).has(r),s=a?"inline":"attachment";try{const e=ma(z,n,s);let r;if(C)r=await C.getOrFetch(e,async()=>(await N.files.getArtifactDownloadUrl(z,n,s)).url);else{r=(await N.files.getArtifactDownloadUrl(z,n,s)).url}return{displayName:t,artifactPath:n,url:r,isImage:a}}catch(e){return console.error(`Failed to resolve artifact URL for ${n}`,e),null}}));A(e.filter(e=>!!e))}catch(e){console.error("Error loading artifact URLs from message details",e),A([])}else A([])})()},[z,$,N,C]);const D=na(n),{Icon:R}=P;return e("div",{className:s,children:t("div",{className:`border-l-4 overflow-hidden bg-white dark:bg-gray-900 mb-4 ${P.borderColor} ${i||""}`,"data-workstream-id":D,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":""} ${h||""}`,children:r?e(Ur,{size:"sm",color:"blue"}):e(R,{className:`size-4 ${P.iconColor}`})}),e("span",{className:`text-xs font-medium text-muted ${p||""}`,children:P.sender}),"main"!==D&&"all"!==D&&e(w,{variant:"default",className:"text-xs text-muted ml-1",children:D})]}),t("div",{className:"flex items-center gap-1.5 print:hidden",children:[e("span",{className:`text-[11px] text-muted/70 ${m||""}`,children:un(n.timestamp).format("HH:mm:ss")}),e(v,{variant:"ghost",size:"xs",onClick:()=>{const e=j||"",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(()=>{k({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(Ue,{className:"size-3"})})]})]}),t("div",{className:`px-4 pb-3 bg-white dark:bg-gray-900 ${u||""}`,children:[n.type===Wt.REQUEST_INPUT&&n.details?.ux?(()=>{const t=n.details.ux;return e(Zr,{question:"string"==typeof j?j:"",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})})():j&&e("div",{className:"message-content break-words max-w-full",style:{overflowWrap:"anywhere"},children:I(_||j)}),T.length>0&&t("div",{className:`mt-3 text-xs ${f||""}`,children:[e("div",{className:"font-medium text-muted mb-1",children:"Artifacts"}),T.some(e=>e.isImage)&&e("div",{className:"mb-2 flex flex-wrap gap-3",children:T.filter(e=>e.isImage).map(({displayName:n,artifactPath:r,url:a})=>t("div",{className:"max-w-xs cursor-pointer",onClick:()=>S(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:T.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 ${g||""}`,children:[t("button",{onClick:()=>x(!y),className:"text-xs text-muted flex items-center",children:[y?"Hide":"Show"," details",e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 ml-1 transition-transform "+(y?"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"})})]}),y&&e("div",{className:"mt-2 p-2 bg-muted border border-mixer-muted/40 rounded text-sm",children:"string"==typeof n.details?I(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:u,contentClassName:m}){const[h,f]=c(0),[x,w]=c(""),N=g(null),k=g(n.length),C=g(0),S=g(i||Date.now()),P=g(n),j=g(0),_=g(performance.now()),I=g(a),T=g(0);d(()=>{const e=performance.now(),t=n.length-j.current,r=e-_.current;if(t>0&&r>30){const e=t/r*1e3,n=.2;I.current=I.current*(1-n)+e*n,I.current=Math.max(50,Math.min(2e3,I.current))}j.current=n.length,_.current=e},[n.length]),k.current=n.length,P.current=n;const A=p(()=>{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=requestAnimationFrame(t));let i;if(s)i=Math.max(500,2*I.current);else if(a<20)i=.85*I.current;else if(a<100)i=I.current;else if(a<500){const e=(a-100)/400;i=I.current*(1+.5*e)}else i=2*I.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=g(null),F=g(0);d(()=>{(h>=k.current||s)&&(w(P.current.slice(0,h)),F.current=h)},[h,s]);const E=h<n.length&&!s;d(()=>{if(E)return z.current||(z.current=window.setInterval(()=>{const e=C.current;e>F.current&&(w(P.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 $=b(),D=o(()=>un(S.current).format("HH:mm:ss"),[]),R=h<n.length,O=o(()=>{const e=x||n.slice(0,h);return R?e+"▋":e},[x,n,h,R]);return n?t("div",{className:y("flex flex-col gap-1 p-3 rounded-lg","bg-blue-50/50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800/30","min-h-[3rem]",l),children:[t("div",{className:y("flex items-center justify-between",u),children:[t("div",{className:"flex items-center gap-2",children:[r&&"main"!==r&&t("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-medium",children:["Task: ",r]}),R&&e("span",{className:"text-xs text-muted",children:"Streaming..."})]}),t("div",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs text-muted",children:D}),e(v,{variant:"ghost",size:"xs",onClick:()=>{navigator.clipboard.writeText(n).then(()=>{$({status:"success",title:"Copied to clipboard",duration:2e3})})},className:"text-muted opacity-50 hover:opacity-100",title:"Copy message",children:e(Ue,{className:"size-3"})})]})]}),t("div",{className:y("text-sm break-words leading-relaxed streaming-content prose prose-sm dark:prose-invert max-w-none",R&&"streaming-active",m),children:[e(hn,{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\n /* Style the cursor character when streaming */\n .streaming-active {\n /* The cursor character (▋) inherits text color by default */\n }\n\n /* Animate cursor with CSS - applies to the character via text-shadow */\n @keyframes cursorPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n\n /* Make cursor character blink - targets last character when streaming */\n .streaming-active code:last-child,\n .streaming-active p:last-child,\n .streaming-active li:last-child,\n .streaming-active pre:last-child code {\n /* Cursor character inherits this animation via the container */\n }\n "})]})]}):null}),ya=e=>/\.(png|jpg|jpeg|gif|webp|svg)(\?|$)/i.test(e);function ba({files:n}){const{openImage:r}=Wr();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}function va({message:n,isExpanded:r,onToggle:a,artifactRunId:s}){const[i,l]=c(!1),[o,u]=c([]),m=b(),{client:p}=Kt(),h=ua(),g=n.details,f=g?.tool||"Tool",y=g?.files,x="string"==typeof n.message?n.message:"";d(()=>{if(!y||0===y.length||!s)return void u([]);let e=!1;return(async()=>{const t=await Promise.all(y.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(h)return await h.getOrFetch(e,async()=>(await p.files.getArtifactDownloadUrl(s,t,r)).url);return(await p.files.getArtifactDownloadUrl(s,t,r)).url}catch(e){return console.error(`Failed to resolve artifact URL for ${t}`,e),null}}));e||u(t.filter(e=>!!e))})(),()=>{e=!0}},[y,s,p,h]);const w=o.filter(e=>ya(e)),N=o.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-center 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-center gap-2 flex-1 min-w-0",children:[e(r?Oe:Le,{className:"size-3 text-muted flex-shrink-0"}),e("span",{className:"text-xs font-medium text-purple-600 dark:text-purple-400 flex-shrink-0",children:f}),!r&&x&&e("span",{className:"text-xs text-muted flex-1",children:x})]}),t("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e("span",{className:"text-xs text-muted",children:un(n.timestamp).format("HH:mm:ss")}),e(v,{variant:"ghost",size:"xs",onClick:e=>{e.stopPropagation(),(()=>{const e=[x,g?"\n\nDetails:\n"+JSON.stringify(g,null,2):""].join("").trim();navigator.clipboard.writeText(e).then(()=>{m({status:"success",title:"Copied to clipboard",duration:2e3})})})()},className:"text-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy message",children:e(Ue,{className:"size-3"})})]})]}),w.length>0&&e("div",{className:"px-4 pb-2",children:e(ba,{files:w})}),r&&t("div",{className:"px-4 py-2 bg-gray-50/50 dark:bg-gray-800/30",children:[x&&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(hn,{artifactRunId:s,children:x})}),N.length>0&&e(ba,{files:N}),g&&t("div",{className:"mt-2",children:[t("button",{onClick:e=>{e.stopPropagation(),l(!i)},className:"text-xs text-muted flex items-center",children:[i?"Hide":"Show"," details",e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 ml-1 transition-transform "+(i?"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"})})]}),i&&e("div",{className:"mt-2 p-2 bg-muted border border-mixer-muted/40 rounded text-sm",children:e("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto",children:JSON.stringify(g,null,2)})})]})]})]})}function xa({files:r,artifactRunId:a}){const[s,i]=c([]),{client:l}=Kt(),o=ua();d(()=>{if(!r||0===r.length||!a)return void i([]);let e=!1;return(async()=>{const t=await Promise.all(r.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(a,t,r);if(o)return await o.getOrFetch(e,async()=>(await l.files.getArtifactDownloadUrl(a,t,r)).url);return(await l.files.getArtifactDownloadUrl(a,t,r)).url}catch(e){return console.error(`Failed to resolve artifact URL for ${t}`,e),null}}));e||i(t.filter(e=>!!e))})(),()=>{e=!0}},[r,a,l,o]);const u=s.filter(e=>ya(e)),m=s.filter(e=>!ya(e));return t(n,{children:[u.length>0&&e("div",{className:"pl-5 pr-3 pb-2",children:e(ba,{files:u})}),m.length>0&&e("div",{className:"pl-5 pr-3 pb-2",children:e(ba,{files:m})})]})}const wa=h(function({messages:n,showPulsatingCircle:r=!1,toolRunId:a,toolStatus:s}){const[i,l]=c(!0),[o,u]=c(new Set),[m,p]=c(new Set),h=g(n.length),f=b(),y=n.find(e=>e.workflow_run_id)?.workflow_run_id??n[0]?.workflow_run_id;d(()=>{const e=h.current,t=n.length;if(t>e){const n=new Set;for(let r=e;r<t;r++)n.add(r);p(n);const r=setTimeout(()=>{p(new Set)},500);return h.current=t,()=>clearTimeout(r)}h.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`,P=e=>{u(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(Me,{className:"size-4 text-success"}):"error"===s?e(Ve,{className:"size-4 text-destructive"}):"warning"===s?e(Xe,{className:"size-4 text-attention"}):e(Je,{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?Le:Oe,{className:"size-3 text-muted"})]}),t("div",{className:"flex items-center gap-1.5",children:[t("span",{className:"text-[11px] text-muted/70",children:[un(N).format("HH:mm:ss"),n.length>1&&` - ${un(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(Ue,{className:"size-3"})})]})]}),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=m.has(a),d=o.has(a),u=s?.files;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-m.size))+"ms",animation:c?"slideInFade 0.4s ease-out forwards":"none",animationDelay:100*(a-(n.length-m.size))+"ms"},children:[t("div",{className:"flex items-center gap-2 py-1.5 text-xs cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50",onClick:()=>P(a),title:l,children:[e(d?Oe:Le,{className:"size-3 text-muted flex-shrink-0"}),e("span",{className:"font-medium text-purple-700 dark:text-purple-300 flex-shrink-0 min-w-[100px]",children:i}),!d&&e("span",{className:"text-muted truncate flex-1",children:l})]}),e(xa,{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(hn,{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(va,{message:t,isExpanded:o.has(n),onToggle:()=>P(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 Na({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(Me,{className:"size-3 text-success"}):e(Qe,{className:"size-3 text-attention"}))]})]},n))}:{className:"py-1"})}function ka(e,t){return"all"===t?[...e]:"main"===t?e.filter(e=>"main"===na(e)):e.filter(e=>na(e)===t)}const Ca=(e,t)=>e.includes("%thinking_message%")?e.replace(/%thinking_message%/g,Xr[t]):e,Sa=e=>e.type===Wt.BATCH_PROGRESS&&!!e.details?.batch_id;class Pa extends f{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return console.error("Message render error:",e),{hasError:!0,error:e}}render(){return this.state.hasError?null:this.props.children}}const ja=l.memo(function({messages:r,bottomRef:a,viewMode:s="stacked",isCompleted:i=!1,streamingMessages:u=new Map,onSendMessage:m,thinkingMessageIndex:h=0}){const f=g(null),[y,b]=c("all"),v=g(0),x=g(null),w=u.size>0,N=o(()=>{let e=0;return u.forEach(t=>{e+=t.text?.length||0}),Math.floor(e/200)},[u]),k=p(()=>{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,u.size,N,k]);const C=l.useMemo(()=>[...r].filter(e=>!(e=>{if(e.type!==Wt.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]),P=l.useMemo(()=>{const e=new Map;e.set("all",C.length);const t=ka(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:ka(C,y),[C,y]),{importantMessages:_,recentThinking:I}=l.useMemo(()=>{const e=u.size>0;return{importantMessages:j.filter(e=>e.type===Wt.ANSWER||e.type===Wt.QUESTION||e.type===Wt.COMPLETE||e.type===Wt.IDLE||e.type===Wt.REQUEST_INPUT||e.type===Wt.TERMINATED||e.type===Wt.ERROR||e.type===Wt.THOUGHT&&e.details?.tool||e.type===Wt.SYSTEM&&"toolkit_ready"===e.details?.system_type),recentThinking:i||e?[]:j.filter(e=>e.type===Wt.UPDATE||e.type===Wt.PLAN||e.type===Wt.THOUGHT&&!e.details?.tool).slice(-1)}},[j,i,u.size]),T=l.useMemo(()=>oa(j,u,y),[j,u,y]),A=l.useMemo(()=>oa(_,u,y),[_,u,y]),z=o(()=>!i&&(u.size>0||I.length>0||!j.some(e=>e.type===Wt.COMPLETE||e.type===Wt.IDLE||e.type===Wt.TERMINATED)),[i,u.size,I.length,j]),F=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,[Wt.COMPLETE,Wt.IDLE,Wt.REQUEST_INPUT,Wt.TERMINATED].includes(t.type))}return e},[C]);return t("div",{ref:f,className:"flex-1 min-h-0 h-full overflow-y-auto overflow-x-hidden px-4 sm:px-2 lg:px-4 flex flex-col relative","data-testid":"all-messages-mixed",children:[e("div",{className:"sticky top-0 z-10",children:e(Na,{workstreams:S,activeWorkstream:y,onSelectWorkstream:b,count:P,completionStatus:F})}),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",children:[t(n,"stacked"===s?{children:[T.map((t,n)=>{const r=n===T.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(Pa,{children:e(wa,{messages:t.messages,showPulsatingCircle:s,toolRunId:t.toolRunId,toolStatus:t.toolStatus})},`group-${t.toolRunId||t.firstTimestamp}-${n}`)}if("streaming"===t.type)return e(Pa,{children:e(fa,{text:t.text,workstreamId:t.workstreamId,isComplete:t.isComplete})},`streaming-${t.streamingId}-${n}`);{const a=t.message,s=!i&&r&&!ta.includes(a.type);return Sa(a)?e(Pa,{children:e(Gr,{message:a,batchData:a.details,isRunning:!a.details.completed_at})},`batch-${a.details.batch_id}-${a.timestamp}-${n}`):e(Pa,{children:e(ga,{message:a,showPulsatingCircle:s,onSendMessage:m})},`${a.timestamp}-${n}`)}}),z&&0===u.size&&t("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-blue-50/50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800/30",children:[e(Ur,{size:"sm",color:"blue"}),e("span",{className:"text-sm text-muted",children:"Working..."})]})]}:{children:[A.map((t,n)=>{const r=n===A.length-1;if("tool_group"===t.type){const a=t.messages[t.messages.length-1],s=!i&&0===I.length&&r&&!ta.includes(a.type)&&"completed"!==t.toolStatus;return e(Pa,{children:e(wa,{messages:t.messages,showPulsatingCircle:s,toolRunId:t.toolRunId,toolStatus:t.toolStatus})},`group-${t.toolRunId||t.firstTimestamp}-${n}`)}if("streaming"===t.type)return e(Pa,{children:e(fa,{text:t.text,workstreamId:t.workstreamId,isComplete:t.isComplete})},`streaming-${t.streamingId}-${n}`);{const a=t.message,s=!i&&0===I.length&&r&&!ta.includes(a.type);return Sa(a)?e(Pa,{children:e(Gr,{message:a,batchData:a.details,isRunning:!a.details.completed_at})},`batch-${a.details.batch_id}-${a.timestamp}-${n}`):e(Pa,{children:e(ga,{message:a,showPulsatingCircle:s,onSendMessage:m})},`${a.timestamp}-${n}`)}}),I.map((t,n)=>e(Pa,{children:e(fa,{text:Ca(t.message||"",h),workstreamId:na(t),isComplete:n<I.length-1})},`thinking-${t.timestamp}-${n}`)),z&&0===I.length&&0===u.size&&t("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-blue-50/50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800/30",children:[e(Ur,{size:"sm",color:"blue"}),e("span",{className:"text-sm text-muted",children:"Working..."})]})]}),e("div",{ref:a,className:"h-4"})]})]})});class _a{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 _a(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?Ht.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?Gt(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&&Jt(t,e.provider)?this._model=t:this._model=e?.default_model&&Jt(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,this.onStateChanged())}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 _n({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 Ia=u(void 0);function Ta({children:t}){const{client:n}=Kt(),[r,a]=c();return d(()=>{a(new _a(n,a))},[]),r&&e(Ia.Provider,{value:r,children:t})}function Aa(){const e=m(Ia);if(!e)throw new Error("usePayloadBuilder must be used within a PayloadProvider");return e}function za({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,className:g,titleClassName:f,actionsClassName:y}){return e(Ta,{children:t("div",{className:`flex flex-wrap items-end justify-between py-1.5 px-2 border-b shadow-sm flex-shrink-0 ${g||""}`,children:[t("div",{className:`flex flex-wrap items-center space-x-2 ${f||""}`,children:[t("div",{className:"flex items-center space-x-1",children:[e(Je,{className:"size-5 text-muted"}),e("span",{className:"font-medium",children:n})]}),t("span",{className:"text-xs text-muted ml-1",children:["(Run ID: ",s.runId.substring(0,8),"...)"]})]}),t("div",{className:`flex justify-end items-center space-x-2 ml-auto ${y||""}`,children:[t("div",{className:"flex items-center space-x-1 bg-muted rounded p-0.5",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-l-md",onClick:()=>l("sliding"),children:"Most Important"})]}),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(et,{className:"size-4 mr-1.5"}),e("span",{className:"font-medium text-xs",children:o?"Hide Plan":"Show Plan"})]})]}),e(Fa,{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(tt,{className:"size-4"})})]})]})})}function Fa({run:n,isModal:r,onClose:a,onDownload:s,onCopyRunId:i,resetWorkflow:l,onExportPdf:o}){const c=b(),{client:d}=Kt(),u=Aa();return t(N,{hover:!0,children:[e(k,{children:e(v,{size:"xs",variant:"ghost",title:"More actions",children:e(nt,{className:"size-4"})})}),e(C,{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(S,{children:e(P,{children:t(j,{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(_,{className:"text-xs",onSelect:()=>{return e=`/store/agent-runner?agentId=${n.runId}__${n.workflowId}`,window.open(e,"_blank"),e;var e},children:[e(Re,{className:"size-3.5 mr-2 text-muted"})," Open in new tab"]}),t(_,{className:"text-xs",onSelect:()=>{i?i():(navigator.clipboard.writeText(n.runId),c({status:"success",title:"Run ID copied",duration:2e3}))},children:[e(Ue,{className:"size-3.5 mr-2 text-muted"})," Copy Run ID"]}),t(_,{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(rt,{className:"size-3.5 mr-2 text-muted"})," Download Conversation"]}),o&&t(_,{className:"text-xs",onSelect:o,children:[e(rt,{className:"size-3.5 mr-2 text-muted"})," Export as PDF"]}),a&&r&&t(_,{className:"text-xs",onSelect:a,children:[e(tt,{className:"size-3.5 mr-2 text-muted"})," Close"]}),t(_,{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(tt,{className:"size-3.5 mr-2 text-destructive"})," Cancel Workflow"]})]})})})})})})]})}const Ea="vertesia.content_store.lastDisplayedView";function $a({onUpdate:t}){const[n,r]=c("grid"===localStorage.getItem(Ea)),a=()=>{localStorage.setItem(Ea,"grid"),r(!0),t(!0)},s=()=>{localStorage.setItem(Ea,"table"),r(!1),t(!1)};return e(v,{variant:"outline",onClick:()=>{n?s():a()},alt:n?"Table View":"Thumbnail View",children:e(n?at:st,{})})}function Da(e,t=7){return e?"~"+e.slice(-t):""}function Ra(e,t){return e.length>t?e.substring(0,t)+"...":e}$a.LAST_DISPLAYED_VIEW=Ea;const Oa="text/csv",La="image/",Ua="application/pdf",Ma="video/",Va=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.ms-powerpoint"],qa=e=>e===Oa||Oa.includes(e),Ba=e=>e.startsWith(La)||La.includes(e),Ka=e=>e===Ua||Ua.includes(e),Wa=e=>e.startsWith(Ma)||Ma.includes(e),Ha=e=>Va.includes(e),Ga=import.meta.env,Ja={max_hw:Ga?.VITE_RENDITION_HW||256,format:Yt.jpeg,generate_if_missing:!0},Ya="vertesia.content_store.renditionId";async function Za(e,t,n,r,a){if(!t?.content?.type||!(Ba(t.content.type)||Wa(t.content.type)||Ka(t.content.type)))return void a("No preview available");a("Preparing preview...");const s=(new Date).getTime()/1e3,i=localStorage.getItem(`${Ya}_${t.id}_${Ja.max_hw}`),l=localStorage.getItem(`${Ya}_${t.id}_${Ja.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,Ja).then(s=>{if("generating"===s.status)a("Preparing preview..."),n(""),r(""),setTimeout(()=>Za(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(`${Ya}_${t.id}_${Ja.max_hw}`,e),localStorage.setItem(`${Ya}_${t.id}_${Ja.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 Qa(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 Xa(e){switch(e){case Zt.RUNNING:return"text-info";case Zt.COMPLETED:return"text-success";case Zt.FAILED:return"text-destructive";case Zt.TERMINATED:case Zt.CANCELED:return"text-attention";default:return"text-muted"}}function es(e){switch(e){case Zt.RUNNING:return"Running";case Zt.COMPLETED:return"Completed";case Zt.FAILED:return"Failed";case Zt.CONTINUED_AS_NEW:return"Continued As New";case Zt.TERMINATED:return"Terminated";case Zt.TIMED_OUT:return"Timed Out";case Zt.CANCELED:return"Canceled";default:return"Unknown"}}class ts 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 ns({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 ts;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(T,{children:"Save Changes"}),e(A,{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(z,{adapter:g,options:l,value:u,onChange:e=>{m(e)},gap:"gap-4"}),f&&e(F,{label:"Version Label (Optional)",description:"Optional label for the new version.",className:"mt-3 pl-8",children:e(E,{value:p,onChange:h,placeholder:"e.g., v1.2, approved, post-review",className:"w-full"})})]})}),t($,{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 rs({isOpen:r,onClose:a,object:s,refetch:i}){const{client:l,store:o}=Kt(),u=b(),m=pn(),[p,h]=c(!1),[f,y]=c(""),[x,w]=c(!1),[N,k]=c(null),C=g(null),S=g(null),[P,j]=c(null),[_,z]=c(null);function F(e,t){e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"http://myserver/object-schema.json",fileMatch:["*"],schema:t}]})}return d(()=>{r&&(y(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),S.current&&F(S.current,t.object_schema))}catch(e){console.error("Failed to fetch JSON schema:",e)}}(s.type.id))},[r,s]),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(T,{children:"Edit Properties"}),t(A,{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"}),P&&e("span",{className:"ml-2 text-green-600",children:"(JSON schema validation enabled)"})]}),e("div",{className:"h-[75vh] border border-gray-300 dark:border-gray-700 rounded-md",children:e(Tn,{height:"100%",language:"json",value:f,onChange:e=>y(e||""),onMount:function(e,t){C.current=e,S.current=t,P&&F(t,P)},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,automaticLayout:!0,wordWrap:"on"}})})]}),t($,{children:[e(v,{variant:"secondary",onClick:a,children:"Cancel"}),e(v,{variant:"primary",onClick:function(){if(!C.current)return;const e=C.current.getValue();try{const t=JSON.parse(e);k(t),w(!0)}catch(e){u({status:"error",title:"Invalid JSON",description:"Please fix the JSON syntax errors before saving.",duration:5e3})}},children:"Save Changes"})]})]}),e(ns,{isOpen:x,onClose:function(){w(!1)},onConfirm:async function(e,t){try{h(!0);const n=N||JSON.parse(f);if(e){const e=await l.objects.update(s.id,{properties:n},{createRevision:!0,revisionLabel:t});e.id!==s.id&&z(e.id),u({status:"success",title:"New version created",description:"A new version with updated properties has been created.",duration:2e3}),w(!1),a(),e.id!==s.id&&setTimeout(()=>{m(`/objects/${e.id}`),u({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}),u({status:"success",title:"Properties updated",description:"The object properties have been updated successfully.",duration:2e3}),i&&await i(),w(!1),a()}catch(e){u({status:"error",title:"Error updating properties",description:e.message||"An error occurred while updating the properties.",duration:5e3}),h(!1)}},isLoading:p})]})}function as({className:t,size:n="md"}){return e("div",{className:`flex items-center justify-center ${t||""}`,children:e(qe,{className:`${{sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"}[n]} animate-spin text-muted-foreground`})})}function ss({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(as,{className:"py-4",size:"md"}),e(zn,{file:n,onLoadSuccess:({numPages:e})=>{m(!1),o?.(e)},onLoadError:e=>{m(!1),h(e),d?.(e)},loading:null,children:e(Fn,{pageNumber:r,width:a,renderTextLayer:i,renderAnnotationLayer:l,loading:e(as,{className:"py-4",size:"sm"})})})]})}An.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${An.version}/build/pdf.worker.min.mjs`;const is=u(null);function ls({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(is.Provider,{value:h,children:t?e(zn,{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(as,{className:"py-4",size:"md"}),children:r((t,n)=>e(Fn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e(as,{className:"py-4",size:"sm"})},t))}):e(as,{className:"py-4",size:"md"})})}function os(){return m(is)}const cs=210/297;function ds({pageNumber:t,width:n,className:r}){const a=os(),s=a?.pageDimensions?.aspectRatio??cs,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(as,{size:"md"})}:{className:r,children:e(Fn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e(as,{className:"py-4",size:"sm"})})})}function us({pageNumber:t,width:n,isSelected:r,onSelect:a,renderThumbnail:s,aspectRatio:i=cs,rootMargin:l="200px 0px"}){const o=g(null),[u,m]=c(!1);d(()=>{const e=o.current;if(!e)return;const t=new IntersectionObserver(e=>{const t=e[0];t?.isIntersecting&&m(!0)},{rootMargin:l,threshold:0});return t.observe(e),()=>t.disconnect()},[l]);const p=n?Math.round(n/i):200,h=u?e(Fn,{pageNumber:t,width:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:e("div",{className:"flex items-center justify-center bg-muted",style:{height:p},children:e(as,{size:"sm"})})}):e("div",{className:"flex items-center justify-center bg-muted",style:{height:p,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:h,onSelect:a})})}function ms({pdfUrl:r,urlLoading:a=!1,pageCount:s,currentPage:i,thumbnailWidth:l,onPageSelect:o,renderThumbnail:u,scrollContainerRef:m,onAspectRatioChange:h,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=g(null),P=p(e=>{x(e)},[]),j=p(async e=>{b?.(e.numPages);try{const t=(await e.getPage(1)).getViewport({scale:1}),n=t.width/t.height;C(n),h?.(n)}catch(e){console.error("Failed to get page dimensions:",e),C(cs),h?.(cs)}},[h,b]),_=k??cs,I=l?Math.round(l/_):200,T=y?y(I):I+16+24+8;d(()=>{T>0&&null!==k&&f?.(T)},[T,k,f]);if(d(()=>{const e=m?.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,m]),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(as,{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(zn,{file:r,onLoadSuccess:j,onLoadError:P,loading:e(as,{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(us,{pageNumber:r,width:l,isSelected:r===i,onSelect:()=>o(r),renderThumbnail:u,aspectRatio:_})},r)}),z>0&&e("div",{style:{height:z}})]}):e(as,{className:"py-4",size:"md"})})})}function ps({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(as,{className:"py-8",size:"lg"}),e(zn,{file:n,onLoadSuccess:({numPages:e})=>{p(e),g(!1)},onLoadError:e=>{g(!1),y(e)},loading:null,children:e(Fn,{pageNumber:Math.min(r,m||1),width:a,height:s,renderTextLayer:l,renderAnnotationLayer:o,loading:e(as,{className:"py-8",size:"md"})})})]})}const hs=210/297,gs=[50,75,100,125,150,200,300];function fs({pdfUrl:a,pdfUrlLoading:s=!1,pageCount:i,currentPage:l,onChange:o,onPageCountChange:u,className:m,compact:h=!1,headerExtra:f}){const y=g(null),b=g(null),[x,w]=c(void 0),[N,k]=c(100),[C,S]=c(hs),[P,j]=c(null),_=g(null),I=x?Math.round(x*N/100):void 0,T=p(()=>{let e=gs.findIndex(e=>e>=N);-1===e&&(e=gs.length-1);const t=Math.min(e+1,gs.length-1);k(gs[t])},[N]),A=p(()=>{let e=gs.findIndex(e=>e>=N);-1===e&&(e=gs.length-1);const t=Math.max(e-1,0);k(gs[t])},[N]),z=p(()=>{k(100)},[]),F=p(e=>e+(h?28:48),[h]),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=_.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"})}),_.current=s}else w(t),_.current=E(t,C)},a=n();a>0&&(w(a),_.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 $=g(!1),D=g(null),O=g(N);d(()=>{O.current!==N&&(O.current=N,D.current={targetPage:l},$.current=!0)},[N,l]),d(()=>{const e=b.current,t=D.current;if(t&&e&&P){D.current=null;const n=(t.targetPage-1)*P;requestAnimationFrame(()=>{e.scrollTo({top:n,behavior:"instant"}),requestAnimationFrame(()=>{$.current=!1})})}},[P]);const L=g(!1);d(()=>{const e=b.current;if(e&&P&&!L.current)if(l>1){L.current=!0,$.current=!0;const t=(l-1)*P;e.scrollTo({top:t,behavior:"instant"}),requestAnimationFrame(()=>{$.current=!1})}else L.current=!0},[P,l]);const U=g(l);d(()=>{const e=b.current;if(e&&P&&U.current!==l){U.current=l,$.current=!0;const t=(l-1)*P;e.scrollTo({top:t,behavior:"instant"}),requestAnimationFrame(()=>{$.current=!1})}},[l,P]),d(()=>{const e=b.current;if(!e||!P)return;let t=null;const n=()=>{$.current||(t&&clearTimeout(t),t=setTimeout(()=>{const t=e.scrollTop,n=Math.round(t/P)+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)}},[P,i,l,o]);return t("div",{ref:y,className:r("flex flex-col items-stretch",h?"gap-y-1":"gap-y-2",m),children:[t("div",{className:r("relative flex items-center justify-center px-2",h?"h-6":"h-9"),children:[e(v,{variant:"ghost",size:"xs",onClick:()=>{l>1&&o(l-1)},alt:"Previous page",children:e(it,{className:"size-4"})}),t("div",{className:"absolute left-2 flex items-center gap-x-1",children:[e(bs,{zoom:N,onZoomIn:T,onZoomOut:A,onFitToView:z,canZoomIn:N<gs[gs.length-1],canZoomOut:N>gs[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(ys,{currentPage:l,totalPages:i,onChange:o})})]}),e("div",{ref:b,className:r("flex flex-col items-center flex-1 overflow-y-auto px-2",h?"gap-1":"gap-2"),children:e(ms,{pdfUrl:a,urlLoading:s,pageCount:i,currentPage:l,thumbnailWidth:I,onPageSelect:o,onPageCountChange:u,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",h?"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",h?"text-xs pt-0.5":"text-sm pt-1"),children:n})]},n)})}),e("div",{className:r("flex items-center justify-center",h?"h-6":"h-9"),children:e(v,{variant:"ghost",size:"xs",onClick:()=>{l<i&&o(l+1)},alt:"Next page",children:e(lt,{className:"size-4"})})})]})}function ys({currentPage:n,totalPages:r,onChange:a}){const s=g(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 bs({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(x,{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(ot,{className:"size-4"})})}),t("span",{className:"text-xs text-muted-foreground min-w-[32px] text-center",children:[n,"%"]}),e(x,{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(ct,{className:"size-4"})})}),e(x,{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(dt,{className:"size-4"})})})]})}const vs="magic-pdf";var xs;!function(e){e.original="original",e.instrumented="instrumented"}(xs||(xs={}));class ws{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=`${vs}/${this.objectId}/pages`;switch(t){case xs.original:return`${n}/page-${e}.original.jpg`;case xs.instrumented:return`${n}/page-${e}.instrumented.jpg`}}}class Ns{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=`${vs}/${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 ks{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 Cs=u(void 0);function Ss({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 ks(a);s&&n.text&&e.initFromContent(n.text);const t=n.text?_s(n.text):"";return{count:a,layoutProvider:new Ns(r,n.id,a),markdownProvider:e,imageProvider:new ws(r,n.id,a),xml:t,xmlPages:n.text?js(t):[],pdfUrl:"",pdfUrlLoading:!0}});return d(()=>{if(s){const e=n.metadata,t=e?.renditions?.find(e=>e.name===Qt),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(Cs.Provider,{value:i,children:t})}function Ps(){const e=l.useContext(Cs);if(!e)throw new Error("useMagicPdfContext must be used within a MagicPdfProvider");return e}function js(e){const t=(new DOMParser).parseFromString(_s(e),"text/xml").getElementsByTagName("page"),n=new XMLSerializer;return Array.from(t).map(e=>n.serializeToString(e))}function _s(e){return e.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").replace(/<\?xml.*?\?>/g,"")}const Is=[50,75,100,125,150,200,300],Ts=11/8.5;function As({className:n,currentPage:a,onChange:s}){const[i,l]=c(xs.instrumented),[o,u]=c(Ts),[m,h]=c(new Map),[f,y]=c(100),b=g(new Set),x=g(null),w=g(null),N=g(!1),{imageProvider:k,count:C}=Ps(),S=p(()=>{let e=Is.findIndex(e=>e>=f);-1===e&&(e=Is.length-1);const t=Math.min(e+1,Is.length-1);y(Is[t])},[f]),P=p(()=>{let e=Is.findIndex(e=>e>=f);-1===e&&(e=Is.length-1);const t=Math.max(e-1,0);y(Is[t])},[f]),j=p(()=>{y(100)},[]);d(()=>{k.getPageImageUrl(1,i).then(e=>{const t=new window.Image;t.onload=()=>{t.width>0&&t.height>0&&u(t.height/t.width)},t.src=e}).catch(()=>{})},[k,i]);const _=g(i);d(()=>{let e=!1;_.current!==i&&(_.current=i,b.current=new Set,h(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),h(e=>new Map(e).set(t,n)))}catch{}})(t)),()=>{e=!0}},[a,C,i,k]);const I=g(f);d(()=>{if(I.current!==f&&w.current){I.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=g(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(it,{className:"size-4"})}),t("div",{className:"absolute left-2 flex items-center gap-x-1",children:[e(zs,{type:xs.original,currentType:i,onClick:()=>l(xs.original),icon:e(ut,{className:"size-4"}),tooltip:"Original images"}),e(zs,{type:xs.instrumented,currentType:i,onClick:()=>l(xs.instrumented),icon:e(mt,{className:"size-4"}),tooltip:"Instrumented images"}),e("div",{className:"w-px h-4 bg-border mx-1"}),e(Fs,{zoom:f,onZoomIn:S,onZoomOut:P,onFitToView:j,canZoomIn:f<Is[Is.length-1],canZoomOut:f>Is[0]})]}),e("div",{className:"absolute right-2",children:e($s,{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(Es,{currentPage:a,pageNumber:n+1,aspectRatio:o,zoom:f,url:m.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(lt,{className:"size-4"})})})]})}function zs({type:t,currentType:n,onClick:a,icon:s,tooltip:i}){return e(x,{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 Fs({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(x,{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(ot,{className:"size-4"})})}),t("span",{className:"text-xs text-muted-foreground min-w-[32px] text-center",children:[n,"%"]}),e(x,{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(ct,{className:"size-4"})})}),e(x,{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(dt,{className:"size-4"})})})]})}function Es({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(qe,{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 $s({currentPage:n,totalPages:r,onChange:a}){const s=g(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 Ds({object:n}){const{client:r}=Kt(),a=e=>{(function(e,t,n){return e.files.getDownloadUrl(`${vs}/${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(pt,{className:"size-4"})}):t(gn,{strategy:"absolute",placement:"bottom-start",zIndex:100,offset:8,children:[e(gn.Trigger,{click:!0,children:e(v,{variant:"ghost",size:"xs",alt:"Download",children:e(pt,{className:"size-4"})})}),e(gn.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 Rs({className:t}){return e("div",{className:`flex items-center justify-center ${t||""}`,children:e(qe,{className:"w-6 h-6 animate-spin text-gray-400"})})}function Os({viewType:t,pageNumber:n}){switch(t){case"json":return e(Us,{pageNumber:n});case"markdown":return e(Ms,{pageNumber:n});default:return e(Ls,{pageNumber:n})}}function Ls({pageNumber:t}){const{xmlPages:n}=Ps();return e("div",{className:"px-4 py-2",children:e(fn,{xml:n[t-1],collapsible:!0})})}function Us({pageNumber:t}){const[n,r]=c(null),[a,s]=c(!0),[i,l]=c(null),{layoutProvider:o}=Ps();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(Rs,{})}):i?e("div",{className:"px-4 py-2 text-red-500 text-sm",children:i}):n?e(yn,{className:"w-full",data:n}):null}function Ms({pageNumber:n}){const[r,a]=c(null),[s,i]=c(!0),[l,o]=c(null),{markdownProvider:u}=Ps();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(Rs,{}),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(hn,{children:r}):e("div",{children:"No markdown content available"})})}class Vs 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(L,{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 qs({objectId:n,onClose:r}){const{client:a}=Kt(),{data:s,error:i}=O(()=>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(L,{title:"Fetching document failed",children:i.message}),r&&e(v,{variant:"outline",onClick:r,children:"Close"})]})}):s?e(Vs,{onClose:r,children:e("div",{className:"fixed inset-0 bg-background z-50 flex items-center justify-center",children:e(Ss,{object:s,children:e(Bs,{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(De,{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 Bs({object:n,onClose:r}){const{count:a,pdfUrl:s,pdfUrlLoading:i}=Ps(),[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(U,"xml"===d?{direction:"horizontal",className:"absolute inset-0",children:[e(M,{defaultSize:50,minSize:20,maxSize:80,className:"bg-muted",children:e(As,{className:"h-full",currentPage:l,onChange:o})}),e(V,{className:"w-[4px] bg-border cursor-ew-resize"}),t(M,{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(Ds,{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(De,{className:"size-4"})})})]}),e("div",{className:"flex-1 overflow-auto px-2",children:e(Os,{pageNumber:l,viewType:"xml"})})]})]}:{direction:"horizontal",className:"absolute inset-0",children:[e(M,{defaultSize:50,minSize:20,maxSize:80,className:"bg-muted",children:e(fs,{pdfUrl:s,pdfUrlLoading:i,pageCount:a,className:"h-full",currentPage:l,onChange:o})}),e(V,{className:"w-[4px] bg-border cursor-ew-resize"}),t(M,{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(Ds,{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(De,{className:"size-4"})})})]}),e("div",{className:"flex-1 overflow-auto px-2",children:e(Os,{pageNumber:l,viewType:"markdown"})})]})]})}function Ks({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 w=e=>{f(e)};return p?e("div",{className:"flex items-center justify-center h-full",children:e(q,{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(De,{className:"size-4"})})}),e(fs,{pdfUrl:u,pdfUrlLoading:p,pageCount:g||100,currentPage:l,onChange:o,onPageCountChange:w,className:"flex-1 min-h-0"})]}):e("div",{className:"relative h-full flex flex-col",children:e(fs,{pdfUrl:u,pdfUrlLoading:p,pageCount:g||100,currentPage:l,onChange:o,onPageCountChange:w,className:s,compact:!0,headerExtra:e(x,{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(ht,{className:"size-4"})})})})}):e("div",{className:"flex items-center justify-center h-full text-muted",children:"No PDF available"})}const Ws=131072;const Hs=["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/svg+xml"],Gs=["video/mp4","video/webm"],Js=["audio/mp4","audio/m4a","audio/x-m4a","audio/mpeg","audio/ogg","audio/wav","audio/webm"],Ys="h-[calc(100vh-208px)]",Zs="h-[calc(100vh-228px)]",Qs="h-[calc(100vh-218px)]",Xs="max-h-[calc(100vh-268px)]";function ei(e){return e===en.created||e===en.processing}function ti(e){return e.metadata?.content_processor?.type}function ni(e){return e?"":"hidden"}var ri;function ai({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(U,{direction:"horizontal",className:Ys,children:[e(M,{className:"min-w-[100px]",children:e(si,{object:r,refetch:s??(()=>Promise.resolve()),handleCopyContent:l})}),e(V,{withHandle:!0}),e(M,{className:"min-w-[100px]",children:e(ii,{object:r,loadText:a??!1,handleCopyContent:l,refetch:s})})]})})}function si({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(gt,{className:"size-4"})}),e(v,{variant:"ghost",size:"sm",onClick:()=>{d(!0)},title:"Edit properties",className:"flex items-center gap-2",children:e(ft,{className:"size-4"})})]})]}),r.properties?e("div",{className:`${Zs} overflow-auto px-2`,children:e(bn,{value:r.properties,viewCode:i})}):e("div",{className:`${Zs} overflow-auto px-2`,children:e("div",{children:"No properties defined"})}),e(rs,{isOpen:o,onClose:()=>{d(!1)},object:r,refetch:a})]})}function ii({object:n,loadText:r,handleCopyContent:a,refetch:s}){const i=n?.metadata?.type===tn.Image,l=n?.metadata?.type===tn.Video,o=n?.metadata?.type===tn.Audio,u="application/pdf"===n?.content?.type,m=!!n?.content?.type&&Ha(n.content.type),h=ei(n?.status),f=!(!n.transcript||!l&&!o),y=n.metadata,b=y?.renditions?.find(e=>e.name===Qt),[x,w]=c(l?ri.Video:o?ri.Audio:i?ri.Image:ri.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>Ws?t.substring(0,Ws):t),[o,u]=c(!1),[m,h]=c(()=>!!t&&t.length>Ws),g=p(()=>{u(!0),r.objects.getObjectText(e).then(e=>{s(e.text),e.text.length>Ws?(l(e.text.substring(0,Ws)),h(!0)):(l(e.text),h(!1))}).catch(e=>{console.error("Failed to load text",e),s(void 0),l(void 0),h(!1)}).finally(()=>{u(!1)})},[e,r]);return d(()=>{t&&t.length>Ws?(s(t),l(t.substring(0,Ws)),h(!0)):(s(t),l(t),h(!1)),n&&!t&&g()},[e,t,n,g]),{fullText:a,displayText:i,isLoading:o,isCropped:m,loadText:g}}(n.id,n.text,r),P=(u||m)&&h,{progress:j,status:_,outputFormat:I,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===Zt.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,P),{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=p(async()=>{if(!t||s)return;i(!0),o(void 0);const r=async t=>{try{const s=await n.objects.getRendition(e,{format:Xt.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,m);d(()=>{T&&_===Zt.COMPLETED&&s?.()},[T,_,s]);const $=(u||m)&&h&&!T&&_===Zt.RUNNING,D=g(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===ri.Image?"primary":"ghost",size:"sm",alt:"View Image",onClick:()=>w(ri.Image),children:"Image"}),l&&e(v,{variant:x===ri.Video?"primary":"ghost",size:"sm",alt:"View Video",onClick:()=>w(ri.Video),children:"Video"}),o&&e(v,{variant:x===ri.Audio?"primary":"ghost",size:"sm",alt:"View Audio",onClick:()=>w(ri.Audio),children:"Audio"}),f&&e(v,{variant:x===ri.Transcript?"primary":"ghost",size:"sm",alt:"View Transcript",onClick:()=>w(ri.Transcript),children:"Transcript"}),e(v,{variant:x===ri.Text?"primary":"ghost",size:"sm",alt:"View Text",onClick:()=>w(ri.Text),children:"Text"}),u&&e(v,{variant:x===ri.Pdf?"primary":"ghost",size:"sm",alt:"View PDF",onClick:()=>w(ri.Pdf),children:"PDF"}),m&&e(v,{variant:x===ri.Pdf?"primary":"ghost",size:"sm",alt:"View as PDF",onClick:()=>{w(ri.Pdf),b||A||z||E()},disabled:z,children:z?e(q,{size:"sm"}):"PDF"})]}),e(hi,{object:n})]}),x===ri.Text&&!$&&e(li,{object:n,text:k,fullText:N,handleCopyContent:a,textContainerRef:D}),x===ri.Pdf&&m&&(b||A)&&e(gi,{object:n,pdfRendition:b,officePdfUrl:A})]}),e("div",{className:ni(x===ri.Image),children:e(ci,{object:n})}),e("div",{className:ni(x===ri.Video),children:e(di,{object:n})}),e("div",{className:ni(x===ri.Audio),children:e(ui,{object:n})}),f&&e("div",{className:ni(x===ri.Transcript),children:e(pi,{object:n,handleCopyContent:a})}),u&&e("div",{className:ni(x===ri.Pdf),children:e(fi,{object:n})}),m&&e("div",{className:ni(x===ri.Pdf),children:e(yi,{pdfRendition:b,officePdfUrl:A,officePdfConverting:z,officePdfError:F,onConvert:E})}),$&&e("div",{className:ni(x===ri.Text),children:e(bi,{progress:j,status:_,outputFormat:I})}),e("div",{className:ni(x===ri.Text&&!$&&C),children:e("div",{className:"flex justify-center items-center flex-1",children:e(q,{size:"lg"})})}),e("div",{className:ni(x===ri.Text&&!$&&!C),children:e(oi,{object:n,text:k,isTextCropped:S,textContainerRef:D})})]})}function li({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=ti(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(gt,{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(pt,{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(q,{size:"sm"}):e(pt,{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(pt,{className:"size-4"}),"PDF"]})]})]})}),t(K,{isOpen:p,onClose:()=>h(!1),children:[e(W,{children:"Export document as PDF"}),t(H,{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(G,{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`;Qa(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"}(ri||(ri={}));const oi=h(({object:r,text:a,isTextCropped:s,textContainerRef:i})=>{const l=r.content,o=ei(r?.status),c="xml"===ti(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(Xe,{className:"size-4"}),e("span",{className:"text-sm font-semibold",children:"Showing first 128K characters only"})]})}),e("div",{className:`max-w-7xl px-2 ${Qs} overflow-auto`,ref:i,children:c?e("div",{className:"px-4 py-2",children:e(fn,{xml:a,collapsible:!0})}):u?e("div",{className:"vprose prose-sm p-1",children:e(hn,{components:{a:({node:t,...n})=>{const r=n.href||"";return r.includes("/store/objects/")?e(mn,{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 ci({object:t}){const{client:n}=Kt(),[r,a]=c(),s=t.content,i=t.metadata&&t.metadata.type===tn.Image;return d(()=>{if(i){a(void 0);(async()=>{const e=s?.type&&Hs.includes(s.type);try{const r=await n.objects.getRendition(t.id,{format:Yt.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(q,{size:"md"})})}function di({object:n}){const{client:r}=Kt(),[a,s]=c(),[i,l]=c(),[o,u]=c(!0),m=n.content,p=n.metadata?.type===tn.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&&Gs.includes(m.type),b=g.find(e=>e.name===nn);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(q,{size:"md"})}):a?e("video",{src:a,poster:i,controls:!0,className:`w-full ${Xs} 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 ui({object:n}){const{client:r}=Kt(),[a,s]=c(),[i,l]=c(!0),o=n.content,u=n.metadata?.type===tn.Audio,m=n.metadata,p=(m?.renditions||[]).find(e=>e.name===rn),h=o?.type&&Js.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(q,{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: ",mi(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 mi(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 pi({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(gt,{className:"size-4"})})}),e("div",{className:`${Qs} 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 hi({object:r}){const[a,s]=c(!1),i=ti(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(yt,{className:"size-4"})}),a&&e(B,{children:e(qs,{objectId:r.id,onClose:()=>s(!1)})})]}):null}function gi({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(q,{size:"sm"}):e(pt,{className:"size-4"})})})}function fi({object:t}){return e("div",{className:Qs,children:e(Ks,{object:t,className:"h-full"})})}function yi({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(q,{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(Xe,{className:"size-8"}),e("span",{children:s})]}):e("div",n?.content?.source?{className:Qs,children:e(Ks,{source:n.content.source,className:"h-full"})}:r?{className:Qs,children:e(Ks,{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 bi({progress:r,status:a,outputFormat:s}){const i=Xa(a),l=es(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(vi,{name:o?"Analyze Layouts":"Analyze Page",progress:r.pages}),o&&t(n,{children:[e(vi,{name:"Extract Tables",progress:r.tables}),e(vi,{name:"Describe Images",progress:r.images}),e(vi,{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(vn,{percent:c})]}),!r&&t("div",{className:"flex items-center gap-2 text-muted",children:[e(q,{size:"sm"}),e("span",{children:"Loading processing status..."})]})]})}function vi({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 xi({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(J,{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(Y,{className:"bg-muted h-[2px]"}),t(Z,{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 wi({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&&Za(o,r,m,h,f)},[r]),t(J,{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(bt,{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(Y,{className:"bg-gray-200 h-[2px]"}),t(Z,{className:"p-2 flex flex-col",children:[t("div",{className:"flex flex-col overflow-hidden",children:[e(x,{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(x,{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 Ni(e){return`${e._id} (${e.count})`}function ki(e){return`${e.name} (${e.count})`}function Ci({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(Q,{filterBy:"_id",className:s,isClearable:!0,optionLabel:Ni,options:n,value:l,onChange:e=>{t.setFilterValue(r,e?._id)},by:"_id",placeholder:a})}function Si({search:t,name:n,placeholder:r,className:a}){const[s,i]=c([]);return d(()=>{t.setFilterValue(n,s)},[s]),e(X,{className:a,value:s,onChange:i,placeholder:r})}function Pi(e){return`${e.name} (${e.count})`}function ji({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(Q,{filterBy:"name",className:a,isClearable:!0,optionLabel:Pi,options:s,value:u,onChange:e=>{t.setFilterValue("type",e?._id)},by:"_id",placeholder:r})}function _i({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:Ni(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 Ii({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 Ti={},Ai={};function zi(e){const{client:t}=Kt();return O(()=>{let n=Ti[e];return n||(n=t.users.retrieve(e).then(e=>e),Ti[e]=n),n},[e])}function Fi(e){const{client:t}=Kt();return O(()=>{let n=Ai[e];return n||(n=t.iam.groups.retrieve(e).then(e=>e),Ai[e]=n),n},[e])}function Ei(){return e("div",{className:"size-8"})}function $i({showTitle:n=!1,size:r="md"}){return e(qi,{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(ee,{src:"/icon.svg",size:r}),n&&e("div",{className:"text-sm font-semibold pl-2",children:"System User"})]})})}function Di({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(qi,{title:"Service Account",description:i,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(ee,{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 Ri({title:t="Error",error:n,showTitle:r=!1,size:a="md"}){return e(Li,{title:t,message:"string"==typeof n?n:n.message,color:"bg-red-500",showTitle:r,size:a})}function Oi({userRef:t,showTitle:n=!1,size:r="md"}){if(!t)return e(Li,{title:"Unknown User",message:"User information is not available.",showTitle:n,size:r});const[a,s]=t?t.split(":"):["unknown"];switch(a){case an.User:return e(Mi,{userId:s,showTitle:n,size:r});case an.Group:return e(Ui,{userId:s,showTitle:n,size:r});case"system":return e($i,{showTitle:n,size:r});case an.ServiceAccount:case an.Agent:return e(Di,{accountId:s,showTitle:n,size:r});case an.ApiKey:return e(Vi,{keyId:s,size:r,showTitle:n});default:return e(Ri,{title:"Unknown User",error:`Invalid user ref type: ${a}`,showTitle:n,size:r})}}function Li({title:n,message:r,color:a,size:s="md",showTitle:i=!1}){return e(qi,{title:n,description:r,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(ee,{color:a,size:s}),i&&e("div",{className:"text-sm font-semibold pl-1",children:n})]})})}function Ui({userId:n,showTitle:r=!1,size:a="md"}){const{data:s,error:i}=Fi(n);if(i)return e(Ri,{title:"Failed to fetch group",error:i,showTitle:r,size:a});if(!s)return e(Ei,{});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(qi,{title:s.name||"Unnamed Group",description:l,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(vt,{className:"size-6 text-indigo-500",size:a}),r&&e("div",{className:"text-sm font-semibold pl-2",children:s.name||"Unnamed Group"})]})})}function Mi({userId:n,showTitle:r=!1,size:a="md"}){const{data:s,error:i}=zi(n);if(i)return e(Ri,{title:"Failed to fetch user",error:i,showTitle:r,size:a});if(!s)return e(Ei,{});const l=e("div",{className:"truncate",title:s.email,children:s.email});return e(qi,{title:s.name||s.email||s.username||"unknown",description:l,children:t("div",{className:"flex flex-row items-center gap-2",children:[e(ee,{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 Vi({keyId:n,showTitle:r=!1,size:a="md"}){const{client:s}=Kt(),{data:i,error:l}=O(()=>s.apikeys.retrieve(n),[]);if(l)return e(Ri,{title:"Failed to fetch the apikey",error:l,showTitle:r,size:a});if(!i)return e(Ei,{});const o=e(ee,{name:"PK",color:"bg-pink-500",size:a}),c=t(te,{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(qi,{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 qi({title:n,description:r,children:a}){return t(N,{hover:!0,children:[e(k,{className:"cursor-pointer flex items-center inline-block",children:e("div",{children:a})}),e(C,{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 Bi({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(Oi,{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 Ki({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(Q,{filterBy:"name",className:a,isClearable:!0,optionLabel:ki,options:i,value:u,onChange:e=>{t.setFilterValue("environment",e?._id)},by:"_id",placeholder:r})}function Wi(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 sn.published:i="success";break;case sn.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(w,{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=_i({buckets:n.models||[],name:"model"});r.push(e)}if(n.statuses){const e=_i({buckets:n.statuses||[],name:"status"});r.push(e)}if(n.finish_reason){const e=_i({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=Bi({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 Hi(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 Gi({facets:n,search:r}){const[a,s]=c([]),i=Wi(n),l=Hi(r);return t(ne,{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(re,{}),e(v,{onClick:()=>{r.search()},variant:"outline",title:"Refresh",children:e(xt,{className:"size-5"})})]}),t("div",{className:"flex gap-2 items-center",children:[e(ae,{}),e(se,{})]})]})}function Ji(e){const t=[];if(t.push({placeholder:"Workflow or Run ID",name:"name",type:"text",options:[]}),e.status){const n=_i({buckets:e.status||[],name:"status",placeholder:"Status"});t.push(n)}if(e.initiated_by){const n=Bi({buckets:e.initiated_by||[],name:"initiated_by",placeholder:"Initiated By"});t.push(n)}t.push({name:"start",placeholder:"Date After",type:"date",multiple:!1});return t.push({name:"end",placeholder:"Date Before",type:"date",multiple:!1}),t}function Yi(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,"name"===n?(e.query.search_term=r,e.query.name=r):e.query[n]=r}}),e.search()):e.clearFilters()}}function Zi({facets:n,search:r}){const[a,s]=c([]),i=Ji(n),l=Yi(r);return e(ne,{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(re,{}),e(ae,{}),e(se,{})]})})}function Qi(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=Ii({buckets:e.type||[],typeRegistry:t,type:"select",multiple:!0});n.push(r)}if(e.status){const t=_i({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 Xi(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 el({facets:n,search:r}){const[a,s]=c([]),i=Qi(n),l=Xi(r);return e(ne,{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(re,{}),e(ae,{}),e(se,{})]})})}function tl(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 nl(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 rl({facets:n,search:r}){const[a,s]=c([]),i=tl(),l=nl(r);return e(ne,{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(re,{}),e(ae,{}),e(se,{})]})})}function al(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 sl(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 il({facets:n,search:r}){const[a,s]=c([]),i=al(n),l=sl(r);return e(ne,{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(re,{}),e(ae,{}),e(se,{})]})})}function ll(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 ol(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 cl({facets:n,search:r}){const[a,s]=c([]),i=ll(),l=ol(r);return e(ne,{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(re,{}),e(ae,{}),e(se,{})]})})}class dl{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 dl(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 ul=u(void 0);function ml(){const e=m(ul);if(!e)throw new Error("useObjectSelection must be used within a ObjectSelectionProvider");return e}function pl(){return m(ul)}function hl({value:t,collectionId:n,children:r}){const[a,s]=c();return d(()=>{const e=new dl(t,n,{},s);s(e)},[t]),a&&e(ul.Provider,{value:a,children:r})}un.extend($n),un.extend(En);const gl={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(bt,{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||Da(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(bt,{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:un(t)[r](a)},n)}},fl=gl.string();function yl(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 bl(e){return e&&"."!==e?e.split("."):[]}class vl{layout;renderer=fl;path;fallbackPath;previewObject;constructor(e,t){if(this.layout=e,this.path=bl(e.field||""),this.fallbackPath=e.fallback?bl(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=gl[e](r)}else this.renderer=gl[t]()}}get name(){return this.layout.name}resolveValue(e){let t=yl(e,this.path);return void 0===t&&this.fallbackPath&&(t=yl(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 gl[a](s,e=>{this.previewObject(t.id)})(t,n)}return this.renderer(this.resolveValue(t),n)}}function xl({objects:n,selection:r,isLoading:a,columns:s,onRowClick:i,selectedObject:l,toggleAll:o,onSelectionChange:c}){return t(te,{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(ie,{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 wl({objects:r,selection:a,isLoading:s,onSelectionChange:i,onRowClick:l,previewObject:o,selectedObject:c}){return t(n,{children:[e(xi,{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(wi,{document:t,selection:a,onSelectionChange:i,onRowClick:l,previewObject:o,selectedObject:c},t.id))})]})}class Nl{client;limit;collectionId;facets=new le({});result=new le({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 kl=u(void 0);function Cl(){return m(kl)}function Sl(){return oe(Cl().facets)}function Pl(){const e=Cl();return{...oe(e.result),search:e}}function jl(){const e=Cl();return oe(e.facets).total}var _l;async function Il(e){try{const t=await e.arrayBuffer(),n=new Dn;n.appendByteArray(new Uint8Array(t));const r=n.end();return r?.toString()}catch(e){return void console.error("Error calculating file hash:",e)}}function Tl(){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 Il(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=_l.SKIP)}},i=async()=>{const n=t.filter(e=>e.action!==_l.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=_l.UPDATE)}console.log(`Reconciled ${t.filter(e=>e.action===_l.UPDATE).length}`)};return await s(),await i(),t.forEach(e=>{e.action||(e.action=_l.CREATE)}),console.log("Document processing check results:",{totalFiles:n.length,toCreate:t.filter(e=>e.action===_l.CREATE).length,toUpdate:t.filter(e=>e.action===_l.UPDATE).length,toSkip:t.filter(e=>e.action===_l.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 Al({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:w}=Kt(),N=b(),[k,C]=c([]),[S,P]=c([]),[j,_]=c(!1),[I,T]=c(null),[A,z]=c([]),[F,E]=c(!1),[$,D]=c(!1),[R,O]=c(0),[L,U]=c(Date.now()),[M,V]=c(void 0),[B,J]=c(null),[Y,Z]=c(u),[Q,X]=c("");d(()=>{i&&y.store.collections.retrieve(i).then(V)},[i]),d(()=>{F?(Z("Uploading Files"),X(`${Math.round(R)}% complete`)):$?(Z("Upload Complete"),X("")):j?(Z("File Analysis Results"),X(`${k.length} file${1!==k.length?"s":""}`)):k.length>0?(Z(u),X("Checking for duplicates and updates")):(Z(u),X(""))},[F,$,j,u,R,k.length]);const ee=()=>M||l?t(ce,{className:"mb-4",status:"default",icon:e(Pt,{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}=Tl(),ae=o(()=>w?.types||[],[w?.types]);d(()=>{r&&(P([]),_(!1),T(null),z([]),E(!1),D(!1),O(0),ne({toCreate:0,toUpdate:0,toSkip:0}),J(null),Z(u),X(""),s&&s.length>0?(C(s),le(s)):C([]),U(Date.now()))},[r,s]);const se=()=>{C([]),P([]),_(!1),T(null),z([]),E(!1),D(!1),O(0),ne({toCreate:0,toUpdate:0,toSkip:0}),J(null),Z(u),X(""),U(Date.now()),a()},ie=e=>{e&&e.length>0&&(C(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);P(t);const n=t.filter(e=>e.action===_l.CREATE).length,r=t.filter(e=>e.action===_l.UPDATE).length,a=t.filter(e=>e.action===_l.SKIP).length;ne({toCreate:n,toUpdate:r,toSkip:a}),N({title:"Files analyzed",description:`${e.length} file(s): ${n} new, ${r} to update, ${a} to skip`,status:"info",duration:4e3}),_(!0)}catch(e){console.error("Error processing files:",e),N({title:"Error",description:"There was an error analyzing the files",status:"error",duration:5e3})}},oe=async()=>{if(!S.length)return;const e=I?.id||null,t=S.map(e=>({file:e.file,status:"pending",progress:0,action:e.action===_l.CREATE?"create":e.action===_l.UPDATE?"update":"skip"}));z(t),E(!0),D(!1);const n=S.filter(e=>e.action===_l.SKIP),r=S.filter(e=>e.action===_l.UPDATE),a=S.filter(e=>e.action===_l.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}),z(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){N({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(z(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()}),z(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});z(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),z(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||z(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 O(r),e})}))}};r.length>0&&await l(r,"update"),a.length>0&&await l(a,"create"),z(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}),E(!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`),N({title:"Upload Complete",description:m,status:u>0?"warning":"success",duration:5e3}),J(s)},ue=()=>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(x,{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(Ye,{className:"size-3 ml-2"})})]}),e(de,{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=>T(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(Nt,{className:"size-4 mr-1"}),"Automatic Type Detection",e(x,{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(Ye,{className:"size-3 ml-2"})})]})})]});return t(K,{isOpen:r,onClose:se,className:"mx-auto",disableCloseOnClickOutside:!0,children:[e(W,{description:Q,children:Y}),g?t(H,{children:[m,ee(),ue()]}):0!==k.length||h?F||$?F?t(H,{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:`${R}%`}})})}),e("div",{className:"max-h-96 overflow-y-auto",children:A.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(Ct,{className:"size-5 text-muted"}),"uploading"===n.status&&e(q,{size:"sm"}),"success"===n.status&&e(Nt,{className:"size-5 text-success"}),"error"===n.status&&e(St,{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(H,{children:t("div",{className:"mb-4",children:[ee(),e(wn,{files:A.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(H,{children:j?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(wt,{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(Nt,{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(kt,{className:"size-5 text-mixer-attention/40"}),e("span",{className:"font-medium",children:"Skip"})]}),e("div",{className:"text-2xl font-semibold",children:te.toSkip})]})]})})}),ue(),e(ce,{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(q,{size:"lg",className:"mb-4"}),e("div",{className:"text-lg font-medium",children:"Analyzing files..."})]})}):t(H,{className:"flex flex-col items-center justify-center p-8",children:[ee(),e(xn,{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(G,{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===k.length&&!h)return e(G,{children:e(v,{variant:"ghost",onClick:se,children:"Cancel"})});if(!F&&!$){const n=j;return t(G,{children:[e(v,{variant:"ghost",onClick:se,children:"Cancel"}),e(v,{disabled:!n,onClick:oe,children:te.toCreate+te.toUpdate>0?"Upload":"Continue"})]})}return F?e(G,{children:e(v,{variant:"ghost",disabled:!0,children:"Uploading..."})}):t(G,{children:[e(v,{variant:"ghost",onClick:()=>{C([]),P([]),_(!1),T(null),z([]),E(!1),D(!1),O(0),ne({toCreate:0,toUpdate:0,toSkip:0})},children:"Upload More"}),e(v,{onClick:()=>{p&&B&&p(B),se()},children:"Close"})]})})()]},L)}function zl(e){const t="function"==typeof e?e:e.onUploadDone,{client:n,project:r,store:a}=Kt(),s=Cl(),i=b(),{checkDocumentProcessing:l}=Tl();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===_l.CREATE).length,y=g.filter(e=>e.action===_l.UPDATE).length,b=g.filter(e=>e.action===_l.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===_l.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===_l.CREATE||e.action===_l.UPDATE)&&e.file);if(v.length>0){console.log(`Processing ${v.length} files (${v.filter(e=>e.action===_l.CREATE).length} create, ${v.filter(e=>e.action===_l.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===_l.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"}(_l||(_l={}));const Fl=[{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 El({isGridView:t=!1,onUpload:n,collectionId:r,...a}){return n?e($l,{...a,onUpload:n,isGridView:t,collectionId:r}):e(Dl,{...a,isGridView:t})}function $l({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=Cl(),w=b(),{checkDocumentProcessing:N}=Tl(),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(q,{size:"xl"})}),e(Dl,{...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(xn,{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(Al,{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 Dl({objects:t,layout:n=Fl,isLoading:r,onRowClick:a,onSelectionChange:s,previewObject:i,selectedObject:l,isGridView:c}){const d=pl(),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:Fl).map(e=>new vl(e,i)),[n,i]);return e(c?wl:xl,{objects:t,isLoading:r,columns:p,onRowClick:a,previewObject:i,selectedObject:l,selection:d,toggleAll:m,onSelectionChange:u})}function Rl({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 Nl(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(kl.Provider,{value:d,children:t})}const Ol=[{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 Ll({onChange:t}){return e(Rl,{children:e(Ul,{onRowClick:e=>{t(e||void 0)}})})}function Ul({onRowClick:n}){const[r,s]=c(!1),[i,l]=c("grid"===localStorage.getItem("vertesia.content_store.lastDisplayedView")),{search:o,isLoading:u,error:m,objects:p,hasMore:h}=Pl(),f=g(null);ue(f,()=>{r&&h&&!u&&(s(!1),o.loadMore(!0).finally(()=>{s(!0)}))},{threshold:.1,deps:[r,h,u]}),d(()=>{o.search().finally(()=>{s(!0)})},[]);const y=Sl(),b=Cl();return m?e(L,{title:"Search failed",children:m.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(el,{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(xt,{size:16})}),e($a,{onUpdate:l})]})]}),t("div",{className:"@container flex-1 overflow-y-auto",children:[e(El,{objects:p||[],isLoading:!1,layout:Ol,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",u?"block":"hidden"),children:e(q,{size:"xl"})})]})]})}function Ml({isOpen:n,onClose:r}){return t(K,{onClose:()=>r(),isOpen:!!n,className:"min-w-[60vw]",children:[e(W,{children:"Select Content"}),e(H,{className:"pt-0 overflow-y-auto max-h-[80vh] min-h-[80vh]",children:n&&e(Ll,{onChange:r})})]})}const Vl=/store:([a-f0-9]+)/;function ql({object:n}){const{client:a}=Kt(),{off:s,on:i,isOn:l}=me(),[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(Vl);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(pe.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(De,{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(jt,{className:"size-5"})})}),e(Ml,{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 Bl(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 Kl({objectId:n,isOpen:r,onClose:a}){const s=pn(),{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/")&&P(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)}},P=async e=>{try{"found"===(await i.objects.getRendition(e.id,{format:Yt.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())},_=f&&(f.startsWith("#")||f.includes("\n#")||f.includes("\n*")),I=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(_t,{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(ht,{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(De,{className:"h-5 w-5"})})]})]}),m?e("div",{className:"flex-1 flex items-center justify-center",children:t("div",{className:"text-center",children:[e(q,{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(st,{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(Ye,{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(q,{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:_?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(hn,{children:f})}):e("pre",{className:"text-wrap whitespace-pre-wrap dark:text-gray-200",children:f})}):null,I&&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(q,{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(_t,{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"})]}),!I&&!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(_t,{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(bn,{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(Ye,{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?Wl(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(pt,{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(Le,{className:"h-4 w-4 ml-2"})]})]})]}):null}function Wl(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 Hl=Object.values(ln),Gl=Object.values(on);function Jl({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||Hl),[C,S]=c(100);d(()=>{s&&k(s)},[s]);const P={};let j=!1,_=!1;N.forEach(e=>{e===ln.full_text?j=!0:_=!0,Gl.includes(e)&&(P[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:_?{text:u,config:P}:void 0,full_text:j?u:void 0,limit:C}),y("Searching...")},F=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(E,{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(It,{size:18})}),t(I,{isOpen:x,onClose:()=>w(!1),children:[e(T,{children:"Search Types"}),e(A,{children:t("div",{className:"flex flex-col gap-2",children:[t("label",{className:"flex items-center gap-2",children:[e(he,{checked:N.includes(ln.full_text),onCheckedChange:F(ln.full_text)}),e("span",{children:"Full Text"})]}),e("div",{className:"font-semibold mt-2 mb-1",children:"Embeddings"}),Gl.map(n=>t("label",{className:"flex items-center gap-2",children:[e(he,{checked:N.includes(n),onCheckedChange:F(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(ge,{type:"number",min:1,value:C,onChange:e=>S(Number(e??100)),style:{width:80}})]})]})}),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 Yl=[{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 Zl({onUploadDone:t=async()=>{},layout:n}){const r=Cl(),a=b(),s=zl(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(Ql,{layout:n,onUpload:(e,t)=>{const n=r.collectionId;return s(e,t,n)}})}function Ql({layout:n,onUpload:r,allowFilter:a=!0,allowSearch:s=!0}){const i=Cl(),[l,o]=c(!1),[u,m]=c(null),{typeRegistry:p}=Kt(),{search:h,isLoading:f,error:y,objects:b,hasMore:v}=Pl(),[x,w]=c(p?n||(N=p,((k=h.query.type)?N.getTypeLayout(k):Yl)??Yl):Yl);var N,k;const[C,S]=c(0),[P,j]=c(0),[_,I]=c("grid"===localStorage.getItem($a.LAST_DISPLAYED_VIEW)),[T,A]=c([]),z=g(null);d(()=>{l||0!==b.length||(j(0),h._updateRunningState(!0),h.search().then(()=>{o(!0)}).catch(e=>{console.error("Initial search failed:",e),h._updateRunningState(!1)}))},[]),d(()=>{b.length<P&&j(b.length)},[b.length,P]),ue(z,()=>{l&&b.length>0&&b.length!=P&&(o(!1),h.loadMore().finally(()=>{j(b.length),o(!0)}))},{deps:[l,b.length]});const F=Sl(),E=Cl(),$=Qi(F),D=Xi(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 U=pn();return t("div",{className:"flex flex-col gap-y-2",children:[e(eo,{object:u,onClose:()=>m(null)}),y&&e(L,{title:"Error",children:y.message}),e(Xl,{isLoading:f,refreshTrigger:C,allowFilter:a,allowSearch:s,filterGroups:$,filters:T,handleFilterChange:e=>{const t="function"==typeof e?e(T):e;A(t),D(t)},handleVectorSearch:e=>{if(e&&e.vector){if(h.query.vector=e.vector,h.query.full_text=e.full_text,h.query.weights=e.weights,h.query.score_aggregation=e.score_aggregation,h.query.dynamic_scaling=e.dynamic_scaling,void 0!==e.limit&&(h.limit=e.limit,h.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)}h.search().then(()=>o(!0))}else e&&e.full_text?(h.query.full_text=e.full_text,void 0!==e.limit&&(h.limit=e.limit,h.query.limit=e.limit),h.search().then(()=>o(!0))):void 0===e&&l&&(delete h.query.vector,delete h.query.full_text,h.search().then(()=>o(!0)))},handleRefetch:()=>{h.search().then(()=>o(!0))},setIsGridView:I}),e(El,{objects:b,isLoading:!b.length&&f,layout:x,onRowClick:e=>{U(`/objects/${e.id}`)},previewObject:e=>{const t=b.find(t=>t.id===e)||null;m(t)},selectedObject:u,onUpload:r,isGridView:_,collectionId:i.collectionId}),e("div",v?{ref:z,className:"w-full flex justify-center",children:e(q,{size:"xl"})}:{className:"text-muted text-center text-sm py-1",children:`All ${b.length} objects loaded.`})]})}function Xl(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(ne,{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(Jl,{onChange:d,isLoading:r,refresh:a,className:"w-full"}),e(re,{})]}),t("div",{className:"flex gap-1 items-center",children:[e(v,{variant:"outline",onClick:u,alt:"Refresh",children:e(xt,{size:16})}),e($a,{onUpdate:m})]})]}),t("div",{className:"flex gap-2 items-center pt-2",children:[e(ae,{}),e(se,{})]})]}),!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(Jl,{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(xt,{size:16})}),e($a,{onUpdate:m})]})]})]})}function eo({object:n,onClose:r}){const{store:a}=Kt(),s=b(),i=pn(),l=Bl(a,s,n?.content?.source,n?.name||n?.content?.name);return n?t(fe,{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(Re,{className:"size-4"})}),n.content?.source&&e(v,{variant:"ghost",size:"sm",title:"Download",onClick:l,children:e(pt,{className:"size-4"})})]}),e(ye,{className:"my-2"}),e("div",{className:"pt-2",children:e(ai,{object:n,loadText:!0},n.id)})]}):null}var to;function no({isExporting:n,isOpen:r,onClose:a}){return t(I,{onClose:()=>a(void 0),isOpen:r,className:"relative overflow-visible",children:[e(T,{children:"Export Object Properties"}),!n&&e(ro,{onClose:a}),n&&e(ao,{})]})}function ro({onClose:n}){const[r,a]=c(void 0),[s,i]=c(void 0),l=["Export selected objects","Export all objects"];return t(A,{className:"min-h-[104px] pt-0 flex flex-col gap-y-4",children:[e("div",{className:"h-1/3",children:e(Q,{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(Q,{options:Object.values(to),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 ao({}){return e(A,{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(q,{size:"lg"})]})})}function so({collection:t}){const n=b(),{client:r,typeRegistry:a}=Kt();Cl().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(Ql,{layout:s}):e(Zl,{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"}(to||(to={}));const io=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 lo({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(de,{options:i.typeRegistry?.types||[],value:p,onChange:g,placeholder:"Choose Content Types...",optionLabel:io,className:t||"text-sm bg-background",filterBy:"name",isClearable:a||!1,multiple:!0})}:{className:"flex flex-col gap-4 content-between",children:e(de,{options:i.typeRegistry?.types||[],value:u,onChange:e=>{m(e||void 0),r(e)},placeholder:"Choose a Content Type...",optionLabel:io,className:t||"text-sm bg-background",filterBy:"name",isClearable:a||!1})})}function oo({onClose:n,redirect:r=!0,onAddToCollection:a}){const s=pn(),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(H,{children:[e(F,{label:"Name",required:!0,children:e(E,{type:"text",value:u.name||"",onChange:e=>p("name",e)})}),e(F,{label:"Description",className:"mt-2",children:e(be,{value:u.description||"",onChange:e=>p("description",e)})}),e(F,{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(ve,{value:u.dynamic||!1,onChange:e=>p("dynamic",e)})}),!u.dynamic&&e(F,{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(lo,{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(F,{label:"Type",className:"mt-2",description:"Optionally select a content type to assign custom properties and data to the collection.",children:e(lo,{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(G,{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 co({isOpen:n,onClose:r}){return t(K,{onClose:r,isOpen:n,children:[e(W,{children:"Create a Collection"}),e(oo,{onClose:r})]})}function uo({}){const{client:r}=Kt(),a=b(),[s,i]=c(),[l,o]=c(!0),[u,m]=c(!1),{data:p,error:h,refetch:g}=O(()=>r.store.collections.search({}),[]);if(d(()=>{(p||h)&&o(!1)},[p,h]),h)return e(L,{title:"Collections fetch failed",children:h.message});return t(n,{children:[p&&(p.length>0?t(te,{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(ie,{columns:4,isLoading:l,children:p.map(n=>t(xe,{children:[e("td",{children:t("div",{className:"flex items-center gap-2",children:[mo(n.dynamic),e(mn,{href:`/collections/${n.id}`,children:n.name})]})}),e("td",{children:n.type?.name||"-"}),e("td",{children:un(n.created_at).fromNow()}),e("td",{className:"text-right",children:e(v,{variant:"destructive",size:"sm",onClick:()=>i(n.id),children:e(Tt,{className:"size-4"})})})]},n.id))})]}):e(we,{title:"No Collections",buttonLabel:"New Collections",onClick:()=>m(!0),children:"Get started by creating a new Collections."})),e(co,{isOpen:u,onClose:()=>m(!1)}),e(Ne,{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 mo(t){const n=t?"Dynamic Collection":"Static Collection",r=e(t?At:zt,{className:"size-5"});return e(x,{description:n,className:"mr-2",children:r})}function po({objects:n,isLoading:r}){const a=pn();return t(te,{className:"w-full",children:[e(ke,{children:t("tr",{children:[e("th",{children:"Name"}),e("th",{children:"Strict Mode"}),e("th",{children:"Semantic Chunking"}),e("th",{children:"Updated At"})]})}),e(ie,{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:un(n.updated_at).fromNow()})]},n.id))})]})}un.extend($n),un.extend($n);class ho{client;limit;result=new le({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 go=u(void 0);function fo(){return m(go)}function yo(){const e=fo();return{...oe(e.result),search:e}}function bo(){return fo().objects.length}function vo({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(T,{children:n}),e(A,{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(E,{value:o,onChange:d})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-muted",children:"Description"}),e(be,{value:u,onChange:e=>m(e.target.value)})]})]})}),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 xo;function wo({isDirty:n=!1}){const r=Kt(),{store:a}=r,s=b(),[i,l]=c(!1),{search:o,isLoading:u,error:m,objects:p}=yo(),[h,f]=c(""),y=Ce(h,500),v=g(null);ue(v,()=>{i&&o.loadMore()},{deps:[i]}),d(()=>{o.search().then(()=>l(!0))},[]),d(()=>{o.query.name=h,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(m)return e(L,{title:"Failed to fetch ObjectTypes",children:m.message});return t("div",{className:"flex flex-col gap-4 h-full",children:[t("div",{className:"flex flex-shrink-0 gap-4",children:[e(E,{placeholder:"Filter by Name",value:h,onChange:f}),e(Q,{className:"w-60",isClearable:!0,options:Object.values(xo),value:x,onChange:e=>{w(e)},placeholder:"Is Chunkable"})]}),t("div",{className:"flex-1 overflow-y-auto",children:[u||0!==p?.length?e(po,{objects:p,isLoading:u}):e(we,{title:"No Type",buttonLabel:"Create Type",onClick:()=>{k(!0)},children:"Get started by creating a new Type."}),e(vo,{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(e){e.true="Yes",e.false="No"}(xo||(xo={}));const No=[Mn,Rn()];function ko({objectType:n,onSchemaUpdate:r}){const{store:a}=Kt(),s=b(),[i,l]=c(!1),d=Nn(n.object_schema),u=g(void 0),[m,p]=c(!1),h=o(()=>function(e){if(!e)return"";return JSON.stringify(e,null,2)}(d.schema),[d]),f=()=>{if(u.current){const e=u.current.getValue();try{const t=function(e){if(!e?.trim())return;return JSON.parse(e.trim())}(e);Co(t),d.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:()=>{m&&!f()||p(e=>!e)},children:m?"Edit Schema":"Edit Json"})}),e("div",{className:"ml-auto flex gap-x-2",children:e(v,{isLoading:i,variant:"outline",size:"sm",onClick:()=>{m&&!f()||(l(!0),a.types.update(n.id,{object_schema:d.schema}).then(()=>{r(d),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(()=>{l(!1)}))},children:"Save Changes"})})]}),e("div",{className:"px-4 py-2",children:m?e(kn,{value:h,extensions:No,editorRef:u}):e(Cn,{schema:d})})]})}const Co=e=>{try{new In({strict:!1}).compile(e)}catch(e){throw new Error(`Invalid JSON Schema definition: ${e.message}`)}};function So({children:t,limit:n,name:r,chunkable:a}){const{store:s}=Kt(),i=o(()=>{const e=new ho(s,n);return e.query.name=r,e.query.chunkable=a,e},[n]);return e(go.Provider,{value:i,children:t})}function Po({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(T,{children:a}),t(A,{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(Q,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(Nt,{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($,{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})]})]})}const jo=[Mn,Rn()];function _o({objectType:n,onLayoutUpdate:r}){const a=b(),[s,i]=c(!1),{store:l}=Kt(),d=g(void 0),u=o(()=>Io(n.table_layout),[n.table_layout]),m=(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:s,variant:"outline",size:"sm",onClick:()=>{if(!d.current)return;const e=d.current.getValue();let t;if(e)try{t=JSON.parse(e)}catch(e){return m("Invalid JSON",e.message)}else t=null;return Array.isArray(t)?t.some(e=>!e||!e.name||!e.field)?m("Invalid JSON","A table layout entry must contain the following properties:] {field, name, converter?}"):(i(!0),void l.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(()=>{i(!1)})):m("Invalid JSON","The table layout must be an array")},children:"Save Changes"})})]}),e("div",{className:"px-4 py-2",children:e(kn,{value:u,extensions:jo,editorRef:d})})]})}function Io(e){return e?JSON.stringify(e,null,2):"[\n\n]"}const To=[Mn,Rn()];function Ao({refetch:r,collection:a}){const s=a.type?.id,i=g(void 0),l=b(),{client:d}=Kt(),[u,m]=c(!1),[p,h]=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||[]}),f=o(()=>Io(a.table_layout),[a.table_layout]),y=(e,t)=>{h({...p,[e]:t})};return t("div",{className:"flex flex-col gap-4 py-2",children:[t(Se,{title:"Configuration",action:e(v,{size:"lg",isDisabled:u,onClick:()=>{let e;try{e=p.query?JSON.parse(p.query):void 0}catch(e){return void l({title:"Invalid Query JSON",description:e.message,status:"error",duration:5e3})}const t={name:p.name,description:p.description,query:e,tags:p.tags,type:p.type,allowed_types:p.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}m(!0),d.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(()=>{m(!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(On,{userRef:a.created_by,showTitle:!0}),t("span",{children:["at ",un(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(On,{userRef:a.updated_by,showTitle:!0}),t("span",{children:["at ",un(a.updated_at).format("YYYY-MM-DD HH:mm:ss")]})]})]})]}),e(F,{label:"Name",required:!0,children:e(E,{value:p.name,onChange:e=>y("name",e)})}),e(F,{label:"Description",children:e(be,{value:p.description,onChange:e=>y("description",e.target.value)})}),!a.dynamic&&e(F,{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(lo,{defaultValue:p.allowed_types||null,onChange:e=>{Array.isArray(e)?y("allowed_types",e.map(e=>e.id)):y("allowed_types",e?[e.id]:[])},isClearable:!0,multiple:!0})}),a.dynamic&&e(F,{label:"Query",description:"Define the query to dynamically fetch content for the collection.",children:e(be,{className:pe.INPUT,value:p.query,onChange:e=>y("query",e.target.value)})}),e(F,{label:"Table Layout",description:"Define a custom layout for displaying the collection in tables.",children:e(kn,{className:"border-1 rounded-md border-border",value:f,extensions:To,editorRef:i})}),e(F,{label:"Type",description:"Select a content type to assign custom properties and data to the collection.",children:e(lo,{defaultValue:p.type||null,onChange:e=>{Array.isArray(e)?y("type",e.length>0?e[0].id:null):y("type",e?.id||null)},isClearable:!0})})]}),s&&e(zo,{typeId:s,collection:a}),!a.dynamic&&t(n,{children:[e(Ln,{collection:a}),e(Un,{collection:a})]})]})}function zo({typeId:t,collection:n}){const[r,a]=c({}),s=b(),{client:i}=Kt(),[l,d]=c(!1),{data:u,error:m}=O(()=>i.store.types.retrieve(t),[t]),p=u?.object_schema||{},h=o(()=>new Sn(p,n.properties||{}),[p,n.properties]);if(m)return e(L,{title:"Failed to load type",children:m.message});if(!u)return null;return e(Se,{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 Sn&&a(e.value)}})})}function Fo({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(),[h,g]=c(""),[f,b]=c(!1),[x,w]=c(!1),P=Ce(h,300),I=p(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&&w(!0),l&&l.length>0?n.filter(e=>!l.includes(e.id)):n},[m,d,l,x]),{data:T,error:A}=O(()=>I(x?P:""),[x?P:"",I]),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=p(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=p(()=>{n(void 0,void 0)},[n]),$=p(e=>{g(e)},[]),D=h.trim().length>0,R=o(()=>{if(!T)return[];if(x)return T;if(!D)return T;const e=h.toLowerCase();return T.filter(t=>t.name.toLowerCase().includes(e))},[T,x,D,h]),U=z&&D;if(A)return e(L,{title:"Collection fetch failed",children:A.message});return t(N,{children:[e(k,{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(jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(C,{className:"mt-2 mb-2 w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:t(S,{shouldFilter:!1,children:[t("div",{className:"flex justify-between items-center border-b px-3","cmdk-input-wrapper":"",children:[e(Pe,{placeholder:i,value:h,onValueChange:$,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(je,{children:f?"Searching...":D?"No collections found.":"No collections available."}),t(j,{className:"max-h-[300px] overflow-auto",children:[U&&!u&&e(_,{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(_,{value:n.id,onSelect:()=>F(n),className:"flex items-center justify-between",children:[e("span",{className:"truncate",children:n.name}),a&&e(Ft,{className:"ml-2 h-4 w-4 shrink-0"})]},n.id)})]})]})})]})}function Eo({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(Se,{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(_e,{value:s,onChange:e=>{i(e)},options:o,placeholder:"Select properties to share"})})})}function $o({collection:t}){const{client:n}=Kt(),[r,a]=c(t.skip_head_sync??!1),[s,i]=c(!1),l=b();return e(Se,{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(ve,{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 Do({action:n,objectIds:r,children:a}){const{store:s}=Kt(),i=b(),[l,o]=c(!1),d=p(()=>(o(!0),Promise.resolve(!0)),[]);nc(n.id,d);return t("div",{children:[a,e(Po,{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 Ro={id:"changeType",name:"Change Content Type",description:"Change the Content Type of the selected documents",confirm:!1,component:Do};function Oo({action:r,callback:a,children:s}){const[i,l]=c(!1),o=r.confirmationText||`Are you sure you want to ${r.name}?`,d=p(e=>r.confirm?(l(!0),Promise.resolve(!0)):a(e),[r.confirm,a]),u=nc(r.id,d);return t(n,{children:[s,e(Ne,{onConfirm:()=>{l(!1),a({...u.params,action:r})},onCancel:()=>l(!1),title:"Are you sure?",content:o,isOpen:i})]})}function Lo({action:t,objectIds:n,children:r}){const a=tc(),s=b(),{client:i}=Kt(),l=Cl(),o=pn(),c=p(()=>{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(Oo,{action:t,callback:c,children:r})}const Uo={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:Lo,destructive:!0},Mo={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:Lo,destructive:!0};function Vo({action:t,objectIds:n}){const{store:r}=Kt(),a=b(),[s,i]=c(!1),[l,o]=c(!1),d=p(()=>(i(!0),Promise.resolve(!0)),[]),u=nc(t.id,d);return e("div",{children:e(no,{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===to.CSV)s=new Blob([r.data],{type:r.type});else if(e===to.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 qo={id:"exportProperties",name:"Export Properties",description:"Export all Object Properties",confirm:!1,component:Vo};function Bo({action:t,objectIds:n,collectionId:r}){const a=tc(),s=b(),{client:i}=Kt(),l=Cl(),o=p(()=>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(Oo,{action:t,callback:o})}const Ko={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:Bo,destructive:!0};function Wo({action:t,objectIds:n,collectionId:r}){const a=b(),{client:s}=Kt(),[i,l]=c(!1),o=p(()=>(l(!0),Promise.resolve(!0)),[]);return nc(t.id,o),e(Go,{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 Ho={id:"startWorkflow",name:"Start Workflow",description:"Start an workflow on the selected objects",confirm:!1,hideInList:!0,component:Wo};function Go({isOpen:n,onClose:r}){return t(K,{onClose:()=>r(void 0),isOpen:n,className:"",children:[e(W,{children:"Start a Workflow by Rule"}),e(Yo,{onClose:r})]})}function Jo(n){return{label:t("div",{children:[e("div",{children:n.name}),e("div",{className:"text-sm text-muted",children:n.description})]}),reverse:!0}}function Yo({onClose:n}){const[r,a]=c(void 0),s=tc();return t("div",{children:[t(H,{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(Ie,{options:s.wfRules,optionLayout:Jo,onChange:e=>{a(e)},value:r})})]}),t(G,{children:[e(v,{variant:"secondary",onClick:()=>n(),children:"Cancel"}),e(v,{onClick:()=>{r&&n(r.id)},isDisabled:!r,children:"Start"})]})]})}class Zo{params;allActions=[qo,Ro,Ho,sc,Uo,Ko,Mo];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:Wo})).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 Qo=u(void 0);function Xo({children:n}){const r=ml(),a=b(),{client:s}=Kt(),i=Cl(),{data:l,error:c}=O(()=>s.workflows.rules.list().then(e=>e.map(e=>({id:e.id,name:e.name,description:e.description,confirm:!1,isWorkflow:!0,component:Wo})).sort((e,t)=>e.name.localeCompare(t.name))),[]),d=o(()=>{const e=new Zo({selection:r,toast:a,client:s,search:i});return e.wfRules=l,e},[r,l]);return c?e(L,{title:"Failed to fetch workflows",children:c.message}):d&&t(Qo.Provider,{value:d,children:[e(ec,{}),n]})}function ec({}){const t=tc(),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 tc(){const e=m(Qo);if(!e)throw new Error("You cannot use useActionContext outside an ActionProvider");return e}function nc(e,t){const n=tc();return d(()=>n.registerCallback(e,t),[n,e,t]),n}function rc(e){const t=tc();return d(()=>(t.startWorkflow=e,()=>{t.startWorkflow=void 0}),[e,t]),t}function ac({action:t,objectIds:n}){const[r,a]=c(!1),s=p(()=>(n.length>0&&a(!0),Promise.resolve(!0)),[n]);return nc(t.id,s),r&&e(B,{children:e(ic,{objectIds:n,isOpen:r,onClose:()=>{a(!1)}})})}const sc={id:"addToCollection",name:"Add to Collection",description:"Add documents to a collection",confirm:!1,component:ac};function ic({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(W,{className:"flex flex-col min-w-0 overflow-hidden",children:"Add to a Collection"}),e(Te,{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(lc,{onClose:r,objectIds:a})})]})}function lc({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(Ae,{level:5,children:"Choose from existing collections"}),e(H,{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(Fo,{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(G,{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(oo,{onClose:n,onAddToCollection:e=>o({collectionId:e}),redirect:!1})})}];return t(ze,{defaultValue:"select",tabs:d,fullWidth:!0,children:[e(Fe,{}),e(Ee,{})]})}function oc(){const n=ml(),r=n.size(),a=r>1?"s":"",s=n?.hasSelection(),i=n?.isSingleSelection();return e(Xo,{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(De,{className:"size-4"})})]}),e(pc,{selection:n,children:e(v,{variant:"ghost",alt:"More action",size:"sm",children:e(Et,{size:16})})}),s&&e(cc,{selection:n})]})})}function cc({}){return e(uc,{})}function dc({collectionId:r,allowFolders:a=!0}){const[s,i]=c([]),[l,o]=c(!1),d=ml(),u=d?.hasSelection();return!u&&t(n,{children:[e(v,{onClick:()=>o(!0),children:"Upload"}),e(Al,{collectionId:r??"",isOpen:l,onClose:()=>{o(!1),i([])},files:s,title:"Upload Files",onUploadComplete:e=>{e&&e.success&&i([])},allowFolders:a})]})}function uc(){const t=tc();return t.params.selection.hasSelection()&&e(v,{onClick:()=>t.run(Ho.id),children:"Start Workflow"})}function mc(e){return{label:e.name,className:r("flex-1 px-2 py-2 hover:bg-accent nowrap",e.destructive?"text-destructive":"")}}function pc({selection:n,children:r}){const a=tc();return t(N,{hover:!0,children:[e(k,{children:r}),e(C,{className:"p-0 w-50",align:"end",sideOffset:6,children:e(hc,{executeAction:e=>{a.run(e.id)},selection:n})})]})}function hc({executeAction:t,selection:n}){const r=tc(),a=n?.hasSelection()?r.actions.filter(e=>!e.hideInList):[qo];return e("div",{className:"rounded-md shadow-md py-2",children:e("div",{className:"px-1 text-sm",children:e(Ie,{options:a,optionLayout:mc,onChange:e=>{t(e)},noCheck:!0})})})}function gc({onSend:n,onStop:r,disabled:a=!1,isSending:s=!1,isStopping:i=!1,isStreaming:l=!1,isCompleted:o=!1,activeTaskCount:u=0,placeholder:m="Type your message...",onFilesSelected:h,uploadedFiles:f=[],onRemoveFile:y,acceptedFileTypes:b=".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.png,.jpg,.jpeg,.gif,.webp",maxFiles:w=5,processingFiles:N,hasProcessingFiles:k=!1,renderDocumentSearch:C,selectedDocuments:S=[],onRemoveDocument:P,hideObjectLinking:j=!1,className:_,inputClassName:I}){const T=g(null),A=g(null),[z,F]=c(""),[E,$]=c(!1),[D,R]=c(!1),[O,L]=c(!1);d(()=>{!a&&o&&T.current?.focus()},[a,o]);const U=p(e=>{if(!h)return;const t=Array.from(e),n=w-f.length,r=t.slice(0,n);r.length>0&&h(r)},[h,w,f.length]),M=p(e=>{e.preventDefault(),e.stopPropagation(),h&&L(!0)},[h]),V=p(e=>{e.preventDefault(),e.stopPropagation(),L(!1)},[]),B=p(e=>{e.preventDefault(),e.stopPropagation(),L(!1),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&U(e.dataTransfer.files)},[U]),G=p(e=>{if(!h)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)},[h,U]),J=p(e=>{e.target.files&&e.target.files.length>0&&(U(e.target.files),e.target.value="")},[U]),Y=p(()=>{A.current?.click()},[]),Z=p(e=>{const t=`[📄 ${e.name}](doc:${e.id})`,n=z||"",r=T.current?.selectionStart||n.length,a=n.substring(0,r)+t+n.substring(r);F(a),R(!1)},[z]),Q=()=>{const e=z.trim();!e||a||s||(n(e),F(""))},X=()=>{r&&!i&&r()},ee=g(0),te=p(()=>{const e=T.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[]);d(()=>{te()},[z,te]);const ne=f.length>0||S.length>0||N&&N.size>0;return t("div",{className:`relative p-3 border-t border-muted flex-shrink-0 transition-all ${O?"bg-blue-50 dark:bg-blue-900/20 border-blue-400":""} ${_||""}`,style:{minHeight:"120px"},onDragOver:M,onDragLeave:V,onDrop:B,children:[O&&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(wt,{className:"size-5"}),"Drop files to upload"]})}),h&&e("input",{ref:A,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||N&&N.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(x,{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(Dt,{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(tt,{className:"size-3"})})]},n.id)),N&&Array.from(N.values()).map(n=>t("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-sm "+(n.status===cn.ERROR?"bg-destructive/10 text-destructive":n.status===cn.READY?"bg-success/10 text-success":"bg-attention/10 text-attention"),children:[n.status===cn.UPLOADING&&e(q,{size:"xs"}),n.status===cn.PROCESSING&&e(q,{size:"xs"}),n.status===cn.READY&&e(Rt,{className:"size-3.5"}),n.status===cn.ERROR&&e(tt,{className:"size-3.5"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),t("span",{className:"text-xs opacity-70",children:[n.status===cn.UPLOADING&&"Uploading...",n.status===cn.PROCESSING&&"Processing...",n.status===cn.READY&&"Ready",n.status===cn.ERROR&&(n.error||"Error")]})]},n.id))]})]}),S.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(x,{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:S.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(Dt,{className:"size-3.5"}),e("span",{className:"max-w-[120px] truncate",children:n.name}),P&&e("button",{onClick:()=>P(n.id),className:"ml-1 p-0.5 hover:bg-blue-200 dark:hover:bg-blue-800 rounded",children:e(tt,{className:"size-3"})})]},n.id))})]})]}),(h||C)&&t("div",{className:"flex gap-2 mb-2",children:[h&&t(v,{variant:"outline",size:"sm",onClick:Y,disabled:a||f.length>=w,className:"text-xs",children:[e(wt,{className:"size-3.5 mr-1.5"}),"Upload"]}),C&&t(v,{variant:"outline",size:"sm",onClick:()=>R(!0),disabled:a,className:"text-xs",children:[e(Dt,{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:T,value:z,onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey){e.preventDefault();z.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=>F(e.target.value),onPaste:G,disabled:a,placeholder:l?"Agent is working... (Esc Esc to stop)":h?"Ask anything... (drop or paste files)":m,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"}}),!j&&e(v,{variant:"ghost",className:"rounded-full",disabled:!o,onClick:()=>$(!0),alt:"Link Object",children:e(Ot,{className:"size-4"})})]}),l&&r&&!z.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(q,{size:"sm",className:"mr-2"}):e(Lt,{className:"size-4 mr-2"})," Stop"]}):t(v,{onClick:Q,disabled:a||s||!z.trim()||k,className:"px-4 py-2.5",title:k?"Wait for files to finish processing":void 0,children:[s?e(q,{size:"sm",className:"mr-2"}):e(Ut,{className:"size-4 mr-2"}),k?"Processing...":"Send"]})]}),e("div",{className:"text-xs text-muted mt-2 text-center",children:u>0?t("div",{className:"flex items-center justify-center",children:[e(Mt,{className:"h-3 w-3 mr-1 text-attention"}),t("span",{children:["Agent has ",u," active workstream",1!==u?"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"}),!j&&t(K,{isOpen:E,onClose:()=>$(!1),className:"min-w-[60vw]",children:[e(W,{children:"Link Object"}),e(H,{className:"pb-6",children:e(Ll,{onChange:e=>{const t=`[${e.properties?.title||e.name||"Object"}](store:${e.id})`,n=z||"",r=T.current?.selectionStart||n.length,a=n.substring(0,r)+t+n.substring(r);F(a),$(!1),setTimeout(()=>{if(T.current){T.current.focus();const e=r+t.length;T.current.setSelectionRange(e,e)}},100)}})})]}),C&&C({isOpen:D,onClose:()=>R(!1),onSelect:Z})]})}const fc=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(De,{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-muted rounded-full h-2",children:e("div",{className:"bg-background h-2 rounded-full",style:{width:`${o}%`}})}),e("span",{className:"text-xs text-muted",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=Vt,c="text-muted";return"in_progress"===l?(o=Qe,c="text-info"):"completed"===l&&(o=Me,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(w,{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(Ve,{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=Vt,s="text-gray-400",i="bg-gray-100 dark:bg-gray-800",l="Pending";return"in_progress"===r?(a=Qe,s="text-info",i="bg-info/20",l="In Progress"):"completed"===r&&(a=Me,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 yc(...e){return Wn(a(e))}const bc=u(void 0);function vc({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 xc({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(De,{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 wc={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 Nc(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(Nc(n,t))return!0;return!1}function kc(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 Cc(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(...Cc(e,[...t,a,String(r)]))}):"object"==typeof r&&null!==r&&n.push(...Cc(r,[...t,a]))}return n}const Sc=h(function({spec:r,artifactRunId:a}){const{title:s,description:i,spec:l,options:u}=r,[h,f]=c(!1),[y,b]=c(!1),[v,x]=c(null),[w,N]=c(!1),k=g(null),C=g(null),S=g(null),{client:P}=function(){const e=m(bc);if(!e)throw new Error("useUserSession must be used within a UserSessionProvider");return e}(),j=ua(),[_,I]=c(null),[T,A]=c(!1),[z,F]=c(null),E=u?.mode||"chart",$="dashboard"===E,D=u?.enableFullscreen??$,R=u?.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,E);d(()=>{const e=Cc(l);if(0===e.length)return I(l),A(!1),void F(null);let t=!1;A(!0),F(null);return(async()=>{const n=new Map;for(const r of e)try{const e=r.path.join(".");let t;if(a&&!r.artifactPath.startsWith("agents/")){const e=ma(a,r.artifactPath,"inline");if(j)t=await j.getOrFetch(e,async()=>(await P.files.getArtifactDownloadUrl(a,r.artifactPath,"inline")).url);else{t=(await P.files.getArtifactDownloadUrl(a,r.artifactPath,"inline")).url}}else{const e=pa(r.artifactPath);if(j)t=await j.getOrFetch(e,async()=>(await P.files.getDownloadUrl(r.artifactPath)).url);else{t=(await P.files.getDownloadUrl(r.artifactPath)).url}}const s=await fetch(t);if(!s.ok)throw new Error(`Failed to fetch artifact data: ${s.statusText}`);let i;if(r.artifactPath.toLowerCase().endsWith(".csv")){const e=await s.text(),t=Bn.parse(e,{header:!0,skipEmptyLines:!0,dynamicTyping:!0});t.errors.length>0&&console.warn(`CSV parse warnings for ${r.artifactPath}:`,t.errors),i=t.data}else{const e=await s.json();i=Array.isArray(e)?e:[e]}console.log(`Artifact ${r.artifactPath}: loaded ${i.length} rows`),i&&0!==i.length||console.warn(`Artifact ${r.artifactPath}: returned empty data`),n.set(e,i)}catch(e){return console.error(`Failed to resolve artifact: ${r.artifactPath}`,e),void(t||F(`Failed to load data from artifact: ${r.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;console.log(`Replacing artifact data at path: ${e}, path parts:`,t);for(let e=0;e<t.length-1;e++){if(void 0===a[t[e]]){console.warn(`Path navigation failed at step ${e}, key "${t[e]}" not found in:`,Object.keys(a));break}a=a[t[e]]}const s=t[t.length-1];if(a[s]&&"object"==typeof a[s]){const e=a[s].url;delete a[s].url,a[s].values=r,console.log(`Replaced artifact URL "${e}" with ${r.length} data rows`)}else console.warn(`Could not find data object at path ${e}. current[${s}]:`,a[s])}return n}(l,n);console.log("Resolved spec with artifact data:",JSON.stringify(e).slice(0,500)+"..."),I(e),A(!1)}})(),()=>{t=!0}},[l,a,P,j]);const[O,L]=c(!1);d(()=>{const e=()=>{L(document.documentElement.classList.contains("dark"))};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const[U,M]=c(0);d(()=>{if(!S.current)return;const e=new ResizeObserver(e=>{for(const t of e)M(t.contentRect.width)});return e.observe(S.current),M(S.current.clientWidth),()=>e.disconnect()},[]);const V=o(()=>Cc(l).length>0,[l]),q=o(()=>{if(V&&!_)return null;let e=_||l;return e?(u?.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,u.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(Nc(t,r)||s&&kc(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},[_,l,V,u?.parameterValues]),B=p((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=>B(e,a))}}if(e.vconcat&&Array.isArray(e.vconcat))return{...e,vconcat:e.vconcat.map(e=>B(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=>B(e,a))}}const n=e.width;return"container"===n||"number"==typeof n&&n>t?{...e,width:t}:e},[]),K=p((e,t=!1)=>{if(!q)return null;const n=function(e){const t={background:"transparent",view:{stroke:"transparent"},range:{category:wc.categorical,diverging:wc.diverging,heatmap:wc.purples,ramp:wc.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}}}(O),r=t?"undefined"!=typeof window?Math.min(window.innerWidth-80,1400):1200:U>0?U-24:500,a="vconcat"in q||"hconcat"in q||"concat"in q,i=a?{type:"pad",contains:"padding"}:{type:"fit",contains:"padding"};let l=q;a&&r&&(l=B(q,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&&!q.title?{title:s}:{},config:{...n,...q.config}}},[q,s,O,U,B]),W=p(async()=>{const e=w?C.current:k.current;if(e&&!y)try{(await e.toCanvas(2)).toBlob(async e=>{e&&(await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),b(!0),setTimeout(()=>b(!1),2e3))},"image/png")}catch(e){console.error("Failed to copy chart:",e)}},[y,w]),H=p(async()=>{const e=w?C.current:k.current;if(e&&!h){f(!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{f(!1)}}},[s,h,w]),G=p(e=>{k.current=e,x(null)},[]),J=p(e=>{C.current=e},[]),Y=p(e=>{console.error("Vega-Lite rendering error:",e),x(e instanceof Error?e.message:"Unknown error")},[]),Z=p(()=>{N(e=>!e)},[]);d(()=>{x(null)},[l]);const Q=({className:n})=>t("div",{className:yc("flex items-center gap-2",n),children:[t("button",{onClick:W,disabled:y,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(y?Ft:gt,{className:"w-3 h-3"}),y?"Copied":"Copy"]}),t("button",{onClick:H,disabled:h,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(pt,{className:"w-3 h-3"}),h?"Exporting...":"Export"]}),D&&t("button",{onClick:Z,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:w?"Exit fullscreen":"Fullscreen",children:[e(w?qt:ht,{className:"w-3 h-3"}),w?"Exit":"Fullscreen"]})]});if(T||V&&!_)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:R},children:t("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e(qe,{className:"w-5 h-5 animate-spin"}),e("span",{className:"text-sm",children:"Loading data from artifacts..."})]})})]})});if(z)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:R},children:e(vc,{error:z,chartTitle:s})})]})});if(v)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:R},children:e(vc,{error:v,chartTitle:s})})]})});const X=K(R),ee=K(0,!0);if(!X)return null;console.log("VegaLite rendering with spec:",{title:s,hasData:!!X.data?.values,dataLength:X.data?.values?.length,spec:JSON.stringify(X).slice(0,1e3)+"..."});const te=X.data;return te&&!te.values&&!te.url&&console.warn("VegaLite spec has no data:",X),t(n,{children:[e("div",{className:yc("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(Q,{})]}),i&&e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:i}),e("div",{ref:S,className:"bg-white dark:bg-gray-900 rounded overflow-hidden",style:{width:"100%",height:R,minWidth:0},children:e(Kn,{spec:X,onEmbed:e=>G(e.view),onError:Y,options:{renderer:u?.renderer||"canvas",actions:!1}})})]})}),t(xc,{isOpen:w,onClose:()=>N(!1),title:s||($?"Dashboard":"Chart"),description:i,children:[e("div",{className:"w-full h-full min-h-[calc(100vh-200px)]",children:ee&&e(Kn,{spec:ee,onEmbed:e=>J(e.view),onError:Y,options:{renderer:u?.renderer||"canvas",actions:!1}})}),e("div",{className:"absolute bottom-6 right-6",children:e(Q,{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700"})})]})]})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId),Pc=["#4f46e5","#06b6d4","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6"];class jc 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 _c(e){return"vega-lite"===e.library}function Ic(e){return("recharts"===e.library||void 0===e.library)&&!("spec"in e)}function Tc(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 Ac=h(function({spec:t,artifactRunId:n}){return _c(t)?e(Sc,{spec:t,artifactRunId:n}):e(Fc,{spec:t})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)&&e.artifactRunId===t.artifactRunId);function zc(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 Fc=h(function({spec:r}){const a={...r,chart:zc(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:u,yAxis:m,options:h,nameKey:f,valueKey:y,yKey:b,axisKey:v,dataKey:x}=a,[w,N]=c(!1),[k,C]=c(!1),S=g(null),P=p(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=p(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]),_=u||[],I=o||[],T=t(n,{children:[e(Hn,{dataKey:d,tick:{fontSize:12}}),e(Gn,{yAxisId:"left",tickFormatter:Tc,label:m?.left?.label?{value:m.left.label,angle:-90,position:"insideLeft"}:void 0}),_.some(e=>"right"===e.yAxisId)&&e(Gn,{yAxisId:"right",orientation:"right",tickFormatter:Tc,label:m?.right?.label?{value:m.right.label,angle:-90,position:"insideRight"}:void 0})]}),A=t(n,{children:[e(Jn,{strokeDasharray:"3 3"}),e(Yn,{formatter:e=>"number"==typeof e?Tc(e):String(e)}),e(Zn,{}),h?.referenceZero&&e(Qn,{y:0,stroke:"#999",strokeDasharray:"3 3"})]}),z=()=>_.map((t,n)=>{const r=t.color||Pc[n%Pc.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:h?.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:h?.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:h?.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",children:t("div",{className:"flex flex-col gap-2 p-3",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:P,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?Ft:gt,{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(pt,{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(jc,{chartType:s,children:e(Xn,{width:"100%",height:"100%",children:(()=>{switch(s){case"bar":return t(rr,{data:I,children:[T,A,z()]});case"line":return t(nr,{data:I,children:[T,A,z()]});case"area":return t(tr,{data:I,children:[T,A,z()]});case"composed":default:return t(er,{data:I,children:[T,A,z()]});case"pie":return t(lr,{children:[e(or,{data:I,dataKey:y||"value",nameKey:f||"name",cx:"50%",cy:"50%",innerRadius:h?.innerRadius||0,outerRadius:100,label:!1!==h?.showLabels,children:I.map((t,n)=>e(cr,{fill:Pc[n%Pc.length]},`cell-${n}`))}),e(Yn,{formatter:e=>"number"==typeof e?Tc(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:Tc}),e(Yn,{formatter:e=>"number"==typeof e?Tc(e):String(e)}),e(Zn,{}),_.length>0?_.map((t,n)=>e(ur,{name:t.label||t.key,data:I,fill:t.color||Pc[n%Pc.length]},t.key)):e(ur,{name:"Data",data:I,fill:Pc[0]})]})})();case"radar":return(()=>{const n=v||d;return t(mr,{cx:"50%",cy:"50%",outerRadius:100,data:I,children:[e(pr,{}),e(hr,{dataKey:n,tick:{fontSize:11}}),e(gr,{tickFormatter:Tc}),_.map((t,n)=>e(fr,{name:t.label||t.key,dataKey:t.key,stroke:t.color||Pc[n%Pc.length],fill:t.color||Pc[n%Pc.length],fillOpacity:.3},t.key)),e(Yn,{formatter:e=>"number"==typeof e?Tc(e):String(e)}),e(Zn,{})]})})();case"radialBar":return(()=>{const n=f||"name",r=y||"value",a=h?.startAngle??180,s=h?.endAngle??0;return t(yr,{cx:"50%",cy:"50%",innerRadius:h?.innerRadius??30,outerRadius:100,barSize:15,data:I,startAngle:a,endAngle:s,children:[e(br,{label:{position:"insideStart",fill:"#fff",fontSize:11},background:!0,dataKey:r,children:I.map((t,n)=>e(cr,{fill:Pc[n%Pc.length]},`cell-${n}`))}),e(Yn,{formatter:e=>"number"==typeof e?Tc(e):String(e)}),e(Zn,{iconSize:10,layout:"vertical",verticalAlign:"middle",align:"right",formatter:(e,t)=>{const a=I.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?Tc(e):String(e)}),t(xr,{dataKey:r,data:I,isAnimationActive:!0,children:[I.map((t,n)=>e(cr,{fill:Pc[n%Pc.length]},`cell-${n}`)),!1!==h?.showLabels&&e(wr,{position:"center",fill:"#fff",stroke:"none",dataKey:n})]})]})})();case"treemap":return e(Nr,{data:I,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:Pc[c%Pc.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:Tc(o)})]})]})})}})()})})})]})})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)),Ec={chart:({code:t})=>{const n=o(()=>JSON.parse(t),[t]);return e(Ac,{spec:n})}};function $c({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 Dc({children:t}){const{client:n}=Kt(),[r,a]=c(Ec);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=dn(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($c,{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({...Ec,...e})})},[]),e(jn,{components:r,children:t})}function Rc(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(Dc,{children:e(Uc,{...t,run:r})})}return r?e(Lc,{...t}):e(Oc,{})}function Oc(){return t(ce,{status:"info",icon:e(Je,{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 Lc({initialMessage:n,startWorkflow:r,onClose:a,isModal:s=!1,fullWidth:i=!1,placeholder:l="Type your message...",startButtonText:o="Start Agent",title:u="Start New Conversation",getAttachedDocs:m,onAttachmentsSent:h,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,P]=c(),j=b(),_=g(null),I=g(null),[T,A]=c([]),[z,F]=c(!1),E=g(0),$=p(e=>{e.preventDefault(),e.stopPropagation(),E.current++,e.dataTransfer?.types?.includes("Files")&&F(!0)},[]),D=p(e=>{e.preventDefault(),e.stopPropagation()},[]),R=p(e=>{e.preventDefault(),e.stopPropagation(),E.current--,0===E.current&&F(!1)},[]),O=p(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=p(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=p(e=>{A(t=>t.filter((t,n)=>n!==e))},[]);d(()=>{_.current&&_.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=m?.()||[];let n=e;if(t.length>0&&!/store:\S+/.test(e)){n=[e,"","Attachments:",...t.map(e=>`store:${e}`)].join("\n")}const a=await r(n);if(a){if(T.length>0){for(const e of T)try{const t=`files/${e.name}`;await x.files.uploadArtifact(a.run_id,t,e),await x.store.workflows.sendSignal(a.workflow_id,a.run_id,"FileUploaded",{id:`file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:e.name,content_type:e.type||"application/octet-stream",reference:`artifact:${t}`,artifact_path:t})}catch(t){console.error(`Failed to upload staged file ${e.name}:`,t)}A([])}h?.(),P({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)}}};return S?e(Uc,{onClose:a,isModal:s,initialMessage:n,placeholder:l,run:S,title:u}):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:$,onDragOver:D,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(wt,{className:"size-6"}),"Drop files to stage for upload"]})}),e("input",{ref:I,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(Bt,{className:"size-3.5 text-muted"})}),e("span",{className:"font-medium text-sm text-gray-700 dark:text-gray-300",children:u})]}),a&&!s&&e(v,{size:"xs",variant:"ghost",onClick:a,title:"Close",className:"text-slate-500 hover:text-slate-700",children:e(tt,{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(Dt,{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(tt,{className:"size-3"})})]},`${n.name}-${r}`))}),e("div",{className:"flex gap-2 mb-2",children:t(v,{variant:"outline",size:"sm",onClick:()=>I.current?.click(),disabled:k||T.length>=y,className:"text-xs",children:[e(wt,{className:"size-3.5 mr-1.5"}),"Upload"]})}),t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex-1",children:e("input",{ref:_,value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),M())},placeholder:l,disabled:k,className:"w-full py-2 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:ring-0 rounded-md"})}),t(v,{onClick:M,disabled:!w.trim()||k,className:"px-3 py-2 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(q,{size:"sm",className:"mr-1.5"}):e(Ut,{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`:"Type a message to start the conversation"})]})]})}function Uc({run:n,title:r,interactive:a=!0,onClose:s,isModal:i=!1,fullWidth:l=!1,placeholder:u="Type your message...",resetWorkflow:m,uploadedFiles:h,onRemoveFile:f,acceptedFileTypes:y,maxFiles:x,renderDocumentSearch:w,selectedDocuments:N,onRemoveDocument:k,hideObjectLinking:C,getAttachedDocs:S,onAttachmentsSent:P,isUploading:j=!1,inputContainerClassName:_,inputClassName:I}){const{client:T}=Kt(),A=g(null),z=g(null),[F,E]=c([]),[$,D]=c(!1),[R,O]=c(!1),[L,U]=c("sliding"),[M,V]=c(!i),[q,B]=c(!1),[J,Y]=c([]),[Z,Q]=c(0),[X,ee]=c(new Map),[te,ne]=c(0),re=b(),[ae,se]=c(a),[ie,le]=c(null),[oe,de]=c(new Map),[ue,me]=c(new Map),pe=o(()=>Array.from(ue.values()).some(e=>e.status===cn.UPLOADING||e.status===cn.PROCESSING),[ue]),he=g(new Map),ge=g(null),[fe,ye]=c(0),[be,ve]=c(0),[xe,we]=c(!1),Ne=g(null),ke=p(()=>{he.current.size>0&&(de(new Map(he.current)),ve(e=>e+1)),ge.current=null},[]),[Ce,Se]=c(!1),Pe=g(0),je=o(()=>{const e=J[Z]||{plan:{plan:[]},timestamp:0},t=X.get(e.timestamp)||new Map;return{plan:e.plan,workstreamStatus:t}},[J,Z,X]),_e=p(()=>{V(e=>(e||sessionStorage.setItem("plan-panel-shown","true"),!e))},[]),Ie=p(e=>{Q(e)},[]),Te=p(()=>{V(!1)},[]);d(()=>{if(!$){const e=setInterval(()=>{ne(()=>Math.floor(Math.random()*(Xr.length-1)))},4e3);return()=>clearInterval(e)}},[$]);d(()=>(E([]),Y([]),Q(0),ee(new Map),V(!1),le(null),de(new Map),(async()=>{try{const e=await T.store.workflows.getRunDetails(n.runId,n.workflowId);le(e.status)}catch(e){console.error("Failed to check workflow status:",e)}})(),T.store.workflows.streamMessages(n.workflowId,n.runId,e=>{if(e.type===Wt.STREAMING_CHUNK){const t=e.details;if(!t?.streaming_id)return;ye(e=>e+1),we(!0),Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>we(!1),50);const n=he.current.get(t.streaming_id)||{text:"",workstreamId:e.workstream_id,startTimestamp:Date.now()},r=n.text+(e.message||"");return he.current.set(t.streaming_id,{text:r,workstreamId:e.workstream_id,isComplete:t.is_final,startTimestamp:n.startTimestamp}),void(null===ge.current&&(ge.current=requestAnimationFrame(ke)))}if(e.type===Wt.SYSTEM){const t=e.details;if("file_processing"===t?.system_type&&t.files)return void me(e=>{const n=new Map(e);for(const e of t.files)n.set(e.id,e);return n})}e.type===Wt.ANSWER&&(he.current.clear(),null!==ge.current&&(cancelAnimationFrame(ge.current),ge.current=null),de(new Map)),e.type===Wt.COMPLETE&&(he.current.clear(),null!==ge.current&&(cancelAnimationFrame(ge.current),ge.current=null),de(new Map)),e.message&&E(t=>{if(t.find(t=>t.timestamp===e.timestamp))return t;if(e.type===Wt.QUESTION&&!e.details?._optimistic){const n=t.filter(t=>!(t.type===Wt.QUESTION&&t.details?._optimistic&&t.message===e.message));return ea(n,e),[...n]}return ea(t,e),[...t]})}),()=>{E([]),null!==ge.current&&(cancelAnimationFrame(ge.current),ge.current=null),he.current.clear()}),[n.runId,T.store.workflows,ke]),d(()=>{D(!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}(F)),0===J.length&&V(!1)},[F,J.length]),d(()=>{if(1===J.length&&!M&&!sessionStorage.getItem("plan-panel-shown")){const e=setTimeout(()=>{V(!0),sessionStorage.setItem("plan-panel-shown","true")},500);return()=>clearTimeout(e)}F.forEach(e=>{if(e.type===Wt.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===J.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),Y(t=>{const n=[e,...t];return console.log("New plans array:",n),n}),Q(0),console.log("Setting showSlidingPanel to true"),V(!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")}}),ee(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===Wt.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=F[F.length-1];e&&(e.type===Wt.TERMINATED?(se(!1),le("TERMINATED")):se(!!a||e.type===Wt.REQUEST_INPUT))},[F,J,Z]);const Ae=e=>{const t=e.trim();if(!t||R)return;if(pe)return void re({status:"warning",title:"Files Still Processing",description:"Please wait for all files to finish processing before sending",duration:3e3});O(!0);const r=Date.now(),a={timestamp:r,workflow_run_id:n.runId,type:Wt.QUESTION,message:t,workstream_id:"main",details:{_optimistic:!0}};console.log("[Optimistic] Adding user message:",t),E(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?.()||[];let i=t;if(s.length>0&&!/store:\S+/.test(t)){i=[t,"","Attachments:",...s.map(e=>`store:${e}`)].join("\n")}T.store.workflows.sendSignal(n.workflowId,n.runId,"UserInput",{message:i,metadata:s.length>0?{attached_docs:s}:void 0}).then(()=>{D(!1),P?.()}).catch(e=>{E(e=>e.filter(e=>e.timestamp!==r)),re({status:"error",title:"Failed to Send Message",description:e instanceof Error?e.message:"Unknown error",duration:3e3})}).finally(()=>{O(!1)})},ze=p(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:cn.UPLOADING,started_at:Date.now()};me(t=>new Map(t).set(e,a));try{await T.files.uploadArtifact(n.runId,r,t),me(t=>{const n=new Map(t),a=n.get(e);return a&&(a.status=cn.PROCESSING,a.artifact_path=r,a.reference=`artifact:${r}`),n}),await T.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){me(n=>{const r=new Map(n),a=r.get(e);return a&&(a.status=cn.ERROR,a.error=t instanceof Error?t.message:"Upload failed",a.completed_at=Date.now()),r}),re({status:"error",title:"Upload Failed",description:t instanceof Error?t.message:"Failed to upload file",duration:3e3})}}},[T,n,re]),Fe=p(e=>{e.preventDefault(),e.stopPropagation(),Pe.current++,n&&e.dataTransfer?.types?.includes("Files")&&Se(!0)},[n]),Ee=p(e=>{e.preventDefault(),e.stopPropagation()},[]),$e=p(e=>{e.preventDefault(),e.stopPropagation(),Pe.current--,0===Pe.current&&Se(!1)},[]),De=p(e=>{if(e.preventDefault(),e.stopPropagation(),Pe.current=0,Se(!1),n&&e.dataTransfer?.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);ze(t)}},[n,ze]),Re=r||n.workflowId.split(":")[2]||"Agent Conversation",[Oe,Le]=c(!1);return e(da,{children:e(Hr,{children:t("div",{className:"flex gap-2 h-full relative overflow-hidden "+(Ce?"ring-2 ring-blue-400 ring-inset":""),onDragEnter:Fe,onDragOver:Ee,onDragLeave:$e,onDrop:De,children:[Ce&&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(wt,{className:"size-6"}),"Drop files to upload"]})}),t("div",{ref:z,className:"flex flex-col h-full min-h-0 border-0 "+(M?"lg:w-2/3 flex-1":l?"flex-1 w-full":"flex-1 mx-auto "+(i?"":"max-w-4xl")),children:[xe&&e("div",{className:"absolute top-2 right-2 z-50",children:e("div",{className:"w-3 h-3 rounded-full bg-green-400 shadow-[0_0_8px_2px_rgba(74,222,128,0.8)]"})}),e("div",{className:"flex-shrink-0",children:e(za,{title:Re,isCompleted:$,onClose:s,isModal:i,run:n,viewMode:L,onViewModeChange:U,showPlanPanel:M,hasPlan:J.length>0,onTogglePlanPanel:_e,onDownload:async()=>{try{const e=await async function(e,t){return e.files.getDownloadUrl(`agents/${t}/conversation.json`).then(e=>e.url)}(T,n.runId);e&&window.open(e,"_blank")}catch(e){console.error("Failed to download conversation",e),re({status:"error",title:"Failed to download conversation",duration:3e3})}},onCopyRunId:()=>{navigator.clipboard.writeText(n.runId),re({status:"success",title:"Run ID copied",duration:2e3})},resetWorkflow:m,onExportPdf:()=>{z.current?Le(!0):re({status:"error",title:"PDF export failed",description:"No conversation content available to export",duration:3e3})}})}),0!==F.length||$?e(ja,{messages:F,bottomRef:A,viewMode:L,isCompleted:$,plan:je.plan,workstreamStatus:je.workstreamStatus,showPlanPanel:M,onTogglePlanPanel:_e,plans:J,activePlanIndex:Z,onChangePlan:Ie,taskLabels:je.plan.plan?.reduce((e,t)=>(t.id&&t.goal&&e.set(t.id.toString(),t.goal),e),new Map),streamingMessages:oe,onSendMessage:Ae,thinkingMessageIndex:te}):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[te]})]}),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:ie&&"RUNNING"!==ie?t(ce,{status:"COMPLETED"===ie?"success":"done",icon:null,className:"m-2",children:["This Workflow is ",ie]}):ae&&e(gc,{onSend:Ae,onStop:async()=>{if(!q){B(!0);try{await T.store.workflows.sendSignal(n.workflowId,n.runId,"Stop",{message:"User requested stop"}),re({status:"info",title:"Agent Interrupted",description:"Type your message to give new instructions",duration:3e3}),D(!0)}catch(e){re({status:"error",title:"Failed to Interrupt",description:e instanceof Error?e.message:"Unknown error",duration:3e3})}finally{B(!1)}}},disabled:j,isSending:R||j,isStopping:q,isStreaming:!$,isCompleted:$,activeTaskCount:(()=>{if(!F.length)return 0;const e=new Map;F.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];[Wt.COMPLETE,Wt.IDLE].includes(e.type)||t++}return t})(),placeholder:u,onFilesSelected:ze,uploadedFiles:h,onRemoveFile:f,acceptedFileTypes:y,maxFiles:x,processingFiles:ue,hasProcessingFiles:pe,renderDocumentSearch:w,selectedDocuments:N,onRemoveDocument:k,hideObjectLinking:C,className:_,inputClassName:I})})]}),M&&e("div",{className:"h-full lg:w-1/3 border-l",children:e(fc,{plan:je.plan,workstreamStatus:je.workstreamStatus,isOpen:M,onClose:Te,plans:J,activePlanIndex:Z,onChangePlan:Ie})}),t(K,{isOpen:Oe,onClose:()=>Le(!1),children:[e(W,{children:"Export conversation as PDF"}),t(H,{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(G,{align:"right",children:[e(v,{variant:"ghost",size:"sm",onClick:()=>Le(!1),children:"Cancel"}),e(v,{size:"sm",onClick:()=>{if(!z.current)return void re({status:"error",title:"PDF export failed",description:"No conversation content available to export",duration:3e3});const e=`${Re} - ${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}(z.current,e);t?(re({status:"success",title:"PDF export ready",description:"Use your browser's Print dialog to save as PDF",duration:4e3}),Le(!1)):re({status:"error",title:"PDF export failed",description:"Unable to open print preview",duration:4e3})},children:"Open print dialog"})]})]})]})})})}function Mc({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 Vc({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(Mc,{messages:o,isCompleted:!1})})})}function qc(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 Bc(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 Kc(e){return["```chart",JSON.stringify(e,null,2),"```"].join("\n")}function Wc(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 Hc(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 Gc(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 Jc(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 Yc={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"]}},Zc='\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 Qc(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 Xc(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 ed({children:t,fallback:n}){return td?e(td,{fallback:n,children:t}):e(kr,{FallbackComponent:n,children:t})}let td=null;function nd(e){td=e}function rd({children:t}){return e(ed,{fallback:ad,children:t})}function ad({error:n}){return t(ce,{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 sd({children:t}){return e(ed,{fallback:id,children:t})}function id({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 ld({children:t}){return e(ed,{fallback:od,children:t})}function od({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 cd({className:n,children:a,title:s,description:i,actions:l,breadcrumbs:o,isCompact:c=!1,useDynamicBreadcrumbs:d=!0}){const u=pn();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(Le,{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(x,{description:i,children:e(Ye,{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 dd({}){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 ud(...e){const t=Array.from(e);return t.__AnyOf__=!0,t}function md(...e){return Array.from(e)}function pd(e){return!0===e.__AnyOf__}class hd{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(pd(e))return e.some(e=>this.permissions.has(e));for(const t of e)if(!this.permissions.has(t))return!1;return!0}}const gd=u(void 0);function fd(){const e=m(gd);if(!e)throw new Error("UserPermissionContext cannot be used outside UserPermissionProvider");return e}function yd({children:t}){const n=Kt(),{data:r,error:a,isLoading:s}=O(()=>n.user?n.client.iam.roles.list():Promise.resolve(void 0),[n.user]),i=o(()=>n.authToken&&r&&!s?new hd(n,r):void 0,[n,r,s]);return a?e(L,{title:"Failed to fetch role mappings",children:a.message}):i&&e(gd.Provider,{value:i,children:t})}function bd({permission:t,isDisabled:n,title:r,children:a,...s}){return fd().hasPermission(t)||(n=!0,r="You do not have permission to perform this action"),e(v,{isDisabled:n,title:r,...s,children:a})}function vd({permission:t,...n}){return fd().hasPermission(t)?e(Sr,{...n}):null}function xd({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{Ir as ActivitiesDoc,Ar as ActivityDoc,sc as AddToCollectionAction,ac as AddToCollectionActionComponent,Ac as AgentChart,md as AllOf,Lr as AnimatedThinkingDots,ud as AnyOf,Vi as ApiKeyAvatar,Zr as AskUserWidget,so as BrowseCollectionView,Ro as ChangeTypeAction,Do as ChangeTypeActionComponent,cl as CollectionsFacetsNav,uo as CollectionsTable,Qr as ConfirmationWidget,$a as ContentDispositionButton,wo as ContentObjectTypesSearch,po as ContentObjectTypesTable,ai as ContentOverview,oo as CreateCollectionForm,co as CreateCollectionModal,vo as CreateOrUpdateTypeModal,Uo as DeleteObjectsAction,Lo as DeleteObjectsActionComponent,Mo as DeleteObjectsFromCollectionsAction,wl as DocumentGridView,wi as DocumentIcon,xi as DocumentIconSkeleton,ql as DocumentInput,Kl as DocumentPreviewPanel,Nl as DocumentSearch,Rl as DocumentSearchProvider,Ql as DocumentSearchResults,Zl as DocumentSearchResultsWithDropZone,dl as DocumentSelection,hl as DocumentSelectionProvider,El as DocumentTable,vl as DocumentTableColumn,xl as DocumentTableView,Al as DocumentUploadModal,el as DocumentsFacetsNav,Ao as EditCollectionView,Ki as EnvironmentFacet,qo as ExportPropertiesAction,Vo as ExportPropertiesComponent,no as ExportPropertiesModal,to as ExportTypes,_l as FileUploadAction,cd as GenericPageNavHeader,za as Header,rl as InteractionsFacetsNav,Or as JumpingDots,qs as MagicPdfView,ga as MessageItem,Vc as MessagesContainer,Rc as ModernAgentConversation,dd as NotFoundView,ko as ObjectSchemaEditor,ho as ObjectTypeSearch,go as ObjectTypeSearchContext,So as ObjectTypeSearchProvider,Zo as ObjectsActionContext,Xo as ObjectsActionContextProvider,rd as PanelErrorBoundary,_a as PayloadBuilder,Ta as PayloadBuilderProvider,Ia as PayloadContext,ps as PdfDocumentRenderer,ss as PdfPageRenderer,fs as PdfPageSlider,ms as PdfThumbnailList,il as PromptsFacetsNav,rs as PropertiesEditorModal,Ur as PulsatingCircle,Vr as PulsingMessageLoader,Ko as RemoveFromCollectionAction,Bo as RemoveFromCollectionActionComponent,sd as RowErrorBoundary,Gi as RunsFacetsNav,ns as SaveVersionConfirmModal,kl as SearchContext,bd as SecureButton,vd as SecureSidebarItem,Fo as SelectCollection,lo as SelectContentType,Po as SelectContentTypeModal,Ll as SelectDocument,Ml as SelectDocumentModal,oc as SelectionActions,ls as SharedPdfProvider,Eo as SharedPropsEditor,ds as SimplePdfPage,Ks as SimplePdfViewer,Ho as StartWorkflowAction,Wo as StartWorkflowComponent,fa as StreamingMessage,Ci as StringFacet,Si as StringListFacet,$o as SyncMemberHeadsToggle,_o as TableLayoutEditor,qr as ThinkingBar,Xr as ThinkingMessages,ji as TypeFacet,Mr as TypedDots,dc as UploadObjectsButton,xd as UserAvatar,Oi as UserInfo,yd as UserPermissionProvider,hd as UserPermissions,gd as UserPermissionsContext,_i as VStringFacet,Ii as VTypeFacet,Bi as VUserFacet,Sc as VegaLiteChart,ed as VertesiaErrorBoundary,Br as WavyThinking,ld as WidgetErrorBoundary,Zi as WorkflowExecutionsFacetsNav,Wc as buildCashflowComposedChart,Qc as buildChartSpec,Jc as buildNavLineChart,Hc as buildPerformanceLineChart,qc as buildScenarioComparisonBarChart,Bc as buildScenarioDeltaPercentChart,Gc as buildTvpiOverlayChart,Zc as chartSystemPromptAddition,mo as collectionIcon,Yc as createChartToolDefinition,Xc as extractChartSpecs,Xa as getWorkflowStatusColor,es as getWorkflowStatusName,pd as isAnyOf,qa as isCsv,Ba as isImage,Ka as isPdf,Ha as isPreviewableAsPdf,Ic as isRechartsSpec,_c as isVegaLiteSpec,Wa as isVideo,Qa as printElementToPdf,Za as retrieveRendition,nd as setErrorBoundaryComponent,Da as shortId,Ra as shortenString,Io as stringifyTableLayout,Kc as toChartMarkdown,ll as useCollectionsFilterGroups,ol as useCollectionsFilterHandler,Qi as useDocumentFilterGroups,Xi as useDocumentFilterHandler,Cl as useDocumentSearch,jl as useDocumentSearchCount,ml as useDocumentSelection,zl as useDocumentUploadHandler,Bl as useDownloadDocument,Fi as useFetchGroupInfo,zi as useFetchUserInfo,tl as useInteractionsFilterGroups,nl as useInteractionsFilterHandler,nc as useObjectsActionCallback,tc as useObjectsActionContext,pl as useOptionalDocumentSelection,Aa as usePayloadBuilder,al as usePromptsFilterGroups,sl as usePromptsFilterHandler,Wi as useRunsFilterGroups,Hi as useRunsFilterHandler,fo as useSearch,bo as useSearchCount,os as useSharedPdf,Tl as useSmartFileUploadProcessing,rc as useStartWorkflowCallback,fd as useUserPermissions,Sl as useWatchDocumentSearchFacets,Pl as useWatchDocumentSearchResult,yo as useWatchSearchResult,Ji as useWorkflowExecutionsFilterGroups,Yi as useWorkflowExecutionsFilterHandler};
2
+ //# sourceMappingURL=vertesia-ui-features.js.map