//>>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(u,n,x,E,y,z,A,v,r,q,p,f,l,w,B,C,D,t){return x("dojox.treemap.TreeMap",[B,C,D],{baseClass:"dojoxTreeMap",store:null,query:{},queryOptions:null,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&&(p.setMarginBox(this.domNode,a),this.invalidateRendering())},postCreate:function(){this.inherited(arguments);this.own(v(this.domNode,"mouseover",n.hitch(this,this._onMouseOver)));this.own(v(this.domNode,"mouseout",n.hitch(this,this._onMouseOut)));this.own(v(this.domNode,z.release,n.hitch(this,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;this._dataChanged&&(this._dataChanged=!1,this._coloringChanged=this._groupingChanged=!0);this._groupingChanged&&(this._groupingChanged=!1,this._set("rootItem",null),this._updateTreeMapHierarchy(),a=!0);this._rootItemChanged&&(this._rootItemChanged=!1,a=!0);this._coloringChanged&&(this._coloringChanged=!1,null!=this.colorModel&&null!=this._data&&this.colorModel.initialize&&this.colorModel.initialize(this._data,n.hitch(this,function(a){return this.colorFunc(a,
this.store)})));this._areaChanged&&(this._areaChanged=!1,this._removeAreaForGroup());if(void 0!=this.domNode&&null!=this._items){a&&q.empty(this.domNode);var b=this.rootItem,c;if(null!=b){var d=this._getRenderer(b);d&&(this._isLeaf(b)&&(b=d.parentItem),c=d.parentItem)}d=p.getMarginBox(this.domNode);null!=b?this._buildRenderer(this.domNode,c,b,{x:d.l,y:d.t,w:d.w,h:d.h},0,a):this._buildChildrenRenderers(this.domNode,b?b:{__treeRoot:!0,children:this._items},0,a,d)}},_setRootItemAttr:function(a){this._rootItemChanged=
!0;this._set("rootItem",a)},_setStoreAttr:function(a){var b;this._observeHandler&&(this._observeHandler.remove(),this._observeHandler=null);null!=a?(b=a.query(this.query,this.queryOptions),b.observe&&(this._observeHandler=b.observe(n.hitch(this,this._updateItem),!0)),b=A(b,n.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;null==this.groupFuncs&&(this._groupFuncs=null!=a?u.map(a,function(a){return function(b){return b[a]}}):null);this._set("groupAttrs",a)},_setGroupFuncsAttr:function(a){this._groupingChanged=!0;this._set("groupFuncs",this._groupFuncs=a);null==a&&null!=this.groupAttrs&&(this._groupFuncs=u.map(this.groupAttrs,function(a){return function(b){return b[a]}}))},
_setAreaAttrAttr:function(a){this._areaChanged=!0;this._set("areaAttr",a)},areaFunc:function(a,b){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,b){var c=this.labelAttr&&0<this.labelAttr.length?a[this.labelAttr]:null;return c?c.toString():null},tooltipFunc:function(a,b){var c=this.tooltipAttr&&0<this.tooltipAttr.length?a[this.tooltipAttr]:null;return c?c.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,b){var c=this.colorAttr&&0<this.colorAttr.length?a[this.colorAttr]:0;null==c&&(c=0);return parseFloat(c)},_setColorFuncAttr:function(a){this._coloringChanged=!0;this._set("colorFunc",a)},createRenderer:function(a,b,c){a=q.create("div");"header"!=c&&(l.set(a,"overflow","hidden"),l.set(a,"position","absolute"));return a},styleRenderer:function(a,b,c,d){switch(d){case "leaf":l.set(a,
"background",this.getColorForItem(b).toHex());case "header":(b=this.getLabelForItem(b))&&(isNaN(this.labelThreshold)||c<this.labelThreshold)?a.innerHTML=b:q.empty(a)}},_updateTreeMapHierarchy:function(){null!=this._data&&(this._items=null!=this._groupFuncs&&0<this._groupFuncs.length?w.group(this._data,this._groupFuncs,n.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 y(a)},getLabelForItem:function(a){return a.__treeName?
a.__treeName:this.labelFunc(a,this.store)},_buildChildrenRenderers:function(a,b,c,d,g,e){var m=b.children,h=p.getMarginBox(a),h=w.solve(m,h.w,h.h,n.hitch(this,this._computeAreaForItem),!this.isLeftToRight()).rectangles;g&&(h=u.map(h,function(a){a.x+=g.l;a.y+=g.t;return a}));for(var k,f=0;f<m.length;++f)k=h[f],this._buildRenderer(a,b,m[f],k,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,g,e,f){var h=this._isLeaf(c),k=e?null:this._getRenderer(c,f,a),k=h?this._updateLeafRenderer(k,c,g):this._updateGroupRenderer(k,c,g);e&&(k.level=g,k.item=c,k.parentItem=b,this.itemToRenderer[this.getIdentity(c)]=k,this.updateRenderers(c));b=Math.floor(d.x);var m=Math.floor(d.y),l=Math.floor(d.x+d.w+1E-11)-b;d=Math.floor(d.y+d.h+1E-11)-m;e&&q.place(k,a);p.setMarginBox(k,{l:b,t:m,w:l,h:d});h||(a=p.getContentBox(k),
this._layoutGroupContent(k,a.w,a.h,g+1,e,f));this.onRendererUpdated({renderer:k,item:c,kind:h?"leaf":"group",level:g})},_layoutGroupContent:function(a,b,c,d,f,e){var g=r(".dojoxTreeMapHeader",a)[0],h=r(".dojoxTreeMapGroupContent",a)[0];if(null!=g&&null!=h){var k=p.getMarginBox(g);k.h>c?(k.h=c,l.set(h,"display","none")):(l.set(h,"display","block"),p.setMarginBox(h,{l:0,t:k.h,w:b,h:c-k.h}),this._buildChildrenRenderers(h,a.item,d,f,null,e));p.setMarginBox(g,{l:0,t:0,w:b,h:k.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 g=r(".dojoxTreeMapHeader",a)[0],g=this._updateHeaderRenderer(g,b,c);d&&q.place(g,a);g=r(".dojoxTreeMapGroupContent",a)[0];g=this._updateGroupContentRenderer(g,b,c);d&&q.place(g,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,b,!0)},onRendererUpdated:function(){},onItemRollOver:function(){},onItemRollOut:function(){},updateRenderers:function(a){if(a){n.isArray(a)||(a=[a]);for(var b=0;b<a.length;b++){var c=a[b],d=this._getRenderer(c);if(d){var g=this.isItemSelected(c),e=t("ie");if(g){if(f.add(d,"dojoxTreeMapSelected"),e&&(t("quirks")||9>e)){var e=d.previousSibling,m=l.get(d);e&&f.contains(e,"dojoxTreeMapIEHack")||(e=this.createRenderer(c,-10,"group"),f.add(e,"dojoxTreeMapIEHack"),f.add(e,"dojoxTreeMapSelected"),
l.set(e,{position:"absolute",overflow:"hidden"}),q.place(e,d,"before"));var h=2*parseInt(l.get(e,"border-width")),h=this._isLeaf(c)?h-1:h+1;"auto"!=m.left&&l.set(e,{left:parseInt(m.left)+1+"px",top:parseInt(m.top)+1+"px",width:parseInt(m.width)-h+"px",height:parseInt(m.height)-h+"px"})}}else e&&(t("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");g||this._hoveredItem==c?l.set(d,"zIndex",20):l.set(d,"zIndex",7>=t("ie")?0:"auto")}}}}})});