/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/accessorSupport/decorators/aliasOf","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/property","../../core/accessorSupport/decorators/subclass","../../renderers/support/ClassBreakInfo","./SmartMappingSliderBase","./ClassedColorSlider/ClassedColorSliderViewModel","../support/widgetUtils","../support/decorators/messageBundle","../support/jsxFactory"],(function(e,r,s,i,t,l,o,a,n,d,c,p,u,m){"use strict";var g;const b={base:"esri-classed-color-slider",rampElement:"esri-classed-color-slider__ramp",sliderContainer:"esri-classed-color-slider__slider-container",histogramContainer:"esri-classed-color-slider__histogram-container",track:"esri-classed-color-slider--interactive-track",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",widgetIcon:"esri-icon-edit",disabled:"esri-disabled"};let h=g=function(r){function s(e,s){var i;return(i=r.call(this,e,s)||this)._bgFillId=null,i._rampFillId=null,i.breaks=null,i.label=void 0,i.messages=null,i.viewModel=new c,i._bgFillId=`${i.id}-bg-fill`,i._rampFillId=`${i.id}-linear-gradient`,i}e._inheritsLoose(s,r),s.fromRendererResult=function(e,r){const{renderer:{classBreakInfos:s}}=e,i=s.map((e=>{const r=e.symbol.color;return{min:e.minValue,max:e.maxValue,color:r}}));return new g({breaks:i,histogramConfig:{bins:r?r.bins:[]}})};var i=s.prototype;return i.updateClassBreakInfos=function(e){const r=this.breaks;if(r.length===e.length)return e.map(((e,s)=>{const i=e.symbol;return i.color=r[s].color,new n({minValue:r[s].min,maxValue:r[s].max,symbol:i})}));console.error(`Number of input breakInfos must match number of slider breaks: ${r.length}`)},i.updateFromRendererResult=function(e,r){const{renderer:{classBreakInfos:s}}=e,i=s.map((e=>{const r=e.symbol.color;return{min:e.minValue,max:e.maxValue,color:r}}));this.set({breaks:i}),null!=r&&r.bins&&(this.histogramConfig.bins=r.bins)},i.render=function(){const{state:e,label:r,visibleElements:s}=this,i="disabled"===e,t=this.classes(b.base,b.esriWidget,b.esriWidgetPanel,{[b.disabled]:i,[b.track]:s.interactiveTrack});return m.tsx("div",{"aria-label":r,class:t},i?null:this.renderContent(this.renderRamp(),b.sliderContainer,b.histogramContainer))},i.renderRamp=function(){const{_bgFillId:e,_rampFillId:r,viewModel:s}=this,i=s.getStopInfo();return m.tsx("div",{class:b.rampElement},m.tsx("svg",{xmlns:"http://www.w3.org/2000/svg"},m.tsx("defs",null,this.renderRampFillDefinition(r,i),this.renderBackgroundFillDefinition(e)),m.tsx("rect",{x:"0",y:"0",fill:`url(#${e})`,height:"100%",width:"100%"}),m.tsx("rect",{x:"0",y:"0",fill:`url(#${r})`,height:"100%",width:"100%"})))},s}(d.SmartMappingSliderBase);r.__decorate([s.aliasOf("viewModel.breaks")],h.prototype,"breaks",void 0),r.__decorate([o.property({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],h.prototype,"label",void 0),r.__decorate([o.property(),u.messageBundle("esri/widgets/smartMapping/ClassedColorSlider/t9n/ClassedColorSlider")],h.prototype,"messages",void 0),r.__decorate([o.property()],h.prototype,"viewModel",void 0),h=g=r.__decorate([a.subclass("esri.widgets.smartMapping.ClassedColorSlider")],h);return h}));
