AUI.add("liferay-sign-in-modal",(t=>{const e="signinmodal",o=t.config.win,n=t.Component.create({ATTRS:{resetFormValidator:{value:!0},signInPortlet:{setter:t.one,value:"#p_p_id_com_liferay_login_web_portlet_LoginPortlet_"}},EXTENDS:t.Plugin.Base,NAME:e,NS:e,prototype:{_bindUI(){const e=this;e._host.on("click",t.bind("_load",e));Liferay.on("screenLoad",(function destroyModal(){e.destroy(),Liferay.detach("screenLoad",destroyModal)}))},_load(t){const e=this;t.preventDefault(),e._signInPortletBody&&e._hasSignInForm?e._loadDOM():e._loadIO()},_loadDOM(){const t=this,e=t._signInPortletBody;t._originalParentNode||(t._originalParentNode=e.ancestor()),t._setModalContent(e),Liferay.Util.focusFormField(e.one("input:text"))},_loadIO(){const t=this,e=Liferay.Util.addParams("windowState=exclusive",t._signInURL);Liferay.Util.fetch(e).then((t=>t.text())).then((e=>{e?t._setModalContent(e):t._redirectPage()})).catch((()=>t._redirectPage()))},_redirectPage(){o.location.href=this._signInURL},_setModalContent(o){const n=this,i=Liferay.Util.getWindow(e);i?(i.bodyNode.setContent(o),i.show()):Liferay.Util.openWindow({dialog:{after:{visibleChange(t){const e=n._signInPortletBody,o=n._formValidator;if(o&&n.get("resetFormValidator")&&o.resetAllFields(),!t.newVal&&e){const t=n._originalParentNode;t&&t.append(e)}}},height:450,width:560},id:e,title:Liferay.Language.get("sign-in")},(e=>{const n=e.bodyNode;n.plug(t.Plugin.ParseContent),n.setContent(o)}))},destructor(){const t=Liferay.Util.getWindow(e);t&&t.destroy()},initializer(){const t=this,e=t.get("signInPortlet");e&&(t._signInPortletBody=e.one(".portlet-body"));const o=t.get("host");if(t._host=o,t._signInPortlet=e,t._signInURL=o.attr("href"),e){const o=e.one("form");if(o){const e=Liferay.Form.get(o.attr("id"));t._formValidator="",e&&(t._formValidator=e.formValidator),t._hasSignInForm=o.hasClass("sign-in-form")}}t._bindUI()}}});Liferay.SignInModal=n}),"",{requires:["aui-base","aui-component","aui-parse-content","liferay-form","liferay-portlet-url","liferay-util-window","plugin"]});
//# sourceMappingURL=sign_in_modal.js.map