import { c } from "../../chunks/runtime.js";
import { html as l } from "lit-html";
import { usePropertyChange as m } from "@arcgis/lumina/controllers";
import { classes as d } from "@arcgis/components-utils";
import h from "@geoscene/core/widgets/Compass/CompassViewModel.js";
import { LitElement as p, createEvent as g, noShadowRoot as u, safeClassMap as s, nothing as o, safeStyleMap as f } from "@arcgis/lumina";
import { u as v } from "../../chunks/useT9n.js";
import { m as w } from "../../chunks/useViewModel.js";
import { g as i } from "../../chunks/globalCss.js";
import { css as y } 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 $ = y`@layer{geoscene-compass{display:block}}`, r = "geoscene-compass", a = {
  base: r,
  iconContainer: `${r}__icon-container`
}, b = w(h);
class M extends p {
  constructor() {
    super(...arguments), this.messages = v(), this.viewModel = b(this), this.autoDestroyDisabled = !1, this.goToOverride = this.viewModel.goToOverride, this.orientation = this.viewModel.orientation, this.position = "top-left", this.state = this.viewModel.state, this.geoscenePropertyChange = m()("state", "orientation"), this.geosceneReady = g();
  }
  static {
    this.properties = { autoDestroyDisabled: 5, goToOverride: 0, icon: 3, label: 1, messageOverrides: 0, orientation: 0, position: 3, referenceElement: 1, state: 3 };
  }
  static {
    this.shadowRootOptions = u;
  }
  static {
    this.styles = $;
  }
  get icon() {
    return this._icon ?? (this.state === "rotation" ? "arrow-up" : "compass-needle");
  }
  set icon(t) {
    this._icon = t;
  }
  async destroy() {
    await this.manager.destroy();
  }
  async reset() {
    this.viewModel.reset();
  }
  _reset() {
    this.viewModel.reset();
  }
  render() {
    const { messages: t, icon: n } = this;
    return l`<div class=${s(d(a.base, i.widget))}><calcite-button class=${s(i.widgetButton)} .disabled=${this.state === "disabled"} kind=neutral .label=${t.reset} @click=${this._reset} round scale=s title=${t.reset ?? o}><div aria-hidden=true class=${s(a.iconContainer)} title=${t.reset ?? o}><calcite-icon .icon=${n} style=${f(C(this.orientation))}></calcite-icon></div></calcite-button></div>`;
  }
}
const C = (e) => ({
  transform: `rotateZ(${e.z}deg)`
});
c("geoscene-compass", M);
export {
  M as GeosceneCompass
};