// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.8/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/widgets/SizeSlider/templates/SizeSlider.html":'\x3cdiv class\x3d"${_css.container}"\x3e\n  \x3cdiv data-dojo-attach-point\x3d"_containerNode"\x3e\n    \x3cdiv data-dojo-attach-point\x3d"_titleNode"\x3e\x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"_sliderNode"\x3e\x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"_scaleNode"\x3e\x3c/div\x3e\n  \x3c/div\x3e\n\x3c/div\x3e'}});
define("./Widgette ./RendererSlider ./RendererSlider/sliderUtils ../Color ../core/numberUtils dijit/_TemplatedMixin dojo/_base/lang dojo/debounce dojo/dom-style dojo/dom-construct dojo/dom-class dojox/gfx dojo/text!./SizeSlider/templates/SizeSlider.html".split(" "),function(n,p,k,l,q,r,h,t,d,u,v,g,w){return n.createSubclass([r],{_rampNode:null,_sliderHeight:null,_barsGroup:null,_updateTimer:null,_css:null,_defaultHeight:200,_handles:[0,1],declaredClass:"esri.widgets.SizeSlider",templateString:w,properties:{visualVariable:null,
values:null,minValue:{dependsOn:["statistics"],get:function(){return this.get("statistics.min")||0},set:function(a){if(void 0===a)return this._clearOverride("minValue");this._override("minValue",a)}},maxValue:{dependsOn:["statistics"],get:function(){return this.get("statistics.max")||100},set:function(a){if(void 0===a)return this._clearOverride("maxValue");this._override("maxValue",a)}},minSize:null,maxSize:null,histogram:null,statistics:null,zoomOptions:null,histogramVisible:!0,statisticsVisible:!0,
labelsVisible:!0,ticksVisible:!0,handlesVisible:!0,histogramWidth:100,rampWidth:26,symbolWidth:50,isDate:!1,isRatio:!1},constructor:function(){this._css={container:"esri-size-info-slider",handlerTickSize:"esri-handler-tick-size"};this._attachSymbols=t(this._attachSymbols,0)},postCreate:function(){this.inherited(arguments);this._setUpDataDefaults()},startup:function(){this.inherited(arguments);this._slider=new p({type:"SizeSlider",values:this.values,isDate:this.isDate,minimum:this.zoomOptions?this.zoomOptions.minSliderValue:
this.minValue,maximum:this.zoomOptions?this.zoomOptions.maxSliderValue:this.maxValue,_minZoomLabel:this.zoomOptions?this.minValue:null,_maxZoomLabel:this.zoomOptions?this.maxValue:null,_isZoomed:this.zoomOptions?!0:!1,labelsVisible:this.labelsVisible,ticksVisible:this.ticksVisible,handlesVisible:this.handlesVisible,handles:this._handles},this._sliderNode);this._slider.startup();this._rampNode=this._slider._sliderAreaRight;this._sliderHeight=d.get(this._rampNode,"height")||this._defaultHeight;this._createSVGSurfaces();
this._slider.on("slide",h.hitch(this,function(a){this._fillRamp(a.values)}));this._slider.on("data-change",h.hitch(this,function(a){this._updateVisualVariable(a.values);this.values=a.values;this._fillRamp();this.emit("data-change",{})}));this._slider.on("handle-value-change",h.hitch(this,function(a){this._updateVisualVariable(a.values);this.values=a.values;this._updateRendererSlider();this.emit("handle-value-change",{})}));this._slider.on("data-value-change",h.hitch(this,function(a){this.set({minValue:a.min,
maxValue:a.max});this._updateRendererSlider();this.emit("data-value-change",{})}));this._slider.on("stop",h.hitch(this,function(){this.emit("handle-value-change",{})}));this._slider.on("zoom-out",h.hitch(this,function(){this.zoomOptions=null}));this.statistics&&this.statisticsVisible&&this._generateStatistics();this.histogramVisible&&(this.histogram||this.zoomOptions&&this.zoomOptions.histogram)&&this._generateHistogram();this.watch("minValue, maxValue, symbol, visualVariable, minSize, maxSize, statistics, histogram, zoomOptions",
this._updateTimeout);this.watch("histogramVisible",this._toggleHistogram);this.watch("zoomOptions",this._zoomEventHandler)},destroy:function(){this._slider&&this._slider.destroy();this._avgHandleObjs&&this._avgHandleObjs.avgHandleTooltip&&this._avgHandleObjs.avgHandleTooltip.destroy();this.countTooltips&&this.countTooltips.forEach(function(a){a.destroy()})},refresh:function(){this._updateTimeout()},_updateTimeout:function(){this._updateRendererSlider()},_updateRendererSlider:function(){var a=this.visualVariable;
this.set({minSize:a.minSize,maxSize:a.maxSize,values:[a.minDataValue<this.minValue?this.minValue:a.minDataValue,a.maxDataValue>this.maxValue?this.maxValue:a.maxDataValue]});null!==this.zoomOptions&&!1!==this.zoomOptions?(this.toggleSliderBottom=this.zoomOptions.minSliderValue>this.minValue,this.toggleSliderTop=this.zoomOptions.maxSliderValue<this.maxValue,this._slider.set({minimum:this.zoomOptions.minSliderValue,maximum:this.zoomOptions.maxSliderValue,_minZoomLabel:this.minValue,_maxZoomLabel:this.maxValue,
_isZoomed:!0})):this._slider.set({minimum:this.minValue,maximum:this.maxValue,_minZoomLabel:null,_maxZoomLabel:null,_isZoomed:!1});this._slider.set("values",this.values);this._slider._reset();this._slider._updateRoundedLabels();this._slider._generateMoveables();this._clearRect();this._createSVGSurfaces();this.statistics&&this.statisticsVisible&&this._generateStatistics();this.histogramVisible&&(this.histogram||this.zoomOptions&&this.zoomOptions.histogram)&&this._generateHistogram()},_updateVisualVariable:function(a){this.set({"visualVariable.minDataValue":a[0],
"visualVariable.maxDataValue":a[1]})},_zoomEventHandler:function(){this.emit("zoom",{zoomed:!!this.zoomOptions})},_setUpDataDefaults:function(){var a=this.visualVariable;this.set({minSize:a.minSize,maxSize:a.maxSize});null!==this.zoomOptions&&!1!==this.zoomOptions&&(this.toggleSliderBottom=this.zoomOptions.minSliderValue>this.minValue,this.toggleSliderTop=this.zoomOptions.maxSliderValue<this.maxValue);null===a.minDataValue&&null===a.maxDataValue||0===a.minDataValue&&0===a.maxDataValue?null===this.minValue&&
null===this.maxValue&&this.set({minValue:0,maxValue:100,values:[20,80]}):this.minValue===this.maxValue?0===this.minValue?this.set({maxValue:100,values:[20,80]}):null===this.minValue?this.set({minValue:0,maxValue:100,values:[20,80]}):this.set({minValue:0,maxValue:2*this.minValue,values:[this.maxValue/5,this.maxValue/5*4]}):this.values=[a.minDataValue<this.minValue?this.minValue:a.minDataValue,a.maxDataValue>this.maxValue?this.maxValue:a.maxDataValue];null===this.minValue&&(this.minValue=0);null===
this.maxValue&&(this.maxValue=100)},_createSVGSurfaces:function(){this._proportionalSymbolSurface=g.createSurface(this._rampNode,this.rampWidth,this._sliderHeight);this._surfaceRect=this._proportionalSymbolSurface.createRect({width:this.rampWidth,height:this._sliderHeight});this._histogramSurface=k.generateHistogramSurface(this._rampNode,this.histogramWidth,this._sliderHeight,this.rampWidth);this._fillRamp();this._attachSymbols()},_attachSymbols:function(){this._attachSymbol(this._slider.moveables[0],
this.minSize,"min");this._attachSymbol(this._slider.moveables[1],this.maxSize,"max")},_attachSymbol:function(a,b){var e=d.get(a.handleContainer,"height"),c=this.symbol||{type:"custom"};a.symbol||(a.symbol=u.create("div",{style:"position: absolute; left: 10px;"},a));switch(c.type){case "simple-line":b=b===this.minSize?5:13;this._generateLineSymbol(a,b,e);break;case "simple-marker":b=b===this.minSize?12:48;this._generateCircleSymbol(a.symbol,b,e);break;default:b=b===this.minSize?12:48,this._generateCircleSymbol(a.symbol,
b,e)}return a.symbol},_generateLineSymbol:function(a,b,e){var c=a.symbol;v.add(a.tick,this._css.handlerTickSize);d.set(c,"top",e/2-b+"px");d.set(c,"height",2*b+"px");d.set(c,"width",b-4+"px");c.innerHTML="";a=g.createSurface(c);a.rawNode.style.position="absolute";a.rawNode.style.top=1===b?"1px":b/2+"px";this.isLeftToRight()||(a.rawNode.style.left="-45px");a.setDimensions(this.rampWidth,b);a.createRect({width:this.rampWidth,height:b}).setFill(new l([0,121,193,.8]));return a},_generateCircleSymbol:function(a,
b,e){var c=b/2;b=12===b?!0:!1;var m=this.isLeftToRight();d.set(a,"top",e/2-(c+1)+"px");d.set(a,"height",2*(c+1)+"px");d.set(a,"width",b?2*(c+1):c+"px");d.set(a,"left",b?"8px":"10px");a.innerHTML="";a=g.createSurface(a);a.rawNode.style.position="absolute";m||(a.rawNode.style.left=b?"-35px":"-53px");b?(a.setDimensions(2*(c+1),2*(c+1)),a.createCircle({cx:7,cy:c+1,r:c}).setFill(new l([0,121,193,.8])).setStroke("#fff")):(a.setDimensions(c+1,2*(c+1)),a.createCircle({cx:m?0:23,cy:c+1,r:c}).setFill(new l([0,
121,193,.8])).setStroke("#fff"));return a},_fillRamp:function(a){var b=this._slider,e=this._sliderHeight,c=Math.round(e-((a?a[0]:b.values[0])-b.minimum)/(b.maximum-b.minimum)*e);a=Math.round(e-((a?a[1]:b.values[1])-b.minimum)/(b.maximum-b.minimum)*e);b=this.rampWidth;this.isLeftToRight()?(this._proportionalSymbolSurface.clear(),this._proportionalSymbolSurface.createPath().moveTo(b,0).lineTo(b,a).lineTo(10,c).lineTo(10,e).lineTo(0,e).lineTo(0,0).closePath().setFill("#9a9a9a")):(this._proportionalSymbolSurface.clear(),
this._proportionalSymbolSurface.createPath().moveTo(b,0).lineTo(b,e).lineTo(b-10,e).lineTo(b-10,c).lineTo(0,a).lineTo(0,0).closePath().setFill("#9a9a9a"));d.set(this._proportionalSymbolSurface.rawNode,"overflow","visible");d.set(this._proportionalSymbolSurface.rawNode,"background-color","#d9d9d9");null!==this.zoomOptions&&!1!==this.zoomOptions&&(this.toggleSliderBottom&&this.toggleSliderTop?(this._proportionalSymbolSurface.createPath("M0,1 L6.25,-1 L12.5,1 L18.75,-1 L25,1").setStroke({color:"#fff",
width:3}).setTransform(g.matrix.translate(0,5)),this._proportionalSymbolSurface.createPath("M0,1 L6.25,-1 L12.5,1 L18.75,-1 L25,1").setStroke({color:"#fff",width:3}).setTransform(g.matrix.translate(0,195))):this.toggleSliderBottom?this._proportionalSymbolSurface.createPath("M0,1 L6.25,-1 L12.5,1 L18.75,-1 L25,1").setStroke({color:"#fff",width:3}).setTransform(g.matrix.translate(0,195)):this.toggleSliderTop&&this._proportionalSymbolSurface.createPath("M0,1 L6.25,-1 L12.5,1 L18.75,-1 L25,1").setStroke({color:"#fff",
width:3}).setTransform(g.matrix.translate(0,5)))},_clearRect:function(){this._proportionalSymbolSurface.destroy();this._histogramSurface.destroy()},_showHistogram:function(){this.histogram||this.zoomOptions&&this.zoomOptions.histogram?this._generateHistogram():this._barsGroup&&(this._barsGroup.destroy(),this._barsGroup=null)},_toggleHistogram:function(){this.histogramVisible?(d.set(this._barsGroup.rawNode,"display","inline-block"),this._showHistogram()):d.set(this._barsGroup.rawNode,"display","none")},
_generateHistogram:function(){var a=this.zoomOptions&&this.zoomOptions.histogram?this.zoomOptions.histogram:this.histogram;this._barsGroup=k.generateHistogram(this._histogramSurface,a,this.histogramWidth,this.rampWidth,this.isLeftToRight());this.countTooltips=k.generateCountTooltips(a,this._barsGroup)},_generateStatistics:function(){if(!(2>this.statistics.count||isNaN(this.statistics.avg))){var a,b=this.statistics;a=this._slider;var e=this.zoomOptions||null,c=k.getPrecision(this.maxValue),d,f;b.min===
b.max&&b.min===b.avg?(d=0,f=2*b.avg):(d=b.min,f=b.max);if(d!==a.minimum||f!==a.maximum)d=a.minimum,f=a.maximum;e&&(d=e.minSliderValue,f=e.maxSliderValue);a=this._sliderHeight*(f-b.avg)/(f-d);b=q.round([b.avg,f,d])[0];this._avgHandleObjs=k.generateAvgLine(this._histogramSurface,b,a,c,this.isLeftToRight(),this.isDate,this.isRatio)}}})});