// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/SelectableLegend","dojo/_base/declare dojo/_base/lang dojo/dom-construct dojo/dom-style dojo/on dijit/_WidgetBase dijit/_TemplatedMixin ./TriStateItem ./FlowList".split(" "),function(g,l,e,h,m,n,p,q,r){var t=g(null,{createPresentation:function(a,c,b,f,g){var k=this,d=e.create("div",{"class":"selectableLegendRoot"},b);c=this.canSelect()&&new q(d,{"class":"dijitInline selectableLegendRootCheckbox"});b=e.create("div",{"class":"dijitInline selectableLegendRootColorRect",
style:"background-color:"+a.color+";"});f=e.create("div",{innerHTML:a.label,"class":"dijitInline selectableLegendRootLabel TrimWithEllipses"});this.isRtlPlacement()?(e.place(f,d),e.place(b,d)):(e.place(b,d),e.place(f,d));c&&(c.set("checked",!a.unchecked),c.onClick=function(b){k.onSelectionChanged(a.label,b.checked)});this.getItemMaxWidth()&&h.set(d,"width",this.getItemMaxWidth()+"px");this.setItemWidth(h.get(d,"width"));m(f,"click",function(b){b.stopPropagation();k.onLabelClicked(a,d)});return d},
onSelectionChanged:function(a,c){},onLabelClicked:function(a,c){},canSelect:function(){},isRtlPlacement:function(){},getItemMaxWidth:function(){},setItemWidth:function(a){}});return g([n,p],{templateString:"\x3cdiv class\x3d'esriGESelectableLegend'\x3e\x3cdiv data-dojo-attach-point\x3d'listDiv'\x3e\x3c/div\x3e\x3c/div\x3e",series:null,list:null,allowSelect:!0,showSeriesData:!1,isRtlPlacement:!1,keepItemsTheSameWidth:!1,_isCollectingWidthsFlag:!1,_uncheckedSeriesHash:null,_itemMaxWidth:0,postCreate:function(){var a=
this;this._uncheckedSeriesHash={};var c=l.mixin(new t,{onSelectionChanged:function(b,c){c?delete a._uncheckedSeriesHash[b]:a._uncheckedSeriesHash[b]=!0;a.onSeriesExclusionChanged(a._uncheckedSeriesHash)},onLabelClicked:function(b,c){if(a.showSeriesData)a.onPointLabelClickedAt(void 0!==b.unsortedIndex?b.unsortedIndex:a.list.items.indexOf(b),c);else a.onSeriesLabelClickedAt(a.list.items.indexOf(b),c)},canSelect:function(){return a.allowSelect},isRtlPlacement:function(){return a.isRtlPlacement},getItemMaxWidth:function(){return a._isCollectingWidthsFlag?
0:a._itemMaxWidth},setItemWidth:function(b){a._itemMaxWidth=Math.max(a._itemMaxWidth||0,b||0)}});this.list=new r({"class":"selectableLegendFlowList",itemRenderer:c},this.listDiv);this.own(this.list)},onSeriesLabelClickedAt:function(a,c){},onPointLabelClickedAt:function(a,c){},onSeriesExclusionChanged:function(a){},resetExclusion:function(){this._uncheckedSeriesHash={}},refresh:function(){var a=[],c=this;this.showSeriesData?this.series&&this.series[0]&&this.series[0].data.forEach(function(b){a.push({label:b.name||
"",color:b.fill,unsortedIndex:b.unsortedIndex})}):this.series&&this.series.forEach(function(b){a.push({label:b.name,color:b.data[0].fill,unchecked:!0===c._uncheckedSeriesHash[b.name]})});this._itemMaxWidth=0;this._isCollectingWidthsFlag=!0;this.list.setItems(a);this._isCollectingWidthsFlag=!1;this.keepItemsTheSameWidth&&this.list.refresh()}})});