function GlobalAjaxObserver(a){this.ERROR_MESSAGE_TYPE="ERROR";this.JQUERY_TECH_ID="jquery";this.WEBCOMPONENTS_TECH_ID="ui5wc";this.SAPUI5_TECH_ID="ui5";this.JUIC_TECH_ID="juic";
this.messageCodeKeys={AKAMAI_MESSAGE_CODE_KEY:"<akamaiMessageCode>"};this._labels=a;this._bEventListenersAttached=false;GlobalAjaxObserver.prototype.start=function(){if(!this._bEventListenersAttached){if(document.readyState==="interactive"||document.readyState==="complete"){jQuery(document).ajaxError(function(c,b,d,e){this.checkResponseForGlobalErrors(b)
}.bind(this))}else{jQuery(document).ready(function(){jQuery(document).ajaxError(function(c,b,d,e){this.checkResponseForGlobalErrors(b)}.bind(this))}.bind(this))}this._bEventListenersAttached=true
}return this};GlobalAjaxObserver.prototype.getLabel=function(b,d){var c=this._labels[b];if(c&&d){Object.keys(d).forEach(function(e){c=c.replace(e,d[e])})}return c
};GlobalAjaxObserver.prototype.checkResponseForGlobalErrors=function(e){var c="COE0060";var b=e.getResponseHeader("Error-Code")||e.getResponseHeader("X-Error-Code");
var f={};switch(b){case c:var d=this.messageCodeKeys.AKAMAI_MESSAGE_CODE_KEY;f[d]=e.getResponseHeader("X-Message-Code")||"";this.displayHttpStatusMessage(this.getLabel("error.common.WAFBlockException.errorCode",f));
break}};GlobalAjaxObserver.prototype.detectLearningUiTechnology=function(){var b;if(window.WebComponents){b=this.WEBCOMPONENTS_TECH_ID}else{if(window.sap&&window.sap.ui){b=this.SAPUI5_TECH_ID
}else{if(window.juic){b=this.JUIC_TECH_ID}else{b=this.JQUERY_TECH_ID}}}return b};GlobalAjaxObserver.prototype.displayNativeStatusAlert=function(b){b&&window.alert(b)
};GlobalAjaxObserver.prototype.displayHttpStatusMessage=function(d,b,c){var f=this.detectLearningUiTechnology();b=b||this.ERROR_MESSAGE_TYPE;function e(){switch(f){case this.WEBCOMPONENTS_TECH_ID:this.displayWebComponentsHttpStatusMessage(d,b);
break;case this.SAPUI5_TECH_ID:this.displayUi5HttpStatusMessage(d,b);break;case this.JUIC_TECH_ID:this.displayJuicHttpStatusMessage(d,b);break;default:!c&&window.alert(d)
}}if(document.readyState==="complete"){e.call(this)}else{jQuery(document).load(function(){e.call(this)})}};GlobalAjaxObserver.prototype.displayUi5HttpStatusMessage=function(c,b){sap.ui.require(["sap/m/MessageBox","sap/ui/Device"],function(e,d){b=b||this.ERROR_MESSAGE_TYPE;
e.alert(c,{styleClass:d.support.touch?"sapUiSizeCozy":"sapUiSizeCompact",icon:e.Icon[b],title:this.getHttpStatusMessageDialogTitle(b)})}.bind(this))};GlobalAjaxObserver.prototype.displayJuicHttpStatusMessage=function(c,b){b=b||this.ERROR_MESSAGE_TYPE;
switch(b){case this.ERROR_MESSAGE_TYPE:CustomAlert.error(this.getHttpStatusMessageDialogTitle(b),[c]);break}};GlobalAjaxObserver.prototype.displayWebComponentsHttpStatusMessage=function(c,b){b=b||this.ERROR_MESSAGE_TYPE;
switch(b){case this.ERROR_MESSAGE_TYPE:this._renderWebComponentMessage(c,b,this.getLabel("button.OK"));break}};GlobalAjaxObserver.prototype._renderWebComponentMessage=function(i,c,e){var h=document.getElementById("lmsGlobalAjaxMessageDialog-root");
var g,d;function b(){h.innerHTML=('<ui5-dialog id="lmsGlobalAjaxMessageDialog-dialog" header-text="'+this.getHttpStatusMessageDialogTitle(c)+'" style="min-width: 20rem;"><div style="margin: 1rem;"><span>'+i+'</span></div><div slot="footer"	style="display: flex; justify-content: flex-end; width: 100%; padding: .25rem 1rem;"><ui5-button id="lmsGlobalAjaxMessageDialog-button" design="Emphasized">'+e+"</ui5-button></div></ui5-dialog>")
}function f(j){g&&g.close();d&&d.removeEventListener("click",f)}if(!h){h=document.createElement("div");h.setAttribute("id","lmsGlobalAjaxMessageDialog-root");h.setAttribute("style","display: none;");
b.call(this);document.body.appendChild(h)}else{h.setAttribute("style","display: none;");b.call(this)}g=document.getElementById("lmsGlobalAjaxMessageDialog-dialog");
d=document.getElementById("lmsGlobalAjaxMessageDialog-button");d.addEventListener("click",f);if(g){this._waitForWebComponentConnected(g,function(j){if(j){h.setAttribute("style","display: block;");
g.show()}else{console.error("globalAjaxObserver.js: Web component timed out. Unable to display response status:",i)}})}};GlobalAjaxObserver.prototype._waitForWebComponentConnected=function(c,e){var d=10,b=0;
elementCheckIntervalId=setInterval(function(){if(c._fullyConnected){clearInterval(elementCheckIntervalId);e&&e(true)}else{if(b>d){clearInterval(elementCheckIntervalId);
e&&e(false)}}b++},100)};GlobalAjaxObserver.prototype.getHttpStatusMessageDialogTitle=function(b){switch(b){case this.ERROR_MESSAGE_TYPE:return this.getLabel("label.Error");
default:return""}};return this};