Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/app/hooks/app_hooks/useURLParser",["module","exports","require","frontend-js-web","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,d.useSelector)((e=>e.fragmentEntryLinks)),[,t]=(0,o.useSessionState)(i.HIGHLIGHTED_COMMENT_ID_KEY,void 0,n.COOKIE_TYPES.NECESSARY),a=(0,d.useSelector)((e=>e.layoutData)),m=(0,d.useDispatch)(),u=(0,c.useSelectItem)(),f=(0,s.useCallback)((t=>{const{fragmentEntryLinkId:n}=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)(a,n)||{};s&&(u(s),m((0,r.default)({sidebarOpen:!0,sidebarPanelId:"comments"})))}),[m,e,a,u]);(0,s.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 n=a("frontend-js-web"),s=a("liferay!frontend-js-react-web$react"),o=a("../../../common/hooks/useSessionState"),r=_interopRequireDefault(a("../../actions/switchSidebarPanel")),i=a("../../config/constants/highlightedCommentIdKey"),c=a("../../contexts/ControlsContext"),d=a("../../contexts/StoreContext"),l=_interopRequireDefault(a("../../utils/getFragmentItem"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=useURLParser.js.map