// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../core/Accessor ../../core/has ../../core/reactiveUtils ../../core/time ../../core/accessorSupport/decorators/property ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./utils ../support/GoTo".split(" "),function(d,b,f,c,g,e,m,n,h,k,l){b=class extends l.GoToMixin(b){constructor(a){super(a);this.orientation={x:0,y:0,z:0};this.view=null;this._updateForCamera=this._updateForCamera.bind(this);this._updateForRotation=this._updateForRotation.bind(this); this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this.addHandles(c.watch(()=>this.view,this._updateRotationWatcher,c.initial))}destroy(){this.view=null}get canShowNorth(){return k.canShowNorth(this.view)}get state(){return!this.view?.ready||"2d"===this.view.type&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){this.view?.ready&&("2d"===this.view?.type?this.callGoTo({target:{rotation:0},options:{animationMode:"always", duration:g.Milliseconds(f("mapview-essential-goto-duration"))}}):this.callGoTo({target:{heading:0}}))}_updateForRotation(a){void 0!==a&&null!==a&&this._set("orientation",{z:a})}_updateForCamera(a){a&&this._set("orientation",{x:0,y:0,z:-a.heading})}_updateRotationWatcher(a){this.removeAllHandles();a&&this.addHandles("2d"===a.type?c.watch(()=>a?.rotation,this._updateForRotation,c.initial):c.watch(()=>a?.camera,this._updateForCamera,c.initial))}};d.__decorate([e.property({readOnly:!0})],b.prototype, "canShowNorth",null);d.__decorate([e.property({readOnly:!0})],b.prototype,"orientation",void 0);d.__decorate([e.property({readOnly:!0})],b.prototype,"state",null);d.__decorate([e.property()],b.prototype,"view",void 0);return b=d.__decorate([h.subclass("esri.widgets.Compass.CompassViewModel")],b)});