/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import o from"./Analysis.js";import t from"./ElevationProfile/ElevationProfileDisplayUnits.js";import i from"./ElevationProfile/ElevationProfileGroup.js";import r from"./ElevationProfile/ElevationProfileLineGround.js";import s from"./ElevationProfile/ElevationProfileLineInput.js";import l from"./ElevationProfile/ElevationProfileLineQuery.js";import n from"./ElevationProfile/ElevationProfileLineScene.js";import a from"./ElevationProfile/ElevationProfileViewOptions.js";import p from"../core/Accessor.js";import{equals as f}from"../core/arrayUtils.js";import m from"../core/Collection.js";import{referenceSetter as y}from"../core/collectionUtils.js";import v from"../core/Logger.js";import{equalsMaybe as u}from"../core/maybe.js";import{property as h,subclass as c}from"../core/accessorSupport/decorators.js";import g from"../geometry/Polyline.js";import{geometryEquals as d}from"../layers/graphics/dehydratedFeatureComparison.js";import{getGraphicEffectiveElevationInfo as P}from"../support/elevationInfoUtils.js";import E from"../symbols/support/ElevationInfo.js";import{isValidInputPath as j}from"../views/analysis/ElevationProfile/elevationProfileGeometryUtils.js";const w={base:p,key:"type",typeMap:{ground:r,input:s,query:l,scene:n,group:i},errorContext:"elevation-profile-line"},I=m.ofType(w);let U=class extends o{constructor(e){super(e),this.type="elevation-profile",this.geometry=null,this.displayUnits=new t,this.viewOptions=new a,e?.profiles||(this.profiles=new m([new r]))}initialize(){const e=e=>!e?.declaredClass?.startsWith("esri.widgets.ElevationProfile")||(v.getLogger(this).errorOnce("Classes from the 'esri/widgets/ElevationProfile' namespace are meant for use with the Elevation Profile widget and are not supported in the 'profiles' collection of the ElevationProfileAnalysis. Use classes from 'esri/analysis/ElevationProfile' instead."),!1);this.profiles.on("before-changes",o=>{e(o.item)||o.preventDefault()});for(const o of Array.from(this.profiles))e(o)||this.profiles.remove(o)}get elevationInfo(){return this._get("elevationInfo")}set elevationInfo(e){this._set("elevationInfo",e)}get profiles(){return this._get("profiles")}set profiles(e){const o=this._get("profiles"),t=e??new m;this._set("profiles",y(t,o))}get valid(){return j(this.geometry)}equals(e){return this===e||super.equals(e)&&d(this.geometry,e.geometry)&&u(this.elevationInfo,e.elevationInfo)&&f(this.profiles.toArray(),e.profiles.toArray(),(e,o)=>e.equals(o))&&this.displayUnits.equals(e.displayUnits)&&this.viewOptions.equals(e.viewOptions)}clear(){this.geometry=null,this.elevationInfo=null}setGeometryFromFeature(e){e.geometry&&"polyline"===e.geometry.type?(this.geometry=e.geometry,this.elevationInfo=new E({...P(e)})):v.getLogger(this).errorOnce("The feature's geometry must be a polyline to set it as the geometry of the ElevationProfileAnalysis.")}};e([h({type:["elevation-profile"]})],U.prototype,"type",void 0),e([h({type:g})],U.prototype,"geometry",void 0),e([h({type:E})],U.prototype,"elevationInfo",null),e([h({type:I,nonNullable:!0})],U.prototype,"profiles",null),e([h({type:t,nonNullable:!0})],U.prototype,"displayUnits",void 0),e([h()],U.prototype,"valid",null),e([h({type:a,nonNullable:!0})],U.prototype,"viewOptions",void 0),U=e([c("esri.analysis.ElevationProfileAnalysis")],U);const b=U;export{b as default};
