Liferay.Loader.define("frontend-js-spa-web@5.0.40/util/utils",["module","exports","require"],(function(t,e,r){window;{Object.defineProperty(e,"__esModule",{value:!0}),e.clearNodeAttributes=function clearNodeAttributes(t){Array.prototype.slice.call(t.attributes).forEach((e=>t.removeAttribute(e.name)))},e.copyNodeAttributes=function copyNodeAttributes(t,e){Array.prototype.slice.call(t.attributes).forEach((t=>e.setAttribute(t.name,t.value)))},e.getCurrentBrowserPath=function getCurrentBrowserPath(){return"".concat(window.location.pathname).concat(window.location.search).concat(window.location.hash)},e.getCurrentBrowserPathWithoutHash=getCurrentBrowserPathWithoutHash,e.getNodeOffset=function getNodeOffset(t){let[e,r]=[0,0];do{e+=t.offsetLeft,r+=t.offsetTop,t=t.offsetParent}while(t);return{offsetLeft:e,offsetTop:r}},e.getPortletBoundaryId=getPortletBoundaryId,e.getPortletBoundaryIds=getPortletBoundaryIds,e.getUid=function getUid(){return t++},e.getUrlPath=getUrlPath,e.getUrlPathWithoutHash=getUrlPathWithoutHash,e.getUrlPathWithoutHashAndSearch=function getUrlPathWithoutHashAndSearch(t){return(!t||t.startsWith("/")?new URL(t,window.location.origin):new URL(t)).pathname},e.isCurrentBrowserPath=function isCurrentBrowserPath(t){if(t){const e=getCurrentBrowserPathWithoutHash();return getUrlPathWithoutHash(t)===getUrlPath(e)}return!1},e.removePathTrailingSlash=function removePathTrailingSlash(t){const e=t?t.length:0;e>1&&"/"===t[e-1]&&(t=t.substr(0,e-1));return t},e.resetAllPortlets=function resetAllPortlets(){getPortletBoundaryIds(Liferay.Portlet.list).forEach((t=>{const e=document.querySelector("#"+t);e&&(Liferay.Portlet.destroy(e),e.portletProcessed=!1)})),Liferay.Portlet.readyCounter=0,Liferay.destroyComponents(((t,e)=>e.destroyOnNavigate))},e.runStyle=runStyle,e.runStylesInElement=function runStylesInElement(t,e,r){const n=t.querySelectorAll("style,link");if(!n.length&&e)return void setTimeout(e);let o=0;const a=function callback(){e&&++o===n.length&&setTimeout(e)};for(let t=0;t<n.length;t++)runStyle(n[t],a,r)},e.setReferrer=function setReferrer(t){Object.defineProperty(document,"referrer",{configurable:!0,get:()=>t})};let t=1;function getCurrentBrowserPathWithoutHash(){return"".concat(window.location.pathname).concat(window.location.search)}function getPortletBoundaryId(t){return"p_p_id_"+t+"_"}function getPortletBoundaryIds(t){return t.map((t=>getPortletBoundaryId(t)))}function getUrlPath(t){const e=!t||t.startsWith("/")?new URL(t,window.location.origin):new URL(t);return e.pathname+e.search+e.hash}function getUrlPathWithoutHash(t){const e=!t||t.startsWith("/")?new URL(t,window.location.origin):new URL(t);return e.pathname+e.search}function runStyle(t,e,r){const n=function callback(){e&&e()};if(!t.rel||"stylesheet"===t.rel||"canonical"===t.rel||"alternate"===t.rel)return"STYLE"===t.tagName||"canonical"===t.rel||"alternate"===t.rel?setTimeout(n):(t.addEventListener("load",n,{once:!0}),t.addEventListener("error",n,{once:!0})),r?r(t):document.head.appendChild(t),t;setTimeout(n)}}}));
//# sourceMappingURL=utils.js.map