Liferay.Loader.define("@liferay/search-experiences-web@3.0.30/sxp_blueprint_admin/js/hooks/useShouldConfirmBeforeNavigate",["module","exports","require","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,n,r){window;Object.defineProperty(n,"__esModule",{value:!0}),n.default=function useShouldConfirmBeforeNavigate(e,n=Liferay.Language.get("you-have-unsaved-changes-do-you-want-to-proceed-without-saving")){(0,a.useEffect)((()=>{const getRequiresConfirmationValue=()=>"function"==typeof e?e():e,handleBeforeUnload=e=>{getRequiresConfirmationValue()&&(e.preventDefault(),e.returnValue="")},handleBeforeNavigate=e=>{getRequiresConfirmationValue()&&(0,o.openConfirmModal)({message:n,onConfirm:n=>{n||e.originalEvent.preventDefault()}})};return window.addEventListener("beforeunload",handleBeforeUnload),Liferay.on("beforeNavigate",handleBeforeNavigate),()=>{window.removeEventListener("beforeunload",handleBeforeUnload),Liferay.detach("beforeNavigate",handleBeforeNavigate)}}),[e,n])};var o=r("frontend-js-web"),a=r("liferay!frontend-js-react-web$react")}));
//# sourceMappingURL=useShouldConfirmBeforeNavigate.js.map