import { c as a } from "../../chunks/runtime.js";
import { css as r, html as i } from "lit";
import { usePropertyChange as l } from "@arcgis/lumina/controllers";
import { reEmitEvent as n } from "@arcgis/lumina/controllers/accessor";
import { classes as h } from "@arcgis/toolkit/dom";
import g from "@arcgis/core/widgets/Home/HomeViewModel.js";
import { LitElement as d, createEvent as m, safeClassMap as v, nothing as u } from "@arcgis/lumina";
import { u as p } from "../../chunks/useT9n.js";
import { m as w } from "../../chunks/useViewModel.js";
/*! 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 */
const b = r`.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 = "home", s = {
  base: f,
  button: "arcgis-button"
}, x = w(g);
class M extends d {
  constructor() {
    super(...arguments), this.messages = p(), this.viewModel = x(this), this.view = this.viewModel.view, this.autoDestroyDisabled = !1, this.goToOverride = this.viewModel.goToOverride, this.icon = "home", this.state = this.viewModel.state, this.viewpoint = this.viewModel.viewpoint, this.arcgisGo = n(() => this.viewModel, "go"), this.arcgisPropertyChange = l()("state"), this.arcgisReady = m();
  }
  static {
    this.properties = { view: 0, autoDestroyDisabled: 5, goToOverride: 0, icon: 1, label: 1, messageOverrides: 0, position: 3, referenceElement: 1, state: 3, viewpoint: 0 };
  }
  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: c } = this, t = this.viewModel?.state, o = t === "going-home";
    return i`<div class=${v(h(s.base, s.button))}><calcite-button .disabled=${t === "disabled"} .iconStart=${o ? void 0 : c ?? void 0} kind=neutral .label=${e.componentLabel} @click=${this._go} .scale=${o ? "s" : "m"} title=${(t === "going-home" ? e.cancel : e.title) ?? u}>${o ? i`<calcite-loader inline label></calcite-loader>` : null}</calcite-button></div>`;
  }
}
a("arcgis-home", M);
export {
  M as ArcgisHome
};
