/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as e}from"./ONARC6AZ.js";import{a as h}from"./BM4VSEDV.js";import{b as d}from"./HVT2WBVC.js";import"./UBPOT5V3.js";import"./ISFTCFSJ.js";import{G as n,I as c,J as i,K as p,h as r,i as a}from"./FFF5HUPM.js";import"./EXBEKVP5.js";export default $arcgis.t(([l,{watch:m}])=>{var g=r`:host{display:block}.instant-apps-compass{position:relative;height:100px;border-radius:50%}.instant-apps-compass #instant-compass{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10}.instant-apps-compass #dir-ring{height:100px;width:100px;border-radius:50%;background-color:var(--calcite-color-foreground-1);border:1px solid var(--calcite-color-border-1);position:relative}.instant-apps-compass #dir-ring .dir-heading{position:absolute;--calcite-fab-background-color: transparent;--calcite-fab-text-color: var(--calcite-color-text-1);--calcite-fab-shadow: none}.instant-apps-compass #dir-ring #north{right:37px;top:5px}.instant-apps-compass #dir-ring #east{right:6px;top:38px}.instant-apps-compass #dir-ring #west{left:4px;top:38px}.instant-apps-compass #dir-ring #south{right:38px;bottom:4px}`,u={base:"instant-apps-compass"},o=class extends n{constructor(){super(...arguments),this._messages=h({name:"instant-apps-compass",blocking:!0}),this.rotationWatcherKey="rotationWatcher",this.baseClass=u.base,this.rotation=0}static{this.properties={baseClass:16,rotation:16,view:0}}static{this.styles=g}get view(){return this._view}set view(t){this._view=t,this.handles?.has(this.rotationWatcherKey)&&this.handles?.remove(this.rotationWatcherKey),this.handles?.add(m(()=>t.rotation,s=>{this.rotation=Math.floor(s)}),this.rotationWatcherKey)}load(){this.initializeModules()}disconnectedCallback(){super.disconnectedCallback(),this.handles?.removeAll(),this.handles?.destroy(),this.handles=null}initializeModules(){this.handles=new l}goToHeading(t){let s=this._view.viewpoint.clone();s.rotation=this.decideRotation(t),this._view.goTo(s)}decideRotation(t){switch(t){case"north":return 0;case"east":return 270;case"south":return 180;case"west":return 90}}render(){return a`<div class=${c(this.baseClass)}><arcgis-compass id=instant-compass .view=${this.view}></arcgis-compass>${this.renderDirectionRing()}</div>`}renderDirectionRing(){return e("dir-ring",a`<div id=dir-ring style=${i({transform:`rotate(${this.rotation}deg)`})}>${["north","east","south","west"].map(t=>this._renderHeading(t))}</div>`)}_renderHeading(t){let s=this._messages[t];return e(t,a`<calcite-button scale=s round kind=neutral class="dir-heading" appearance=transparent id=${t??p} style=${i({transform:`rotate(-${this.rotation}deg)`})} @click=${()=>this.goToHeading(t)}>${s.charAt(0).toLocaleUpperCase()}</calcite-button>`)}};d("instant-apps-compass",o);return o},"core/Handles","core/reactiveUtils")