"use strict";
// The require scope
var __webpack_require__ = {};
/************************************************************************/ // webpack/runtime/compat_get_default_export
(()=>{
    // getDefaultExport function for compatibility with non-ESM modules
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
// webpack/runtime/define_property_getters
(()=>{
    __webpack_require__.d = function(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/runtime/has_own_property
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
// webpack/runtime/make_namespace_object
(()=>{
    // define __esModule on exports
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
/************************************************************************/ var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
    default: ()=>/* binding */ Sidebar_rslib_entry_
});
const external_react_namespaceObject = require("react");
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
const react_namespaceObject = require("@chakra-ui/react");
const bs_namespaceObject = require("react-icons/bs");
const external_react_router_dom_namespaceObject = require("react-router-dom");
const Logo_js_namespaceObject = require("../Logo/Logo.js");
var Logo_js_default = /*#__PURE__*/ __webpack_require__.n(Logo_js_namespaceObject);
const Nav_js_namespaceObject = require("../Nav/Nav.js");
var Nav_js_default = /*#__PURE__*/ __webpack_require__.n(Nav_js_namespaceObject);
const useLocalStorage_js_namespaceObject = require("../../hooks/useLocalStorage.js");
var useLocalStorage_js_default = /*#__PURE__*/ __webpack_require__.n(useLocalStorage_js_namespaceObject);
function Sidebar({ previousItem, items = [], groups = [], footerItems = [], isCollapsible = true, isCollapsed: initialIsCollapsed = false, logoOverrides, status, children, footerChildren }) {
    const bg = (0, react_namespaceObject.useColorModeValue)('darkblue.800', 'gray.700');
    const [isCollapsed, setIsCollapsed] = useLocalStorage_js_default()('isNavCollapsed', initialIsCollapsed);
    const renderLogo = /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Link, {
        as: external_react_router_dom_namespaceObject.Link,
        to: "/"
    }, /*#__PURE__*/ external_react_default().createElement(Logo_js_default(), {
        alt: "Redpanda Cloud",
        height: 20,
        isCollapsed: isCollapsed,
        overrides: logoOverrides
    }));
    const padding = 3;
    return /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        as: "aside",
        p: padding,
        bg: bg,
        boxShadow: "xl",
        zIndex: 2,
        position: "sticky",
        top: "0",
        height: "100vh",
        width: isCollapsed ? '58px' : '200px'
    }, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        mt: 3.5,
        ml: 3
    }, isCollapsed ? /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Tooltip, {
        label: "Home",
        placement: "right",
        hasArrow: true
    }, renderLogo) : renderLogo), items.length > 0 && /*#__PURE__*/ external_react_default().createElement(Nav_js_default(), {
        status: status,
        items: previousItem ? [
            {
                ...previousItem,
                isPrevious: true
            },
            ...items
        ] : items,
        isCollapsed: isCollapsed
    }), groups.length > 0 && groups.map(({ heading, items }, i)=>/*#__PURE__*/ external_react_default().createElement(Nav_js_default(), {
            status: status,
            key: i,
            heading: heading,
            items: 0 === i && previousItem ? [
                {
                    ...previousItem,
                    isPrevious: true
                },
                ...items
            ] : items,
            isCollapsed: isCollapsed
        })), children, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        position: "absolute",
        bottom: 0,
        left: "0",
        right: "0",
        padding: padding
    }, !isCollapsed && /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        left: "auto",
        right: "auto",
        margin: "auto",
        padding: padding
    }, footerChildren), /*#__PURE__*/ external_react_default().createElement(Nav_js_default(), {
        isCollapsed: isCollapsed,
        status: status,
        items: [
            ...footerItems,
            ...isCollapsible ? [
                {
                    to: 'toggle-sidebar',
                    title: isCollapsed ? 'Expand sidebar' : 'Collapse sidebar',
                    icon: isCollapsed ? bs_namespaceObject.BsChevronDoubleRight : bs_namespaceObject.BsChevronDoubleLeft,
                    isIconOnly: false,
                    status: 'success',
                    // Note: using 'any' because chakra event omits preventDefault in their type.
                    onClick: (e)=>{
                        e.preventDefault();
                        setIsCollapsed(!isCollapsed);
                    }
                }
            ] : []
        ]
    })));
}
/* ESM default export */ const Sidebar_rslib_entry_ = Sidebar;
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
