@vertesia/ui 0.78.0 → 0.79.1

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 (409) hide show
  1. package/lib/esm/core/components/Panel.js +8 -0
  2. package/lib/esm/core/components/Panel.js.map +1 -0
  3. package/lib/esm/core/components/SelectBox.js +1 -1
  4. package/lib/esm/core/components/SelectBox.js.map +1 -1
  5. package/lib/esm/core/components/SelectList.js +18 -13
  6. package/lib/esm/core/components/SelectList.js.map +1 -1
  7. package/lib/esm/core/components/SidePanel.js +2 -2
  8. package/lib/esm/core/components/SidePanel.js.map +1 -1
  9. package/lib/esm/core/components/index.js +1 -1
  10. package/lib/esm/core/components/index.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/breadcrumb.js +29 -8
  12. package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -1
  13. package/lib/esm/core/components/shadcn/button.js +3 -2
  14. package/lib/esm/core/components/shadcn/button.js.map +1 -1
  15. package/lib/esm/core/components/shadcn/filters/filterBar.js +41 -14
  16. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  17. package/lib/esm/core/components/shadcn/index.js +2 -0
  18. package/lib/esm/core/components/shadcn/index.js.map +1 -1
  19. package/lib/esm/core/components/shadcn/input.js +4 -1
  20. package/lib/esm/core/components/shadcn/input.js.map +1 -1
  21. package/lib/esm/core/components/shadcn/resizeable.js +15 -0
  22. package/lib/esm/core/components/shadcn/resizeable.js.map +1 -0
  23. package/lib/esm/core/components/shadcn/selectBox.js +15 -9
  24. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  25. package/lib/esm/core/components/shadcn/tabs.js +20 -8
  26. package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
  27. package/lib/esm/core/components/shadcn/textarea.js +7 -0
  28. package/lib/esm/core/components/shadcn/textarea.js.map +1 -0
  29. package/lib/esm/core/components/table/index.js +1 -1
  30. package/lib/esm/core/components/table/index.js.map +1 -1
  31. package/lib/esm/core/hooks/CompositeState.js +139 -1
  32. package/lib/esm/core/hooks/CompositeState.js.map +1 -1
  33. package/lib/esm/core/hooks/index.js +1 -0
  34. package/lib/esm/core/hooks/index.js.map +1 -1
  35. package/lib/esm/core/hooks/useScrollableSearch.js +92 -0
  36. package/lib/esm/core/hooks/useScrollableSearch.js.map +1 -0
  37. package/lib/esm/env/index.js +1 -1
  38. package/lib/esm/env/index.js.map +1 -1
  39. package/lib/esm/features/agent/PayloadBuilder.js +80 -55
  40. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  41. package/lib/esm/features/agent/chat/ModernAgentConversation.js +22 -24
  42. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
  43. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +2 -3
  44. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  45. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -2
  46. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  47. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +15 -20
  48. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
  49. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +1 -0
  50. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -1
  51. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +3 -3
  52. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -1
  53. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +6 -6
  54. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
  55. package/lib/esm/features/facets/CollectionsFacetsNav.js +85 -0
  56. package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -0
  57. package/lib/esm/features/facets/DocumentsFacetsNav.js +19 -7
  58. package/lib/esm/features/facets/DocumentsFacetsNav.js.map +1 -1
  59. package/lib/esm/features/facets/EnvironmentFacet.js +1 -1
  60. package/lib/esm/features/facets/EnvironmentFacet.js.map +1 -1
  61. package/lib/esm/features/facets/InteractionsFacetsNav.js +88 -0
  62. package/lib/esm/features/facets/InteractionsFacetsNav.js.map +1 -0
  63. package/lib/esm/features/facets/PromptsFacetsNav.js +80 -0
  64. package/lib/esm/features/facets/PromptsFacetsNav.js.map +1 -0
  65. package/lib/esm/features/facets/RunsFacetsNav.js +28 -6
  66. package/lib/esm/features/facets/RunsFacetsNav.js.map +1 -1
  67. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js +7 -5
  68. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -1
  69. package/lib/esm/features/facets/index.js +10 -8
  70. package/lib/esm/features/facets/index.js.map +1 -1
  71. package/lib/esm/features/facets/utils/SearchInterface.js +2 -0
  72. package/lib/esm/features/facets/utils/SearchInterface.js.map +1 -0
  73. package/lib/esm/features/facets/utils/StringFacet.js.map +1 -0
  74. package/lib/esm/features/facets/utils/StringListFacet.js.map +1 -0
  75. package/lib/esm/features/facets/utils/TypeFacet.js.map +1 -0
  76. package/lib/esm/features/facets/utils/VEnvironmentFacet.js.map +1 -0
  77. package/lib/esm/features/facets/utils/VInteractionFacet.js.map +1 -0
  78. package/lib/esm/features/facets/utils/VStringFacet.js.map +1 -0
  79. package/lib/esm/features/facets/{VTypeFacet.js → utils/VTypeFacet.js} +9 -4
  80. package/lib/esm/features/facets/utils/VTypeFacet.js.map +1 -0
  81. package/lib/esm/features/facets/{VUserFacet.js → utils/VUserFacet.js} +1 -1
  82. package/lib/esm/features/facets/utils/VUserFacet.js.map +1 -0
  83. package/lib/esm/features/facets/utils/utils.js.map +1 -0
  84. package/lib/esm/features/layout/GenericPageNavHeader.js +58 -5
  85. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
  86. package/lib/esm/features/store/collections/BrowseCollectionView.js +3 -0
  87. package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -1
  88. package/lib/esm/features/store/collections/CreateCollection.js +2 -2
  89. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
  90. package/lib/esm/features/store/collections/EditCollectionView.js +43 -31
  91. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  92. package/lib/esm/features/store/collections/SelectCollection.js +46 -16
  93. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
  94. package/lib/esm/features/store/objects/DocumentSearchResults.js +43 -13
  95. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  96. package/lib/esm/features/store/objects/DocumentTable.js +6 -6
  97. package/lib/esm/features/store/objects/DocumentTable.js.map +1 -1
  98. package/lib/esm/features/store/objects/components/ContentOverview.js +225 -87
  99. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  100. package/lib/esm/features/store/objects/components/DocumentIcon.js +11 -3
  101. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
  102. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +11 -2
  103. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
  104. package/lib/esm/features/store/objects/components/useDownloadObject.js +2 -2
  105. package/lib/esm/features/store/objects/components/useDownloadObject.js.map +1 -1
  106. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +13 -1
  107. package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
  108. package/lib/esm/features/store/objects/layout/documentLayout.js +7 -8
  109. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
  110. package/lib/esm/features/store/objects/layout/renderers.js +28 -12
  111. package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
  112. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +5 -1
  113. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  114. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +1 -1
  115. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -1
  116. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +3 -2
  117. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
  118. package/lib/esm/features/store/objects/selection/SelectionActions.js +2 -0
  119. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
  120. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +12 -4
  121. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
  122. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +20 -2
  123. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
  124. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +16 -8
  125. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
  126. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +1 -1
  127. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
  128. package/lib/esm/features/store/types/ObjectSchemaEditor.js +1 -1
  129. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  130. package/lib/esm/features/user/UserInfo.js +35 -1
  131. package/lib/esm/features/user/UserInfo.js.map +1 -1
  132. package/lib/esm/router/HistoryNavigator.js +25 -2
  133. package/lib/esm/router/HistoryNavigator.js.map +1 -1
  134. package/lib/esm/router/Nav.js +3 -3
  135. package/lib/esm/router/Nav.js.map +1 -1
  136. package/lib/esm/session/UserSession.js +1 -0
  137. package/lib/esm/session/UserSession.js.map +1 -1
  138. package/lib/esm/session/UserSessionProvider.js +9 -2
  139. package/lib/esm/session/UserSessionProvider.js.map +1 -1
  140. package/lib/esm/session/auth/composable.js +66 -67
  141. package/lib/esm/session/auth/composable.js.map +1 -1
  142. package/lib/esm/shell/login/UserInfo.js +1 -1
  143. package/lib/esm/shell/login/UserInfo.js.map +1 -1
  144. package/lib/esm/widgets/form/Form.js +17 -30
  145. package/lib/esm/widgets/form/Form.js.map +1 -1
  146. package/lib/esm/widgets/form/FormContext.js +4 -2
  147. package/lib/esm/widgets/form/FormContext.js.map +1 -1
  148. package/lib/esm/widgets/form/ManagedObject.js +4 -0
  149. package/lib/esm/widgets/form/ManagedObject.js.map +1 -1
  150. package/lib/esm/widgets/form/fields.js +4 -3
  151. package/lib/esm/widgets/form/fields.js.map +1 -1
  152. package/lib/esm/widgets/form/inputs.js +2 -0
  153. package/lib/esm/widgets/form/inputs.js.map +1 -1
  154. package/lib/esm/widgets/schema-editor/index.js +0 -1
  155. package/lib/esm/widgets/schema-editor/index.js.map +1 -1
  156. package/lib/tsconfig.tsbuildinfo +1 -1
  157. package/lib/types/core/components/Panel.d.ts +11 -0
  158. package/lib/types/core/components/Panel.d.ts.map +1 -0
  159. package/lib/types/core/components/SelectList.d.ts +2 -1
  160. package/lib/types/core/components/SelectList.d.ts.map +1 -1
  161. package/lib/types/core/components/SidePanel.d.ts.map +1 -1
  162. package/lib/types/core/components/index.d.ts +1 -1
  163. package/lib/types/core/components/index.d.ts.map +1 -1
  164. package/lib/types/core/components/shadcn/breadcrumb.d.ts +3 -2
  165. package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +1 -1
  166. package/lib/types/core/components/shadcn/button.d.ts.map +1 -1
  167. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
  168. package/lib/types/core/components/shadcn/index.d.ts +2 -0
  169. package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
  170. package/lib/types/core/components/shadcn/input.d.ts.map +1 -1
  171. package/lib/types/core/components/shadcn/resizeable.d.ts +9 -0
  172. package/lib/types/core/components/shadcn/resizeable.d.ts.map +1 -0
  173. package/lib/types/core/components/shadcn/selectBox.d.ts +3 -2
  174. package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
  175. package/lib/types/core/components/shadcn/tabs.d.ts +2 -1
  176. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
  177. package/lib/types/core/components/shadcn/textarea.d.ts +4 -0
  178. package/lib/types/core/components/shadcn/textarea.d.ts.map +1 -0
  179. package/lib/types/core/hooks/CompositeState.d.ts +115 -6
  180. package/lib/types/core/hooks/CompositeState.d.ts.map +1 -1
  181. package/lib/types/core/hooks/index.d.ts +1 -0
  182. package/lib/types/core/hooks/index.d.ts.map +1 -1
  183. package/lib/types/core/hooks/useScrollableSearch.d.ts +82 -0
  184. package/lib/types/core/hooks/useScrollableSearch.d.ts.map +1 -0
  185. package/lib/types/env/index.d.ts +3 -1
  186. package/lib/types/env/index.d.ts.map +1 -1
  187. package/lib/types/features/agent/PayloadBuilder.d.ts +11 -19
  188. package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
  189. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  190. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +1 -1
  191. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  192. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  193. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
  194. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -1
  195. package/lib/types/features/facets/CollectionsFacetsNav.d.ts +14 -0
  196. package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -0
  197. package/lib/types/features/facets/DocumentsFacetsNav.d.ts +1 -1
  198. package/lib/types/features/facets/DocumentsFacetsNav.d.ts.map +1 -1
  199. package/lib/types/features/facets/InteractionsFacetsNav.d.ts +14 -0
  200. package/lib/types/features/facets/InteractionsFacetsNav.d.ts.map +1 -0
  201. package/lib/types/features/facets/PromptsFacetsNav.d.ts +15 -0
  202. package/lib/types/features/facets/PromptsFacetsNav.d.ts.map +1 -0
  203. package/lib/types/features/facets/RunsFacetsNav.d.ts +1 -1
  204. package/lib/types/features/facets/RunsFacetsNav.d.ts.map +1 -1
  205. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts +1 -1
  206. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +1 -1
  207. package/lib/types/features/facets/index.d.ts +10 -8
  208. package/lib/types/features/facets/index.d.ts.map +1 -1
  209. package/lib/types/features/facets/utils/SearchInterface.d.ts +14 -0
  210. package/lib/types/features/facets/utils/SearchInterface.d.ts.map +1 -0
  211. package/lib/types/features/facets/utils/StringFacet.d.ts.map +1 -0
  212. package/lib/types/features/facets/utils/StringListFacet.d.ts.map +1 -0
  213. package/lib/types/features/facets/utils/TypeFacet.d.ts.map +1 -0
  214. package/lib/types/features/facets/utils/VEnvironmentFacet.d.ts.map +1 -0
  215. package/lib/types/features/facets/utils/VInteractionFacet.d.ts.map +1 -0
  216. package/lib/types/features/facets/utils/VStringFacet.d.ts.map +1 -0
  217. package/lib/types/features/facets/{VTypeFacet.d.ts → utils/VTypeFacet.d.ts} +2 -1
  218. package/lib/types/features/facets/utils/VTypeFacet.d.ts.map +1 -0
  219. package/lib/types/features/facets/utils/VUserFacet.d.ts.map +1 -0
  220. package/lib/types/features/facets/utils/utils.d.ts.map +1 -0
  221. package/lib/types/features/layout/GenericPageNavHeader.d.ts +2 -1
  222. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  223. package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -1
  224. package/lib/types/features/store/collections/CreateCollection.d.ts.map +1 -1
  225. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
  226. package/lib/types/features/store/collections/SelectCollection.d.ts +12 -8
  227. package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
  228. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  229. package/lib/types/features/store/objects/DocumentTable.d.ts +4 -0
  230. package/lib/types/features/store/objects/DocumentTable.d.ts.map +1 -1
  231. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  232. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +7 -1
  233. package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +1 -1
  234. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +1 -1
  235. package/lib/types/features/store/objects/components/useDownloadObject.d.ts +1 -1
  236. package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +1 -1
  237. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +2 -1
  238. package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts.map +1 -1
  239. package/lib/types/features/store/objects/layout/documentLayout.d.ts +4 -2
  240. package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +1 -1
  241. package/lib/types/features/store/objects/layout/renderers.d.ts +1 -1
  242. package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
  243. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +2 -3
  244. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  245. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
  246. package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
  247. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +1 -0
  248. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
  249. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
  250. package/lib/types/features/user/UserInfo.d.ts +12 -1
  251. package/lib/types/features/user/UserInfo.d.ts.map +1 -1
  252. package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
  253. package/lib/types/router/Nav.d.ts +2 -1
  254. package/lib/types/router/Nav.d.ts.map +1 -1
  255. package/lib/types/session/UserSession.d.ts.map +1 -1
  256. package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
  257. package/lib/types/session/auth/composable.d.ts.map +1 -1
  258. package/lib/types/widgets/form/Form.d.ts +2 -1
  259. package/lib/types/widgets/form/Form.d.ts.map +1 -1
  260. package/lib/types/widgets/form/FormContext.d.ts +5 -2
  261. package/lib/types/widgets/form/FormContext.d.ts.map +1 -1
  262. package/lib/types/widgets/form/ManagedObject.d.ts.map +1 -1
  263. package/lib/types/widgets/form/fields.d.ts +2 -2
  264. package/lib/types/widgets/form/fields.d.ts.map +1 -1
  265. package/lib/types/widgets/form/inputs.d.ts.map +1 -1
  266. package/lib/types/widgets/schema-editor/index.d.ts +0 -1
  267. package/lib/types/widgets/schema-editor/index.d.ts.map +1 -1
  268. package/lib/vertesia-ui-core.js +1 -1
  269. package/lib/vertesia-ui-core.js.map +1 -1
  270. package/lib/vertesia-ui-env.js +1 -1
  271. package/lib/vertesia-ui-env.js.map +1 -1
  272. package/lib/vertesia-ui-features.js +1 -1
  273. package/lib/vertesia-ui-features.js.map +1 -1
  274. package/lib/vertesia-ui-router.js +1 -1
  275. package/lib/vertesia-ui-router.js.map +1 -1
  276. package/lib/vertesia-ui-session.js +1 -1
  277. package/lib/vertesia-ui-session.js.map +1 -1
  278. package/lib/vertesia-ui-shell.js +1 -1
  279. package/lib/vertesia-ui-shell.js.map +1 -1
  280. package/lib/vertesia-ui-widgets.js +1 -1
  281. package/lib/vertesia-ui-widgets.js.map +1 -1
  282. package/package.json +166 -165
  283. package/src/core/components/Panel.tsx +34 -0
  284. package/src/core/components/SelectList.tsx +11 -1
  285. package/src/core/components/SidePanel.tsx +18 -13
  286. package/src/core/components/index.ts +1 -1
  287. package/src/core/components/shadcn/breadcrumb.tsx +49 -30
  288. package/src/core/components/shadcn/button.tsx +3 -2
  289. package/src/core/components/shadcn/filters/filterBar.tsx +49 -23
  290. package/src/core/components/shadcn/index.ts +2 -0
  291. package/src/core/components/shadcn/input.tsx +10 -7
  292. package/src/core/components/shadcn/resizeable.tsx +54 -0
  293. package/src/core/components/shadcn/selectBox.tsx +87 -67
  294. package/src/core/components/shadcn/tabs.tsx +25 -8
  295. package/src/core/components/shadcn/textarea.tsx +21 -0
  296. package/src/core/components/table/index.tsx +1 -1
  297. package/src/core/hooks/index.ts +1 -0
  298. package/src/core/hooks/useScrollableSearch.tsx +193 -0
  299. package/src/features/agent/chat/ModernAgentConversation.tsx +109 -118
  300. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +2 -22
  301. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +1 -9
  302. package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +39 -55
  303. package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +1 -0
  304. package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +8 -8
  305. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +8 -8
  306. package/src/features/facets/CollectionsFacetsNav.tsx +115 -0
  307. package/src/features/facets/DocumentsFacetsNav.tsx +22 -11
  308. package/src/features/facets/EnvironmentFacet.tsx +1 -1
  309. package/src/features/facets/InteractionsFacetsNav.tsx +121 -0
  310. package/src/features/facets/PromptsFacetsNav.tsx +110 -0
  311. package/src/features/facets/RunsFacetsNav.tsx +40 -9
  312. package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +10 -8
  313. package/src/features/facets/index.ts +11 -9
  314. package/src/features/facets/utils/SearchInterface.tsx +12 -0
  315. package/src/features/facets/{VTypeFacet.tsx → utils/VTypeFacet.tsx} +12 -5
  316. package/src/features/facets/{VUserFacet.tsx → utils/VUserFacet.tsx} +1 -1
  317. package/src/features/layout/GenericPageNavHeader.tsx +73 -10
  318. package/src/features/store/collections/BrowseCollectionView.tsx +4 -0
  319. package/src/features/store/collections/CreateCollection.tsx +3 -4
  320. package/src/features/store/collections/EditCollectionView.tsx +104 -85
  321. package/src/features/store/collections/SelectCollection.tsx +214 -29
  322. package/src/features/store/objects/DocumentSearchResults.tsx +98 -27
  323. package/src/features/store/objects/DocumentTable.tsx +14 -4
  324. package/src/features/store/objects/components/ContentOverview.tsx +536 -267
  325. package/src/features/store/objects/components/DocumentIcon.tsx +42 -13
  326. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +12 -2
  327. package/src/features/store/objects/layout/DocumentTableColumn.tsx +16 -1
  328. package/src/features/store/objects/layout/documentLayout.tsx +10 -12
  329. package/src/features/store/objects/layout/knowledge.md +10 -10
  330. package/src/features/store/objects/layout/renderers.tsx +39 -18
  331. package/src/features/store/objects/search/DocumentSearchContext.ts +6 -1
  332. package/src/features/store/objects/search/DocumentSearchProvider.tsx +1 -1
  333. package/src/features/store/objects/selection/ObjectsActionContext.tsx +3 -2
  334. package/src/features/store/objects/selection/SelectionActions.tsx +2 -0
  335. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +23 -10
  336. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +22 -2
  337. package/src/features/store/objects/upload/DocumentUploadModal.tsx +23 -15
  338. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +10 -7
  339. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +1 -1
  340. package/src/features/store/types/ObjectSchemaEditor.tsx +1 -1
  341. package/src/features/user/UserInfo.tsx +66 -3
  342. package/src/router/HistoryNavigator.ts +33 -2
  343. package/src/router/Nav.tsx +4 -3
  344. package/src/shell/login/UserInfo.tsx +1 -1
  345. package/src/widgets/form/Form.tsx +19 -43
  346. package/src/widgets/form/FormContext.ts +5 -2
  347. package/src/widgets/form/fields.tsx +8 -6
  348. package/src/widgets/form/inputs.tsx +1 -0
  349. package/src/widgets/schema-editor/index.ts +0 -1
  350. package/lib/esm/core/components/Textarea.js +0 -15
  351. package/lib/esm/core/components/Textarea.js.map +0 -1
  352. package/lib/esm/features/facets/FacetsNav.js +0 -8
  353. package/lib/esm/features/facets/FacetsNav.js.map +0 -1
  354. package/lib/esm/features/facets/StringFacet.js.map +0 -1
  355. package/lib/esm/features/facets/StringListFacet.js.map +0 -1
  356. package/lib/esm/features/facets/TypeFacet.js.map +0 -1
  357. package/lib/esm/features/facets/VEnvironmentFacet.js.map +0 -1
  358. package/lib/esm/features/facets/VFacetsNav.js +0 -48
  359. package/lib/esm/features/facets/VFacetsNav.js.map +0 -1
  360. package/lib/esm/features/facets/VInteractionFacet.js.map +0 -1
  361. package/lib/esm/features/facets/VStringFacet.js.map +0 -1
  362. package/lib/esm/features/facets/VTypeFacet.js.map +0 -1
  363. package/lib/esm/features/facets/VUserFacet.js.map +0 -1
  364. package/lib/esm/features/facets/utils.js.map +0 -1
  365. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js +0 -49
  366. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js.map +0 -1
  367. package/lib/types/core/components/Textarea.d.ts +0 -8
  368. package/lib/types/core/components/Textarea.d.ts.map +0 -1
  369. package/lib/types/features/facets/FacetsNav.d.ts +0 -7
  370. package/lib/types/features/facets/FacetsNav.d.ts.map +0 -1
  371. package/lib/types/features/facets/StringFacet.d.ts.map +0 -1
  372. package/lib/types/features/facets/StringListFacet.d.ts.map +0 -1
  373. package/lib/types/features/facets/TypeFacet.d.ts.map +0 -1
  374. package/lib/types/features/facets/VEnvironmentFacet.d.ts.map +0 -1
  375. package/lib/types/features/facets/VFacetsNav.d.ts +0 -16
  376. package/lib/types/features/facets/VFacetsNav.d.ts.map +0 -1
  377. package/lib/types/features/facets/VInteractionFacet.d.ts.map +0 -1
  378. package/lib/types/features/facets/VStringFacet.d.ts.map +0 -1
  379. package/lib/types/features/facets/VTypeFacet.d.ts.map +0 -1
  380. package/lib/types/features/facets/VUserFacet.d.ts.map +0 -1
  381. package/lib/types/features/facets/utils.d.ts.map +0 -1
  382. package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts +0 -10
  383. package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts.map +0 -1
  384. package/src/core/components/Textarea.tsx +0 -25
  385. package/src/features/facets/FacetsNav.tsx +0 -19
  386. package/src/features/facets/VFacetsNav.tsx +0 -81
  387. package/src/widgets/schema-editor/JSONSchemaEditorModal.tsx +0 -67
  388. /package/lib/esm/features/facets/{StringFacet.js → utils/StringFacet.js} +0 -0
  389. /package/lib/esm/features/facets/{StringListFacet.js → utils/StringListFacet.js} +0 -0
  390. /package/lib/esm/features/facets/{TypeFacet.js → utils/TypeFacet.js} +0 -0
  391. /package/lib/esm/features/facets/{VEnvironmentFacet.js → utils/VEnvironmentFacet.js} +0 -0
  392. /package/lib/esm/features/facets/{VInteractionFacet.js → utils/VInteractionFacet.js} +0 -0
  393. /package/lib/esm/features/facets/{VStringFacet.js → utils/VStringFacet.js} +0 -0
  394. /package/lib/esm/features/facets/{utils.js → utils/utils.js} +0 -0
  395. /package/lib/types/features/facets/{StringFacet.d.ts → utils/StringFacet.d.ts} +0 -0
  396. /package/lib/types/features/facets/{StringListFacet.d.ts → utils/StringListFacet.d.ts} +0 -0
  397. /package/lib/types/features/facets/{TypeFacet.d.ts → utils/TypeFacet.d.ts} +0 -0
  398. /package/lib/types/features/facets/{VEnvironmentFacet.d.ts → utils/VEnvironmentFacet.d.ts} +0 -0
  399. /package/lib/types/features/facets/{VInteractionFacet.d.ts → utils/VInteractionFacet.d.ts} +0 -0
  400. /package/lib/types/features/facets/{VStringFacet.d.ts → utils/VStringFacet.d.ts} +0 -0
  401. /package/lib/types/features/facets/{VUserFacet.d.ts → utils/VUserFacet.d.ts} +0 -0
  402. /package/lib/types/features/facets/{utils.d.ts → utils/utils.d.ts} +0 -0
  403. /package/src/features/facets/{StringFacet.tsx → utils/StringFacet.tsx} +0 -0
  404. /package/src/features/facets/{StringListFacet.tsx → utils/StringListFacet.tsx} +0 -0
  405. /package/src/features/facets/{TypeFacet.tsx → utils/TypeFacet.tsx} +0 -0
  406. /package/src/features/facets/{VEnvironmentFacet.tsx → utils/VEnvironmentFacet.tsx} +0 -0
  407. /package/src/features/facets/{VInteractionFacet.tsx → utils/VInteractionFacet.tsx} +0 -0
  408. /package/src/features/facets/{VStringFacet.tsx → utils/VStringFacet.tsx} +0 -0
  409. /package/src/features/facets/{utils.tsx → utils/utils.tsx} +0 -0
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import s,{useRef as i,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,Children as h,isValidElement as u}from"react";import{EditorView as p}from"@codemirror/view";import{useSafeLayoutEffect as m,Styles as f,Button as g,DotBadge as y,Table as v,VTooltip as b,useToast as x,VModal as w,VModalTitle as N,VModalBody as k,VModalFooter as C,VSelectBox as S,ModalBody as j,ModalFooter as O,useFlag as A,useClickOutside as P}from"@vertesia/ui/core";import{Text as $,EditorState as E}from"@codemirror/state";import{Plus as T,Trash2 as I,Info as q,AlignLeft as M,SquarePen as L,ChevronDown as D,ChevronRight as F,UploadIcon as z,CheckCircleIcon as R,AlertCircleIcon as V,XCircleIcon as _}from"lucide-react";import U from"clsx";import K from"ajv";import{ObjectWalker as B}from"@vertesia/json";import W from"react-markdown";import H from"remark-gfm";import{visit as J,SKIP as G}from"unist-util-visit";import{offset as X,shift as Z,flip as Y}from"@floating-ui/dom";import{useFloating as Q,autoUpdate as ee,useDismiss as te,useClick as re,useHover as ne,useInteractions as se,useTransitionStyles as ie,FloatingPortal as ae,FloatingFocusManager as oe,safePolygon as le}from"@floating-ui/react";import{json as ce}from"@codemirror/lang-json";import{basicSetup as de}from"codemirror";import{isNil as he,omit as ue,isEqual as pe}from"lodash-es";import{XMLParser as me,XMLValidator as fe}from"fast-xml-parser";let ge=null;class ye{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const ve=[p.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),p.lineWrapping];function be({onChange:t,value:r,className:s,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=i(null),u=i(void 0);a((()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}}),[t,d]);const f=o((()=>e("div",{ref:h,className:s})),[s]);return m((()=>{if(h.current){let t=[...ve,(e=e=>{u.current?.(e)},p.updateListener.of((t=>{t.docChanged&&e(t)})))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?$.of(e.split("\n")):e;return ge?ge.doc.toString()!==r.toString()&&(ge=E.create({doc:r,extensions:t})):ge=E.create({doc:r,extensions:t}),ge})(r,t),s=new p({state:n,parent:h.current}),i=new ye(s);return l&&(l.current=i),()=>{s.destroy(),l&&(l.current=void 0)}}var e}),[f,c]),f}const xe=l(void 0),we=xe.Provider;function Ne(){const e=c(xe);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}const ke=l(void 0);function Ce(){const e=c(ke);if(!e)throw new Error("useForm must be used within a Form element");return e}const Se=ke.Provider;function je({htmlFor:r,required:n,children:s}){return t("label",{htmlFor:r,className:"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200",children:[s,n&&e("sup",{className:"text-red-600",children:"*"})]})}function Oe({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function Ae({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const Pe=s.forwardRef((({object:t,type:r="text",onChange:n,...s},i)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);s.className?s.className=U(f.INPUT,s.className):s.className=f.INPUT;const h=e=>{o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e)};return"textarea"===r?e("textarea",{ref:i,...s,value:a,onChange:h}):e("input","checkbox"===r?{ref:i,...s,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:i,...s,type:r,value:a,onChange:h})}));function $e({object:t,components:r,onSubmit:n,children:s,onChange:i}){return t.observer=i,e(Se,{value:{object:t,components:r||{}},children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:s})})}function Ee(){const t=Ce();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(Ie)})}function Te({children:r,...n}){return t($e,{...n,children:[e(Ee,{}),r]})}function Ie(t){return t.isList?e(Le,{object:t},t.name):t.isObject?e(Me,{object:t},t.name):e(qe,{object:t},t.name)}function qe({object:r,editor:n,inline:s=!1}){n||(n=r.schema.editor);const{components:i}=Ce(),a=n&&i[n]||Pe,o=r.getInputType();"checkbox"===o&&(s=!0);return t("div",{className:"",children:[t("div",{className:U("flex gap-2",s?"flex-row items-center":"flex-col"),children:[!r.isListItem&&e(je,{required:r.schema.isRequired,children:r.title}),e(a,{object:r,type:o,onChange:e=>{const{value:t}=e.target;r.value=r.schema.isNumber?parseFloat(t):t}})]}),r.schema.description&&e(Oe,{children:r.schema.description})]})}function Me({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(Ie)]})}function Le({object:r}){const[n,s]=d(r.value||[]);return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map(((t,i)=>e(De,{object:t,list:r,onDelete:()=>(e=>{r.remove(e),s([...r.value])})(i)},`${i}-${n[i]??""}`))),e("div",{children:t(g,{variant:"secondary",onClick:()=>{r.add(),s([...r.value])},children:[e(T,{className:"size-6"})," Add"]})})]})}function De({list:r,object:n,onDelete:s}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(i=n,a=r.schema.arraySchema.editor,i.isList?e(Le,{object:i}):i.isObject?e(Me,{object:i}):e(qe,{object:i,editor:a}))}),e(g,{variant:"secondary",onClick:s,children:e(I,{className:"size-4"})})]});var i,a}class Fe{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new K({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach((t=>{this.loadProperty(t,e[t])}))}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new Re(this,e,t):new ze(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(s=t)?{type:"object",properties:{}}:"array"===s?{type:"array",items:{}}:{type:s}:t;var s;const i=this.loadProperty(e,n);return this.schema.properties[i.name]=i.schema,r&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter((t=>t!==e)))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class ze extends Fe{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter((e=>e!==this.name)),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class Re extends ze{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function Ve(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function _e(e,t){if(t.editor)return t.editor;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class Ue{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||Ve(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Ke extends Ue{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new Je(this,t,this.getOrInitArrayProperty(e)):t.isObject?new We(this,t,t.name,this.getOrInitObjectProperty(e)):new He(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new Je(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new We(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new He(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class Be extends Ke{value;constructor(e,t={}){super(null,e instanceof Fe?e:new Fe(e),"#root"),this.value=t}}class We extends Ke{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class He extends Ue{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return _e(this.name,this.schema)}}class Je extends Ue{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Ge(this,e):new Xe(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new We(this,this.schema,String(e),t):new Xe(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Ge extends Ke{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class Xe extends Ue{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return _e(this.name,this.schema)}}const Ze="text-pink-500 dark:text-pink-400",Ye="text-purple-500 dark:text-purple-400",Qe="text-blue-500 dark:text-blue-400",et={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:Ze,assign:Ze,startObject:Ze,endObject:Ze,startArray:Ze,endArray:Ze,boolean:Ye,null:Ye,key:Qe,index:Qe,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class tt{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof tt)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class rt extends tt{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class nt extends tt{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class st{classMap;tab;stack=[];block=new rt(this,void 0,"","");constructor(e=et,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new rt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new nt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function it({data:t,className:r,classMap:n}){const[s,i]=d();return a((()=>{i(function(t,r,n){const s=new st(r);(new B).walk(t,s);const i=s.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${s.classMap.code}' style='overflow-x: scroll'>${i}</div>`}})}(t,n,r))}),[t]),s}function at({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map((([t,r])=>e(ct,{name:t,value:r},t)))})}function ot({name:t}){return e("div",{className:"text-md font-semibold",children:Ve(t)})}function lt({children:t,className:r}){return e("div",{className:U("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function ct({name:r,value:n}){const s=pt(n);switch(s.type){case ut.Inline:return t("div",{className:"w-full flex gap-2",children:[e(ot,{name:r+":"}),e("p",{children:s.value})]});case ut.Paragraph:return t("div",{children:[e(ot,{name:r}),e("p",{children:s.value})]});case ut.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(ot,{name:r}),e("div",{className:"vprose dark:prose-invert",children:s.value})]});case ut.Array:return e(dt,{name:r,value:n});case ut.Object:return t("div",{children:[e(ot,{name:r}),e(lt,{className:"mt-2",children:Object.entries(n).map((([t,r])=>e(ct,{name:t,value:r},t)))})]})}}function dt({name:r,value:n}){const s=n.join(" ").length,i=s/n.length,a="string"==typeof n[0]&&(s<80||s<400&&i<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(ot,{name:r+":"}),n.map(((t,r)=>e(y,{children:String(t)},r)))]}:{children:[r&&e(ot,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map(((t,r)=>e(ht,{index:r,value:t,useBullet:o},r)))})]})}function ht({index:r,value:n,useBullet:s}){const i=s?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=pt(n);let o;switch(a.type){case ut.Object:o=e(lt,{children:Object.entries(n).map((([t,r])=>e(ct,{name:t,value:r},t)))});break;case ut.Array:o=e(dt,{value:n});break;case ut.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:i}),e("div",{children:o})]})}var ut;function pt(e){if(null==e)return{value:"-",type:ut.Inline};if(Array.isArray(e))return{value:e,type:ut.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=ut.Inline:t>400?r=ut.Prose:(r=ut.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:ut.Inline}:{value:e,type:ut.Object}}function mt({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(it,{data:t}):e(at,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}function ft(){return e=>{J(e,"html",((e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[G,t]}))}}function gt({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0}){const i=[H,...n];return s&&i.push(ft),e(W,{remarkPlugins:i,components:r,children:t})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(ut||(ut={}));const yt=l(void 0);function vt(){return c(yt)}const bt=Symbol("__SLOT_NAME");function xt(e,t){const r=[];return h.forEach(e,(e=>{!function(e,t,r){let n;u(e)&&(n=e.type[bt])?r[n]=e:t.push(e)}(e,r,t)})),r.length>1?r:r[0]}function wt(e,t){t[bt]=e}function Nt(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function kt(t){const r={};if(xt(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,s=r.content.props;return e(Ct,{...t,trigger:n,content:s})}function Ct({middleware:r,offset:n,trigger:s,dismiss:i=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=Q({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[X(n||4),Z(),Y()],whileElementsMounted:ee}),{floatingStyles:m,refs:{setReference:f,setFloating:g},context:y}=p,v=te(y,Nt(i)),b=re(y,Nt(!(x=s)||x.hover||x.click?x?.click:{enabled:!0}));var x;const w=ne(y,Nt(function(e){return!0===e?.hover?{enabled:!0,handleClose:le({blockPointerEvents:!0}),restMs:0}:e?.hover}(s))),{getReferenceProps:N,getFloatingProps:k}=se([v,b,w]),{isMounted:C,styles:S}=ie(y,a.transition);return t(yt.Provider,{value:{...p,close:()=>u(!1)},children:[s&&e("div",{className:U(s.className,"inline-block"),ref:f,...N(),children:s.children}),e(ae,{children:C&&e("div",{ref:g,style:{...m,zIndex:c},...k(),children:e(oe,{context:y,children:e("div",{className:U(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:S,children:a.children})})})})]})}function St(e){return null}function jt(e){return null}function Ot({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function At({className:r,properties:n}){return e(v,{className:r,children:e("tbody",{children:n.map((r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(b,{description:r.description,placement:"top",children:e(q,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name)))})})}wt("trigger",St),wt("content",jt),kt.Trigger=St,kt.Content=jt;const Pt=[de,ce()];function $t({schema:r,isOpen:n,onClose:s,readonly:a=!1}){const l=i(void 0),c=x(),d=o((()=>function(e){return e?JSON.stringify(e,null,2):""}(r.schema)),[r]);return t(w,{onClose:s,isOpen:!!n,className:"min-w-[60vw]",children:[e(N,{children:"JSON Schema Editor"}),e(k,{children:a?e(it,{data:r.schema||{}}):e(be,{value:d,extensions:Pt,editorRef:l})}),e(C,{children:a?null:e(g,{onClick:()=>{if(l.current){const e=l.current.getValue();try{const t=function(e){if(e&&(e=e.trim()))return JSON.parse(e)}(e);r.replaceSchema(t),s()}catch(e){c({status:"error",title:"Invalid JSON Schema",description:e.message,duration:5e3})}}},children:"Save changes"})})]})}var Et;function Tt(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function It(e){let t,r=!1,n=!1;const s=e.type;if(Array.isArray(s))for(const e of s)"null"===e?r=!0:t||(t=e);else t=s;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?qt(e[0].type):qt(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let i=t;switch(e.editor||e.format){case"textarea":i="text";break;case"media":i="media";break;case"document":i="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:i}}function qt(e){return e?Array.isArray(e)?e.find((e=>"null"!==e))||"any":e:"any"}!function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(Et||(Et={}));let Mt=0;class Lt{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new Dt("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new Dt("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new Lt(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class Dt{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=It(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new Dt(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++Mt}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const s={};return Tt(s,r),e.properties[t]=s,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),s}(this._getPropertiesSchema(),e,t,r),s=new Dt(e,n,this.loader,this);return this.children.push(s),s}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter((e=>e!==t))))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter((e=>e.name!==this.name))),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,s={};for(const e of Object.keys(n)){const i=n[e];e===t?s[r]=i:s[e]=i}e.properties=s}e.required&&(e.required=e.required.map((e=>e===t?r:e)))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(Tt(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,this.schema.format=void 0,t=!0):e.editor?(this.schema.editor=e.editor,this.schema.format=e.editor,t=!0):n&&(this.schema.editor=void 0,this.schema.format=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const s=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=Et[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===Et.object}}(t);let i;return"text"===s.name?(s.name=Et.string,i="textarea"):"media"===s.name?(s.name=Et.any,i="media"):"document"===s.name?(s.name=Et.any,i="document"):i=null,{name:r,type:s,isRequired:n,editor:i}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function Ft(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const zt=function(){const e=Object.values(Et),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function Rt({value:r,onChange:n,onCancel:s,onSave:i}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(Vt,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:s,onSave:i})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(_t,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:s,onSave:i})}),t("div",{children:[e(g,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(M,{className:"size-4"})}),e(Ut,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function Vt({value:t,onChange:r,onCancel:n,onSave:s}){const o=i(null);a((()=>{o.current?.focus()}),[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":s?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:f.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function _t({value:t,onChange:r,onCancel:n,onSave:s}){return e(S,{className:f.INPUT_UNSTYLED,options:zt,value:t||"",onBlur:()=>{s?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?s?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Ut({value:r,isOpen:n,onClose:s}){return t(w,{isOpen:n,onClose:s,children:[e(N,{children:"Edit description"}),e(Kt,{value:r,onSave:s})]})}function Kt({value:n,onSave:s}){const o=i(null),[l,c]=d(n||"");return a((()=>{o.current&&o.current.focus()}),[o.current]),t(r,{children:[e(j,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(O,{children:e(g,{onClick:()=>s(l),children:"Save Changes"})})]})}function Bt({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Wt(e){const[t,r]=d(new Lt(e||{type:"object",properties:{}}).withChangeListener((e=>{r(e.clone())})));return t}const Ht="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Jt=`${Ht} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Gt=`${Ht} shadow-xs ring-1 ring-inset ring-ring`;function Xt({value:r,onChange:n,onDelete:s,outlineOnHover:i=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:g,isOn:y}=A(u),[v,b]=d();return t("div",{className:"",children:[y&&!p?e(Yt,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void b(t);b(void 0)}n(e)&&g()},onCancel:g,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Zt,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:i,editOnClick:a,onDelete:s,readonly:p}),v&&e("div",{className:"text-red-500 text-sm",children:v})]})}function Zt({viewer:r,value:n,onEdit:s,editOnClick:i,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&s()},onClick:()=>{i&&s()},className:U("flex justify-start items-center group",a?Jt:Ht,{"cursor-pointer":i}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(g,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(I,{className:"size-4"})}),c?null:e(g,{variant:"ghost",size:"sm",className:d,onClick:s,children:e(L,{className:"size-4"})})]})]})}function Yt({editor:t,value:r,onSave:n,onCancel:s,skipClickOutside:a}){const[o,l]=d(r),c=i(r),[h,u]=d(null),p=()=>{n(c.current)},m=P(p,a);return e("div",{ref:m,children:e("div",{className:Gt,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout((()=>{n(e)}),500)))},onSave:p,onCancel:s})})})})}function Qt(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function er({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map((e=>tr(e,n))),n?null:e(ar,{parent:r.root})]})}function tr(t,r){return t.isParent?e(nr,{property:t,readonly:r},t.name):e(rr,{node:t,readonly:r},t.name)}function rr({node:t,readonly:r}){return e("li",{children:e(ir,{property:t,readonly:r})})}function nr({property:r,readonly:n}){const[s,i]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>i(!s),children:e(s?D:F,{className:"size-4"})}),e("div",{className:"flex-1",children:e(ir,{property:r,readonly:n})})]}),s&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map((e=>tr(e,n))),n?null:e(ar,{parent:r})]})]})}function sr(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function ir({property:t,readonly:r}){const n=x(),s=t.resetIsNew(),i=Ft(t);return e(Xt,{value:i,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:Rt,viewer:Bt,outlineOnHover:!0,isEditing:s,skipClickOutside:Qt,readonly:r,onValidate:e=>sr(e.name)})}function ar({parent:r}){return t(g,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:Et.string},!0).isNew=!0,r.reloadTree()},children:[e(T,{className:"size-4"}),"Add property"]})}function or({content:t,...r}){const n=i(null);return a((()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach((([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))})),n.current.innerHTML="",n.current.appendChild(e)}),[t,r]),e("span",{ref:n})}function lr(t){return r=>e(or,{content:t,...r})}function cr({onDrop:r,message:n,buttonLabel:s="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=i(null),u=i(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],s=new Set,i=async e=>{if(e.isFile){const t=await new Promise((t=>{e.file((r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)}))}));!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&s.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise((e=>{t.readEntries((t=>{e(t)}))}));await Promise.all(r.map(i));const n=e.fullPath.substring(1);n&&s.add(n)}};try{if(await Promise.all(t.map((e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?i(t):Promise.resolve()}))),n.length>0){const e=new Set(Array.from(s).map((e=>e.split("/")[0])).filter(Boolean)).size,t=n.length;let i="";i=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:i})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(z,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(g,{onClick:()=>{h.current&&h.current.click()},children:[e(z,{className:"h-4 w-4 mr-2"}),s]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some((e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/")))){const e=new Set(t.map((e=>e.webkitRelativePath?.split("/")[0])).filter(Boolean)).size,n=t.length,s=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,i={count:t.length,message:s};r(t,i)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function dr({title:r,count:n,icon:s=e(R,{className:"h-4 w-4 text-green-500"}),items:i}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:s}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:i.length>0?e("ul",{className:"space-y-1",children:i.map(((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r)))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function hr({files:r,className:n="",location:s,collection:i}){const a=r.filter((e=>"success"===e.status)),o=r.filter((e=>"updated"===e.status)),l=r.filter((e=>"skipped"===e.status)),c=r.filter((e=>"failed"===e.status)),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(R,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",i?` in collection '${i}'`:"",s?` in folder '${s}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(dr,{title:"Successfully Uploaded",count:d,icon:e(R,{className:"h-4 w-4 text-green-500"}),items:a.map((e=>e.name))}),h>0&&e(dr,{title:"Successfully Updated",count:h,icon:e(R,{className:"h-4 w-4 text-blue-500"}),items:o.map((e=>e.name))}),u>0&&e(dr,{title:"Skipped (Already Existed)",count:u,icon:e(V,{className:"h-4 w-4 text-amber-500"}),items:l.map((e=>e.name))}),p>0&&e(dr,{title:"Failed to Upload",count:p,icon:e(_,{className:"h-4 w-4 text-red-500"}),items:c.map((e=>e.name))})]})]})}const ur="#text",pr="#comment",mr="#cdata",fr="DECLARATION_TAG",gr={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},yr=l({theme:gr,collapsible:!1,indentSize:2}),vr=()=>c(yr),br=new me({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:pr,cdataPropName:mr,parseTagValue:!1});function xr(r){const{indentation:n,children:s,isInline:i}=r,{theme:a}=vr();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),s,e("span",{children:`${i?"":n}]]>`})]})}function wr(t){const{collapsible:r,theme:n}=vr(),{collapsed:s}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(Nr,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function Nr({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function kr(e){const{collapsible:t,initialCollapsedDepth:r}=vr(),[n,s]=d((()=>!(he(r)||!t)&&e>=r));return a((()=>{s(!(he(r)||!t)&&e>=r)}),[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>s((e=>!e)),role:"button",style:{cursor:"pointer"}}:{}}}function Cr(r){const{indentation:n,children:s,isInline:i,level:a}=r,{theme:o}=vr(),{collapsed:l,buttonProps:c}=kr(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(wr,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&s,l&&"...",e("span",{children:`${i||l?" ":n}--\x3e`})]})}function Sr(r){const{attributes:n}=r,{theme:s}=vr();return n?e("span",{children:Object.entries(n).map((([r,n])=>t("span",{children:[e("span",{style:{color:s.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:s.separatorColor},children:"="}),e("span",{style:{color:s.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`)))}):null}function jr(r){const{indentation:n,tagKey:s,attributes:i}=r,{theme:a}=vr();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${s.slice(1)}`}),e(Sr,{attributes:i}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function Or(e){return"string"==typeof e&&e.includes("\n")}function Ar(e){const t=e[":@"],r=ue(e,":@"),[[n,s]]=Object.entries(r),i=function(e){switch(e){case ur:case mr:case pr:return e;default:return e.startsWith("?")?fr:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:s,type:i}}function Pr(e){return!!e&&Object.keys(e).length>0}function $r(n){const{indentation:s,tagKey:i,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=kr(d),{theme:p}=vr();return t("div",{children:[t("span",{...u,children:[e("span",{children:s}),e(wr,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${i}`}),!h&&e(Sr,{attributes:a}),h&&Pr(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":s}</`}),e("span",{style:{color:p.tagColor},children:`${i}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function Er(t){const{hasSiblings:r,text:n,indentation:s,isText:i}=t,{theme:a}=vr(),o=i?{color:a.textColor}:void 0;return Or(n)||r?e("div",{style:o,children:n.split("\n").filter((e=>!!e.trim())).map(((t,r)=>e("div",{children:`${s}${t.trim()}`},`${r}`)))}):e("span",{style:o,children:n})}function Tr(t){const{elements:n,level:s=0,isText:i=!0}=t,{indentSize:a}=vr();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map(((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=Ar(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,s),p=`${s}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&ur in e[0]&&!Or(e[0][ur])}(c);switch(d){case ur:return e(Er,{text:c,indentation:u,hasSiblings:h,isText:i},p);case pr:return e(Cr,{isInline:m,indentation:u,level:s,children:e(Tr,{elements:c,level:s+1,isText:!1})},p);case mr:return e(xr,{indentation:u,isInline:m,children:e(Tr,{elements:c,level:s+1,isText:!1})},p);case fr:return e(jr,{indentation:u,tagKey:o,attributes:l},p);default:return e($r,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:s,children:e(Tr,{elements:c,level:s+1})},p)}}))}):null}function Ir(){return e("div",{children:"Invalid XML!"})}function qr(t){const{theme:r,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d((()=>({...gr,...r}))),{json:m,valid:f}=function(e){return o((()=>{try{if(!fe.validate(e))throw new Error("Invalid XML!");const t=br.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}}),[e])}(n),g=o((()=>({theme:u,collapsible:s,indentSize:i,initialCollapsedDepth:h??c})),[u,s,i,c,h]);return a((()=>{p((e=>{const t={...gr,...r};return pe(t,e)?e:t}))}),[r]),f?e(yr.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:u.fontFamily,overflowWrap:"break-word"},children:e(Tr,{elements:m})})}):l||e(Ir,{})}export{Re as ArrayPropertySchema,be as CodeMirrorEditor,cr as DropZone,ye as EditorApi,we as FieldSetContextProvider,$e as Form,Se as FormContextProvider,Ae as FormError,Oe as FormHelper,je as FormLabel,Te as GeneratedForm,Pe as Input,it as JSONCode,mt as JSONDisplay,$t as JSONSchemaEditorModal,at as JSONView,Ge as ManageObjectEntry,Je as ManagedListProperty,Be as ManagedObject,Ke as ManagedObjectBase,We as ManagedObjectProperty,He as ManagedProperty,Xe as ManagedScalarEntry,Lt as ManagedSchema,gt as MarkdownRenderer,Ue as Node,kt as Popover,yt as PopoverContext,Ot as Progress,At as PropertiesView,Rt as PropertyEditor,Vt as PropertyNameEditor,ze as PropertySchema,Bt as PropertyViewer,qe as ScalarField,Fe as Schema,er as SchemaEditor,Dt as SchemaNode,or as SvgIcon,dr as UploadResultCategory,hr as UploadSummary,qr as XMLViewer,Ve as computeTitleFromName,lr as createSvgIcon,Ft as getEditableSchemaProperty,Ne as useFieldSet,Ce as useForm,vt as usePopoverContext,Wt as useSchema,sr as validatePropertyName};
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import s,{useRef as i,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,Children as h,isValidElement as u}from"react";import{EditorView as p}from"@codemirror/view";import{useSafeLayoutEffect as m,Styles as f,FormItem as g,Button as y,DotBadge as v,Table as b,VTooltip as x,VSelectBox as w,VModal as N,VModalTitle as k,ModalBody as C,ModalFooter as j,useFlag as S,useClickOutside as O,useToast as A}from"@vertesia/ui/core";import{Text as P,EditorState as $}from"@codemirror/state";import{Plus as T,Trash2 as E,Info as I,AlignLeft as q,SquarePen as M,ChevronDown as L,ChevronRight as D,UploadIcon as z,CheckCircleIcon as F,AlertCircleIcon as R,XCircleIcon as _}from"lucide-react";import V from"clsx";import U from"ajv";import{ObjectWalker as K}from"@vertesia/json";import B from"react-markdown";import W from"remark-gfm";import{visit as H,SKIP as G}from"unist-util-visit";import{offset as X,shift as Z,flip as Y}from"@floating-ui/dom";import{useFloating as J,autoUpdate as Q,useDismiss as ee,useClick as te,useHover as re,useInteractions as ne,useTransitionStyles as se,FloatingPortal as ie,FloatingFocusManager as ae,safePolygon as oe}from"@floating-ui/react";import{isNil as le,omit as ce,isEqual as de}from"lodash-es";import{XMLParser as he,XMLValidator as ue}from"fast-xml-parser";let pe=null;class me{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const fe=[p.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),p.lineWrapping];function ge({onChange:t,value:r,className:s,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=i(null),u=i(void 0);a((()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}}),[t,d]);const f=o((()=>e("div",{ref:h,className:s})),[s]);return m((()=>{if(h.current){let t=[...fe,(e=e=>{u.current?.(e)},p.updateListener.of((t=>{t.docChanged&&e(t)})))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?P.of(e.split("\n")):e;return pe?pe.doc.toString()!==r.toString()&&(pe=$.create({doc:r,extensions:t})):pe=$.create({doc:r,extensions:t}),pe})(r,t),s=new p({state:n,parent:h.current}),i=new me(s);return l&&(l.current=i),()=>{s.destroy(),l&&(l.current=void 0)}}var e}),[f,c]),f}const ye=l(void 0),ve=ye.Provider;function be(){const e=c(ye);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}class xe{object;components;disabled;constructor(e,t={},r=!1){this.object=e,this.components=t,this.disabled=r}}const we=l(void 0);function Ne(){const e=c(we);if(!e)throw new Error("useForm must be used within a Form element");return e}const ke=we.Provider,Ce=s.forwardRef((({object:t,type:r="text",onChange:n,...s},i)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);s.className?s.className=V(f.INPUT,s.className):s.className=f.INPUT;const h=e=>{s.disabled||(o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e))};return"textarea"===r?e("textarea",{ref:i,...s,value:a,onChange:h}):e("input","checkbox"===r?{ref:i,...s,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:i,...s,type:r,value:a,onChange:h})}));function je({object:t,components:r,onSubmit:n,children:s,onChange:i,disabled:a}){return t.observer=i,e(ke,{value:new xe(t,r||{},a??!1),children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:s})})}function Se(){const t=Ne();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(Ae)})}function Oe({children:r,...n}){return t(je,{...n,children:[e(Se,{}),r]})}function Ae(t){return t.isList?e(Te,{object:t},t.name):t.isObject?e($e,{object:t},t.name):e(Pe,{object:t},t.name)}function Pe({object:t,editor:r,inline:n=!1}){r||(r=t.schema.editor);const{components:s,disabled:i}=Ne(),a=r&&s[r]||Ce,o=t.getInputType();"checkbox"===o&&(n=!0);return e(g,{label:t.title,required:t.schema.isRequired,description:t.schema.description,className:V("flex",n?"flex-row items-center":"flex-col"),children:!t.isListItem&&e(a,{object:t,type:o,onChange:e=>{if(i)return;const{value:r}=e.target;t.value=t.schema.isNumber?parseFloat(r):r},disabled:i})})}function $e({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(Ae)]})}function Te({object:r}){const[n,s]=d(r.value||[]),{disabled:i}=Ne();return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map(((t,a)=>e(Ee,{object:t,list:r,onDelete:()=>(e=>{i||(r.remove(e),s([...r.value]))})(a),disabled:i},`${a}-${n[a]??""}`))),e("div",{children:t(y,{variant:"secondary",onClick:()=>{i||(r.add(),s([...r.value]))},disabled:i,children:[e(T,{className:"size-6"})," Add"]})})]})}function Ee({list:r,object:n,onDelete:s,disabled:i}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(a=n,o=r.schema.arraySchema.editor,a.isList?e(Te,{object:a}):a.isObject?e($e,{object:a}):e(Pe,{object:a,editor:o}))}),e(y,{variant:"secondary",onClick:s,disabled:i,children:e(E,{className:"size-4"})})]});var a,o}class Ie{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new U({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach((t=>{this.loadProperty(t,e[t])}))}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new Me(this,e,t):new qe(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(s=t)?{type:"object",properties:{}}:"array"===s?{type:"array",items:{}}:{type:s}:t;var s;const i=this.loadProperty(e,n);return this.schema.properties[i.name]=i.schema,r&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter((t=>t!==e)))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class qe extends Ie{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter((e=>e!==this.name)),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class Me extends qe{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function Le(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function De(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class ze{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||Le(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Fe extends ze{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new Ue(this,t,this.getOrInitArrayProperty(e)):t.isObject?new _e(this,t,t.name,this.getOrInitObjectProperty(e)):new Ve(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new Ue(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new _e(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new Ve(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class Re extends Fe{value;constructor(e,t={}){super(null,e instanceof Ie?e:new Ie(e),"#root"),this.value=t}}class _e extends Fe{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class Ve extends ze{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return De(this.name,this.schema)}}class Ue extends ze{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Ke(this,e):new Be(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new _e(this,this.schema,String(e),t):new Be(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Ke extends Fe{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class Be extends ze{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return De(this.name,this.schema)}}function We({label:t,required:r,children:n}){return e(g,{label:t,required:r,children:n})}function He({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function Ge({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const Xe="text-pink-500 dark:text-pink-400",Ze="text-purple-500 dark:text-purple-400",Ye="text-blue-500 dark:text-blue-400",Je={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:Xe,assign:Xe,startObject:Xe,endObject:Xe,startArray:Xe,endArray:Xe,boolean:Ze,null:Ze,key:Ye,index:Ye,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class Qe{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof Qe)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class et extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class tt extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class rt{classMap;tab;stack=[];block=new et(this,void 0,"","");constructor(e=Je,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new et(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new tt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function nt({data:t,className:r,classMap:n}){const[s,i]=d();return a((()=>{i(function(t,r,n){const s=new rt(r);(new K).walk(t,s);const i=s.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${s.classMap.code}' style='overflow-x: scroll'>${i}</div>`}})}(t,n,r))}),[t]),s}function st({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map((([t,r])=>e(ot,{name:t,value:r},t)))})}function it({name:t}){return e("div",{className:"text-md font-semibold",children:Le(t)})}function at({children:t,className:r}){return e("div",{className:V("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function ot({name:r,value:n}){const s=ht(n);switch(s.type){case dt.Inline:return t("div",{className:"w-full flex gap-2",children:[e(it,{name:r+":"}),e("p",{children:s.value})]});case dt.Paragraph:return t("div",{children:[e(it,{name:r}),e("p",{children:s.value})]});case dt.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(it,{name:r}),e("div",{className:"vprose dark:prose-invert",children:s.value})]});case dt.Array:return e(lt,{name:r,value:n});case dt.Object:return t("div",{children:[e(it,{name:r}),e(at,{className:"mt-2",children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))})]})}}function lt({name:r,value:n}){const s=n.join(" ").length,i=s/n.length,a="string"==typeof n[0]&&(s<80||s<400&&i<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(it,{name:r+":"}),n.map(((t,r)=>e(v,{children:String(t)},r)))]}:{children:[r&&e(it,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map(((t,r)=>e(ct,{index:r,value:t,useBullet:o},r)))})]})}function ct({index:r,value:n,useBullet:s}){const i=s?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=ht(n);let o;switch(a.type){case dt.Object:o=e(at,{children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))});break;case dt.Array:o=e(lt,{value:n});break;case dt.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:i}),e("div",{children:o})]})}var dt;function ht(e){if(null==e)return{value:"-",type:dt.Inline};if(Array.isArray(e))return{value:e,type:dt.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=dt.Inline:t>400?r=dt.Prose:(r=dt.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:dt.Inline}:{value:e,type:dt.Object}}function ut({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(nt,{data:t}):e(st,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}function pt(){return e=>{H(e,"html",((e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[G,t]}))}}function mt({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0}){const i=[W,...n];return s&&i.push(pt),e(B,{remarkPlugins:i,components:r,children:t})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(dt||(dt={}));const ft=l(void 0);function gt(){return c(ft)}const yt=Symbol("__SLOT_NAME");function vt(e,t){const r=[];return h.forEach(e,(e=>{!function(e,t,r){let n;u(e)&&(n=e.type[yt])?r[n]=e:t.push(e)}(e,r,t)})),r.length>1?r:r[0]}function bt(e,t){t[yt]=e}function xt(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function wt(t){const r={};if(vt(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,s=r.content.props;return e(Nt,{...t,trigger:n,content:s})}function Nt({middleware:r,offset:n,trigger:s,dismiss:i=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=J({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[X(n||4),Z(),Y()],whileElementsMounted:Q}),{floatingStyles:m,refs:{setReference:f,setFloating:g},context:y}=p,v=ee(y,xt(i)),b=te(y,xt(!(x=s)||x.hover||x.click?x?.click:{enabled:!0}));var x;const w=re(y,xt(function(e){return!0===e?.hover?{enabled:!0,handleClose:oe({blockPointerEvents:!0}),restMs:0}:e?.hover}(s))),{getReferenceProps:N,getFloatingProps:k}=ne([v,b,w]),{isMounted:C,styles:j}=se(y,a.transition);return t(ft.Provider,{value:{...p,close:()=>u(!1)},children:[s&&e("div",{className:V(s.className,"inline-block"),ref:f,...N(),children:s.children}),e(ie,{children:C&&e("div",{ref:g,style:{...m,zIndex:c},...k(),children:e(ae,{context:y,children:e("div",{className:V(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:j,children:a.children})})})})]})}function kt(e){return null}function Ct(e){return null}function jt({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function St({className:r,properties:n}){return e(b,{className:r,children:e("tbody",{children:n.map((r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(x,{description:r.description,placement:"top",children:e(I,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name)))})})}var Ot;function At(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function Pt(e){let t,r=!1,n=!1;const s=e.type;if(Array.isArray(s))for(const e of s)"null"===e?r=!0:t||(t=e);else t=s;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?$t(e[0].type):$t(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let i=t;switch(e.editor||e.format){case"textarea":i="text";break;case"media":i="media";break;case"document":i="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:i}}function $t(e){return e?Array.isArray(e)?e.find((e=>"null"!==e))||"any":e:"any"}bt("trigger",kt),bt("content",Ct),wt.Trigger=kt,wt.Content=Ct,function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(Ot||(Ot={}));let Tt=0;class Et{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new It("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new It("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new Et(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class It{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=Pt(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new It(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++Tt}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const s={};return At(s,r),e.properties[t]=s,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),s}(this._getPropertiesSchema(),e,t,r),s=new It(e,n,this.loader,this);return this.children.push(s),s}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter((e=>e!==t))))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter((e=>e.name!==this.name))),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,s={};for(const e of Object.keys(n)){const i=n[e];e===t?s[r]=i:s[e]=i}e.properties=s}e.required&&(e.required=e.required.map((e=>e===t?r:e)))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(At(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,this.schema.format=void 0,t=!0):e.editor?(this.schema.editor=e.editor,this.schema.format=e.editor,t=!0):n&&(this.schema.editor=void 0,this.schema.format=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const s=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=Ot[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===Ot.object}}(t);let i;return"text"===s.name?(s.name=Ot.string,i="textarea"):"media"===s.name?(s.name=Ot.any,i="media"):"document"===s.name?(s.name=Ot.any,i="document"):i=null,{name:r,type:s,isRequired:n,editor:i}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function qt(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const Mt=function(){const e=Object.values(Ot),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function Lt({value:r,onChange:n,onCancel:s,onSave:i}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(Dt,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:s,onSave:i})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(zt,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:s,onSave:i})}),t("div",{children:[e(y,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(q,{className:"size-4"})}),e(Ft,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function Dt({value:t,onChange:r,onCancel:n,onSave:s}){const o=i(null);a((()=>{o.current?.focus()}),[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":s?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:f.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function zt({value:t,onChange:r,onCancel:n,onSave:s}){return e(w,{className:f.INPUT_UNSTYLED,options:Mt,value:t||"",onBlur:()=>{s?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?s?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Ft({value:r,isOpen:n,onClose:s}){return t(N,{isOpen:n,onClose:s,children:[e(k,{children:"Edit description"}),e(Rt,{value:r,onSave:s})]})}function Rt({value:n,onSave:s}){const o=i(null),[l,c]=d(n||"");return a((()=>{o.current&&o.current.focus()}),[o.current]),t(r,{children:[e(C,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(j,{children:e(y,{onClick:()=>s(l),children:"Save Changes"})})]})}function _t({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Vt(e){const[t,r]=d(new Et(e||{type:"object",properties:{}}).withChangeListener((e=>{r(e.clone())})));return t}const Ut="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Kt=`${Ut} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Bt=`${Ut} shadow-xs ring-1 ring-inset ring-ring`;function Wt({value:r,onChange:n,onDelete:s,outlineOnHover:i=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:g,isOn:y}=S(u),[v,b]=d();return t("div",{className:"",children:[y&&!p?e(Gt,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void b(t);b(void 0)}n(e)&&g()},onCancel:g,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Ht,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:i,editOnClick:a,onDelete:s,readonly:p}),v&&e("div",{className:"text-red-500 text-sm",children:v})]})}function Ht({viewer:r,value:n,onEdit:s,editOnClick:i,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&s()},onClick:()=>{i&&s()},className:V("flex justify-start items-center group",a?Kt:Ut,{"cursor-pointer":i}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(y,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(E,{className:"size-4"})}),c?null:e(y,{variant:"ghost",size:"sm",className:d,onClick:s,children:e(M,{className:"size-4"})})]})]})}function Gt({editor:t,value:r,onSave:n,onCancel:s,skipClickOutside:a}){const[o,l]=d(r),c=i(r),[h,u]=d(null),p=()=>{n(c.current)},m=O(p,a);return e("div",{ref:m,children:e("div",{className:Bt,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout((()=>{n(e)}),500)))},onSave:p,onCancel:s})})})})}function Xt(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function Zt({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map((e=>Yt(e,n))),n?null:e(rr,{parent:r.root})]})}function Yt(t,r){return t.isParent?e(Qt,{property:t,readonly:r},t.name):e(Jt,{node:t,readonly:r},t.name)}function Jt({node:t,readonly:r}){return e("li",{children:e(tr,{property:t,readonly:r})})}function Qt({property:r,readonly:n}){const[s,i]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>i(!s),children:e(s?L:D,{className:"size-4"})}),e("div",{className:"flex-1",children:e(tr,{property:r,readonly:n})})]}),s&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map((e=>Yt(e,n))),n?null:e(rr,{parent:r})]})]})}function er(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function tr({property:t,readonly:r}){const n=A(),s=t.resetIsNew(),i=qt(t);return e(Wt,{value:i,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:Lt,viewer:_t,outlineOnHover:!0,isEditing:s,skipClickOutside:Xt,readonly:r,onValidate:e=>er(e.name)})}function rr({parent:r}){return t(y,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:Ot.string},!0).isNew=!0,r.reloadTree()},children:[e(T,{className:"size-4"}),"Add property"]})}function nr({content:t,...r}){const n=i(null);return a((()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach((([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))})),n.current.innerHTML="",n.current.appendChild(e)}),[t,r]),e("span",{ref:n})}function sr(t){return r=>e(nr,{content:t,...r})}function ir({onDrop:r,message:n,buttonLabel:s="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=i(null),u=i(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],s=new Set,i=async e=>{if(e.isFile){const t=await new Promise((t=>{e.file((r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)}))}));!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&s.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise((e=>{t.readEntries((t=>{e(t)}))}));await Promise.all(r.map(i));const n=e.fullPath.substring(1);n&&s.add(n)}};try{if(await Promise.all(t.map((e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?i(t):Promise.resolve()}))),n.length>0){const e=new Set(Array.from(s).map((e=>e.split("/")[0])).filter(Boolean)).size,t=n.length;let i="";i=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:i})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(z,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(y,{onClick:()=>{h.current&&h.current.click()},children:[e(z,{className:"h-4 w-4 mr-2"}),s]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some((e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/")))){const e=new Set(t.map((e=>e.webkitRelativePath?.split("/")[0])).filter(Boolean)).size,n=t.length,s=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,i={count:t.length,message:s};r(t,i)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function ar({title:r,count:n,icon:s=e(F,{className:"h-4 w-4 text-green-500"}),items:i}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:s}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:i.length>0?e("ul",{className:"space-y-1",children:i.map(((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r)))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function or({files:r,className:n="",location:s,collection:i}){const a=r.filter((e=>"success"===e.status)),o=r.filter((e=>"updated"===e.status)),l=r.filter((e=>"skipped"===e.status)),c=r.filter((e=>"failed"===e.status)),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(F,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",i?` in collection '${i}'`:"",s?` in folder '${s}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(ar,{title:"Successfully Uploaded",count:d,icon:e(F,{className:"h-4 w-4 text-green-500"}),items:a.map((e=>e.name))}),h>0&&e(ar,{title:"Successfully Updated",count:h,icon:e(F,{className:"h-4 w-4 text-blue-500"}),items:o.map((e=>e.name))}),u>0&&e(ar,{title:"Skipped (Already Existed)",count:u,icon:e(R,{className:"h-4 w-4 text-amber-500"}),items:l.map((e=>e.name))}),p>0&&e(ar,{title:"Failed to Upload",count:p,icon:e(_,{className:"h-4 w-4 text-red-500"}),items:c.map((e=>e.name))})]})]})}const lr="#text",cr="#comment",dr="#cdata",hr="DECLARATION_TAG",ur={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},pr=l({theme:ur,collapsible:!1,indentSize:2}),mr=()=>c(pr),fr=new he({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:cr,cdataPropName:dr,parseTagValue:!1});function gr(r){const{indentation:n,children:s,isInline:i}=r,{theme:a}=mr();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),s,e("span",{children:`${i?"":n}]]>`})]})}function yr(t){const{collapsible:r,theme:n}=mr(),{collapsed:s}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(vr,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function vr({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function br(e){const{collapsible:t,initialCollapsedDepth:r}=mr(),[n,s]=d((()=>!(le(r)||!t)&&e>=r));return a((()=>{s(!(le(r)||!t)&&e>=r)}),[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>s((e=>!e)),role:"button",style:{cursor:"pointer"}}:{}}}function xr(r){const{indentation:n,children:s,isInline:i,level:a}=r,{theme:o}=mr(),{collapsed:l,buttonProps:c}=br(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(yr,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&s,l&&"...",e("span",{children:`${i||l?" ":n}--\x3e`})]})}function wr(r){const{attributes:n}=r,{theme:s}=mr();return n?e("span",{children:Object.entries(n).map((([r,n])=>t("span",{children:[e("span",{style:{color:s.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:s.separatorColor},children:"="}),e("span",{style:{color:s.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`)))}):null}function Nr(r){const{indentation:n,tagKey:s,attributes:i}=r,{theme:a}=mr();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${s.slice(1)}`}),e(wr,{attributes:i}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function kr(e){return"string"==typeof e&&e.includes("\n")}function Cr(e){const t=e[":@"],r=ce(e,":@"),[[n,s]]=Object.entries(r),i=function(e){switch(e){case lr:case dr:case cr:return e;default:return e.startsWith("?")?hr:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:s,type:i}}function jr(e){return!!e&&Object.keys(e).length>0}function Sr(n){const{indentation:s,tagKey:i,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=br(d),{theme:p}=mr();return t("div",{children:[t("span",{...u,children:[e("span",{children:s}),e(yr,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${i}`}),!h&&e(wr,{attributes:a}),h&&jr(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":s}</`}),e("span",{style:{color:p.tagColor},children:`${i}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function Or(t){const{hasSiblings:r,text:n,indentation:s,isText:i}=t,{theme:a}=mr(),o=i?{color:a.textColor}:void 0;return kr(n)||r?e("div",{style:o,children:n.split("\n").filter((e=>!!e.trim())).map(((t,r)=>e("div",{children:`${s}${t.trim()}`},`${r}`)))}):e("span",{style:o,children:n})}function Ar(t){const{elements:n,level:s=0,isText:i=!0}=t,{indentSize:a}=mr();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map(((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=Cr(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,s),p=`${s}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&lr in e[0]&&!kr(e[0][lr])}(c);switch(d){case lr:return e(Or,{text:c,indentation:u,hasSiblings:h,isText:i},p);case cr:return e(xr,{isInline:m,indentation:u,level:s,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case dr:return e(gr,{indentation:u,isInline:m,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case hr:return e(Nr,{indentation:u,tagKey:o,attributes:l},p);default:return e(Sr,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:s,children:e(Ar,{elements:c,level:s+1})},p)}}))}):null}function Pr(){return e("div",{children:"Invalid XML!"})}function $r(t){const{theme:r,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d((()=>({...ur,...r}))),{json:m,valid:f}=function(e){return o((()=>{try{if(!ue.validate(e))throw new Error("Invalid XML!");const t=fr.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}}),[e])}(n),g=o((()=>({theme:u,collapsible:s,indentSize:i,initialCollapsedDepth:h??c})),[u,s,i,c,h]);return a((()=>{p((e=>{const t={...ur,...r};return de(t,e)?e:t}))}),[r]),f?e(pr.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:u.fontFamily,overflowWrap:"break-word"},children:e(Ar,{elements:m})})}):l||e(Pr,{})}export{Me as ArrayPropertySchema,ge as CodeMirrorEditor,ir as DropZone,me as EditorApi,ve as FieldSetContextProvider,je as Form,xe as FormContext,ke as FormContextProvider,Ge as FormError,He as FormHelper,We as FormLabel,Oe as GeneratedForm,Ce as Input,nt as JSONCode,ut as JSONDisplay,st as JSONView,Ke as ManageObjectEntry,Ue as ManagedListProperty,Re as ManagedObject,Fe as ManagedObjectBase,_e as ManagedObjectProperty,Ve as ManagedProperty,Be as ManagedScalarEntry,Et as ManagedSchema,mt as MarkdownRenderer,ze as Node,wt as Popover,ft as PopoverContext,jt as Progress,St as PropertiesView,Lt as PropertyEditor,Dt as PropertyNameEditor,qe as PropertySchema,_t as PropertyViewer,Pe as ScalarField,Ie as Schema,Zt as SchemaEditor,It as SchemaNode,nr as SvgIcon,ar as UploadResultCategory,or as UploadSummary,$r as XMLViewer,Le as computeTitleFromName,sr as createSvgIcon,qt as getEditableSchemaProperty,be as useFieldSet,Ne as useForm,gt as usePopoverContext,Vt as useSchema,er as validatePropertyName};
2
2
  //# sourceMappingURL=vertesia-ui-widgets.js.map