Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/app/hooks/app_hooks/useURLParser",["module","exports","require","frontend-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../../actions/switchSidebarPanel","../../config/constants/highlightedCommentIdKey","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getFragmentItem"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function useURLParser(){const e=(0,c.useSelector)((e=>e.fragmentEntryLinks)),[,t]=(0,a.useSessionState)(i.HIGHLIGHTED_COMMENT_ID_KEY,void 0,s.COOKIE_TYPES.NECESSARY),n=(0,c.useSelector)((e=>e.layoutData)),m=(0,c.useDispatch)(),u=(0,d.useSelectItem)(),f=(0,r.useCallback)((t=>{const{fragmentEntryLinkId:a}=Object.values(e).find((e=>e.comments.find((e=>e.commentId===t||e.children.find((e=>e.commentId===t))))))||{fragmentEntryLinkId:null},{itemId:s}=(0,l.default)(n,a)||{};s&&(u(s),m((0,o.default)({sidebarOpen:!0,sidebarPanelId:"comments"})))}),[m,e,n,u]);(0,r.useEffect)((()=>{const e=new URL(window.location.href);e.searchParams.has("messageId")&&(t(e.searchParams.get("messageId")),f(e.searchParams.get("messageId")),e.searchParams.delete("messageId"),history.replaceState(null,document.head.title,e.href)),e.searchParams.has("itemId")&&(u(e.searchParams.get("itemId")),e.searchParams.delete("itemId"),history.replaceState(null,document.head.title,e.href))}),[f,t,u])};var a=n("frontend-js-components-web"),s=n("frontend-js-web"),r=n("liferay!frontend-js-react-web$react"),o=_interopRequireDefault(n("../../actions/switchSidebarPanel")),i=n("../../config/constants/highlightedCommentIdKey"),d=n("../../contexts/ControlsContext"),c=n("../../contexts/StoreContext"),l=_interopRequireDefault(n("../../utils/getFragmentItem"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=useURLParser.js.map