text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See http://js.arcgis.com/3.15/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.
  
  //>>built
  define("dojo/_base/declare ./CustomColorItem dojo/Evented dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/on dojo/_base/html dojo/_base/lang ../../../utils".split(" "),function(g,d,h,k,l,m,e,f,n,p){return g([k,l,m,h],{baseClass:"infographic-custom-color-list",templateString:'\x3cdiv\x3e\x3cdiv class\x3d"costom-color-list-header"\x3e\x3cdiv title\x3d"${nls.category}"\x3e${nls.category}\x3c/div\x3e\x3cdiv title\x3d"${nls.labelAxis}"\x3e${nls.labelAxis}\x3c/div\x3e\x3cdiv title\x3d"${nls.color}"\x3e${nls.color}\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"costom-color-list" data-dojo-attach-point\x3d"colorList"\x3e\x3c/div\x3e\x3cdiv class\x3d"costom-color-list" data-dojo-attach-point\x3d"otherList"\x3e\x3c/div\x3e\x3c/div\x3e',
  constructor:function(a){this.inherited(arguments);this._colorItems=[];this._otherItems=[];a.nls&&(this.nls=a.nls);this.others=[{text:this.nls.nullText,label:this.nls.nullText,id:"null",color:"#808080"},{text:this.nls.others,label:this.nls.others,id:"others",color:"#808080"}]},setConfig:function(a){if(a&&Array.isArray(a.categories)){this.clear();var b=a.categories;b=this._removeDuplicateCategories(b);var c=a.others;a.others&&a.others.length||(c=n.clone(this.others));this._setCategories(b);this._setOthers(c)}},
  setColors:function(a){this._colors=a;this._colorItems.length&&(this._ignoreEvent(),this._colorItems.forEach(function(b){var c=p.getNextColor(this._colors,this._lastColor);this._lastColor=c;b.setColor(c)}.bind(this)),this._careEvent(),this._onChange())},setNumberType:function(a){this.numberType=a;this._colorItems.length&&this._colorItems.forEach(function(b){b.setNumberType(a)}.bind(this))},_setCategories:function(a){a.forEach(function(b){this.addNewColorItem(b)}.bind(this))},_setOthers:function(a){a&&
  a.length&&a.forEach(function(b){this._addOtherColorItem(b,"others"===b.id)}.bind(this))},clear:function(){f.empty(this.colorList);f.empty(this.otherList);this._colorItems=[];this._otherItems=[]},_addOtherColorItem:function(a,b){b=new d({nls:this.nls,deletable:!1,labelVisible:!b,numberType:!1});b.placeAt(this.otherList);b.setConfig(a);this._otherItems.push(b);this._bindEvent(b)},getListIds:function(){return this._colorItems.map(function(a){return this.numberType?Number(a.itemId):a.itemId}.bind(this))},
  addNewColorItem:function(a,b){var c=new d({nls:this.nls,numberType:this.numberType});c.placeAt(this.colorList);c.setConfig(a);b&&c.highLight();this._colorItems.push(c);this._bindEvent(c);this._onChange()},_bindEvent:function(a){this.own(e(a,"change",function(){this._onChange()}.bind(this)));this.own(e(a,"delete",function(b){this._colorItems=this._colorItems.filter(function(c){return c.itemId!==b}.bind(this));this._onChange();this.emit("delete",b)}.bind(this)))},getConfig:function(){if(!this._colorItems.length&&
  !this._otherItems.length)return!1;var a=this._colorItems.map(function(c){return c.getConfig()});a=a.filter(function(c){return!!c});var b=this._otherItems.map(function(c){return c.getConfig()});b=b.filter(function(c){return!!c});return{categories:a,others:b}},_removeDuplicateCategories:function(a){if(!a||2>a.length)return a;var b={};return a.filter(function(c){c=c.id;return b[c]?!1:(b[c]=1,!0)})},_ignoreEvent:function(){this.ignoreChangeEvents=!0},_careEvent:function(){this.ignoreChangeEvents=!1},
  _onChange:function(){if(!this.ignoreChangeEvents){var a=this.getConfig();a&&this.emit("change",a)}}})});