/*
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 e}from"tslib";import t from"../../../core/Accessor.js";import{watch as o,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as n}from"../../../geometry/projectionUtils.js";import{getConfig as l}from"./constants.js";let a=class extends t{constructor(e){super(e),this.visible=!1,this._element=p()}initialize(){this.view.surface?.appendChild(this._element),this.addHandles([o(()=>this.visible&&!!this._screenPoint,e=>{this._element.style.display=e?"block":"none"},i),o(()=>({color:this.line.color.toCss(),zIndex:this._zIndex}),({color:e,zIndex:t})=>{Object.assign(this._element.style,{background:e,zIndex:t.toString()})},i),o(()=>this._screenPoint,e=>{e&&(this._element.style.transform=`translate(${e.x}px, ${e.y}px)`)},i)])}destroy(){this._element.remove()}get updating(){return!1}get _result(){return this.analysisViewData.results.find(e=>e.computation.profile===this.line)}get _zIndex(){const{profiles:e}=this.analysisViewData.analysis,t=e.indexOf(this.line);return e.length-(-1===t?0:t)}get _screenPoint(){const{view:e}=this;"3d"===e.type?(e.commitProperty("size"),e.commitProperty("camera")):e.commitProperty("center");const t=e?.spatialReference,o=t?n(this._result?.hoveredPoint,t).geometry:null;return o&&e?.ready?e.toScreen(o):null}};function p(){const e=document.createElement("div"),{size:t,borderStyle:o,borderColor:i,borderWidth:r,boxShadow:s}=l().hoveredPointsStyle,{style:n}=e;return n.display="block",n.position="absolute",n.top="0",n.left="0",n.contain="strict",n.boxSizing="border-box",n.width=`${t}px`,n.height=`${t}px`,n.marginTop=`-${t/2}px`,n.marginLeft=`-${t/2}px`,n.border=`${o} ${r}px ${i}`,n.borderRadius=`${t}px`,n.boxShadow=s,e}e([r()],a.prototype,"view",void 0),e([r()],a.prototype,"analysisViewData",void 0),e([r()],a.prototype,"line",void 0),e([r()],a.prototype,"visible",void 0),e([r()],a.prototype,"updating",null),e([r()],a.prototype,"_result",null),e([r()],a.prototype,"_zIndex",null),e([r()],a.prototype,"_screenPoint",null),a=e([s("esri.views.analysis.ElevationProfile.ElevationProfileHoveredPointVisualization")],a);export{a as ElevationProfileHoveredPointVisualization};
