/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Evented","../../core/Handles","../../core/maybe","../../core/reactiveUtils","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass"],(function(e,o,r,t,n,c,s,i,a,l,p){"use strict";var d;const u=Symbol("anchorHandles");let y=function(o){function r(e){var r;return(r=o.call(this,e)||this)[d]=new t,r.location=null,r.screenLocationEnabled=!1,r.view=null,r[u].add([c.when((()=>n.applySome(r.screenLocationEnabled?r.view:null,(e=>[e.size,"3d"===e.type?e.camera:e.viewpoint]))),(()=>r.notifyChange("screenLocation"))),c.watch((()=>r.screenLocation),((e,o)=>{n.isSome(e)&&n.isSome(o)&&r.emit("view-change")}))]),r}return e._inheritsLoose(r,o),r.prototype.destroy=function(){this.view=null,this[u]=n.destroyMaybe(this[u])},e._createClass(r,[{key:"screenLocation",get:function(){const{location:e,view:o,screenLocationEnabled:r}=this;return r&&n.isSome(e)&&n.isSome(o)&&o.ready?o.toScreen(e):null}}]),r}(r.EventedAccessor);d=u,o.__decorate([s.property()],y.prototype,"location",void 0),o.__decorate([s.property()],y.prototype,"screenLocation",null),o.__decorate([s.property()],y.prototype,"screenLocationEnabled",void 0),o.__decorate([s.property()],y.prototype,"view",void 0),y=o.__decorate([p.subclass("esri.widgets.support.AnchorElementViewModel")],y);return y}));
