text: /*
   * ! SAP UI development toolkit for HTML5 (SAPUI5)
  
          (c) Copyright 2009-2015 SAP SE. All rights reserved
      
   */
  sap.ui.define(["jquery.sap.global","sap/ui/core/Element","./ArrayUtilities"],function(q,S,a){"use strict";var T=S.extend("sap.ui.vtm.TreeCollections",{getTreeItem:function(t){if(!t){return null;}if(typeof t==="string"){var b=this._treeItemsById.get(t);if(!b){throw t+" was not found in tree with tree id "+this.getId();}return b;}return t;},getTreeItemId:function(t){if(!t){return null;}return typeof t==="string"?t:t.id;},updateCollections:function(r,c){c=c!==false;var o=this._parentIdsById;var b=this._includedTreeItems;var d=this._excludedTreeItems;this._treeItemsById=new Map();this._parentIdsById=new Map();this._treeItemsBySceneNodeId=new sap.ui.vtm.Lookup();this._includedTreeItems=[];this._excludedTreeItems=[];var p=this._parentIdsById;var h=false;var u=function(i,e,f){var g=i.id;if(!g){throw"id is not set for tree item with name "+i.name;}if(this._treeItemsById.has(g)){throw g+" is not unique in the tree";}var j;if(f){this._excludedTreeItems.push(i);if(c&&d&&!h){j=this._excludedTreeItems.length-1;if(j>=d.length||d[j]!=i){h=true;}}}else{this._includedTreeItems.push(i);if(c&&b&&!h){j=this._includedTreeItems.length-1;if(j>=b.length||b[j]!=i){h=true;}}}this._treeItemsById.set(g,i);if(e){if(!e.id){throw"id is not set for tree item with name "+e.name;}p.set(g,e.id);if(c&&o&&!h){if(o.get(g)!==e.id){h=true;}}}else if(c&&o&&!h){if(o.get(g)){h=true;}}if(i.includedChildren){i.includedChildren.forEach(function(k){u(k,i,f);});}if(i.excludedChildren){i.excludedChildren.forEach(function(k){u(k,i,true);});}if(i.sceneNodeIds){sap.ui.vtm.TreeItemUtilities.getSceneNodeIds(i).forEach(function(s){this._treeItemsBySceneNodeId.addValue(s,i);}.bind(this));}}.bind(this);r.forEach(function(e){u(e,null);});if(c&&!h){if(b&&b.length!==this._includedTreeItems.length){h=true;}if(d&&d.length!==this._excludedTreeItems.length){h=true;}}return c&&h;},updateTreeItemsBySceneNodeId:function(r){this._treeItemsBySceneNodeId=new sap.ui.vtm.Lookup();sap.ui.vtm.TreeItemUtilities.traverseTree(r,function(t){sap.ui.vtm.TreeItemUtilities.getSceneNodeIds(t).forEach(function(s){this._treeItemsBySceneNodeId.addValue(s,t);}.bind(this));return sap.ui.vtm.ChildCollectionType.IncludedAndExcluded;}.bind(this));},getItem:function(t){return this._treeItemsById.get(t);},isIncludedItem:function(t){t=this.getTreeItem(t);return this._includedTreeItems.indexOf(t)!==-1;},isExcludedItem:function(t){t=this.getTreeItem(t);return this._excludedTreeItems.indexOf(t)!==-1;},getItemsBySceneNodeId:function(s,t){s=sap.ui.vtm.ArrayUtilities.wrap(s);if(!s.length){return[];}t=t||sap.ui.vtm.TreeItemType.Included;var b=function(d,t){switch(t){case sap.ui.vtm.TreeItemType.IncludedOrExcluded:return true;case sap.ui.vtm.TreeItemType.Included:return this.isIncludedItem(d);case sap.ui.vtm.TreeItemType.Excluded:return this.isExcludedItem(d);default:throw"Unexpected sap.ui.vtm.TreeItemType value "+t;}}.bind(this);var c=[];s.forEach(function(d){var e=this._treeItemsBySceneNodeId.getValues(d);e.forEach(function(f){if(c.indexOf(f)===-1&&b(f,t)){c.push(f);}});}.bind(this));return c;},getParentItem:function(t){var b=this.getTreeItemId(t);var p=this._parentIdsById.get(b);if(!p){return undefined;}return this._treeItemsById.get(p);},getDescendantItems:function(t,b){t=this.getTreeItem(t);b=b||sap.ui.vtm.TreeItemType.Included;var d=[];switch(b){case sap.ui.vtm.TreeItemType.IncludedOrExcluded:sap.ui.vtm.TreeItemUtilities.traverseBranch(t,function(c){if(c!==t){d.push(c);}return sap.ui.vtm.ChildCollectionType.IncludedAndExcluded;});break;case sap.ui.vtm.TreeItemType.Included:sap.ui.vtm.TreeItemUtilities.traverseBranch(t,function(c){if(c===t){return this.isIncludedItem(c)?sap.ui.vtm.ChildCollectionType.Included:sap.ui.vtm.ChildCollectionType.None;}else{d.push(c);return sap.ui.vtm.ChildCollectionType.Included;}}.bind(this));break;case sap.ui.vtm.TreeItemType.Excluded:sap.ui.vtm.TreeItemUtilities.traverseBranch(t,function(c){if(c===t){return sap.ui.vtm.ChildCollectionType.IncludedAndExcluded;}else{if(this.isExcludedItem(c)){d.push(c);}return sap.ui.vtm.ChildCollectionType.IncludedAndExcluded;}}.bind(this));break;default:throw"Unexpected sap.ui.vtm.TreeItemType value "+b;}return d;},getAncestorItems:function(t){t=this.getTreeItem(t);var b=[];var c=this.getParentItem(t.id);while(c){b.push(c);c=this.getParentItem(c.id);}return b.reverse();},getAllItems:function(t){t=t||sap.ui.vtm.TreeItemType.Included;switch(t){case sap.ui.vtm.TreeItemType.IncludedOrExcluded:return this._includedTreeItems.concat(this._excludedTreeItems);case sap.ui.vtm.TreeItemType.Included:return this._includedTreeItems.slice();case sap.ui.vtm.TreeItemType.Excluded:return this._excludedTreeItems.slice();default:throw"Unexpected sap.ui.vtm.TreeItemType value "+t;}}});return T;});
  