/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../../../core/Evented.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as a}from"../../../../support/elevationInfoUtils.js";import{viewingModeFromString as m}from"../../../ViewingMode.js";import{EditGeometryOperations as p}from"../../../interactive/editGeometry/EditGeometryOperations.js";const d=Symbol("observerTooltipOperations");let l=class extends e{constructor(t){super(t),this._operations=null}initialize(){this.addHandles(i(()=>this.subTool.observer,t=>this._syncObserver(t),r))}destroy(){this.removeHandles(d),this._operations=o(this._operations)}get operations(){return this._operations}get elevationInfo(){return a}get visible(){return this.subTool.viewshedComputedData?.valid??!1}get isDraped(){return!1}get origin(){return this.subTool.observer}get updating(){return!1}toMap(t){return this.view.toMap(t)}_syncObserver(t){if(null==t)return this.removeHandles(d),this._operations=o(this._operations),void this.emit("committed");const e=this._operations?.data.geometry;if(e===t)return;if(this._operations?.trySetGeometry(t))return this.emit("modified-externally"),void this.emit("committed");this.removeHandles(d),this._operations=o(this._operations);const i=p.fromGeometry(t.clone(),m(this.view.viewingMode));this._operations=i,this.addHandles(i.data.on("change",()=>{const t=i.data.geometry;"point"===t.type&&(this.subTool.observer=t,this.emit("committed"))}),d),this.emit("committed")}};t([s({constructOnly:!0})],l.prototype,"view",void 0),t([s({constructOnly:!0})],l.prototype,"subTool",void 0),l=t([n("esri.views.3d.analysis.Viewshed.ViewshedObserverManipulatedObject3D")],l);export{l as ViewshedObserverManipulatedObject3D};
