/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{createTask as e}from"../../../core/asyncUtils.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import n from"../../Widget.js";import{css as a}from"../css.js";import{loadArrowDependencies as c,Arrow as l}from"./Arrow.js";import{getRelativeAngleBetweenPoints as d,getPixelXYFromRelativeAngle as m}from"./imageNavigationUtils.js";import p from"./NavigationUIPanoramicViewModel.js";import{tsx as u}from"../../support/widget.js";let g=class extends n{constructor(t){super(t),this.navigate=null,this.viewModel=new p,this._clickTask=null,this._handleClick=t=>{this._clickTask?.abort(),this._clickTask=e(async e=>{const r=t.target;if(!this.navigate||!this.currentNode)return;await i(()=>"compiled"===this.viewModel.state,{signal:e});const s=r.getAttribute("data-direction");o(e),await this.navigate({direction:s,signal:e})})}}loadDependencies(){return c()}set currentNode(t){this.viewModel.currentNode=t}get currentNode(){return this.viewModel.currentNode}get nodes(){return this.viewModel.nodes}set nodes(t){this.viewModel.nodes=t}render(){const{currentNode:t}=this;if(!t)return null;const{towards:e,backwards:o,left:i,right:r,currentHeading:s}=t;return u("div",{class:a.navigationUI},u("div",{class:a.navigationDirectionPad},[e,o,i,r].map((e,o)=>{if(!e)return null;const i=d(t.geometry.x,t.geometry.y,e.geometry.x,e.geometry.y)-s,{x:r,y:n}=m(i);return u(l,{class:a.navigationDirection,"data-direction":t.getDirectionTo(e),icon:"chevron-up",key:o,rotateZ:i,x:r,y:n,onclick:this._handleClick})})))}};t([r()],g.prototype,"currentNode",null),t([r()],g.prototype,"navigate",void 0),t([r({nonNullable:!0})],g.prototype,"nodes",null),t([r()],g.prototype,"viewModel",void 0),t([r()],g.prototype,"_clickTask",void 0),g=t([s("esri.widgets.OrientedImageryViewer.components.NavigationUI360")],g);const v=g;export{v as default};
