"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    NodePropertyPanel: ()=>NodePropertyPanel
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
const external_lucide_react_namespaceObject = require("lucide-react");
const external_react_namespaceObject = require("react");
const SURFACE_REMAP = {
    '--surface-raised': 'var(--surface-overlay)'
};
function NodePropertyPanel({ panelTitle, onClose, nodeIcon, nodeLabel, nodeCategory, action, schema, plugins, onSubmit, disabled, resetKey, className, contentInset = '1.5rem', children, headerExtra }) {
    const hasNodeHeader = !!(nodeLabel || nodeCategory || nodeIcon || action);
    const formSchema = (0, external_react_namespaceObject.useMemo)(()=>schema && void 0 === schema.actions ? {
            ...schema,
            actions: []
        } : schema, [
        schema
    ]);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        className: (0, apollo_wind_namespaceObject.cn)('flex min-h-0 flex-col bg-surface-raised', className),
        style: {
            '--mf-content-inset': contentInset
        },
        children: [
            panelTitle && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                className: "flex h-10 shrink-0 items-center justify-between px-2",
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                        className: "flex items-center gap-1",
                        children: [
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                                className: "grid size-8 place-items-center text-foreground-subtle",
                                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.GripVertical, {
                                    size: 14
                                })
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                                className: "text-sm font-semibold text-foreground",
                                children: panelTitle
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                        className: "flex items-center gap-1",
                        children: [
                            headerExtra,
                            onClose && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
                                type: "button",
                                onClick: onClose,
                                title: "Close",
                                "aria-label": "Close",
                                className: "grid size-6 place-items-center rounded text-foreground-muted transition hover:bg-surface-overlay hover:text-foreground",
                                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
                                    size: 14
                                })
                            })
                        ]
                    })
                ]
            }),
            hasNodeHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                className: "flex shrink-0 items-center justify-between gap-4 py-4 [padding-inline:var(--mf-content-inset,1.5rem)]",
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                        className: "flex min-w-0 flex-1 items-center gap-3.5",
                        children: [
                            nodeIcon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                                className: "grid size-11 shrink-0 place-items-center rounded-xl bg-surface-overlay text-foreground-subtle [&>svg]:size-5",
                                children: nodeIcon
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                                className: "flex min-w-0 flex-1 flex-col justify-center",
                                children: [
                                    nodeLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                                        className: "block truncate text-base font-semibold leading-5 tracking-[-0.3px] text-foreground",
                                        children: nodeLabel
                                    }),
                                    nodeCategory && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                                        className: "block truncate text-xs leading-4 text-foreground-muted",
                                        children: nodeCategory
                                    })
                                ]
                            })
                        ]
                    }),
                    action && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                        className: "flex shrink-0 items-center gap-2",
                        children: action
                    })
                ]
            }),
            children ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                className: "min-h-0 flex-1 overflow-auto",
                style: SURFACE_REMAP,
                children: children
            }) : formSchema ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                className: "min-h-0 flex-1 overflow-auto",
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                    style: SURFACE_REMAP,
                    className: "[&_label]:text-foreground-muted",
                    children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.MetadataForm, {
                        schema: formSchema,
                        plugins: plugins,
                        stepVariant: "tabs",
                        onSubmit: onSubmit,
                        disabled: disabled,
                        className: "flex flex-col gap-4 pb-6 pt-3 [padding-inline:var(--mf-content-inset)]"
                    }, resetKey)
                })
            }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                className: "py-4 text-xs text-foreground-subtle [padding-inline:var(--mf-content-inset,1.5rem)]",
                children: "No form schema defined for this node."
            })
        ]
    });
}
exports.NodePropertyPanel = __webpack_exports__.NodePropertyPanel;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "NodePropertyPanel"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
