function handleBeforeNavigate(){Liferay.on("beforeNavigate",(()=>{const e=parent.document.getElementsByClassName("lfr-device")[0],a=document.createElement("section");a.classList.add("loading-animation-simulation-device"),a.innerHTML='',e.parentNode.appendChild(a),e.classList.add("lfr-device--is-navigating")}))}function handleFrameOnLoad(){frameElement.onload=function(){const e=parent.document.getElementsByClassName("loading-animation-simulation-device")[0];e&&e.remove();parent.document.getElementsByClassName("lfr-device")[0].classList.remove("lfr-device--is-navigating")}}function handlePreviewParam(){const e=new URL(frameElement.contentWindow.location.href),a=new URLSearchParams(e.search);a.has("p_l_mode")||(a.append("p_l_mode","preview"),frameElement.contentWindow.location.search=a.toString())}AUI().use("aui-base",(()=>{frameElement&&"simulationDeviceIframe"===frameElement.getAttribute("id")&&(document.body.classList.add("lfr-has-simulation-panel"),handleBeforeNavigate(),handleFrameOnLoad(),handlePreviewParam())}));