/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
import{a as f}from"./VK24LKXI.js";import b from"./DTE4O2DP.js";import{e as g}from"./LYMDZ73M.js";import"./MG6XDMQJ.js";import"./HITJFSBP.js";import{B as h,E as d,P as p,Q as e,S as r,U as z,a,j as l,k as u}from"./3VKC6PRK.js";export default $geoscene.t(([{ignoreAbortErrors:b},{when:w},{a:y}])=>{var i={base:"geoscene-zoom",horizontalLayout:"geoscene-zoom--horizontal",button:"geoscene-widget--button",zoomIn:"geoscene-zoom__zoom-in",zoomOut:"geoscene-zoom__zoom-out"};function x(t){if(t.type==="3d")return!!t.ready;if(!t?.ready)return!1;let o=v(t),s=t.constraints?.effectiveMaxScale;return s===0||o>s}function I(t){if(t.type==="3d")return!!t.ready;if(!t?.ready)return!1;let o=v(t),s=t.constraints?.effectiveMinScale;return s===0||o<s}function v(t){let o=t?.animation?.target;return(o&&"then"in o?void 0:o?.scale)??t?.scale??0}var Z=l`@layer{geoscene-zoom,.geoscene-zoom{display:flex;flex-flow:column nowrap;box-shadow:0 1px 2px #0000004d}.geoscene-zoom__zoom-out{border-block-start:solid 1px var(--calcite-color-border-1)}.geoscene-zoom--horizontal{flex-flow:row-reverse nowrap}.geoscene-zoom--horizontal .geoscene-zoom__zoom-out{border-block-start:none;border-inline-end:solid 1px var(--calcite-color-border-1)}}`,n=class extends p{constructor(){super(...arguments),this.messages=f({}),this.view=y(this),this.canZoomIn=!1,this.canZoomOut=!1,this.autoDestroyDisabled=!1,this.icon="magnifying-glass-plus",this.layout="vertical",this.position="top-left",this.state="disabled",this.geoscenePropertyChange=g()("state"),this.geosceneReady=h()}static{this.properties={canZoomIn:16,canZoomOut:16,autoDestroyDisabled:5,icon:1,label:1,layout:3,messageOverrides:0,position:1,referenceElement:1,state:3}}static{this.shadowRootOptions=d}static{this.styles=Z}async destroy(){await this.manager.destroy()}async zoomIn(){let{view:o}=this;!this.canZoomIn||!o||(o.type==="2d"?o.mapViewNavigation.zoomIn():b(o.goTo({zoomFactor:2})))}async zoomOut(){let{view:o}=this;!this.canZoomOut||!o||(o.type==="2d"?o.mapViewNavigation.zoomOut():b(o.goTo({zoomFactor:.5})))}loaded(){this.manager.onLifecycle(()=>[w(()=>this.view?.stationary,()=>{this.canZoomIn=x(this.view),this.canZoomOut=I(this.view)},{initial:!0}),w(()=>this.view?.ready?"ready":"disabled",o=>{this.state=o},{sync:!0,initial:!0})])}render(){let o={[i.horizontalLayout]:this.layout==="horizontal"},{canZoomIn:s,canZoomOut:O}=this,{zoomIn:c,zoomOut:m}=this.messages;return u`<div class=${e(a(i.base,o))}><calcite-button class=${e(a(i.button,i.zoomIn))} .disabled=${!s} icon-start=plus kind=neutral .label=${c} @click=${this.zoomIn} title=${c??r}></calcite-button><calcite-button class=${e(a(i.button,i.zoomOut))} .disabled=${!O} icon-start=minus kind=neutral .label=${m} @click=${this.zoomOut} title=${m??r}></calcite-button></div>`}};z("geoscene-zoom",n);return n},"core/promiseUtils","core/reactiveUtils",b)