text: /*!
   * OpenUI5
   * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["./library","sap/ui/core/Control","sap/ui/Device","sap/ui/core/theming/Parameters","sap/ui/thirdparty/jquery"],function(e,t,i,a,r){"use strict";var s=t.extend("sap.ui.unified.ShellHeader",{metadata:{properties:{logo:{type:"sap.ui.core.URI",defaultValue:""},searchVisible:{type:"boolean",defaultValue:true}},aggregations:{headItems:{type:"sap.ui.unified.ShellHeadItem",multiple:true},headEndItems:{type:"sap.ui.unified.ShellHeadItem",multiple:true},search:{type:"sap.ui.core.Control",multiple:false},user:{type:"sap.ui.unified.ShellHeadUserItem",multiple:false}}},renderer:{render:function(e,t){var i=t.getId();e.write("<div");e.writeControlData(t);e.writeAttribute("class","sapUiUfdShellHeader");if(sap.ui.getCore().getConfiguration().getAccessibility()){e.writeAttribute("role","toolbar")}e.write(">");e.write("<div id='",i,"-hdr-begin' class='sapUiUfdShellHeadBegin'>");this.renderHeaderItems(e,t,true);e.write("</div>");e.write("<div id='",i,"-hdr-center' class='sapUiUfdShellHeadCenter'>");this.renderSearch(e,t);e.write("</div>");e.write("<div id='",i,"-hdr-end' class='sapUiUfdShellHeadEnd'>");this.renderHeaderItems(e,t,false);e.write("</div>");e.write("</div>")},renderSearch:function(e,t){var i=t.getSearch();e.write("<div id='",t.getId(),"-hdr-search'");if(sap.ui.getCore().getConfiguration().getAccessibility()){e.writeAttribute("role","search")}e.writeAttribute("class","sapUiUfdShellSearch"+(t.getSearchVisible()?"":" sapUiUfdShellHidden"));e.write("><div>");if(i){e.renderControl(i)}e.write("</div></div>")},renderHeaderItems:function(e,t,i){e.write("<div class='sapUiUfdShellHeadContainer'>");var a=i?t.getHeadItems():t.getHeadEndItems();for(var r=0;r<a.length;r++){e.write("<div tabindex='0'");e.writeElementData(a[r]);e.addClass("sapUiUfdShellHeadItm");if(a[r].getStartsSection()){e.addClass("sapUiUfdShellHeadItmDelim")}if(a[r].getShowSeparator()){e.addClass("sapUiUfdShellHeadItmSep")}if(!a[r].getVisible()){e.addClass("sapUiUfdShellHidden")}if(a[r].getSelected()&&a[r].getToggleEnabled()){e.addClass("sapUiUfdShellHeadItmSel")}if(a[r].getShowMarker()){e.addClass("sapUiUfdShellHeadItmMark")}e.writeClasses();var s=a[r].getTooltip_AsString();if(s){e.writeAttributeEscaped("title",s)}if(sap.ui.getCore().getConfiguration().getAccessibility()){e.writeAccessibilityState(a[r],{role:"button",selected:null,pressed:a[r].getToggleEnabled()?a[r].getSelected():null})}e.write("><span></span><div class='sapUiUfdShellHeadItmMarker'><div></div></div></div>")}var d=t.getUser();if(!i&&d){e.write("<div tabindex='0'");e.writeElementData(d);e.addClass("sapUiUfdShellHeadUsrItm");if(!d.getShowPopupIndicator()){e.addClass("sapUiUfdShellHeadUsrItmWithoutPopup")}e.writeClasses();var s=d.getTooltip_AsString();if(s){e.writeAttributeEscaped("title",s)}if(sap.ui.getCore().getConfiguration().getAccessibility()){e.writeAccessibilityState(d,{role:"button"});if(d.getShowPopupIndicator()){e.writeAttribute("aria-haspopup","true")}}e.write("><span id='",d.getId(),"-img' aria-hidden='true' class='sapUiUfdShellHeadUsrItmImg'></span>");e.write("<span id='"+d.getId()+"-name' class='sapUiUfdShellHeadUsrItmName'");var l=d.getUsername()||"";e.writeAttributeEscaped("title",l);e.write(">");e.writeEscaped(l);e.write("</span><span class='sapUiUfdShellHeadUsrItmExp' aria-hidden='true'></span></div>")}e.write("</div>");if(i){this._renderLogo(e,t)}},_renderLogo:function(e,t){var i=sap.ui.getCore().getLibraryResourceBundle("sap.ui.unified"),a=i.getText("SHELL_LOGO_TOOLTIP"),r=t._getLogo();e.write("<div class='sapUiUfdShellIco'>");e.write("<img id='",t.getId(),"-icon'");e.writeAttributeEscaped("title",a);e.writeAttributeEscaped("alt",a);e.write("src='");e.writeEscaped(r);e.write("'");if(!r){e.addStyle("display","none");e.writeStyles()}e.write(">");e.write("</div>")}}});s.prototype.init=function(){var e=this;this._rtl=sap.ui.getCore().getConfiguration().getRTL();this._handleMediaChange=function(t){if(!e.getDomRef()){return}e._refresh()};i.media.attachHandler(this._handleMediaChange,this,i.media.RANGESETS.SAP_STANDARD);this._handleResizeChange=function(t){if(!e.getDomRef()||!e.getUser()){return}var i=this.getUser();var a=i._checkAndAdaptWidth(!e.$("hdr-search").hasClass("sapUiUfdShellHidden")&&!!e.getSearch());if(a){e._refresh()}};i.resize.attachHandler(this._handleResizeChange,this);this.data("sap-ui-fastnavgroup","true",true)};s.prototype.exit=function(){i.media.detachHandler(this._handleMediaChange,this,i.media.RANGESETS.SAP_STANDARD);delete this._handleMediaChange;i.resize.detachHandler(this._handleResizeChange,this);delete this._handleResizeChange};s.prototype.onAfterRendering=function(){this._refresh();this.$("hdr-center").toggleClass("sapUiUfdShellAnim",!this._noHeadCenterAnim)};s.prototype.onThemeChanged=function(){if(this.getDomRef()){this.invalidate()}};s.prototype._getLogo=function(){var e=this.getLogo();if(!e){e=a._getThemeImage(null,true)}return e};s.prototype._refresh=function(){function e(e){for(var t=0;t<e.length;t++){e[t]._refreshIcon()}}e(this.getHeadItems());e(this.getHeadEndItems());var t=this.getUser(),i=r("html").hasClass("sapUiMedia-Std-Phone"),a=!this.$("hdr-search").hasClass("sapUiUfdShellHidden"),s=this.$("icon");if(t){t._refreshImage();t._checkAndAdaptWidth(a&&!!this.getSearch())}s.parent().toggleClass("sapUiUfdShellHidden",i&&a&&!!this.getSearch());var d=this.$("hdr-end").outerWidth(),l=this.$("hdr-begin").outerWidth(),n=Math.max(d,l),h=(i&&a?l:n)+"px",o=(i&&a?d:n)+"px";this.$("hdr-center").css({left:this._rtl?o:h,right:this._rtl?h:o})};return s});