//>>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(w,n,z,G,A,B,C,x,u,q,p,l,m,y,D,E,F,v){return z("dojox.treemap.TreeMap",[D,E,F],{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(x(this.domNode,"mouseover",n.hitch(this,this._onMouseOver)));this.own(x(this.domNode,"mouseout",n.hitch(this,this._onMouseOut)));this.own(x(this.domNode,B.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(f){return this.colorFunc(f,
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;if(null!=b){var c=this._getRenderer(b);if(c){this._isLeaf(b)&&(b=c.parentItem);var d=c.parentItem}}c=p.getMarginBox(this.domNode);null!=b?this._buildRenderer(this.domNode,d,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){this._observeHandler&&(this._observeHandler.remove(),this._observeHandler=null);if(null!=a){var b=a.query(this.query,this.queryOptions);b.observe&&(this._observeHandler=b.observe(n.hitch(this,this._updateItem),!0));b=C(b,n.hitch(this,this._initItems))}else 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?w.map(a,function(b){return function(c){return c[b]}}):null);this._set("groupAttrs",a)},_setGroupFuncsAttr:function(a){this._groupingChanged=!0;this._set("groupFuncs",this._groupFuncs=a);null==a&&null!=this.groupAttrs&&(this._groupFuncs=w.map(this.groupAttrs,function(b){return function(c){return c[b]}}))},
_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&&(m.set(a,"overflow","hidden"),m.set(a,"position","absolute"));return a},styleRenderer:function(a,b,c,d){switch(d){case "leaf":m.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?y.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){if(a.__treeID){var b=a.__treeValue;if(!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 A(a)},getLabelForItem:function(a){return a.__treeName?
a.__treeName:this.labelFunc(a,this.store)},_buildChildrenRenderers:function(a,b,c,d,f,e){var k=b.children,g=p.getMarginBox(a);g=y.solve(k,g.w,g.h,n.hitch(this,this._computeAreaForItem),!this.isLeftToRight()).rectangles;f&&(g=w.map(g,function(r){r.x+=f.l;r.y+=f.t;return r}));for(var h,t=0;t<k.length;++t)h=g[t],this._buildRenderer(a,b,k[t],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,f,e,k){var g=this._isLeaf(c),h=e?null:this._getRenderer(c,k,a);h=g?this._updateLeafRenderer(h,c,f):this._updateGroupRenderer(h,c,f);e&&(h.level=f,h.item=c,h.parentItem=b,this.itemToRenderer[this.getIdentity(c)]=h,this.updateRenderers(c));b=Math.floor(d.x);var t=Math.floor(d.y),r=Math.floor(d.x+d.w+1E-11)-b;d=Math.floor(d.y+d.h+1E-11)-t;e&&q.place(h,a);p.setMarginBox(h,{l:b,t:t,w:r,h:d});g||(a=p.getContentBox(h),
this._layoutGroupContent(h,a.w,a.h,f+1,e,k));this.onRendererUpdated({renderer:h,item:c,kind:g?"leaf":"group",level:f})},_layoutGroupContent:function(a,b,c,d,f,e){var k=u(".dojoxTreeMapHeader",a)[0],g=u(".dojoxTreeMapGroupContent",a)[0];if(null!=k&&null!=g){var h=p.getMarginBox(k);h.h>c?(h.h=c,m.set(g,"display","none")):(m.set(g,"display","block"),p.setMarginBox(g,{l:0,t:h.h,w:b,h:c-h.h}),this._buildChildrenRenderers(g,a.item,d,f,null,e));p.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"),l.add(a,"dojoxTreeMapGroup"));this.styleRenderer(a,b,c,"group");var f=u(".dojoxTreeMapHeader",a)[0];f=this._updateHeaderRenderer(f,b,c);d&&q.place(f,a);f=u(".dojoxTreeMapGroupContent",a)[0];f=this._updateGroupContentRenderer(f,b,c);d&&q.place(f,a);return a},_updateHeaderRenderer:function(a,b,c){null==a&&(a=this.createRenderer(b,c,"header"),l.add(a,"dojoxTreeMapHeader"),l.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"),l.add(a,"dojoxTreeMapLeaf"),l.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"),l.add(a,"dojoxTreeMapGroupContent"),l.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 f=this.isItemSelected(c),e=v("ie");if(f){if(l.add(d,"dojoxTreeMapSelected"),e&&(v("quirks")||9>e)){e=d.previousSibling;var k=m.get(d);e&&l.contains(e,"dojoxTreeMapIEHack")||(e=this.createRenderer(c,-10,"group"),l.add(e,"dojoxTreeMapIEHack"),l.add(e,"dojoxTreeMapSelected"),
m.set(e,{position:"absolute",overflow:"hidden"}),q.place(e,d,"before"));var g=2*parseInt(m.get(e,"border-width"));g=this._isLeaf(c)?g-1:g+1;"auto"!=k.left&&m.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 e&&(v("quirks")||9>e)&&(e=d.previousSibling)&&l.contains(e,"dojoxTreeMapIEHack")&&e.parentNode.removeChild(e),l.remove(d,"dojoxTreeMapSelected");this._hoveredItem==c?l.add(d,"dojoxTreeMapHovered"):l.remove(d,
"dojoxTreeMapHovered");f||this._hoveredItem==c?m.set(d,"zIndex",20):m.set(d,"zIndex",7>=v("ie")?0:"auto")}}}}})});