/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import i from"../../Color.js";import{property as e,cast as s,subclass as r}from"../../core/accessorSupport/decorators.js";import a from"./SmartMappingSliderBase.js";import l from"./OpacitySlider/OpacitySliderViewModel.js";import{globalCss as o}from"../support/globalCss.js";import{messageBundle as n,tsx as d}from"../support/widget.js";var p;const m="esri-opacity-slider",c={base:m,rampElement:`${m}__ramp`,sliderContainer:`${m}__slider-container`,histogramContainer:`${m}__histogram-container`,track:`${m}--interactive-track`},g={trackFillColor:new i([0,121,193])};let h=p=class extends a{constructor(t,i){super(t,i),this.messages=null,this.style={...g},this.viewModel=new l,this._rampFillId=`${this.id}-ramp-fill`,this._bgFillId=`${this.id}-bg-fill`}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}castStyle(t){return{...g,...t}}static fromVisualVariableResult(t,i){const{visualVariable:{stops:e},statistics:s}=t,{avg:r,max:a,min:l,stddev:o}=s;return new p({max:a??void 0,min:l??void 0,stops:e,histogramConfig:{average:r??void 0,standardDeviation:o??void 0,bins:i?i.bins:[]}})}updateFromVisualVariableResult(t,i){const{visualVariable:{stops:e},statistics:s}=t,{avg:r,max:a,min:l,stddev:o}=s;this.set({max:a,min:l,stops:e,histogramConfig:{...this.histogramConfig,average:r,standardDeviation:o,bins:i?i.bins:[]}})}render(){const{state:t,label:i,visibleElements:e}=this,s="disabled"===t,r=this.classes(c.base,o.widget,o.panel,{[o.disabled]:s,[c.track]:!!e.interactiveTrack});return d("div",{"aria-label":i,class:r},s?null:this.renderContent(this._renderRamp(),c.sliderContainer,c.histogramContainer))}_renderRamp(){const{_bgFillId:t,_rampFillId:i,style:{trackFillColor:e},viewModel:s,zoomOptions:r}=this,a=s.getStopInfo(e);return d("div",{class:c.rampElement},d("svg",{xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderRampFillDefinition(i,a),this.renderBackgroundFillDefinition(t)),d("rect",{fill:`url(#${t})`,height:"100%",width:"100%",x:"0",y:"0"}),d("rect",{fill:`url(#${i})`,height:"100%",width:"100%",x:"0",y:"0"})),r?this.renderZoomCaps():null)}};t([e()],h.prototype,"label",null),t([e(),n("esri/widgets/smartMapping/OpacitySlider/t9n/OpacitySlider")],h.prototype,"messages",void 0),t([e()],h.prototype,"stops",null),t([e()],h.prototype,"style",void 0),t([s("style")],h.prototype,"castStyle",null),t([e({type:l})],h.prototype,"viewModel",void 0),h=p=t([r("esri.widgets.smartMapping.OpacitySlider")],h);const v=h;export{v as default};
