"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __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__, {
    NestedValue: ()=>NestedValue
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const KeyboardArrowRight_namespaceObject = require("@mui/icons-material/KeyboardArrowRight");
var KeyboardArrowRight_default = /*#__PURE__*/ __webpack_require__.n(KeyboardArrowRight_namespaceObject);
const material_namespaceObject = require("@mui/material");
const apollo_core_namespaceObject = require("@uipath/apollo-core");
var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
const external_react_namespaceObject = require("react");
const SectionArrowIcon = (0, material_namespaceObject.styled)(KeyboardArrowRight_default(), {
    shouldForwardProp: (prop)=>'expanded' !== prop
})(({ expanded })=>({
        marginRight: apollo_core_default().Spacing.SpacingXs,
        transition: 'transform 0.2s ease',
        cursor: 'pointer',
        transform: expanded ? 'rotate(90deg)' : 'none',
        width: apollo_core_default().FontFamily.FontMSize,
        height: apollo_core_default().FontFamily.FontMSize
    }));
const Value = (0, material_namespaceObject.styled)('span')({
    color: 'var(--color-foreground-de-emp)',
    flex: 1
});
const NestedObjectContainer = (0, material_namespaceObject.styled)('div')({
    paddingLeft: apollo_core_default().Spacing.SpacingXs
});
const ExpandButton = (0, material_namespaceObject.styled)('button')({
    background: 'none',
    border: 'none',
    padding: 0,
    color: 'var(--color-foreground-de-emp)',
    cursor: 'pointer',
    display: 'flex',
    alignItems: 'center',
    fontSize: 'inherit',
    fontFamily: 'inherit',
    '&:hover': {
        color: 'var(--color-foreground)'
    },
    '&:focus-visible': {
        outline: `${apollo_core_default().Border.BorderThickS} solid var(--color-focus-indicator)`
    }
});
const KeyValuePair = (0, material_namespaceObject.styled)('div')({
    display: 'flex',
    marginBottom: apollo_core_default().Spacing.SpacingMicro,
    fontSize: apollo_core_default().FontFamily.FontSSize,
    '&:last-child': {
        marginBottom: 0
    }
});
const Key = (0, material_namespaceObject.styled)('span')({
    fontWeight: apollo_core_default().FontFamily.FontWeightMedium,
    marginBottom: apollo_core_default().Spacing.SpacingXs,
    marginRight: apollo_core_default().Spacing.SpacingXs,
    minWidth: 'max-content'
});
const NestedValue = ({ value, depth = 0 })=>{
    const [isExpanded, setIsExpanded] = (0, external_react_namespaceObject.useState)(false);
    if (null === value) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Value, {
        children: "null"
    });
    if ('object' != typeof value) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Value, {
        children: String(value)
    });
    if (Array.isArray(value)) {
        if (0 === value.length) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Value, {
            children: "[]"
        });
        return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Value, {
            children: [
                /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(ExpandButton, {
                    onClick: ()=>setIsExpanded(!isExpanded),
                    children: [
                        /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SectionArrowIcon, {
                            fontSize: "small",
                            expanded: isExpanded
                        }),
                        "Array[",
                        value.length,
                        "]"
                    ]
                }),
                isExpanded && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NestedObjectContainer, {
                    children: value.map((item, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(KeyValuePair, {
                            children: [
                                /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Key, {
                                    children: [
                                        "[",
                                        index,
                                        "]:"
                                    ]
                                }),
                                /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NestedValue, {
                                    value: item,
                                    depth: depth + 1
                                })
                            ]
                        }, index))
                })
            ]
        });
    }
    const entries = Object.entries(value);
    if (0 === entries.length) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Value, {
        children: '{}'
    });
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Value, {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(ExpandButton, {
                onClick: ()=>setIsExpanded(!isExpanded),
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SectionArrowIcon, {
                        fontSize: "small",
                        expanded: isExpanded
                    }),
                    '{...}'
                ]
            }),
            isExpanded && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NestedObjectContainer, {
                children: entries.map(([key, val])=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(KeyValuePair, {
                        children: [
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(Key, {
                                children: [
                                    key,
                                    ":"
                                ]
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NestedValue, {
                                value: val,
                                depth: depth + 1
                            })
                        ]
                    }, key))
            })
        ]
    });
};
exports.NestedValue = __webpack_exports__.NestedValue;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "NestedValue"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
