Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/components/sidebar/MultiPanelSidebar.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/loading-indicator","@frontend-taglib-clay$clayui/tooltip","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../hooks/useLoad.es","./MultiPanelSidebar.scss"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({createPlugin:t,currentPanelId:a,onChange:u,open:f,panels:b,sidebarPanels:y,variant:g="dark"}){const[h,P]=(0,o.useStateSafe)(!1),E=(0,o.useIsMounted)(),v=(0,s.default)(),j=(0,c.useRef)(y),[I,k]=(0,c.useState)([]);(0,c.useEffect)((()=>{const e=Object.values(j.current).map((e=>v(e.sidebarPanelId,e.pluginEntryPoint).then((a=>{const n=new a(t({panel:e,sidebarOpen:!0,sidebarPanelId:e.sidebarPanelId}),e);return{Component:()=>n.renderSidebar(),sidebarPanelId:e.sidebarPanelId}})).catch((e=>console.error(e)))));k([]),Promise.all(e).then((e=>{E()&&k(e)}))}),[E,v]),(0,c.useEffect)((()=>{const e=Liferay.SideNavigation.instance(document.querySelector(".product-menu-toggle"));if(e){f&&e.hide();const t=e.on("openStart.lexicon.sidenav",(()=>u({sidebarOpen:!1})));return()=>t.removeListener()}}),[u,f]);return c.default.createElement(i.ClayTooltipProvider,null,c.default.createElement("div",{className:(0,d.default)("multi-panel-sidebar","multi-panel-sidebar-".concat(g),{"menu-indicator-enabled":document.querySelector(e.join(","))})},c.default.createElement("nav",{className:(0,d.default)("multi-panel-sidebar-buttons","tbar","tbar-stacked","dark"===g?"tbar-".concat(g,"-d1"):"tbar-".concat(g))},c.default.createElement("ul",{className:"tbar-nav"},b.reduce(((e,t,l)=>{const i=t.map((e=>{const t=y[e],l=f&&a===e,{icon:i,isLink:o,label:s,pluginEntryPoint:b,url:m}=t,g=()=>v(t.sidebarPanelId,b).then(...p),h=(0,d.default)("tbar-btn tbar-btn-monospaced",{active:l});return c.default.createElement("li",{className:(0,d.default)("tbar-item","tbar-item--".concat(t.sidebarPanelId)),key:t.sidebarPanelId},o?c.default.createElement("a",{className:h,href:m},c.default.createElement(r.default,{symbol:i})):c.default.createElement(n.ClayButtonWithIcon,{"aria-pressed":l,className:h,"data-tooltip-align":"left",displayType:"unstyled",id:t.sidebarPanelId,onClick:()=>(({sidebarPanelId:e})=>u({sidebarOpen:e!==a||!f,sidebarPanelId:e}))(t),onFocus:g,onMouseEnter:g,symbol:i,title:s}))}));return l===b.length-1?e.concat(i):e.concat([...i,c.default.createElement("hr",{key:"separator-".concat(l)})])}),[]))),c.default.createElement("div",{className:(0,d.default)("multi-panel-sidebar-content",{"multi-panel-sidebar-content-open":f})},h?c.default.createElement("div",null,c.default.createElement(n.default,{block:!0,displayType:"secondary",onClick:()=>{u({sidebarOpen:!1}),P(!1)},small:!0},Liferay.Language.get("refresh"))):c.default.createElement(m,{handleError:()=>{P(!0)}},0===I.length&&c.default.createElement(l.default,null),I.map((e=>c.default.createElement("div",{className:(0,d.default)({"d-none":e.sidebarPanelId!==a}),key:e.sidebarPanelId},c.default.createElement(e.Component,null))))))))};var n=b(a("@frontend-taglib-clay$clayui/button")),r=u(a("@frontend-taglib-clay$clayui/icon")),l=u(a("@frontend-taglib-clay$clayui/loading-indicator")),i=a("@frontend-taglib-clay$clayui/tooltip"),o=a("@liferay/frontend-js-react-web"),d=u(a("liferay!frontend-js-react-web$classnames")),c=b(a("liferay!frontend-js-react-web$react")),s=u(a("../../hooks/useLoad.es"));function u(e){return e&&e.__esModule?e:{default:e}}function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function b(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();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 l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}a("./MultiPanelSidebar.scss");const e=[".change-tracking-indicator",".staging-indicator"],p=[e=>e,e=>{}];class m extends c.default.Component{static getDerivedStateFromError(e){return{hasError:!0}}constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e){this.props.handleError&&this.props.handleError(e)}render(){return this.state.hasError?null:this.props.children}}}}));
//# sourceMappingURL=MultiPanelSidebar.es.js.map