/*
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{EventedAccessor as o}from"../../core/Evented.js";import{when as t,watch as i}from"../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{projectOrLoad as s}from"../../geometry/projectionUtils.js";let c=class extends o{constructor(e){super(e),this.location=null,this.screenLocationEnabled=!1,this.view=null,this.addHandles([t(()=>{const e=this.screenLocationEnabled?this.view:null;return e?[e.size,"3d"===e.type?e.camera:e.viewpoint]:null},()=>this.notifyChange("screenLocation")),i(()=>this.screenLocation,(e,o)=>{null!=e&&null!=o&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const{location:e,view:o,screenLocationEnabled:t}=this,i=o?.spatialReference,n=i?s(e,i).geometry:null;return t&&n&&o?.ready?o.toScreen(n):null}};e([n()],c.prototype,"location",void 0),e([n()],c.prototype,"screenLocation",null),e([n()],c.prototype,"screenLocationEnabled",void 0),e([n()],c.prototype,"view",void 0),c=e([r("esri.widgets.support.AnchorElementViewModel")],c);export{c as default};
