/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import{createTask as r}from"../../../core/asyncUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{watch as i,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{updateDirectionalNodesGeneric as h,updateDirectionalNodesWithSameView as c}from"./imageNavigationUtils.js";import n from"./NavigationUIPanoramicViewModel.js";let d=class extends n{constructor(e){super(e),this.cameraHeadingThreshold=0,this.cameraPitchThreshold=0,this.preserveAngle="none"}initialize(){this.addHandles(this.createCompileHandle())}createCompileHandle(){return i(()=>({nodes:this.nodes,currentNode:this.currentNode,length:this.nodes.length,currentHeading:this.currentNode?.currentHeading,currentPitch:this.currentNode?.currentPitch,preserveAngle:this.preserveAngle,cameraHeadingThreshold:this.cameraHeadingThreshold,cameraPitchThreshold:this.cameraPitchThreshold}),()=>{this._compileTask?.abort(),this._compileTask=r(async e=>{t(e),this.compile()})},o)}compile(){const{nodes:e}=this;if(e.length)switch(this.preserveAngle){case"heading":e.forEach(r=>c(r,e,this.cameraHeadingThreshold,null));break;case"pitch":e.forEach(r=>c(r,e,null,this.cameraPitchThreshold));break;case"both":e.forEach(r=>c(r,e,this.cameraHeadingThreshold,this.cameraPitchThreshold));break;default:e.forEach(r=>h(r,e))}}};e([s()],d.prototype,"cameraHeadingThreshold",void 0),e([s()],d.prototype,"cameraPitchThreshold",void 0),e([s()],d.prototype,"preserveAngle",void 0),d=e([a("esri.widgets.OrientedImageryViewer.components.NavigationUIViewModel")],d);const l=d;export{l as default};
