/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../Color.js";import{deprecated as o,esriurl as i}from"../../core/deprecate.js";import{EventedAccessor as r}from"../../core/Evented.js";import{handlesGroup as s}from"../../core/handleUtils.js";import has from"../../core/has.js";import l from"../../core/Logger.js";import{memoize as n}from"../../core/memoize.js";import{watch as p,syncAndInitial as a,sync as u}from"../../core/reactiveUtils.js";import{generateUUID as m}from"../../core/uuid.js";import{property as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../geometry/Point.js";import{getConfig as f}from"./support/constants.js";import{binaryFindClosest as v}from"./support/profileUtils.js";import{convertSamples as y,convertStatistics as g}from"./support/unitUtils.js";let b=class extends r{constructor(e){super(e),this.type=null,this.id=m(),this.title=null,this.color=new t("#000000"),this.visible=!0,this._getSamplesMemoized=n((e,t)=>y(e,t)),this._getStatisticsMemoized=n((e,t)=>g(e,t)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null,has("esri-deprecation-warnings")&&!e?.isDefaultLine&&o(l.getLogger(this),"This class is deprecated. Use the Elevation Profile component or the elevation profile analysis directly instead.",{see:[`Elevation Profile component reference: ${i}arcgis-elevation-profile/`,`Esri's move to web components: ${i}components-transition-plan/`],replacement:"ElevationProfileAnalysis or <arcgis-elevation-profile></arcgis-elevation-profile>",warnOnce:!0})}normalizeCtorArgs(e){const{isDefaultLine:t,...o}=e??{};return o}get progress(){return null!=this.result&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){const e=this._viewModel?.hoveredChartPosition;return null!=e?this._getPoint(e):null}get available(){return!0}get hasZ(){const e=this.result;return null!=e&&e.hasZ}get minDemResolution(){return f().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(e){return this._viewModel=e,s([p(()=>e.effectiveUnits,e=>{this.effectiveUnits=e},a),p(()=>[e.input],()=>this._onChange(),u)])}toggleVisibility(e){this.visible=void 0===e?!this.visible:e}_onChange(){this.emit("change")}_getPoint(e){const{samples:t,result:o}=this;if(null==t||null==o)return null;const i=t.length;if(0===i)return null;const r=t[i-1].distance,s=v(t,e*r,e=>e.distance);if(null==s)return null;const{x:l,y:n,z:p}=s;return null==p?null:new d({x:l,y:n,z:p,spatialReference:o.spatialReference})}};e([c({nonNullable:!0})],b.prototype,"id",void 0),e([c()],b.prototype,"title",void 0),e([c({type:t,nonNullable:!0})],b.prototype,"color",void 0),e([c({nonNullable:!0})],b.prototype,"visible",void 0),e([c({readOnly:!0})],b.prototype,"progress",null),e([c({readOnly:!0})],b.prototype,"samples",null),e([c({readOnly:!0})],b.prototype,"statistics",null),e([c()],b.prototype,"hoveredPoint",null),e([c()],b.prototype,"viewVisualizationEnabled",void 0),e([c()],b.prototype,"available",null),e([c()],b.prototype,"result",void 0),e([c()],b.prototype,"effectiveUnits",void 0),e([c()],b.prototype,"numSamplesForPreview",void 0),e([c()],b.prototype,"numSamplesPerChunk",void 0),e([c()],b.prototype,"chartFillEnabled",void 0),e([c()],b.prototype,"chartStrokeWidth",void 0),e([c()],b.prototype,"chartStrokeOffsetY",void 0),e([c({readOnly:!0})],b.prototype,"hasZ",null),e([c({readOnly:!0})],b.prototype,"minDemResolution",null),e([c()],b.prototype,"_viewModel",void 0),b=e([h("esri.widgets.ElevationProfile.ElevationProfileLine")],b);const w=b;export{w as default};
