/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import e from"../../../core/Handles.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{HoveredPoints as s}from"./HoveredPoints.js";import{InputRepresentation2D as o}from"./InputRepresentation2D.js";import{ProfileLine2D as r}from"./ProfileLine2D.js";class h{constructor(t,h){this._handles=new e,this._inputRepresentation=new o({view:t}),this._hoveredPoints=new s({view:t}),this._profileLine=new r({view:t}),this._handles.add([i(()=>h.viewModel.hoveredPoints,e=>this._hoveredPoints.update(e),n),i(()=>{const{state:e,highlightEnabled:t,viewModel:i}=h;return{input:i.input,state:e,highlightEnabled:t}},e=>this._updateInputRepresentation(e),n),i(()=>h.viewModel.chartData,e=>this._profileLine.update(e),n),i(()=>h.viewModel.input?.geometry,()=>{this._profileLine.remove()},n)])}destroy(){this._handles=t(this._handles),this._inputRepresentation=t(this._inputRepresentation),this._hoveredPoints=t(this._hoveredPoints),this._profileLine=t(this._profileLine)}_updateInputRepresentation({input:e,state:t,highlightEnabled:i}){"selected"===t&&i?this._inputRepresentation.update(e):this._inputRepresentation.remove()}}export{h as ElevationProfileView2D};
