Liferay.Loader.define("frontend-js-spa-web@5.0.24/screen/EventScreen",["module","exports","require","./HtmlScreen"],(function(e,t,r){var s;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=(s=r("./HtmlScreen"))&&s.__esModule?s:{default:s};class e extends a.default{constructor(){super(),this.cacheable=!1,this.timeout=Liferay.SPA.app.timeout}dispose(){super.dispose(),Liferay.fire("screenDispose",{app:Liferay.SPA.app,screen:this})}activate(){super.activate(),Liferay.fire("screenActivate",{app:Liferay.SPA.app,screen:this})}addCache(e){super.addCache(e),this.cacheLastModified=(new Date).getTime()}checkRedirectPath(e){const t=Liferay.SPA.app;Liferay.SPA.__capturedFormElement__||t.findRoute(e)||(window.location.href=e)}deactivate(){super.deactivate(),Liferay.fire("screenDeactivate",{app:Liferay.SPA.app,screen:this})}beforeScreenFlip(){Liferay.fire("beforeScreenFlip",{app:Liferay.SPA.app,screen:this})}copyBodyAttributes(){const e=this.virtualDocument.querySelector("body");document.body.className=e.className,document.body.onload=e.onload}evaluateStyles(e){const t=document.querySelector("html").lang.replace("-","_"),r=this.virtualDocument.lang.replace("-","_");return t!==r&&(this.stylesPermanentSelector_=a.default.selectors.stylesPermanent,this.stylesTemporarySelector_=a.default.selectors.stylesTemporary,this.makePermanentSelectorsTemporary_(t,r)),super.evaluateStyles(e).then(this.restoreSelectors_.bind(this))}flip(e){return this.copyBodyAttributes(),Promise.resolve(this.beforeScreenFlip()).then(super.flip(e)).then((()=>{this.runBodyOnLoad(),Liferay.fire("screenFlip",{app:Liferay.SPA.app,screen:this})}))}getCache(){let e=null;const t=Liferay.SPA.app;return t.isCacheEnabled()&&!t.isScreenCacheExpired(this)&&(e=super.getCache()),e}getCacheLastModified(){return this.cacheLastModified}isValidResponseStatusCode(e){const t=Liferay.SPA.app.getValidStatusCodes();return e>=200&&e<=500||t.indexOf(e)>-1}load(e){return super.load(e).then((t=>{const r=this.beforeUpdateHistoryPath(e);return this.checkRedirectPath(r),Liferay.fire("screenLoad",{app:Liferay.SPA.app,content:t,screen:this}),t}))}makePermanentSelectorsTemporary_(e,t){a.default.selectors.stylesTemporary=a.default.selectors.stylesTemporary.split(",").concat(a.default.selectors.stylesPermanent.split(",").map((t=>"".concat(t,'[href*="').concat(e,'"]')))).join(),a.default.selectors.stylesPermanent=a.default.selectors.stylesPermanent.split(",").map((e=>"".concat(e,'[href*="').concat(t,'"]'))).join()}restoreSelectors_(){a.default.selectors.stylesPermanent=this.stylesPermanentSelector_||a.default.selectors.stylesPermanent,a.default.selectors.stylesTemporary=this.stylesTemporarySelector_||a.default.selectors.stylesTemporary}runBodyOnLoad(){const e=document.body.onload;e&&e()}runFaviconInElement_(e){return super.runFaviconInElement_(e).then((()=>{e.forEach((e=>{e.type||-1===e.href.indexOf(".ico")||(e.type="image/x-icon")}))}))}}var o=e;t.default=o}}));
//# sourceMappingURL=EventScreen.js.map