// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../Slider/SliderViewModel ./support/utils".split(" "),function(g,h,f,u,v,r,t,q){f=class extends t{constructor(a){super(a);this._initialStopValues=[];this._min=this._max=null;this.hasTimeData=!1;this.inputFormatFunction=(b,c)=>"max"===c?this.getUnzoomedMax().toString():"min"===c?this.getUnzoomedMin().toString():b.toString(); this.inputParseFunction=null;this.labelFormatFunction=b=>{if(this.hasTimeData)return q.formatDateLabel(b);const {max:c,min:d,precision:e}=this;return q.formatNumberLabel(parseFloat(b.toFixed(10kk>b)&&(e.max= Math.max(...d));this.set({...e});this._initialStopValues=d}else this._initialStopValues=null;this._set("stops",a||null);this.notifyChange("values")}get labels(){var {values:a}=this;a=a&&a.length?a.map((d,e)=>this.getLabelForValue(d,"value",e)):[];const b=this.getUnzoomedMax(),c=this.getUnzoomedMin();return{max:this.getLabelForValue(b,"max"),min:this.getLabelForValue(c,"min"),values:a}}get max(){const {breaks:a}=this;return a?.length?a[a.length-1].max:this.max}set max(a){var {zoomOptions:b}=this;if(null!= b?.max){const c=this.values;let d=b.max;ad&&(d=a,b.min=a);if(c&&c.length)for(b=0;bc[b]&&this.setValue(b,a);this._storeZoomMin(d,a)}else this.updateBreakMin(a), this.setMin(a);this.notifyChange("labels")}get state(){const {max:a,min:b,values:c}=this;return null!=a&&null!=b&&0d.max);c.pop();return c}if(2>b?.length)return[];c=this.getValuesFromStops();return[c[0],c[c.length-1]]}set zoomOptions(a){const {zoomingEnabled:b,zoomOptions:c}=this;if(b){if(c){var d=null!=this._max?this._max:this.max;const e=null!=this._min?this._min:this.min;if(a){const {max:k, min:n}=a,l=null!=k,p=null!=n,m=l?a.max:d;d=l?d:null;this._storeZoomMin(p?a.min:e,p?e:null);this._storeZoomMax(m,d)}else this.setMax(d),this.setMin(e),this._max=this._min=null}else if(a){const {max:e,min:k}=a;null!=k&&this._storeZoomMin(a.min,this.min);null!=e&&this._storeZoomMax(a.max,this.max)}this._set("zoomOptions",a);this.notifyChange("max");this.notifyChange("min")}}getStopIndexFromValueIndex(a){const {stops:b}=this,c=this.values[a];return 0===a?c<=this.values[1]?0:b.length-1:1===a?this.values[0]>= c?0:b.length-1:null}getStopChanges(a,b){const c=this.stops;a=this.getStopIndexFromValueIndex(a);const d=this.getValuesFromStops();d[a]=b;const [e,k]=[d[0],d[d.length-1]].sort((p,m)=>p>m?1:-1),n=k-e,l=c.length-1;return d.map((p,m)=>({index:m,value:this.toPrecision(e+m*n/l)}))}setValue(a,b){const {max:c,min:d,values:e}=this,k=e[a];isNaN(b)||k===b||b>c||bn>l?1:-1),a=q.getStopChanges(a[0],a[a.length-1],this._initialStopValues?? []),this.updateStops(a),this.updateBreaks(),this.notifyChange("labels"))}getValuesFromStops(a){return(a||this.stops)?.map(b=>b.hasOwnProperty("ratio")?b.ratio:b.value)}updateBreaks(){const {breaks:a,values:b}=this;a?.length&&b.slice().sort((c,d)=>c>d?1:-1).forEach((c,d)=>{a[d].max=c;null!=a[d+1]&&(a[d+1].min=c)})}updateBreakMax(a){const {breaks:b,max:c,min:d}=this;!isNaN(a)&&c!==a&&null!=d&&a>d&&b?.length&&(b[b.length-1].max=a)}updateBreakMin(a){const {breaks:b,max:c,min:d}=this;!isNaN(a)&&d!==a&& null!=c&&a{d.hasOwnProperty("ratio")?d.ratio=c[e]:d.value=c[e]})}}getUnzoomedMax(){return this.zoomOptions&&null!=this._max?this._max:this.max}getUnzoomedMin(){return this.zoomOptions&&null!=this._min?this._min:this.min}_storeZoomMax(a,b){this._max=b;this.setMax(a)}_storeZoomMin(a,b){this._min=b;this.setMin(a)}};g.__decorate([h.property()], f.prototype,"breaks",null);g.__decorate([h.property()],f.prototype,"stops",null);g.__decorate([h.property()],f.prototype,"hasTimeData",void 0);g.__decorate([h.property()],f.prototype,"inputFormatFunction",void 0);g.__decorate([h.property()],f.prototype,"inputParseFunction",void 0);g.__decorate([h.property()],f.prototype,"labelFormatFunction",void 0);g.__decorate([h.property({readOnly:!0})],f.prototype,"labels",null);g.__decorate([h.property()],f.prototype,"max",null);g.__decorate([h.property()],f.prototype, "min",null);g.__decorate([h.property({readOnly:!0})],f.prototype,"state",null);g.__decorate([h.property()],f.prototype,"thumbsConstrained",void 0);g.__decorate([h.property({readOnly:!0})],f.prototype,"values",null);g.__decorate([h.property()],f.prototype,"zoomingEnabled",void 0);g.__decorate([h.property()],f.prototype,"zoomOptions",null);return f=g.__decorate([r.subclass("esri.widgets.smartMapping.SmartMappingSliderViewModel")],f)});