import { c as l } from "../../chunks/runtime.js";
import { html as o } from "lit-html";
import { usePropertyChange as c } from "@arcgis/lumina/controllers";
import { reEmitEvent as n } from "@arcgis/lumina/controllers/accessor";
import { classes as m } from "@arcgis/components-utils";
import d from "@geoscene/core/widgets/Home/HomeViewModel.js";
import { LitElement as h, createEvent as g, noShadowRoot as p, safeClassMap as i, nothing as v } from "@arcgis/lumina";
import { u as w } from "../../chunks/useT9n.js";
import { m as f } from "../../chunks/useViewModel.js";
import { g as a } from "../../chunks/globalCss.js";
import { css as u } from "@lit/reactive-element/css-tag.js";
/*! 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 */
const b = u`@layer{geoscene-home{display:block}}`, y = {
  base: "geoscene-home"
}, M = f(d);
class $ extends h {
  constructor() {
    super(...arguments), this.messages = w(), this.viewModel = M(this), this.autoDestroyDisabled = !1, this.goToOverride = this.viewModel.goToOverride, this.icon = "home", this.position = "top-left", this.state = this.viewModel.state, this.viewpoint = this.viewModel.viewpoint, this.geosceneGo = n(() => this.viewModel, "go"), this.geoscenePropertyChange = c()("state"), this.geosceneReady = g();
  }
  static {
    this.properties = { autoDestroyDisabled: 5, goToOverride: 0, icon: 1, label: 1, messageOverrides: 0, position: 3, referenceElement: 1, state: 3, viewpoint: 0 };
  }
  static {
    this.shadowRootOptions = p;
  }
  static {
    this.styles = b;
  }
  async cancelGo() {
    this.viewModel.cancelGo();
  }
  async destroy() {
    await this.manager.destroy();
  }
  async go() {
    this.viewModel.go();
  }
  _go() {
    const { viewModel: e } = this;
    e.state === "going-home" ? e.cancelGo() : e.go();
  }
  render() {
    const { messages: e, icon: r } = this, t = this.viewModel?.state, s = t === "going-home";
    return o`<div class=${i(m(y.base, a.widget))}><calcite-button class=${i(a.widgetButton)} .disabled=${t === "disabled"} .iconStart=${s ? void 0 : r ?? void 0} kind=neutral .label=${e.componentLabel} @click=${this._go} .scale=${s ? "s" : "m"} title=${(t === "going-home" ? e.cancel : e.title) ?? v}>${s ? o`<calcite-loader inline label></calcite-loader>` : null}</calcite-button></div>`;
  }
}
l("geoscene-home", $);
export {
  $ as GeosceneHome
};