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