/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
import c from"./IEWQL27P.js";import{a as m}from"./B7UYEEQJ.js";import b from"./PXNZ6E2J.js";import a from"./K2TY4WFO.js";import{g as u}from"./SRDD32D4.js";import"./EPSDPGVP.js";import{b as p}from"./IMJMO6DB.js";import{J as h,K as d,M as g,P as v,a as l,b as e,s as n}from"./RNRMSLW5.js";import"./G6QKOIC3.js";export default $arcgis.t(([x,,{a:o},w])=>{var T=l`.arcgis-button{--calcite-icon-color: var(--calcite-color-text-3);--calcite-button-background-color: var(--calcite-color-foreground-1);color:var(--calcite-color-text-3);line-height:var(--calcite-font-line-height-relative-tight);display:flex;flex-flow:column;cursor:pointer;background-color:var(--calcite-color-foreground-1);font-size:var(--calcite-font-size);:hover{--calcite-icon-color: var(--calcite-color-text-1);--calcite-button-background-color: var(--calcite-color-transparent-hover)}calcite-button{width:var(--calcite-spacing-xxxl);height:var(--calcite-spacing-xxxl)}}:host{width:var(--calcite-spacing-xxxl);height:var(--calcite-spacing-xxxl)}`,f={base:"track",button:"arcgis-button"},y=w(x),r=class extends h{constructor(){super(...arguments),this.messages=m(),this.viewModel=y(this),this.view=this.viewModel.view,this.autoDestroyDisabled=!1,this.error=this.viewModel.error,this.geolocationOptions=this.viewModel.geolocationOptions,this.goToOverride=this.viewModel.goToOverride,this.goToLocationDisabled=this.viewModel.goToLocationEnabled,this.graphic=this.viewModel.graphic,this.icon="compass-north-circle",this.positionFilterFunction=this.viewModel.positionFilterFunction,this.rotationDisabled=this.viewModel.rotationEnabled,this.scale=this.viewModel.scale,this.state=this.viewModel.state,this.tracking=this.viewModel.tracking,this.arcgisComplete=o(()=>this.viewModel,"track"),this.arcgisError=o(()=>this.viewModel,"track-error"),this.arcgisPropertyChange=u()("state"),this.arcgisReady=n()}static{this.properties={view:0,autoDestroyDisabled:5,error:1,geolocationOptions:1,goToOverride:0,goToLocationDisabled:7,graphic:0,icon:1,label:1,messageOverrides:0,position:3,positionFilterFunction:0,referenceElement:1,rotationDisabled:5,scale:9,state:3,tracking:4}}static{this.styles=T}async destroy(){await this.manager.destroy()}async start(){this.viewModel.start()}async stop(){this.viewModel.stop()}_localizeError(t){if(t instanceof GeolocationPositionError)return t.code===GeolocationPositionError.PERMISSION_DENIED?this.messages?.permissionError:t.code===GeolocationPositionError.TIMEOUT?this.messages?.timeoutError:this.messages?.positionUnavailable;if(t instanceof Error)return t.message}_toggleTracking(){if(!this.viewModel)return;let{state:t}=this.viewModel;if(!(t==="feature-unsupported"||t==="disabled")){if(t==="tracking"||t==="waiting"){this.viewModel.stop();return}this.viewModel.start()}}render(){let{viewModel:t,messages:s,icon:b}=this,i=t?.state,M=i==="tracking",a=this._localizeError(this.viewModel?.error),c=(M?s?.stopTracking:s?.startTracking)??"",E=i==="feature-unsupported",k=(i==="tracking"?"pause":void 0)??b??void 0;return e`<div class=${d(p(f.base,f.button))}>${!E&&e`<calcite-button .disabled=${i==="disabled"} .iconStart=${k} kind=neutral .label=${c} .loading=${i==="waiting"} @click=${this._toggleTracking} title=${c??g}></calcite-button>`||""}${a?e`<calcite-tooltip open overlay-positioning=fixed .referenceElement=${this.el}>${a}</calcite-tooltip>`:null}</div>`}};v("arcgis-track",r);return r},"widgets/Track/TrackViewModel",a,b,c)