import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import React from "react";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { MosaicContext, MosaicWindowContext } from "react-mosaic-component";
import CssBaseline from "@foxglove/studio-base/components/CssBaseline";
import ErrorBoundary from "@foxglove/studio-base/components/ErrorBoundary";
import GlobalCss from "@foxglove/studio-base/components/GlobalCss";
import { useMessagePipeline } from "@foxglove/studio-base/components/MessagePipeline";
import AppConfigurationContext from "@foxglove/studio-base/context/AppConfigurationContext";
import PanelCatalogContext from "@foxglove/studio-base/context/PanelCatalogContext";
import CurrentLayoutProvider from "@foxglove/studio-base/providers/CurrentLayoutProvider";
import EventsProvider from "@foxglove/studio-base/providers/EventsProvider";
import { PanelStateContextProvider } from "@foxglove/studio-base/providers/PanelStateContextProvider";
import TimelineInteractionStateProvider from "@foxglove/studio-base/providers/TimelineInteractionStateProvider";
import WorkspaceContextProvider from "@foxglove/studio-base/providers/WorkspaceContextProvider";
import { ConnectionsProvider } from "./ConnectionsProvider.js";
import { MessagePipelineProvider } from "./MessagePipelineProvider";
export function useSourceProblems() {
    return useMessagePipeline((ctx) => ctx.playerState.problems ?? []);
}
export const VisualizerContext = React.memo(function VisualizerContext({ children, connections, }) {
    // eslint-disable-next-line no-warning-comments
    // TODO(milan.medvec) improve it
    const appConfiguration = {
        get() { },
        set: async () => {
            await Promise.resolve();
        },
        addChangeListener: () => { },
        removeChangeListener: () => { },
    };
    // eslint-disable-next-line no-warning-comments
    // TODO(milan.medvec) improve it
    const actions = {
        updateTree: () => { },
        remove: (_path) => { },
        expand: (_path, _percentage) => { },
        getRoot: () => { },
        hide: (_path) => { },
        replaceWith: (_path, _newNode) => { }
    };
    // eslint-disable-next-line no-warning-comments
    // TODO(milan.medvec) improve it
    const mosaicContext = {
        mosaicActions: actions,
        mosaicId: "mosaicId",
        blueprintNamespace: "blueprintNamespace",
    };
    // eslint-disable-next-line no-warning-comments
    // TODO(milan.medvec) improve it
    const mosaicWindowContext = {
        blueprintNamespace: "blueprintNamespace",
        mosaicWindowActions: {
            split: async (..._args) => { },
            replaceWithNew: async (..._args) => { },
            setAdditionalControlsOpen: (_open) => { },
            getPath: () => {
                return [];
            },
            connectDragSource: (_connectedElements) => {
                return null;
            },
        },
    };
    // eslint-disable-next-line no-warning-comments
    // TODO(milan.medvec) improve it
    const panelCatalog = {
        getPanels() {
            return [];
        },
        getPanelByType(_type) {
            return undefined;
        },
    };
    // TODO: Simplify
    return (_jsx(AppConfigurationContext.Provider, { value: appConfiguration, children: _jsx(DndProvider, { backend: HTML5Backend, children: _jsxs(WorkspaceContextProvider, { children: [_jsx(GlobalCss, {}), _jsx(CssBaseline, { children: _jsx(ErrorBoundary, { children: _jsx(TimelineInteractionStateProvider, { children: _jsx(CurrentLayoutProvider, { children: _jsx(ConnectionsProvider, { value: connections, children: _jsx(MessagePipelineProvider, { children: _jsx(EventsProvider, { children: _jsx(MosaicContext.Provider, { value: mosaicContext, children: _jsx(MosaicWindowContext.Provider, { value: mosaicWindowContext, children: _jsx(PanelCatalogContext.Provider, { value: panelCatalog, children: _jsx(PanelStateContextProvider, { children: children }) }) }) }) }) }) }) }) }) }) })] }) }) }));
});
//# sourceMappingURL=VisualizerContext.js.map