/*
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","../../Color","../../core/accessorSupport/decorators/aliasOf","../../core/arrayUtils","../../core/has","../../core/accessorSupport/decorators/cast","../../core/accessorSupport/decorators/property","../../core/accessorSupport/decorators/subclass","./SmartMappingSliderBase","./OpacitySlider/OpacitySliderViewModel","../support/widgetUtils","../support/decorators/messageBundle","../support/jsxFactory"],(function(e,t,i,s,r,a,o,l,n,d,p,c,u,g){"use strict";var m;const v={base:"esri-opacity-slider",rampElement:"esri-opacity-slider__ramp",sliderContainer:"esri-opacity-slider__slider-container",histogramContainer:"esri-opacity-slider__histogram-container",track:"esri-opacity-slider--interactive-track",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",widgetIcon:"esri-icon-edit",disabled:"esri-disabled"},y={trackFillColor:new i([0,121,193])};let _=m=function(t){function i(e,i){var s;return(s=t.call(this,e,i)||this)._bgFillId=null,s._rampFillId=null,s.label=void 0,s.messages=null,s.stops=null,s.style={...y},s.viewModel=new p,s.zoomOptions=null,s._rampFillId=`${s.id}-ramp-fill`,s._bgFillId=`${s.id}-bg-fill`,s}e._inheritsLoose(i,t);var s=i.prototype;return s.castStyle=function(e){return{...y,...e}},i.fromVisualVariableResult=function(e,t){const{visualVariable:{stops:i},statistics:s}=e,{avg:r,max:a,min:o,stddev:l}=s;return new m({max:a,min:o,stops:i,histogramConfig:{average:r,standardDeviation:l,bins:t?t.bins:[]}})},s.updateFromVisualVariableResult=function(e,t){const{visualVariable:{stops:i},statistics:s}=e,{avg:r,max:a,min:o,stddev:l}=s;this.set({max:a,min:o,stops:i,histogramConfig:{average:r,standardDeviation:l,bins:t?t.bins:[]}})},s.render=function(){const{state:e,label:t,visibleElements:i}=this,s="disabled"===e,r=this.classes(v.base,v.esriWidget,v.esriWidgetPanel,{[v.disabled]:s,[v.track]:i.interactiveTrack});return g.tsx("div",{"aria-label":t,class:r},s?null:this.renderContent(this.renderRamp(),v.sliderContainer,v.histogramContainer))},s.renderRamp=function(){const{_bgFillId:e,_rampFillId:t,style:{trackFillColor:i},viewModel:s,zoomOptions:r}=this,a=s.getStopInfo(i);return g.tsx("div",{class:v.rampElement},g.tsx("svg",{xmlns:"http://www.w3.org/2000/svg"},g.tsx("defs",null,this.renderRampFillDefinition(t,a),this.renderBackgroundFillDefinition(e)),g.tsx("rect",{x:"0",y:"0",fill:`url(#${e})`,height:"100%",width:"100%"}),g.tsx("rect",{x:"0",y:"0",fill:`url(#${t})`,height:"100%",width:"100%"})),r?this.renderZoomCaps():null)},i}(d.SmartMappingSliderBase);t.__decorate([l.property({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],_.prototype,"label",void 0),t.__decorate([l.property(),u.messageBundle("esri/widgets/smartMapping/OpacitySlider/t9n/OpacitySlider")],_.prototype,"messages",void 0),t.__decorate([s.aliasOf("viewModel.stops")],_.prototype,"stops",void 0),t.__decorate([l.property()],_.prototype,"style",void 0),t.__decorate([o.cast("style")],_.prototype,"castStyle",null),t.__decorate([l.property()],_.prototype,"viewModel",void 0),t.__decorate([s.aliasOf("viewModel.zoomOptions")],_.prototype,"zoomOptions",void 0),_=m=t.__decorate([n.subclass("esri.widgets.smartMapping.OpacitySlider")],_);return _}));
