@vertesia/ui 0.79.0 → 0.80.0-dev-20251118
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.
- package/lib/esm/core/components/Panel.js +8 -0
- package/lib/esm/core/components/Panel.js.map +1 -0
- package/lib/esm/core/components/SelectBox.js +1 -1
- package/lib/esm/core/components/SelectBox.js.map +1 -1
- package/lib/esm/core/components/SidePanel.js +2 -2
- package/lib/esm/core/components/SidePanel.js.map +1 -1
- package/lib/esm/core/components/index.js +1 -1
- package/lib/esm/core/components/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/breadcrumb.js +29 -8
- package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -1
- package/lib/esm/core/components/shadcn/button.js +3 -2
- package/lib/esm/core/components/shadcn/button.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/filterBar.js +2 -2
- package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
- package/lib/esm/core/components/shadcn/index.js +1 -0
- package/lib/esm/core/components/shadcn/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/input.js +4 -1
- package/lib/esm/core/components/shadcn/input.js.map +1 -1
- package/lib/esm/core/components/shadcn/resizeable.js +2 -2
- package/lib/esm/core/components/shadcn/resizeable.js.map +1 -1
- package/lib/esm/core/components/shadcn/selectBox.js +15 -9
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/esm/core/components/shadcn/tabs.js +10 -3
- package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
- package/lib/esm/core/components/shadcn/textarea.js +7 -0
- package/lib/esm/core/components/shadcn/textarea.js.map +1 -0
- package/lib/esm/core/hooks/CompositeState.js +139 -1
- package/lib/esm/core/hooks/CompositeState.js.map +1 -1
- package/lib/esm/core/hooks/index.js +1 -0
- package/lib/esm/core/hooks/index.js.map +1 -1
- package/lib/esm/core/hooks/useScrollableSearch.js +92 -0
- package/lib/esm/core/hooks/useScrollableSearch.js.map +1 -0
- package/lib/esm/env/index.js +1 -1
- package/lib/esm/env/index.js.map +1 -1
- package/lib/esm/features/agent/PayloadBuilder.js +80 -55
- package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentConversation.js +22 -24
- package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +2 -3
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -2
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +15 -20
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +1 -0
- package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +3 -3
- package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +6 -6
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
- package/lib/esm/features/facets/CollectionsFacetsNav.js +19 -0
- package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -1
- package/lib/esm/features/facets/InteractionsFacetsNav.js +9 -3
- package/lib/esm/features/facets/InteractionsFacetsNav.js.map +1 -1
- package/lib/esm/features/facets/utils/VTypeFacet.js +4 -1
- package/lib/esm/features/facets/utils/VTypeFacet.js.map +1 -1
- package/lib/esm/features/layout/GenericPageNavHeader.js +58 -5
- package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
- package/lib/esm/features/store/collections/BrowseCollectionView.js +3 -0
- package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/CreateCollection.js +2 -2
- package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
- package/lib/esm/features/store/collections/EditCollectionView.js +29 -30
- package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/SelectCollection.js +46 -45
- package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentSearchResults.js +35 -9
- package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentTable.js +6 -6
- package/lib/esm/features/store/objects/DocumentTable.js.map +1 -1
- package/lib/esm/features/store/objects/components/ContentOverview.js +158 -114
- package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/esm/features/store/objects/components/DocumentIcon.js +5 -3
- package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
- package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +11 -2
- package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
- package/lib/esm/features/store/objects/components/useDownloadObject.js +2 -2
- package/lib/esm/features/store/objects/components/useDownloadObject.js.map +1 -1
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js +13 -1
- package/lib/esm/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
- package/lib/esm/features/store/objects/layout/documentLayout.js +5 -5
- package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
- package/lib/esm/features/store/objects/layout/renderers.js +28 -12
- package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js +5 -1
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +1 -1
- package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -1
- package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +3 -2
- package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
- package/lib/esm/features/store/objects/selection/SelectionActions.js +2 -0
- package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +10 -2
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +20 -2
- package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +15 -7
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
- package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +1 -1
- package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
- package/lib/esm/features/user/UserInfo.js +2 -0
- package/lib/esm/features/user/UserInfo.js.map +1 -1
- package/lib/esm/router/HistoryNavigator.js +25 -2
- package/lib/esm/router/HistoryNavigator.js.map +1 -1
- package/lib/esm/router/Nav.js +3 -3
- package/lib/esm/router/Nav.js.map +1 -1
- package/lib/esm/session/UserSession.js +1 -0
- package/lib/esm/session/UserSession.js.map +1 -1
- package/lib/esm/session/UserSessionProvider.js +9 -2
- package/lib/esm/session/UserSessionProvider.js.map +1 -1
- package/lib/esm/session/auth/composable.js +66 -67
- package/lib/esm/session/auth/composable.js.map +1 -1
- package/lib/esm/widgets/form/Form.js +17 -30
- package/lib/esm/widgets/form/Form.js.map +1 -1
- package/lib/esm/widgets/form/FormContext.js +4 -2
- package/lib/esm/widgets/form/FormContext.js.map +1 -1
- package/lib/esm/widgets/form/ManagedObject.js +4 -0
- package/lib/esm/widgets/form/ManagedObject.js.map +1 -1
- package/lib/esm/widgets/form/fields.js +4 -3
- package/lib/esm/widgets/form/fields.js.map +1 -1
- package/lib/esm/widgets/form/inputs.js +2 -0
- package/lib/esm/widgets/form/inputs.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/Panel.d.ts +11 -0
- package/lib/types/core/components/Panel.d.ts.map +1 -0
- package/lib/types/core/components/SidePanel.d.ts.map +1 -1
- package/lib/types/core/components/index.d.ts +1 -1
- package/lib/types/core/components/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/breadcrumb.d.ts +3 -2
- package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/index.d.ts +1 -0
- package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/input.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/selectBox.d.ts +3 -2
- package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/textarea.d.ts +4 -0
- package/lib/types/core/components/shadcn/textarea.d.ts.map +1 -0
- package/lib/types/core/hooks/CompositeState.d.ts +115 -6
- package/lib/types/core/hooks/CompositeState.d.ts.map +1 -1
- package/lib/types/core/hooks/index.d.ts +1 -0
- package/lib/types/core/hooks/index.d.ts.map +1 -1
- package/lib/types/core/hooks/useScrollableSearch.d.ts +82 -0
- package/lib/types/core/hooks/useScrollableSearch.d.ts.map +1 -0
- package/lib/types/env/index.d.ts +3 -1
- package/lib/types/env/index.d.ts.map +1 -1
- package/lib/types/features/agent/PayloadBuilder.d.ts +11 -19
- package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -1
- package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/facets/InteractionsFacetsNav.d.ts +1 -0
- package/lib/types/features/facets/InteractionsFacetsNav.d.ts.map +1 -1
- package/lib/types/features/facets/utils/SearchInterface.d.ts +6 -1
- package/lib/types/features/facets/utils/SearchInterface.d.ts.map +1 -1
- package/lib/types/features/facets/utils/VTypeFacet.d.ts +2 -1
- package/lib/types/features/facets/utils/VTypeFacet.d.ts.map +1 -1
- package/lib/types/features/layout/GenericPageNavHeader.d.ts +2 -1
- package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
- package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/collections/CreateCollection.d.ts.map +1 -1
- package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/collections/SelectCollection.d.ts +6 -4
- package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
- package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/types/features/store/objects/DocumentTable.d.ts +4 -0
- package/lib/types/features/store/objects/DocumentTable.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/DocumentIcon.d.ts +3 -1
- package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts +1 -1
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts +2 -1
- package/lib/types/features/store/objects/layout/DocumentTableColumn.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/documentLayout.d.ts +4 -2
- package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +1 -1
- package/lib/types/features/store/objects/layout/renderers.d.ts +1 -1
- package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +1 -0
- package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +1 -0
- package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
- package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
- package/lib/types/features/user/UserInfo.d.ts.map +1 -1
- package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/types/router/Nav.d.ts +2 -1
- package/lib/types/router/Nav.d.ts.map +1 -1
- package/lib/types/session/UserSession.d.ts.map +1 -1
- package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/types/session/auth/composable.d.ts.map +1 -1
- package/lib/types/widgets/form/Form.d.ts +2 -1
- package/lib/types/widgets/form/Form.d.ts.map +1 -1
- package/lib/types/widgets/form/FormContext.d.ts +5 -2
- package/lib/types/widgets/form/FormContext.d.ts.map +1 -1
- package/lib/types/widgets/form/ManagedObject.d.ts.map +1 -1
- package/lib/types/widgets/form/fields.d.ts +2 -2
- package/lib/types/widgets/form/fields.d.ts.map +1 -1
- package/lib/types/widgets/form/inputs.d.ts.map +1 -1
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +1 -1
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +170 -165
- package/src/core/components/Panel.tsx +34 -0
- package/src/core/components/SelectBox.tsx +1 -1
- package/src/core/components/SidePanel.tsx +5 -3
- package/src/core/components/TagsInput.tsx +388 -0
- package/src/core/components/index.ts +2 -1
- package/src/core/components/shadcn/breadcrumb.tsx +49 -30
- package/src/core/components/shadcn/button.tsx +3 -2
- package/src/core/components/shadcn/filters/filterBar.tsx +3 -3
- package/src/core/components/shadcn/index.ts +2 -1
- package/src/core/components/shadcn/input.tsx +10 -7
- package/src/core/components/shadcn/popover.tsx +2 -2
- package/src/core/components/shadcn/resizeable.tsx +4 -4
- package/src/core/components/shadcn/selectBox.tsx +87 -67
- package/src/core/components/shadcn/tabs.tsx +10 -3
- package/src/core/components/shadcn/textarea.tsx +21 -0
- package/src/core/hooks/CompositeState.tsx +156 -6
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/useScrollableSearch.tsx +193 -0
- package/src/env/index.ts +4 -3
- package/src/features/agent/PayloadBuilder.tsx +92 -65
- package/src/features/agent/chat/ModernAgentConversation.tsx +109 -118
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +3 -23
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +3 -11
- package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +39 -55
- package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +1 -0
- package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +8 -8
- package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +9 -9
- package/src/features/facets/CollectionsFacetsNav.tsx +21 -0
- package/src/features/facets/InteractionsFacetsNav.tsx +13 -3
- package/src/features/facets/utils/SearchInterface.tsx +5 -1
- package/src/features/facets/utils/VTypeFacet.tsx +6 -2
- package/src/features/layout/GenericPageNavHeader.tsx +73 -10
- package/src/features/store/collections/BrowseCollectionView.tsx +4 -0
- package/src/features/store/collections/CreateCollection.tsx +3 -4
- package/src/features/store/collections/EditCollectionView.tsx +112 -85
- package/src/features/store/collections/SelectCollection.tsx +105 -49
- package/src/features/store/collections/SharedPropsEditor.tsx +61 -0
- package/src/features/store/collections/SyncMemberHeadsToggle.tsx +48 -0
- package/src/features/store/collections/index.ts +3 -1
- package/src/features/store/objects/DocumentSearchResults.tsx +128 -53
- package/src/features/store/objects/DocumentTable.tsx +14 -4
- package/src/features/store/objects/components/ContentOverview.tsx +208 -110
- package/src/features/store/objects/components/DocumentIcon.tsx +11 -12
- package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +12 -2
- package/src/features/store/objects/components/useDownloadObject.ts +7 -2
- package/src/features/store/objects/layout/DocumentTableColumn.tsx +16 -1
- package/src/features/store/objects/layout/documentLayout.tsx +7 -5
- package/src/features/store/objects/layout/knowledge.md +10 -10
- package/src/features/store/objects/layout/renderers.tsx +39 -18
- package/src/features/store/objects/search/DocumentSearchContext.ts +6 -1
- package/src/features/store/objects/search/DocumentSearchProvider.tsx +1 -1
- package/src/features/store/objects/selection/ObjectsActionContext.tsx +3 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +2 -0
- package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +8 -2
- package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +22 -2
- package/src/features/store/objects/upload/DocumentUploadModal.tsx +18 -9
- package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +10 -7
- package/src/features/store/types/CreateOrUpdateTypeModal.tsx +1 -1
- package/src/features/user/UserInfo.tsx +2 -0
- package/src/router/HistoryNavigator.ts +33 -2
- package/src/router/Nav.tsx +4 -3
- package/src/session/UserSession.ts +1 -0
- package/src/session/UserSessionProvider.tsx +10 -2
- package/src/session/auth/composable.ts +71 -70
- package/src/shell/apps/AppProjectSelector.tsx +2 -2
- package/src/widgets/form/Form.tsx +19 -43
- package/src/widgets/form/FormContext.ts +5 -2
- package/src/widgets/form/ManagedObject.ts +4 -0
- package/src/widgets/form/fields.tsx +8 -6
- package/src/widgets/form/inputs.tsx +1 -0
- package/lib/esm/core/components/Textarea.js +0 -15
- package/lib/esm/core/components/Textarea.js.map +0 -1
- package/lib/types/core/components/Textarea.d.ts +0 -8
- package/lib/types/core/components/Textarea.d.ts.map +0 -1
- package/src/core/components/Textarea.tsx +0 -25
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import s,{useRef as i,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,Children as h,isValidElement as u}from"react";import{EditorView as p}from"@codemirror/view";import{useSafeLayoutEffect as m,Styles as f,Button as g,DotBadge as y,Table as v,VTooltip as b,VSelectBox as x,VModal as w,VModalTitle as N,ModalBody as k,ModalFooter as C,useFlag as j,useClickOutside as S,useToast as O}from"@vertesia/ui/core";import{Text as A,EditorState as P}from"@codemirror/state";import{Plus as $,Trash2 as T,Info as E,AlignLeft as I,SquarePen as q,ChevronDown as M,ChevronRight as L,UploadIcon as D,CheckCircleIcon as F,AlertCircleIcon as z,XCircleIcon as R}from"lucide-react";import _ from"clsx";import V from"ajv";import{ObjectWalker as U}from"@vertesia/json";import K from"react-markdown";import B from"remark-gfm";import{visit as W,SKIP as H}from"unist-util-visit";import{offset as G,shift as X,flip as Z}from"@floating-ui/dom";import{useFloating as Y,autoUpdate as J,useDismiss as Q,useClick as ee,useHover as te,useInteractions as re,useTransitionStyles as ne,FloatingPortal as se,FloatingFocusManager as ie,safePolygon as ae}from"@floating-ui/react";import{isNil as oe,omit as le,isEqual as ce}from"lodash-es";import{XMLParser as de,XMLValidator as he}from"fast-xml-parser";let ue=null;class pe{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const me=[p.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),p.lineWrapping];function fe({onChange:t,value:r,className:s,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=i(null),u=i(void 0);a((()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}}),[t,d]);const f=o((()=>e("div",{ref:h,className:s})),[s]);return m((()=>{if(h.current){let t=[...me,(e=e=>{u.current?.(e)},p.updateListener.of((t=>{t.docChanged&&e(t)})))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?A.of(e.split("\n")):e;return ue?ue.doc.toString()!==r.toString()&&(ue=P.create({doc:r,extensions:t})):ue=P.create({doc:r,extensions:t}),ue})(r,t),s=new p({state:n,parent:h.current}),i=new pe(s);return l&&(l.current=i),()=>{s.destroy(),l&&(l.current=void 0)}}var e}),[f,c]),f}const ge=l(void 0),ye=ge.Provider;function ve(){const e=c(ge);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}const be=l(void 0);function xe(){const e=c(be);if(!e)throw new Error("useForm must be used within a Form element");return e}const we=be.Provider;function Ne({htmlFor:r,required:n,children:s}){return t("label",{htmlFor:r,className:"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200",children:[s,n&&e("sup",{className:"text-red-600",children:"*"})]})}function ke({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function Ce({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const je=s.forwardRef((({object:t,type:r="text",onChange:n,...s},i)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);s.className?s.className=_(f.INPUT,s.className):s.className=f.INPUT;const h=e=>{o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e)};return"textarea"===r?e("textarea",{ref:i,...s,value:a,onChange:h}):e("input","checkbox"===r?{ref:i,...s,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:i,...s,type:r,value:a,onChange:h})}));function Se({object:t,components:r,onSubmit:n,children:s,onChange:i}){return t.observer=i,e(we,{value:{object:t,components:r||{}},children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:s})})}function Oe(){const t=xe();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(Pe)})}function Ae({children:r,...n}){return t(Se,{...n,children:[e(Oe,{}),r]})}function Pe(t){return t.isList?e(Ee,{object:t},t.name):t.isObject?e(Te,{object:t},t.name):e($e,{object:t},t.name)}function $e({object:r,editor:n,inline:s=!1}){n||(n=r.schema.editor);const{components:i}=xe(),a=n&&i[n]||je,o=r.getInputType();"checkbox"===o&&(s=!0);return t("div",{className:"",children:[t("div",{className:_("flex gap-2",s?"flex-row items-center":"flex-col"),children:[!r.isListItem&&e(Ne,{required:r.schema.isRequired,children:r.title}),e(a,{object:r,type:o,onChange:e=>{const{value:t}=e.target;r.value=r.schema.isNumber?parseFloat(t):t}})]}),r.schema.description&&e(ke,{children:r.schema.description})]})}function Te({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(Pe)]})}function Ee({object:r}){const[n,s]=d(r.value||[]);return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map(((t,i)=>e(Ie,{object:t,list:r,onDelete:()=>(e=>{r.remove(e),s([...r.value])})(i)},`${i}-${n[i]??""}`))),e("div",{children:t(g,{variant:"secondary",onClick:()=>{r.add(),s([...r.value])},children:[e($,{className:"size-6"})," Add"]})})]})}function Ie({list:r,object:n,onDelete:s}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(i=n,a=r.schema.arraySchema.editor,i.isList?e(Ee,{object:i}):i.isObject?e(Te,{object:i}):e($e,{object:i,editor:a}))}),e(g,{variant:"secondary",onClick:s,children:e(T,{className:"size-4"})})]});var i,a}class qe{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new V({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach((t=>{this.loadProperty(t,e[t])}))}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new Le(this,e,t):new Me(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(s=t)?{type:"object",properties:{}}:"array"===s?{type:"array",items:{}}:{type:s}:t;var s;const i=this.loadProperty(e,n);return this.schema.properties[i.name]=i.schema,r&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter((t=>t!==e)))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class Me extends qe{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter((e=>e!==this.name)),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class Le extends Me{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function De(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function Fe(e,t){if(t.editor)return t.editor;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class ze{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||De(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Re extends ze{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new Ke(this,t,this.getOrInitArrayProperty(e)):t.isObject?new Ve(this,t,t.name,this.getOrInitObjectProperty(e)):new Ue(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new Ke(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new Ve(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new Ue(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class _e extends Re{value;constructor(e,t={}){super(null,e instanceof qe?e:new qe(e),"#root"),this.value=t}}class Ve extends Re{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class Ue extends ze{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return Fe(this.name,this.schema)}}class Ke extends ze{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Be(this,e):new We(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new Ve(this,this.schema,String(e),t):new We(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Be extends Re{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class We extends ze{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return Fe(this.name,this.schema)}}const He="text-pink-500 dark:text-pink-400",Ge="text-purple-500 dark:text-purple-400",Xe="text-blue-500 dark:text-blue-400",Ze={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:He,assign:He,startObject:He,endObject:He,startArray:He,endArray:He,boolean:Ge,null:Ge,key:Xe,index:Xe,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class Ye{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof Ye)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class Je extends Ye{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class Qe extends Ye{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class et{classMap;tab;stack=[];block=new Je(this,void 0,"","");constructor(e=Ze,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new Je(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new Qe(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function tt({data:t,className:r,classMap:n}){const[s,i]=d();return a((()=>{i(function(t,r,n){const s=new et(r);(new U).walk(t,s);const i=s.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${s.classMap.code}' style='overflow-x: scroll'>${i}</div>`}})}(t,n,r))}),[t]),s}function rt({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map((([t,r])=>e(it,{name:t,value:r},t)))})}function nt({name:t}){return e("div",{className:"text-md font-semibold",children:De(t)})}function st({children:t,className:r}){return e("div",{className:_("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function it({name:r,value:n}){const s=ct(n);switch(s.type){case lt.Inline:return t("div",{className:"w-full flex gap-2",children:[e(nt,{name:r+":"}),e("p",{children:s.value})]});case lt.Paragraph:return t("div",{children:[e(nt,{name:r}),e("p",{children:s.value})]});case lt.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(nt,{name:r}),e("div",{className:"vprose dark:prose-invert",children:s.value})]});case lt.Array:return e(at,{name:r,value:n});case lt.Object:return t("div",{children:[e(nt,{name:r}),e(st,{className:"mt-2",children:Object.entries(n).map((([t,r])=>e(it,{name:t,value:r},t)))})]})}}function at({name:r,value:n}){const s=n.join(" ").length,i=s/n.length,a="string"==typeof n[0]&&(s<80||s<400&&i<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(nt,{name:r+":"}),n.map(((t,r)=>e(y,{children:String(t)},r)))]}:{children:[r&&e(nt,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map(((t,r)=>e(ot,{index:r,value:t,useBullet:o},r)))})]})}function ot({index:r,value:n,useBullet:s}){const i=s?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=ct(n);let o;switch(a.type){case lt.Object:o=e(st,{children:Object.entries(n).map((([t,r])=>e(it,{name:t,value:r},t)))});break;case lt.Array:o=e(at,{value:n});break;case lt.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:i}),e("div",{children:o})]})}var lt;function ct(e){if(null==e)return{value:"-",type:lt.Inline};if(Array.isArray(e))return{value:e,type:lt.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=lt.Inline:t>400?r=lt.Prose:(r=lt.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:lt.Inline}:{value:e,type:lt.Object}}function dt({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(tt,{data:t}):e(rt,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}function ht(){return e=>{W(e,"html",((e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[H,t]}))}}function ut({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0}){const i=[B,...n];return s&&i.push(ht),e(K,{remarkPlugins:i,components:r,children:t})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(lt||(lt={}));const pt=l(void 0);function mt(){return c(pt)}const ft=Symbol("__SLOT_NAME");function gt(e,t){const r=[];return h.forEach(e,(e=>{!function(e,t,r){let n;u(e)&&(n=e.type[ft])?r[n]=e:t.push(e)}(e,r,t)})),r.length>1?r:r[0]}function yt(e,t){t[ft]=e}function vt(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function bt(t){const r={};if(gt(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,s=r.content.props;return e(xt,{...t,trigger:n,content:s})}function xt({middleware:r,offset:n,trigger:s,dismiss:i=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=Y({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[G(n||4),X(),Z()],whileElementsMounted:J}),{floatingStyles:m,refs:{setReference:f,setFloating:g},context:y}=p,v=Q(y,vt(i)),b=ee(y,vt(!(x=s)||x.hover||x.click?x?.click:{enabled:!0}));var x;const w=te(y,vt(function(e){return!0===e?.hover?{enabled:!0,handleClose:ae({blockPointerEvents:!0}),restMs:0}:e?.hover}(s))),{getReferenceProps:N,getFloatingProps:k}=re([v,b,w]),{isMounted:C,styles:j}=ne(y,a.transition);return t(pt.Provider,{value:{...p,close:()=>u(!1)},children:[s&&e("div",{className:_(s.className,"inline-block"),ref:f,...N(),children:s.children}),e(se,{children:C&&e("div",{ref:g,style:{...m,zIndex:c},...k(),children:e(ie,{context:y,children:e("div",{className:_(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:j,children:a.children})})})})]})}function wt(e){return null}function Nt(e){return null}function kt({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function Ct({className:r,properties:n}){return e(v,{className:r,children:e("tbody",{children:n.map((r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(b,{description:r.description,placement:"top",children:e(E,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name)))})})}var jt;function St(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function Ot(e){let t,r=!1,n=!1;const s=e.type;if(Array.isArray(s))for(const e of s)"null"===e?r=!0:t||(t=e);else t=s;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?At(e[0].type):At(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let i=t;switch(e.editor||e.format){case"textarea":i="text";break;case"media":i="media";break;case"document":i="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:i}}function At(e){return e?Array.isArray(e)?e.find((e=>"null"!==e))||"any":e:"any"}yt("trigger",wt),yt("content",Nt),bt.Trigger=wt,bt.Content=Nt,function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(jt||(jt={}));let Pt=0;class $t{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new Tt("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new Tt("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new $t(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class Tt{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=Ot(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new Tt(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++Pt}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const s={};return St(s,r),e.properties[t]=s,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),s}(this._getPropertiesSchema(),e,t,r),s=new Tt(e,n,this.loader,this);return this.children.push(s),s}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter((e=>e!==t))))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter((e=>e.name!==this.name))),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,s={};for(const e of Object.keys(n)){const i=n[e];e===t?s[r]=i:s[e]=i}e.properties=s}e.required&&(e.required=e.required.map((e=>e===t?r:e)))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(St(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,this.schema.format=void 0,t=!0):e.editor?(this.schema.editor=e.editor,this.schema.format=e.editor,t=!0):n&&(this.schema.editor=void 0,this.schema.format=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const s=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=jt[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===jt.object}}(t);let i;return"text"===s.name?(s.name=jt.string,i="textarea"):"media"===s.name?(s.name=jt.any,i="media"):"document"===s.name?(s.name=jt.any,i="document"):i=null,{name:r,type:s,isRequired:n,editor:i}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function Et(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const It=function(){const e=Object.values(jt),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function qt({value:r,onChange:n,onCancel:s,onSave:i}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(Mt,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:s,onSave:i})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(Lt,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:s,onSave:i})}),t("div",{children:[e(g,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(I,{className:"size-4"})}),e(Dt,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function Mt({value:t,onChange:r,onCancel:n,onSave:s}){const o=i(null);a((()=>{o.current?.focus()}),[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":s?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:f.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function Lt({value:t,onChange:r,onCancel:n,onSave:s}){return e(x,{className:f.INPUT_UNSTYLED,options:It,value:t||"",onBlur:()=>{s?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?s?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Dt({value:r,isOpen:n,onClose:s}){return t(w,{isOpen:n,onClose:s,children:[e(N,{children:"Edit description"}),e(Ft,{value:r,onSave:s})]})}function Ft({value:n,onSave:s}){const o=i(null),[l,c]=d(n||"");return a((()=>{o.current&&o.current.focus()}),[o.current]),t(r,{children:[e(k,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(C,{children:e(g,{onClick:()=>s(l),children:"Save Changes"})})]})}function zt({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Rt(e){const[t,r]=d(new $t(e||{type:"object",properties:{}}).withChangeListener((e=>{r(e.clone())})));return t}const _t="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Vt=`${_t} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Ut=`${_t} shadow-xs ring-1 ring-inset ring-ring`;function Kt({value:r,onChange:n,onDelete:s,outlineOnHover:i=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:g,isOn:y}=j(u),[v,b]=d();return t("div",{className:"",children:[y&&!p?e(Wt,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void b(t);b(void 0)}n(e)&&g()},onCancel:g,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Bt,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:i,editOnClick:a,onDelete:s,readonly:p}),v&&e("div",{className:"text-red-500 text-sm",children:v})]})}function Bt({viewer:r,value:n,onEdit:s,editOnClick:i,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&s()},onClick:()=>{i&&s()},className:_("flex justify-start items-center group",a?Vt:_t,{"cursor-pointer":i}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(g,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(T,{className:"size-4"})}),c?null:e(g,{variant:"ghost",size:"sm",className:d,onClick:s,children:e(q,{className:"size-4"})})]})]})}function Wt({editor:t,value:r,onSave:n,onCancel:s,skipClickOutside:a}){const[o,l]=d(r),c=i(r),[h,u]=d(null),p=()=>{n(c.current)},m=S(p,a);return e("div",{ref:m,children:e("div",{className:Ut,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout((()=>{n(e)}),500)))},onSave:p,onCancel:s})})})})}function Ht(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function Gt({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map((e=>Xt(e,n))),n?null:e(er,{parent:r.root})]})}function Xt(t,r){return t.isParent?e(Yt,{property:t,readonly:r},t.name):e(Zt,{node:t,readonly:r},t.name)}function Zt({node:t,readonly:r}){return e("li",{children:e(Qt,{property:t,readonly:r})})}function Yt({property:r,readonly:n}){const[s,i]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>i(!s),children:e(s?M:L,{className:"size-4"})}),e("div",{className:"flex-1",children:e(Qt,{property:r,readonly:n})})]}),s&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map((e=>Xt(e,n))),n?null:e(er,{parent:r})]})]})}function Jt(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function Qt({property:t,readonly:r}){const n=O(),s=t.resetIsNew(),i=Et(t);return e(Kt,{value:i,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:qt,viewer:zt,outlineOnHover:!0,isEditing:s,skipClickOutside:Ht,readonly:r,onValidate:e=>Jt(e.name)})}function er({parent:r}){return t(g,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:jt.string},!0).isNew=!0,r.reloadTree()},children:[e($,{className:"size-4"}),"Add property"]})}function tr({content:t,...r}){const n=i(null);return a((()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach((([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))})),n.current.innerHTML="",n.current.appendChild(e)}),[t,r]),e("span",{ref:n})}function rr(t){return r=>e(tr,{content:t,...r})}function nr({onDrop:r,message:n,buttonLabel:s="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=i(null),u=i(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],s=new Set,i=async e=>{if(e.isFile){const t=await new Promise((t=>{e.file((r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)}))}));!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&s.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise((e=>{t.readEntries((t=>{e(t)}))}));await Promise.all(r.map(i));const n=e.fullPath.substring(1);n&&s.add(n)}};try{if(await Promise.all(t.map((e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?i(t):Promise.resolve()}))),n.length>0){const e=new Set(Array.from(s).map((e=>e.split("/")[0])).filter(Boolean)).size,t=n.length;let i="";i=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:i})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(D,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(g,{onClick:()=>{h.current&&h.current.click()},children:[e(D,{className:"h-4 w-4 mr-2"}),s]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some((e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/")))){const e=new Set(t.map((e=>e.webkitRelativePath?.split("/")[0])).filter(Boolean)).size,n=t.length,s=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,i={count:t.length,message:s};r(t,i)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function sr({title:r,count:n,icon:s=e(F,{className:"h-4 w-4 text-green-500"}),items:i}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:s}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:i.length>0?e("ul",{className:"space-y-1",children:i.map(((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r)))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function ir({files:r,className:n="",location:s,collection:i}){const a=r.filter((e=>"success"===e.status)),o=r.filter((e=>"updated"===e.status)),l=r.filter((e=>"skipped"===e.status)),c=r.filter((e=>"failed"===e.status)),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(F,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",i?` in collection '${i}'`:"",s?` in folder '${s}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(sr,{title:"Successfully Uploaded",count:d,icon:e(F,{className:"h-4 w-4 text-green-500"}),items:a.map((e=>e.name))}),h>0&&e(sr,{title:"Successfully Updated",count:h,icon:e(F,{className:"h-4 w-4 text-blue-500"}),items:o.map((e=>e.name))}),u>0&&e(sr,{title:"Skipped (Already Existed)",count:u,icon:e(z,{className:"h-4 w-4 text-amber-500"}),items:l.map((e=>e.name))}),p>0&&e(sr,{title:"Failed to Upload",count:p,icon:e(R,{className:"h-4 w-4 text-red-500"}),items:c.map((e=>e.name))})]})]})}const ar="#text",or="#comment",lr="#cdata",cr="DECLARATION_TAG",dr={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},hr=l({theme:dr,collapsible:!1,indentSize:2}),ur=()=>c(hr),pr=new de({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:or,cdataPropName:lr,parseTagValue:!1});function mr(r){const{indentation:n,children:s,isInline:i}=r,{theme:a}=ur();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),s,e("span",{children:`${i?"":n}]]>`})]})}function fr(t){const{collapsible:r,theme:n}=ur(),{collapsed:s}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(gr,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function gr({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function yr(e){const{collapsible:t,initialCollapsedDepth:r}=ur(),[n,s]=d((()=>!(oe(r)||!t)&&e>=r));return a((()=>{s(!(oe(r)||!t)&&e>=r)}),[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>s((e=>!e)),role:"button",style:{cursor:"pointer"}}:{}}}function vr(r){const{indentation:n,children:s,isInline:i,level:a}=r,{theme:o}=ur(),{collapsed:l,buttonProps:c}=yr(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(fr,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&s,l&&"...",e("span",{children:`${i||l?" ":n}--\x3e`})]})}function br(r){const{attributes:n}=r,{theme:s}=ur();return n?e("span",{children:Object.entries(n).map((([r,n])=>t("span",{children:[e("span",{style:{color:s.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:s.separatorColor},children:"="}),e("span",{style:{color:s.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`)))}):null}function xr(r){const{indentation:n,tagKey:s,attributes:i}=r,{theme:a}=ur();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${s.slice(1)}`}),e(br,{attributes:i}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function wr(e){return"string"==typeof e&&e.includes("\n")}function Nr(e){const t=e[":@"],r=le(e,":@"),[[n,s]]=Object.entries(r),i=function(e){switch(e){case ar:case lr:case or:return e;default:return e.startsWith("?")?cr:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:s,type:i}}function kr(e){return!!e&&Object.keys(e).length>0}function Cr(n){const{indentation:s,tagKey:i,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=yr(d),{theme:p}=ur();return t("div",{children:[t("span",{...u,children:[e("span",{children:s}),e(fr,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${i}`}),!h&&e(br,{attributes:a}),h&&kr(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":s}</`}),e("span",{style:{color:p.tagColor},children:`${i}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function jr(t){const{hasSiblings:r,text:n,indentation:s,isText:i}=t,{theme:a}=ur(),o=i?{color:a.textColor}:void 0;return wr(n)||r?e("div",{style:o,children:n.split("\n").filter((e=>!!e.trim())).map(((t,r)=>e("div",{children:`${s}${t.trim()}`},`${r}`)))}):e("span",{style:o,children:n})}function Sr(t){const{elements:n,level:s=0,isText:i=!0}=t,{indentSize:a}=ur();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map(((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=Nr(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,s),p=`${s}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&ar in e[0]&&!wr(e[0][ar])}(c);switch(d){case ar:return e(jr,{text:c,indentation:u,hasSiblings:h,isText:i},p);case or:return e(vr,{isInline:m,indentation:u,level:s,children:e(Sr,{elements:c,level:s+1,isText:!1})},p);case lr:return e(mr,{indentation:u,isInline:m,children:e(Sr,{elements:c,level:s+1,isText:!1})},p);case cr:return e(xr,{indentation:u,tagKey:o,attributes:l},p);default:return e(Cr,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:s,children:e(Sr,{elements:c,level:s+1})},p)}}))}):null}function Or(){return e("div",{children:"Invalid XML!"})}function Ar(t){const{theme:r,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d((()=>({...dr,...r}))),{json:m,valid:f}=function(e){return o((()=>{try{if(!he.validate(e))throw new Error("Invalid XML!");const t=pr.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}}),[e])}(n),g=o((()=>({theme:u,collapsible:s,indentSize:i,initialCollapsedDepth:h??c})),[u,s,i,c,h]);return a((()=>{p((e=>{const t={...dr,...r};return ce(t,e)?e:t}))}),[r]),f?e(hr.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:u.fontFamily,overflowWrap:"break-word"},children:e(Sr,{elements:m})})}):l||e(Or,{})}export{Le as ArrayPropertySchema,fe as CodeMirrorEditor,nr as DropZone,pe as EditorApi,ye as FieldSetContextProvider,Se as Form,we as FormContextProvider,Ce as FormError,ke as FormHelper,Ne as FormLabel,Ae as GeneratedForm,je as Input,tt as JSONCode,dt as JSONDisplay,rt as JSONView,Be as ManageObjectEntry,Ke as ManagedListProperty,_e as ManagedObject,Re as ManagedObjectBase,Ve as ManagedObjectProperty,Ue as ManagedProperty,We as ManagedScalarEntry,$t as ManagedSchema,ut as MarkdownRenderer,ze as Node,bt as Popover,pt as PopoverContext,kt as Progress,Ct as PropertiesView,qt as PropertyEditor,Mt as PropertyNameEditor,Me as PropertySchema,zt as PropertyViewer,$e as ScalarField,qe as Schema,Gt as SchemaEditor,Tt as SchemaNode,tr as SvgIcon,sr as UploadResultCategory,ir as UploadSummary,Ar as XMLViewer,De as computeTitleFromName,rr as createSvgIcon,Et as getEditableSchemaProperty,ve as useFieldSet,xe as useForm,mt as usePopoverContext,Rt as useSchema,Jt as validatePropertyName};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"debounce";import s,{useRef as i,useEffect as a,useMemo as o,createContext as l,useContext as c,useState as d,Children as h,isValidElement as u}from"react";import{EditorView as p}from"@codemirror/view";import{useSafeLayoutEffect as m,Styles as f,FormItem as g,Button as y,DotBadge as v,Table as b,VTooltip as x,VSelectBox as w,VModal as N,VModalTitle as k,ModalBody as C,ModalFooter as j,useFlag as S,useClickOutside as O,useToast as A}from"@vertesia/ui/core";import{Text as P,EditorState as $}from"@codemirror/state";import{Plus as T,Trash2 as E,Info as I,AlignLeft as q,SquarePen as M,ChevronDown as L,ChevronRight as D,UploadIcon as z,CheckCircleIcon as F,AlertCircleIcon as R,XCircleIcon as _}from"lucide-react";import V from"clsx";import U from"ajv";import{ObjectWalker as K}from"@vertesia/json";import B from"react-markdown";import W from"remark-gfm";import{visit as H,SKIP as G}from"unist-util-visit";import{offset as X,shift as Z,flip as Y}from"@floating-ui/dom";import{useFloating as J,autoUpdate as Q,useDismiss as ee,useClick as te,useHover as re,useInteractions as ne,useTransitionStyles as se,FloatingPortal as ie,FloatingFocusManager as ae,safePolygon as oe}from"@floating-ui/react";import{isNil as le,omit as ce,isEqual as de}from"lodash-es";import{XMLParser as he,XMLValidator as ue}from"fast-xml-parser";let pe=null;class me{editor;constructor(e){this.editor=e}setValue(e){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e||""}})}getValue(){return this.editor.state.doc.toString()}}const fe=[p.theme({"&":{fontSize:"14px",fontFamily:"monospace"},".cm-content":{fontFamily:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{backgroundColor:"transparent",color:"#ddd"},".cm-focused":{outline:"none"},".cm-cursor":{borderLeft:"2px solid #808080",borderLeftColor:"#808080",animation:"blink 1.2s step-start infinite"},"@keyframes blink":{"50%":{opacity:0}}}),p.lineWrapping];function ge({onChange:t,value:r,className:s,editorRef:l,extensions:c,debounceTimeout:d=0}){const h=i(null),u=i(void 0);a((()=>{if(t)return u.current=d>0?n(t,d):t,()=>{u.current=void 0}}),[t,d]);const f=o((()=>e("div",{ref:h,className:s})),[s]);return m((()=>{if(h.current){let t=[...fe,(e=e=>{u.current?.(e)},p.updateListener.of((t=>{t.docChanged&&e(t)})))];Array.isArray(c)?t=t.concat(c):c&&t.push(c);const n=((e="",t=[])=>{const r="string"==typeof e?P.of(e.split("\n")):e;return pe?pe.doc.toString()!==r.toString()&&(pe=$.create({doc:r,extensions:t})):pe=$.create({doc:r,extensions:t}),pe})(r,t),s=new p({state:n,parent:h.current}),i=new me(s);return l&&(l.current=i),()=>{s.destroy(),l&&(l.current=void 0)}}var e}),[f,c]),f}const ye=l(void 0),ve=ye.Provider;function be(){const e=c(ye);if(!e)throw new Error("useFieldSet must be used within a Form or FieldSet element");return e}class xe{object;components;disabled;constructor(e,t={},r=!1){this.object=e,this.components=t,this.disabled=r}}const we=l(void 0);function Ne(){const e=c(we);if(!e)throw new Error("useForm must be used within a Form element");return e}const ke=we.Provider,Ce=s.forwardRef((({object:t,type:r="text",onChange:n,...s},i)=>{const[a,o]=d(null!=t.value?String(t.value):""),[l,c]=d(t.schema.isBoolean&&!0===t.value);s.className?s.className=V(f.INPUT,s.className):s.className=f.INPUT;const h=e=>{s.disabled||(o(e.target.value),t.schema.isBoolean?(t.value=e.target.checked,c(t.value)):t.value=e.target.value,n&&n(e))};return"textarea"===r?e("textarea",{ref:i,...s,value:a,onChange:h}):e("input","checkbox"===r?{ref:i,...s,type:"checkbox",checked:l,onChange:h,className:"form-check-input"}:{ref:i,...s,type:r,value:a,onChange:h})}));function je({object:t,components:r,onSubmit:n,children:s,onChange:i,disabled:a}){return t.observer=i,e(ke,{value:new xe(t,r||{},a??!1),children:e("form",{className:"w-full",onSubmit:e=>{e.stopPropagation(),e.preventDefault(),n&&n(t.value)},children:s})})}function Se(){const t=Ne();return e("div",{className:"flex flex-col gap-4 w-full",children:t.object.properties.map(Ae)})}function Oe({children:r,...n}){return t(je,{...n,children:[e(Se,{}),r]})}function Ae(t){return t.isList?e(Te,{object:t},t.name):t.isObject?e($e,{object:t},t.name):e(Pe,{object:t},t.name)}function Pe({object:t,editor:r,inline:n=!1}){r||(r=t.schema.editor);const{components:s,disabled:i}=Ne(),a=r&&s[r]||Ce,o=t.getInputType();"checkbox"===o&&(n=!0);return e(g,{label:t.title,required:t.schema.isRequired,description:t.schema.description,className:V("flex",n?"flex-row items-center":"flex-col"),children:!t.isListItem&&e(a,{object:t,type:o,onChange:e=>{if(i)return;const{value:r}=e.target;t.value=t.schema.isNumber?parseFloat(r):r},disabled:i})})}function $e({object:r}){return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.properties.map(Ae)]})}function Te({object:r}){const[n,s]=d(r.value||[]),{disabled:i}=Ne();return t("div",{className:"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600",children:[!r.isListItem&&e("div",{className:"text-gray-900 dark:text-gray-200 font-semibold",children:r.title}),r.items.map(((t,a)=>e(Ee,{object:t,list:r,onDelete:()=>(e=>{i||(r.remove(e),s([...r.value]))})(a),disabled:i},`${a}-${n[a]??""}`))),e("div",{children:t(y,{variant:"secondary",onClick:()=>{i||(r.add(),s([...r.value]))},disabled:i,children:[e(T,{className:"size-6"})," Add"]})})]})}function Ee({list:r,object:n,onDelete:s,disabled:i}){return t("div",{className:"flex gap-2 w-full",children:[e("div",{className:"flex-1",children:(a=n,o=r.schema.arraySchema.editor,a.isList?e(Te,{object:a}):a.isObject?e($e,{object:a}):e(Pe,{object:a,editor:o}))}),e(y,{variant:"secondary",onClick:s,disabled:i,children:e(E,{className:"size-4"})})]});var a,o}class Ie{schema;properties={};_validator;constructor(e){this.schema=e||{type:"object",properties:{}},this.load()}get validator(){if(!this._validator){const e=new U({allErrors:!0,strict:!1});this._validator=e.compile(this.schema)}return this._validator}load(){if(this.schema.properties){const e=this.schema.properties;Object.keys(e).forEach((t=>{this.loadProperty(t,e[t])}))}}hasProperties(){return Object.keys(this.properties).length>0}get title(){return this.schema.title||this.schema.name}get description(){return this.schema.description}loadProperty(e,t){let r;return r="array"===t.type?new Me(this,e,t):new qe(this,e,t),this.properties[e]=r,r}get type(){return this.schema.type}validate(e){return this.validator(e)?null:this.validator.errors||[]}addProperty(e,t,r=!1){"object"!==this.schema.type&&(this.schema.type="object"),this.schema.properties||(this.schema.properties={});const n="string"==typeof t?"object"===(s=t)?{type:"object",properties:{}}:"array"===s?{type:"array",items:{}}:{type:s}:t;var s;const i=this.loadProperty(e,n);return this.schema.properties[i.name]=i.schema,r&&(i.isRequired=!0),i}removeProperty(e){this.schema.properties&&(delete this.schema.properties[e],Array.isArray(this.schema.required)&&(this.schema.required=this.schema.required.filter((t=>t!==e)))),delete this.properties[e]}getProperty(e){return this.properties[e]}get editor(){return this.schema.editor}}class qe extends Ie{parent;name;constructor(e,t,r){if(super(r),this.parent=e,this.name=t,"array"===r.type)throw new Error("Array property must be instantiated using ArrayPropertySchema");"object"!==r.type||r.properties||(r.properties={})}get isMulti(){return!1}get isReadOnly(){return!!this.schema.readOnly}set isReadOnly(e){this.schema.readOnly=e}get defaultValue(){return this.schema.default}set defaultValue(e){this.schema.default=e}get enum(){return this.schema.enum}set enum(e){this.schema.enum=e}get isRequired(){const e=this.parent.schema.required;return!!e&&e.includes(this.name)}set isRequired(e){let t=Array.isArray(this.parent.schema.required)?this.parent.schema.required:[];t=e?t.concat(this.name):t.filter((e=>e!==this.name)),this.parent.schema.required=t}get type(){return this.schema.type}set type(e){this.schema.type!==e&&(this.schema.type=e,"object"!==e&&(this.properties={},this.schema.properties=void 0))}remove(){this.parent.removeProperty(this.name)}get isBoolean(){return"boolean"===this.type}get isString(){return"string"===this.type}get isNumber(){return"number"===this.type||"integer"===this.type}get isObject(){return"object"===this.type}}class Me extends qe{arraySchema;constructor(e,t,r){super(e,t,function(e){if("array"!==e.type)throw new Error("Expecting an array schema");if(e.items){if(Array.isArray(e.items))throw new Error("Tuple arrays are not supported")}else e.items={};return e.items}(r)),this.arraySchema=r}get isMulti(){return!0}}function Le(e){return(e=e.replace(/_/g," ").replace(/([a-z0-9])&([A-Z])/g,"$1 $2"))[0].toUpperCase()+e.slice(1)}function De(e,t){if(t.editor)return t.editor;if(t.schema.format)return t.schema.format;switch(t.type){case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text"}}class ze{parent;schema;name;observer;constructor(e,t,r){this.parent=e,this.schema=t,this.name=r}get isRoot(){return!this.parent}get root(){return this.parent?this.parent.root:this}get path(){return this.parent?this.parent.path.concat(this.name):[]}get isScalar(){return!1}get isListItem(){return!1}get isObject(){return!1}get isList(){return!1}get title(){return this.schema.title||Le(this.name)}onChange(e){this.observer&&!1===this.observer(this)||this.parent&&this.parent.onChange(e)}}class Fe extends ze{constructor(e,t,r){super(e,t,r)}get isObject(){return!0}getProperty(e){const t=this.schema.properties[e];return t.isMulti?new Ue(this,t,this.getOrInitArrayProperty(e)):t.isObject?new _e(this,t,t.name,this.getOrInitObjectProperty(e)):new Ve(this,t)}getOrInitObjectProperty(e){let t=this.value[e];return t||(this.value[e]=t={}),t}getOrInitArrayProperty(e){let t=this.value[e];return t||(this.value[e]=t=[]),t}setPropertyValue(e,t){return this.value[e]!==t&&(this.value[e]=t,!0)}getPropertyValue(e){return this.value[e]}get properties(){const e=[];for(const t of Object.values(this.schema.properties))t.isMulti?e.push(new Ue(this,t,this.getOrInitArrayProperty(t.name))):t.isObject?e.push(new _e(this,t,t.name,this.getOrInitObjectProperty(t.name))):e.push(new Ve(this,t));return e}[Symbol.iterator](){return this.properties[Symbol.iterator]()}}class Re extends Fe{value;constructor(e,t={}){super(null,e instanceof Ie?e:new Ie(e),"#root"),this.value=t}}class _e extends Fe{value;constructor(e,t,r,n){super(e,t,r),this.value=n}}class Ve extends ze{constructor(e,t){super(e,t,t.name),void 0===e.value[this.name]&&void 0!==t.defaultValue&&(e.value[this.name]=t.defaultValue)}get isScalar(){return!0}set value(e){this.parent.setPropertyValue(this.name,e)&&this.onChange(this)}get value(){return this.parent.getPropertyValue(this.name)}getInputType(){return De(this.name,this.schema)}}class Ue extends ze{value;items=[];constructor(e,t,r){super(e,t,t.name),this.value=r;for(const e of this.value)this.add()}get isList(){return!0}newItem(e){return this.schema.isObject?new Ke(this,e):new Be(this,e)}add(){const e=this.newItem(this.items.length);return this.items.push(e),e}remove(e){const t=this.value;if(e>=0&&e<this.items.length){this.items.splice(e,1);for(let e=0,t=this.items.length;e<t;e++){const t=this.items[e];t.index=e,t.name=String(e)}}Array.isArray(t)&&e>=0&&e<t.length&&(t.splice(e,1),this.onChange(this))}[Symbol.iterator](){return this.items[Symbol.iterator]()}item(e){if(e<0||e>=this.value.length)return;const t=this.value[e];return this.schema.isObject?new _e(this,this.schema,String(e),t):new Be(this,e)}trim(){for(;void 0===this.items[this.items.length-1];)this.items.pop()}}class Ke extends Fe{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&(e.value[t]={}),this.key=this.name+"@"+Date.now()}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}}class Be extends ze{index;key;constructor(e,t){super(e,e.schema,String(t)),this.index=t,void 0===e.value[t]&&void 0!==e.schema.defaultValue&&(e.value[t]=e.schema.defaultValue),this.key=this.name+"@"+Date.now()}get isScalar(){return!0}get isListItem(){return!0}set value(e){this.parent.value[this.index]=e}get value(){return this.parent.value[this.index]}getInputType(){return De(this.name,this.schema)}}function We({label:t,required:r,children:n}){return e(g,{label:t,required:r,children:n})}function He({children:t}){return e("p",{className:"mt-2 text-sm text-gray-500",children:t})}function Ge({children:t}){return e("p",{className:"mt-2 text-sm text-red-600",children:t})}const Xe="text-pink-500 dark:text-pink-400",Ze="text-purple-500 dark:text-purple-400",Ye="text-blue-500 dark:text-blue-400",Je={code:"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono",comma:Xe,assign:Xe,startObject:Xe,endObject:Xe,startArray:Xe,endArray:Xe,boolean:Ze,null:Ze,key:Ye,index:Ye,string:"text-orange-500 dark:text-orange-400",number:"text-green-500 dark:text-green-400"};class Qe{renderer;parent;key;indent;result=[];constructor(e,t,r,n){this.renderer=e,this.parent=t,this.key=r,this.indent=n}get classMap(){return this.renderer.classMap}writeKey(e){const t=typeof e;"string"===t?(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent),this.result.push(`<span class="${this.classMap.key}">"${e}"</span><span class='${this.classMap.assign}'>: </span>`)):"number"===t&&(this.result.length>0&&this.result.push(`<span class='${this.classMap.comma}'>,\n</span>`),this.indent&&this.result.push(this.indent))}pushValue(e,t){if(this.writeKey(e),null===t)this.result.push(`<span class='${this.classMap.null}'>null</span>`);else if(t instanceof Qe)this.result.push(t.renderStart()+t.renderValue()+t.renderEnd());else{let e;const r=typeof t;"string"===r?(t=(t=`"${t}"`).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),e=this.classMap.string):"number"===r?e=this.classMap.number:"boolean"===r&&(e=this.classMap.boolean),this.result.push(`<span class='${e}'>${t}</span>`)}}renderValue(){return this.result.join("")}}class et extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startObject}'>{\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endObject}'>${e}${this.parent?.indent||""}}</span>`}}class tt extends Qe{constructor(e,t,r,n){super(e,t,r,n)}renderStart(){return`<span class='${this.classMap.startArray}'>[\n</span>`}renderEnd(){const e=this.result.length>0?"\n":"";return`<span class='${this.classMap.endArray}'>${e}${this.parent?.indent||""}]</span>`}}class rt{classMap;tab;stack=[];block=new et(this,void 0,"","");constructor(e=Je,t=" "){this.classMap=e,this.tab=t}onStartObject(e){const t=new et(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndObject(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onStartIteration(e){const t=new tt(this,this.block,e,this.block.indent+this.tab);this.stack.push(this.block),this.block=t}onEndIteration(){const e=this.block;this.block=this.stack.pop(),this.block.pushValue(e.key,e)}onValue(e,t){this.block.pushValue(e,t)}}function nt({data:t,className:r,classMap:n}){const[s,i]=d();return a((()=>{i(function(t,r,n){const s=new rt(r);(new K).walk(t,s);const i=s.block.renderValue();return e("div",{className:n,dangerouslySetInnerHTML:{__html:`<div class='${s.classMap.code}' style='overflow-x: scroll'>${i}</div>`}})}(t,n,r))}),[t]),s}function st({value:t}){return e("div",{className:"flex flex-col gap-4",children:Object.entries(t).map((([t,r])=>e(ot,{name:t,value:r},t)))})}function it({name:t}){return e("div",{className:"text-md font-semibold",children:Le(t)})}function at({children:t,className:r}){return e("div",{className:V("flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600",r),children:t})}function ot({name:r,value:n}){const s=ht(n);switch(s.type){case dt.Inline:return t("div",{className:"w-full flex gap-2",children:[e(it,{name:r+":"}),e("p",{children:s.value})]});case dt.Paragraph:return t("div",{children:[e(it,{name:r}),e("p",{children:s.value})]});case dt.Prose:return t("div",{className:"prose dark:prose-invert",children:[e(it,{name:r}),e("div",{className:"vprose dark:prose-invert",children:s.value})]});case dt.Array:return e(lt,{name:r,value:n});case dt.Object:return t("div",{children:[e(it,{name:r}),e(at,{className:"mt-2",children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))})]})}}function lt({name:r,value:n}){const s=n.join(" ").length,i=s/n.length,a="string"==typeof n[0]&&(s<80||s<400&&i<32),o=n.length>9;return t("div",a?{className:"flex gap-2 flex-wrap",children:[r&&e(it,{name:r+":"}),n.map(((t,r)=>e(v,{children:String(t)},r)))]}:{children:[r&&e(it,{name:r}),e("div",{className:"flex flex-col gap-2",children:n.map(((t,r)=>e(ct,{index:r,value:t,useBullet:o},r)))})]})}function ct({index:r,value:n,useBullet:s}){const i=s?e("span",{className:"text-xl",children:"•"}):t("span",{children:[r+1,"."]}),a=ht(n);let o;switch(a.type){case dt.Object:o=e(at,{children:Object.entries(n).map((([t,r])=>e(ot,{name:t,value:r},t)))});break;case dt.Array:o=e(lt,{value:n});break;case dt.Prose:o=e("div",{className:"prose dark:prose-invert",children:a.value});break;default:o=e("div",{children:a.value})}return t("div",{className:"flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4",children:[e("div",{className:"font-semibold text-gray-600 dark:text-gray-400",children:i}),e("div",{children:o})]})}var dt;function ht(e){if(null==e)return{value:"-",type:dt.Inline};if(Array.isArray(e))return{value:e,type:dt.Array};const t=typeof e;if("string"===t){const t=e.length;let r;return t<80?r=dt.Inline:t>400?r=dt.Prose:(r=dt.Paragraph,e=e.replace(/(?:\n\n)+/g,"\n\n")),{type:r,value:e}}return"number"===t||"boolean"===t?{value:String(e),type:dt.Inline}:{value:e,type:dt.Object}}function ut({value:t,viewCode:r=!1}){return t?e("div",{className:"relative w-full",children:r?e(nt,{data:t}):e(st,{value:t})}):e("pre",{className:"whitespace-pre-wrap",children:"No Data to display"})}function pt(){return e=>{H(e,"html",((e,t,r)=>{if(e.value&&/<!--[\s\S]*?-->/.test(e.value)&&r&&"number"==typeof t&&r.children)return r.children.splice(t,1),[G,t]}))}}function mt({children:t,components:r,remarkPlugins:n=[],removeComments:s=!0}){const i=[W,...n];return s&&i.push(pt),e(B,{remarkPlugins:i,components:r,children:t})}!function(e){e[e.Inline=0]="Inline",e[e.Paragraph=1]="Paragraph",e[e.Prose=2]="Prose",e[e.Array=3]="Array",e[e.Object=4]="Object"}(dt||(dt={}));const ft=l(void 0);function gt(){return c(ft)}const yt=Symbol("__SLOT_NAME");function vt(e,t){const r=[];return h.forEach(e,(e=>{!function(e,t,r){let n;u(e)&&(n=e.type[yt])?r[n]=e:t.push(e)}(e,r,t)})),r.length>1?r:r[0]}function bt(e,t){t[yt]=e}function xt(e){return e?"boolean"==typeof e?{enabled:e}:e:{enabled:!1}}function wt(t){const r={};if(vt(t.children,r),!r.content)throw new Error("Popover must provide a content slot");const n=r.trigger?.props,s=r.content.props;return e(Nt,{...t,trigger:n,content:s})}function Nt({middleware:r,offset:n,trigger:s,dismiss:i=!0,content:a,placement:o,strategy:l,zIndex:c=40}){const[h,u]=d(!1),p=J({open:h,placement:o,strategy:l,onOpenChange:u,middleware:r||[X(n||4),Z(),Y()],whileElementsMounted:Q}),{floatingStyles:m,refs:{setReference:f,setFloating:g},context:y}=p,v=ee(y,xt(i)),b=te(y,xt(!(x=s)||x.hover||x.click?x?.click:{enabled:!0}));var x;const w=re(y,xt(function(e){return!0===e?.hover?{enabled:!0,handleClose:oe({blockPointerEvents:!0}),restMs:0}:e?.hover}(s))),{getReferenceProps:N,getFloatingProps:k}=ne([v,b,w]),{isMounted:C,styles:j}=se(y,a.transition);return t(ft.Provider,{value:{...p,close:()=>u(!1)},children:[s&&e("div",{className:V(s.className,"inline-block"),ref:f,...N(),children:s.children}),e(ie,{children:C&&e("div",{ref:g,style:{...m,zIndex:c},...k(),children:e(ae,{context:y,children:e("div",{className:V(a.className,"bg-popover rounded-md text-popover-foreground max-w-md"),style:j,children:a.children})})})})]})}function kt(e){return null}function Ct(e){return null}function jt({percent:t}){return e("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:e("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:`${t}%`}})})}function St({className:r,properties:n}){return e(b,{className:r,children:e("tbody",{children:n.map((r=>t("tr",{children:[t("td",{className:"w-1/3 font-semibold gap-2",children:[e("span",{children:r.name}),r.description&&e(x,{description:r.description,placement:"top",children:e(I,{className:"size-3 ml-2 text-muted-foreground"})})]}),e("td",{className:"w-2/3",children:r.value??"undefined"})]},r.name)))})})}var Ot;function At(e,t){let r="any"===t.name?void 0:t.isNullable?[t.name,"null"]:t.name;if(t.isArray)if(e.type="array",e.properties=void 0,!e.items||Array.isArray(e.items))e.items={type:r,properties:t.isObject?{}:void 0};else{const n=e.items;n.type=r,t.isObject&&!n.properties&&(n.properties={})}else e.type=r,e.items=void 0,t.isObject?e.properties||(e.properties={}):e.properties=void 0}function Pt(e){let t,r=!1,n=!1;const s=e.type;if(Array.isArray(s))for(const e of s)"null"===e?r=!0:t||(t=e);else t=s;t||(t="any"),"array"===t&&(n=!0,t=function(e){if(!e)return"any";let t;t=Array.isArray(e)?$t(e[0].type):$t(e.type);"array"!==t&&"null"!==t||(t="any");return t}(e.items));let i=t;switch(e.editor||e.format){case"textarea":i="text";break;case"media":i="media";break;case"document":i="document"}return{isNullable:r,isArray:n,isObject:"object"===t,name:i}}function $t(e){return e?Array.isArray(e)?e.find((e=>"null"!==e))||"any":e:"any"}bt("trigger",kt),bt("content",Ct),wt.Trigger=kt,wt.Content=Ct,function(e){e.string="string",e.number="number",e.integer="integer",e.boolean="boolean",e.object="object",e.any="any",e.text="text",e.media="media",e.document="document"}(Ot||(Ot={}));let Tt=0;class Et{source;onChange=()=>{};schema;root;constructor(e,t){this.schema=e?"string"==typeof e?JSON.parse(e):e:{title:t,type:"object",properties:{}},this.schema.properties||(this.schema.properties={}),this.root=new It("",this.schema,this),this.root.loadChildren()}get isEmpty(){return!this.root.children||0===this.root.children.length}get children(){return this.root.children}reload(){return this.root=new It("",this.schema,this),this.root.loadChildren(),this.onChange?.(this),this}withSource(e,t){return this.source={uri:t,name:e},this}withChangeListener(e){return this.onChange=e,this}replaceSchema(e){this.schema=e||{title:this.schema.title,type:"object",properties:{}},this.reload()}clone(){const e=new Et(this.schema);return e.source=this.source,this.onChange&&e.withChangeListener(this.onChange),e}}class It{schema;loader;parent;name;isRequired=!1;type;children;constructor(e,t,r,n){if(this.schema=t,this.loader=r,this.parent=n,this.name=e,this.type=Pt(t),this.parent){let t=this.parent._getPropertiesSchema().required;this.isRequired=!(!t||!Array.isArray(t))&&t.includes(e)}}get title(){return this.schema.title}set title(e){this.schema.title=e}get description(){return this.schema.description}set description(e){this.schema.description=e}get isParent(){return this.type.isObject}get isNew(){return!!this.schema.isNew}set isNew(e){e?this.schema.isNew=!0:delete this.schema.isNew}resetIsNew(){const e=this.isNew;return this.isNew=!1,e}getNameSignature(){return`${this.name}${this.isRequired?"":"?"}`}getTypeSignature(){return`${this.type.name}${this.type.isArray?"[]":""}${this.type.isNullable?"?":""}`}getSignature(){return`${this.getNameSignature()}: ${this.getTypeSignature()}`}reloadTree(){this.loader.reload()}loadChildren(){this.children=[],this.schema.items&&this.schema.items.properties?this._loadChildren(this.schema.items.properties):this.schema.properties&&this._loadChildren(this.schema.properties)}_loadChildren(e){for(const t of Object.keys(e)){const r=e[t],n=new It(t,r,this.loader,this);this.children.push(n),n.isParent&&n.loadChildren()}}_getPropertiesSchema(){return this.type.isArray&&this.type.isObject?this.schema.items:this.schema}findAvailableChildName(e){const t=this._getPropertiesSchema().properties||{};let r;do{r=e+ ++Tt}while(t[r]);return r}addChild(e,t,r=!1){if(!this.type.isObject)throw new Error("Cannot add child to a non object node");this.children||(this.children=[]);const n=function(e,t,r,n=!1){if("object"!==e.type)throw new Error("Cannot add property to a non-object schema");e.properties||(e.properties={});const s={};return At(s,r),e.properties[t]=s,n&&(Array.isArray(e.required)?function(e,t){e.includes(t)||e.push(t)}(e.required,t):e.required=[t]),s}(this._getPropertiesSchema(),e,t,r),s=new It(e,n,this.loader,this);return this.children.push(s),s}remove(){if(this.parent&&this.parent.type.isObject){return function(e,t){e.properties&&(delete e.properties[t],Array.isArray(e.required)&&(e.required=e.required.filter((e=>e!==t))))}(this.parent._getPropertiesSchema(),this.name),this.parent.children&&(this.parent.children=this.parent.children.filter((e=>e.name!==this.name))),!0}return!1}update(e){let t=!1;null!=e.name&&this.name!==e.name&&(this.parent&&function(e,t,r){if(e.properties){const n=e.properties,s={};for(const e of Object.keys(n)){const i=n[e];e===t?s[r]=i:s[e]=i}e.properties=s}e.required&&(e.required=e.required.map((e=>e===t?r:e)))}(this.parent._getPropertiesSchema(),this.name,e.name),this.name=e.name,t=!0),null!=e.isRequired&&this.isRequired!==e.isRequired&&(this.parent&&function(e,t,r){if(Array.isArray(e.required)){const n=e.required.indexOf(t);r?n<0&&e.required.push(t):n>-1&&e.required.splice(n,1)}else r&&(e.required=[t])}(this.parent._getPropertiesSchema(),this.name,e.isRequired),this.isRequired=e.isRequired,t=!0);let r=e.type?.name;"any"===r&&(r=void 0);const n=r!==this.schema.type;return e.type&&(At(this.schema,e.type),this.type=e.type,this.type.isObject?this.children||(this.children=[]):this.children=void 0,t=!0),this.schema.editor&&null===e.editor?(this.schema.editor=void 0,this.schema.format=void 0,t=!0):e.editor?(this.schema.editor=e.editor,this.schema.format=e.editor,t=!0):n&&(this.schema.editor=void 0,this.schema.format=void 0,t=!0),e.description!==this.description&&(this.description=e.description,t=!0),t}getUpdateFromNameAndTypeSignature(e,t){let r=e.trim(),n=!0;r.endsWith("?")&&(r=r.substring(0,r.length-1).trim(),n=!1);const s=function(e){let t=!1,r=!1;(e=e.trim()).endsWith("?")&&(r=!0,e=e.substring(0,e.length-1).trim()),e.endsWith("[]")&&(t=!0,e=e.substring(0,e.length-2).trim());const n=Ot[e];if(!n)throw new Error(`Unknown type "${e}"`);return{name:n,isArray:t,isNullable:r,isObject:n===Ot.object}}(t);let i;return"text"===s.name?(s.name=Ot.string,i="textarea"):"media"===s.name?(s.name=Ot.any,i="media"):"document"===s.name?(s.name=Ot.any,i="document"):i=null,{name:r,type:s,isRequired:n,editor:i}}updateFromNameAndTypeSignature(e,t){return this.update(this.getUpdateFromNameAndTypeSignature(e,t))}updateFromSignature(e){const t=(e=e.trim()).indexOf(":");if(t<0)throw new Error("Expecting a name and a type separated by a colon");const r=e.substring(0,t),n=e.substring(t+1);return this.updateFromNameAndTypeSignature(r,n)}}function qt(e){return{name:e.getNameSignature(),type:e.getTypeSignature(),description:e.description}}const Mt=function(){const e=Object.values(Ot),t=[...e];for(const r of e)t.push(r+"[]");return e.sort(),t}();function Lt({value:r,onChange:n,onCancel:s,onSave:i}){const[a,o]=d(!1);if(!r)return null;return t("div",{className:"flex items-center",children:[e("div",{className:"flex-1",children:e(Dt,{value:r.name,onChange:e=>{n({...r,name:e})},onCancel:s,onSave:i})}),e("div",{className:"px-1 font-semibold",children:":"}),e("div",{className:"flex-1",children:e(zt,{value:r.type,onChange:e=>{n({...r,type:e})},onCancel:s,onSave:i})}),t("div",{children:[e(y,{variant:"ghost",size:"xs",onClick:()=>o(!0),title:"Edit description",children:e(q,{className:"size-4"})}),e(Ft,{value:r.description,isOpen:a,onClose:e=>{void 0!==e&&"string"==typeof e&&n({...r,description:e},!0),o(!1)}})]})]})}function Dt({value:t,onChange:r,onCancel:n,onSave:s}){const o=i(null);a((()=>{o.current?.focus()}),[]);return e("input",{onKeyUp:e=>{switch(e.key){case"Enter":s?.();break;case"Escape":n?.()}},ref:o,value:t,onChange:e=>{r(e.target.value)},className:f.INPUT_UNSTYLED,style:{fontSize:"inherit",width:"",display:"inline"}})}function zt({value:t,onChange:r,onCancel:n,onSave:s}){return e(w,{className:f.INPUT_UNSTYLED,options:Mt,value:t||"",onBlur:()=>{s?.()},onChange:r,onKeyDown:(e,t)=>{t||("Enter"===e.key?s?.():"Escape"===e.key&&n?.())},popupClass:"schema-type-suggest-popup z-90"})}function Ft({value:r,isOpen:n,onClose:s}){return t(N,{isOpen:n,onClose:s,children:[e(k,{children:"Edit description"}),e(Rt,{value:r,onSave:s})]})}function Rt({value:n,onSave:s}){const o=i(null),[l,c]=d(n||"");return a((()=>{o.current&&o.current.focus()}),[o.current]),t(r,{children:[e(C,{className:"h-max",children:e("textarea",{ref:o,className:"dark:bg-gray-800 w-full h-full dark:text-white",value:l,onChange:e=>c(e.target.value)})}),e(j,{children:e(y,{onClick:()=>s(l),children:"Save Changes"})})]})}function _t({value:r}){return r?t("div",{className:"w-full flex items-baseline",children:[e("div",{children:r.name||""}),e("div",{className:"ml-2 text-sm text-muted",children:r.type||""})]}):null}function Vt(e){const[t,r]=d(new Et(e||{type:"object",properties:{}}).withChangeListener((e=>{r(e.clone())})));return t}const Ut="block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4",Kt=`${Ut} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`,Bt=`${Ut} shadow-xs ring-1 ring-inset ring-ring`;function Wt({value:r,onChange:n,onDelete:s,outlineOnHover:i=!1,editOnClick:a=!0,placeholder:o,viewer:l,editor:c,skipClickOutside:h,isEditing:u=!1,readonly:p=!1,onValidate:m}){const{on:f,off:g,isOn:y}=S(u),[v,b]=d();return t("div",{className:"",children:[y&&!p?e(Gt,{value:r,onSave:e=>{if(m){const t=m(e);if(t)return void b(t);b(void 0)}n(e)&&g()},onCancel:g,editor:c,skipClickOutside:e=>!!h&&h(e)}):e(Ht,{value:r,onEdit:f,viewer:l,placeholder:o,outlineOnHover:i,editOnClick:a,onDelete:s,readonly:p}),v&&e("div",{className:"text-red-500 text-sm",children:v})]})}function Ht({viewer:r,value:n,onEdit:s,editOnClick:i,outlineOnHover:a,placeholder:o,onDelete:l,readonly:c}){const d="invisible group-hover:visible";return t("div",{tabIndex:0,onKeyUp:e=>{"Enter"===e.key&&s()},onClick:()=>{i&&s()},className:V("flex justify-start items-center group",a?Kt:Ut,{"cursor-pointer":i}),children:[e(r,{value:n,placeholder:o}),t("div",{className:"ml-auto flex space-x-2",children:[!c&&l&&e(y,{variant:"ghost",size:"sm",className:d,onClick:l,children:e(E,{className:"size-4"})}),c?null:e(y,{variant:"ghost",size:"sm",className:d,onClick:s,children:e(M,{className:"size-4"})})]})]})}function Gt({editor:t,value:r,onSave:n,onCancel:s,skipClickOutside:a}){const[o,l]=d(r),c=i(r),[h,u]=d(null),p=()=>{n(c.current)},m=O(p,a);return e("div",{ref:m,children:e("div",{className:Bt,children:e("div",{className:"w-full",onClick:e=>e.stopPropagation(),children:e(t,{value:o,onChange:(e,t=!1)=>{l(e),c.current=e,t&&(h&&clearTimeout(h),u(setTimeout((()=>{n(e)}),500)))},onSave:p,onCancel:s})})})})}function Xt(e){const t=e.target;return!(!t.closest||!t.closest(".schema-type-suggest-popup"))}function Zt({schema:r,readonly:n=!1}){return t("ul",{className:"",children:[r.children.map((e=>Yt(e,n))),n?null:e(rr,{parent:r.root})]})}function Yt(t,r){return t.isParent?e(Qt,{property:t,readonly:r},t.name):e(Jt,{node:t,readonly:r},t.name)}function Jt({node:t,readonly:r}){return e("li",{children:e(tr,{property:t,readonly:r})})}function Qt({property:r,readonly:n}){const[s,i]=d(!0);return t("li",{children:[t("div",{className:"flex items-center w-full",children:[e("button",{onClick:()=>i(!s),children:e(s?L:D,{className:"size-4"})}),e("div",{className:"flex-1",children:e(tr,{property:r,readonly:n})})]}),s&&t("ul",{className:"ml-4 border-l border-gray-400 border-dashed",children:[(r.children||[]).map((e=>Yt(e,n))),n?null:e(rr,{parent:r})]})]})}function er(e){return e?/^[a-zA-Z0-9_]+[?]?$/.test(e)?void 0:"Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)":"Name is required"}function tr({property:t,readonly:r}){const n=A(),s=t.resetIsNew(),i=qt(t);return e(Wt,{value:i,onChange:e=>{try{e.description&&"string"!=typeof e.description&&(e.description=void 0);const r=t.getUpdateFromNameAndTypeSignature(e.name,e.type);t.update({...r,description:e.description})&&t.reloadTree()}catch(e){return n({status:"error",title:"Invalid property declaration",description:e.message,duration:9e3}),!1}return!0},onDelete:()=>{t.remove(),t.reloadTree()},editor:Lt,viewer:_t,outlineOnHover:!0,isEditing:s,skipClickOutside:Xt,readonly:r,onValidate:e=>er(e.name)})}function rr({parent:r}){return t(y,{variant:"ghost",onClick:()=>{const e=r.findAvailableChildName("new_property_");r.addChild(e,{isObject:!1,isArray:!1,isNullable:!1,name:Ot.string},!0).isNew=!0,r.reloadTree()},children:[e(T,{className:"size-4"}),"Add property"]})}function nr({content:t,...r}){const n=i(null);return a((()=>{if(!n.current)return;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return console.warn("SvgIcon: No <svg> element found in provided string"),void(n.current.innerHTML="");r&&Object.entries(r).forEach((([t,r])=>{if(null==r)return;const n="className"===t?"class":t;e.setAttribute(n,String(r))})),n.current.innerHTML="",n.current.appendChild(e)}),[t,r]),e("span",{ref:n})}function sr(t){return r=>e(nr,{content:t,...r})}function ir({onDrop:r,message:n,buttonLabel:s="Upload Files",allowFolders:a=!0,className:o=""}){const[l,c]=d(!1),h=i(null),u=i(null);return t("div",{className:`flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${l?"border-color-primary bg-color-primary/10":"border-dashed border-color-border"} ${o}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&c(!0)},onDragLeave:e=>{e.preventDefault(),u.current&&!u.current.contains(e.relatedTarget)&&c(!1)},onDrop:async e=>{if(e.preventDefault(),c(!1),e.dataTransfer.items&&e.dataTransfer.items.length>0){const t=Array.from(e.dataTransfer.items),n=[],s=new Set,i=async e=>{if(e.isFile){const t=await new Promise((t=>{e.file((r=>{Object.defineProperty(r,"webkitRelativePath",{writable:!0,value:e.fullPath.substring(1)}),t(r)}))}));!t.name.startsWith(".")&&t.size>0&&n.push(t);const r=e.fullPath.substring(1).split("/").slice(0,-1).join("/");r&&s.add(r)}else if(e.isDirectory){const t=e.createReader(),r=await new Promise((e=>{t.readEntries((t=>{e(t)}))}));await Promise.all(r.map(i));const n=e.fullPath.substring(1);n&&s.add(n)}};try{if(await Promise.all(t.map((e=>{const t=e.webkitGetAsEntry?e.webkitGetAsEntry():e;return t?i(t):Promise.resolve()}))),n.length>0){const e=new Set(Array.from(s).map((e=>e.split("/")[0])).filter(Boolean)).size,t=n.length;let i="";i=e>0?1===e?`Preparing to upload 1 folder with ${t} files...`:`Preparing to upload ${e} folders with ${t} files...`:`Preparing to upload ${t} file${1===t?"":"s"}...`,r(n,{count:n.length,message:i})}}catch(t){console.error("Error processing dropped files:",t);const n=Array.from(e.dataTransfer.files);n.length>0&&r(n)}}else if(e.dataTransfer.files&&e.dataTransfer.files.length>0){const t=Array.from(e.dataTransfer.files);r(t)}},children:[e(z,{className:"h-12 w-12 mb-3 transition-colors "+(l?"text-primary":"text-muted/50")}),e("p",{className:"text-color-muted-foreground",children:n}),t("div",{className:"mt-4 text-center",children:[t("div",{className:"text-sm text-muted mb-2",children:["Drag and drop files",a?" or folders":""," here, or"]}),t(y,{onClick:()=>{h.current&&h.current.click()},children:[e(z,{className:"h-4 w-4 mr-2"}),s]}),e("input",{type:"file",ref:h,onChange:e=>{if(e.target.files&&e.target.files.length>0){const t=Array.from(e.target.files);if(t.some((e=>e.webkitRelativePath&&e.webkitRelativePath.includes("/")))){const e=new Set(t.map((e=>e.webkitRelativePath?.split("/")[0])).filter(Boolean)).size,n=t.length,s=1===e?`Preparing to upload 1 folder with ${n} files...`:`Preparing to upload ${e} folders with ${n} files...`,i={count:t.length,message:s};r(t,i)}else{const e={count:t.length,message:`Preparing to upload ${t.length} file${1===t.length?"":"s"}...`};r(t,e)}}},multiple:!0,webkitdirectory:a?"":void 0,directory:a?"":void 0,className:"hidden"})]})]})}function ar({title:r,count:n,icon:s=e(F,{className:"h-4 w-4 text-green-500"}),items:i}){const[a,o]=d(!1);return t("div",{className:"border border-color-border rounded-md overflow-hidden",children:[t("div",{className:"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer",onClick:()=>o(!a),children:[t("div",{className:"flex items-center",children:[e("span",{className:"mr-2",children:s}),e("span",{className:"font-medium",children:r}),e("span",{className:"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs",children:n})]}),e("button",{className:"text-muted",children:e("svg",{className:"h-5 w-5 transition-transform "+(a?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a&&e("div",{className:"p-3 border-t border-color-border max-h-48 overflow-y-auto",children:i.length>0?e("ul",{className:"space-y-1",children:i.map(((t,r)=>e("li",{className:"text-sm py-1 px-2 rounded hover:bg-color-muted/10",children:t},r)))}):e("div",{className:"text-sm text-muted py-2",children:"No items to display"})})]})}function or({files:r,className:n="",location:s,collection:i}){const a=r.filter((e=>"success"===e.status)),o=r.filter((e=>"updated"===e.status)),l=r.filter((e=>"skipped"===e.status)),c=r.filter((e=>"failed"===e.status)),d=a.length,h=o.length,u=l.length,p=c.length,m=r.length;return t("div",{className:`flex flex-col py-2 ${n}`,children:[t("div",{className:"flex items-center mb-4",children:[e("div",{className:"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center",children:e(F,{className:"size-4 text-success"})}),e("div",{children:t("p",{className:"text-muted",children:[m," file",1!==m?"s":""," processed",i?` in collection '${i}'`:"",s?` in folder '${s}'`:""]})})]}),t("div",{className:"space-y-3 mt-2",children:[d>0&&e(ar,{title:"Successfully Uploaded",count:d,icon:e(F,{className:"h-4 w-4 text-green-500"}),items:a.map((e=>e.name))}),h>0&&e(ar,{title:"Successfully Updated",count:h,icon:e(F,{className:"h-4 w-4 text-blue-500"}),items:o.map((e=>e.name))}),u>0&&e(ar,{title:"Skipped (Already Existed)",count:u,icon:e(R,{className:"h-4 w-4 text-amber-500"}),items:l.map((e=>e.name))}),p>0&&e(ar,{title:"Failed to Upload",count:p,icon:e(_,{className:"h-4 w-4 text-red-500"}),items:c.map((e=>e.name))})]})]})}const lr="#text",cr="#comment",dr="#cdata",hr="DECLARATION_TAG",ur={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace"},pr=l({theme:ur,collapsible:!1,indentSize:2}),mr=()=>c(pr),fr=new he({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:cr,cdataPropName:dr,parseTagValue:!1});function gr(r){const{indentation:n,children:s,isInline:i}=r,{theme:a}=mr();return t("div",{style:{color:a.cdataColor},children:[e("span",{children:`${n}<![CDATA[`}),s,e("span",{children:`${i?"":n}]]>`})]})}function yr(t){const{collapsible:r,theme:n}=mr(),{collapsed:s}=t;return r?e("span",{style:{position:"relative"},children:e("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:e(vr,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function vr({...t}){return e("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",...t,children:e("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"})})}function br(e){const{collapsible:t,initialCollapsedDepth:r}=mr(),[n,s]=d((()=>!(le(r)||!t)&&e>=r));return a((()=>{s(!(le(r)||!t)&&e>=r)}),[r,e,t]),{collapsed:n,buttonProps:t?{onClick:()=>s((e=>!e)),role:"button",style:{cursor:"pointer"}}:{}}}function xr(r){const{indentation:n,children:s,isInline:i,level:a}=r,{theme:o}=mr(),{collapsed:l,buttonProps:c}=br(a);return t("div",{style:{color:o.commentColor},children:[t("span",{...c,children:[e("span",{children:n}),e(yr,{collapsed:l}),e("span",{children:"\x3c!-- "})]}),!l&&s,l&&"...",e("span",{children:`${i||l?" ":n}--\x3e`})]})}function wr(r){const{attributes:n}=r,{theme:s}=mr();return n?e("span",{children:Object.entries(n).map((([r,n])=>t("span",{children:[e("span",{style:{color:s.attributeKeyColor},children:` ${r}`}),e("span",{style:{color:s.separatorColor},children:"="}),e("span",{style:{color:s.attributeValueColor},children:`"${n}"`})]},`attribute-${r}`)))}):null}function Nr(r){const{indentation:n,tagKey:s,attributes:i}=r,{theme:a}=mr();return t("div",{children:[e("span",{style:{color:a.separatorColor},children:`${n}<?`}),e("span",{style:{color:a.tagColor},children:`${s.slice(1)}`}),e(wr,{attributes:i}),e("span",{style:{color:a.separatorColor},children:"?>"})]})}function kr(e){return"string"==typeof e&&e.includes("\n")}function Cr(e){const t=e[":@"],r=ce(e,":@"),[[n,s]]=Object.entries(r),i=function(e){switch(e){case lr:case dr:case cr:return e;default:return e.startsWith("?")?hr:"TAG"}}(n);return{attributes:t,tagKey:n,subElements:s,type:i}}function jr(e){return!!e&&Object.keys(e).length>0}function Sr(n){const{indentation:s,tagKey:i,attributes:a,children:o,isInline:l,hasChildren:c,level:d}=n,{collapsed:h,buttonProps:u}=br(d),{theme:p}=mr();return t("div",{children:[t("span",{...u,children:[e("span",{children:s}),e(yr,{collapsed:h}),e("span",{style:{color:p.separatorColor},children:"<"}),e("span",{style:{color:p.tagColor},children:`${i}`}),!h&&e(wr,{attributes:a}),h&&jr(a)&&" ...",e("span",{style:{color:p.separatorColor},children:c?">":" />"})]}),c&&t(r,{children:[!h&&o,h&&"...",e("span",{style:{color:p.separatorColor},children:`${l||h?"":s}</`}),e("span",{style:{color:p.tagColor},children:`${i}`}),e("span",{style:{color:p.separatorColor},children:">"})]})]})}function Or(t){const{hasSiblings:r,text:n,indentation:s,isText:i}=t,{theme:a}=mr(),o=i?{color:a.textColor}:void 0;return kr(n)||r?e("div",{style:o,children:n.split("\n").filter((e=>!!e.trim())).map(((t,r)=>e("div",{children:`${s}${t.trim()}`},`${r}`)))}):e("span",{style:o,children:n})}function Ar(t){const{elements:n,level:s=0,isText:i=!0}=t,{indentSize:a}=mr();return Array.isArray(n)&&0!==n.length?e(r,{children:n.map(((t,r)=>{const{tagKey:o,attributes:l,subElements:c,type:d}=Cr(t),h=n.length>1,u=function(e,t){return new Array(t*e+1).join(" ")}(a,s),p=`${s}-${r}`,m=function(e){return"string"!=typeof e&&1===e.length&&lr in e[0]&&!kr(e[0][lr])}(c);switch(d){case lr:return e(Or,{text:c,indentation:u,hasSiblings:h,isText:i},p);case cr:return e(xr,{isInline:m,indentation:u,level:s,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case dr:return e(gr,{indentation:u,isInline:m,children:e(Ar,{elements:c,level:s+1,isText:!1})},p);case hr:return e(Nr,{indentation:u,tagKey:o,attributes:l},p);default:return e(Sr,{indentation:u,tagKey:o,attributes:l,isInline:m,hasChildren:c.length>0,level:s,children:e(Ar,{elements:c,level:s+1})},p)}}))}):null}function Pr(){return e("div",{children:"Invalid XML!"})}function $r(t){const{theme:r,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:l,initalCollapsedDepth:c,initialCollapsedDepth:h}=t,[u,p]=d((()=>({...ur,...r}))),{json:m,valid:f}=function(e){return o((()=>{try{if(!ue.validate(e))throw new Error("Invalid XML!");const t=fr.parse(e);if("string"==typeof e&&e.trim().length>0&&0===t.length)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(e){return{json:null,valid:!1,errorMessage:`Fail to parse: ${e.message}`}}}),[e])}(n),g=o((()=>({theme:u,collapsible:s,indentSize:i,initialCollapsedDepth:h??c})),[u,s,i,c,h]);return a((()=>{p((e=>{const t={...ur,...r};return de(t,e)?e:t}))}),[r]),f?e(pr.Provider,{value:g,children:e("div",{className:"rxv-container",style:{whiteSpace:"pre-wrap",fontFamily:u.fontFamily,overflowWrap:"break-word"},children:e(Ar,{elements:m})})}):l||e(Pr,{})}export{Me as ArrayPropertySchema,ge as CodeMirrorEditor,ir as DropZone,me as EditorApi,ve as FieldSetContextProvider,je as Form,xe as FormContext,ke as FormContextProvider,Ge as FormError,He as FormHelper,We as FormLabel,Oe as GeneratedForm,Ce as Input,nt as JSONCode,ut as JSONDisplay,st as JSONView,Ke as ManageObjectEntry,Ue as ManagedListProperty,Re as ManagedObject,Fe as ManagedObjectBase,_e as ManagedObjectProperty,Ve as ManagedProperty,Be as ManagedScalarEntry,Et as ManagedSchema,mt as MarkdownRenderer,ze as Node,wt as Popover,ft as PopoverContext,jt as Progress,St as PropertiesView,Lt as PropertyEditor,Dt as PropertyNameEditor,qe as PropertySchema,_t as PropertyViewer,Pe as ScalarField,Ie as Schema,Zt as SchemaEditor,It as SchemaNode,nr as SvgIcon,ar as UploadResultCategory,or as UploadSummary,$r as XMLViewer,Le as computeTitleFromName,sr as createSvgIcon,qt as getEditableSchemaProperty,be as useFieldSet,Ne as useForm,gt as usePopoverContext,Vt as useSchema,er as validatePropertyName};
|
|
2
2
|
//# sourceMappingURL=vertesia-ui-widgets.js.map
|