/*
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{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.js";import{property as i,subclass as l}from"../../../core/accessorSupport/decorators.js";import r from"../../../geometry/Point.js";import{sanitizeProgress as s,binaryFindClosest as n}from"./elevationProfileGenerationUtils.js";import{convertSamples as a,convertStatistics as p}from"./elevationProfileUnitUtils.js";let u=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>a(t,e)),this._getStatisticsMemoized=o((t,e)=>p(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return s(null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0)}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get indicatorPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.indicatorRelativePosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const i=o.length;if(0===i)return null;const l=o[i-1].distance,s=n(o,t*l,t=>t.distance);if(null==s)return null;const{x:a,y:p,z:u}=s;return null==u?null:new r({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([i()],u.prototype,"available",null),t([i({readOnly:!0})],u.prototype,"profile",null),t([i({readOnly:!0})],u.prototype,"progress",null),t([i()],u.prototype,"samples",null),t([i()],u.prototype,"statistics",null),t([i({constructOnly:!0})],u.prototype,"computation",void 0),t([i()],u.prototype,"rawResult",void 0),t([i()],u.prototype,"indicatorPoint",null),u=t([l("esri.views.analysis.ElevationProfile.ElevationProfileResult")],u);export{u as default};
