@vertesia/ui 0.74.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/lib/esm/core/components/Center.js +1 -1
  2. package/lib/esm/core/components/Center.js.map +1 -1
  3. package/lib/esm/core/components/Overlay.js +57 -0
  4. package/lib/esm/core/components/Overlay.js.map +1 -0
  5. package/lib/esm/core/components/SidePanel.js +6 -6
  6. package/lib/esm/core/components/SidePanel.js.map +1 -1
  7. package/lib/esm/core/components/index.js +1 -0
  8. package/lib/esm/core/components/index.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/tabs.js +43 -5
  10. package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
  11. package/lib/esm/features/agent/PayloadBuilder.js +9 -2
  12. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  13. package/lib/esm/features/facets/DocumentsFacetsNav.js +4 -2
  14. package/lib/esm/features/facets/DocumentsFacetsNav.js.map +1 -1
  15. package/lib/esm/features/facets/VTypeFacet.js +2 -1
  16. package/lib/esm/features/facets/VTypeFacet.js.map +1 -1
  17. package/lib/esm/features/magic-pdf/TextPageView.js +2 -4
  18. package/lib/esm/features/magic-pdf/TextPageView.js.map +1 -1
  19. package/lib/esm/features/store/collections/CreateCollection.js +1 -1
  20. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
  21. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +2 -4
  22. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +1 -1
  23. package/lib/esm/features/store/objects/DocumentSearchResults.js +19 -21
  24. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  25. package/lib/esm/features/store/objects/components/ContentOverview.js +2 -4
  26. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  27. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +51 -46
  28. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -1
  29. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +50 -34
  30. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  31. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +1 -3
  32. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -1
  33. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +4 -11
  34. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
  35. package/lib/esm/features/user/UserInfo.js +2 -2
  36. package/lib/esm/features/user/UserInfo.js.map +1 -1
  37. package/lib/esm/session/UserSessionProvider.js +6 -3
  38. package/lib/esm/session/UserSessionProvider.js.map +1 -1
  39. package/lib/esm/session/auth/composable.js +3 -3
  40. package/lib/esm/session/auth/composable.js.map +1 -1
  41. package/lib/esm/session/auth/firebase.js +7 -0
  42. package/lib/esm/session/auth/firebase.js.map +1 -1
  43. package/lib/esm/session/auth/useAuthState.js +0 -3
  44. package/lib/esm/session/auth/useAuthState.js.map +1 -1
  45. package/lib/esm/shell/apps/StandaloneApp.js +1 -1
  46. package/lib/esm/shell/apps/StandaloneApp.js.map +1 -1
  47. package/lib/esm/shell/login/EnterpriseSigninButton.js +3 -0
  48. package/lib/esm/shell/login/EnterpriseSigninButton.js.map +1 -1
  49. package/lib/esm/shell/login/InviteAcceptModal.js +1 -1
  50. package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -1
  51. package/lib/esm/widgets/form/ManagedObject.js +1 -1
  52. package/lib/esm/widgets/index.js +1 -0
  53. package/lib/esm/widgets/index.js.map +1 -1
  54. package/lib/esm/widgets/markdown/MarkdownRenderer.js +24 -0
  55. package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -0
  56. package/lib/esm/widgets/markdown/index.js +2 -0
  57. package/lib/esm/widgets/markdown/index.js.map +1 -0
  58. package/lib/tsconfig.tsbuildinfo +1 -1
  59. package/lib/types/core/components/Overlay.d.ts +25 -0
  60. package/lib/types/core/components/Overlay.d.ts.map +1 -0
  61. package/lib/types/core/components/SidePanel.d.ts +3 -1
  62. package/lib/types/core/components/SidePanel.d.ts.map +1 -1
  63. package/lib/types/core/components/index.d.ts +1 -0
  64. package/lib/types/core/components/index.d.ts.map +1 -1
  65. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
  66. package/lib/types/env/index.d.ts +2 -2
  67. package/lib/types/env/index.d.ts.map +1 -1
  68. package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
  69. package/lib/types/features/facets/DocumentsFacetsNav.d.ts.map +1 -1
  70. package/lib/types/features/facets/VTypeFacet.d.ts.map +1 -1
  71. package/lib/types/features/magic-pdf/TextPageView.d.ts.map +1 -1
  72. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts.map +1 -1
  73. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  74. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  75. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts +4 -3
  76. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts.map +1 -1
  77. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +5 -2
  78. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  79. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts +2 -4
  80. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts.map +1 -1
  81. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
  82. package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
  83. package/lib/types/session/auth/composable.d.ts +1 -1
  84. package/lib/types/session/auth/composable.d.ts.map +1 -1
  85. package/lib/types/session/auth/firebase.d.ts.map +1 -1
  86. package/lib/types/session/auth/useAuthState.d.ts.map +1 -1
  87. package/lib/types/shell/login/EnterpriseSigninButton.d.ts.map +1 -1
  88. package/lib/types/widgets/index.d.ts +1 -0
  89. package/lib/types/widgets/index.d.ts.map +1 -1
  90. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts +9 -0
  91. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -0
  92. package/lib/types/widgets/markdown/index.d.ts +2 -0
  93. package/lib/types/widgets/markdown/index.d.ts.map +1 -0
  94. package/lib/vertesia-ui-core.js +1 -1
  95. package/lib/vertesia-ui-core.js.map +1 -1
  96. package/lib/vertesia-ui-features.js +1 -1
  97. package/lib/vertesia-ui-features.js.map +1 -1
  98. package/lib/vertesia-ui-session.js +1 -1
  99. package/lib/vertesia-ui-session.js.map +1 -1
  100. package/lib/vertesia-ui-shell.js +1 -1
  101. package/lib/vertesia-ui-shell.js.map +1 -1
  102. package/lib/vertesia-ui-widgets.js +1 -1
  103. package/lib/vertesia-ui-widgets.js.map +1 -1
  104. package/package.json +6 -4
  105. package/src/core/components/Center.tsx +1 -1
  106. package/src/core/components/Overlay.tsx +129 -0
  107. package/src/core/components/SidePanel.tsx +38 -33
  108. package/src/core/components/index.ts +1 -0
  109. package/src/core/components/shadcn/tabs.tsx +48 -5
  110. package/src/env/index.ts +1 -1
  111. package/src/features/agent/PayloadBuilder.tsx +8 -2
  112. package/src/features/facets/DocumentsFacetsNav.tsx +4 -2
  113. package/src/features/facets/VTypeFacet.tsx +2 -1
  114. package/src/features/magic-pdf/TextPageView.tsx +3 -4
  115. package/src/features/store/collections/CreateCollection.tsx +1 -1
  116. package/src/features/store/objects/DocumentPreviewPanel.tsx +2 -4
  117. package/src/features/store/objects/DocumentSearchResults.tsx +24 -26
  118. package/src/features/store/objects/components/ContentOverview.tsx +3 -6
  119. package/src/features/store/objects/components/VectorSearchWidget.tsx +88 -60
  120. package/src/features/store/objects/search/DocumentSearchContext.ts +57 -36
  121. package/src/features/store/objects/search/DocumentSearchProvider.tsx +2 -6
  122. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +6 -12
  123. package/src/features/user/UserInfo.tsx +2 -2
  124. package/src/session/UserSessionProvider.tsx +5 -3
  125. package/src/session/auth/composable.ts +3 -3
  126. package/src/session/auth/firebase.ts +8 -0
  127. package/src/session/auth/useAuthState.ts +0 -4
  128. package/src/shell/apps/StandaloneApp.tsx +1 -1
  129. package/src/shell/login/EnterpriseSigninButton.tsx +3 -0
  130. package/src/shell/login/InviteAcceptModal.tsx +1 -1
  131. package/src/widgets/form/ManagedObject.ts +1 -1
  132. package/src/widgets/index.ts +1 -0
  133. package/src/widgets/markdown/MarkdownRenderer.tsx +45 -0
  134. package/src/widgets/markdown/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/codemirror/CodemirrorStateSingleton.js","esm/widgets/codemirror/CodeMirrorEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/fields.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/json-view/JSONCode.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/popover/context.js","esm/widgets/popover/slots.js","esm/widgets/popover/Popover.js","esm/widgets/Progress.js","esm/widgets/properties/PropertiesView.js","esm/widgets/schema-editor/JSONSchemaEditorModal.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/SvgIcon.js","esm/widgets/upload/DropZone.js","esm/widgets/upload/UploadResultCategory.js","esm/widgets/upload/UploadSummary.js","esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js"],"sourcesContent":["import { EditorState, Text } from '@codemirror/state';\nlet stateInstance = null;\n/**\n * Returns a shared instance of CodeMirror's EditorState.\n * If the instance doesn't exist, it creates one with the given initial content.\n *\n * @param initialDoc - The initial content for the editor, either as a `string` or `Text`.\n * @param extensions - Optional extensions to be applied to the editor.\n * @returns The shared EditorState instance.\n**/\nexport const getSharedEditorState = (initialDoc = \"\", extensions = []) => {\n const doc = typeof initialDoc === \"string\" ? Text.of(initialDoc.split(\"\\n\")) : initialDoc;\n if (!stateInstance) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n else if (stateInstance.doc.toString() !== doc.toString()) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n return stateInstance;\n};\n/**\n * Resets the singleton instance (useful for testing or reinitializing).\n**/\nexport const resetSharedEditorState = () => {\n stateInstance = null;\n};\n//# sourceMappingURL=CodemirrorStateSingleton.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport debounce from 'debounce';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { EditorView } from '@codemirror/view';\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { getSharedEditorState } from './CodemirrorStateSingleton';\nexport class EditorApi {\n editor;\n constructor(editor) {\n this.editor = editor;\n }\n setValue(value) {\n this.editor.dispatch({\n changes: {\n from: 0,\n to: this.editor.state.doc.length,\n insert: value || \"\",\n },\n });\n }\n getValue() {\n return this.editor.state.doc.toString();\n }\n}\nconst customTheme = EditorView.theme({\n \"&\": { fontSize: \"14px\", fontFamily: \"monospace\" },\n \".cm-content\": { fontFamily: \"inherit\" },\n \".cm-scroller\": { fontFamily: \"inherit\" },\n \".cm-gutters\": { backgroundColor: \"transparent\", color: \"#ddd\" },\n \".cm-focused\": { outline: \"none\" },\n \".cm-cursor\": {\n borderLeft: \"2px solid #808080\",\n borderLeftColor: \"#808080\",\n animation: \"blink 1.2s step-start infinite\"\n },\n \"@keyframes blink\": { \"50%\": { opacity: 0 } }\n});\nconst baseExtensions = [\n customTheme,\n EditorView.lineWrapping,\n];\nfunction updateListenerExtension(cb) {\n return EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n cb(update);\n }\n });\n}\n;\n/**\n * The className is only used on the first rendering - the editor class will not be updated if the property changes\n**/\nexport function CodeMirrorEditor({ onChange, value, className, editorRef, extensions, debounceTimeout = 0 }) {\n const ref = useRef(null);\n // the onChange property may change so we need to store it in a\n // reference to be able to update it when it changes without\n // re-registering the listener on codemirror since codemirror can only register\n // listeners at creation\n const onChangeRef = useRef(undefined);\n useEffect(() => {\n if (onChange) {\n onChangeRef.current = debounceTimeout > 0\n ? debounce(onChange, debounceTimeout)\n : onChange;\n return () => {\n // WE MUST NOT CANCEL THE DEBOUNCE even if we unset the onChange impl\n // otherwise some updates will never happens\n onChangeRef.current = undefined;\n };\n }\n }, [onChange, debounceTimeout]);\n const component = useMemo(() => _jsx(\"div\", { ref: ref, className: className }), [className]);\n useSafeLayoutEffect(() => {\n if (ref.current) {\n let actualExtensions = [...baseExtensions, updateListenerExtension((update) => {\n onChangeRef.current?.(update);\n })];\n if (Array.isArray(extensions)) {\n actualExtensions = actualExtensions.concat(extensions);\n }\n else if (extensions) {\n actualExtensions.push(extensions);\n }\n const sharedState = getSharedEditorState(value, actualExtensions);\n const editor = new EditorView({\n state: sharedState,\n parent: ref.current,\n });\n const api = new EditorApi(editor);\n if (editorRef) {\n editorRef.current = api;\n }\n return () => {\n editor.destroy();\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }\n }, [component, extensions]);\n return component;\n}\n//# sourceMappingURL=CodeMirrorEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nclass FormContext {\n object;\n components;\n constructor(object, components = {}) {\n this.object = object;\n this.components = components;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function FormLabel({ htmlFor, required, children }) {\n return (_jsxs(\"label\", { htmlFor: htmlFor, className: \"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200\", children: [children, required && _jsx(\"sup\", { className: \"text-red-600\", children: \"*\" })] }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { FormContextProvider, useForm } from \"./FormContext.js\";\nimport { FormLabel, FormHelper } from \"./fields.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: {\n object,\n components: components || {}\n }, children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\n// interface FieldSetProps {\n// name: string;\n// children?: ReactNode | ReactNode[];\n// }\n// export function FieldSet({ name, children }: FieldSetProps) {\n// const ctx = useForm();\n// const newCtx = {\n// ...ctx,\n// object: ctx.object.getProperty(name) as ManagedObjectProperty\n// }\n// return (\n// <FormContextProvider value={newCtx}>\n// {children}\n// </FormContextProvider>\n// )\n// }\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n const { value } = event.target;\n object.value = object.schema.isNumber ? parseFloat(value) : value;\n };\n return (_jsxs(\"div\", { className: \"\", children: [_jsxs(\"div\", { className: clsx('flex gap-2', inline ? 'flex-row items-center' : 'flex-col'), children: [!object.isListItem && _jsx(FormLabel, { required: object.schema.isRequired, children: object.title }), _jsx(Component, { object: object, type: inputType, onChange: handleOnChange })] }), object.schema.description && _jsx(FormHelper, { children: object.schema.description })] }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const addItem = () => {\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index) }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'secondary', onClick: addItem, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'secondary', onClick: onDelete, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map","import Ajv from \"ajv\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: {} };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n _validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.load();\n }\n get validator() {\n if (!this._validator) {\n const ajv = new Ajv({ allErrors: true, strict: false });\n this._validator = ajv.compile(this.schema);\n }\n return this._validator;\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return null;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = {};\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onCHnage only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ObjectWalker } from \"@vertesia/json\";\nimport { useEffect, useState } from \"react\";\nconst st_code = \"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono\";\nconst st_punct = \"text-pink-500 dark:text-pink-400\";\nconst st_symbol = \"text-purple-500 dark:text-purple-400\";\nconst st_number = \"text-green-500 dark:text-green-400\";\nconst st_string = \"text-orange-500 dark:text-orange-400\";\nconst st_key = \"text-blue-500 dark:text-blue-400\";\nconst defaultClassMap = {\n code: st_code,\n comma: st_punct,\n assign: st_punct,\n startObject: st_punct,\n endObject: st_punct,\n startArray: st_punct,\n endArray: st_punct,\n boolean: st_symbol,\n null: st_symbol,\n key: st_key,\n index: st_key,\n string: st_string,\n number: st_number,\n};\nclass Block {\n renderer;\n parent;\n key;\n indent;\n result = [];\n constructor(renderer, parent, key, indent) {\n this.renderer = renderer;\n this.parent = parent;\n this.key = key;\n this.indent = indent;\n }\n get classMap() {\n return this.renderer.classMap;\n }\n writeKey(key) {\n const type = typeof key;\n if (type === 'string') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n this.result.push(`<span class=\"${this.classMap.key}\">\"${key}\"</span><span class='${this.classMap.assign}'>: </span>`);\n }\n else if (type === 'number') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n }\n }\n pushValue(key, value) {\n this.writeKey(key);\n if (value === null) {\n this.result.push(`<span class='${this.classMap.null}'>null</span>`);\n }\n else if (value instanceof Block) {\n this.result.push(value.renderStart() + value.renderValue() + value.renderEnd());\n }\n else {\n let valueClass;\n const type = typeof value;\n if (type === 'string') {\n value = `\"${value}\"`;\n value = value.replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n valueClass = this.classMap.string;\n }\n else if (type === 'number') {\n valueClass = this.classMap.number;\n }\n else if (type === 'boolean') {\n valueClass = this.classMap.boolean;\n }\n this.result.push(`<span class='${valueClass}'>${value}</span>`);\n }\n }\n renderValue() {\n return this.result.join('');\n }\n}\nclass ObjectBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startObject}'>{\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endObject}'>${NL}${this.parent?.indent || ''}}</span>`;\n }\n}\nclass ArrayBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startArray}'>[\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endArray}'>${NL}${this.parent?.indent || ''}]</span>`;\n }\n}\nclass JsonRenderer {\n classMap;\n tab;\n stack = [];\n block = new ObjectBlock(this, undefined, '', '');\n constructor(classMap = defaultClassMap, tab = ' ') {\n this.classMap = classMap;\n this.tab = tab;\n }\n onStartObject(key) {\n const nested = new ObjectBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndObject() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onStartIteration(key) {\n const nested = new ArrayBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndIteration() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onValue(key, value) {\n this.block.pushValue(key, value);\n }\n}\nfunction renderJson(json, classMap, className) {\n const renderer = new JsonRenderer(classMap);\n new ObjectWalker().walk(json, renderer);\n const out = renderer.block.renderValue();\n return _jsx(\"div\", { className: className, dangerouslySetInnerHTML: { __html: `<div class='${renderer.classMap.code}' style='overflow-x: scroll'>${out}</div>` } });\n}\nexport function JSONCode({ data, className, classMap }) {\n const [element, setElement] = useState();\n useEffect(() => {\n setElement(renderJson(data, classMap, className));\n }, [data]);\n return element;\n}\n//# sourceMappingURL=JSONCode.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { createContext, useContext } from \"react\";\nconst PopoverContext = createContext(undefined);\nexport function usePopoverContext() {\n return useContext(PopoverContext);\n}\nexport { PopoverContext };\n//# sourceMappingURL=context.js.map","import { Children, isValidElement } from \"react\";\nconst __SLOT_NAME = Symbol('__SLOT_NAME');\nexport function processOneSlot(child, out, slots) {\n let slotName;\n if (isValidElement(child) && (slotName = child.type[__SLOT_NAME])) {\n slots[slotName] = child;\n }\n else {\n out.push(child);\n }\n}\nexport function processSlots(children, slots) {\n const out = [];\n Children.forEach(children, child => {\n processOneSlot(child, out, slots);\n });\n return out.length > 1 ? out : out[0];\n}\nexport function defineSlot(name, component) {\n component[__SLOT_NAME] = name;\n}\n//# sourceMappingURL=slots.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { flip, offset, shift } from \"@floating-ui/dom\";\nimport { FloatingFocusManager, FloatingPortal, autoUpdate, safePolygon, useClick, useDismiss, useFloating, useHover, useInteractions, useTransitionStyles } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { PopoverContext } from \"./context\";\nimport { defineSlot, processSlots } from \"./slots\";\nfunction computeElementProps(value) {\n if (!value)\n return { enabled: false };\n return (typeof value === 'boolean' ? { enabled: value } : value);\n}\nfunction getHoverProps(props) {\n return props?.hover === true ? {\n enabled: true,\n handleClose: safePolygon({ blockPointerEvents: true }),\n restMs: 0,\n } : props?.hover;\n}\nfunction getClickProps(props) {\n return props && !props.hover && !props.click ? {\n enabled: true,\n } : props?.click;\n}\n/**\n * The component is instantiated when all interactions are known\n * @param param0\n * @returns\n */\nexport function Popover(props) {\n const slots = {};\n processSlots(props.children, slots);\n if (!slots.content) {\n throw new Error('Popover must provide a content slot');\n }\n const triggerProps = slots.trigger?.props;\n const contentProps = slots.content.props;\n // wait for the trigger to be defined\n return _jsx(ResolvedPopover, { ...props, trigger: triggerProps, content: contentProps });\n}\nfunction ResolvedPopover({ middleware, offset: defaultOffset, trigger, dismiss = true, content, placement, strategy, zIndex = 40 }) {\n const [isOpen, setIsOpen] = useState(false);\n const floating = useFloating({\n open: isOpen,\n placement,\n strategy,\n onOpenChange: setIsOpen,\n middleware: middleware || [offset(defaultOffset || 4), shift(), flip()],\n whileElementsMounted: autoUpdate // stick to the anchor when resizing / scrolling\n });\n const { floatingStyles, refs: { setReference, setFloating }, context, } = floating;\n const dismissInteraction = useDismiss(context, computeElementProps(dismiss));\n const clickInteraction = useClick(context, computeElementProps(getClickProps(trigger)));\n const hoverInteraction = useHover(context, computeElementProps(getHoverProps(trigger)));\n const { getReferenceProps, getFloatingProps, } = useInteractions([dismissInteraction, clickInteraction, hoverInteraction]);\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, content.transition);\n return (_jsxs(PopoverContext.Provider, { value: {\n ...floating,\n close: () => setIsOpen(false)\n }, children: [trigger &&\n _jsx(\"div\", { className: clsx(trigger.className, \"inline-block\"), ref: setReference, ...getReferenceProps(), children: trigger.children }), _jsx(FloatingPortal, { children: isMounted && (_jsx(\"div\", { ref: setFloating, style: { ...floatingStyles, zIndex: zIndex }, ...getFloatingProps(), children: _jsx(FloatingFocusManager, { context: context, children: _jsx(\"div\", { className: clsx(content.className, \"bg-popover rounded-md text-popover-foreground max-w-md\"), style: transitionStyles, children: content.children }) }) })) })] }));\n}\nfunction PopoverTrigger(_props) {\n return null;\n}\ndefineSlot('trigger', PopoverTrigger);\nfunction PopoverContent(_props) {\n return null;\n}\ndefineSlot('content', PopoverContent);\nPopover.Trigger = PopoverTrigger;\nPopover.Content = PopoverContent;\n//# sourceMappingURL=Popover.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function Progress({ percent }) {\n return (_jsx(\"div\", { className: \"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700\", children: _jsx(\"div\", { className: \"bg-blue-600 h-2.5 rounded-full\", style: { width: `${percent}%` } }) }));\n}\n//# sourceMappingURL=Progress.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Table, VTooltip } from \"@vertesia/ui/core\";\nimport { Info } from \"lucide-react\";\nexport function PropertiesView({ className, properties }) {\n return (_jsx(Table, { className: className, children: _jsx(\"tbody\", { children: properties.map((property) => (_jsxs(\"tr\", { children: [_jsxs(\"td\", { className: 'w-1/3 font-semibold gap-2', children: [_jsx(\"span\", { children: property.name }), property.description &&\n _jsx(VTooltip, { description: property.description, placement: \"top\", children: _jsx(Info, { className: \"size-3 ml-2 text-muted-foreground\" }) })] }), _jsx(\"td\", { className: 'w-2/3', children: property.value ?? 'undefined' })] }, property.name))) }) }));\n}\n//# sourceMappingURL=PropertiesView.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { json } from \"@codemirror/lang-json\";\nimport { CodeMirrorEditor } from \"../codemirror\";\nimport { Button, VModal, VModalBody, VModalFooter, VModalTitle, useToast } from \"@vertesia/ui/core\";\nimport { basicSetup } from \"codemirror\";\nimport { useMemo, useRef } from \"react\";\nimport { JSONCode } from '../json-view';\nfunction contentToJSON(content) {\n if (!content)\n return undefined;\n content = content.trim();\n if (!content)\n return undefined;\n return JSON.parse(content);\n}\nfunction jsonToContent(json) {\n if (!json)\n return '';\n return JSON.stringify(json, null, 2);\n}\nconst extensions = [basicSetup, json()];\nexport function JSONSchemaEditorModal({ schema, isOpen, onClose, readonly = false }) {\n const editorRef = useRef(undefined);\n const toast = useToast();\n const value = useMemo(() => {\n return jsonToContent(schema.schema);\n }, [schema]);\n const onSaveChanges = () => {\n if (editorRef.current) {\n const value = editorRef.current.getValue();\n try {\n const newSchema = contentToJSON(value);\n schema.replaceSchema(newSchema);\n onClose();\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid JSON Schema',\n description: err.message,\n duration: 5000\n });\n }\n }\n };\n return (_jsxs(VModal, { onClose: onClose, isOpen: !!isOpen, className: 'min-w-[60vw]', children: [_jsx(VModalTitle, { children: \"JSON Schema Editor\" }), _jsx(VModalBody, { children: !readonly ? _jsx(CodeMirrorEditor, { value: value, extensions: extensions, editorRef: editorRef })\n : _jsx(JSONCode, { data: schema.schema || {} }) }), _jsx(VModalFooter, { children: !readonly ? _jsx(Button, { onClick: onSaveChanges, children: \"Save changes\" }) : null })] }));\n}\n//# sourceMappingURL=JSONSchemaEditorModal.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor || schema.format) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n this.schema.format = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(VSelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(VModal, { isOpen: isOpen, onClose: onClose, children: [_jsx(VModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-muted', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { SquarePen, Trash2 } from 'lucide-react';\nimport { Button, Styles, useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-ring`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { className: \"\", children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'invisible group-hover:visible';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onEdit, children: _jsx(SquarePen, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { Button, useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(Button, { variant: \"ghost\", onClick: add, children: [_jsx(Plus, { className: 'size-4' }), \"Add property\"] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from \"react\";\nexport function SvgIcon({ content, ...props }) {\n const containerRef = useRef(null);\n useEffect(() => {\n if (!containerRef.current)\n return;\n // Parse the SVG string\n const parser = new DOMParser();\n const doc = parser.parseFromString(content, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) {\n console.warn('SvgIcon: No <svg> element found in provided string');\n containerRef.current.innerHTML = '';\n return;\n }\n // Apply all passed props to the SVG element\n props && Object.entries(props).forEach(([key, value]) => {\n if (value == null)\n return;\n const attrName = key === 'className' ? 'class' : key;\n svgEl.setAttribute(attrName, String(value));\n });\n // Clear and append the new SVG\n containerRef.current.innerHTML = '';\n containerRef.current.appendChild(svgEl);\n }, [content, props]);\n return _jsx(\"span\", { ref: containerRef });\n}\nexport function createSvgIcon(content) {\n const IconComponent = (props) => {\n return _jsx(SvgIcon, { content: content, ...props });\n };\n return IconComponent;\n}\n//# sourceMappingURL=SvgIcon.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState, useRef } from \"react\";\nimport { UploadIcon } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\n/**\n * A reusable drop zone component for file uploads\n *\n * @example\n * <DropZone\n * onDrop={handleFileSelect}\n * message=\"Drag and drop files here\"\n * buttonLabel=\"Select Files\"\n * />\n */\nexport function DropZone({ onDrop, message, buttonLabel = \"Upload Files\", allowFolders = true, className = \"\" }) {\n const [isDragging, setIsDragging] = useState(false);\n const inputRef = useRef(null);\n const dropZoneRef = useRef(null);\n const handleDragOver = (e) => {\n e.preventDefault();\n if (e.dataTransfer.types.includes('Files')) {\n setIsDragging(true);\n }\n };\n const handleDragLeave = (e) => {\n e.preventDefault();\n // Only set dragging to false if leaving the container (not entering a child)\n if (dropZoneRef.current && !dropZoneRef.current.contains(e.relatedTarget)) {\n setIsDragging(false);\n }\n };\n const handleDrop = async (e) => {\n e.preventDefault();\n setIsDragging(false);\n if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {\n // Handle folders using the DataTransferItemList API which supports directory reading\n const items = Array.from(e.dataTransfer.items);\n const files = [];\n const folders = new Set();\n const processEntry = async (entry) => {\n if (entry.isFile) {\n // Get file\n const file = await new Promise((resolve) => {\n entry.file((file) => {\n // Store full path in the file object for location use\n Object.defineProperty(file, \"webkitRelativePath\", {\n writable: true,\n value: entry.fullPath.substring(1), // Remove leading slash\n });\n resolve(file);\n });\n });\n // Skip hidden files\n if (!file.name.startsWith(\".\") && file.size > 0) {\n files.push(file);\n }\n // Add folder path to tracking\n const folderPath = entry.fullPath.substring(1).split(\"/\").slice(0, -1).join(\"/\");\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n else if (entry.isDirectory) {\n // Get folder reader\n const reader = entry.createReader();\n const entries = await new Promise((resolve) => {\n reader.readEntries((entries) => {\n resolve(entries);\n });\n });\n // Process all entries\n await Promise.all(entries.map(processEntry));\n // Add this folder to tracking\n const folderPath = entry.fullPath.substring(1);\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n };\n try {\n // Process all dropped items\n await Promise.all(items.map((item) => {\n const entry = item.webkitGetAsEntry ? item.webkitGetAsEntry() : item;\n if (entry) {\n return processEntry(entry);\n }\n return Promise.resolve();\n }));\n if (files.length > 0) {\n const topLevelFolders = new Set(Array.from(folders)\n .map((path) => path.split(\"/\")[0])\n .filter(Boolean));\n const folderCount = topLevelFolders.size;\n const fileCount = files.length;\n let message = \"\";\n if (folderCount > 0) {\n message =\n folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n }\n else {\n message = `Preparing to upload ${fileCount} file${fileCount === 1 ? \"\" : \"s\"}...`;\n }\n onDrop(files, { count: files.length, message });\n }\n }\n catch (error) {\n console.error(\"Error processing dropped files:\", error);\n // Fallback to simple file array if folder processing fails\n const fileArray = Array.from(e.dataTransfer.files);\n if (fileArray.length > 0) {\n onDrop(fileArray);\n }\n }\n }\n else if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // Fallback for browsers that don't support items API\n const fileArray = Array.from(e.dataTransfer.files);\n onDrop(fileArray);\n }\n };\n const handleChange = (e) => {\n if (e.target.files && e.target.files.length > 0) {\n const fileArray = Array.from(e.target.files);\n // Check if there are directories (with webkitRelativePath)\n const hasDirectories = fileArray.some((file) => file.webkitRelativePath && file.webkitRelativePath.includes(\"/\"));\n if (hasDirectories) {\n // Count the unique top-level directories\n const topLevelDirs = new Set(fileArray.map((file) => file.webkitRelativePath?.split(\"/\")[0]).filter(Boolean));\n const folderCount = topLevelDirs.size;\n const fileCount = fileArray.length;\n // Create custom message with folder info\n const formattedMessage = folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n const customMessage = {\n count: fileArray.length,\n message: formattedMessage,\n };\n onDrop(fileArray, customMessage);\n }\n else {\n // Regular file upload\n const feedback = {\n count: fileArray.length,\n message: `Preparing to upload ${fileArray.length} file${fileArray.length === 1 ? \"\" : \"s\"}...`,\n };\n onDrop(fileArray, feedback);\n }\n }\n };\n const openFileSelector = () => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n };\n return (_jsxs(\"div\", { className: `flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${isDragging ? \"border-color-primary bg-color-primary/10\" : \"border-dashed border-color-border\"} ${className}`, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(UploadIcon, { className: `h-12 w-12 mb-3 transition-colors ${isDragging ? \"text-primary\" : \"text-muted/50\"}` }), _jsx(\"p\", { className: \"text-color-muted-foreground\", children: message }), _jsxs(\"div\", { className: \"mt-4 text-center\", children: [_jsxs(\"div\", { className: \"text-sm text-muted mb-2\", children: [\"Drag and drop files\", allowFolders ? \" or folders\" : \"\", \" here, or\"] }), _jsxs(Button, { onClick: openFileSelector, children: [_jsx(UploadIcon, { className: \"h-4 w-4 mr-2\" }), buttonLabel] }), _jsx(\"input\", { type: \"file\", ref: inputRef, onChange: handleChange, multiple: true, \n // @ts-expect-error: webkitdirectory is a non-standard attribute\n webkitdirectory: allowFolders ? \"\" : undefined, directory: allowFolders ? \"\" : undefined, className: \"hidden\" })] })] }));\n}\n//# sourceMappingURL=DropZone.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon } from \"lucide-react\";\nimport { useState } from \"react\";\n/**\n * Displays a collapsible category of upload results\n *\n * @example\n * <UploadResultCategory\n * title=\"Successfully Uploaded\"\n * count={3}\n * icon={<CheckCircleIcon className=\"h-4 w-4 text-green-500\" />}\n * items={[\"document1.pdf\", \"document2.pdf\", \"document3.pdf\"]}\n * />\n */\nexport function UploadResultCategory({ title, count, icon = _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items }) {\n const [isExpanded, setIsExpanded] = useState(false);\n return (_jsxs(\"div\", { className: \"border border-color-border rounded-md overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer\", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"span\", { className: \"mr-2\", children: icon }), _jsx(\"span\", { className: \"font-medium\", children: title }), _jsx(\"span\", { className: \"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs\", children: count })] }), _jsx(\"button\", { className: \"text-muted\", children: _jsx(\"svg\", { className: `h-5 w-5 transition-transform ${isExpanded ? 'transform rotate-180' : ''}`, fill: \"none\", viewBox: \"0 0 24 24\", stroke: \"currentColor\", children: _jsx(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M19 9l-7 7-7-7\" }) }) })] }), isExpanded && (_jsx(\"div\", { className: \"p-3 border-t border-color-border max-h-48 overflow-y-auto\", children: items.length > 0 ? (_jsx(\"ul\", { className: \"space-y-1\", children: items.map((item, index) => (_jsx(\"li\", { className: \"text-sm py-1 px-2 rounded hover:bg-color-muted/10\", children: item }, index))) })) : (_jsx(\"div\", { className: \"text-sm text-muted py-2\", children: \"No items to display\" })) }))] }));\n}\n//# sourceMappingURL=UploadResultCategory.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from \"lucide-react\";\nimport { UploadResultCategory } from \"./UploadResultCategory\";\n/**\n * Displays a summary of upload results with collapsible categories\n *\n * @example\n * <UploadSummary\n * files={[\n * { name: \"document1.pdf\", status: \"success\" },\n * { name: \"document2.pdf\", status: \"skipped\" }\n * ]}\n * location=\"/reports/2023\"\n * />\n */\nexport function UploadSummary({ files, className = \"\", location, collection }) {\n // Group files by status\n const successFiles = files.filter(f => f.status === 'success');\n const updatedFiles = files.filter(f => f.status === 'updated');\n const skippedFiles = files.filter(f => f.status === 'skipped');\n const failedFiles = files.filter(f => f.status === 'failed');\n // Calculate counts\n const successCount = successFiles.length;\n const updatedCount = updatedFiles.length;\n const skippedCount = skippedFiles.length;\n const failedCount = failedFiles.length;\n const totalCount = files.length;\n return (_jsxs(\"div\", { className: `flex flex-col py-2 ${className}`, children: [_jsxs(\"div\", { className: \"flex items-center mb-4\", children: [_jsx(\"div\", { className: \"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center\", children: _jsx(CheckCircleIcon, { className: \"size-4 text-success\" }) }), _jsx(\"div\", { children: _jsxs(\"p\", { className: \"text-muted\", children: [totalCount, \" file\", totalCount !== 1 ? \"s\" : \"\", \" processed\", collection ? ` in collection '${collection}'` : \"\", location ? ` in folder '${location}'` : \"\"] }) })] }), _jsxs(\"div\", { className: \"space-y-3 mt-2\", children: [successCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Uploaded\", count: successCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items: successFiles.map(f => f.name) })), updatedCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Updated\", count: updatedCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-blue-500\" }), items: updatedFiles.map(f => f.name) })), skippedCount > 0 && (_jsx(UploadResultCategory, { title: \"Skipped (Already Existed)\", count: skippedCount, icon: _jsx(AlertCircleIcon, { className: \"h-4 w-4 text-amber-500\" }), items: skippedFiles.map(f => f.name) })), failedCount > 0 && (_jsx(UploadResultCategory, { title: \"Failed to Upload\", count: failedCount, icon: _jsx(XCircleIcon, { className: \"h-4 w-4 text-red-500\" }), items: failedFiles.map(f => f.name) }))] })] }));\n}\n//# sourceMappingURL=UploadSummary.js.map","export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"path\", { d: \"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { isEqual } from 'lodash-es';\nimport { useEffect, useMemo, useState } from 'react';\nimport { defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n const [theme, setTheme] = useState(() => ({ ...defaultTheme, ...customTheme }));\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n useEffect(() => {\n setTheme((currentTheme) => {\n const nextTheme = { ...defaultTheme, ...customTheme };\n return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;\n });\n }, [customTheme]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map"],"names":["stateInstance","EditorApi","editor","constructor","this","setValue","value","dispatch","changes","from","to","state","doc","length","insert","getValue","toString","baseExtensions","EditorView","theme","fontSize","fontFamily","backgroundColor","color","outline","borderLeft","borderLeftColor","animation","opacity","lineWrapping","CodeMirrorEditor","onChange","className","editorRef","extensions","debounceTimeout","ref","useRef","onChangeRef","undefined","useEffect","current","debounce","component","useMemo","_jsx","useSafeLayoutEffect","actualExtensions","cb","update","updateListener","of","docChanged","Array","isArray","concat","push","sharedState","initialDoc","Text","split","EditorState","create","getSharedEditorState","parent","api","destroy","FieldSetContext","createContext","FieldSetContextProvider","Provider","useFieldSet","ctx","useContext","Error","_FormContext","useForm","FormContextProvider","FormLabel","htmlFor","required","children","_jsxs","FormHelper","FormError","Input","React","forwardRef","object","type","props","actualValue","useState","String","booleanValue","setBooleanValue","schema","isBoolean","clsx","Styles","INPUT","_onChange","ev","target","checked","Form","components","onSubmit","observer","evt","stopPropagation","preventDefault","GeneratedFormFields","properties","map","renderProperty","GeneratedForm","prop","isList","ListField","name","isObject","CompositeField","ScalarField","inline","Component","inputType","getInputType","isListItem","isRequired","title","event","isNumber","parseFloat","description","items","item","index","ListItem","list","onDelete","remove","deleteItem","Button","variant","onClick","add","Plus","arraySchema","Trash2","Schema","_validator","load","validator","ajv","Ajv","allErrors","strict","compile","Object","keys","forEach","loadProperty","hasProperties","propertySchema","property","ArrayPropertySchema","PropertySchema","validate","errors","addProperty","typeOrSchema","removeProperty","filter","x","getProperty","super","isMulti","isReadOnly","readOnly","defaultValue","default","enum","values","includes","isString","getArrayElementType","computeTitleFromName","replace","toUpperCase","slice","_name","Node","isRoot","root","path","isScalar","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","out","Symbol","iterator","ManagedObject","_v","newItem","ManageObjectEntry","ManagedScalarEntry","splice","i","l","trim","pop","key","Date","now","st_punct","st_symbol","st_key","defaultClassMap","code","comma","assign","startObject","endObject","startArray","endArray","boolean","null","string","number","Block","renderer","indent","result","classMap","writeKey","pushValue","renderStart","renderValue","renderEnd","valueClass","join","ObjectBlock","NL","ArrayBlock","JsonRenderer","tab","stack","block","onStartObject","nested","onEndObject","currentBlock","onStartIteration","onEndIteration","onValue","JSONCode","data","element","setElement","json","ObjectWalker","walk","dangerouslySetInnerHTML","__html","renderJson","JSONView","entries","PropertyElement","PropertyTitle","BlockElement","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","itemMediumLength","isInline","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","PopoverContext","usePopoverContext","__SLOT_NAME","processSlots","slots","Children","child","slotName","isValidElement","processOneSlot","defineSlot","computeElementProps","enabled","Popover","triggerProps","trigger","contentProps","ResolvedPopover","middleware","offset","defaultOffset","dismiss","placement","strategy","zIndex","isOpen","setIsOpen","floating","useFloating","open","onOpenChange","shift","flip","whileElementsMounted","autoUpdate","floatingStyles","refs","setReference","setFloating","context","dismissInteraction","useDismiss","clickInteraction","useClick","hover","click","hoverInteraction","useHover","handleClose","safePolygon","blockPointerEvents","restMs","getHoverProps","getReferenceProps","getFloatingProps","useInteractions","isMounted","styles","transitionStyles","useTransitionStyles","transition","close","FloatingPortal","style","FloatingFocusManager","PopoverTrigger","_props","PopoverContent","Progress","percent","width","PropertiesView","Table","VTooltip","Info","Trigger","Content","basicSetup","JSONSchemaEditorModal","onClose","readonly","toast","useToast","JSON","stringify","jsonToContent","VModal","VModalTitle","VModalBody","VModalFooter","newSchema","parse","contentToJSON","replaceSchema","err","status","message","duration","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","format","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","findAvailableChildName","prefix","addChild","addRequired","c","updated","newName","newProperties","setPropertyName","indexOf","setRequireProperty","actualType","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","endsWith","substring","text","parseTypeSignature","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","options","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","size","AlignLeft","EditDescriptionModal","focus","onKeyUp","e","INPUT_UNSTYLED","display","VSelectBox","onBlur","onKeyDown","popupClass","EditDescriptionModalForm","currentValue","setCurrentValue","_Fragment","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","outlineOnHover","editOnClick","placeholder","viewer","skipClickOutside","isEditing","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","SquarePen","Editor","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","autoSave","clearTimeout","setTimeout","closest","SchemaEditor","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","test","editableProp","SvgIcon","containerRef","svgEl","DOMParser","parseFromString","querySelector","console","warn","innerHTML","attrName","setAttribute","appendChild","createSvgIcon","DropZone","onDrop","buttonLabel","allowFolders","isDragging","setIsDragging","inputRef","dropZoneRef","onDragOver","dataTransfer","onDragLeave","contains","relatedTarget","async","files","folders","Set","processEntry","entry","isFile","file","Promise","resolve","defineProperty","writable","fullPath","startsWith","folderPath","isDirectory","reader","createReader","readEntries","all","webkitGetAsEntry","folderCount","Boolean","fileCount","count","error","fileArray","UploadIcon","some","webkitRelativePath","formattedMessage","customMessage","feedback","multiple","webkitdirectory","directory","UploadResultCategory","icon","CheckCircleIcon","isExpanded","setIsExpanded","fill","viewBox","stroke","strokeLinecap","strokeLinejoin","strokeWidth","d","UploadSummary","location","collection","successFiles","f","updatedFiles","skippedFiles","failedFiles","successCount","updatedCount","skippedCount","failedCount","totalCount","AlertCircleIcon","XCircleIcon","ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","XMLViewerContext","collapsible","indentSize","useXMLViewerContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","indentation","CollapseIcon","collapsed","position","right","border","padding","background","Caret","transform","attrs","height","useCollapsible","level","initialCollapsedDepth","setCollapsed","isNil","buttonProps","currentCollapsed","role","cursor","CommentTag","Attributes","attributes","DeclarationTag","tagKey","hasBreakLines","elements","getTagProps","elementWithoutAttributes","omit","subElements","getTagType","hasAttributes","Tag","hasChildren","TextElement","hasSiblings","isText","line","Elements","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","setTheme","valid","XMLValid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BAAEA,EAAoBlC,sBAAEA,GAA2B3jB,GAC5HvE,EAAOqqB,GAAY5lB,GAAS,KAAO,IAAKqhB,MAAiBmE,OAC1Dza,KAAEA,EAAI8a,MAAEA,GZCH,SAAsBJ,GACjC,OAAOzoB,GAAQ,KACX,IACI,IAAK8oB,GAAalhB,SAAS6gB,GACvB,MAAM,IAAI3mB,MAAM,gBAEpB,MAAMiM,EAAOkX,GAAO1P,MAAMkT,GAC1B,GAAmB,iBAARA,GAAoBA,EAAI5d,OAAO5M,OAAS,GAAqB,IAAhB8P,EAAK9P,OACzD,MAAM,IAAI6D,MAAM,gBAEpB,MAAO,CAAEiM,OAAM8a,OAAO,EAClC,CACQ,MAAOrO,GAEH,MAAO,CAAEzM,KAAM,KAAM8a,OAAO,EAAOE,aAAc,kBADnCvO,EAC2D5E,UACrF,IACO,CAAC6S,GACR,CYlB4BO,CAAaP,GAC/BtW,EAAUnS,GAAQ,KAAO,CAC3BzB,QACAumB,cACAC,aACA0B,sBAAuBA,GAAyBkC,KAChD,CAACpqB,EAAOumB,EAAaC,EAAY4D,EAAsBlC,IAO3D,OANA7mB,GAAU,KACNgpB,GAAUK,IACN,MAAMC,EAAY,IAAK7E,MAAiBmE,GACxC,OAAOW,GAAQD,EAAWD,GAAgBA,EAAeC,OAE9D,CAACV,IACCK,EAGG5oB,EAAK4kB,GAAiBnjB,SAAU,CAAEhE,MAAOyU,EAAS9P,SAAUpC,EAAK,MAAO,CAAEb,UAAW,gBAAiBuU,MAAO,CAAEyV,WAAY,WAAY3qB,WAAYF,EAAME,WAAY4qB,aAAc,cAAgBhnB,SAAUpC,EAAKkoB,GAAU,CAAEb,SAAUvZ,QAFrO2a,GAA0BzoB,EAAKqoB,GAAY,CAAA,EAG1D"}
1
+ {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/codemirror/CodemirrorStateSingleton.js","esm/widgets/codemirror/CodeMirrorEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/fields.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/json-view/JSONCode.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/markdown/MarkdownRenderer.js","esm/widgets/popover/context.js","esm/widgets/popover/slots.js","esm/widgets/popover/Popover.js","esm/widgets/Progress.js","esm/widgets/properties/PropertiesView.js","esm/widgets/schema-editor/JSONSchemaEditorModal.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/SvgIcon.js","esm/widgets/upload/DropZone.js","esm/widgets/upload/UploadResultCategory.js","esm/widgets/upload/UploadSummary.js","esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js"],"sourcesContent":["import { EditorState, Text } from '@codemirror/state';\nlet stateInstance = null;\n/**\n * Returns a shared instance of CodeMirror's EditorState.\n * If the instance doesn't exist, it creates one with the given initial content.\n *\n * @param initialDoc - The initial content for the editor, either as a `string` or `Text`.\n * @param extensions - Optional extensions to be applied to the editor.\n * @returns The shared EditorState instance.\n**/\nexport const getSharedEditorState = (initialDoc = \"\", extensions = []) => {\n const doc = typeof initialDoc === \"string\" ? Text.of(initialDoc.split(\"\\n\")) : initialDoc;\n if (!stateInstance) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n else if (stateInstance.doc.toString() !== doc.toString()) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n return stateInstance;\n};\n/**\n * Resets the singleton instance (useful for testing or reinitializing).\n**/\nexport const resetSharedEditorState = () => {\n stateInstance = null;\n};\n//# sourceMappingURL=CodemirrorStateSingleton.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport debounce from 'debounce';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { EditorView } from '@codemirror/view';\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { getSharedEditorState } from './CodemirrorStateSingleton';\nexport class EditorApi {\n editor;\n constructor(editor) {\n this.editor = editor;\n }\n setValue(value) {\n this.editor.dispatch({\n changes: {\n from: 0,\n to: this.editor.state.doc.length,\n insert: value || \"\",\n },\n });\n }\n getValue() {\n return this.editor.state.doc.toString();\n }\n}\nconst customTheme = EditorView.theme({\n \"&\": { fontSize: \"14px\", fontFamily: \"monospace\" },\n \".cm-content\": { fontFamily: \"inherit\" },\n \".cm-scroller\": { fontFamily: \"inherit\" },\n \".cm-gutters\": { backgroundColor: \"transparent\", color: \"#ddd\" },\n \".cm-focused\": { outline: \"none\" },\n \".cm-cursor\": {\n borderLeft: \"2px solid #808080\",\n borderLeftColor: \"#808080\",\n animation: \"blink 1.2s step-start infinite\"\n },\n \"@keyframes blink\": { \"50%\": { opacity: 0 } }\n});\nconst baseExtensions = [\n customTheme,\n EditorView.lineWrapping,\n];\nfunction updateListenerExtension(cb) {\n return EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n cb(update);\n }\n });\n}\n;\n/**\n * The className is only used on the first rendering - the editor class will not be updated if the property changes\n**/\nexport function CodeMirrorEditor({ onChange, value, className, editorRef, extensions, debounceTimeout = 0 }) {\n const ref = useRef(null);\n // the onChange property may change so we need to store it in a\n // reference to be able to update it when it changes without\n // re-registering the listener on codemirror since codemirror can only register\n // listeners at creation\n const onChangeRef = useRef(undefined);\n useEffect(() => {\n if (onChange) {\n onChangeRef.current = debounceTimeout > 0\n ? debounce(onChange, debounceTimeout)\n : onChange;\n return () => {\n // WE MUST NOT CANCEL THE DEBOUNCE even if we unset the onChange impl\n // otherwise some updates will never happens\n onChangeRef.current = undefined;\n };\n }\n }, [onChange, debounceTimeout]);\n const component = useMemo(() => _jsx(\"div\", { ref: ref, className: className }), [className]);\n useSafeLayoutEffect(() => {\n if (ref.current) {\n let actualExtensions = [...baseExtensions, updateListenerExtension((update) => {\n onChangeRef.current?.(update);\n })];\n if (Array.isArray(extensions)) {\n actualExtensions = actualExtensions.concat(extensions);\n }\n else if (extensions) {\n actualExtensions.push(extensions);\n }\n const sharedState = getSharedEditorState(value, actualExtensions);\n const editor = new EditorView({\n state: sharedState,\n parent: ref.current,\n });\n const api = new EditorApi(editor);\n if (editorRef) {\n editorRef.current = api;\n }\n return () => {\n editor.destroy();\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }\n }, [component, extensions]);\n return component;\n}\n//# sourceMappingURL=CodeMirrorEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nclass FormContext {\n object;\n components;\n constructor(object, components = {}) {\n this.object = object;\n this.components = components;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function FormLabel({ htmlFor, required, children }) {\n return (_jsxs(\"label\", { htmlFor: htmlFor, className: \"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200\", children: [children, required && _jsx(\"sup\", { className: \"text-red-600\", children: \"*\" })] }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { FormContextProvider, useForm } from \"./FormContext.js\";\nimport { FormLabel, FormHelper } from \"./fields.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: {\n object,\n components: components || {}\n }, children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\n// interface FieldSetProps {\n// name: string;\n// children?: ReactNode | ReactNode[];\n// }\n// export function FieldSet({ name, children }: FieldSetProps) {\n// const ctx = useForm();\n// const newCtx = {\n// ...ctx,\n// object: ctx.object.getProperty(name) as ManagedObjectProperty\n// }\n// return (\n// <FormContextProvider value={newCtx}>\n// {children}\n// </FormContextProvider>\n// )\n// }\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n const { value } = event.target;\n object.value = object.schema.isNumber ? parseFloat(value) : value;\n };\n return (_jsxs(\"div\", { className: \"\", children: [_jsxs(\"div\", { className: clsx('flex gap-2', inline ? 'flex-row items-center' : 'flex-col'), children: [!object.isListItem && _jsx(FormLabel, { required: object.schema.isRequired, children: object.title }), _jsx(Component, { object: object, type: inputType, onChange: handleOnChange })] }), object.schema.description && _jsx(FormHelper, { children: object.schema.description })] }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const addItem = () => {\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index) }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'secondary', onClick: addItem, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'secondary', onClick: onDelete, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map","import Ajv from \"ajv\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: {} };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n _validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.load();\n }\n get validator() {\n if (!this._validator) {\n const ajv = new Ajv({ allErrors: true, strict: false });\n this._validator = ajv.compile(this.schema);\n }\n return this._validator;\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return null;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = {};\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onChange only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ObjectWalker } from \"@vertesia/json\";\nimport { useEffect, useState } from \"react\";\nconst st_code = \"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono\";\nconst st_punct = \"text-pink-500 dark:text-pink-400\";\nconst st_symbol = \"text-purple-500 dark:text-purple-400\";\nconst st_number = \"text-green-500 dark:text-green-400\";\nconst st_string = \"text-orange-500 dark:text-orange-400\";\nconst st_key = \"text-blue-500 dark:text-blue-400\";\nconst defaultClassMap = {\n code: st_code,\n comma: st_punct,\n assign: st_punct,\n startObject: st_punct,\n endObject: st_punct,\n startArray: st_punct,\n endArray: st_punct,\n boolean: st_symbol,\n null: st_symbol,\n key: st_key,\n index: st_key,\n string: st_string,\n number: st_number,\n};\nclass Block {\n renderer;\n parent;\n key;\n indent;\n result = [];\n constructor(renderer, parent, key, indent) {\n this.renderer = renderer;\n this.parent = parent;\n this.key = key;\n this.indent = indent;\n }\n get classMap() {\n return this.renderer.classMap;\n }\n writeKey(key) {\n const type = typeof key;\n if (type === 'string') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n this.result.push(`<span class=\"${this.classMap.key}\">\"${key}\"</span><span class='${this.classMap.assign}'>: </span>`);\n }\n else if (type === 'number') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n }\n }\n pushValue(key, value) {\n this.writeKey(key);\n if (value === null) {\n this.result.push(`<span class='${this.classMap.null}'>null</span>`);\n }\n else if (value instanceof Block) {\n this.result.push(value.renderStart() + value.renderValue() + value.renderEnd());\n }\n else {\n let valueClass;\n const type = typeof value;\n if (type === 'string') {\n value = `\"${value}\"`;\n value = value.replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n valueClass = this.classMap.string;\n }\n else if (type === 'number') {\n valueClass = this.classMap.number;\n }\n else if (type === 'boolean') {\n valueClass = this.classMap.boolean;\n }\n this.result.push(`<span class='${valueClass}'>${value}</span>`);\n }\n }\n renderValue() {\n return this.result.join('');\n }\n}\nclass ObjectBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startObject}'>{\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endObject}'>${NL}${this.parent?.indent || ''}}</span>`;\n }\n}\nclass ArrayBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startArray}'>[\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endArray}'>${NL}${this.parent?.indent || ''}]</span>`;\n }\n}\nclass JsonRenderer {\n classMap;\n tab;\n stack = [];\n block = new ObjectBlock(this, undefined, '', '');\n constructor(classMap = defaultClassMap, tab = ' ') {\n this.classMap = classMap;\n this.tab = tab;\n }\n onStartObject(key) {\n const nested = new ObjectBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndObject() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onStartIteration(key) {\n const nested = new ArrayBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndIteration() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onValue(key, value) {\n this.block.pushValue(key, value);\n }\n}\nfunction renderJson(json, classMap, className) {\n const renderer = new JsonRenderer(classMap);\n new ObjectWalker().walk(json, renderer);\n const out = renderer.block.renderValue();\n return _jsx(\"div\", { className: className, dangerouslySetInnerHTML: { __html: `<div class='${renderer.classMap.code}' style='overflow-x: scroll'>${out}</div>` } });\n}\nexport function JSONCode({ data, className, classMap }) {\n const [element, setElement] = useState();\n useEffect(() => {\n setElement(renderJson(data, classMap, className));\n }, [data]);\n return element;\n}\n//# sourceMappingURL=JSONCode.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport Markdown from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport { visit, SKIP } from 'unist-util-visit';\nfunction remarkRemoveComments() {\n return (tree) => {\n visit(tree, 'html', (node, index, parent) => {\n if (node.value && /<!--[\\s\\S]*?-->/.test(node.value)) {\n if (parent && typeof index === 'number' && parent.children) {\n parent.children.splice(index, 1);\n return [SKIP, index];\n }\n }\n });\n };\n}\nexport function MarkdownRenderer({ children, components, remarkPlugins = [], removeComments = true }) {\n const plugins = [remarkGfm, ...remarkPlugins];\n if (removeComments) {\n plugins.push(remarkRemoveComments);\n }\n return (_jsx(Markdown, { remarkPlugins: plugins, components: components, children: children }));\n}\n//# sourceMappingURL=MarkdownRenderer.js.map","import { createContext, useContext } from \"react\";\nconst PopoverContext = createContext(undefined);\nexport function usePopoverContext() {\n return useContext(PopoverContext);\n}\nexport { PopoverContext };\n//# sourceMappingURL=context.js.map","import { Children, isValidElement } from \"react\";\nconst __SLOT_NAME = Symbol('__SLOT_NAME');\nexport function processOneSlot(child, out, slots) {\n let slotName;\n if (isValidElement(child) && (slotName = child.type[__SLOT_NAME])) {\n slots[slotName] = child;\n }\n else {\n out.push(child);\n }\n}\nexport function processSlots(children, slots) {\n const out = [];\n Children.forEach(children, child => {\n processOneSlot(child, out, slots);\n });\n return out.length > 1 ? out : out[0];\n}\nexport function defineSlot(name, component) {\n component[__SLOT_NAME] = name;\n}\n//# sourceMappingURL=slots.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { flip, offset, shift } from \"@floating-ui/dom\";\nimport { FloatingFocusManager, FloatingPortal, autoUpdate, safePolygon, useClick, useDismiss, useFloating, useHover, useInteractions, useTransitionStyles } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { PopoverContext } from \"./context\";\nimport { defineSlot, processSlots } from \"./slots\";\nfunction computeElementProps(value) {\n if (!value)\n return { enabled: false };\n return (typeof value === 'boolean' ? { enabled: value } : value);\n}\nfunction getHoverProps(props) {\n return props?.hover === true ? {\n enabled: true,\n handleClose: safePolygon({ blockPointerEvents: true }),\n restMs: 0,\n } : props?.hover;\n}\nfunction getClickProps(props) {\n return props && !props.hover && !props.click ? {\n enabled: true,\n } : props?.click;\n}\n/**\n * The component is instantiated when all interactions are known\n * @param param0\n * @returns\n */\nexport function Popover(props) {\n const slots = {};\n processSlots(props.children, slots);\n if (!slots.content) {\n throw new Error('Popover must provide a content slot');\n }\n const triggerProps = slots.trigger?.props;\n const contentProps = slots.content.props;\n // wait for the trigger to be defined\n return _jsx(ResolvedPopover, { ...props, trigger: triggerProps, content: contentProps });\n}\nfunction ResolvedPopover({ middleware, offset: defaultOffset, trigger, dismiss = true, content, placement, strategy, zIndex = 40 }) {\n const [isOpen, setIsOpen] = useState(false);\n const floating = useFloating({\n open: isOpen,\n placement,\n strategy,\n onOpenChange: setIsOpen,\n middleware: middleware || [offset(defaultOffset || 4), shift(), flip()],\n whileElementsMounted: autoUpdate // stick to the anchor when resizing / scrolling\n });\n const { floatingStyles, refs: { setReference, setFloating }, context, } = floating;\n const dismissInteraction = useDismiss(context, computeElementProps(dismiss));\n const clickInteraction = useClick(context, computeElementProps(getClickProps(trigger)));\n const hoverInteraction = useHover(context, computeElementProps(getHoverProps(trigger)));\n const { getReferenceProps, getFloatingProps, } = useInteractions([dismissInteraction, clickInteraction, hoverInteraction]);\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, content.transition);\n return (_jsxs(PopoverContext.Provider, { value: {\n ...floating,\n close: () => setIsOpen(false)\n }, children: [trigger &&\n _jsx(\"div\", { className: clsx(trigger.className, \"inline-block\"), ref: setReference, ...getReferenceProps(), children: trigger.children }), _jsx(FloatingPortal, { children: isMounted && (_jsx(\"div\", { ref: setFloating, style: { ...floatingStyles, zIndex: zIndex }, ...getFloatingProps(), children: _jsx(FloatingFocusManager, { context: context, children: _jsx(\"div\", { className: clsx(content.className, \"bg-popover rounded-md text-popover-foreground max-w-md\"), style: transitionStyles, children: content.children }) }) })) })] }));\n}\nfunction PopoverTrigger(_props) {\n return null;\n}\ndefineSlot('trigger', PopoverTrigger);\nfunction PopoverContent(_props) {\n return null;\n}\ndefineSlot('content', PopoverContent);\nPopover.Trigger = PopoverTrigger;\nPopover.Content = PopoverContent;\n//# sourceMappingURL=Popover.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function Progress({ percent }) {\n return (_jsx(\"div\", { className: \"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700\", children: _jsx(\"div\", { className: \"bg-blue-600 h-2.5 rounded-full\", style: { width: `${percent}%` } }) }));\n}\n//# sourceMappingURL=Progress.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Table, VTooltip } from \"@vertesia/ui/core\";\nimport { Info } from \"lucide-react\";\nexport function PropertiesView({ className, properties }) {\n return (_jsx(Table, { className: className, children: _jsx(\"tbody\", { children: properties.map((property) => (_jsxs(\"tr\", { children: [_jsxs(\"td\", { className: 'w-1/3 font-semibold gap-2', children: [_jsx(\"span\", { children: property.name }), property.description &&\n _jsx(VTooltip, { description: property.description, placement: \"top\", children: _jsx(Info, { className: \"size-3 ml-2 text-muted-foreground\" }) })] }), _jsx(\"td\", { className: 'w-2/3', children: property.value ?? 'undefined' })] }, property.name))) }) }));\n}\n//# sourceMappingURL=PropertiesView.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { json } from \"@codemirror/lang-json\";\nimport { CodeMirrorEditor } from \"../codemirror\";\nimport { Button, VModal, VModalBody, VModalFooter, VModalTitle, useToast } from \"@vertesia/ui/core\";\nimport { basicSetup } from \"codemirror\";\nimport { useMemo, useRef } from \"react\";\nimport { JSONCode } from '../json-view';\nfunction contentToJSON(content) {\n if (!content)\n return undefined;\n content = content.trim();\n if (!content)\n return undefined;\n return JSON.parse(content);\n}\nfunction jsonToContent(json) {\n if (!json)\n return '';\n return JSON.stringify(json, null, 2);\n}\nconst extensions = [basicSetup, json()];\nexport function JSONSchemaEditorModal({ schema, isOpen, onClose, readonly = false }) {\n const editorRef = useRef(undefined);\n const toast = useToast();\n const value = useMemo(() => {\n return jsonToContent(schema.schema);\n }, [schema]);\n const onSaveChanges = () => {\n if (editorRef.current) {\n const value = editorRef.current.getValue();\n try {\n const newSchema = contentToJSON(value);\n schema.replaceSchema(newSchema);\n onClose();\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid JSON Schema',\n description: err.message,\n duration: 5000\n });\n }\n }\n };\n return (_jsxs(VModal, { onClose: onClose, isOpen: !!isOpen, className: 'min-w-[60vw]', children: [_jsx(VModalTitle, { children: \"JSON Schema Editor\" }), _jsx(VModalBody, { children: !readonly ? _jsx(CodeMirrorEditor, { value: value, extensions: extensions, editorRef: editorRef })\n : _jsx(JSONCode, { data: schema.schema || {} }) }), _jsx(VModalFooter, { children: !readonly ? _jsx(Button, { onClick: onSaveChanges, children: \"Save changes\" }) : null })] }));\n}\n//# sourceMappingURL=JSONSchemaEditorModal.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor || schema.format) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n this.schema.format = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(VSelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(VModal, { isOpen: isOpen, onClose: onClose, children: [_jsx(VModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-muted', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { SquarePen, Trash2 } from 'lucide-react';\nimport { Button, Styles, useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-ring`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { className: \"\", children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'invisible group-hover:visible';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onEdit, children: _jsx(SquarePen, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { Button, useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(Button, { variant: \"ghost\", onClick: add, children: [_jsx(Plus, { className: 'size-4' }), \"Add property\"] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from \"react\";\nexport function SvgIcon({ content, ...props }) {\n const containerRef = useRef(null);\n useEffect(() => {\n if (!containerRef.current)\n return;\n // Parse the SVG string\n const parser = new DOMParser();\n const doc = parser.parseFromString(content, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) {\n console.warn('SvgIcon: No <svg> element found in provided string');\n containerRef.current.innerHTML = '';\n return;\n }\n // Apply all passed props to the SVG element\n props && Object.entries(props).forEach(([key, value]) => {\n if (value == null)\n return;\n const attrName = key === 'className' ? 'class' : key;\n svgEl.setAttribute(attrName, String(value));\n });\n // Clear and append the new SVG\n containerRef.current.innerHTML = '';\n containerRef.current.appendChild(svgEl);\n }, [content, props]);\n return _jsx(\"span\", { ref: containerRef });\n}\nexport function createSvgIcon(content) {\n const IconComponent = (props) => {\n return _jsx(SvgIcon, { content: content, ...props });\n };\n return IconComponent;\n}\n//# sourceMappingURL=SvgIcon.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState, useRef } from \"react\";\nimport { UploadIcon } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\n/**\n * A reusable drop zone component for file uploads\n *\n * @example\n * <DropZone\n * onDrop={handleFileSelect}\n * message=\"Drag and drop files here\"\n * buttonLabel=\"Select Files\"\n * />\n */\nexport function DropZone({ onDrop, message, buttonLabel = \"Upload Files\", allowFolders = true, className = \"\" }) {\n const [isDragging, setIsDragging] = useState(false);\n const inputRef = useRef(null);\n const dropZoneRef = useRef(null);\n const handleDragOver = (e) => {\n e.preventDefault();\n if (e.dataTransfer.types.includes('Files')) {\n setIsDragging(true);\n }\n };\n const handleDragLeave = (e) => {\n e.preventDefault();\n // Only set dragging to false if leaving the container (not entering a child)\n if (dropZoneRef.current && !dropZoneRef.current.contains(e.relatedTarget)) {\n setIsDragging(false);\n }\n };\n const handleDrop = async (e) => {\n e.preventDefault();\n setIsDragging(false);\n if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {\n // Handle folders using the DataTransferItemList API which supports directory reading\n const items = Array.from(e.dataTransfer.items);\n const files = [];\n const folders = new Set();\n const processEntry = async (entry) => {\n if (entry.isFile) {\n // Get file\n const file = await new Promise((resolve) => {\n entry.file((file) => {\n // Store full path in the file object for location use\n Object.defineProperty(file, \"webkitRelativePath\", {\n writable: true,\n value: entry.fullPath.substring(1), // Remove leading slash\n });\n resolve(file);\n });\n });\n // Skip hidden files\n if (!file.name.startsWith(\".\") && file.size > 0) {\n files.push(file);\n }\n // Add folder path to tracking\n const folderPath = entry.fullPath.substring(1).split(\"/\").slice(0, -1).join(\"/\");\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n else if (entry.isDirectory) {\n // Get folder reader\n const reader = entry.createReader();\n const entries = await new Promise((resolve) => {\n reader.readEntries((entries) => {\n resolve(entries);\n });\n });\n // Process all entries\n await Promise.all(entries.map(processEntry));\n // Add this folder to tracking\n const folderPath = entry.fullPath.substring(1);\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n };\n try {\n // Process all dropped items\n await Promise.all(items.map((item) => {\n const entry = item.webkitGetAsEntry ? item.webkitGetAsEntry() : item;\n if (entry) {\n return processEntry(entry);\n }\n return Promise.resolve();\n }));\n if (files.length > 0) {\n const topLevelFolders = new Set(Array.from(folders)\n .map((path) => path.split(\"/\")[0])\n .filter(Boolean));\n const folderCount = topLevelFolders.size;\n const fileCount = files.length;\n let message = \"\";\n if (folderCount > 0) {\n message =\n folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n }\n else {\n message = `Preparing to upload ${fileCount} file${fileCount === 1 ? \"\" : \"s\"}...`;\n }\n onDrop(files, { count: files.length, message });\n }\n }\n catch (error) {\n console.error(\"Error processing dropped files:\", error);\n // Fallback to simple file array if folder processing fails\n const fileArray = Array.from(e.dataTransfer.files);\n if (fileArray.length > 0) {\n onDrop(fileArray);\n }\n }\n }\n else if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // Fallback for browsers that don't support items API\n const fileArray = Array.from(e.dataTransfer.files);\n onDrop(fileArray);\n }\n };\n const handleChange = (e) => {\n if (e.target.files && e.target.files.length > 0) {\n const fileArray = Array.from(e.target.files);\n // Check if there are directories (with webkitRelativePath)\n const hasDirectories = fileArray.some((file) => file.webkitRelativePath && file.webkitRelativePath.includes(\"/\"));\n if (hasDirectories) {\n // Count the unique top-level directories\n const topLevelDirs = new Set(fileArray.map((file) => file.webkitRelativePath?.split(\"/\")[0]).filter(Boolean));\n const folderCount = topLevelDirs.size;\n const fileCount = fileArray.length;\n // Create custom message with folder info\n const formattedMessage = folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n const customMessage = {\n count: fileArray.length,\n message: formattedMessage,\n };\n onDrop(fileArray, customMessage);\n }\n else {\n // Regular file upload\n const feedback = {\n count: fileArray.length,\n message: `Preparing to upload ${fileArray.length} file${fileArray.length === 1 ? \"\" : \"s\"}...`,\n };\n onDrop(fileArray, feedback);\n }\n }\n };\n const openFileSelector = () => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n };\n return (_jsxs(\"div\", { className: `flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${isDragging ? \"border-color-primary bg-color-primary/10\" : \"border-dashed border-color-border\"} ${className}`, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(UploadIcon, { className: `h-12 w-12 mb-3 transition-colors ${isDragging ? \"text-primary\" : \"text-muted/50\"}` }), _jsx(\"p\", { className: \"text-color-muted-foreground\", children: message }), _jsxs(\"div\", { className: \"mt-4 text-center\", children: [_jsxs(\"div\", { className: \"text-sm text-muted mb-2\", children: [\"Drag and drop files\", allowFolders ? \" or folders\" : \"\", \" here, or\"] }), _jsxs(Button, { onClick: openFileSelector, children: [_jsx(UploadIcon, { className: \"h-4 w-4 mr-2\" }), buttonLabel] }), _jsx(\"input\", { type: \"file\", ref: inputRef, onChange: handleChange, multiple: true, \n // @ts-expect-error: webkitdirectory is a non-standard attribute\n webkitdirectory: allowFolders ? \"\" : undefined, directory: allowFolders ? \"\" : undefined, className: \"hidden\" })] })] }));\n}\n//# sourceMappingURL=DropZone.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon } from \"lucide-react\";\nimport { useState } from \"react\";\n/**\n * Displays a collapsible category of upload results\n *\n * @example\n * <UploadResultCategory\n * title=\"Successfully Uploaded\"\n * count={3}\n * icon={<CheckCircleIcon className=\"h-4 w-4 text-green-500\" />}\n * items={[\"document1.pdf\", \"document2.pdf\", \"document3.pdf\"]}\n * />\n */\nexport function UploadResultCategory({ title, count, icon = _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items }) {\n const [isExpanded, setIsExpanded] = useState(false);\n return (_jsxs(\"div\", { className: \"border border-color-border rounded-md overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer\", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"span\", { className: \"mr-2\", children: icon }), _jsx(\"span\", { className: \"font-medium\", children: title }), _jsx(\"span\", { className: \"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs\", children: count })] }), _jsx(\"button\", { className: \"text-muted\", children: _jsx(\"svg\", { className: `h-5 w-5 transition-transform ${isExpanded ? 'transform rotate-180' : ''}`, fill: \"none\", viewBox: \"0 0 24 24\", stroke: \"currentColor\", children: _jsx(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M19 9l-7 7-7-7\" }) }) })] }), isExpanded && (_jsx(\"div\", { className: \"p-3 border-t border-color-border max-h-48 overflow-y-auto\", children: items.length > 0 ? (_jsx(\"ul\", { className: \"space-y-1\", children: items.map((item, index) => (_jsx(\"li\", { className: \"text-sm py-1 px-2 rounded hover:bg-color-muted/10\", children: item }, index))) })) : (_jsx(\"div\", { className: \"text-sm text-muted py-2\", children: \"No items to display\" })) }))] }));\n}\n//# sourceMappingURL=UploadResultCategory.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from \"lucide-react\";\nimport { UploadResultCategory } from \"./UploadResultCategory\";\n/**\n * Displays a summary of upload results with collapsible categories\n *\n * @example\n * <UploadSummary\n * files={[\n * { name: \"document1.pdf\", status: \"success\" },\n * { name: \"document2.pdf\", status: \"skipped\" }\n * ]}\n * location=\"/reports/2023\"\n * />\n */\nexport function UploadSummary({ files, className = \"\", location, collection }) {\n // Group files by status\n const successFiles = files.filter(f => f.status === 'success');\n const updatedFiles = files.filter(f => f.status === 'updated');\n const skippedFiles = files.filter(f => f.status === 'skipped');\n const failedFiles = files.filter(f => f.status === 'failed');\n // Calculate counts\n const successCount = successFiles.length;\n const updatedCount = updatedFiles.length;\n const skippedCount = skippedFiles.length;\n const failedCount = failedFiles.length;\n const totalCount = files.length;\n return (_jsxs(\"div\", { className: `flex flex-col py-2 ${className}`, children: [_jsxs(\"div\", { className: \"flex items-center mb-4\", children: [_jsx(\"div\", { className: \"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center\", children: _jsx(CheckCircleIcon, { className: \"size-4 text-success\" }) }), _jsx(\"div\", { children: _jsxs(\"p\", { className: \"text-muted\", children: [totalCount, \" file\", totalCount !== 1 ? \"s\" : \"\", \" processed\", collection ? ` in collection '${collection}'` : \"\", location ? ` in folder '${location}'` : \"\"] }) })] }), _jsxs(\"div\", { className: \"space-y-3 mt-2\", children: [successCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Uploaded\", count: successCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items: successFiles.map(f => f.name) })), updatedCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Updated\", count: updatedCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-blue-500\" }), items: updatedFiles.map(f => f.name) })), skippedCount > 0 && (_jsx(UploadResultCategory, { title: \"Skipped (Already Existed)\", count: skippedCount, icon: _jsx(AlertCircleIcon, { className: \"h-4 w-4 text-amber-500\" }), items: skippedFiles.map(f => f.name) })), failedCount > 0 && (_jsx(UploadResultCategory, { title: \"Failed to Upload\", count: failedCount, icon: _jsx(XCircleIcon, { className: \"h-4 w-4 text-red-500\" }), items: failedFiles.map(f => f.name) }))] })] }));\n}\n//# sourceMappingURL=UploadSummary.js.map","export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"path\", { d: \"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { isEqual } from 'lodash-es';\nimport { useEffect, useMemo, useState } from 'react';\nimport { defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n const [theme, setTheme] = useState(() => ({ ...defaultTheme, ...customTheme }));\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n useEffect(() => {\n setTheme((currentTheme) => {\n const nextTheme = { ...defaultTheme, ...customTheme };\n return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;\n });\n }, [customTheme]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map"],"names":["stateInstance","EditorApi","editor","constructor","this","setValue","value","dispatch","changes","from","to","state","doc","length","insert","getValue","toString","baseExtensions","EditorView","theme","fontSize","fontFamily","backgroundColor","color","outline","borderLeft","borderLeftColor","animation","opacity","lineWrapping","CodeMirrorEditor","onChange","className","editorRef","extensions","debounceTimeout","ref","useRef","onChangeRef","undefined","useEffect","current","debounce","component","useMemo","_jsx","useSafeLayoutEffect","actualExtensions","cb","update","updateListener","of","docChanged","Array","isArray","concat","push","sharedState","initialDoc","Text","split","EditorState","create","getSharedEditorState","parent","api","destroy","FieldSetContext","createContext","FieldSetContextProvider","Provider","useFieldSet","ctx","useContext","Error","_FormContext","useForm","FormContextProvider","FormLabel","htmlFor","required","children","_jsxs","FormHelper","FormError","Input","React","forwardRef","object","type","props","actualValue","useState","String","booleanValue","setBooleanValue","schema","isBoolean","clsx","Styles","INPUT","_onChange","ev","target","checked","Form","components","onSubmit","observer","evt","stopPropagation","preventDefault","GeneratedFormFields","properties","map","renderProperty","GeneratedForm","prop","isList","ListField","name","isObject","CompositeField","ScalarField","inline","Component","inputType","getInputType","isListItem","isRequired","title","event","isNumber","parseFloat","description","items","item","index","ListItem","list","onDelete","remove","deleteItem","Button","variant","onClick","add","Plus","arraySchema","Trash2","Schema","_validator","load","validator","ajv","Ajv","allErrors","strict","compile","Object","keys","forEach","loadProperty","hasProperties","propertySchema","property","ArrayPropertySchema","PropertySchema","validate","errors","addProperty","typeOrSchema","removeProperty","filter","x","getProperty","super","isMulti","isReadOnly","readOnly","defaultValue","default","enum","values","includes","isString","getArrayElementType","computeTitleFromName","replace","toUpperCase","slice","_name","Node","isRoot","root","path","isScalar","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","out","Symbol","iterator","ManagedObject","_v","newItem","ManageObjectEntry","ManagedScalarEntry","splice","i","l","trim","pop","key","Date","now","st_punct","st_symbol","st_key","defaultClassMap","code","comma","assign","startObject","endObject","startArray","endArray","boolean","null","string","number","Block","renderer","indent","result","classMap","writeKey","pushValue","renderStart","renderValue","renderEnd","valueClass","join","ObjectBlock","NL","ArrayBlock","JsonRenderer","tab","stack","block","onStartObject","nested","onEndObject","currentBlock","onStartIteration","onEndIteration","onValue","JSONCode","data","element","setElement","json","ObjectWalker","walk","dangerouslySetInnerHTML","__html","renderJson","JSONView","entries","PropertyElement","PropertyTitle","BlockElement","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","itemMediumLength","isInline","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","remarkRemoveComments","tree","visit","test","SKIP","MarkdownRenderer","remarkPlugins","removeComments","plugins","remarkGfm","Markdown","PopoverContext","usePopoverContext","__SLOT_NAME","processSlots","slots","Children","child","slotName","isValidElement","processOneSlot","defineSlot","computeElementProps","enabled","Popover","triggerProps","trigger","contentProps","ResolvedPopover","middleware","offset","defaultOffset","dismiss","placement","strategy","zIndex","isOpen","setIsOpen","floating","useFloating","open","onOpenChange","shift","flip","whileElementsMounted","autoUpdate","floatingStyles","refs","setReference","setFloating","context","dismissInteraction","useDismiss","clickInteraction","useClick","hover","click","hoverInteraction","useHover","handleClose","safePolygon","blockPointerEvents","restMs","getHoverProps","getReferenceProps","getFloatingProps","useInteractions","isMounted","styles","transitionStyles","useTransitionStyles","transition","close","FloatingPortal","style","FloatingFocusManager","PopoverTrigger","_props","PopoverContent","Progress","percent","width","PropertiesView","Table","VTooltip","Info","Trigger","Content","basicSetup","JSONSchemaEditorModal","onClose","readonly","toast","useToast","JSON","stringify","jsonToContent","VModal","VModalTitle","VModalBody","VModalFooter","newSchema","parse","contentToJSON","replaceSchema","err","status","message","duration","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","format","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","findAvailableChildName","prefix","addChild","addRequired","c","updated","newName","newProperties","setPropertyName","indexOf","setRequireProperty","actualType","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","endsWith","substring","text","parseTypeSignature","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","options","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","size","AlignLeft","EditDescriptionModal","focus","onKeyUp","e","INPUT_UNSTYLED","display","VSelectBox","onBlur","onKeyDown","popupClass","EditDescriptionModalForm","currentValue","setCurrentValue","_Fragment","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","outlineOnHover","editOnClick","placeholder","viewer","skipClickOutside","isEditing","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","SquarePen","Editor","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","autoSave","clearTimeout","setTimeout","closest","SchemaEditor","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","editableProp","SvgIcon","containerRef","svgEl","DOMParser","parseFromString","querySelector","console","warn","innerHTML","attrName","setAttribute","appendChild","createSvgIcon","DropZone","onDrop","buttonLabel","allowFolders","isDragging","setIsDragging","inputRef","dropZoneRef","onDragOver","dataTransfer","onDragLeave","contains","relatedTarget","async","files","folders","Set","processEntry","entry","isFile","file","Promise","resolve","defineProperty","writable","fullPath","startsWith","folderPath","isDirectory","reader","createReader","readEntries","all","webkitGetAsEntry","folderCount","Boolean","fileCount","count","error","fileArray","UploadIcon","some","webkitRelativePath","formattedMessage","customMessage","feedback","multiple","webkitdirectory","directory","UploadResultCategory","icon","CheckCircleIcon","isExpanded","setIsExpanded","fill","viewBox","stroke","strokeLinecap","strokeLinejoin","strokeWidth","d","UploadSummary","location","collection","successFiles","f","updatedFiles","skippedFiles","failedFiles","successCount","updatedCount","skippedCount","failedCount","totalCount","AlertCircleIcon","XCircleIcon","ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","XMLViewerContext","collapsible","indentSize","useXMLViewerContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","indentation","CollapseIcon","collapsed","position","right","border","padding","background","Caret","transform","attrs","height","useCollapsible","level","initialCollapsedDepth","setCollapsed","isNil","buttonProps","currentCollapsed","role","cursor","CommentTag","Attributes","attributes","DeclarationTag","tagKey","hasBreakLines","elements","getTagProps","elementWithoutAttributes","omit","subElements","getTagType","hasAttributes","Tag","hasChildren","TextElement","hasSiblings","isText","line","Elements","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","setTheme","valid","XMLValidator","errorMessage","useXMLViewer","currentTheme","nextTheme","isEqual","whiteSpace","overflowWrap"],"mappings":"k+CACA,IAAIA,GAAgB,KCKb,MAAMC,GACTC,OACA,WAAAC,CAAYD,GACRE,KAAKF,OAASA,CACtB,CACI,QAAAG,CAASC,GACLF,KAAKF,OAAOK,SAAS,CACjBC,QAAS,CACLC,KAAM,EACNC,GAAIN,KAAKF,OAAOS,MAAMC,IAAIC,OAC1BC,OAAQR,GAAS,KAGjC,CACI,QAAAS,GACI,OAAOX,KAAKF,OAAOS,MAAMC,IAAII,UACrC,EAEA,MAaMC,GAAiB,CAbHC,EAAWC,MAAM,CACjC,IAAK,CAAEC,SAAU,OAAQC,WAAY,aACrC,cAAe,CAAEA,WAAY,WAC7B,eAAgB,CAAEA,WAAY,WAC9B,cAAe,CAAEC,gBAAiB,cAAeC,MAAO,QACxD,cAAe,CAAEC,QAAS,QAC1B,aAAc,CACVC,WAAY,oBACZC,gBAAiB,UACjBC,UAAW,kCAEf,mBAAoB,CAAE,MAAO,CAAEC,QAAS,MAIxCV,EAAWW,cAaR,SAASC,IAAiBC,SAAEA,EAAQzB,MAAEA,EAAK0B,UAAEA,EAASC,UAAEA,EAASC,WAAEA,EAAUC,gBAAEA,EAAkB,IACpG,MAAMC,EAAMC,EAAO,MAKbC,EAAcD,OAAOE,GAC3BC,GAAU,KACN,GAAIT,EAIA,OAHAO,EAAYG,QAAUN,EAAkB,EAClCO,EAASX,EAAUI,GACnBJ,EACC,KAGHO,EAAYG,aAAUF,KAG/B,CAACR,EAAUI,IACd,MAAMQ,EAAYC,GAAQ,IAAMC,EAAK,MAAO,CAAET,IAAKA,EAAKJ,UAAWA,KAAc,CAACA,IA6BlF,OA5BAc,GAAoB,KAChB,GAAIV,EAAIK,QAAS,CACb,IAAIM,EAAmB,IA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