@vertesia/ui 0.59.0 → 0.61.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 (661) hide show
  1. package/lib/esm/core/components/FormItem.js +9 -0
  2. package/lib/esm/core/components/FormItem.js.map +1 -0
  3. package/lib/esm/core/components/InputList.js +4 -3
  4. package/lib/esm/core/components/InputList.js.map +1 -1
  5. package/lib/esm/core/components/index.js +3 -3
  6. package/lib/esm/core/components/index.js.map +1 -1
  7. package/lib/esm/core/components/shadcn/button.js +37 -7
  8. package/lib/esm/core/components/shadcn/button.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/dialog.js +3 -3
  10. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js +38 -0
  12. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js.map +1 -0
  13. package/lib/esm/core/components/shadcn/filters/comboBox.js +24 -26
  14. package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -1
  15. package/lib/esm/core/components/shadcn/filters/dateFilter.js +12 -12
  16. package/lib/esm/core/components/shadcn/filters/dateFilter.js.map +1 -1
  17. package/lib/esm/core/components/shadcn/filters/filterBar.js +49 -36
  18. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  19. package/lib/esm/core/components/shadcn/filters/filters.js +31 -23
  20. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -1
  21. package/lib/esm/core/components/shadcn/filters/selectFilter.js +33 -24
  22. package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +1 -1
  23. package/lib/esm/core/components/shadcn/filters/textFilter.js +2 -2
  24. package/lib/esm/core/components/shadcn/filters/textFilter.js.map +1 -1
  25. package/lib/esm/core/components/shadcn/filters/types.js.map +1 -1
  26. package/lib/esm/core/components/shadcn/input.js +4 -4
  27. package/lib/esm/core/components/shadcn/input.js.map +1 -1
  28. package/lib/esm/core/components/shadcn/selectBox.js +72 -6
  29. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  30. package/lib/esm/core/components/styles.js +1 -1
  31. package/lib/esm/core/components/styles.js.map +1 -1
  32. package/lib/esm/core/components/table/index.js +3 -0
  33. package/lib/esm/core/components/table/index.js.map +1 -1
  34. package/lib/esm/core/index.js +2 -1
  35. package/lib/esm/core/index.js.map +1 -1
  36. package/lib/esm/core/utils/cn.js +6 -0
  37. package/lib/esm/core/utils/cn.js.map +1 -0
  38. package/lib/esm/core/utils/index.js +2 -0
  39. package/lib/esm/core/utils/index.js.map +1 -0
  40. package/lib/esm/features/agent/PayloadBuilder.js +174 -0
  41. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -0
  42. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js +207 -0
  43. package/lib/esm/features/agent/chat/AnimatedThinkingDots.js.map +1 -0
  44. package/lib/esm/features/agent/chat/JumpingDots.js +6 -0
  45. package/lib/esm/features/agent/chat/JumpingDots.js.map +1 -0
  46. package/lib/esm/features/agent/chat/ModernAgentConversation.js +409 -0
  47. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -0
  48. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +129 -0
  49. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -0
  50. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +66 -0
  51. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -0
  52. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js +29 -0
  53. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.js.map +1 -0
  54. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +97 -0
  55. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -0
  56. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +46 -0
  57. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -0
  58. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +352 -0
  59. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -0
  60. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js +20 -0
  61. package/lib/esm/features/agent/chat/ModernAgentOutput/MessagesContainer.js.map +1 -0
  62. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +62 -0
  63. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -0
  64. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js +23 -0
  65. package/lib/esm/features/agent/chat/ModernAgentOutput/SlideInPanel.js.map +1 -0
  66. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js +51 -0
  67. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js.map +1 -0
  68. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +82 -0
  69. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -0
  70. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js +13 -0
  71. package/lib/esm/features/agent/chat/ModernAgentOutput/StackedMessages.js.map +1 -0
  72. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +105 -0
  73. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -0
  74. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +154 -0
  75. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +1 -0
  76. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js +266 -0
  77. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js.map +1 -0
  78. package/lib/esm/features/agent/chat/WaitingMessages.js +60 -0
  79. package/lib/esm/features/agent/chat/WaitingMessages.js.map +1 -0
  80. package/lib/esm/features/agent/chat/index.js +5 -0
  81. package/lib/esm/features/agent/chat/index.js.map +1 -0
  82. package/lib/esm/features/agent/index.js +3 -0
  83. package/lib/esm/features/agent/index.js.map +1 -0
  84. package/lib/esm/features/errors/PanelErrorBoundary.js +11 -0
  85. package/lib/esm/features/errors/PanelErrorBoundary.js.map +1 -0
  86. package/lib/esm/features/errors/RowErrorBoundary.js +9 -0
  87. package/lib/esm/features/errors/RowErrorBoundary.js.map +1 -0
  88. package/lib/esm/features/errors/VertesiaErrorBoundary.js +15 -0
  89. package/lib/esm/features/errors/VertesiaErrorBoundary.js.map +1 -0
  90. package/lib/esm/features/errors/WidgetErrorBoundary.js +11 -0
  91. package/lib/esm/features/errors/WidgetErrorBoundary.js.map +1 -0
  92. package/lib/esm/features/errors/index.js +5 -0
  93. package/lib/esm/features/errors/index.js.map +1 -0
  94. package/lib/esm/features/facets/EnvironmentFacet.js +39 -0
  95. package/lib/esm/features/facets/EnvironmentFacet.js.map +1 -0
  96. package/lib/esm/features/facets/FacetsNav.js +8 -0
  97. package/lib/esm/features/facets/FacetsNav.js.map +1 -0
  98. package/lib/esm/features/facets/InteractionFacet.js +39 -0
  99. package/lib/esm/features/facets/InteractionFacet.js.map +1 -0
  100. package/lib/esm/features/facets/StringFacet.js +12 -0
  101. package/lib/esm/features/facets/StringFacet.js.map +1 -0
  102. package/lib/esm/features/facets/StringListFacet.js +11 -0
  103. package/lib/esm/features/facets/StringListFacet.js.map +1 -0
  104. package/lib/esm/features/facets/TypeFacet.js +42 -0
  105. package/lib/esm/features/facets/TypeFacet.js.map +1 -0
  106. package/lib/esm/features/facets/TypeOptions.js +19 -0
  107. package/lib/esm/features/facets/TypeOptions.js.map +1 -0
  108. package/lib/esm/features/facets/UserFacet.js +33 -0
  109. package/lib/esm/features/facets/UserFacet.js.map +1 -0
  110. package/lib/esm/features/facets/VFacetsNav.js +114 -0
  111. package/lib/esm/features/facets/VFacetsNav.js.map +1 -0
  112. package/lib/esm/features/facets/VStringFacet.js +17 -0
  113. package/lib/esm/features/facets/VStringFacet.js.map +1 -0
  114. package/lib/esm/features/facets/VTypeFacet.js +56 -0
  115. package/lib/esm/features/facets/VTypeFacet.js.map +1 -0
  116. package/lib/esm/features/facets/VUserFacet.js +31 -0
  117. package/lib/esm/features/facets/VUserFacet.js.map +1 -0
  118. package/lib/esm/features/facets/index.js +12 -0
  119. package/lib/esm/features/facets/index.js.map +1 -0
  120. package/lib/esm/features/facets/utils.js +7 -0
  121. package/lib/esm/features/facets/utils.js.map +1 -0
  122. package/lib/esm/features/index.js +9 -1
  123. package/lib/esm/features/index.js.map +1 -1
  124. package/lib/esm/features/layout/GenericPageNavHeader.js +11 -0
  125. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -0
  126. package/lib/esm/features/layout/NotFoundView.js +5 -0
  127. package/lib/esm/features/layout/NotFoundView.js.map +1 -0
  128. package/lib/esm/features/layout/index.js +3 -0
  129. package/lib/esm/features/layout/index.js.map +1 -0
  130. package/lib/esm/features/magic-pdf/DownloadPopover.js +13 -0
  131. package/lib/esm/features/magic-pdf/DownloadPopover.js.map +1 -0
  132. package/lib/esm/features/magic-pdf/MagicPdfView.js +44 -0
  133. package/lib/esm/features/magic-pdf/MagicPdfView.js.map +1 -0
  134. package/lib/esm/features/magic-pdf/PageSlider.js +57 -0
  135. package/lib/esm/features/magic-pdf/PageSlider.js.map +1 -0
  136. package/lib/esm/features/magic-pdf/PdfPageProvider.js +133 -0
  137. package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +1 -0
  138. package/lib/esm/features/magic-pdf/TextPageView.js +45 -0
  139. package/lib/esm/features/magic-pdf/TextPageView.js.map +1 -0
  140. package/lib/esm/features/magic-pdf/index.js +2 -0
  141. package/lib/esm/features/magic-pdf/index.js.map +1 -0
  142. package/lib/esm/features/magic-pdf/types.js +2 -0
  143. package/lib/esm/features/magic-pdf/types.js.map +1 -0
  144. package/lib/esm/features/magic-pdf/useResizeOnDrag.js +34 -0
  145. package/lib/esm/features/magic-pdf/useResizeOnDrag.js.map +1 -0
  146. package/lib/esm/features/store/collections/BrowseCollectionView.js +37 -0
  147. package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -0
  148. package/lib/esm/features/store/collections/CollectionView.js +53 -0
  149. package/lib/esm/features/store/collections/CollectionView.js.map +1 -0
  150. package/lib/esm/features/store/collections/CollectionsTable.js +60 -0
  151. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -0
  152. package/lib/esm/features/store/collections/CollectionsView.js +94 -0
  153. package/lib/esm/features/store/collections/CollectionsView.js.map +1 -0
  154. package/lib/esm/features/store/collections/EditCollectionView.js +161 -0
  155. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -0
  156. package/lib/esm/features/store/collections/index.js +6 -0
  157. package/lib/esm/features/store/collections/index.js.map +1 -0
  158. package/lib/esm/features/store/index.js +4 -0
  159. package/lib/esm/features/store/index.js.map +1 -0
  160. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +150 -0
  161. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +1 -0
  162. package/lib/esm/features/store/objects/DocumentSearchResults.js +123 -0
  163. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -0
  164. package/lib/esm/features/store/objects/DocumentSelectionProvider.js +81 -0
  165. package/lib/esm/features/store/objects/DocumentSelectionProvider.js.map +1 -0
  166. package/lib/esm/features/store/objects/DocumentTable.js +278 -0
  167. package/lib/esm/features/store/objects/DocumentTable.js.map +1 -0
  168. package/lib/esm/features/store/objects/ExportPropertiesModal.js +31 -0
  169. package/lib/esm/features/store/objects/ExportPropertiesModal.js.map +1 -0
  170. package/lib/esm/features/store/objects/components/ContentDispositionButton.js +31 -0
  171. package/lib/esm/features/store/objects/components/ContentDispositionButton.js.map +1 -0
  172. package/lib/esm/features/store/objects/components/ContentOverview.js +195 -0
  173. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -0
  174. package/lib/esm/features/store/objects/components/DocumentIcon.js +28 -0
  175. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -0
  176. package/lib/esm/features/store/objects/components/DocumentInput.js +52 -0
  177. package/lib/esm/features/store/objects/components/DocumentInput.js.map +1 -0
  178. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +169 -0
  179. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -0
  180. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +45 -0
  181. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -0
  182. package/lib/esm/features/store/objects/components/SelectDocument.js +39 -0
  183. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -0
  184. package/lib/esm/features/store/objects/components/SelectDocumentModal.js +7 -0
  185. package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +1 -0
  186. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +85 -0
  187. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -0
  188. package/lib/esm/features/store/objects/components/index.js +10 -0
  189. package/lib/esm/features/store/objects/components/index.js.map +1 -0
  190. package/lib/esm/features/store/objects/components/useDownloadObject.js +21 -0
  191. package/lib/esm/features/store/objects/components/useDownloadObject.js.map +1 -0
  192. package/lib/esm/features/store/objects/index.js +11 -0
  193. package/lib/esm/features/store/objects/index.js.map +1 -0
  194. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +74 -0
  195. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -0
  196. package/lib/esm/features/store/objects/layout/documentLayout.js +16 -0
  197. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -0
  198. package/lib/esm/features/store/objects/layout/index.js +3 -0
  199. package/lib/esm/features/store/objects/layout/index.js.map +1 -0
  200. package/lib/esm/features/store/objects/layout/renderers.js +128 -0
  201. package/lib/esm/features/store/objects/layout/renderers.js.map +1 -0
  202. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +150 -0
  203. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -0
  204. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +41 -0
  205. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -0
  206. package/lib/esm/features/store/objects/search/index.js +3 -0
  207. package/lib/esm/features/store/objects/search/index.js.map +1 -0
  208. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +149 -0
  209. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -0
  210. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js +2 -0
  211. package/lib/esm/features/store/objects/selection/ObjectsActionSpec.js.map +1 -0
  212. package/lib/esm/features/store/objects/selection/SelectionActions.js +75 -0
  213. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -0
  214. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +64 -0
  215. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -0
  216. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +53 -0
  217. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -0
  218. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js +30 -0
  219. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js.map +1 -0
  220. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +66 -0
  221. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -0
  222. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +106 -0
  223. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -0
  224. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +64 -0
  225. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +1 -0
  226. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js +72 -0
  227. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js.map +1 -0
  228. package/lib/esm/features/store/objects/selection/actions/index.js +8 -0
  229. package/lib/esm/features/store/objects/selection/actions/index.js.map +1 -0
  230. package/lib/esm/features/store/objects/selection/index.js +5 -0
  231. package/lib/esm/features/store/objects/selection/index.js.map +1 -0
  232. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +476 -0
  233. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -0
  234. package/lib/esm/features/store/objects/upload/index.js +4 -0
  235. package/lib/esm/features/store/objects/upload/index.js.map +1 -0
  236. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +201 -0
  237. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -0
  238. package/lib/esm/features/store/objects/upload/useUploadHandler.js +230 -0
  239. package/lib/esm/features/store/objects/upload/useUploadHandler.js.map +1 -0
  240. package/lib/esm/features/store/types/ContentObjectTypeView.js +158 -0
  241. package/lib/esm/features/store/types/ContentObjectTypeView.js.map +1 -0
  242. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +82 -0
  243. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +1 -0
  244. package/lib/esm/features/store/types/ContentObjectTypesTable.js +11 -0
  245. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +1 -0
  246. package/lib/esm/features/store/types/ContentObjectTypesView.js +55 -0
  247. package/lib/esm/features/store/types/ContentObjectTypesView.js.map +1 -0
  248. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +26 -0
  249. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -0
  250. package/lib/esm/features/store/types/ObjectSchemaEditor.js +89 -0
  251. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -0
  252. package/lib/esm/features/store/types/SelectContentType.js +43 -0
  253. package/lib/esm/features/store/types/SelectContentType.js.map +1 -0
  254. package/lib/esm/features/store/types/SelectContentTypeModal.js +28 -0
  255. package/lib/esm/features/store/types/SelectContentTypeModal.js.map +1 -0
  256. package/lib/esm/features/store/types/TableLayoutEditor.js +78 -0
  257. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -0
  258. package/lib/esm/features/store/types/index.js +11 -0
  259. package/lib/esm/features/store/types/index.js.map +1 -0
  260. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js +98 -0
  261. package/lib/esm/features/store/types/search/ObjectTypeSearchContext.js.map +1 -0
  262. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js +15 -0
  263. package/lib/esm/features/store/types/search/ObjectTypeSearchProvider.js.map +1 -0
  264. package/lib/esm/features/store/types/search/index.js +3 -0
  265. package/lib/esm/features/store/types/search/index.js.map +1 -0
  266. package/lib/esm/features/user/UserAvatar.js +18 -0
  267. package/lib/esm/features/user/UserAvatar.js.map +1 -0
  268. package/lib/esm/features/user/UserInfo.js +88 -0
  269. package/lib/esm/features/user/UserInfo.js.map +1 -0
  270. package/lib/esm/features/user/index.js +3 -0
  271. package/lib/esm/features/user/index.js.map +1 -0
  272. package/lib/esm/features/utils/index.js +4 -0
  273. package/lib/esm/features/utils/index.js.map +1 -0
  274. package/lib/esm/features/utils/mimeType.js +9 -0
  275. package/lib/esm/features/utils/mimeType.js.map +1 -0
  276. package/lib/esm/features/utils/rendition.js +47 -0
  277. package/lib/esm/features/utils/rendition.js.map +1 -0
  278. package/lib/esm/features/utils/text.js +10 -0
  279. package/lib/esm/features/utils/text.js.map +1 -0
  280. package/lib/esm/layout/FullHeightLayout.js +1 -1
  281. package/lib/esm/layout/FullHeightLayout.js.map +1 -1
  282. package/lib/esm/layout/Sidebar.js +12 -2
  283. package/lib/esm/layout/Sidebar.js.map +1 -1
  284. package/lib/esm/widgets/Progress.js +5 -0
  285. package/lib/esm/widgets/Progress.js.map +1 -0
  286. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +1 -1
  287. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -1
  288. package/lib/esm/widgets/form/Form.js +2 -2
  289. package/lib/esm/widgets/form/Form.js.map +1 -1
  290. package/lib/esm/widgets/form/schema.js +11 -5
  291. package/lib/esm/widgets/form/schema.js.map +1 -1
  292. package/lib/esm/widgets/index.js +4 -0
  293. package/lib/esm/widgets/index.js.map +1 -1
  294. package/lib/esm/widgets/popover/Popover.js +73 -0
  295. package/lib/esm/widgets/popover/Popover.js.map +1 -0
  296. package/lib/esm/widgets/popover/context.js +7 -0
  297. package/lib/esm/widgets/popover/context.js.map +1 -0
  298. package/lib/esm/widgets/popover/index.js +3 -0
  299. package/lib/esm/widgets/popover/index.js.map +1 -0
  300. package/lib/esm/widgets/popover/slots.js +22 -0
  301. package/lib/esm/widgets/popover/slots.js.map +1 -0
  302. package/lib/esm/widgets/properties/PropertiesView.js +6 -0
  303. package/lib/esm/widgets/properties/PropertiesView.js.map +1 -0
  304. package/lib/esm/widgets/properties/index.js +2 -0
  305. package/lib/esm/widgets/properties/index.js.map +1 -0
  306. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js +1 -2
  307. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js.map +1 -1
  308. package/lib/esm/widgets/schema-editor/editor/Editable.js +9 -10
  309. package/lib/esm/widgets/schema-editor/editor/Editable.js.map +1 -1
  310. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js +1 -1
  311. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js.map +1 -1
  312. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +2 -2
  313. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
  314. package/lib/esm/widgets/upload/DropZone.js +162 -0
  315. package/lib/esm/widgets/upload/DropZone.js.map +1 -0
  316. package/lib/esm/widgets/upload/UploadResultCategory.js +19 -0
  317. package/lib/esm/widgets/upload/UploadResultCategory.js.map +1 -0
  318. package/lib/esm/widgets/upload/UploadSummary.js +30 -0
  319. package/lib/esm/widgets/upload/UploadSummary.js.map +1 -0
  320. package/lib/esm/widgets/upload/index.js +4 -0
  321. package/lib/esm/widgets/upload/index.js.map +1 -0
  322. package/lib/tsconfig.tsbuildinfo +1 -1
  323. package/lib/types/core/components/FormItem.d.ts +11 -0
  324. package/lib/types/core/components/index.d.ts +3 -3
  325. package/lib/types/core/components/shadcn/button.d.ts +13 -2
  326. package/lib/types/core/components/shadcn/command.d.ts +7 -7
  327. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts +8 -0
  328. package/lib/types/core/components/shadcn/filters/comboBox.d.ts +5 -5
  329. package/lib/types/core/components/shadcn/filters/dateFilter.d.ts +3 -4
  330. package/lib/types/core/components/shadcn/filters/types.d.ts +7 -1
  331. package/lib/types/core/components/shadcn/input.d.ts +4 -4
  332. package/lib/types/core/components/shadcn/selectBox.d.ts +13 -4
  333. package/lib/types/core/components/table/index.d.ts +1 -0
  334. package/lib/types/core/index.d.ts +2 -1
  335. package/lib/types/core/utils/cn.d.ts +2 -0
  336. package/lib/types/core/utils/index.d.ts +1 -0
  337. package/lib/types/features/agent/PayloadBuilder.d.ts +53 -0
  338. package/lib/types/features/agent/chat/AnimatedThinkingDots.d.ts +37 -0
  339. package/lib/types/features/agent/chat/JumpingDots.d.ts +6 -0
  340. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts +24 -0
  341. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +21 -0
  342. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +18 -0
  343. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.d.ts +10 -0
  344. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +15 -0
  345. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +12 -0
  346. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +7 -0
  347. package/lib/types/features/agent/chat/ModernAgentOutput/MessagesContainer.d.ts +9 -0
  348. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts +8 -0
  349. package/lib/types/features/agent/chat/ModernAgentOutput/SlideInPanel.d.ts +10 -0
  350. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingMessages.d.ts +7 -0
  351. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts +9 -0
  352. package/lib/types/features/agent/chat/ModernAgentOutput/StackedMessages.d.ts +7 -0
  353. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts +21 -0
  354. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +23 -0
  355. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts +17 -0
  356. package/lib/types/features/agent/chat/WaitingMessages.d.ts +1 -0
  357. package/lib/types/features/agent/chat/index.d.ts +4 -0
  358. package/lib/types/features/agent/index.d.ts +2 -0
  359. package/lib/types/features/errors/PanelErrorBoundary.d.ts +4 -0
  360. package/lib/types/features/errors/RowErrorBoundary.d.ts +7 -0
  361. package/lib/types/features/errors/VertesiaErrorBoundary.d.ts +11 -0
  362. package/lib/types/features/errors/WidgetErrorBoundary.d.ts +4 -0
  363. package/lib/types/features/errors/index.d.ts +4 -0
  364. package/lib/types/features/facets/EnvironmentFacet.d.ts +9 -0
  365. package/lib/types/features/facets/FacetsNav.d.ts +6 -0
  366. package/lib/types/features/facets/InteractionFacet.d.ts +9 -0
  367. package/lib/types/features/facets/StringFacet.d.ts +10 -0
  368. package/lib/types/features/facets/StringListFacet.d.ts +10 -0
  369. package/lib/types/features/facets/TypeFacet.d.ts +15 -0
  370. package/lib/types/features/facets/TypeOptions.d.ts +3 -0
  371. package/lib/types/features/facets/UserFacet.d.ts +11 -0
  372. package/lib/types/features/facets/VFacetsNav.d.ts +7 -0
  373. package/lib/types/features/facets/VStringFacet.d.ts +15 -0
  374. package/lib/types/features/facets/VTypeFacet.d.ts +8 -0
  375. package/lib/types/features/facets/VUserFacet.d.ts +9 -0
  376. package/lib/types/features/facets/index.d.ts +11 -0
  377. package/lib/types/features/facets/utils.d.ts +3 -0
  378. package/lib/types/features/index.d.ts +9 -1
  379. package/lib/types/features/layout/GenericPageNavHeader.d.ts +12 -0
  380. package/lib/types/features/layout/NotFoundView.d.ts +4 -0
  381. package/lib/types/features/layout/index.d.ts +2 -0
  382. package/lib/types/features/magic-pdf/DownloadPopover.d.ts +6 -0
  383. package/lib/types/features/magic-pdf/MagicPdfView.d.ts +6 -0
  384. package/lib/types/features/magic-pdf/PageSlider.d.ts +7 -0
  385. package/lib/types/features/magic-pdf/PdfPageProvider.d.ts +28 -0
  386. package/lib/types/features/magic-pdf/TextPageView.d.ts +7 -0
  387. package/lib/types/features/magic-pdf/index.d.ts +1 -0
  388. package/lib/types/features/magic-pdf/types.d.ts +1 -0
  389. package/lib/types/features/magic-pdf/useResizeOnDrag.d.ts +8 -0
  390. package/lib/types/features/store/collections/BrowseCollectionView.d.ts +6 -0
  391. package/lib/types/features/store/collections/CollectionView.d.ts +5 -0
  392. package/lib/types/features/store/collections/CollectionsTable.d.ts +5 -0
  393. package/lib/types/features/store/collections/CollectionsView.d.ts +10 -0
  394. package/lib/types/features/store/collections/EditCollectionView.d.ts +7 -0
  395. package/lib/types/features/store/collections/index.d.ts +5 -0
  396. package/lib/types/features/store/index.d.ts +3 -0
  397. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts +7 -0
  398. package/lib/types/features/store/objects/DocumentSearchResults.d.ts +19 -0
  399. package/lib/types/features/store/objects/DocumentSelectionProvider.d.ts +32 -0
  400. package/lib/types/features/store/objects/DocumentTable.d.ts +20 -0
  401. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts +11 -0
  402. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts +8 -0
  403. package/lib/types/features/store/objects/components/ContentOverview.d.ts +7 -0
  404. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +10 -0
  405. package/lib/types/features/store/objects/components/DocumentInput.d.ts +7 -0
  406. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts +7 -0
  407. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts +8 -0
  408. package/lib/types/features/store/objects/components/SelectDocument.d.ts +8 -0
  409. package/lib/types/features/store/objects/components/SelectDocumentModal.d.ts +8 -0
  410. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts +10 -0
  411. package/lib/types/features/store/objects/components/index.d.ts +9 -0
  412. package/lib/types/features/store/objects/components/useDownloadObject.d.ts +3 -0
  413. package/lib/types/features/store/objects/index.d.ts +10 -0
  414. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +16 -0
  415. package/lib/types/features/store/objects/layout/documentLayout.d.ts +17 -0
  416. package/lib/types/features/store/objects/layout/index.d.ts +2 -0
  417. package/lib/types/features/store/objects/layout/renderers.d.ts +2 -0
  418. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +48 -0
  419. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts +15 -0
  420. package/lib/types/features/store/objects/search/index.d.ts +2 -0
  421. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts +25 -0
  422. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts +27 -0
  423. package/lib/types/features/store/objects/selection/SelectionActions.d.ts +4 -0
  424. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts +3 -0
  425. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts +3 -0
  426. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts +15 -0
  427. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +2 -0
  428. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts +3 -0
  429. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts +2 -0
  430. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts +3 -0
  431. package/lib/types/features/store/objects/selection/actions/index.d.ts +7 -0
  432. package/lib/types/features/store/objects/selection/index.d.ts +4 -0
  433. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts +37 -0
  434. package/lib/types/features/store/objects/upload/index.d.ts +3 -0
  435. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts +29 -0
  436. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts +49 -0
  437. package/lib/types/features/store/types/ContentObjectTypeView.d.ts +5 -0
  438. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts +5 -0
  439. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts +7 -0
  440. package/lib/types/features/store/types/ContentObjectTypesView.d.ts +8 -0
  441. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts +14 -0
  442. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts +7 -0
  443. package/lib/types/features/store/types/SelectContentType.d.ts +10 -0
  444. package/lib/types/features/store/types/SelectContentTypeModal.d.ts +32 -0
  445. package/lib/types/features/store/types/TableLayoutEditor.d.ts +8 -0
  446. package/lib/types/features/store/types/index.d.ts +10 -0
  447. package/lib/types/features/store/types/search/ObjectTypeSearchContext.d.ts +35 -0
  448. package/lib/types/features/store/types/search/ObjectTypeSearchProvider.d.ts +10 -0
  449. package/lib/types/features/store/types/search/index.d.ts +2 -0
  450. package/lib/types/features/user/UserAvatar.d.ts +8 -0
  451. package/lib/types/features/user/UserInfo.d.ts +36 -0
  452. package/lib/types/features/user/index.d.ts +2 -0
  453. package/lib/types/features/utils/index.d.ts +3 -0
  454. package/lib/types/features/utils/mimeType.d.ts +4 -0
  455. package/lib/types/features/utils/rendition.d.ts +3 -0
  456. package/lib/types/features/utils/text.d.ts +2 -0
  457. package/lib/types/layout/Sidebar.d.ts +2 -1
  458. package/lib/types/widgets/Progress.d.ts +5 -0
  459. package/lib/types/widgets/form/schema.d.ts +4 -3
  460. package/lib/types/widgets/index.d.ts +4 -0
  461. package/lib/types/widgets/popover/Popover.d.ts +37 -0
  462. package/lib/types/widgets/popover/context.d.ts +7 -0
  463. package/lib/types/widgets/popover/index.d.ts +2 -0
  464. package/lib/types/widgets/popover/slots.d.ts +4 -0
  465. package/lib/types/widgets/properties/PropertiesView.d.ts +10 -0
  466. package/lib/types/widgets/properties/index.d.ts +1 -0
  467. package/lib/types/widgets/upload/DropZone.d.ts +40 -0
  468. package/lib/types/widgets/upload/UploadResultCategory.d.ts +25 -0
  469. package/lib/types/widgets/upload/UploadSummary.d.ts +37 -0
  470. package/lib/types/widgets/upload/index.d.ts +3 -0
  471. package/lib/vertesia-ui-core.js +1 -1
  472. package/lib/vertesia-ui-core.js.map +1 -1
  473. package/lib/vertesia-ui-features.js +1 -1
  474. package/lib/vertesia-ui-features.js.map +1 -1
  475. package/lib/vertesia-ui-layout.js +1 -1
  476. package/lib/vertesia-ui-layout.js.map +1 -1
  477. package/lib/vertesia-ui-router.js.map +1 -1
  478. package/lib/vertesia-ui-session.js.map +1 -1
  479. package/lib/vertesia-ui-widgets.js +1 -1
  480. package/lib/vertesia-ui-widgets.js.map +1 -1
  481. package/package.json +13 -5
  482. package/src/core/components/FormItem.tsx +35 -0
  483. package/src/core/components/InputList.tsx +4 -3
  484. package/src/core/components/index.ts +3 -3
  485. package/src/core/components/shadcn/button.tsx +68 -8
  486. package/src/core/components/shadcn/dialog.tsx +3 -3
  487. package/src/core/components/shadcn/filters/DynamicLabel.tsx +45 -0
  488. package/src/core/components/shadcn/filters/comboBox.tsx +56 -52
  489. package/src/core/components/shadcn/filters/dateFilter.tsx +24 -25
  490. package/src/core/components/shadcn/filters/filterBar.tsx +53 -47
  491. package/src/core/components/shadcn/filters/filters.tsx +43 -30
  492. package/src/core/components/shadcn/filters/selectFilter.tsx +53 -34
  493. package/src/core/components/shadcn/filters/textFilter.tsx +6 -3
  494. package/src/core/components/shadcn/filters/types.ts +8 -1
  495. package/src/core/components/shadcn/input.tsx +5 -5
  496. package/src/core/components/shadcn/selectBox.tsx +138 -33
  497. package/src/core/components/styles.ts +1 -1
  498. package/src/core/components/table/index.tsx +8 -0
  499. package/src/core/index.ts +2 -1
  500. package/src/core/utils/cn.ts +6 -0
  501. package/src/core/utils/index.ts +1 -0
  502. package/src/features/agent/PayloadBuilder.tsx +208 -0
  503. package/src/features/agent/chat/AnimatedThinkingDots.tsx +350 -0
  504. package/src/features/agent/chat/JumpingDots.tsx +16 -0
  505. package/src/features/agent/chat/ModernAgentConversation.tsx +708 -0
  506. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +246 -0
  507. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +231 -0
  508. package/src/features/agent/chat/ModernAgentOutput/InlineSlideInPanel.tsx +66 -0
  509. package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +282 -0
  510. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +125 -0
  511. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +562 -0
  512. package/src/features/agent/chat/ModernAgentOutput/MessagesContainer.tsx +51 -0
  513. package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +123 -0
  514. package/src/features/agent/chat/ModernAgentOutput/README-image-support.md +43 -0
  515. package/src/features/agent/chat/ModernAgentOutput/SlideInPanel.tsx +72 -0
  516. package/src/features/agent/chat/ModernAgentOutput/SlidingMessages.tsx +96 -0
  517. package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +185 -0
  518. package/src/features/agent/chat/ModernAgentOutput/StackedMessages.tsx +33 -0
  519. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +167 -0
  520. package/src/features/agent/chat/ModernAgentOutput/utils.ts +195 -0
  521. package/src/features/agent/chat/ModernAgentOutput/with-types.d.ts +15 -0
  522. package/src/features/agent/chat/SlidingThinkingIndicator.tsx +459 -0
  523. package/src/features/agent/chat/WaitingMessages.ts +66 -0
  524. package/src/features/agent/chat/index.ts +4 -0
  525. package/src/features/agent/index.ts +2 -0
  526. package/src/features/errors/PanelErrorBoundary.tsx +30 -0
  527. package/src/features/errors/RowErrorBoundary.tsx +28 -0
  528. package/src/features/errors/VertesiaErrorBoundary.tsx +28 -0
  529. package/src/features/errors/WidgetErrorBoundary.tsx +27 -0
  530. package/src/features/errors/index.ts +4 -0
  531. package/src/features/facets/EnvironmentFacet.tsx +53 -0
  532. package/src/features/facets/FacetsNav.tsx +19 -0
  533. package/src/features/facets/InteractionFacet.tsx +53 -0
  534. package/src/features/facets/StringFacet.tsx +23 -0
  535. package/src/features/facets/StringListFacet.tsx +22 -0
  536. package/src/features/facets/TypeFacet.tsx +59 -0
  537. package/src/features/facets/TypeOptions.tsx +22 -0
  538. package/src/features/facets/UserFacet.tsx +61 -0
  539. package/src/features/facets/VFacetsNav.tsx +139 -0
  540. package/src/features/facets/VStringFacet.tsx +34 -0
  541. package/src/features/facets/VTypeFacet.tsx +72 -0
  542. package/src/features/facets/VUserFacet.tsx +47 -0
  543. package/src/features/facets/index.ts +11 -0
  544. package/src/features/facets/utils.tsx +9 -0
  545. package/src/features/index.ts +9 -1
  546. package/src/features/layout/GenericPageNavHeader.tsx +48 -0
  547. package/src/features/layout/NotFoundView.tsx +11 -0
  548. package/src/features/layout/index.ts +2 -0
  549. package/src/features/magic-pdf/DownloadPopover.tsx +32 -0
  550. package/src/features/magic-pdf/MagicPdfView.tsx +102 -0
  551. package/src/features/magic-pdf/PageSlider.tsx +112 -0
  552. package/src/features/magic-pdf/PdfPageProvider.tsx +229 -0
  553. package/src/features/magic-pdf/TextPageView.tsx +65 -0
  554. package/src/features/magic-pdf/index.ts +1 -0
  555. package/src/features/magic-pdf/types.ts +1 -0
  556. package/src/features/magic-pdf/useResizeOnDrag.ts +42 -0
  557. package/src/features/store/collections/BrowseCollectionView.tsx +45 -0
  558. package/src/features/store/collections/CollectionView.tsx +94 -0
  559. package/src/features/store/collections/CollectionsTable.tsx +115 -0
  560. package/src/features/store/collections/CollectionsView.tsx +166 -0
  561. package/src/features/store/collections/EditCollectionView.tsx +253 -0
  562. package/src/features/store/collections/index.ts +5 -0
  563. package/src/features/store/index.ts +3 -0
  564. package/src/features/store/objects/DocumentPreviewPanel.tsx +417 -0
  565. package/src/features/store/objects/DocumentSearchResults.tsx +209 -0
  566. package/src/features/store/objects/DocumentSelectionProvider.tsx +99 -0
  567. package/src/features/store/objects/DocumentTable.tsx +409 -0
  568. package/src/features/store/objects/ExportPropertiesModal.tsx +89 -0
  569. package/src/features/store/objects/components/ContentDispositionButton.tsx +45 -0
  570. package/src/features/store/objects/components/ContentOverview.tsx +466 -0
  571. package/src/features/store/objects/components/DocumentIcon.tsx +87 -0
  572. package/src/features/store/objects/components/DocumentInput.tsx +90 -0
  573. package/src/features/store/objects/components/PropertiesEditorModal.tsx +253 -0
  574. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +136 -0
  575. package/src/features/store/objects/components/SelectDocument.tsx +69 -0
  576. package/src/features/store/objects/components/SelectDocumentModal.tsx +20 -0
  577. package/src/features/store/objects/components/VectorSearchWidget.tsx +115 -0
  578. package/src/features/store/objects/components/index.ts +9 -0
  579. package/src/features/store/objects/components/useDownloadObject.ts +24 -0
  580. package/src/features/store/objects/index.ts +10 -0
  581. package/src/features/store/objects/layout/DocumentTableColumn.tsx +84 -0
  582. package/src/features/store/objects/layout/documentLayout.tsx +69 -0
  583. package/src/features/store/objects/layout/index.ts +2 -0
  584. package/src/features/store/objects/layout/knowledge.md +238 -0
  585. package/src/features/store/objects/layout/renderers.tsx +139 -0
  586. package/src/features/store/objects/search/DocumentSearchContext.ts +181 -0
  587. package/src/features/store/objects/search/DocumentSearchProvider.tsx +54 -0
  588. package/src/features/store/objects/search/index.ts +2 -0
  589. package/src/features/store/objects/selection/ObjectsActionContext.tsx +196 -0
  590. package/src/features/store/objects/selection/ObjectsActionSpec.ts +31 -0
  591. package/src/features/store/objects/selection/SelectionActions.tsx +160 -0
  592. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +114 -0
  593. package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +76 -0
  594. package/src/features/store/objects/selection/actions/ConfirmAction.tsx +46 -0
  595. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +77 -0
  596. package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +117 -0
  597. package/src/features/store/objects/selection/actions/RemoveFromCollectionAction.tsx +77 -0
  598. package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +122 -0
  599. package/src/features/store/objects/selection/actions/index.ts +7 -0
  600. package/src/features/store/objects/selection/index.ts +4 -0
  601. package/src/features/store/objects/upload/DocumentUploadModal.tsx +970 -0
  602. package/src/features/store/objects/upload/index.ts +3 -0
  603. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +250 -0
  604. package/src/features/store/objects/upload/useUploadHandler.ts +325 -0
  605. package/src/features/store/types/ContentObjectTypeView.tsx +244 -0
  606. package/src/features/store/types/ContentObjectTypesSearch.tsx +111 -0
  607. package/src/features/store/types/ContentObjectTypesTable.tsx +38 -0
  608. package/src/features/store/types/ContentObjectTypesView.tsx +71 -0
  609. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +70 -0
  610. package/src/features/store/types/ObjectSchemaEditor.tsx +127 -0
  611. package/src/features/store/types/SelectContentType.tsx +88 -0
  612. package/src/features/store/types/SelectContentTypeModal.tsx +142 -0
  613. package/src/features/store/types/TableLayoutEditor.tsx +104 -0
  614. package/src/features/store/types/index.ts +10 -0
  615. package/src/features/store/types/search/ObjectTypeSearchContext.tsx +119 -0
  616. package/src/features/store/types/search/ObjectTypeSearchProvider.tsx +24 -0
  617. package/src/features/store/types/search/index.ts +2 -0
  618. package/src/features/user/UserAvatar.tsx +34 -0
  619. package/src/features/user/UserInfo.tsx +215 -0
  620. package/src/features/user/index.ts +2 -0
  621. package/src/features/utils/index.ts +3 -0
  622. package/src/features/utils/mimeType.ts +9 -0
  623. package/src/features/utils/rendition.ts +75 -0
  624. package/src/features/utils/text.ts +10 -0
  625. package/src/layout/FullHeightLayout.tsx +1 -1
  626. package/src/layout/Sidebar.tsx +12 -2
  627. package/src/widgets/Progress.tsx +10 -0
  628. package/src/widgets/codemirror/CodeMirrorEditor.tsx +1 -1
  629. package/src/widgets/form/Form.tsx +2 -2
  630. package/src/widgets/form/schema.ts +14 -7
  631. package/src/widgets/index.ts +5 -1
  632. package/src/widgets/popover/Popover.tsx +171 -0
  633. package/src/widgets/popover/context.ts +15 -0
  634. package/src/widgets/popover/index.ts +2 -0
  635. package/src/widgets/popover/slots.ts +24 -0
  636. package/src/widgets/properties/PropertiesView.tsx +26 -0
  637. package/src/widgets/properties/index.ts +1 -0
  638. package/src/widgets/schema-editor/JSONSchemaEditorModal.tsx +1 -2
  639. package/src/widgets/schema-editor/editor/Editable.tsx +12 -13
  640. package/src/widgets/schema-editor/editor/PropertyViewer.tsx +1 -1
  641. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +4 -4
  642. package/src/widgets/upload/DropZone.tsx +257 -0
  643. package/src/widgets/upload/UploadResultCategory.tsx +81 -0
  644. package/src/widgets/upload/UploadSummary.tsx +116 -0
  645. package/src/widgets/upload/index.ts +3 -0
  646. package/lib/esm/code/index.js +0 -3
  647. package/lib/esm/code/index.js.map +0 -1
  648. package/lib/esm/core/components/Input.js +0 -16
  649. package/lib/esm/core/components/Input.js.map +0 -1
  650. package/lib/esm/form/index.js +0 -3
  651. package/lib/esm/form/index.js.map +0 -1
  652. package/lib/types/code/index.d.ts +0 -0
  653. package/lib/types/core/components/Input.d.ts +0 -8
  654. package/lib/types/form/index.d.ts +0 -0
  655. package/lib/vertesia-ui-code.js +0 -2
  656. package/lib/vertesia-ui-code.js.map +0 -1
  657. package/lib/vertesia-ui-form.js +0 -2
  658. package/lib/vertesia-ui-form.js.map +0 -1
  659. package/src/code/index.ts +0 -1
  660. package/src/core/components/Input.tsx +0 -43
  661. package/src/form/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js","esm/widgets/json-view/JSONCode.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/codemirror/CodemirrorStateSingleton.js","esm/widgets/codemirror/CodeMirrorEditor.js","esm/widgets/schema-editor/JSONSchemaEditorModal.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/fields.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js"],"sourcesContent":["export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"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\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { isEqual } from 'lodash-es';\nimport { useEffect, useMemo, useState } from 'react';\nimport { defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n const [theme, setTheme] = useState(() => ({ ...defaultTheme, ...customTheme }));\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n useEffect(() => {\n setTheme((currentTheme) => {\n const nextTheme = { ...defaultTheme, ...customTheme };\n return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;\n });\n }, [customTheme]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ObjectWalker } from \"@vertesia/json\";\nimport { useEffect, useState } from \"react\";\nconst st_code = \"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono\";\nconst st_punct = \"text-pink-500 dark:text-pink-400\";\nconst st_symbol = \"text-purple-500 dark:text-purple-400\";\nconst st_number = \"text-green-500 dark:text-green-400\";\nconst st_string = \"text-orange-500 dark:text-orange-400\";\nconst st_key = \"text-blue-500 dark:text-blue-400\";\nconst defaultClassMap = {\n code: st_code,\n comma: st_punct,\n assign: st_punct,\n startObject: st_punct,\n endObject: st_punct,\n startArray: st_punct,\n endArray: st_punct,\n boolean: st_symbol,\n null: st_symbol,\n key: st_key,\n index: st_key,\n string: st_string,\n number: st_number,\n};\nclass Block {\n renderer;\n parent;\n key;\n indent;\n result = [];\n constructor(renderer, parent, key, indent) {\n this.renderer = renderer;\n this.parent = parent;\n this.key = key;\n this.indent = indent;\n }\n get classMap() {\n return this.renderer.classMap;\n }\n writeKey(key) {\n const type = typeof key;\n if (type === 'string') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n this.result.push(`<span class=\"${this.classMap.key}\">\"${key}\"</span><span class='${this.classMap.assign}'>: </span>`);\n }\n else if (type === 'number') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n }\n }\n pushValue(key, value) {\n this.writeKey(key);\n if (value === null) {\n this.result.push(`<span class='${this.classMap.null}'>null</span>`);\n }\n else if (value instanceof Block) {\n this.result.push(value.renderStart() + value.renderValue() + value.renderEnd());\n }\n else {\n let valueClass;\n const type = typeof value;\n if (type === 'string') {\n value = `\"${value}\"`;\n value = value.replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n valueClass = this.classMap.string;\n }\n else if (type === 'number') {\n valueClass = this.classMap.number;\n }\n else if (type === 'boolean') {\n valueClass = this.classMap.boolean;\n }\n this.result.push(`<span class='${valueClass}'>${value}</span>`);\n }\n }\n renderValue() {\n return this.result.join('');\n }\n}\nclass ObjectBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startObject}'>{\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endObject}'>${NL}${this.parent?.indent || ''}}</span>`;\n }\n}\nclass ArrayBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startArray}'>[\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endArray}'>${NL}${this.parent?.indent || ''}]</span>`;\n }\n}\nclass JsonRenderer {\n classMap;\n tab;\n stack = [];\n block = new ObjectBlock(this, undefined, '', '');\n constructor(classMap = defaultClassMap, tab = ' ') {\n this.classMap = classMap;\n this.tab = tab;\n }\n onStartObject(key) {\n const nested = new ObjectBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndObject() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onStartIteration(key) {\n const nested = new ArrayBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndIteration() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onValue(key, value) {\n this.block.pushValue(key, value);\n }\n}\nfunction renderJson(json, classMap, className) {\n const renderer = new JsonRenderer(classMap);\n new ObjectWalker().walk(json, renderer);\n const out = renderer.block.renderValue();\n return _jsx(\"div\", { className: className, dangerouslySetInnerHTML: { __html: `<div class='${renderer.classMap.code}' style='overflow-x: scroll'>${out}</div>` } });\n}\nexport function JSONCode({ data, className, classMap }) {\n const [element, setElement] = useState();\n useEffect(() => {\n setElement(renderJson(data, classMap, className));\n }, [data]);\n return element;\n}\n//# sourceMappingURL=JSONCode.js.map","import Ajv from \"ajv\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: { type: 'any' } };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.validator = new Ajv({ strict: false }).compile(this.schema);\n this.load();\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return true;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = { type: 'any' };\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onCHnage only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { EditorState, Text } from '@codemirror/state';\nlet stateInstance = null;\n/**\n * Returns a shared instance of CodeMirror's EditorState.\n * If the instance doesn't exist, it creates one with the given initial content.\n *\n * @param initialDoc - The initial content for the editor, either as a `string` or `Text`.\n * @param extensions - Optional extensions to be applied to the editor.\n * @returns The shared EditorState instance.\n**/\nexport const getSharedEditorState = (initialDoc = \"\", extensions = []) => {\n const doc = typeof initialDoc === \"string\" ? Text.of(initialDoc.split(\"\\n\")) : initialDoc;\n if (!stateInstance) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n else if (stateInstance.doc.toString() !== doc.toString()) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n return stateInstance;\n};\n/**\n * Resets the singleton instance (useful for testing or reinitializing).\n**/\nexport const resetSharedEditorState = () => {\n stateInstance = null;\n};\n//# sourceMappingURL=CodemirrorStateSingleton.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport debounce from 'debounce';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { EditorView } from '@codemirror/view';\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { getSharedEditorState } from './CodemirrorStateSingleton';\nexport class EditorApi {\n editor;\n constructor(editor) {\n this.editor = editor;\n }\n setValue(value) {\n this.editor.dispatch({\n changes: {\n from: 0,\n to: this.editor.state.doc.length,\n insert: value || \"\",\n },\n });\n }\n getValue() {\n return this.editor.state.doc.toString();\n }\n}\nconst customTheme = EditorView.theme({\n \"&\": { fontSize: \"16px\", fontFamily: \"Sans-Serif\" },\n \".cm-content\": { fontFamily: \"inherit\" },\n \".cm-scroller\": { fontFamily: \"inherit\" },\n \".cm-gutters\": { backgroundColor: \"transparent\", color: \"#ddd\" },\n \".cm-focused\": { outline: \"none\" },\n \".cm-cursor\": {\n borderLeft: \"2px solid #000\",\n borderLeftColor: \"#000\",\n animation: \"blink 1.2s step-start infinite\"\n },\n \"@keyframes blink\": { \"50%\": { opacity: 0 } }\n});\nconst baseExtensions = [\n customTheme,\n EditorView.lineWrapping,\n];\nfunction updateListenerExtension(cb) {\n return EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n cb(update);\n }\n });\n}\n;\n/**\n * The className is only used on the first rendering - the editor class will not be updated if the property changes\n**/\nexport function CodeMirrorEditor({ onChange, value, className, editorRef, extensions, debounceTimeout = 0 }) {\n const ref = useRef(null);\n // the onChange property may change so we need to store it in a\n // reference to be able to update it when it changes without\n // re-registering the listener on codemirror since codemirror can only register\n // listeners at creation\n const onChangeRef = useRef(undefined);\n useEffect(() => {\n if (onChange) {\n onChangeRef.current = debounceTimeout > 0\n ? debounce(onChange, debounceTimeout)\n : onChange;\n return () => {\n // WE MUST NOT CANCEL THE DEBOUNCE even if we unset the onChange impl\n // otherwise some updates will never happens\n onChangeRef.current = undefined;\n };\n }\n }, [onChange, debounceTimeout]);\n const component = useMemo(() => _jsx(\"div\", { ref: ref, className: className }), [className]);\n useSafeLayoutEffect(() => {\n if (ref.current) {\n let actualExtensions = [...baseExtensions, updateListenerExtension((update) => {\n onChangeRef.current?.(update);\n })];\n if (Array.isArray(extensions)) {\n actualExtensions = actualExtensions.concat(extensions);\n }\n else if (extensions) {\n actualExtensions.push(extensions);\n }\n const sharedState = getSharedEditorState(value, actualExtensions);\n const editor = new EditorView({\n state: sharedState,\n parent: ref.current,\n });\n const api = new EditorApi(editor);\n if (editorRef) {\n editorRef.current = api;\n }\n return () => {\n editor.destroy();\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }\n }, [component, extensions]);\n return component;\n}\n//# sourceMappingURL=CodeMirrorEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { json } from \"@codemirror/lang-json\";\nimport { CodeMirrorEditor } from \"../codemirror\";\nimport { Button, VModal, VModalBody, VModalFooter, VModalTitle } from \"@vertesia/ui/core\";\nimport { useToast } from \"@vertesia/ui/core\";\nimport { basicSetup } from \"codemirror\";\nimport { useMemo, useRef } from \"react\";\nimport { JSONCode } from '../json-view';\nfunction contentToJSON(content) {\n if (!content)\n return undefined;\n content = content.trim();\n if (!content)\n return undefined;\n return JSON.parse(content);\n}\nfunction jsonToContent(json) {\n if (!json)\n return '';\n return JSON.stringify(json, null, 2);\n}\nconst extensions = [basicSetup, json()];\nexport function JSONSchemaEditorModal({ schema, isOpen, onClose, readonly = false }) {\n const editorRef = useRef(undefined);\n const toast = useToast();\n const value = useMemo(() => {\n return jsonToContent(schema.schema);\n }, [schema]);\n const onSaveChanges = () => {\n if (editorRef.current) {\n const value = editorRef.current.getValue();\n try {\n const newSchema = contentToJSON(value);\n schema.replaceSchema(newSchema);\n onClose();\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid JSON Schema',\n description: err.message,\n duration: 5000\n });\n }\n }\n };\n return (_jsxs(VModal, { onClose: onClose, isOpen: !!isOpen, className: 'min-w-[60vw]', children: [_jsx(VModalTitle, { children: \"JSON Schema Editor\" }), _jsx(VModalBody, { children: !readonly ? _jsx(CodeMirrorEditor, { value: value, extensions: extensions, editorRef: editorRef })\n : _jsx(JSONCode, { data: schema.schema || {} }) }), _jsx(VModalFooter, { children: !readonly ? _jsx(Button, { onClick: onSaveChanges, children: \"Save changes\" }) : null })] }));\n}\n//# sourceMappingURL=JSONSchemaEditorModal.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor || schema.format) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n this.schema.format = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(VSelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(VModal, { isOpen: isOpen, onClose: onClose, children: [_jsx(VModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-gray-400', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { Pencil, Trash2 } from 'lucide-react';\nimport { Styles } from '@vertesia/ui/core';\nimport { useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block sm:text-sm sm:leading-6 rounded-md border-0 py-1.5 px-2 text-gray-900 dark:text-slate-50\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-gray-300 dark:hover:ring-slate-600`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-gray-300 dark:ring-slate-600`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'hidden group-hover:block text-gray-400 hover:text-gray-600 dark:text-gray-600 dark:hover:text-gray-400';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(\"button\", { className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(\"button\", { className: btnStyle, onClick: onEdit, children: _jsx(Pencil, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(\"button\", { className: \"ml-1 py-2 flex items-center text-gray-400 hover:text-indigo-600\", onClick: add, children: [_jsx(Plus, { className: 'size-5' }), _jsx(\"div\", { className: 'ml-2', children: \"Add property\" })] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nclass FormContext {\n object;\n components;\n constructor(object, components = {}) {\n this.object = object;\n this.components = components;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function FormLabel({ htmlFor, required, children }) {\n return (_jsxs(\"label\", { htmlFor: htmlFor, className: \"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200\", children: [children, required && _jsx(\"sup\", { className: \"text-red-600\", children: \"*\" })] }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { FormContextProvider, useForm } from \"./FormContext.js\";\nimport { FormLabel, FormHelper } from \"./fields.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: {\n object,\n components: components || {}\n }, children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\n// interface FieldSetProps {\n// name: string;\n// children?: ReactNode | ReactNode[];\n// }\n// export function FieldSet({ name, children }: FieldSetProps) {\n// const ctx = useForm();\n// const newCtx = {\n// ...ctx,\n// object: ctx.object.getProperty(name) as ManagedObjectProperty\n// }\n// return (\n// <FormContextProvider value={newCtx}>\n// {children}\n// </FormContextProvider>\n// )\n// }\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n const { value } = event.target;\n object.value = object.schema.isNumber ? parseFloat(value) : value;\n };\n return (_jsxs(\"div\", { className: \"\", children: [_jsxs(\"div\", { className: clsx('flex gap-2', inline ? 'flex-row items-center' : 'flex-col'), children: [!object.isListItem && _jsx(FormLabel, { required: object.schema.isRequired, children: object.title }), _jsx(Component, { object: object, type: inputType, onChange: handleOnChange })] }), object.schema.description && _jsx(FormHelper, { children: object.schema.description })] }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"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: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const addItem = () => {\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"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: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index) }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'soft', onClick: addItem, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'soft', onClick: onDelete, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map"],"names":["ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","fontFamily","XMLViewerContext","createContext","theme","collapsible","indentSize","useXMLViewerContext","useContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","props","indentation","children","isInline","_jsxs","style","color","_jsx","CollapseIcon","collapsed","position","right","border","padding","background","Caret","fill","transform","transition","attrs","width","height","viewBox","d","useCollapsible","level","initialCollapsedDepth","setCollapsed","useState","isNil","useEffect","buttonProps","onClick","currentCollapsed","role","cursor","CommentTag","Attributes","attributes","Object","entries","map","key","value","DeclarationTag","tagKey","slice","hasBreakLines","elements","includes","getTagProps","element","elementWithoutAttributes","omit","subElements","type","startsWith","getTagType","hasAttributes","keys","length","Tag","hasChildren","_Fragment","TextElement","hasSiblings","text","isText","undefined","split","filter","trim","line","index","Elements","Array","isArray","size","join","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","setTheme","json","valid","useMemo","XMLValidator","validate","Error","parse","e","errorMessage","message","useXMLViewer","context","currentTheme","nextTheme","isEqual","Provider","className","whiteSpace","overflowWrap","st_punct","st_symbol","st_key","defaultClassMap","code","comma","assign","startObject","endObject","startArray","endArray","boolean","null","string","number","Block","renderer","parent","indent","result","constructor","this","classMap","writeKey","push","pushValue","renderStart","renderValue","renderEnd","valueClass","replace","ObjectBlock","super","NL","ArrayBlock","JsonRenderer","tab","stack","block","onStartObject","nested","onEndObject","currentBlock","pop","onStartIteration","onEndIteration","onValue","JSONCode","data","setElement","ObjectWalker","walk","out","dangerouslySetInnerHTML","__html","renderJson","Schema","schema","properties","validator","Ajv","strict","compile","load","forEach","name","loadProperty","hasProperties","title","description","propertySchema","property","ArrayPropertySchema","PropertySchema","errors","addProperty","typeOrSchema","isRequired","items","removeProperty","required","x","getProperty","editor","isMulti","isReadOnly","readOnly","defaultValue","default","enum","values","concat","remove","isBoolean","isString","isNumber","isObject","arraySchema","getArrayElementType","computeTitleFromName","toUpperCase","getInputType","_name","Node","observer","isRoot","root","path","isScalar","isListItem","isList","onChange","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","Symbol","iterator","ManagedObject","_v","add","newItem","ManageObjectEntry","ManagedScalarEntry","item","splice","i","l","String","Date","now","JSONView","PropertyElement","PropertyTitle","BlockElement","clsx","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","itemMediumLength","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","stateInstance","EditorApi","setValue","dispatch","changes","from","to","state","doc","insert","getValue","toString","baseExtensions","EditorView","fontSize","backgroundColor","outline","borderLeft","borderLeftColor","animation","opacity","lineWrapping","CodeMirrorEditor","editorRef","extensions","debounceTimeout","ref","useRef","onChangeRef","current","debounce","component","useSafeLayoutEffect","actualExtensions","cb","update","updateListener","of","docChanged","sharedState","initialDoc","Text","EditorState","create","getSharedEditorState","api","destroy","basicSetup","JSONSchemaEditorModal","isOpen","onClose","readonly","toast","useToast","JSON","stringify","jsonToContent","VModal","VModalTitle","VModalBody","VModalFooter","Button","newSchema","contentToJSON","replaceSchema","err","status","duration","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","format","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","child","findAvailableChildName","prefix","addChild","addRequired","c","updated","newName","newProperties","setPropertyName","indexOf","setRequireProperty","actualType","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","endsWith","substring","object","parseTypeSignature","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","options","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","variant","AlignLeft","EditDescriptionModal","focus","onKeyUp","target","Styles","INPUT_UNSTYLED","display","VSelectBox","onBlur","onKeyDown","popupClass","EditDescriptionModalForm","currentValue","setCurrentValue","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","onDelete","outlineOnHover","editOnClick","placeholder","viewer","skipClickOutside","isEditing","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","Trash2","Pencil","Editor","actualValue","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","stopPropagation","autoSave","clearTimeout","setTimeout","closest","SchemaEditor","prop","renderProperty","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","test","editableProp","Plus","FieldSetContext","FieldSetContextProvider","useFieldSet","ctx","_FormContext","useForm","FormContextProvider","FormLabel","htmlFor","FormHelper","FormError","Input","React","forwardRef","booleanValue","setBooleanValue","INPUT","_onChange","ev","checked","Form","components","onSubmit","evt","preventDefault","GeneratedFormFields","GeneratedForm","ListField","CompositeField","ScalarField","inline","Component","inputType","event","parseFloat","ListItem","list","deleteItem"],"mappings":"27BAA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AQwDzC,SAAU,CAACK,EAAKud,EAAM,CAAEtX,UAAW,WAAa,cAC3I,CACA,SAAS0Z,IAASC,KAAEA,EAAIlI,OAAEA,EAAM4C,SAAEA,IAC9B,OAAQza,EAAM,MAAO,CAAEoG,UAAW,oBAAqBtG,SAAU,CAACK,EAAK,MAAO,CAAEiG,UAAW,SAAUtG,UA7C7E+c,EA6C0GhF,EA7CpGnM,EA6C4GqU,EAAK/V,OAAOwC,YAAYd,OA5C9JmR,EAAKxP,OACElN,EAAKmf,GAAW,CAAEzH,OAAQgF,IAE5BA,EAAKtQ,SACHpM,EAAKof,GAAgB,CAAE1H,OAAQgF,IAG/B1c,EAAKqf,GAAa,CAAE3H,OAAQgF,EAAMnR,OAAQA,OAqCyHvL,EAAK+T,EAAQ,CAAE6E,QAAS,OAAQnX,QAAS6Y,EAAU3a,SAAUK,EAAK0b,EAAQ,CAAEzV,UAAW,gBA7CzQ,IAA4ByW,EAAMnR,CA8ClC"}
1
+ {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js","esm/widgets/json-view/JSONCode.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/codemirror/CodemirrorStateSingleton.js","esm/widgets/codemirror/CodeMirrorEditor.js","esm/widgets/schema-editor/JSONSchemaEditorModal.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/fields.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js","esm/widgets/properties/PropertiesView.js","esm/widgets/popover/context.js","esm/widgets/popover/slots.js","esm/widgets/popover/Popover.js","esm/widgets/upload/DropZone.js","esm/widgets/upload/UploadResultCategory.js","esm/widgets/upload/UploadSummary.js","esm/widgets/Progress.js"],"sourcesContent":["export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"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\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { isEqual } from 'lodash-es';\nimport { useEffect, useMemo, useState } from 'react';\nimport { defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n const [theme, setTheme] = useState(() => ({ ...defaultTheme, ...customTheme }));\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n useEffect(() => {\n setTheme((currentTheme) => {\n const nextTheme = { ...defaultTheme, ...customTheme };\n return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;\n });\n }, [customTheme]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ObjectWalker } from \"@vertesia/json\";\nimport { useEffect, useState } from \"react\";\nconst st_code = \"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono\";\nconst st_punct = \"text-pink-500 dark:text-pink-400\";\nconst st_symbol = \"text-purple-500 dark:text-purple-400\";\nconst st_number = \"text-green-500 dark:text-green-400\";\nconst st_string = \"text-orange-500 dark:text-orange-400\";\nconst st_key = \"text-blue-500 dark:text-blue-400\";\nconst defaultClassMap = {\n code: st_code,\n comma: st_punct,\n assign: st_punct,\n startObject: st_punct,\n endObject: st_punct,\n startArray: st_punct,\n endArray: st_punct,\n boolean: st_symbol,\n null: st_symbol,\n key: st_key,\n index: st_key,\n string: st_string,\n number: st_number,\n};\nclass Block {\n renderer;\n parent;\n key;\n indent;\n result = [];\n constructor(renderer, parent, key, indent) {\n this.renderer = renderer;\n this.parent = parent;\n this.key = key;\n this.indent = indent;\n }\n get classMap() {\n return this.renderer.classMap;\n }\n writeKey(key) {\n const type = typeof key;\n if (type === 'string') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n this.result.push(`<span class=\"${this.classMap.key}\">\"${key}\"</span><span class='${this.classMap.assign}'>: </span>`);\n }\n else if (type === 'number') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n }\n }\n pushValue(key, value) {\n this.writeKey(key);\n if (value === null) {\n this.result.push(`<span class='${this.classMap.null}'>null</span>`);\n }\n else if (value instanceof Block) {\n this.result.push(value.renderStart() + value.renderValue() + value.renderEnd());\n }\n else {\n let valueClass;\n const type = typeof value;\n if (type === 'string') {\n value = `\"${value}\"`;\n value = value.replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n valueClass = this.classMap.string;\n }\n else if (type === 'number') {\n valueClass = this.classMap.number;\n }\n else if (type === 'boolean') {\n valueClass = this.classMap.boolean;\n }\n this.result.push(`<span class='${valueClass}'>${value}</span>`);\n }\n }\n renderValue() {\n return this.result.join('');\n }\n}\nclass ObjectBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startObject}'>{\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endObject}'>${NL}${this.parent?.indent || ''}}</span>`;\n }\n}\nclass ArrayBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startArray}'>[\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endArray}'>${NL}${this.parent?.indent || ''}]</span>`;\n }\n}\nclass JsonRenderer {\n classMap;\n tab;\n stack = [];\n block = new ObjectBlock(this, undefined, '', '');\n constructor(classMap = defaultClassMap, tab = ' ') {\n this.classMap = classMap;\n this.tab = tab;\n }\n onStartObject(key) {\n const nested = new ObjectBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndObject() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onStartIteration(key) {\n const nested = new ArrayBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndIteration() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onValue(key, value) {\n this.block.pushValue(key, value);\n }\n}\nfunction renderJson(json, classMap, className) {\n const renderer = new JsonRenderer(classMap);\n new ObjectWalker().walk(json, renderer);\n const out = renderer.block.renderValue();\n return _jsx(\"div\", { className: className, dangerouslySetInnerHTML: { __html: `<div class='${renderer.classMap.code}' style='overflow-x: scroll'>${out}</div>` } });\n}\nexport function JSONCode({ data, className, classMap }) {\n const [element, setElement] = useState();\n useEffect(() => {\n setElement(renderJson(data, classMap, className));\n }, [data]);\n return element;\n}\n//# sourceMappingURL=JSONCode.js.map","import Ajv from \"ajv\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: {} };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n _validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.load();\n }\n get validator() {\n if (!this._validator) {\n const ajv = new Ajv({ allErrors: true, strict: false });\n this._validator = ajv.compile(this.schema);\n }\n return this._validator;\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return null;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = {};\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onCHnage only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { EditorState, Text } from '@codemirror/state';\nlet stateInstance = null;\n/**\n * Returns a shared instance of CodeMirror's EditorState.\n * If the instance doesn't exist, it creates one with the given initial content.\n *\n * @param initialDoc - The initial content for the editor, either as a `string` or `Text`.\n * @param extensions - Optional extensions to be applied to the editor.\n * @returns The shared EditorState instance.\n**/\nexport const getSharedEditorState = (initialDoc = \"\", extensions = []) => {\n const doc = typeof initialDoc === \"string\" ? Text.of(initialDoc.split(\"\\n\")) : initialDoc;\n if (!stateInstance) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n else if (stateInstance.doc.toString() !== doc.toString()) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n return stateInstance;\n};\n/**\n * Resets the singleton instance (useful for testing or reinitializing).\n**/\nexport const resetSharedEditorState = () => {\n stateInstance = null;\n};\n//# sourceMappingURL=CodemirrorStateSingleton.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport debounce from 'debounce';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { EditorView } from '@codemirror/view';\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { getSharedEditorState } from './CodemirrorStateSingleton';\nexport class EditorApi {\n editor;\n constructor(editor) {\n this.editor = editor;\n }\n setValue(value) {\n this.editor.dispatch({\n changes: {\n from: 0,\n to: this.editor.state.doc.length,\n insert: value || \"\",\n },\n });\n }\n getValue() {\n return this.editor.state.doc.toString();\n }\n}\nconst customTheme = EditorView.theme({\n \"&\": { fontSize: \"14px\", fontFamily: \"monospace\" },\n \".cm-content\": { fontFamily: \"inherit\" },\n \".cm-scroller\": { fontFamily: \"inherit\" },\n \".cm-gutters\": { backgroundColor: \"transparent\", color: \"#ddd\" },\n \".cm-focused\": { outline: \"none\" },\n \".cm-cursor\": {\n borderLeft: \"2px solid #000\",\n borderLeftColor: \"#000\",\n animation: \"blink 1.2s step-start infinite\"\n },\n \"@keyframes blink\": { \"50%\": { opacity: 0 } }\n});\nconst baseExtensions = [\n customTheme,\n EditorView.lineWrapping,\n];\nfunction updateListenerExtension(cb) {\n return EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n cb(update);\n }\n });\n}\n;\n/**\n * The className is only used on the first rendering - the editor class will not be updated if the property changes\n**/\nexport function CodeMirrorEditor({ onChange, value, className, editorRef, extensions, debounceTimeout = 0 }) {\n const ref = useRef(null);\n // the onChange property may change so we need to store it in a\n // reference to be able to update it when it changes without\n // re-registering the listener on codemirror since codemirror can only register\n // listeners at creation\n const onChangeRef = useRef(undefined);\n useEffect(() => {\n if (onChange) {\n onChangeRef.current = debounceTimeout > 0\n ? debounce(onChange, debounceTimeout)\n : onChange;\n return () => {\n // WE MUST NOT CANCEL THE DEBOUNCE even if we unset the onChange impl\n // otherwise some updates will never happens\n onChangeRef.current = undefined;\n };\n }\n }, [onChange, debounceTimeout]);\n const component = useMemo(() => _jsx(\"div\", { ref: ref, className: className }), [className]);\n useSafeLayoutEffect(() => {\n if (ref.current) {\n let actualExtensions = [...baseExtensions, updateListenerExtension((update) => {\n onChangeRef.current?.(update);\n })];\n if (Array.isArray(extensions)) {\n actualExtensions = actualExtensions.concat(extensions);\n }\n else if (extensions) {\n actualExtensions.push(extensions);\n }\n const sharedState = getSharedEditorState(value, actualExtensions);\n const editor = new EditorView({\n state: sharedState,\n parent: ref.current,\n });\n const api = new EditorApi(editor);\n if (editorRef) {\n editorRef.current = api;\n }\n return () => {\n editor.destroy();\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }\n }, [component, extensions]);\n return component;\n}\n//# sourceMappingURL=CodeMirrorEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { json } from \"@codemirror/lang-json\";\nimport { CodeMirrorEditor } from \"../codemirror\";\nimport { Button, VModal, VModalBody, VModalFooter, VModalTitle, useToast } from \"@vertesia/ui/core\";\nimport { basicSetup } from \"codemirror\";\nimport { useMemo, useRef } from \"react\";\nimport { JSONCode } from '../json-view';\nfunction contentToJSON(content) {\n if (!content)\n return undefined;\n content = content.trim();\n if (!content)\n return undefined;\n return JSON.parse(content);\n}\nfunction jsonToContent(json) {\n if (!json)\n return '';\n return JSON.stringify(json, null, 2);\n}\nconst extensions = [basicSetup, json()];\nexport function JSONSchemaEditorModal({ schema, isOpen, onClose, readonly = false }) {\n const editorRef = useRef(undefined);\n const toast = useToast();\n const value = useMemo(() => {\n return jsonToContent(schema.schema);\n }, [schema]);\n const onSaveChanges = () => {\n if (editorRef.current) {\n const value = editorRef.current.getValue();\n try {\n const newSchema = contentToJSON(value);\n schema.replaceSchema(newSchema);\n onClose();\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid JSON Schema',\n description: err.message,\n duration: 5000\n });\n }\n }\n };\n return (_jsxs(VModal, { onClose: onClose, isOpen: !!isOpen, className: 'min-w-[60vw]', children: [_jsx(VModalTitle, { children: \"JSON Schema Editor\" }), _jsx(VModalBody, { children: !readonly ? _jsx(CodeMirrorEditor, { value: value, extensions: extensions, editorRef: editorRef })\n : _jsx(JSONCode, { data: schema.schema || {} }) }), _jsx(VModalFooter, { children: !readonly ? _jsx(Button, { onClick: onSaveChanges, children: \"Save changes\" }) : null })] }));\n}\n//# sourceMappingURL=JSONSchemaEditorModal.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor || schema.format) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n this.schema.format = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(VSelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(VModal, { isOpen: isOpen, onClose: onClose, children: [_jsx(VModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-muted', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { SquarePen, Trash2 } from 'lucide-react';\nimport { Button, Styles, useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-ring`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { className: \"\", children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'invisible group-hover:visible';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onEdit, children: _jsx(SquarePen, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { Button, useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: add, children: [_jsx(Plus, { className: 'size-4' }), \"Add property\"] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nclass FormContext {\n object;\n components;\n constructor(object, components = {}) {\n this.object = object;\n this.components = components;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function FormLabel({ htmlFor, required, children }) {\n return (_jsxs(\"label\", { htmlFor: htmlFor, className: \"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200\", children: [children, required && _jsx(\"sup\", { className: \"text-red-600\", children: \"*\" })] }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { FormContextProvider, useForm } from \"./FormContext.js\";\nimport { FormLabel, FormHelper } from \"./fields.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: {\n object,\n components: components || {}\n }, children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\n// interface FieldSetProps {\n// name: string;\n// children?: ReactNode | ReactNode[];\n// }\n// export function FieldSet({ name, children }: FieldSetProps) {\n// const ctx = useForm();\n// const newCtx = {\n// ...ctx,\n// object: ctx.object.getProperty(name) as ManagedObjectProperty\n// }\n// return (\n// <FormContextProvider value={newCtx}>\n// {children}\n// </FormContextProvider>\n// )\n// }\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n const { value } = event.target;\n object.value = object.schema.isNumber ? parseFloat(value) : value;\n };\n return (_jsxs(\"div\", { className: \"\", children: [_jsxs(\"div\", { className: clsx('flex gap-2', inline ? 'flex-row items-center' : 'flex-col'), children: [!object.isListItem && _jsx(FormLabel, { required: object.schema.isRequired, children: object.title }), _jsx(Component, { object: object, type: inputType, onChange: handleOnChange })] }), object.schema.description && _jsx(FormHelper, { children: object.schema.description })] }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"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: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const addItem = () => {\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"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: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index) }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'secondary', onClick: addItem, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'secondary', onClick: onDelete, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Table } from \"@vertesia/ui/core\";\nexport function PropertiesView({ className, properties }) {\n return (_jsx(Table, { className: className, children: _jsx(\"tbody\", { children: properties.map((property) => (_jsxs(\"tr\", { children: [_jsx(\"td\", { className: 'w-1/3 font-semibold', children: _jsx(\"span\", { children: property.name }) }), _jsx(\"td\", { className: 'w-2/3', children: property.value ?? 'undefined' })] }, property.name))) }) }));\n}\n//# sourceMappingURL=PropertiesView.js.map","import { createContext, useContext } from \"react\";\nconst PopoverContext = createContext(undefined);\nexport function usePopoverContext() {\n return useContext(PopoverContext);\n}\nexport { PopoverContext };\n//# sourceMappingURL=context.js.map","import { Children, isValidElement } from \"react\";\nconst __SLOT_NAME = Symbol('__SLOT_NAME');\nexport function processOneSlot(child, out, slots) {\n let slotName;\n if (isValidElement(child) && (slotName = child.type[__SLOT_NAME])) {\n slots[slotName] = child;\n }\n else {\n out.push(child);\n }\n}\nexport function processSlots(children, slots) {\n const out = [];\n Children.forEach(children, child => {\n processOneSlot(child, out, slots);\n });\n return out.length > 1 ? out : out[0];\n}\nexport function defineSlot(name, component) {\n component[__SLOT_NAME] = name;\n}\n//# sourceMappingURL=slots.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { flip, offset, shift } from \"@floating-ui/dom\";\nimport { FloatingFocusManager, FloatingPortal, autoUpdate, safePolygon, useClick, useDismiss, useFloating, useHover, useInteractions, useTransitionStyles } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { PopoverContext } from \"./context\";\nimport { defineSlot, processSlots } from \"./slots\";\nfunction computeElementProps(value) {\n if (!value)\n return { enabled: false };\n return (typeof value === 'boolean' ? { enabled: value } : value);\n}\nfunction getHoverProps(props) {\n return props?.hover === true ? {\n enabled: true,\n handleClose: safePolygon({ blockPointerEvents: true }),\n restMs: 0,\n } : props?.hover;\n}\nfunction getClickProps(props) {\n return props && !props.hover && !props.click ? {\n enabled: true,\n } : props?.click;\n}\n/**\n * The component is instantiated when all interactions are known\n * @param param0\n * @returns\n */\nexport function Popover(props) {\n const slots = {};\n processSlots(props.children, slots);\n if (!slots.content) {\n throw new Error('Popover must provide a content slot');\n }\n const triggerProps = slots.trigger?.props;\n const contentProps = slots.content.props;\n // wait for the trigger to be defined\n return _jsx(ResolvedPopover, { ...props, trigger: triggerProps, content: contentProps });\n}\nfunction ResolvedPopover({ middleware, offset: defaultOffset, trigger, dismiss = true, content, placement, strategy, zIndex = 40 }) {\n const [isOpen, setIsOpen] = useState(false);\n const floating = useFloating({\n open: isOpen,\n placement,\n strategy,\n onOpenChange: setIsOpen,\n middleware: middleware || [offset(defaultOffset || 4), shift(), flip()],\n whileElementsMounted: autoUpdate // stick to the anchor when resizing / scrolling\n });\n const { floatingStyles, refs: { setReference, setFloating }, context, } = floating;\n const dismissInteraction = useDismiss(context, computeElementProps(dismiss));\n const clickInteraction = useClick(context, computeElementProps(getClickProps(trigger)));\n const hoverInteraction = useHover(context, computeElementProps(getHoverProps(trigger)));\n const { getReferenceProps, getFloatingProps, } = useInteractions([dismissInteraction, clickInteraction, hoverInteraction]);\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, content.transition);\n return (_jsxs(PopoverContext.Provider, { value: {\n ...floating,\n close: () => setIsOpen(false)\n }, children: [trigger &&\n _jsx(\"div\", { className: clsx(trigger.className, \"inline-block\"), ref: setReference, ...getReferenceProps(), children: trigger.children }), _jsx(FloatingPortal, { children: isMounted && (_jsx(\"div\", { ref: setFloating, style: { ...floatingStyles, zIndex: zIndex }, ...getFloatingProps(), children: _jsx(FloatingFocusManager, { context: context, children: _jsx(\"div\", { className: clsx(content.className, \"bg-popover rounded-md text-popover-foreground max-w-md\"), style: transitionStyles, children: content.children }) }) })) })] }));\n}\nfunction PopoverTrigger(_props) {\n return null;\n}\ndefineSlot('trigger', PopoverTrigger);\nfunction PopoverContent(_props) {\n return null;\n}\ndefineSlot('content', PopoverContent);\nPopover.Trigger = PopoverTrigger;\nPopover.Content = PopoverContent;\n//# sourceMappingURL=Popover.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState, useRef } from \"react\";\nimport { UploadIcon } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\n/**\n * A reusable drop zone component for file uploads\n *\n * @example\n * <DropZone\n * onDrop={handleFileSelect}\n * message=\"Drag and drop files here\"\n * buttonLabel=\"Select Files\"\n * />\n */\nexport function DropZone({ onDrop, message, buttonLabel = \"Upload Files\", allowFolders = true, className = \"\" }) {\n const [isDragging, setIsDragging] = useState(false);\n const inputRef = useRef(null);\n const dropZoneRef = useRef(null);\n const handleDragOver = (e) => {\n e.preventDefault();\n if (e.dataTransfer.types.includes('Files')) {\n setIsDragging(true);\n }\n };\n const handleDragLeave = (e) => {\n e.preventDefault();\n // Only set dragging to false if leaving the container (not entering a child)\n if (dropZoneRef.current && !dropZoneRef.current.contains(e.relatedTarget)) {\n setIsDragging(false);\n }\n };\n const handleDrop = async (e) => {\n e.preventDefault();\n setIsDragging(false);\n if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {\n // Handle folders using the DataTransferItemList API which supports directory reading\n const items = Array.from(e.dataTransfer.items);\n const files = [];\n const folders = new Set();\n const processEntry = async (entry) => {\n if (entry.isFile) {\n // Get file\n const file = await new Promise((resolve) => {\n entry.file((file) => {\n // Store full path in the file object for location use\n Object.defineProperty(file, \"webkitRelativePath\", {\n writable: true,\n value: entry.fullPath.substring(1), // Remove leading slash\n });\n resolve(file);\n });\n });\n // Skip hidden files\n if (!file.name.startsWith(\".\") && file.size > 0) {\n files.push(file);\n }\n // Add folder path to tracking\n const folderPath = entry.fullPath.substring(1).split(\"/\").slice(0, -1).join(\"/\");\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n else if (entry.isDirectory) {\n // Get folder reader\n const reader = entry.createReader();\n const entries = await new Promise((resolve) => {\n reader.readEntries((entries) => {\n resolve(entries);\n });\n });\n // Process all entries\n await Promise.all(entries.map(processEntry));\n // Add this folder to tracking\n const folderPath = entry.fullPath.substring(1);\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n };\n try {\n // Process all dropped items\n await Promise.all(items.map((item) => {\n const entry = item.webkitGetAsEntry ? item.webkitGetAsEntry() : item;\n if (entry) {\n return processEntry(entry);\n }\n return Promise.resolve();\n }));\n if (files.length > 0) {\n const topLevelFolders = new Set(Array.from(folders)\n .map((path) => path.split(\"/\")[0])\n .filter(Boolean));\n const folderCount = topLevelFolders.size;\n const fileCount = files.length;\n let message = \"\";\n if (folderCount > 0) {\n message =\n folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n }\n else {\n message = `Preparing to upload ${fileCount} file${fileCount === 1 ? \"\" : \"s\"}...`;\n }\n onDrop(files, { count: files.length, message });\n }\n }\n catch (error) {\n console.error(\"Error processing dropped files:\", error);\n // Fallback to simple file array if folder processing fails\n const fileArray = Array.from(e.dataTransfer.files);\n if (fileArray.length > 0) {\n onDrop(fileArray);\n }\n }\n }\n else if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // Fallback for browsers that don't support items API\n const fileArray = Array.from(e.dataTransfer.files);\n onDrop(fileArray);\n }\n };\n const handleChange = (e) => {\n if (e.target.files && e.target.files.length > 0) {\n const fileArray = Array.from(e.target.files);\n // Check if there are directories (with webkitRelativePath)\n const hasDirectories = fileArray.some((file) => file.webkitRelativePath && file.webkitRelativePath.includes(\"/\"));\n if (hasDirectories) {\n // Count the unique top-level directories\n const topLevelDirs = new Set(fileArray.map((file) => file.webkitRelativePath?.split(\"/\")[0]).filter(Boolean));\n const folderCount = topLevelDirs.size;\n const fileCount = fileArray.length;\n // Create custom message with folder info\n const formattedMessage = folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n const customMessage = {\n count: fileArray.length,\n message: formattedMessage,\n };\n onDrop(fileArray, customMessage);\n }\n else {\n // Regular file upload\n const feedback = {\n count: fileArray.length,\n message: `Preparing to upload ${fileArray.length} file${fileArray.length === 1 ? \"\" : \"s\"}...`,\n };\n onDrop(fileArray, feedback);\n }\n }\n };\n const openFileSelector = () => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n };\n return (_jsxs(\"div\", { className: `flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${isDragging ? \"border-color-primary bg-color-primary/10\" : \"border-dashed border-color-border\"} ${className}`, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(UploadIcon, { className: `h-12 w-12 mb-3 transition-colors ${isDragging ? \"text-primary\" : \"text-muted/50\"}` }), _jsx(\"p\", { className: \"text-color-muted-foreground\", children: message }), _jsxs(\"div\", { className: \"mt-4 text-center\", children: [_jsxs(\"div\", { className: \"text-sm text-muted mb-2\", children: [\"Drag and drop files\", allowFolders ? \" or folders\" : \"\", \" here, or\"] }), _jsxs(Button, { onClick: openFileSelector, children: [_jsx(UploadIcon, { className: \"h-4 w-4 mr-2\" }), buttonLabel] }), _jsx(\"input\", { type: \"file\", ref: inputRef, onChange: handleChange, multiple: true, \n // @ts-expect-error: webkitdirectory is a non-standard attribute\n webkitdirectory: allowFolders ? \"\" : undefined, directory: allowFolders ? \"\" : undefined, className: \"hidden\" })] })] }));\n}\n//# sourceMappingURL=DropZone.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon } from \"lucide-react\";\nimport { useState } from \"react\";\n/**\n * Displays a collapsible category of upload results\n *\n * @example\n * <UploadResultCategory\n * title=\"Successfully Uploaded\"\n * count={3}\n * icon={<CheckCircleIcon className=\"h-4 w-4 text-green-500\" />}\n * items={[\"document1.pdf\", \"document2.pdf\", \"document3.pdf\"]}\n * />\n */\nexport function UploadResultCategory({ title, count, icon = _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items }) {\n const [isExpanded, setIsExpanded] = useState(false);\n return (_jsxs(\"div\", { className: \"border border-color-border rounded-md overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer\", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"span\", { className: \"mr-2\", children: icon }), _jsx(\"span\", { className: \"font-medium\", children: title }), _jsx(\"span\", { className: \"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs\", children: count })] }), _jsx(\"button\", { className: \"text-muted\", children: _jsx(\"svg\", { className: `h-5 w-5 transition-transform ${isExpanded ? 'transform rotate-180' : ''}`, fill: \"none\", viewBox: \"0 0 24 24\", stroke: \"currentColor\", children: _jsx(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M19 9l-7 7-7-7\" }) }) })] }), isExpanded && (_jsx(\"div\", { className: \"p-3 border-t border-color-border max-h-48 overflow-y-auto\", children: items.length > 0 ? (_jsx(\"ul\", { className: \"space-y-1\", children: items.map((item, index) => (_jsx(\"li\", { className: \"text-sm py-1 px-2 rounded hover:bg-color-muted/10\", children: item }, index))) })) : (_jsx(\"div\", { className: \"text-sm text-muted py-2\", children: \"No items to display\" })) }))] }));\n}\n//# sourceMappingURL=UploadResultCategory.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from \"lucide-react\";\nimport { UploadResultCategory } from \"./UploadResultCategory\";\n/**\n * Displays a summary of upload results with collapsible categories\n *\n * @example\n * <UploadSummary\n * files={[\n * { name: \"document1.pdf\", status: \"success\" },\n * { name: \"document2.pdf\", status: \"skipped\" }\n * ]}\n * location=\"/reports/2023\"\n * />\n */\nexport function UploadSummary({ files, className = \"\", location, collection }) {\n // Group files by status\n const successFiles = files.filter(f => f.status === 'success');\n const updatedFiles = files.filter(f => f.status === 'updated');\n const skippedFiles = files.filter(f => f.status === 'skipped');\n const failedFiles = files.filter(f => f.status === 'failed');\n // Calculate counts\n const successCount = successFiles.length;\n const updatedCount = updatedFiles.length;\n const skippedCount = skippedFiles.length;\n const failedCount = failedFiles.length;\n const totalCount = files.length;\n return (_jsxs(\"div\", { className: `flex flex-col py-6 ${className}`, children: [_jsxs(\"div\", { className: \"flex items-center mb-4\", children: [_jsx(\"div\", { className: \"w-12 h-12 mr-4 rounded-full bg-color-success/10 flex items-center justify-center\", children: _jsx(CheckCircleIcon, { className: \"h-6 w-6 text-color-success\" }) }), _jsxs(\"div\", { children: [_jsx(\"p\", { className: \"text-lg font-medium text-color-success\", children: \"Upload Complete\" }), _jsxs(\"p\", { className: \"text-muted\", children: [totalCount, \" file\", totalCount !== 1 ? \"s\" : \"\", \" processed\", collection ? ` in collection '${collection}'` : \"\", location ? ` in folder '${location}'` : \"\"] })] })] }), _jsxs(\"div\", { className: \"space-y-3 mt-2\", children: [successCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Uploaded\", count: successCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items: successFiles.map(f => f.name) })), updatedCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Updated\", count: updatedCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-blue-500\" }), items: updatedFiles.map(f => f.name) })), skippedCount > 0 && (_jsx(UploadResultCategory, { title: \"Skipped (Already Existed)\", count: skippedCount, icon: _jsx(AlertCircleIcon, { className: \"h-4 w-4 text-amber-500\" }), items: skippedFiles.map(f => f.name) })), failedCount > 0 && (_jsx(UploadResultCategory, { title: \"Failed to Upload\", count: failedCount, icon: _jsx(XCircleIcon, { className: \"h-4 w-4 text-red-500\" }), items: failedFiles.map(f => f.name) }))] })] }));\n}\n//# sourceMappingURL=UploadSummary.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function Progress({ percent }) {\n return (_jsx(\"div\", { className: \"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700\", children: _jsx(\"div\", { className: \"bg-blue-600 h-2.5 rounded-full\", style: { width: `${percent}%` } }) }));\n}\n//# sourceMappingURL=Progress.js.map"],"names":["ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","fontFamily","XMLViewerContext","createContext","theme","collapsible","indentSize","useXMLViewerContext","useContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","props","indentation","children","isInline","_jsxs","style","color","_jsx","CollapseIcon","collapsed","position","right","border","padding","background","Caret","fill","transform","transition","attrs","width","height","viewBox","d","useCollapsible","level","initialCollapsedDepth","setCollapsed","useState","isNil","useEffect","buttonProps","onClick","currentCollapsed","role","cursor","CommentTag","Attributes","attributes","Object","entries","map","key","value","DeclarationTag","tagKey","slice","hasBreakLines","elements","includes","getTagProps","element","elementWithoutAttributes","omit","subElements","type","startsWith","getTagType","hasAttributes","keys","length","Tag","hasChildren","_Fragment","TextElement","hasSiblings","text","isText","undefined","split","filter","trim","line","index","Elements","Array","isArray","size","join","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","setTheme","json","valid","useMemo","XMLValidator","validate","Error","parse","e","errorMessage","message","useXMLViewer","context","currentTheme","nextTheme","isEqual","Provider","className","whiteSpace","overflowWrap","st_punct","st_symbol","st_key","defaultClassMap","code","comma","assign","startObject","endObject","startArray","endArray","boolean","null","string","number","Block","renderer","parent","indent","result","constructor","this","classMap","writeKey","push","pushValue","renderStart","renderValue","renderEnd","valueClass","replace","ObjectBlock","super","NL","ArrayBlock","JsonRenderer","tab","stack","block","onStartObject","nested","onEndObject","currentBlock","pop","onStartIteration","onEndIteration","onValue","JSONCode","data","setElement","ObjectWalker","walk","out","dangerouslySetInnerHTML","__html","renderJson","Schema","schema","properties","_validator","load","validator","ajv","Ajv","allErrors","strict","compile","forEach","name","loadProperty","hasProperties","title","description","propertySchema","property","ArrayPropertySchema","PropertySchema","errors","addProperty","typeOrSchema","isRequired","items","removeProperty","required","x","getProperty","editor","isMulti","isReadOnly","readOnly","defaultValue","default","enum","values","concat","remove","isBoolean","isString","isNumber","isObject","arraySchema","getArrayElementType","computeTitleFromName","toUpperCase","getInputType","_name","Node","observer","isRoot","root","path","isScalar","isListItem","isList","onChange","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","Symbol","iterator","ManagedObject","_v","add","newItem","ManageObjectEntry","ManagedScalarEntry","item","splice","i","l","String","Date","now","JSONView","PropertyElement","PropertyTitle","BlockElement","clsx","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","itemMediumLength","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","stateInstance","EditorApi","setValue","dispatch","changes","from","to","state","doc","insert","getValue","toString","baseExtensions","EditorView","fontSize","backgroundColor","outline","borderLeft","borderLeftColor","animation","opacity","lineWrapping","CodeMirrorEditor","editorRef","extensions","debounceTimeout","ref","useRef","onChangeRef","current","debounce","component","useSafeLayoutEffect","actualExtensions","cb","update","updateListener","of","docChanged","sharedState","initialDoc","Text","EditorState","create","getSharedEditorState","api","destroy","basicSetup","JSONSchemaEditorModal","isOpen","onClose","readonly","toast","useToast","JSON","stringify","jsonToContent","VModal","VModalTitle","VModalBody","VModalFooter","Button","newSchema","contentToJSON","replaceSchema","err","status","duration","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","format","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","child","findAvailableChildName","prefix","addChild","addRequired","c","updated","newName","newProperties","setPropertyName","indexOf","setRequireProperty","actualType","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","endsWith","substring","object","parseTypeSignature","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","options","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","variant","AlignLeft","EditDescriptionModal","focus","onKeyUp","target","Styles","INPUT_UNSTYLED","display","VSelectBox","onBlur","onKeyDown","popupClass","EditDescriptionModalForm","currentValue","setCurrentValue","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","onDelete","outlineOnHover","editOnClick","placeholder","viewer","skipClickOutside","isEditing","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","Trash2","SquarePen","Editor","actualValue","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","stopPropagation","autoSave","clearTimeout","setTimeout","closest","SchemaEditor","prop","renderProperty","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","test","editableProp","Plus","FieldSetContext","FieldSetContextProvider","useFieldSet","ctx","_FormContext","useForm","FormContextProvider","FormLabel","htmlFor","FormHelper","FormError","Input","React","forwardRef","booleanValue","setBooleanValue","INPUT","_onChange","ev","checked","Form","components","onSubmit","evt","preventDefault","GeneratedFormFields","GeneratedForm","ListField","CompositeField","ScalarField","inline","Component","inputType","event","parseFloat","ListItem","list","deleteItem","PropertiesView","Table","PopoverContext","usePopoverContext","__SLOT_NAME","processSlots","slots","Children","slotName","isValidElement","processOneSlot","defineSlot","computeElementProps","enabled","Popover","triggerProps","trigger","contentProps","ResolvedPopover","middleware","offset","defaultOffset","dismiss","placement","strategy","zIndex","setIsOpen","floating","useFloating","open","onOpenChange","shift","flip","whileElementsMounted","autoUpdate","floatingStyles","refs","setReference","setFloating","dismissInteraction","useDismiss","clickInteraction","useClick","hover","click","hoverInteraction","useHover","handleClose","safePolygon","blockPointerEvents","restMs","getHoverProps","getReferenceProps","getFloatingProps","useInteractions","isMounted","styles","transitionStyles","useTransitionStyles","close","FloatingPortal","FloatingFocusManager","PopoverTrigger","_props","PopoverContent","DropZone","onDrop","buttonLabel","allowFolders","isDragging","setIsDragging","inputRef","dropZoneRef","onDragOver","dataTransfer","onDragLeave","contains","relatedTarget","async","files","folders","Set","processEntry","entry","isFile","file","Promise","resolve","defineProperty","writable","fullPath","folderPath","isDirectory","reader","createReader","readEntries","all","webkitGetAsEntry","folderCount","Boolean","fileCount","count","error","console","fileArray","UploadIcon","some","webkitRelativePath","formattedMessage","customMessage","feedback","multiple","webkitdirectory","directory","UploadResultCategory","icon","CheckCircleIcon","isExpanded","setIsExpanded","stroke","strokeLinecap","strokeLinejoin","strokeWidth","UploadSummary","location","collection","successFiles","f","updatedFiles","skippedFiles","failedFiles","successCount","updatedCount","skippedCount","failedCount","totalCount","AlertCircleIcon","XCircleIcon","Progress","percent","Trigger","Content"],"mappings":"y1CAAO,MACMA,GAAiB,QACjBC,GAAoB,WACpBC,GAAkB,SAClBC,GAAkB,kBAElBC,GAAe,CACxBC,SAAU,UACVC,UAAW,OACXC,kBAAmB,UACnBC,oBAAqB,UACrBC,eAAgB,OAChBC,aAAc,OACdC,WAAY,UACZC,WAAY,aCPHC,GAAmBC,EALX,CACjBC,MAAOX,GACPY,aAAa,EACbC,WAAY,IAGHC,GAAsB,IAAMC,EAAWN,ICL9CO,GAAS,IAAIC,EAAU,CACzBC,eAAe,EACfC,kBAAkB,EAClBC,oBAAqB,GACrBC,wBAAwB,EACxBC,gBAAiBzB,GACjB0B,cAAezB,GACf0B,eAAe,ICRZ,SAASC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