text: // Copyright (c) 2009-2017 SAP SE, All Rights Reserved
  sap.ui.define(["sap/ui/Device","sap/ui/core/HTML","sap/ushell/components/_HeaderManager/ControlManager","sap/ushell/components/HeaderManager","sap/ushell/components/_HeaderManager/ShellHeader.controller","sap/ushell/ui/footerbar/ContactSupportButton","sap/ushell/ui/launchpad/AccessibilityCustomData","sap/m/Button","sap/m/Dialog","sap/ushell/resources","sap/ushell/utils","sap/ushell/Config","sap/ushell/EventHub","sap/ui/model/json/JSONModel","sap/ui/thirdparty/jquery","sap/ui/core/library"],function(D,H,a,b,S,C,A,B,c,r,u,d,E,J,q,e){"use strict";var V=e.mvc.ViewType;function s(i,o){return sap.ui.getCore().byId(o.getObject());}sap.ui.jsview("sap.ushell.renderers.fiori2.Shell",{createContent:function(o){this.oController=o;this.oShellAppTitleStateEnum={SHELL_NAV_MENU_ONLY:0,ALL_MY_APPS_ONLY:1,SHELL_NAV_MENU:2,ALL_MY_APPS:3};var v=this.getViewData()||{},f=v.config||{};this.oConfig=f;this.aDanglingControls=[];this._allowUpToThreeActionInShellHeader(f);var U=sap.ui.xmlfragment("sap.ushell.ui.ShellLayout",o),g=this.createShellHeader(f,this.getViewData().shellModel);U.setHeader(g);g.setShellLayout(U);E.once("CreateToolArea").do(function(){sap.ui.require(["sap/ushell/ui/shell/ToolArea"],function(T){var h=new T({id:"shell-toolArea",toolAreaItems:{path:"/currentState/toolAreaItems",factory:s}});h.updateAggregation=this.updateShellAggregation;h.addEventDelegate({onAfterRendering:function(){U.applySplitContainerSecondaryContentSize();}});U.setToolArea(h);}.bind(this));}.bind(this));this.setOUnifiedShell(U);this.setDisplayBlock(true);this.addDanglingControl(sap.ui.getCore().byId("viewPortContainer"));this.logonIFrameReference=null;u.setPerformanceMark("FLP - Shell.view rendering started!");return U;},_allowUpToThreeActionInShellHeader:function(o){if(Object.keys(o).length>3){var p=["moveAppFinderActionToShellHeader","moveUserSettingsActionToShellHeader","moveGiveFeedbackActionToShellHeader","moveContactSupportActionToShellHeader","moveEditHomePageActionToShellHeader"],f=0,P;for(var i=0;i<5;i++){P=p[i];if(f===3){o[P]=false;}else if(o[P]){f++;}}}},createShellHeader:function(o,f){var g=d.createModel("/core/shellHeader",J),h=new S(),i;a.init(o,h,f);i=sap.ui.xmlfragment("sap.ushell.ui.ShellHeader",h);if(D.system.desktop){i.setAccessKeyHandler(sap.ushell.renderers.fiori2.AccessKeysHandler);var j=i.getAppTitle();j.addEventDelegate({onsapskipforward:function(k){if(sap.ushell.renderers.fiori2.AccessKeysHandler.getAppKeysHandler()){k.preventDefault();sap.ushell.renderers.fiori2.AccessKeysHandler.bFocusOnShell=false;}}});}if(o.appState==="embedded"){i.setNoLogo();}i.setModel(g);i.setModel(r.i18nModel,"i18n");this.addEventDelegate({"onBeforeRendering":function(){i.createUIArea(this.getUIArea().getId());}},this);return i;},createPostCoreExtControls:function(){sap.ui.require(["sap/ushell/ui/shell/FloatingContainer","sap/ushell/ui/shell/ShellFloatingActions"],function(F,f){var o=sap.ui.getCore().byId("shell");if(!o){return;}var g=new F({id:"shell-floatingContainer",content:{path:"/currentState/floatingContainerContent",factory:s}});if(D.system.desktop){g.addCustomData(new A({key:"tabindex",value:"-1",writeToDom:true}));g.addEventDelegate({onsapskipforward:function(j){j.preventDefault();sap.ushell.renderers.fiori2.AccessKeysHandler.setIsFocusHandledByAnotherHandler(true);sap.ushell.renderers.fiori2.AccessKeysHandler.sendFocusBackToShell(j);},onsapskipback:function(j){if(sap.ushell.renderers.fiori2.AccessKeysHandler.getAppKeysHandler()){j.preventDefault();sap.ushell.renderers.fiori2.AccessKeysHandler.bFocusOnShell=false;}}});}g.setModel(o.getModel());this.addDanglingControl(g);var h=new f({id:"shell-floatingActions",floatingActions:{path:"/currentState/floatingActions",factory:s}});h.updateAggregation=this.updateShellAggregation;var i=this.getOUnifiedShell();i.setFloatingContainer(g);i.setFloatingActionsContainer(h);this._createAllMyAppsView();}.bind(this));},_createAllMyAppsView:function(){var m=this.getModel(),o=function(f){if(f.isEnabled()){this.oAllMyAppsView=sap.ui.view("allMyAppsView",{type:V.JS,viewName:"sap.ushell.renderers.fiori2.allMyApps.AllMyApps",viewData:{_fnGetShellModel:function(){return m;}},async:true,height:"100%",visible:{path:"/ShellAppTitleState",formatter:function(g){return g!==this.oShellAppTitleStateEnum.SHELL_NAV_MENU;}.bind(this)}}).addStyleClass("sapUshellAllMyAppsView");this.oAllMyAppsView.addCustomData(new A({key:"aria-label",value:r.i18n.getText("allMyApps_headerTitle"),writeToDom:true}));this.getOUnifiedShell().getHeader().getAppTitle().setAllMyApps(this.oAllMyAppsView);}}.bind(this);sap.ushell.Container.getServiceAsync("AllMyApps").then(o);},getOUnifiedShell:function(){return this.oUnifiedShell;},setOUnifiedShell:function(U){this.oUnifiedShell=U;},updateShellAggregation:function(n){var o=this.mBindingInfos[n],f=this.getMetadata().getJSONKeys()[n],g;q.each(this[f._sGetter](),q.proxy(function(i,v){this[f._sRemoveMutator](v);},this));q.each(o.binding.getContexts(),q.proxy(function(i,v){g=o.factory(this.getId()+"-"+i,v)?o.factory(this.getId()+"-"+i,v).setBindingContext(v,o.model):"";this[f._sMutator](g);},this));},getControllerName:function(){return"sap.ushell.renderers.fiori2.Shell";},createIFrameDialog:function(){var o=null,l=this.logonIFrameReference,f;var _=function(){if(l){l.remove();}return q("<iframe id=\"SAMLDialogFrame\" src=\"\" frameborder=\"0\" height=\"100%\" width=\"100%\"></iframe>");};var g=function(){o.addStyleClass("sapUshellSamlDialogHidden");q("#sap-ui-blocklayer-popup").addClass("sapUshellSamlDialogHidden");};this.destroyIFrameDialog();var h=new B({text:r.i18n.getText("samlCloseBtn"),press:function(){sap.ushell.Container.cancelLogon();}});var i=new H("SAMLDialogFrame");this.logonIFrameReference=_();i.setContent(this.logonIFrameReference.prop("outerHTML"));o=new c({id:"SAMLDialog",title:r.i18n.getText("samlDialogTitle"),contentWidth:"50%",contentHeight:"50%",rightButton:h}).addStyleClass("sapUshellIframeDialog");f=d.last("/core/extension/SupportTicket");if(f){var j=new C();j.setWidth("150px");j.setIcon("");o.setLeftButton(j);}o.addContent(i);o.open();g();this.logonIFrameReference=q("#SAMLDialogFrame");return this.logonIFrameReference[0];},destroyIFrameDialog:function(){var f=sap.ui.getCore().byId("SAMLDialog");if(f){f.destroy();}this.logonIFrameReference=null;},showIFrameDialog:function(){var o=sap.ui.getCore().byId("SAMLDialog");if(o){o.removeStyleClass("sapUshellSamlDialogHidden");q("#sap-ui-blocklayer-popup").removeClass("sapUshellSamlDialogHidden");}},addDanglingControl:function(o){this.aDanglingControls.push(o);},destroyDanglingControls:function(){if(this.aDanglingControls){this.aDanglingControls.forEach(function(o){if(o.destroyContent){o.destroyContent();}o.destroy();});}}});});
  