Liferay.Loader.define("knowledge-base-web@5.0.75/admin/js/components/VerticalBar",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/core","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./NavigationPanel","./SuggestionsPanel","./TemplatesPanel"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a("@frontend-taglib-clay$clayui/button"),r=a("@frontend-taglib-clay$clayui/core"),i=a("frontend-js-web"),l=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=n?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(a,r,i):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),o=_interopRequireDefault(a("./NavigationPanel")),c=_interopRequireDefault(a("./SuggestionsPanel")),d=_interopRequireDefault(a("./TemplatesPanel"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e="expanded",u="suggestion";var _default=({items:t,moveKBObjectURL:a,parentContainerId:s,portletNamespace:f,productMenuOpen:p})=>{var y;const g=document.getElementById(s),[m,v]=(0,l.useState)(p),[b,j]=(0,l.useState)(null===(y=t.find((({active:e})=>e)))||void 0===y?void 0:y.key),[_,w]=(0,l.useState)(!p&&b!==u),h=Liferay.SideNavigation.instance(document.querySelector(".product-menu-toggle"));(0,l.useEffect)((()=>{if(h&&b!==u)return h.on("openStart.lexicon.sidenav",(()=>{v(!0),w(!1)})),h.on("closedStart.lexicon.sidenav",(()=>{v(!1)})),()=>{h.destroy()}}),[b,h]),(0,l.useEffect)((()=>{g.classList.toggle(e,Boolean(b!==u&&_&&b)),b===u&&g.classList.add("not-expandable")}),[b,g,_]);const B={article:o.default,suggestion:c.default,template:d.default};return l.default.createElement(r.VerticalBar,{absolute:!0,active:_&&b?b:null,onActiveChange:e=>{if(w(e!==u&&(t=>Boolean(e)&&!(e===b&&t))),e){if(e!==b){var a;j(e);const n=null===(a=t.find((({key:t})=>t===e)))||void 0===a?void 0:a.href;if(m&&e!==u){const e=h.on("closed.lexicon.sidenav",(()=>{e.removeListener(),(0,i.navigate)(n)}))}else(0,i.navigate)(n)}m&&e!==u&&h.hide()}},position:"left"},l.default.createElement(r.VerticalBar.Bar,{displayType:"light",items:t},(e=>l.default.createElement(r.VerticalBar.Item,{key:e.key},l.default.createElement(n.ClayButtonWithIcon,{"aria-label":Liferay.Language.get(e.title),"data-tooltip-align":"right",displayType:"unstyled",symbol:e.icon,title:Liferay.Language.get(e.title)})))),l.default.createElement(r.VerticalBar.Content,{items:t},(e=>{const t=B[e.key];return l.default.createElement(r.VerticalBar.Panel,{key:e.key},l.default.createElement("div",{className:"sidebar-header"},l.default.createElement("div",{className:"component-title"},e.title)),l.default.createElement("div",{className:"sidebar-body"},l.default.createElement(t,{items:e.navigationItems,moveKBObjectURL:a,portletNamespace:f,selectedItemId:e.selectedItemId})))})))};t.default=_default}}));
//# sourceMappingURL=VerticalBar.js.map