text: /*!
   * OpenUI5
   * (c) Copyright 2009-2019 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["sap/ui/thirdparty/jquery","sap/ui/base/DataType","sap/ui/base/ManagedObject","sap/ui/core/CustomData","./mvc/View","./mvc/EventHandlerResolver","./ExtensionPoint","./StashedControlSupport","sap/ui/base/SyncPromise","sap/base/Log","sap/base/util/ObjectPath","sap/base/assert","sap/base/security/encodeXML","sap/base/util/LoaderExtensions"],function(e,t,n,r,i,a,o,s,u,l,f,c,p,d){"use strict";function g(e,r,i,a){var o=n.bindingParser(r,a,true);if(o&&typeof o==="object"){return o}var s=r=o||r;var u=t.getType(e);if(u){if(u instanceof t){s=u.parseValue(r,{context:a});if(!u.isValid(s)){l.error("Value '"+r+"' is not valid for type '"+u.getName()+"'.")}}}else{throw new Error("Property "+i+" has unknown type "+e)}return typeof s==="string"?n.bindingParser.escape(s):s}function m(e){return e.localName||e.baseName||e.nodeName}function v(e){if(e.isRejected()){throw e.getResult()}return e.getResult()}function h(e,t){function n(e,n,r){var i,a,o=[];for(i=e.firstChild;i;i=i.nextSibling){a=t(e,n,r,i);if(a){o.push(v(a))}}return u.resolve(o)}function r(e,n,r){var i,a=Promise.resolve(),o=[];for(i=e.firstChild;i;i=i.nextSibling){a=a.then(t.bind(null,e,n,r,i));o.push(a)}return Promise.all(o)}return e?r:n}var w={};w.loadTemplate=function(e,t){var n=e.replace(/\./g,"/")+("."+(t||"view")+".xml");return d.loadResource(n).documentElement};w.loadTemplatePromise=function(e,t){var n=e.replace(/\./g,"/")+("."+(t||"view")+".xml");return d.loadResource(n,{async:true}).then(function(e){return e.documentElement})};w.parseViewAttributes=function(e,t,n){var r=t.getMetadata().getAllProperties();for(var i=0;i<e.attributes.length;i++){var a=e.attributes[i];if(a.name==="controllerName"){t._controllerName=a.value}else if(a.name==="resourceBundleName"){t._resourceBundleName=a.value}else if(a.name==="resourceBundleUrl"){t._resourceBundleUrl=a.value}else if(a.name==="resourceBundleLocale"){t._resourceBundleLocale=a.value}else if(a.name==="resourceBundleAlias"){t._resourceBundleAlias=a.value}else if(a.name==="class"){t.addStyleClass(a.value)}else if(!n[a.name]&&r[a.name]){n[a.name]=g(r[a.name].type,a.value,a.name,t._oContainingView.oController)}}};w.enrichTemplateIds=function(e,t){w.enrichTemplateIdsPromise(e,t,false);return e};w.enrichTemplateIdsPromise=function(e,t,n){return y(e,t,true,n).then(function(){return e})};w.parseTemplate=function(e,t){return v(w.parseTemplatePromise(e,t,false))};w.parseTemplatePromise=function(e,t,n,r){return y(e,t,false,n,r)};function y(t,d,y,C,b){var _=[],x=u.resolve();C=C&&d._sProcessingMode==="sequential";l.debug("XML processing mode is "+(C?"sequential":"default"),"","XMLTemplateProcessor");var I=sap.ui.getCore().getConfiguration().getDesignMode();if(I){d._sapui_declarativeSourceInfo={xmlNode:t,xmlRootNode:d._oContainingView===d?t:d._oContainingView._sapui_declarativeSourceInfo.xmlRootNode}}var N=d.sViewName||d._sFragmentName;if(!N){var M=d;var R=0;while(++R<1e3&&M&&M!==M._oContainingView){M=M._oContainingView}N=M.sViewName}if(d.isSubView()){U(t,true)}else{if(t.localName==="View"&&t.namespaceURI!=="sap.ui.core.mvc"){l.warning("XMLView root node must have the 'sap.ui.core.mvc' namespace, not '"+t.namespaceURI+"'"+(N?" (View name: "+N+")":""))}E(t)}var V=0;function P(){for(;V<_.length;V++){var e=_[V];if(e&&typeof e.then==="function"){return e.then(A).then(P)}}return _}function A(e){var t=[V,1].concat(e);Array.prototype.splice.apply(_,t)}return x.then(P);function S(e){return e}function T(e){return d._oContainingView.createId(e)}function U(e,t,n){if(e.nodeType===1){var r=m(e);if(e.namespaceURI==="http://www.w3.org/1999/xhtml"||e.namespaceURI==="http://www.w3.org/2000/svg"){_.push("<"+r+" ");var i=false;for(var a=0;a<e.attributes.length;a++){var o=e.attributes[a];var s=o.value;if(o.name==="id"){i=true;s=j(d,e)}_.push(o.name+'="'+p(s)+'" ')}if(t===true){_.push("data-sap-ui-preserve"+'="'+d.getId()+'" ');if(!i){_.push("id"+'="'+d.getId()+'" ')}}_.push(">");var u=e;if(window.HTMLTemplateElement&&e instanceof HTMLTemplateElement&&e.content instanceof DocumentFragment){u=e.content}E(u);_.push("</"+r+">")}else if(r==="FragmentDefinition"&&e.namespaceURI==="sap.ui.core"){E(e,false,true)}else{x=x.then(function(){return q(e).then(function(e){for(var t=0;t<e.length;t++){var n=e[t];if(d.getMetadata().hasAggregation("content")){d.addAggregation("content",n)}else if(d.getMetadata().hasAssociation("content")){d.addAssociation("content",n)}}return e})});_.push(x)}}else if(e.nodeType===3&&!n){var l=e.textContent||e.text,f=m(e.parentNode);if(l){if(f!="style"){l=p(l)}_.push(l)}}}function E(e,t,n){var r=e.childNodes;for(var i=0;i<r.length;i++){U(r[i],t,n)}}function L(t,n){var r;var i=sap.ui.getCore().getLoadedLibraries();e.each(i,function(e,i){if(t===i.namespace||t===i.name){r=i.name+"."+(i.tagNames&&i.tagNames[n]||n)}});r=r||t+"."+n;function a(e){if(!e){l.error("Control '"+r+"' did not return a class definition from sap.ui.define.","","XMLTemplateProcessor");e=f.get(r)}if(!e){l.error("Can't find object class '"+r+"' for XML-view","","XMLTemplateProcessor")}return e}var o=r.replace(/\./g,"/");var s=sap.ui.require(o);if(!s){if(C){return new Promise(function(e){sap.ui.require([o],function(t){t=a(t);e(t)})})}else{s=sap.ui.requireSync(o);s=a(s)}}return s}function B(e){if(e.namespaceURI==="http://www.w3.org/1999/xhtml"||e.namespaceURI==="http://www.w3.org/2000/svg"){var t=e.attributes["id"]?e.attributes["id"].textContent||e.attributes["id"].text:null;if(y){return w.enrichTemplateIdsPromise(e,d,C).then(function(){return[]})}else{var n=function(n){var r={id:t?j(d,e,t):undefined,xmlNode:e,containingView:d._oContainingView,processingMode:d._sProcessingMode};if(d.fnScopedRunWithOwner){return d.fnScopedRunWithOwner(function(){return new n(r)})}return new n(r)};if(C){return new Promise(function(e,t){sap.ui.require(["sap/ui/core/mvc/XMLView"],function(t){e([n(t)])})})}else{var r=sap.ui.requireSync("sap/ui/core/mvc/XMLView");return u.resolve([n(r)])}}}else{return q(e)}}function q(e){if(m(e)==="ExtensionPoint"&&e.namespaceURI==="sap.ui.core"){if(y){return u.resolve([])}else{var t=d instanceof i?d._oContainingView:d;return u.resolve(o._factory(t,e.getAttribute("name"),function(){var t=u.resolve();var n=[];var r=e.childNodes;for(var i=0;i<r.length;i++){var a=r[i];if(a.nodeType===1){t=t.then(B.bind(null,a));n.push(t)}}return u.all(n).then(function(e){var t=[];e.forEach(function(e){t=t.concat(e)});return t})}))}}else{var n=L(e.namespaceURI,m(e));if(n&&typeof n.then==="function"){return n.then(function(t){return O(e,t)})}else{return O(e,n)}}}function O(t,o){var f=t.namespaceURI,p={},_="",x=[],N=null,M=null;if(!o){return u.resolve([])}var R=o.getMetadata();var V=R.getAllSettings();if(!y){for(var P=0;P<t.attributes.length;P++){var A=t.attributes[P],U=A.name,E=V[U],L=A.value;if(U==="id"){p[U]=j(d,t,L)}else if(U==="class"){_+=L}else if(U==="viewName"){p[U]=L}else if(U==="fragmentName"){p[U]=L;p["containingView"]=d._oContainingView}else if(U==="binding"&&!E||U==="objectBindings"){var q=n.bindingParser(L,d._oContainingView.oController);if(q){p.objectBindings=p.objectBindings||{};p.objectBindings[q.model||undefined]=q}}else if(U==="metadataContexts"){var O=null;try{O=w._calculatedModelMapping(L,d._oContainingView.oController,true)}catch(e){l.error(d+":"+e.message)}if(O){p.metadataContexts=O;if(w._preprocessMetadataContexts){w._preprocessMetadataContexts(o.getMetadata().getName(),p,d._oContainingView.oController)}}}else if(U.indexOf(":")>-1){if(A.namespaceURI==="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"){var D=m(A);x.push(new r({key:D,value:g("any",L,D,d._oContainingView.oController)}))}else if(A.namespaceURI==="http://schemas.sap.com/sapui5/extension/sap.ui.core.support.Support.info/1"){M=L}else if(U.indexOf("xmlns:")!==0){if(!N){N={}}if(!N.hasOwnProperty(A.namespaceURI)){N[A.namespaceURI]={}}N[A.namespaceURI][m(A)]=A.nodeValue;l.debug(d+": XMLView parser encountered unknown attribute '"+U+"' (value: '"+L+"') with unknown namespace, stored as sap-ui-custom-settings of customData")}}else if(E&&E._iKind===0){p[U]=g(E.type,L,U,d._oContainingView.oController)}else if(E&&E._iKind===1&&E.altTypes){p[U]=g(E.altTypes[0],L,U,d._oContainingView.oController)}else if(E&&E._iKind===2){var q=n.bindingParser(L,d._oContainingView.oController);if(q){p[U]=q}else{l.error(d+": aggregations with cardinality 0..n only allow binding paths as attribute value (wrong value: "+U+"='"+L+"')")}}else if(E&&E._iKind===3){p[U]=T(L)}else if(E&&E._iKind===4){p[U]=L.split(/[\s,]+/g).filter(S).map(T)}else if(E&&E._iKind===5){var F=a.resolveEventHandler(L,d._oContainingView.oController);if(F){p[U]=F}else{l.warning(d+': event handler function "'+L+'" is not a function or does not exist in the controller.')}}else if(E&&E._iKind===-1){if(i.prototype.isPrototypeOf(o.prototype)&&U=="async"){p[U]=g(E.type,L,U,d._oContainingView.oController)}else{l.warning(d+": setting '"+U+"' for class "+R.getName()+" (value:'"+L+"') is not supported")}}else{c(U==="xmlns",d+": encountered unknown setting '"+U+"' for class "+R.getName()+" (value:'"+L+"')");if(w._supportInfo){w._supportInfo({context:t,env:{caller:"createRegularControls",error:true,info:"unknown setting '"+U+"' for class "+R.getName()}})}}}if(N){x.push(new r({key:"sap-ui-custom-settings",value:N}))}if(x.length>0){p.customData=x}}var W=h(C,k);function k(t,n,r,i,a){var o;if(i.nodeType===1){if(i.namespaceURI==="http://schemas.sap.com/sapui5/extension/sap.ui.core.xmlcomposite/1"){p[m(i)]=i.querySelector("*");return}o=i.namespaceURI===f&&r&&r[m(i)];if(o){return W(i,o)}else if(n){if(!a&&i.getAttribute("stashed")==="true"&&!y){s.createStashedControl(j(d,i),{sParentId:p["id"],sParentAggregationName:n.name,fnCreate:function(){var e=C;C=false;try{return v(k(t,n,r,i,true))}finally{C=e}}});return}return B(i).then(function(e){for(var t=0;t<e.length;t++){var r=e[t];var i=n.name;if(n.multiple){if(!p[i]){p[i]=[]}if(typeof p[i].path==="string"){c(!p[i].template,"list bindings support only a single template object");p[i].template=r}else{p[i].push(r)}}else{c(!p[i],"multiple aggregates defined for aggregation with cardinality 0..1");p[i]=r}}return e})}else if(m(t)!=="FragmentDefinition"||t.namespaceURI!=="sap.ui.core"){throw new Error("Cannot add direct child without default aggregation defined for control "+R.getElementName())}}else if(i.nodeType===3){if(e.trim(i.textContent||i.text)){throw new Error("Cannot add text nodes as direct child of an aggregation. For adding text to an aggregation, a surrounding html tag is needed: "+e.trim(i.textContent||i.text))}}}var K=R.getDefaultAggregation();var H=R.getAllAggregations();return W(t,K,H).then(function(){var e;if(y&&t.hasAttribute("id")){X(d,t)}else if(!y){if(i.prototype.isPrototypeOf(o.prototype)&&typeof o._sType==="string"){var n=function(){if(o.getMetadata().isA("sap.ui.core.mvc.XMLView")&&d._sProcessingMode==="sequential"){p.processingMode="sequential"}return i._legacyCreate(p,undefined,o._sType)};if(d.fnScopedRunWithOwner){e=d.fnScopedRunWithOwner(n)}else{e=n()}}else{var r=function(){if(o.getMetadata().isA("sap.ui.core.Fragment")&&t.getAttribute("type")!=="JS"&&d._sProcessingMode==="sequential"){p.processingMode="sequential"}if(d.fnScopedRunWithOwner){return d.fnScopedRunWithOwner(function(){return new o(p)})}else{return new o(p)}};if(b&&b.fnRunWithPreprocessor){e=b.fnRunWithPreprocessor(r)}else{e=r()}}if(_&&e.addStyleClass){e.addStyleClass(_)}}if(!e){e=[]}else if(!Array.isArray(e)){e=[e]}if(w._supportInfo&&e){for(var a=0,s=e.length;a<s;a++){var u=e[a];if(u&&u.getId()){var l=w._supportInfo({context:t,env:{caller:"createRegularControls",nodeid:t.getAttribute("id"),controlid:u.getId()}}),f=M?M+",":"";f+=l;w._supportInfo.addSupportInfo(u.getId(),f)}}}if(I){e.forEach(function(e){if(R.getCompositeAggregationName){var n=t.getElementsByTagName(e.getMetadata().getCompositeAggregationName());for(var r=0;r<n.length;r++){t.removeChild(n[0])}}e._sapui_declarativeSourceInfo={xmlNode:t,xmlRootNode:d._sapui_declarativeSourceInfo.xmlRootNode,fragmentName:R.getName()==="sap.ui.core.Fragment"?p["fragmentName"]:null}})}return e})}function j(e,t,n){if(t.getAttributeNS("http://schemas.sap.com/sapui5/extension/sap.ui.core.Internal/1","id")){return t.getAttribute("id")}else{return T(n?n:t.getAttribute("id"))}}function X(e,t){t.setAttribute("id",T(t.getAttribute("id")));t.setAttributeNS("http://schemas.sap.com/sapui5/extension/sap.ui.core.Internal/1","id",true)}}w._preprocessMetadataContexts=null;w._calculatedModelMapping=function(e,t,r){var i,a={},o=n.bindingParser(e,t);function s(e){if(e.length%2===0){throw new Error("The last entry is no binding")}for(var t=1;t<=e.length;t=t+2){if(typeof e[t-1]=="string"){throw new Error("Binding expected not a string")}if(e[t]){if(typeof e[t]!="string"||e[t]!=","){throw new Error("Missing delimiter ','")}}}}if(o){if(!o.formatter){i=o;o={parts:[i]}}else{s(o.formatter.textFragments)}for(var u=0;u<o.parts.length;u++){i=o.parts[u];a[i.model]=a[i.model]||(r?[]:null);if(Array.isArray(a[i.model])){a[i.model].push(i)}else{a[i.model]=i}}}return a};return w},true);