/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e from"../../Color.js";import{property as i,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 e([0,121,193])};let h=p=class extends a{constructor(t,e){super(t,e),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,e){const{visualVariable:{stops:i},statistics:s}=t,{avg:r,max:a,min:l,stddev:o}=s;return new p({max:a??void 0,min:l??void 0,stops:i,histogramConfig:{average:r??void 0,standardDeviation:o??void 0,bins:e?e.bins:[]}})}updateFromVisualVariableResult(t,e){const{visualVariable:{stops:i},statistics:s}=t,{avg:r,max:a,min:l,stddev:o}=s;this.set({max:a,min:l,stops:i,histogramConfig:{average:r,standardDeviation:o,bins:e?e.bins:[]}})}render(){const{state:t,label:e,visibleElements:i}=this,s="disabled"===t,r=this.classes(c.base,o.widget,o.panel,{[o.disabled]:s,[c.track]:!!i.interactiveTrack});return d("div",{"aria-label":e,class:r},s?null:this.renderContent(this._renderRamp(),c.sliderContainer,c.histogramContainer))}_renderRamp(){const{_bgFillId:t,_rampFillId:e,style:{trackFillColor:i},viewModel:s,zoomOptions:r}=this,a=s.getStopInfo(i);return d("div",{class:c.rampElement},d("svg",{xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderRampFillDefinition(e,a),this.renderBackgroundFillDefinition(t)),d("rect",{fill:`url(#${t})`,height:"100%",width:"100%",x:"0",y:"0"}),d("rect",{fill:`url(#${e})`,height:"100%",width:"100%",x:"0",y:"0"})),r?this.renderZoomCaps():null)}};t([i()],h.prototype,"label",null),t([i(),n("esri/widgets/smartMapping/OpacitySlider/t9n/OpacitySlider")],h.prototype,"messages",void 0),t([i()],h.prototype,"stops",null),t([i()],h.prototype,"style",void 0),t([s("style")],h.prototype,"castStyle",null),t([i({type:l})],h.prototype,"viewModel",void 0),h=p=t([r("esri.widgets.smartMapping.OpacitySlider")],h);const v=h;export{v as default};
