var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SidebarRecursive=exports.LayoutSidebar=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _Breadcrumbs=require("../Breadcrumbs");var _Sidebar=require("../Sidebar");var _LayoutContext=require("./LayoutContext");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["fluidLayout"];function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){(0,_defineProperty2.default)(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}var SidebarRecursive=function SidebarRecursive(_ref){var sidebarItem=_ref.sidebarItem,version=_ref.version,Link=_ref.Link,router=_ref.router,leftIndent=_ref.leftIndent,onPressClose=_ref.onPressClose;if((sidebarItem==null?void 0:sidebarItem.type)==='heading'){var _sidebarItem$pages;return(0,_jsxRuntime.jsxs)(_Sidebar.Sidebar.Group,{ml:`$${leftIndent}`,mb:36,children:[(0,_jsxRuntime.jsx)(_Sidebar.Sidebar.GroupHeader,{children:sidebarItem.title}),sidebarItem==null?void 0:(_sidebarItem$pages=sidebarItem.pages)==null?void 0:_sidebarItem$pages.map(function(sidebarPageItems){return(0,_jsxRuntime.jsx)(SidebarRecursive,{sidebarItem:sidebarPageItems,version:version,Link:Link,router:router,leftIndent:leftIndent+2,onPressClose:onPressClose});})]},sidebarItem.title);}return(0,_jsxRuntime.jsx)(SidebarNodeItem,{sidebarItem:sidebarItem,Link:Link,router:router,onPressClose:onPressClose});};exports.SidebarRecursive=SidebarRecursive;var SidebarNodeItem=function SidebarNodeItem(_ref2){var _sidebarItem$metaData;var sidebarItem=_ref2.sidebarItem,Link=_ref2.Link,router=_ref2.router,onPressClose=_ref2.onPressClose;var sidebarItemTag=sidebarItem==null?void 0:(_sidebarItem$metaData=sidebarItem.metaData)==null?void 0:_sidebarItem$metaData.tag;var isActiveRoute=(router==null?void 0:router.route)===sidebarItem.id;return(0,_jsxRuntime.jsx)(_Sidebar.Sidebar.GroupItem,{sx:{bg:isActiveRoute?'$primary100_alpha_50':'transparent',_light:{':hover':{bg:'$primary100_alpha_30'}},_dark:{'bg':isActiveRoute?'$primary600_alpha_50':undefined,':hover':{bg:'$primary600_alpha_30'}}},onPress:onPressClose,focusable:false,children:(0,_jsxRuntime.jsx)(Link,{href:`${sidebarItem.id}`,passHref:true,style:{width:'100%',height:'100%',textDecoration:'none'},children:(0,_jsxRuntime.jsxs)(_Sidebar.Sidebar.GroupItemContent,{children:[(0,_jsxRuntime.jsx)(_Sidebar.Sidebar.GroupItemText,{children:sidebarItem.title}),sidebarItemTag&&(0,_jsxRuntime.jsx)(_Sidebar.Sidebar.GroupItemTag,{variant:sidebarItemTag,children:(0,_jsxRuntime.jsx)(_Sidebar.Sidebar.GroupItemTagText,{children:sidebarItemTag})})]})})},sidebarItem.title);};var LayoutSidebar=function LayoutSidebar(_ref3){var fluidLayout=_ref3.fluidLayout,props=(0,_objectWithoutProperties2.default)(_ref3,_excluded);var _React$useContext=_react.default.useContext(_LayoutContext.LayoutContext),sidebars=_React$useContext.sidebarItems,version=_React$useContext.version,Link=_React$useContext.Link,router=_React$useContext.router;var _React$useState=_react.default.useState(false),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),hover=_React$useState2[0],setHover=_React$useState2[1];return(0,_jsxRuntime.jsxs)(_Sidebar.Sidebar,_objectSpread(_objectSpread({position:"fixed",w:"250px",pr:"$3"},props),{},{borderColor:"$borderLight200",borderRightWidth:1,sx:{'zIndex':1,'@lg':{pl:fluidLayout?'$1':'$1'},'@xl':{pl:fluidLayout?'$1':'$1'},'_dark':{borderColor:'$borderDark800'}},pt:24,style:{overflowY:hover?'scroll':'hidden',scrollbarGutter:'stable',height:'94vh'},onMouseOver:function onMouseOver(){if(!hover){setHover(true);}},onMouseLeave:function onMouseLeave(){setHover(false);},children:[(0,_jsxRuntime.jsx)(_Breadcrumbs.Breadcrumbs,{}),sidebars==null?void 0:sidebars.map(function(sidebarItems){return(0,_jsxRuntime.jsx)(SidebarRecursive,{sidebarItem:sidebarItems,version:version,Link:Link,router:router,leftIndent:0});})]}));};exports.LayoutSidebar=LayoutSidebar;
//# sourceMappingURL=LayoutSidebar.js.map