/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{property as a,subclass as e}from"../../../../core/accessorSupport/decorators.js";import r from"../../../../layers/GraphicsLayer.js";import{ElevationProfileInputVisualization2D as o}from"./ElevationProfileInputVisualization2D.js";import{ElevationProfileLineVisualization2D as n}from"./ElevationProfileLineVisualization2D.js";let l=class extends t{constructor(i){super(i),this._graphicsLayer=new r({listMode:"hide",internal:!0})}initialize(){const{view:i,analysisViewData:t}=this;i.map.add(this._graphicsLayer),i.map.layers.reorder(this._graphicsLayer,0),this._inputVisualization=new o({view:i,analysisViewData:t}),this._lineVisualizations=s(()=>t.flatProfiles,s=>new n({view:i,analysisViewData:t,line:s,addGraphic:i=>{i.attributes={index:t.flatProfiles.indexOf(s)},this._graphicsLayer.add(i),this._graphicsLayer.graphics.sort((i,t)=>{const s=i.attributes?.index??0;return(t.attributes?.index??0)-s})}}))}destroy(){this._inputVisualization.destroy(),this._lineVisualizations.destroy(),this._graphicsLayer.graphics.drain(i=>{i.destroyed||i.destroy()}),this._graphicsLayer.removeFromParent(),this._graphicsLayer.destroy()}get updating(){return this._inputVisualization.updating||this._lineVisualizations.some(i=>i.updating)}};i([a()],l.prototype,"view",void 0),i([a()],l.prototype,"analysisViewData",void 0),i([a()],l.prototype,"updating",null),l=i([e("esri.views.2d.analysis.ElevationProfile.ElevationProfileVisualization2D")],l);export{l as ElevationProfileVisualization2D};
