Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/app-hooks/useProductMenuHandler",["module","exports","require","liferay!frontend-js-react-web$react","../../actions/index","../../contexts/StoreContext","../../selectors/selectSidebarIsOpened","../../utils/hideProductMenuIfPresent"],(function(e,n,t){window;{Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){const e=(0,i.useDispatch)(),n=(0,o.useRef)(!0),t=(0,i.useSelector)(d.default),s=(0,i.useSelector)((e=>e.sidebar.hidden));(0,o.useEffect)((()=>{(0,a.default)({onHide:()=>{e((0,r.switchSidebarPanel)({sidebarOpen:!0}))}})}),[e]),(0,o.useEffect)((()=>{var o;const i=null===(o=Liferay.SideNavigation)||void 0===o?void 0:o.instance(document.querySelector(".product-menu-toggle")),d=({open:o})=>{s||(o?(n.current=t,e((0,r.switchSidebarPanel)({itemConfigurationOpen:!1,sidebarOpen:!1}))):e((0,r.switchSidebarPanel)({itemConfigurationOpen:!0,sidebarOpen:n.current})))},a=null==i?void 0:i.on("closed.lexicon.sidenav",(()=>d({open:!1}))),u=null==i?void 0:i.on("openStart.lexicon.sidenav",(()=>d({open:!0})));return()=>{null==a||a.removeListener(),null==u||u.removeListener()}}),[e,t,s])};var o=t("liferay!frontend-js-react-web$react"),r=t("../../actions/index"),i=t("../../contexts/StoreContext"),d=s(t("../../selectors/selectSidebarIsOpened")),a=s(t("../../utils/hideProductMenuIfPresent"));function s(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=useProductMenuHandler.js.map