/*
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 e}from"tslib";import{property as t,subclass as s}from"../../core/accessorSupport/decorators.js";import{tsx as i}from"../support/widget.js";import l from"./ValuePickerBaseComponent.js";const r="esri-value-picker__label",o={border:`${r}-border`,text:`${r}-text`};let n=class extends l{constructor(e,t){super(e,t),this.items=null,this.type="label"}get canNext(){return!(!this.items||!this.viewModel)&&this.items.findIndex(({value:e})=>e===this.viewModel.values?.[0])!==this.items.length-1}get canPlay(){return null!=this.viewModel&&!!this.items?.length}get canPrevious(){const{items:e,viewModel:t}=this;return!(!e||!t)&&0!==e.findIndex(({value:e})=>e===t.values?.[0])}render(){const{viewModel:e}=this;if(null==e)return i("div",null);const t=this.items?.find(({value:t})=>t===e.values?.[0]);return i("div",{class:r},i("div",{class:o.border},i("div",{class:o.text},t?.label)))}animate(e){this._step(1,e)}next(){this._step(1)}previous(){this._step(-1)}_step(e,t=!1){const{viewModel:s,items:i}=this;if(!i?.length||!s)return;if(!s.values)return void(s.values=[i[0].value]);const l=i.findIndex(({value:e})=>e===s.values[0]);if(-1===l)return void(s.values=[i[0].value]);const r=l+e;r<0||r>=i.length?s.loop||t?s.values=[i[1===e?0:i.length-1].value]:"playing"===s.state&&s.pause():s.values=[i[r].value]}};e([t()],n.prototype,"canNext",null),e([t()],n.prototype,"canPlay",null),e([t()],n.prototype,"canPrevious",null),e([t()],n.prototype,"items",void 0),e([t()],n.prototype,"type",void 0),n=e([s("esri.widgets.ValuePicker.ValuePickerLabel")],n);const a=n;export{a as default};
