/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{generateUUID as o}from"../../../core/uuid.js";import{property as t,subclass as i}from"../../../core/accessorSupport/decorators.js";import{formatDuration as s}from"../../../intl/duration.js";import r from"../../Widget.js";import{discreteConfiguratorCss as l}from"../css.js";import{ColorPicker as c}from"../../support/ColorPicker.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{messageBundle as a,tsx as p}from"../../support/widget.js";let d=class extends r{constructor(e){super(e),this.colorPickerVisible=!0,this.timeIntervalVisible=!0,this.colorPickerLabel=void 0,this._selectId=`select-${o()}`,this._colorPickerId=`color-picker-${o()}`,this._onColorChange=e=>{this.options.color=e}}loadDependencies(){return n({label:()=>import("@esri/calcite-components/dist/components/calcite-label"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select")})}render(){const e=this._messages.discrete,o=e.intervalLabel,{color:t,interval:i,intervalOptions:r}=this.options,{colorPickerLabel:n}=this;return p("div",{class:l.base},this.timeIntervalVisible?p("calcite-label",{for:this._selectId,key:this._selectId,scale:"s"},o,p("calcite-select",{bind:this,id:this._selectId,label:o,scale:"s",onCalciteSelectChange:this._onIntervalChange},r.toArray().map(e=>p("calcite-option",{key:e,selected:e===i,value:String(e)},s(e))))):null,this.colorPickerVisible?p("calcite-label",{for:this._colorPickerId,key:this._colorPickerId,layout:"inline",scale:"s"},p(c,{id:this._colorPickerId,value:t,onChange:this._onColorChange}),n??e.colorLabel):null)}_onIntervalChange(e){const o=parseInt(e.currentTarget.selectedOption?.value,10);Number.isFinite(o)&&(this.options.interval=o)}};e([t()],d.prototype,"options",void 0),e([t()],d.prototype,"colorPickerVisible",void 0),e([t()],d.prototype,"timeIntervalVisible",void 0),e([t()],d.prototype,"colorPickerLabel",void 0),e([t(),a("esri/widgets/ShadowCast/t9n/ShadowCast")],d.prototype,"_messages",void 0),d=e([i("esri.widgets.ShadowCast.components.DiscreteConfigurator")],d);export{d as DiscreteConfigurator};
