@vertesia/ui 0.80.0-dev-20251118 → 0.80.0

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 (311) hide show
  1. package/README.md +105 -0
  2. package/lib/esm/core/components/MenuList.js +2 -5
  3. package/lib/esm/core/components/MenuList.js.map +1 -1
  4. package/lib/esm/core/components/MessageBox.js +1 -1
  5. package/lib/esm/core/components/MessageBox.js.map +1 -1
  6. package/lib/esm/core/components/TagsInput.js +194 -0
  7. package/lib/esm/core/components/TagsInput.js.map +1 -0
  8. package/lib/esm/core/components/index.js +2 -1
  9. package/lib/esm/core/components/index.js.map +1 -1
  10. package/lib/esm/core/components/shadcn/dialog.js +16 -2
  11. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  12. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +6 -9
  13. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +1 -1
  14. package/lib/esm/core/components/shadcn/filters/filterBar.js +1 -1
  15. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  16. package/lib/esm/core/components/shadcn/popover.js +1 -1
  17. package/lib/esm/core/components/shadcn/popover.js.map +1 -1
  18. package/lib/esm/core/components/shadcn/selectBox.js +23 -5
  19. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  20. package/lib/esm/core/components/shadcn/tabs.js +3 -3
  21. package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
  22. package/lib/esm/env/index.js +4 -1
  23. package/lib/esm/env/index.js.map +1 -1
  24. package/lib/esm/features/agent/chat/AgentChart.js +184 -0
  25. package/lib/esm/features/agent/chat/AgentChart.js.map +1 -0
  26. package/lib/esm/features/agent/chat/ModernAgentConversation.js +87 -10
  27. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
  28. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +6 -2
  29. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  30. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +4 -4
  31. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  32. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +4 -1
  33. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
  34. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +12 -4
  35. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  36. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +60 -56
  37. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  38. package/lib/esm/features/agent/chat/index.js +1 -0
  39. package/lib/esm/features/agent/chat/index.js.map +1 -1
  40. package/lib/esm/features/agent/createChartTool.js +354 -0
  41. package/lib/esm/features/agent/createChartTool.js.map +1 -0
  42. package/lib/esm/features/agent/examples.js +295 -0
  43. package/lib/esm/features/agent/examples.js.map +1 -0
  44. package/lib/esm/features/agent/index.js +2 -0
  45. package/lib/esm/features/agent/index.js.map +1 -1
  46. package/lib/esm/features/agent/visualization.js +165 -0
  47. package/lib/esm/features/agent/visualization.js.map +1 -0
  48. package/lib/esm/features/facets/CollectionsFacetsNav.js +5 -1
  49. package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -1
  50. package/lib/esm/features/index.js +1 -0
  51. package/lib/esm/features/index.js.map +1 -1
  52. package/lib/esm/features/layout/GenericPageNavHeader.js +14 -4
  53. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
  54. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js +268 -0
  55. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js.map +1 -0
  56. package/lib/esm/features/magic-pdf/DownloadPopover.js +11 -11
  57. package/lib/esm/features/magic-pdf/DownloadPopover.js.map +1 -1
  58. package/lib/esm/features/magic-pdf/ExtractedContentView.js +77 -0
  59. package/lib/esm/features/magic-pdf/ExtractedContentView.js.map +1 -0
  60. package/lib/esm/features/magic-pdf/MagicPdfProvider.js +242 -0
  61. package/lib/esm/features/magic-pdf/MagicPdfProvider.js.map +1 -0
  62. package/lib/esm/features/magic-pdf/MagicPdfView.js +41 -47
  63. package/lib/esm/features/magic-pdf/MagicPdfView.js.map +1 -1
  64. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js +261 -0
  65. package/lib/esm/features/pdf-viewer/PdfPageRenderer.js.map +1 -0
  66. package/lib/esm/features/pdf-viewer/PdfPageSlider.js +276 -0
  67. package/lib/esm/features/pdf-viewer/PdfPageSlider.js.map +1 -0
  68. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js +71 -0
  69. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js.map +1 -0
  70. package/lib/esm/features/pdf-viewer/index.js +4 -0
  71. package/lib/esm/features/pdf-viewer/index.js.map +1 -0
  72. package/lib/esm/features/store/collections/EditCollectionView.js +19 -10
  73. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  74. package/lib/esm/features/store/collections/SelectCollection.js +104 -39
  75. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
  76. package/lib/esm/features/store/collections/SharedPropsEditor.js +39 -0
  77. package/lib/esm/features/store/collections/SharedPropsEditor.js.map +1 -0
  78. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js +35 -0
  79. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js.map +1 -0
  80. package/lib/esm/features/store/collections/index.js +2 -0
  81. package/lib/esm/features/store/collections/index.js.map +1 -1
  82. package/lib/esm/features/store/objects/DocumentSearchResults.js +0 -7
  83. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  84. package/lib/esm/features/store/objects/components/ContentOverview.js +273 -83
  85. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  86. package/lib/esm/features/store/objects/components/useContentPanelHooks.js +153 -0
  87. package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +1 -0
  88. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +3 -3
  89. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
  90. package/lib/esm/features/store/objects/layout/renderers.js +13 -0
  91. package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
  92. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +10 -9
  93. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
  94. package/lib/esm/features/utils/index.js +2 -0
  95. package/lib/esm/features/utils/index.js.map +1 -1
  96. package/lib/esm/features/utils/mimeType.js +8 -0
  97. package/lib/esm/features/utils/mimeType.js.map +1 -1
  98. package/lib/esm/features/utils/print.js +181 -0
  99. package/lib/esm/features/utils/print.js.map +1 -0
  100. package/lib/esm/features/utils/workflowStatus.js +43 -0
  101. package/lib/esm/features/utils/workflowStatus.js.map +1 -0
  102. package/lib/esm/router/HistoryNavigator.js +22 -2
  103. package/lib/esm/router/HistoryNavigator.js.map +1 -1
  104. package/lib/esm/session/UserSessionProvider.js +2 -2
  105. package/lib/esm/session/UserSessionProvider.js.map +1 -1
  106. package/lib/esm/shell/apps/AppProjectSelector.js +2 -2
  107. package/lib/esm/shell/apps/AppProjectSelector.js.map +1 -1
  108. package/lib/esm/shell/login/UserInfo.js +2 -1
  109. package/lib/esm/shell/login/UserInfo.js.map +1 -1
  110. package/lib/esm/shell/login/UserSessionMenu.js +7 -1
  111. package/lib/esm/shell/login/UserSessionMenu.js.map +1 -1
  112. package/lib/esm/widgets/form/Form.js +6 -2
  113. package/lib/esm/widgets/form/Form.js.map +1 -1
  114. package/lib/esm/widgets/markdown/MarkdownRenderer.js +226 -4
  115. package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -1
  116. package/lib/esm/widgets/schema-editor/ManagedSchema.js +0 -3
  117. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -1
  118. package/lib/esm/widgets/schema-editor/json-schema4-utils.js +1 -1
  119. package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -1
  120. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +18 -9
  121. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +1 -1
  122. package/lib/esm/widgets/xml-viewer/constants/index.js +10 -0
  123. package/lib/esm/widgets/xml-viewer/constants/index.js.map +1 -1
  124. package/lib/tsconfig.tsbuildinfo +1 -1
  125. package/lib/types/core/components/MessageBox.d.ts.map +1 -1
  126. package/lib/types/core/components/TagsInput.d.ts +16 -0
  127. package/lib/types/core/components/TagsInput.d.ts.map +1 -0
  128. package/lib/types/core/components/index.d.ts +2 -1
  129. package/lib/types/core/components/index.d.ts.map +1 -1
  130. package/lib/types/core/components/shadcn/dialog.d.ts +2 -1
  131. package/lib/types/core/components/shadcn/dialog.d.ts.map +1 -1
  132. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
  133. package/lib/types/core/components/shadcn/popover.d.ts +7 -0
  134. package/lib/types/core/components/shadcn/popover.d.ts.map +1 -1
  135. package/lib/types/core/components/shadcn/selectBox.d.ts +5 -1
  136. package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
  137. package/lib/types/core/components/shadcn/tabs.d.ts +3 -1
  138. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
  139. package/lib/types/env/index.d.ts +2 -0
  140. package/lib/types/env/index.d.ts.map +1 -1
  141. package/lib/types/features/agent/chat/AgentChart.d.ts +48 -0
  142. package/lib/types/features/agent/chat/AgentChart.d.ts.map +1 -0
  143. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  144. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -2
  145. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  146. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +2 -1
  147. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  148. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +4 -2
  149. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
  150. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +2 -4
  151. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
  152. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  153. package/lib/types/features/agent/chat/index.d.ts +1 -0
  154. package/lib/types/features/agent/chat/index.d.ts.map +1 -1
  155. package/lib/types/features/agent/createChartTool.d.ts +178 -0
  156. package/lib/types/features/agent/createChartTool.d.ts.map +1 -0
  157. package/lib/types/features/agent/examples.d.ts +59 -0
  158. package/lib/types/features/agent/examples.d.ts.map +1 -0
  159. package/lib/types/features/agent/index.d.ts +2 -0
  160. package/lib/types/features/agent/index.d.ts.map +1 -1
  161. package/lib/types/features/agent/visualization.d.ts +95 -0
  162. package/lib/types/features/agent/visualization.d.ts.map +1 -0
  163. package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
  164. package/lib/types/features/index.d.ts +1 -0
  165. package/lib/types/features/index.d.ts.map +1 -1
  166. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  167. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts +13 -0
  168. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts.map +1 -0
  169. package/lib/types/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
  170. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts +8 -0
  171. package/lib/types/features/magic-pdf/ExtractedContentView.d.ts.map +1 -0
  172. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts +58 -0
  173. package/lib/types/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -0
  174. package/lib/types/features/magic-pdf/MagicPdfView.d.ts +1 -1
  175. package/lib/types/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
  176. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts +83 -0
  177. package/lib/types/features/pdf-viewer/PdfPageRenderer.d.ts.map +1 -0
  178. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts +29 -0
  179. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts.map +1 -0
  180. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts +19 -0
  181. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -0
  182. package/lib/types/features/pdf-viewer/index.d.ts +4 -0
  183. package/lib/types/features/pdf-viewer/index.d.ts.map +1 -0
  184. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
  185. package/lib/types/features/store/collections/SelectCollection.d.ts +2 -1
  186. package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
  187. package/lib/types/features/store/collections/SharedPropsEditor.d.ts +7 -0
  188. package/lib/types/features/store/collections/SharedPropsEditor.d.ts.map +1 -0
  189. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts +7 -0
  190. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts.map +1 -0
  191. package/lib/types/features/store/collections/index.d.ts +2 -0
  192. package/lib/types/features/store/collections/index.d.ts.map +1 -1
  193. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  194. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  195. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts +30 -0
  196. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -0
  197. package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
  198. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
  199. package/lib/types/features/utils/index.d.ts +2 -0
  200. package/lib/types/features/utils/index.d.ts.map +1 -1
  201. package/lib/types/features/utils/mimeType.d.ts +1 -0
  202. package/lib/types/features/utils/mimeType.d.ts.map +1 -1
  203. package/lib/types/features/utils/print.d.ts +10 -0
  204. package/lib/types/features/utils/print.d.ts.map +1 -0
  205. package/lib/types/features/utils/workflowStatus.d.ts +10 -0
  206. package/lib/types/features/utils/workflowStatus.d.ts.map +1 -0
  207. package/lib/types/router/HistoryNavigator.d.ts +3 -0
  208. package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
  209. package/lib/types/shell/login/UserInfo.d.ts.map +1 -1
  210. package/lib/types/shell/login/UserSessionMenu.d.ts.map +1 -1
  211. package/lib/types/widgets/form/Form.d.ts.map +1 -1
  212. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts +5 -1
  213. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
  214. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
  215. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts.map +1 -1
  216. package/lib/types/widgets/xml-viewer/constants/index.d.ts +10 -0
  217. package/lib/types/widgets/xml-viewer/constants/index.d.ts.map +1 -1
  218. package/lib/vertesia-ui-core.js +1 -1
  219. package/lib/vertesia-ui-core.js.map +1 -1
  220. package/lib/vertesia-ui-env.js +1 -1
  221. package/lib/vertesia-ui-env.js.map +1 -1
  222. package/lib/vertesia-ui-features.js +1 -1
  223. package/lib/vertesia-ui-features.js.map +1 -1
  224. package/lib/vertesia-ui-layout.js +1 -1
  225. package/lib/vertesia-ui-layout.js.map +1 -1
  226. package/lib/vertesia-ui-router.js +1 -1
  227. package/lib/vertesia-ui-router.js.map +1 -1
  228. package/lib/vertesia-ui-session.js +1 -1
  229. package/lib/vertesia-ui-session.js.map +1 -1
  230. package/lib/vertesia-ui-shell.js +1 -1
  231. package/lib/vertesia-ui-shell.js.map +1 -1
  232. package/lib/vertesia-ui-widgets.js +1 -1
  233. package/lib/vertesia-ui-widgets.js.map +1 -1
  234. package/package.json +173 -170
  235. package/src/core/components/MenuList.tsx +3 -6
  236. package/src/core/components/MessageBox.tsx +7 -2
  237. package/src/core/components/SelectBox.tsx +1 -1
  238. package/src/core/components/shadcn/dialog.tsx +19 -1
  239. package/src/core/components/shadcn/filters/filter/SelectFilter.tsx +31 -31
  240. package/src/core/components/shadcn/filters/filterBar.tsx +1 -0
  241. package/src/core/components/shadcn/selectBox.tsx +32 -6
  242. package/src/core/components/shadcn/tabs.tsx +3 -2
  243. package/src/env/index.ts +6 -1
  244. package/src/features/agent/CHART_INSTRUCTIONS.md +228 -0
  245. package/src/features/agent/chat/AgentChart.tsx +601 -0
  246. package/src/features/agent/chat/ModernAgentConversation.tsx +123 -11
  247. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +8 -2
  248. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +12 -2
  249. package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +6 -1
  250. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +15 -10
  251. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +122 -87
  252. package/src/features/agent/chat/index.ts +1 -0
  253. package/src/features/agent/createChartTool.ts +364 -0
  254. package/src/features/agent/examples.ts +321 -0
  255. package/src/features/agent/index.ts +2 -0
  256. package/src/features/agent/visualization.ts +227 -0
  257. package/src/features/facets/CollectionsFacetsNav.tsx +5 -1
  258. package/src/features/index.ts +1 -0
  259. package/src/features/layout/GenericPageNavHeader.tsx +15 -4
  260. package/src/features/magic-pdf/AnnotatedImageSlider.tsx +482 -0
  261. package/src/features/magic-pdf/DownloadPopover.tsx +45 -40
  262. package/src/features/magic-pdf/ExtractedContentView.tsx +132 -0
  263. package/src/features/magic-pdf/MagicPdfProvider.tsx +297 -0
  264. package/src/features/magic-pdf/MagicPdfView.tsx +184 -91
  265. package/src/features/pdf-viewer/PdfPageRenderer.tsx +612 -0
  266. package/src/features/pdf-viewer/PdfPageSlider.tsx +473 -0
  267. package/src/features/pdf-viewer/SimplePdfViewer.tsx +142 -0
  268. package/src/features/pdf-viewer/index.ts +3 -0
  269. package/src/features/store/collections/EditCollectionView.tsx +3 -5
  270. package/src/features/store/collections/SharedPropsEditor.tsx +1 -2
  271. package/src/features/store/objects/DocumentSearchResults.tsx +0 -7
  272. package/src/features/store/objects/components/ContentOverview.tsx +677 -210
  273. package/src/features/store/objects/components/useContentPanelHooks.ts +169 -0
  274. package/src/features/store/objects/layout/DocumentTableColumn.tsx +3 -3
  275. package/src/features/store/objects/layout/knowledge.md +1 -0
  276. package/src/features/store/objects/layout/renderers.tsx +25 -0
  277. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +1 -3
  278. package/src/features/utils/index.ts +3 -1
  279. package/src/features/utils/mimeType.ts +10 -1
  280. package/src/features/utils/print.ts +189 -0
  281. package/src/features/utils/workflowStatus.ts +44 -0
  282. package/src/router/HistoryNavigator.ts +30 -2
  283. package/src/session/UserSessionProvider.tsx +2 -2
  284. package/src/shell/login/UserInfo.tsx +2 -0
  285. package/src/shell/login/UserSessionMenu.tsx +12 -1
  286. package/src/widgets/form/Form.tsx +8 -3
  287. package/src/widgets/markdown/MarkdownRenderer.tsx +350 -6
  288. package/src/widgets/schema-editor/ManagedSchema.ts +0 -3
  289. package/src/widgets/schema-editor/json-schema4-utils.ts +1 -1
  290. package/src/widgets/xml-viewer/components/XMLViewer.tsx +22 -10
  291. package/src/widgets/xml-viewer/constants/index.ts +11 -0
  292. package/lib/esm/features/magic-pdf/PageSlider.js +0 -70
  293. package/lib/esm/features/magic-pdf/PageSlider.js.map +0 -1
  294. package/lib/esm/features/magic-pdf/PdfPageProvider.js +0 -188
  295. package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +0 -1
  296. package/lib/esm/features/magic-pdf/TextPageView.js +0 -62
  297. package/lib/esm/features/magic-pdf/TextPageView.js.map +0 -1
  298. package/lib/esm/features/magic-pdf/useResizeOnDrag.js +0 -34
  299. package/lib/esm/features/magic-pdf/useResizeOnDrag.js.map +0 -1
  300. package/lib/types/features/magic-pdf/PageSlider.d.ts +0 -9
  301. package/lib/types/features/magic-pdf/PageSlider.d.ts.map +0 -1
  302. package/lib/types/features/magic-pdf/PdfPageProvider.d.ts +0 -39
  303. package/lib/types/features/magic-pdf/PdfPageProvider.d.ts.map +0 -1
  304. package/lib/types/features/magic-pdf/TextPageView.d.ts +0 -8
  305. package/lib/types/features/magic-pdf/TextPageView.d.ts.map +0 -1
  306. package/lib/types/features/magic-pdf/useResizeOnDrag.d.ts +0 -9
  307. package/lib/types/features/magic-pdf/useResizeOnDrag.d.ts.map +0 -1
  308. package/src/features/magic-pdf/PageSlider.tsx +0 -142
  309. package/src/features/magic-pdf/PdfPageProvider.tsx +0 -310
  310. package/src/features/magic-pdf/TextPageView.tsx +0 -91
  311. package/src/features/magic-pdf/useResizeOnDrag.ts +0 -42
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import s,{useRef as i,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,Children as h,isValidElement as u}from"react";import{EditorView as p}from"@codemirror/view";import{useSafeLayoutEffect as m,Styles as f,FormItem as g,Button as y,DotBadge as v,Table as b,VTooltip as x,VSelectBox as w,VModal as N,VModalTitle as k,ModalBody as C,ModalFooter as j,useFlag as S,useClickOutside as O,useToast as A}from"@vertesia/ui/core";import{Text as P,EditorState as $}from"@codemirror/state";import{Plus as T,Trash2 as E,Info as I,AlignLeft as q,SquarePen as M,ChevronDown as L,ChevronRight as D,UploadIcon as z,CheckCircleIcon as F,AlertCircleIcon as R,XCircleIcon as _}from"lucide-react";import V from"clsx";import U from"ajv";import{ObjectWalker as K}from"@vertesia/json";import B from"react-markdown";import W from"remark-gfm";import{visit as H,SKIP as G}from"unist-util-visit";import{offset as X,shift as Z,flip as Y}from"@floating-ui/dom";import{useFloating as J,autoUpdate as Q,useDismiss as ee,useClick as te,useHover as re,useInteractions as ne,useTransitionStyles as se,FloatingPortal as ie,FloatingFocusManager as ae,safePolygon as oe}from"@floating-ui/react";import{isNil as le,omit as ce,isEqual as de}from"lodash-es";import{XMLParser as he,XMLValidator as ue}from"fast-xml-parser";let pe=null;class me{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const fe=[p.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),p.lineWrapping];function ge({onChange:t,value:r,className:s,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=i(null),u=i(void 0);a((()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}}),[t,d]);const f=o((()=>e("div",{ref:h,className:s})),[s]);return m((()=>{if(h.current){let t=[...fe,(e=e=>{u.current?.(e)},p.updateListener.of((t=>{t.docChanged&&e(t)})))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?P.of(e.split("\n")):e;return pe?pe.doc.toString()!==r.toString()&&(pe=$.create({doc:r,extensions:t})):pe=$.create({doc:r,extensions:t}),pe})(r,t),s=new p({state:n,parent:h.current}),i=new me(s);return l&&(l.current=i),()=>{s.destroy(),l&&(l.current=void 0)}}var e}),[f,c]),f}const ye=l(void 0),ve=ye.Provider;function be(){const e=c(ye);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}class xe{object;components;disabled;constructor(e,t={},r=!1){this.object=e,this.components=t,this.disabled=r}}const we=l(void 0);function Ne(){const e=c(we);if(!e)throw new Error("useForm must be used within a Form element");return e}const ke=we.Provider,Ce=s.forwardRef((({object:t,type:r="text",onChange:n,...s},i)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);s.className?s.className=V(f.INPUT,s.className):s.className=f.INPUT;const h=e=>{s.disabled||(o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e))};return"textarea"===r?e("textarea",{ref:i,...s,value:a,onChange:h}):e("input","checkbox"===r?{ref:i,...s,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:i,...s,type:r,value:a,onChange:h})}));function je({object:t,components:r,onSubmit:n,children:s,onChange:i,disabled:a}){return t.observer=i,e(ke,{value:new xe(t,r||{},a??!1),children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:s})})}function Se(){const t=Ne();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(Ae)})}function Oe({children:r,...n}){return t(je,{...n,children:[e(Se,{}),r]})}function Ae(t){return t.isList?e(Te,{object:t},t.name):t.isObject?e($e,{object:t},t.name):e(Pe,{object:t},t.name)}function Pe({object:t,editor:r,inline:n=!1}){r||(r=t.schema.editor);const{components:s,disabled:i}=Ne(),a=r&&s[r]||Ce,o=t.getInputType();"checkbox"===o&&(n=!0);return e(g,{label:t.title,required:t.schema.isRequired,description:t.schema.description,className:V("flex",n?"flex-row items-center":"flex-col"),children:!t.isListItem&&e(a,{object:t,type:o,onChange:e=>{if(i)return;const{value:r}=e.target;t.value=t.schema.isNumber?parseFloat(r):r},disabled:i})})}function $e({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(Ae)]})}function Te({object:r}){const[n,s]=d(r.value||[]),{disabled:i}=Ne();return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map(((t,a)=>e(Ee,{object:t,list:r,onDelete:()=>(e=>{i||(r.remove(e),s([...r.value]))})(a),disabled:i},`${a}-${n[a]??""}`))),e("div",{children:t(y,{variant:"secondary",onClick:()=>{i||(r.add(),s([...r.value]))},disabled:i,children:[e(T,{className:"size-6"})," Add"]})})]})}function Ee({list:r,object:n,onDelete:s,disabled:i}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(a=n,o=r.schema.arraySchema.editor,a.isList?e(Te,{object:a}):a.isObject?e($e,{object:a}):e(Pe,{object:a,editor:o}))}),e(y,{variant:"secondary",onClick:s,disabled:i,children:e(E,{className:"size-4"})})]});var a,o}class Ie{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new U({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach((t=>{this.loadProperty(t,e[t])}))}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new Me(this,e,t):new qe(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(s=t)?{type:"object",properties:{}}:"array"===s?{type:"array",items:{}}:{type:s}:t;var s;const i=this.loadProperty(e,n);return this.schema.properties[i.name]=i.schema,r&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter((t=>t!==e)))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class qe extends Ie{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter((e=>e!==this.name)),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class Me extends qe{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function Le(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function De(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class ze{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||Le(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Fe extends ze{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new Ue(this,t,this.getOrInitArrayProperty(e)):t.isObject?new _e(this,t,t.name,this.getOrInitObjectProperty(e)):new Ve(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new Ue(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new _e(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new Ve(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class Re extends Fe{value;constructor(e,t={}){super(null,e instanceof Ie?e:new Ie(e),"#root"),this.value=t}}class _e extends Fe{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class Ve extends ze{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return De(this.name,this.schema)}}class Ue extends ze{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Ke(this,e):new Be(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new _e(this,this.schema,String(e),t):new Be(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Ke extends Fe{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class Be extends ze{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return De(this.name,this.schema)}}function We({label:t,required:r,children:n}){return e(g,{label:t,required:r,children:n})}function He({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function Ge({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const Xe="text-pink-500 dark:text-pink-400",Ze="text-purple-500 dark:text-purple-400",Ye="text-blue-500 dark:text-blue-400",Je={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:Xe,assign:Xe,startObject:Xe,endObject:Xe,startArray:Xe,endArray:Xe,boolean:Ze,null:Ze,key:Ye,index:Ye,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class Qe{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof Qe)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class et extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class tt extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class rt{classMap;tab;stack=[];block=new et(this,void 0,"","");constructor(e=Je,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new et(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new tt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function nt({data:t,className:r,classMap:n}){const[s,i]=d();return a((()=>{i(function(t,r,n){const s=new rt(r);(new K).walk(t,s);const i=s.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${s.classMap.code}' style='overflow-x: scroll'>${i}</div>`}})}(t,n,r))}),[t]),s}function st({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map((([t,r])=>e(ot,{name:t,value:r},t)))})}function it({name:t}){return e("div",{className:"text-md font-semibold",children:Le(t)})}function at({children:t,className:r}){return e("div",{className:V("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function ot({name:r,value:n}){const s=ht(n);switch(s.type){case dt.Inline:return t("div",{className:"w-full flex gap-2",children:[e(it,{name:r+":"}),e("p",{children:s.value})]});case dt.Paragraph:return t("div",{children:[e(it,{name:r}),e("p",{children:s.value})]});case dt.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(it,{name:r}),e("div",{className:"vprose dark:prose-invert",children:s.value})]});case dt.Array:return e(lt,{name:r,value:n});case dt.Object:return t("div",{children:[e(it,{name:r}),e(at,{className:"mt-2",children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))})]})}}function lt({name:r,value:n}){const s=n.join(" ").length,i=s/n.length,a="string"==typeof n[0]&&(s<80||s<400&&i<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(it,{name:r+":"}),n.map(((t,r)=>e(v,{children:String(t)},r)))]}:{children:[r&&e(it,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map(((t,r)=>e(ct,{index:r,value:t,useBullet:o},r)))})]})}function ct({index:r,value:n,useBullet:s}){const i=s?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=ht(n);let o;switch(a.type){case dt.Object:o=e(at,{children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))});break;case dt.Array:o=e(lt,{value:n});break;case dt.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:i}),e("div",{children:o})]})}var dt;function ht(e){if(null==e)return{value:"-",type:dt.Inline};if(Array.isArray(e))return{value:e,type:dt.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=dt.Inline:t>400?r=dt.Prose:(r=dt.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:dt.Inline}:{value:e,type:dt.Object}}function ut({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(nt,{data:t}):e(st,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}function pt(){return e=>{H(e,"html",((e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[G,t]}))}}function mt({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0}){const i=[W,...n];return s&&i.push(pt),e(B,{remarkPlugins:i,components:r,children:t})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(dt||(dt={}));const ft=l(void 0);function gt(){return c(ft)}const yt=Symbol("__SLOT_NAME");function vt(e,t){const r=[];return h.forEach(e,(e=>{!function(e,t,r){let n;u(e)&&(n=e.type[yt])?r[n]=e:t.push(e)}(e,r,t)})),r.length>1?r:r[0]}function bt(e,t){t[yt]=e}function xt(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function wt(t){const r={};if(vt(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,s=r.content.props;return e(Nt,{...t,trigger:n,content:s})}function Nt({middleware:r,offset:n,trigger:s,dismiss:i=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=J({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[X(n||4),Z(),Y()],whileElementsMounted:Q}),{floatingStyles:m,refs:{setReference:f,setFloating:g},context:y}=p,v=ee(y,xt(i)),b=te(y,xt(!(x=s)||x.hover||x.click?x?.click:{enabled:!0}));var x;const w=re(y,xt(function(e){return!0===e?.hover?{enabled:!0,handleClose:oe({blockPointerEvents:!0}),restMs:0}:e?.hover}(s))),{getReferenceProps:N,getFloatingProps:k}=ne([v,b,w]),{isMounted:C,styles:j}=se(y,a.transition);return t(ft.Provider,{value:{...p,close:()=>u(!1)},children:[s&&e("div",{className:V(s.className,"inline-block"),ref:f,...N(),children:s.children}),e(ie,{children:C&&e("div",{ref:g,style:{...m,zIndex:c},...k(),children:e(ae,{context:y,children:e("div",{className:V(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:j,children:a.children})})})})]})}function kt(e){return null}function Ct(e){return null}function jt({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function St({className:r,properties:n}){return e(b,{className:r,children:e("tbody",{children:n.map((r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(x,{description:r.description,placement:"top",children:e(I,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name)))})})}var Ot;function At(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function Pt(e){let t,r=!1,n=!1;const s=e.type;if(Array.isArray(s))for(const e of s)"null"===e?r=!0:t||(t=e);else t=s;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?$t(e[0].type):$t(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let i=t;switch(e.editor||e.format){case"textarea":i="text";break;case"media":i="media";break;case"document":i="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:i}}function $t(e){return e?Array.isArray(e)?e.find((e=>"null"!==e))||"any":e:"any"}bt("trigger",kt),bt("content",Ct),wt.Trigger=kt,wt.Content=Ct,function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(Ot||(Ot={}));let Tt=0;class Et{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new It("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new It("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new Et(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class It{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=Pt(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new It(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++Tt}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const s={};return At(s,r),e.properties[t]=s,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),s}(this._getPropertiesSchema(),e,t,r),s=new It(e,n,this.loader,this);return this.children.push(s),s}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter((e=>e!==t))))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter((e=>e.name!==this.name))),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,s={};for(const e of Object.keys(n)){const i=n[e];e===t?s[r]=i:s[e]=i}e.properties=s}e.required&&(e.required=e.required.map((e=>e===t?r:e)))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(At(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,this.schema.format=void 0,t=!0):e.editor?(this.schema.editor=e.editor,this.schema.format=e.editor,t=!0):n&&(this.schema.editor=void 0,this.schema.format=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const s=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=Ot[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===Ot.object}}(t);let i;return"text"===s.name?(s.name=Ot.string,i="textarea"):"media"===s.name?(s.name=Ot.any,i="media"):"document"===s.name?(s.name=Ot.any,i="document"):i=null,{name:r,type:s,isRequired:n,editor:i}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function qt(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const Mt=function(){const e=Object.values(Ot),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function Lt({value:r,onChange:n,onCancel:s,onSave:i}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(Dt,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:s,onSave:i})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(zt,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:s,onSave:i})}),t("div",{children:[e(y,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(q,{className:"size-4"})}),e(Ft,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function Dt({value:t,onChange:r,onCancel:n,onSave:s}){const o=i(null);a((()=>{o.current?.focus()}),[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":s?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:f.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function zt({value:t,onChange:r,onCancel:n,onSave:s}){return e(w,{className:f.INPUT_UNSTYLED,options:Mt,value:t||"",onBlur:()=>{s?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?s?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Ft({value:r,isOpen:n,onClose:s}){return t(N,{isOpen:n,onClose:s,children:[e(k,{children:"Edit description"}),e(Rt,{value:r,onSave:s})]})}function Rt({value:n,onSave:s}){const o=i(null),[l,c]=d(n||"");return a((()=>{o.current&&o.current.focus()}),[o.current]),t(r,{children:[e(C,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(j,{children:e(y,{onClick:()=>s(l),children:"Save Changes"})})]})}function _t({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Vt(e){const[t,r]=d(new Et(e||{type:"object",properties:{}}).withChangeListener((e=>{r(e.clone())})));return t}const Ut="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Kt=`${Ut} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Bt=`${Ut} shadow-xs ring-1 ring-inset ring-ring`;function Wt({value:r,onChange:n,onDelete:s,outlineOnHover:i=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:g,isOn:y}=S(u),[v,b]=d();return t("div",{className:"",children:[y&&!p?e(Gt,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void b(t);b(void 0)}n(e)&&g()},onCancel:g,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Ht,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:i,editOnClick:a,onDelete:s,readonly:p}),v&&e("div",{className:"text-red-500 text-sm",children:v})]})}function Ht({viewer:r,value:n,onEdit:s,editOnClick:i,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&s()},onClick:()=>{i&&s()},className:V("flex justify-start items-center group",a?Kt:Ut,{"cursor-pointer":i}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(y,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(E,{className:"size-4"})}),c?null:e(y,{variant:"ghost",size:"sm",className:d,onClick:s,children:e(M,{className:"size-4"})})]})]})}function Gt({editor:t,value:r,onSave:n,onCancel:s,skipClickOutside:a}){const[o,l]=d(r),c=i(r),[h,u]=d(null),p=()=>{n(c.current)},m=O(p,a);return e("div",{ref:m,children:e("div",{className:Bt,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout((()=>{n(e)}),500)))},onSave:p,onCancel:s})})})})}function Xt(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function Zt({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map((e=>Yt(e,n))),n?null:e(rr,{parent:r.root})]})}function Yt(t,r){return t.isParent?e(Qt,{property:t,readonly:r},t.name):e(Jt,{node:t,readonly:r},t.name)}function Jt({node:t,readonly:r}){return e("li",{children:e(tr,{property:t,readonly:r})})}function Qt({property:r,readonly:n}){const[s,i]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>i(!s),children:e(s?L:D,{className:"size-4"})}),e("div",{className:"flex-1",children:e(tr,{property:r,readonly:n})})]}),s&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map((e=>Yt(e,n))),n?null:e(rr,{parent:r})]})]})}function er(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function tr({property:t,readonly:r}){const n=A(),s=t.resetIsNew(),i=qt(t);return e(Wt,{value:i,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:Lt,viewer:_t,outlineOnHover:!0,isEditing:s,skipClickOutside:Xt,readonly:r,onValidate:e=>er(e.name)})}function rr({parent:r}){return t(y,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:Ot.string},!0).isNew=!0,r.reloadTree()},children:[e(T,{className:"size-4"}),"Add property"]})}function nr({content:t,...r}){const n=i(null);return a((()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach((([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))})),n.current.innerHTML="",n.current.appendChild(e)}),[t,r]),e("span",{ref:n})}function sr(t){return r=>e(nr,{content:t,...r})}function ir({onDrop:r,message:n,buttonLabel:s="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=i(null),u=i(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],s=new Set,i=async e=>{if(e.isFile){const t=await new Promise((t=>{e.file((r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)}))}));!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&s.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise((e=>{t.readEntries((t=>{e(t)}))}));await Promise.all(r.map(i));const n=e.fullPath.substring(1);n&&s.add(n)}};try{if(await Promise.all(t.map((e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?i(t):Promise.resolve()}))),n.length>0){const e=new Set(Array.from(s).map((e=>e.split("/")[0])).filter(Boolean)).size,t=n.length;let i="";i=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:i})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(z,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(y,{onClick:()=>{h.current&&h.current.click()},children:[e(z,{className:"h-4 w-4 mr-2"}),s]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some((e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/")))){const e=new Set(t.map((e=>e.webkitRelativePath?.split("/")[0])).filter(Boolean)).size,n=t.length,s=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,i={count:t.length,message:s};r(t,i)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function ar({title:r,count:n,icon:s=e(F,{className:"h-4 w-4 text-green-500"}),items:i}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:s}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform 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"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:i.length>0?e("ul",{className:"space-y-1",children:i.map(((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r)))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function or({files:r,className:n="",location:s,collection:i}){const a=r.filter((e=>"success"===e.status)),o=r.filter((e=>"updated"===e.status)),l=r.filter((e=>"skipped"===e.status)),c=r.filter((e=>"failed"===e.status)),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(F,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",i?` in collection '${i}'`:"",s?` in folder '${s}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(ar,{title:"Successfully Uploaded",count:d,icon:e(F,{className:"h-4 w-4 text-green-500"}),items:a.map((e=>e.name))}),h>0&&e(ar,{title:"Successfully Updated",count:h,icon:e(F,{className:"h-4 w-4 text-blue-500"}),items:o.map((e=>e.name))}),u>0&&e(ar,{title:"Skipped (Already Existed)",count:u,icon:e(R,{className:"h-4 w-4 text-amber-500"}),items:l.map((e=>e.name))}),p>0&&e(ar,{title:"Failed to Upload",count:p,icon:e(_,{className:"h-4 w-4 text-red-500"}),items:c.map((e=>e.name))})]})]})}const lr="#text",cr="#comment",dr="#cdata",hr="DECLARATION_TAG",ur={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},pr=l({theme:ur,collapsible:!1,indentSize:2}),mr=()=>c(pr),fr=new he({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:cr,cdataPropName:dr,parseTagValue:!1});function gr(r){const{indentation:n,children:s,isInline:i}=r,{theme:a}=mr();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),s,e("span",{children:`${i?"":n}]]>`})]})}function yr(t){const{collapsible:r,theme:n}=mr(),{collapsed:s}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(vr,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function vr({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function br(e){const{collapsible:t,initialCollapsedDepth:r}=mr(),[n,s]=d((()=>!(le(r)||!t)&&e>=r));return a((()=>{s(!(le(r)||!t)&&e>=r)}),[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>s((e=>!e)),role:"button",style:{cursor:"pointer"}}:{}}}function xr(r){const{indentation:n,children:s,isInline:i,level:a}=r,{theme:o}=mr(),{collapsed:l,buttonProps:c}=br(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(yr,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&s,l&&"...",e("span",{children:`${i||l?" ":n}--\x3e`})]})}function wr(r){const{attributes:n}=r,{theme:s}=mr();return n?e("span",{children:Object.entries(n).map((([r,n])=>t("span",{children:[e("span",{style:{color:s.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:s.separatorColor},children:"="}),e("span",{style:{color:s.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`)))}):null}function Nr(r){const{indentation:n,tagKey:s,attributes:i}=r,{theme:a}=mr();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${s.slice(1)}`}),e(wr,{attributes:i}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function kr(e){return"string"==typeof e&&e.includes("\n")}function Cr(e){const t=e[":@"],r=ce(e,":@"),[[n,s]]=Object.entries(r),i=function(e){switch(e){case lr:case dr:case cr:return e;default:return e.startsWith("?")?hr:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:s,type:i}}function jr(e){return!!e&&Object.keys(e).length>0}function Sr(n){const{indentation:s,tagKey:i,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=br(d),{theme:p}=mr();return t("div",{children:[t("span",{...u,children:[e("span",{children:s}),e(yr,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${i}`}),!h&&e(wr,{attributes:a}),h&&jr(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":s}</`}),e("span",{style:{color:p.tagColor},children:`${i}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function Or(t){const{hasSiblings:r,text:n,indentation:s,isText:i}=t,{theme:a}=mr(),o=i?{color:a.textColor}:void 0;return kr(n)||r?e("div",{style:o,children:n.split("\n").filter((e=>!!e.trim())).map(((t,r)=>e("div",{children:`${s}${t.trim()}`},`${r}`)))}):e("span",{style:o,children:n})}function Ar(t){const{elements:n,level:s=0,isText:i=!0}=t,{indentSize:a}=mr();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map(((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=Cr(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,s),p=`${s}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&lr in e[0]&&!kr(e[0][lr])}(c);switch(d){case lr:return e(Or,{text:c,indentation:u,hasSiblings:h,isText:i},p);case cr:return e(xr,{isInline:m,indentation:u,level:s,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case dr:return e(gr,{indentation:u,isInline:m,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case hr:return e(Nr,{indentation:u,tagKey:o,attributes:l},p);default:return e(Sr,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:s,children:e(Ar,{elements:c,level:s+1})},p)}}))}):null}function Pr(){return e("div",{children:"Invalid XML!"})}function $r(t){const{theme:r,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d((()=>({...ur,...r}))),{json:m,valid:f}=function(e){return o((()=>{try{if(!ue.validate(e))throw new Error("Invalid XML!");const t=fr.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}}),[e])}(n),g=o((()=>({theme:u,collapsible:s,indentSize:i,initialCollapsedDepth:h??c})),[u,s,i,c,h]);return a((()=>{p((e=>{const t={...ur,...r};return de(t,e)?e:t}))}),[r]),f?e(pr.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:u.fontFamily,overflowWrap:"break-word"},children:e(Ar,{elements:m})})}):l||e(Pr,{})}export{Me as ArrayPropertySchema,ge as CodeMirrorEditor,ir as DropZone,me as EditorApi,ve as FieldSetContextProvider,je as Form,xe as FormContext,ke as FormContextProvider,Ge as FormError,He as FormHelper,We as FormLabel,Oe as GeneratedForm,Ce as Input,nt as JSONCode,ut as JSONDisplay,st as JSONView,Ke as ManageObjectEntry,Ue as ManagedListProperty,Re as ManagedObject,Fe as ManagedObjectBase,_e as ManagedObjectProperty,Ve as ManagedProperty,Be as ManagedScalarEntry,Et as ManagedSchema,mt as MarkdownRenderer,ze as Node,wt as Popover,ft as PopoverContext,jt as Progress,St as PropertiesView,Lt as PropertyEditor,Dt as PropertyNameEditor,qe as PropertySchema,_t as PropertyViewer,Pe as ScalarField,Ie as Schema,Zt as SchemaEditor,It as SchemaNode,nr as SvgIcon,ar as UploadResultCategory,or as UploadSummary,$r as XMLViewer,Le as computeTitleFromName,sr as createSvgIcon,qt as getEditableSchemaProperty,be as useFieldSet,Ne as useForm,gt as usePopoverContext,Vt as useSchema,er as validatePropertyName};
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import i,{useRef as s,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,memo as h,useCallback as u,Component as p,Children as m,isValidElement as f}from"react";import{EditorView as y}from"@codemirror/view";import{useSafeLayoutEffect as g,Styles as b,FormItem as v,Button as x,DotBadge as k,Table as w,VTooltip as N,VSelectBox as C,VModal as S,VModalTitle as A,ModalBody as j,ModalFooter as O,useFlag as P,useClickOutside as $,useToast as E}from"@vertesia/ui/core";import{Text as I,EditorState as T}from"@codemirror/state";import F from"clsx";import{Plus as D,Trash2 as q,Check as M,Copy as R,Download as K,Info as L,AlignLeft as z,SquarePen as _,ChevronDown as V,ChevronRight as U,UploadIcon as W,CheckCircleIcon as B,AlertCircleIcon as H,XCircleIcon as G}from"lucide-react";import Z from"ajv";import{ObjectWalker as J}from"@vertesia/json";import X,{defaultUrlTransform as Y}from"react-markdown";import Q from"remark-gfm";import{visit as ee,SKIP as te}from"unist-util-visit";import{toPng as re}from"html-to-image";import{XAxis as ne,YAxis as ie,CartesianGrid as se,Tooltip as ae,Legend as oe,ReferenceLine as le,ResponsiveContainer as ce,ComposedChart as de,AreaChart as he,LineChart as ue,BarChart as pe,Line as me,Area as fe,Bar as ye,PieChart as ge,Pie as be,Cell as ve,ScatterChart as xe,Scatter as ke,RadarChart as we,PolarGrid as Ne,PolarAngleAxis as Ce,PolarRadiusAxis as Se,Radar as Ae,RadialBarChart as je,RadialBar as Oe,FunnelChart as Pe,Funnel as $e,LabelList as Ee,Treemap as Ie}from"recharts";import{useUserSession as Te}from"@vertesia/ui/session";import{offset as Fe,shift as De,flip as qe}from"@floating-ui/dom";import{useFloating as Me,autoUpdate as Re,useDismiss as Ke,useClick as Le,useHover as ze,useInteractions as _e,useTransitionStyles as Ve,FloatingPortal as Ue,FloatingFocusManager as We,safePolygon as Be}from"@floating-ui/react";import{XMLParser as He,XMLValidator as Ge}from"fast-xml-parser";import{isNil as Ze,omit as Je}from"lodash-es";let Xe=null;class Ye{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const Qe=[y.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),y.lineWrapping];function et({onChange:t,value:r,className:i,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=s(null),u=s(void 0);a(()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}},[t,d]);const p=o(()=>e("div",{ref:h,className:i}),[i]);return g(()=>{if(h.current){let t=[...Qe,(e=e=>{u.current?.(e)},y.updateListener.of(t=>{t.docChanged&&e(t)}))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?I.of(e.split("\n")):e;return Xe?Xe.doc.toString()!==r.toString()&&(Xe=T.create({doc:r,extensions:t})):Xe=T.create({doc:r,extensions:t}),Xe})(r,t),i=new y({state:n,parent:h.current}),s=new Ye(i);return l&&(l.current=s),()=>{i.destroy(),l&&(l.current=void 0)}}var e},[p,c]),p}const tt=l(void 0),rt=tt.Provider;function nt(){const e=c(tt);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}class it{object;components;disabled;constructor(e,t={},r=!1){this.object=e,this.components=t,this.disabled=r}}const st=l(void 0);function at(){const e=c(st);if(!e)throw new Error("useForm must be used within a Form element");return e}const ot=st.Provider,lt=i.forwardRef(({object:t,type:r="text",onChange:n,...i},s)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);i.className?i.className=F(b.INPUT,i.className):i.className=b.INPUT;const h=e=>{i.disabled||(o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e))};return"textarea"===r?e("textarea",{ref:s,...i,value:a,onChange:h}):e("input","checkbox"===r?{ref:s,...i,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:s,...i,type:r,value:a,onChange:h})});function ct({object:t,components:r,onSubmit:n,children:i,onChange:s,disabled:a}){return t.observer=s,e(ot,{value:new it(t,r||{},a??!1),children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:i})})}function dt(){const t=at();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(ut)})}function ht({children:r,...n}){return t(ct,{...n,children:[e(dt,{}),r]})}function ut(t){return t.isList?e(ft,{object:t},t.name):t.isObject?e(mt,{object:t},t.name):e(pt,{object:t},t.name)}function pt({object:t,editor:r,inline:n=!1}){r||(r=t.schema.editor);const{components:i,disabled:s}=at(),a=r&&i[r]||lt,o=t.getInputType();"checkbox"===o&&(n=!0);const l=e=>{if(s)return;const{value:r}=e.target;t.value=t.schema.isNumber?parseFloat(r):r};return t.isListItem?e(a,{object:t,type:o,onChange:l,disabled:s}):e(v,{label:t.title,required:t.schema.isRequired,description:t.schema.description,className:F("flex",n?"flex-row items-center":"flex-col"),children:e(a,{object:t,type:o,onChange:l,disabled:s})})}function mt({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(ut)]})}function ft({object:r}){const[n,i]=d(r.value||[]),{disabled:s}=at();return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map((t,a)=>e(yt,{object:t,list:r,onDelete:()=>(e=>{s||(r.remove(e),i([...r.value]))})(a),disabled:s},`${a}-${n[a]??""}`)),e("div",{children:t(x,{variant:"secondary",onClick:()=>{s||(r.add(),i([...r.value]))},disabled:s,children:[e(D,{className:"size-6"})," Add"]})})]})}function yt({list:r,object:n,onDelete:i,disabled:s}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(a=n,o=r.schema.arraySchema.editor,a.isList?e(ft,{object:a}):a.isObject?e(mt,{object:a}):e(pt,{object:a,editor:o}))}),e(x,{variant:"secondary",onClick:i,disabled:s,children:e(q,{className:"size-4"})})]});var a,o}class gt{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new Z({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach(t=>{this.loadProperty(t,e[t])})}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new vt(this,e,t):new bt(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(i=t)?{type:"object",properties:{}}:"array"===i?{type:"array",items:{}}:{type:i}:t;var i;const s=this.loadProperty(e,n);return this.schema.properties[s.name]=s.schema,r&&(s.isRequired=!0),s}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter(t=>t!==e))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class bt extends gt{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter(e=>e!==this.name),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class vt extends bt{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function xt(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function kt(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class wt{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||xt(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Nt extends wt{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new jt(this,t,this.getOrInitArrayProperty(e)):t.isObject?new St(this,t,t.name,this.getOrInitObjectProperty(e)):new At(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new jt(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new St(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new At(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class Ct extends Nt{value;constructor(e,t={}){super(null,e instanceof gt?e:new gt(e),"#root"),this.value=t}}class St extends Nt{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class At extends wt{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return kt(this.name,this.schema)}}class jt extends wt{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Ot(this,e):new Pt(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new St(this,this.schema,String(e),t):new Pt(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Ot extends Nt{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class Pt extends wt{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return kt(this.name,this.schema)}}function $t({label:t,required:r,children:n}){return e(v,{label:t,required:r,children:n})}function Et({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function It({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const Tt="text-pink-500 dark:text-pink-400",Ft="text-purple-500 dark:text-purple-400",Dt="text-blue-500 dark:text-blue-400",qt={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:Tt,assign:Tt,startObject:Tt,endObject:Tt,startArray:Tt,endArray:Tt,boolean:Ft,null:Ft,key:Dt,index:Dt,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class Mt{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof Mt)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class Rt extends Mt{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class Kt extends Mt{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class Lt{classMap;tab;stack=[];block=new Rt(this,void 0,"","");constructor(e=qt,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new Rt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new Kt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function zt({data:t,className:r,classMap:n}){const[i,s]=d();return a(()=>{s(function(t,r,n){const i=new Lt(r);(new J).walk(t,i);const s=i.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${i.classMap.code}' style='overflow-x: scroll'>${s}</div>`}})}(t,n,r))},[t]),i}function _t({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map(([t,r])=>e(Wt,{name:t,value:r},t))})}function Vt({name:t}){return e("div",{className:"text-md font-semibold",children:xt(t)})}function Ut({children:t,className:r}){return e("div",{className:F("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function Wt({name:r,value:n}){const i=Zt(n);switch(i.type){case Gt.Inline:return t("div",{className:"w-full flex gap-2",children:[e(Vt,{name:r+":"}),e("p",{children:i.value})]});case Gt.Paragraph:return t("div",{children:[e(Vt,{name:r}),e("p",{children:i.value})]});case Gt.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(Vt,{name:r}),e("div",{className:"vprose dark:prose-invert",children:i.value})]});case Gt.Array:return e(Bt,{name:r,value:n});case Gt.Object:return t("div",{children:[e(Vt,{name:r}),e(Ut,{className:"mt-2",children:Object.entries(n).map(([t,r])=>e(Wt,{name:t,value:r},t))})]})}}function Bt({name:r,value:n}){const i=n.join(" ").length,s=i/n.length,a="string"==typeof n[0]&&(i<80||i<400&&s<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(Vt,{name:r+":"}),n.map((t,r)=>e(k,{children:String(t)},r))]}:{children:[r&&e(Vt,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map((t,r)=>e(Ht,{index:r,value:t,useBullet:o},r))})]})}function Ht({index:r,value:n,useBullet:i}){const s=i?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=Zt(n);let o;switch(a.type){case Gt.Object:o=e(Ut,{children:Object.entries(n).map(([t,r])=>e(Wt,{name:t,value:r},t))});break;case Gt.Array:o=e(Bt,{value:n});break;case Gt.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:s}),e("div",{children:o})]})}var Gt;function Zt(e){if(null==e)return{value:"-",type:Gt.Inline};if(Array.isArray(e))return{value:e,type:Gt.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=Gt.Inline:t>400?r=Gt.Prose:(r=Gt.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:Gt.Inline}:{value:e,type:Gt.Object}}function Jt({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(zt,{data:t}):e(_t,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(Gt||(Gt={}));const Xt=["#4f46e5","#06b6d4","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6"];class Yt extends p{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 Qt(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 er=h(function({spec:n}){const{chart:i,title:a,description:o,data:l,xKey:c,series:h,yAxis:p,options:m,nameKey:f,valueKey:y,yKey:g,zKey:b,axisKey:v,dataKey:x}=n,[k,w]=d(!1),[N,C]=d(!1),S=s(null),A=u(async()=>{if(S.current&&!N)try{const e=await re(S.current,{backgroundColor:"#ffffff",pixelRatio:2}),t=await fetch(e),r=await t.blob();await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error("Failed to copy chart:",e)}},[N]),j=u(async()=>{if(S.current&&!k){w(!0);try{const e=await re(S.current,{backgroundColor:"#ffffff",pixelRatio:2}),t=document.createElement("a");t.download=`${a||"chart"}.png`,t.href=e,t.click()}catch(e){console.error("Failed to export chart:",e)}finally{w(!1)}}},[a,k]),O=h||[],P=l||[],$=t(r,{children:[e(ne,{dataKey:c,tick:{fontSize:12}}),e(ie,{yAxisId:"left",tickFormatter:Qt,label:p?.left?.label?{value:p.left.label,angle:-90,position:"insideLeft"}:void 0}),O.some(e=>"right"===e.yAxisId)&&e(ie,{yAxisId:"right",orientation:"right",tickFormatter:Qt,label:p?.right?.label?{value:p.right.label,angle:-90,position:"insideRight"}:void 0})]}),E=t(r,{children:[e(se,{strokeDasharray:"3 3"}),e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),e(oe,{}),m?.referenceZero&&e(le,{y:0,stroke:"#999",strokeDasharray:"3 3"})]}),I=()=>O.map((t,r)=>{const n=t.color||Xt[r%Xt.length],s=t.yAxisId||"left";return"line"===i?e(me,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:n,dot:t.dot??!1,yAxisId:s},t.key):"area"===i?e(fe,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:n,fill:n,fillOpacity:.3,stackId:m?.stacked?t.stackId||"stack":void 0,yAxisId:s},t.key):"bar"===i||"bar"===t.type?e(ye,{dataKey:t.key,name:t.label||t.key,fill:n,stackId:m?.stacked?t.stackId||"stack":void 0,yAxisId:s},t.key):"area"===t.type?e(fe,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:n,fill:n,fillOpacity:.3,stackId:m?.stacked?t.stackId||"stack":void 0,yAxisId:s},t.key):e(me,{type:"monotone",dataKey:t.key,name:t.label||t.key,stroke:n,dot:t.dot??!1,yAxisId:s},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:a||"Chart"}),t("div",{className:"flex items-center gap-2 print:hidden chart-actions",children:[t("button",{onClick:A,disabled:N,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(N?M:R,{className:"w-3 h-3"}),N?"Copied":"Copy"]}),t("button",{onClick:j,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 disabled:cursor-not-allowed flex items-center gap-1",title:"Export as PNG",children:[e(K,{className:"w-3 h-3"}),k?"Exporting...":"Export"]})]})]}),o&&e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:o}),e("div",{ref:S,className:"bg-white dark:bg-gray-900 rounded",style:{width:"100%",height:280,minWidth:0},children:e(Yt,{chartType:i,children:e(ce,{width:"100%",height:"100%",children:(()=>{switch(i){case"bar":return t(pe,{data:P,children:[$,E,I()]});case"line":return t(ue,{data:P,children:[$,E,I()]});case"area":return t(he,{data:P,children:[$,E,I()]});case"composed":default:return t(de,{data:P,children:[$,E,I()]});case"pie":return t(ge,{children:[e(be,{data:P,dataKey:y||"value",nameKey:f||"name",cx:"50%",cy:"50%",innerRadius:m?.innerRadius||0,outerRadius:100,label:!1!==m?.showLabels,children:P.map((t,r)=>e(ve,{fill:Xt[r%Xt.length]},`cell-${r}`))}),e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),e(oe,{})]});case"scatter":return(()=>{const r=c,n=g||"y";return t(xe,{children:[e(se,{strokeDasharray:"3 3"}),e(ne,{dataKey:r,name:r,tick:{fontSize:12}}),e(ie,{dataKey:n,name:n,tickFormatter:Qt}),e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),e(oe,{}),O.length>0?O.map((t,r)=>e(ke,{name:t.label||t.key,data:P,fill:t.color||Xt[r%Xt.length]},t.key)):e(ke,{name:"Data",data:P,fill:Xt[0]})]})})();case"radar":return(()=>{const r=v||c||"axis";return t(we,{cx:"50%",cy:"50%",outerRadius:100,data:P,children:[e(Ne,{}),e(Ce,{dataKey:r,tick:{fontSize:11}}),e(Se,{tickFormatter:Qt}),O.map((t,r)=>e(Ae,{name:t.label||t.key,dataKey:t.key,stroke:t.color||Xt[r%Xt.length],fill:t.color||Xt[r%Xt.length],fillOpacity:.3},t.key)),e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),e(oe,{})]})})();case"radialBar":return(()=>{const r=f||"name",n=y||"value",i=m?.startAngle??180,s=m?.endAngle??0;return t(je,{cx:"50%",cy:"50%",innerRadius:m?.innerRadius??30,outerRadius:100,barSize:15,data:P,startAngle:i,endAngle:s,children:[e(Oe,{label:{position:"insideStart",fill:"#fff",fontSize:11},background:!0,dataKey:n,children:P.map((t,r)=>e(ve,{fill:Xt[r%Xt.length]},`cell-${r}`))}),e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),e(oe,{iconSize:10,layout:"vertical",verticalAlign:"middle",align:"right",formatter:(e,t)=>{const i=P.find(i=>i[r]===e||i[n]===t.payload?.value);return i?i[r]:e}})]})})();case"funnel":return(()=>{const r=f||"name",n=y||"value";return t(Pe,{children:[e(ae,{formatter:e=>"number"==typeof e?Qt(e):String(e)}),t($e,{dataKey:n,data:P,isAnimationActive:!0,children:[P.map((t,r)=>e(ve,{fill:Xt[r%Xt.length]},`cell-${r}`)),!1!==m?.showLabels&&e(Ee,{position:"center",fill:"#fff",stroke:"none",dataKey:r})]})]})})();case"treemap":return e(Ie,{data:P,dataKey:x||y||"value",aspectRatio:4/3,stroke:"#fff",fill:"#4f46e5",content:({x:n,y:i,width:s,height:a,name:o,value:l,index:c})=>t("g",{children:[e("rect",{x:n,y:i,width:s,height:a,style:{fill:Xt[c%Xt.length],stroke:"#fff",strokeWidth:2}}),s>50&&a>30&&t(r,{children:[e("text",{x:n+s/2,y:i+a/2-7,textAnchor:"middle",fill:"#fff",fontSize:12,children:o}),e("text",{x:n+s/2,y:i+a/2+10,textAnchor:"middle",fill:"#fff",fontSize:11,children:Qt(l)})]})]})})}})()})})})]})})},(e,t)=>JSON.stringify(e.spec)===JSON.stringify(t.spec)),tr=["artifact:","image:","store:","document:","document://","collection:"];function rr(e){return tr.some(t=>e.startsWith(t))?e:Y(e)}function nr(){return e=>{ee(e,"html",(e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[te,t]})}}function ir({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0,artifactRunId:a}){const{client:o}=Te(),l=[Q,...n];s&&l.push(nr);const c=i.useMemo(()=>{const t=r||{},n=t.code,s=t.a,l=t.img;return{...t,code:({node:t,className:r,children:i,...s})=>{const a=/language-(\w+)/.exec(r||""),o=!a,l=a?a[1]:"";if(!o&&("chart"===l||r?.includes("language-chart")))try{const t=String(i||"").trim(),r=JSON.parse(t);if(r&&r.chart&&Array.isArray(r.data))return e(er,{spec:r})}catch(e){console.warn("Failed to parse chart spec:",e)}return"function"==typeof n?e(n,{node:t,className:r,...s,children:i}):e("code",{...s,className:o?"px-1.5 py-0.5 rounded":"text-muted",children:i})},a:t=>{const{node:r,href:n,children:l,...c}=t,d=n||"",h=d.startsWith("artifact:"),u=h?d.replace(/^artifact:/,"").trim():"",p=d.startsWith("image:"),m=p?d.replace(/^image:/,"").trim():"",[f,y]=i.useState(void 0);if(i.useEffect(()=>{let e=!1;return(async()=>{if(h||p)try{if(h)if(a&&!u.startsWith("agents/")){const{url:t}=await o.files.getArtifactDownloadUrl(a,u,"attachment");e||y(t)}else{const{url:t}=await o.files.getDownloadUrl(u);e||y(t)}else if(p){const{url:t}=await o.files.getDownloadUrl(m);e||y(t)}}catch(t){const r=h?u:m;console.error("Failed to resolve link in MarkdownRenderer:",r,t),e||y(void 0)}else y(void 0)})(),()=>{e=!0}},[h,u,p,m,a,o]),d.startsWith("document://")){const t=d.replace(/^document:\/\//,"").trim(),n=t?`/store/objects/${t}`:d;return"function"==typeof s?e(s,{node:r,href:n,...c,children:l}):e("a",{href:n,...c,target:"_blank",rel:"noopener noreferrer",children:l})}if(d.startsWith("store:")){const t=d.replace(/^store:/,"").trim(),n=t?`/store/objects/${t}`:d;return"function"==typeof s?e(s,{node:r,href:n,...c,children:l}):e("a",{href:n,...c,target:"_blank",rel:"noopener noreferrer",children:l})}if(d.startsWith("collection:")){const t=d.replace(/^collection:/,"").trim(),n=t?`/store/collections/${t}`:d;return"function"==typeof s?e(s,{node:r,href:n,...c,children:l}):e("a",{href:n,...c,target:"_blank",rel:"noopener noreferrer",children:l})}if(!h&&!p&&"function"==typeof s)return e(s,{node:r,href:n,...c,children:l});if(h){return e("a",{href:f||"#",...c,target:"_blank",rel:"noopener noreferrer",children:l})}if(p){return e("a",{href:f||"#",...c,target:"_blank",rel:"noopener noreferrer",children:l})}return e("a",{href:n,...c,target:"_blank",rel:"noopener noreferrer",children:l})},img:t=>{const{node:r,src:n,alt:s,...c}=t,d=n||"",h=d.startsWith("artifact:"),u=d.startsWith("image:"),p=h||u,m=p?d.replace(/^artifact:/,"").replace(/^image:/,"").trim():"",[f,y]=i.useState(void 0);return i.useEffect(()=>{let e=!1;return(async()=>{if(p)try{if(h)if(a&&!m.startsWith("agents/")){const{url:t}=await o.files.getArtifactDownloadUrl(a,m,"inline");e||y(t)}else{const{url:t}=await o.files.getDownloadUrl(m);e||y(t)}else if(u){const{url:t}=await o.files.getDownloadUrl(m);e||y(t)}}catch(t){console.error("Failed to resolve image link in MarkdownRenderer:",m,t),e||y(void 0)}else y(void 0)})(),()=>{e=!0}},[p,m,a,o]),p||"function"!=typeof l?p?f?e("img",{src:f,alt:s,...c}):null:e("img",{src:n,alt:s,...c}):e(l,{node:r,src:n,alt:s,...c})}}},[r,o,a]);return e(X,{remarkPlugins:l,components:c,urlTransform:rr,children:t})}const sr=l(void 0);function ar(){return c(sr)}const or=Symbol("__SLOT_NAME");function lr(e,t){const r=[];return m.forEach(e,e=>{!function(e,t,r){let n;f(e)&&(n=e.type[or])?r[n]=e:t.push(e)}(e,r,t)}),r.length>1?r:r[0]}function cr(e,t){t[or]=e}function dr(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function hr(t){const r={};if(lr(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,i=r.content.props;return e(ur,{...t,trigger:n,content:i})}function ur({middleware:r,offset:n,trigger:i,dismiss:s=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=Me({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[Fe(n||4),De(),qe()],whileElementsMounted:Re}),{floatingStyles:m,refs:{setReference:f,setFloating:y},context:g}=p,b=Ke(g,dr(s)),v=Le(g,dr(!(x=i)||x.hover||x.click?x?.click:{enabled:!0}));var x;const k=ze(g,dr(function(e){return!0===e?.hover?{enabled:!0,handleClose:Be({blockPointerEvents:!0}),restMs:0}:e?.hover}(i))),{getReferenceProps:w,getFloatingProps:N}=_e([b,v,k]),{isMounted:C,styles:S}=Ve(g,a.transition);return t(sr.Provider,{value:{...p,close:()=>u(!1)},children:[i&&e("div",{className:F(i.className,"inline-block"),ref:f,...w(),children:i.children}),e(Ue,{children:C&&e("div",{ref:y,style:{...m,zIndex:c},...N(),children:e(We,{context:g,children:e("div",{className:F(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:S,children:a.children})})})})]})}function pr(e){return null}function mr(e){return null}function fr({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function yr({className:r,properties:n}){return e(w,{className:r,children:e("tbody",{children:n.map(r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(N,{description:r.description,placement:"top",children:e(L,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name))})})}var gr;function br(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function vr(e){let t,r=!1,n=!1;const i=e.type;if(Array.isArray(i))for(const e of i)"null"===e?r=!0:t||(t=e);else t=i;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?xr(e[0].type):xr(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let s=t;switch(e.editor){case"textarea":s="text";break;case"media":s="media";break;case"document":s="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:s}}function xr(e){return e?Array.isArray(e)?e.find(e=>"null"!==e)||"any":e:"any"}cr("trigger",pr),cr("content",mr),hr.Trigger=pr,hr.Content=mr,function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(gr||(gr={}));let kr=0;class wr{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new Nr("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new Nr("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new wr(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class Nr{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=vr(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new Nr(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++kr}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const i={};return br(i,r),e.properties[t]=i,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),i}(this._getPropertiesSchema(),e,t,r),i=new Nr(e,n,this.loader,this);return this.children.push(i),i}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter(e=>e!==t)))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter(e=>e.name!==this.name)),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,i={};for(const e of Object.keys(n)){const s=n[e];e===t?i[r]=s:i[e]=s}e.properties=i}e.required&&(e.required=e.required.map(e=>e===t?r:e))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(br(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,t=!0):e.editor?(this.schema.editor=e.editor,t=!0):n&&(this.schema.editor=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const i=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=gr[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===gr.object}}(t);let s;return"text"===i.name?(i.name=gr.string,s="textarea"):"media"===i.name?(i.name=gr.any,s="media"):"document"===i.name?(i.name=gr.any,s="document"):s=null,{name:r,type:i,isRequired:n,editor:s}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function Cr(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const Sr=function(){const e=Object.values(gr),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function Ar({value:r,onChange:n,onCancel:i,onSave:s}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(jr,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:i,onSave:s})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(Or,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:i,onSave:s})}),t("div",{children:[e(x,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(z,{className:"size-4"})}),e(Pr,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function jr({value:t,onChange:r,onCancel:n,onSave:i}){const o=s(null);a(()=>{o.current?.focus()},[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":i?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:b.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function Or({value:t,onChange:r,onCancel:n,onSave:i}){return e(C,{className:b.INPUT_UNSTYLED,options:Sr,value:t||"",onBlur:()=>{i?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?i?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Pr({value:r,isOpen:n,onClose:i}){return t(S,{isOpen:n,onClose:i,children:[e(A,{children:"Edit description"}),e($r,{value:r,onSave:i})]})}function $r({value:n,onSave:i}){const o=s(null),[l,c]=d(n||"");return a(()=>{o.current&&o.current.focus()},[o.current]),t(r,{children:[e(j,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(O,{children:e(x,{onClick:()=>i(l),children:"Save Changes"})})]})}function Er({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Ir(e){const[t,r]=d(new wr(e||{type:"object",properties:{}}).withChangeListener(e=>{r(e.clone())}));return t}const Tr="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Fr=`${Tr} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Dr=`${Tr} shadow-xs ring-1 ring-inset ring-ring`;function qr({value:r,onChange:n,onDelete:i,outlineOnHover:s=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:y,isOn:g}=P(u),[b,v]=d();return t("div",{className:"",children:[g&&!p?e(Rr,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void v(t);v(void 0)}n(e)&&y()},onCancel:y,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Mr,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:s,editOnClick:a,onDelete:i,readonly:p}),b&&e("div",{className:"text-red-500 text-sm",children:b})]})}function Mr({viewer:r,value:n,onEdit:i,editOnClick:s,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&i()},onClick:()=>{s&&i()},className:F("flex justify-start items-center group",a?Fr:Tr,{"cursor-pointer":s}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(x,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(q,{className:"size-4"})}),c?null:e(x,{variant:"ghost",size:"sm",className:d,onClick:i,children:e(_,{className:"size-4"})})]})]})}function Rr({editor:t,value:r,onSave:n,onCancel:i,skipClickOutside:a}){const[o,l]=d(r),c=s(r),[h,u]=d(null),p=()=>{n(c.current)},m=$(p,a);return e("div",{ref:m,children:e("div",{className:Dr,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout(()=>{n(e)},500)))},onSave:p,onCancel:i})})})})}function Kr(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function Lr({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map(e=>zr(e,n)),n?null:e(Br,{parent:r.root})]})}function zr(t,r){return t.isParent?e(Vr,{property:t,readonly:r},t.name):e(_r,{node:t,readonly:r},t.name)}function _r({node:t,readonly:r}){return e("li",{children:e(Wr,{property:t,readonly:r})})}function Vr({property:r,readonly:n}){const[i,s]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>s(!i),children:e(i?V:U,{className:"size-4"})}),e("div",{className:"flex-1",children:e(Wr,{property:r,readonly:n})})]}),i&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map(e=>zr(e,n)),n?null:e(Br,{parent:r})]})]})}function Ur(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function Wr({property:t,readonly:r}){const n=E(),i=t.resetIsNew(),s=Cr(t);return e(qr,{value:s,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:Ar,viewer:Er,outlineOnHover:!0,isEditing:i,skipClickOutside:Kr,readonly:r,onValidate:e=>Ur(e.name)})}function Br({parent:r}){return t(x,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:gr.string},!0).isNew=!0,r.reloadTree()},children:[e(D,{className:"size-4"}),"Add property"]})}function Hr({content:t,...r}){const n=s(null);return a(()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach(([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))}),n.current.innerHTML="",n.current.appendChild(e)},[t,r]),e("span",{ref:n})}function Gr(t){return r=>e(Hr,{content:t,...r})}function Zr({onDrop:r,message:n,buttonLabel:i="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=s(null),u=s(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],i=new Set,s=async e=>{if(e.isFile){const t=await new Promise(t=>{e.file(r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)})});!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&i.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise(e=>{t.readEntries(t=>{e(t)})});await Promise.all(r.map(s));const n=e.fullPath.substring(1);n&&i.add(n)}};try{if(await Promise.all(t.map(e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?s(t):Promise.resolve()})),n.length>0){const e=new Set(Array.from(i).map(e=>e.split("/")[0]).filter(Boolean)).size,t=n.length;let s="";s=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:s})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(W,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(x,{onClick:()=>{h.current&&h.current.click()},children:[e(W,{className:"h-4 w-4 mr-2"}),i]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some(e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/"))){const e=new Set(t.map(e=>e.webkitRelativePath?.split("/")[0]).filter(Boolean)).size,n=t.length,i=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,s={count:t.length,message:i};r(t,s)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function Jr({title:r,count:n,icon:i=e(B,{className:"h-4 w-4 text-green-500"}),items:s}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:i}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform 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"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:s.length>0?e("ul",{className:"space-y-1",children:s.map((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function Xr({files:r,className:n="",location:i,collection:s}){const a=r.filter(e=>"success"===e.status),o=r.filter(e=>"updated"===e.status),l=r.filter(e=>"skipped"===e.status),c=r.filter(e=>"failed"===e.status),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(B,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",s?` in collection '${s}'`:"",i?` in folder '${i}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(Jr,{title:"Successfully Uploaded",count:d,icon:e(B,{className:"h-4 w-4 text-green-500"}),items:a.map(e=>e.name)}),h>0&&e(Jr,{title:"Successfully Updated",count:h,icon:e(B,{className:"h-4 w-4 text-blue-500"}),items:o.map(e=>e.name)}),u>0&&e(Jr,{title:"Skipped (Already Existed)",count:u,icon:e(H,{className:"h-4 w-4 text-amber-500"}),items:l.map(e=>e.name)}),p>0&&e(Jr,{title:"Failed to Upload",count:p,icon:e(G,{className:"h-4 w-4 text-red-500"}),items:c.map(e=>e.name)})]})]})}const Yr="#text",Qr="#comment",en="#cdata",tn="DECLARATION_TAG",rn={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},nn={attributeKeyColor:"#FFD700",attributeValueColor:"#FF4500",tagColor:"#87CEFA",textColor:"#00FF00",separatorColor:"#FFD700",commentColor:"#BEBEBE",cdataColor:"#33CC66",fontFamily:"monospace"},sn=l({theme:rn,collapsible:!1,indentSize:2}),an=()=>c(sn),on=new He({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:Qr,cdataPropName:en,parseTagValue:!1});function ln(r){const{indentation:n,children:i,isInline:s}=r,{theme:a}=an();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),i,e("span",{children:`${s?"":n}]]>`})]})}function cn(t){const{collapsible:r,theme:n}=an(),{collapsed:i}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(dn,{fill:n.separatorColor,style:{transform:`rotate(${i?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function dn({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function hn(e){const{collapsible:t,initialCollapsedDepth:r}=an(),[n,i]=d(()=>!(Ze(r)||!t)&&e>=r);return a(()=>{i(!(Ze(r)||!t)&&e>=r)},[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>i(e=>!e),role:"button",style:{cursor:"pointer"}}:{}}}function un(r){const{indentation:n,children:i,isInline:s,level:a}=r,{theme:o}=an(),{collapsed:l,buttonProps:c}=hn(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(cn,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&i,l&&"...",e("span",{children:`${s||l?" ":n}--\x3e`})]})}function pn(r){const{attributes:n}=r,{theme:i}=an();return n?e("span",{children:Object.entries(n).map(([r,n])=>t("span",{children:[e("span",{style:{color:i.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:i.separatorColor},children:"="}),e("span",{style:{color:i.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`))}):null}function mn(r){const{indentation:n,tagKey:i,attributes:s}=r,{theme:a}=an();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${i.slice(1)}`}),e(pn,{attributes:s}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function fn(e){return"string"==typeof e&&e.includes("\n")}function yn(e){const t=e[":@"],r=Je(e,":@"),[[n,i]]=Object.entries(r),s=function(e){switch(e){case Yr:case en:case Qr:return e;default:return e.startsWith("?")?tn:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:i,type:s}}function gn(e){return!!e&&Object.keys(e).length>0}function bn(n){const{indentation:i,tagKey:s,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=hn(d),{theme:p}=an();return t("div",{children:[t("span",{...u,children:[e("span",{children:i}),e(cn,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${s}`}),!h&&e(pn,{attributes:a}),h&&gn(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":i}</`}),e("span",{style:{color:p.tagColor},children:`${s}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function vn(t){const{hasSiblings:r,text:n,indentation:i,isText:s}=t,{theme:a}=an(),o=s?{color:a.textColor}:void 0;return fn(n)||r?e("div",{style:o,children:n.split("\n").filter(e=>!!e.trim()).map((t,r)=>e("div",{children:`${i}${t.trim()}`},`${r}`))}):e("span",{style:o,children:n})}function xn(t){const{elements:n,level:i=0,isText:s=!0}=t,{indentSize:a}=an();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=yn(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,i),p=`${i}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&Yr in e[0]&&!fn(e[0][Yr])}(c);switch(d){case Yr:return e(vn,{text:c,indentation:u,hasSiblings:h,isText:s},p);case Qr:return e(un,{isInline:m,indentation:u,level:i,children:e(xn,{elements:c,level:i+1,isText:!1})},p);case en:return e(ln,{indentation:u,isInline:m,children:e(xn,{elements:c,level:i+1,isText:!1})},p);case tn:return e(mn,{indentation:u,tagKey:o,attributes:l},p);default:return e(bn,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:i,children:e(xn,{elements:c,level:i+1})},p)}})}):null}function kn(){return e("div",{children:"Invalid XML!"})}function wn(t){const{theme:r,xml:n,collapsible:i=!1,indentSize:s=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d(()=>document.documentElement.classList.contains("dark"));a(()=>{const e=document.documentElement,t=new MutationObserver(()=>{p(e.classList.contains("dark"))});return t.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const m=o(()=>({...u?nn:rn,...r}),[u,r]),{json:f,valid:y}=function(e){return o(()=>{try{if(!Ge.validate(e))throw new Error("Invalid XML!");const t=on.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}},[e])}(n),g=o(()=>({theme:m,collapsible:i,indentSize:s,initialCollapsedDepth:h??c}),[m,i,s,c,h]);return y?e(sn.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:m.fontFamily,overflowWrap:"break-word"},children:e(xn,{elements:f})})}):l||e(kn,{})}export{vt as ArrayPropertySchema,et as CodeMirrorEditor,Zr as DropZone,Ye as EditorApi,rt as FieldSetContextProvider,ct as Form,it as FormContext,ot as FormContextProvider,It as FormError,Et as FormHelper,$t as FormLabel,ht as GeneratedForm,lt as Input,zt as JSONCode,Jt as JSONDisplay,_t as JSONView,Ot as ManageObjectEntry,jt as ManagedListProperty,Ct as ManagedObject,Nt as ManagedObjectBase,St as ManagedObjectProperty,At as ManagedProperty,Pt as ManagedScalarEntry,wr as ManagedSchema,ir as MarkdownRenderer,wt as Node,hr as Popover,sr as PopoverContext,fr as Progress,yr as PropertiesView,Ar as PropertyEditor,jr as PropertyNameEditor,bt as PropertySchema,Er as PropertyViewer,pt as ScalarField,gt as Schema,Lr as SchemaEditor,Nr as SchemaNode,Hr as SvgIcon,Jr as UploadResultCategory,Xr as UploadSummary,wn as XMLViewer,xt as computeTitleFromName,Gr as createSvgIcon,Cr as getEditableSchemaProperty,nt as useFieldSet,at as useForm,ar as usePopoverContext,Ir as useSchema,Ur as validatePropertyName};
2
2
  //# sourceMappingURL=vertesia-ui-widgets.js.map