// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/SymbolStyler/templates/ColorRampPicker.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"${css.container}"\x3e\r\n    \x3cdiv class\x3d"${css.preview} ${css.item}"\r\n         data-dojo-attach-point\x3d"dap_previewRamp"\x3e\x3c/div\x3e\r\n    \x3cimg data-dojo-attach-point\x3d"dap_colorFlipper" tabindex\x3d"0"\r\n         class\x3d"${css.flipper}"/\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"${css.container}"\x3e\r\n    \x3cdiv class\x3d"${css.viewport}"\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"dap_colorRampPicker"\r\n           class\x3d"${css.list}"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n\r\n'}});
define("esri/dijit/SymbolStyler/ColorRampPicker","../../kernel ../_EventedWidget ../_Tooltip ./_DelayedUpdate ./colorRampUtil ./schemeUtil dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dijit/a11yclick dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/dom-class dojo/dom-construct dojo/dom-style dojo/has dojo/on dojo/query dojo/i18n!../../nls/jsapi dojo/text!./templates/ColorRampPicker.html dojo/NodeList-dom dijit/form/Button".split(" "),function(q,f,r,t,g,d,u,v,m,c,w,h,x,n,k,y,l,p,z,A){f=
w("esri.dijit.SymbolStyler.ColorRampPicker",[f,u,v,t,r],{baseClass:"esriColorRampPicker",templateString:A,labels:z.widgets.symbolEditor,css:{item:"esriItem",selected:"esriSelected",container:"esriContainer",list:"esriList",preview:"esriPreview",flipper:"esriFlipper",viewport:"esriViewport"},schemes:null,selected:null,numStops:0,_schemesChanged:!1,_selectedChanged:!1,_numStopsChanged:!1,_orientationChanged:!1,_commitPropsTrigger:null,_colorRampSurfaces:null,_previewRampSurface:null,_rampsAndSchemes:null,
constructor:function(a){this._colorRampSurfaces=[];this._commitPropsTrigger=this.createUpdateTrigger(this._commitProperties,this)},_commitProperties:function(){var a,b;if(this._schemesChanged||this._numStopsChanged)this._numStopsChanged=this._schemesChanged=!1,a=d.getColorRampsWithSchemes(this.schemes,this.numStops),b=this._hasStops(),this._rampsAndSchemes=a,n.empty(this.dap_colorRampPicker),this._colorRampSurfaces=[],c.forEach(a,function(a){this._createColorRampItem({colors:a.colors,hasStops:b})},
this),this._renderSuggestions();this._selectedChanged&&(this._selectedChanged=!1,this._renderSelected());this._orientationChanged&&(this._orientationChanged=!1,this._renderSelected(),this._renderSuggestions());this.selected||this.set("selected",this._rampsAndSchemes[0])},_hasStops:function(){return 0<this.numStops},_createColorRampItem:function(a){var b=a.colors;a=a.numClasses;var e=n.create("div",{className:this.css.item,tabIndex:0},this.dap_colorRampPicker),B=k.get(e,"height"),c=k.get(e,"width"),
b=g.createColorRamp({node:e,width:c,height:B,colors:b,numClasses:a});this._colorRampSurfaces.push(b)},_renderSuggestions:function(){var a=this._colorRampSurfaces,b=this._rampsAndSchemes,e=this._hasStops();c.forEach(a,function(a,c){g.updateColorRamp({ramp:a,colors:b[c].colors,hasStops:e})})},_renderSelected:function(){var a=this.selected.colors,b=this.dap_previewRamp,e=k.get(b,"height"),c=k.get(b,"width"),d=this._hasStops();this._previewRampSurface?g.updateColorRamp({ramp:this._previewRampSurface,
colors:a,hasStops:d}):this._previewRampSurface=g.createColorRamp({node:b,height:e,width:c,colors:a,hasStops:d})},getStyle:function(){return this.get("selected")},_setSchemesAttr:function(a){this._schemesChanged=!0;this._set("schemes",d.cloneScheme(a));this._commitPropsTrigger()},_getSelectedAttr:function(){var a=this.selected,b={colors:d._createColors(a.colors)};a.scheme&&(b.scheme=d.cloneScheme(a.scheme));return b},_setSelectedAttr:function(a){h.isArray(a)&&(a={colors:a});this._selectedChanged=!0;
this._set("selected",a);this._commitPropsTrigger();this.emit("color-ramp-change",this.get("selected"))},_getSuggestions:function(){return c.map(this._rampsAndSchemes,function(a){return a.colors})},_setNumStopsAttr:function(a){this._numStopsChanged=!0;this._set("numStops",0<a?a:0);this._commitPropsTrigger()},postCreate:function(){this.inherited(arguments);this._addHandlers();this.createTooltips([{node:this.dap_colorFlipper,label:this.labels.flipColorsTooltip},{node:this.dap_colorRampPicker,label:this.labels.selectRampTooltip}])},
_addHandlers:function(){this.own(l(this.dap_colorRampPicker,l.selector("."+this.css.item,m),h.partial(this._rampClickHandler,this)));this.own(l(this.dap_colorFlipper,m,h.hitch(this,function(){this.flipColors()})))},_rampClickHandler:function(a){var b=a.css.selected,c="."+a.css.item,d=p("."+a.css.item,a.dap_colorRampPicker).indexOf(this);p(c,a.dap_colorRampPicker).removeClass(b);x.add(this,b);a.set("selected",a._rampsAndSchemes[d])},flipColors:function(){var a=this._rampsAndSchemes,b=this.selected;
-1===c.indexOf(this._getSuggestions(),b.colors)&&b.colors.reverse();c.forEach(a,function(a){d.flipColors(a.scheme)});this._orientationChanged=!0;this.set("selected",b);this._commitPropsTrigger()},destroy:function(){this.inherited(arguments);c.forEach(this._colorRampSurfaces,function(a){a.destroy()});this._previewRampSurface&&this._previewRampSurface.destroy()}});y("extend-esri")&&h.setObject("dijit.SymbolStyler.ColorRampPicker",f,q);return f});