/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{a as f}from"./EUYSSHX7.js";import{a as v}from"./DHVEHATY.js";import b from"./L4T73YYG.js";import{g as d}from"./2GLF4DQN.js";import"./5AI6MQMZ.js";import a from"./KTDXN3YM.js";import"./ZNBKMZP7.js";import{O as m,P as u,R as s,U as h,a as n,b as l,x as r}from"./IWZQMWZ5.js";import"./ALDX5YZO.js";export default $arcgis.t(([{ignoreAbortErrors:z},{when:w},,{a:g}])=>{function y(t){if(!t)return!1;if(t.type==="3d")return t.ready;if(!t?.ready)return!1;let e=b(t),o=t.constraints?.effectiveMaxScale;return o===0||e>o}function p(t){if(!t)return!1;if(t.type==="3d")return t.ready;if(!t?.ready)return!1;let e=b(t),o=t.constraints?.effectiveMinScale;return o===0||e<o}function b(t){let e=t?.animation?.target;return(e&&"then"in e?void 0:e?.scale)??t?.scale??0}var x=n`.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)}}:host{display:flex;max-width:fit-content}.zoom-out{border-block-start:solid 1px var(--calcite-color-border-1)}.horizontal{flex-flow:row-reverse nowrap}.horizontal .zoom-out{border-block-start:none;border-inline-end:solid 1px var(--calcite-color-border-1)}`,c=class extends m{constructor(){super(...arguments),this.messages=f({}),this._state="disabled",this.view=g(this),this.autoDestroyDisabled=!1,this.icon="magnifying-glass-plus",this.layout="vertical",this.visualScale="m",this.arcgisActionZoom=r(),this.arcgisPropertyChange=d()("state"),this.arcgisReady=r()}static{this.properties={_state:16,view:0,autoDestroyDisabled:5,icon:1,label:1,layout:3,messageOverrides:0,referenceElement:1,visualScale:1,state:32}}static{this.styles=x}get state(){return this._state}async destroy(){await this.manager.destroy()}async zoomIn(){await this.zoomBy(1)}async zoomOut(){await this.zoomBy(-1)}loaded(){this.manager.onLifecycle(()=>[w(()=>this.view?.ready?"ready":"disabled",e=>{this._state=e},{sync:!0,initial:!0})])}async zoomBy(e){let{view:o}=this,a=e===1;if(!(!(a?y(o):p(o))||!o))if(this.arcgisActionZoom.emit({action:a?"zoomIn":"zoomOut"}),o.type==="2d"){let i=o.mapViewNavigation;a?await i.zoomIn():await i.zoomOut()}else await z(o.goTo({zoom:o.zoom+e}))}render(){let e=y(this.view),o=p(this.view),{zoomIn:a,zoomOut:i}=this.messages;return l`<div class=${u({[v.arcgisButton]:!0,horizontal:this.layout==="horizontal"})}><calcite-button class="zoom-in" .disabled=${!e} icon-start=plus kind=neutral .label=${a} @click=${this.zoomIn} .scale=${this.visualScale} title=${a??s}></calcite-button><calcite-button class="zoom-out" .disabled=${!o} icon-start=minus kind=neutral .label=${i} @click=${this.zoomOut} .scale=${this.visualScale} title=${i??s}></calcite-button></div>`}};h("arcgis-zoom",c);return c},"core/promiseUtils","core/reactiveUtils",a,b)