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