import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { observer } from 'mobx-react-lite';
import { EXECUTION_PLAN_VIEW_MODE, } from '../../stores/execution-plan/ExecutionPlanState.js';
import { PanelListItem, PanelDivider, Button, PanelContent, } from '@finos/legend-art';
import { ResultTypeViewer } from './ResultTypeViewer.js';
import { isPlainObject } from '@finos/legend-shared';
export const ConstantExecutionNodeViewer = observer((props) => {
    const { cnode, executionPlanState } = props;
    const resultType = cnode.resultType;
    let value = '';
    const applicationStore = executionPlanState.applicationStore;
    try {
        value = (isPlainObject(cnode.values) ? cnode.values.value : '');
    }
    catch {
        // do nothing
    }
    return (_jsxs(PanelContent, { darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled, children: [value !== '' && (_jsx("div", { className: "query-builder__constant__container", children: _jsxs("div", { children: [_jsx(PanelListItem, { className: "query-builder__constant__container__item__label", children: "Constant Execution Node Details" }), _jsx(PanelDivider, {}), _jsx("pre", { children: _jsx("div", { className: "query-builder__constant__container__item", children: _jsxs("div", { children: ["value: ", value] }) }) })] }) })), _jsx(PanelDivider, {}), _jsx(ResultTypeViewer, { resultType: resultType }), _jsx("div", { className: "query-builder__constant__container", children: _jsx(Button, { className: "btn--dark execution-node-viewer__unsupported-view__to-text-mode__btn", onClick: () => executionPlanState.setViewMode(EXECUTION_PLAN_VIEW_MODE.JSON), text: "View JSON" }) }), _jsx(PanelDivider, {})] }));
});
//# sourceMappingURL=ConstantExecutionNodeViewer.js.map