//>>built
define("dojox/treemap/TreeMap","dojo/_base/array,dojo/_base/lang,dojo/_base/declare,dojo/_base/event,dojo/_base/Color,dojo/touch,dojo/when,dojo/on,dojo/query,dojo/dom-construct,dojo/dom-geometry,dojo/dom-class,dojo/dom-style,./_utils,dijit/_WidgetBase,dojox/widget/_Invalidating,dojox/widget/Selection,dojo/_base/sniff,dojo/uacss".split(","),function(q,l,s,z,t,u,v,A,o,n,m,f,j,r,w,x,y,p){return s("dojox.treemap.TreeMap",[w,x,y],{baseClass:"dojoxTreeMap",store:null,query:{},itemToRenderer:null,_dataChanged:!1,
rootItem:null,_rootItemChanged:!1,tooltipAttr:"",areaAttr:"",_areaChanged:!1,labelAttr:"label",labelThreshold:NaN,colorAttr:"",colorModel:null,_coloringChanged:!1,groupAttrs:[],groupFuncs:null,_groupFuncs:null,_groupingChanged:!1,constructor:function(){this.itemToRenderer={};this.invalidatingProperties="colorModel,groupAttrs,groupFuncs,areaAttr,areaFunc,labelAttr,labelFunc,labelThreshold,tooltipAttr,tooltipFunc,colorAttr,colorFunc,rootItem".split(",")},getIdentity:function(a){return a.__treeID?a.__treeID:
this.store.getIdentity(a)},resize:function(a){a&&(m.setMarginBox(this.domNode,a),this.invalidateRendering())},postCreate:function(){this.inherited(arguments);this.connect(this.domNode,"mouseover",this._onMouseOver);this.connect(this.domNode,"mouseout",this._onMouseOut);this.connect(this.domNode,u.release,this._onMouseUp);this.domNode.setAttribute("role","presentation");this.domNode.setAttribute("aria-label","treemap")},buildRendering:function(){this.inherited(arguments);this.refreshRendering()},refreshRendering:function(){var a=
!1;if(this._dataChanged)this._dataChanged=!1,this._coloringChanged=this._groupingChanged=!0;if(this._groupingChanged)this._groupingChanged=!1,this._set("rootItem",null),this._updateTreeMapHierarchy(),a=!0;if(this._rootItemChanged)this._rootItemChanged=!1,a=!0;if(this._coloringChanged)this._coloringChanged=!1,null!=this.colorModel&&null!=this._data&&this.colorModel.initialize&&this.colorModel.initialize(this._data,l.hitch(this,function(a){return this.colorFunc(a,this.store)}));if(this._areaChanged)this._areaChanged=
!1,this._removeAreaForGroup();if(!(void 0==this.domNode||null==this._items)){a&&n.empty(this.domNode);var b=this.rootItem;if(null!=b&&this._isLeaf(b))b=this._getRenderer(b).parentItem;var c=m.getMarginBox(this.domNode);null!=b?this._buildRenderer(this.domNode,null,b,{x:c.l,y:c.t,w:c.w,h:c.h},0,a):this._buildChildrenRenderers(this.domNode,b?b:{__treeRoot:!0,children:this._items},0,a,c)}},_setRootItemAttr:function(a){this._rootItemChanged=!0;this._set("rootItem",a)},_setStoreAttr:function(a){var b;
null!=a?(b=a.query(this.query),b.observe&&b.observe(l.hitch(this,this._updateItem),!0),b=v(b,l.hitch(this,this._initItems))):b=this._initItems([]);this._set("store",a);return b},_initItems:function(a){this._dataChanged=!0;this._data=a;this.invalidateRendering();return a},_updateItem:function(a,b,c){-1!=b?c!=b?this._data.splice(b,1):this._data[c]=a:-1!=c&&this._data.splice(c,0,a);this._dataChanged=!0;this.invalidateRendering()},_setGroupAttrsAttr:function(a){this._groupingChanged=!0;if(null==this.groupFuncs)this._groupFuncs=
null!=a?q.map(a,function(a){return function(c){return c[a]}}):null;this._set("groupAttrs",a)},_setGroupFuncsAttr:function(a){this._groupingChanged=!0;this._set("groupFuncs",this._groupFuncs=a);if(null==a&&null!=this.groupAttrs)this._groupFuncs=q.map(this.groupAttrs,function(a){return function(c){return c[a]}})},_setAreaAttrAttr:function(a){this._areaChanged=!0;this._set("areaAttr",a)},areaFunc:function(a){return this.areaAttr&&0<this.areaAttr.length?parseFloat(a[this.areaAttr]):1},_setAreaFuncAttr:function(a){this._areaChanged=
!0;this._set("areaFunc",a)},labelFunc:function(a){return(a=this.labelAttr&&0<this.labelAttr.length?a[this.labelAttr]:null)?a.toString():null},tooltipFunc:function(a){return(a=this.tooltipAttr&&0<this.tooltipAttr.length?a[this.tooltipAttr]:null)?a.toString():null},_setColorModelAttr:function(a){this._coloringChanged=!0;this._set("colorModel",a)},_setColorAttrAttr:function(a){this._coloringChanged=!0;this._set("colorAttr",a)},colorFunc:function(a){a=this.colorAttr&&0<this.colorAttr.length?a[this.colorAttr]:
0;null==a&&(a=0);return parseFloat(a)},_setColorFuncAttr:function(a){this._coloringChanged=!0;this._set("colorFunc",a)},createRenderer:function(a,b,c){a=n.create("div");"header"!=c&&(j.set(a,"overflow","hidden"),j.set(a,"position","absolute"));return a},styleRenderer:function(a,b,c,d){switch(d){case "leaf":j.set(a,"background",this.getColorForItem(b).toHex());case "header":(b=this.getLabelForItem(b))&&(isNaN(this.labelThreshold)||c<this.labelThreshold)?a.innerHTML=b:n.empty(a)}},_updateTreeMapHierarchy:function(){if(null!=
this._data)this._items=null!=this._groupFuncs&&0<this._groupFuncs.length?r.group(this._data,this._groupFuncs,l.hitch(this,this._getAreaForItem)).children:this._data},_removeAreaForGroup:function(a){if(null!=a)if(a.__treeValue)delete a.__treeValue,a=a.children;else return;else a=this._items;if(a)for(var b=0;b<a.length;++b)this._removeAreaForGroup(a[b])},_getAreaForItem:function(a){a=this.areaFunc(a,this.store);return isNaN(a)?0:a},_computeAreaForItem:function(a){var b;if(a.__treeID){if(b=a.__treeValue,
!b){b=0;for(var c=a.children,d=0;d<c.length;++d)b+=this._computeAreaForItem(c[d]);a.__treeValue=b}}else b=this._getAreaForItem(a);return b},getColorForItem:function(a){a=this.colorFunc(a,this.store);return null!=this.colorModel?this.colorModel.getColor(a):new t(a)},getLabelForItem:function(a){return a.__treeName?a.__treeName:this.labelFunc(a,this.store)},_buildChildrenRenderers:function(a,b,c,d,i,e){var k=b.children,g=m.getMarginBox(a),g=r.solve(k,g.w,g.h,l.hitch(this,this._computeAreaForItem),!this.isLeftToRight()).rectangles;
i&&(g=q.map(g,function(a){a.x+=i.l;a.y+=i.t;return a}));for(var h,f=0;f<k.length;++f)h=g[f],this._buildRenderer(a,b,k[f],h,c,d,e)},_isLeaf:function(a){return!a.children},_isRoot:function(a){return a.__treeRoot},_getRenderer:function(a,b,c){if(b)for(b=0;b<c.children.length;++b)if(c.children[b].item==a)return c.children[b];return this.itemToRenderer[this.getIdentity(a)]},_buildRenderer:function(a,b,c,d,i,e,f){var g=this._isLeaf(c),h=!e?this._getRenderer(c,f,a):null,h=g?this._updateLeafRenderer(h,c,
i):this._updateGroupRenderer(h,c,i);if(e)h.level=i,h.item=c,h.parentItem=b,this.itemToRenderer[this.getIdentity(c)]=h,this.updateRenderers(c);var b=Math.floor(d.x),j=Math.floor(d.y),l=Math.floor(d.x+d.w+1.0E-11)-b,d=Math.floor(d.y+d.h+1.0E-11)-j;e&&n.place(h,a);m.setMarginBox(h,{l:b,t:j,w:l,h:d});g||(a=m.getContentBox(h),this._layoutGroupContent(h,a.w,a.h,i+1,e,f));this.onRendererUpdated({renderer:h,item:c,kind:g?"leaf":"group",level:i})},_layoutGroupContent:function(a,b,c,d,f,e){var k=o(".dojoxTreeMapHeader",
a)[0],g=o(".dojoxTreeMapGroupContent",a)[0];if(!(null==k||null==g)){var h=m.getMarginBox(k);h.h>c?(h.h=c,j.set(g,"display","none")):(j.set(g,"display","block"),m.setMarginBox(g,{l:0,t:h.h,w:b,h:c-h.h}),this._buildChildrenRenderers(g,a.item,d,f,null,e));m.setMarginBox(k,{l:0,t:0,w:b,h:h.h})}},_updateGroupRenderer:function(a,b,c){var d=null==a;null==a&&(a=this.createRenderer("div",c,"group"),f.add(a,"dojoxTreeMapGroup"));this.styleRenderer(a,b,c,"group");var i=o(".dojoxTreeMapHeader",a)[0],i=this._updateHeaderRenderer(i,
b,c);d&&n.place(i,a);i=o(".dojoxTreeMapGroupContent",a)[0];i=this._updateGroupContentRenderer(i,b,c);d&&n.place(i,a);return a},_updateHeaderRenderer:function(a,b,c){null==a&&(a=this.createRenderer(b,c,"header"),f.add(a,"dojoxTreeMapHeader"),f.add(a,"dojoxTreeMapHeader_"+c));this.styleRenderer(a,b,c,"header");return a},_updateLeafRenderer:function(a,b,c){null==a&&(a=this.createRenderer(b,c,"leaf"),f.add(a,"dojoxTreeMapLeaf"),f.add(a,"dojoxTreeMapLeaf_"+c));this.styleRenderer(a,b,c,"leaf");if(b=this.tooltipFunc(b,
this.store))a.title=b;return a},_updateGroupContentRenderer:function(a,b,c){null==a&&(a=this.createRenderer(b,c,"content"),f.add(a,"dojoxTreeMapGroupContent"),f.add(a,"dojoxTreeMapGroupContent_"+c));this.styleRenderer(a,b,c,"content");return a},_getRendererFromTarget:function(a){for(;a!=this.domNode&&!a.item;)a=a.parentNode;return a},_onMouseOver:function(a){var b=this._getRendererFromTarget(a.target);if(b.item){var c=b.item;this._hoveredItem=c;this.updateRenderers(c);this.onItemRollOver({renderer:b,
item:c,triggerEvent:a})}},_onMouseOut:function(a){var b=this._getRendererFromTarget(a.target);if(b.item){var c=b.item;this._hoveredItem=null;this.updateRenderers(c);this.onItemRollOut({renderer:b,item:c,triggerEvent:a})}},_onMouseUp:function(a){var b=this._getRendererFromTarget(a.target);b.item&&this.selectFromEvent(a,b.item,a.currentTarget,!0)},onRendererUpdated:function(){},onItemRollOver:function(){},onItemRollOut:function(){},updateRenderers:function(a){if(a){l.isArray(a)||(a=[a]);for(var b=0;b<
a.length;b++){var c=a[b],d=this._getRenderer(c);if(d){var i=this.isItemSelected(c),e=p("ie");if(i){if(f.add(d,"dojoxTreeMapSelected"),e&&(p("quirks")||9>e)){var e=d.previousSibling,k=j.get(d);if(!e||!f.contains(e,"dojoxTreeMapIEHack"))e=this.createRenderer(c,-10,"group"),f.add(e,"dojoxTreeMapIEHack"),f.add(e,"dojoxTreeMapSelected"),j.set(e,{position:"absolute",overflow:"hidden"}),n.place(e,d,"before");var g=2*parseInt(j.get(e,"border-width")),g=this._isLeaf(c)?g-1:g+1;"auto"!=k.left&&j.set(e,{left:parseInt(k.left)+
1+"px",top:parseInt(k.top)+1+"px",width:parseInt(k.width)-g+"px",height:parseInt(k.height)-g+"px"})}}else{if(e&&(p("quirks")||9>e))(e=d.previousSibling)&&f.contains(e,"dojoxTreeMapIEHack")&&e.parentNode.removeChild(e);f.remove(d,"dojoxTreeMapSelected")}this._hoveredItem==c?f.add(d,"dojoxTreeMapHovered"):f.remove(d,"dojoxTreeMapHovered");i||this._hoveredItem==c?j.set(d,"zIndex",20):j.set(d,"zIndex",7>=p("ie")?0:"auto")}}}}})});