/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as l } from "./runtime.js";
import { ref as u } from "lit/directives/ref.js";
import { css as m, html as a } from "lit";
import { usePropertyChange as p } from "@arcgis/lumina/controllers";
import { LitElement as g, nothing as d, safeClassMap as h } from "@arcgis/lumina";
import { f as b } from "./layer-list-utils.js";
import { classes as f } from "@arcgis/toolkit/dom";
const n = {
  actionMenu: "action-menu",
  actionGroup: "action-group",
  filterNoResults: "filter-no-results",
  item: "item",
  itemActive: "active",
  itemContentBottom: "content-bottom",
  itemMessage: "message",
  itemActionIcon: "action-icon",
  itemActionImage: "action-image",
  itemTemporaryIcon: "temporary-icon",
  itemTableIcon: "table-icon",
  itemCatalogIcon: "catalog-icon",
  statusIndicator: "status-indicator",
  publishing: "publishing",
  updating: "updating",
  connectionStatus: "connection-status",
  connectionStatusConnected: "connection-status--connected",
  visibleToggle: "visible-toggle",
  visibleIcon: "visible-icon"
}, y = m`:host{margin-inline:var(--calcite-space-sm)}.status-indicator{visibility:hidden}.publishing{visibility:visible;color:var(--calcite-color-text-2);transform-origin:var(--calcite-list-item-icon-center) var(--calcite-list-item-icon-center);animation:2s infinite arcgis-layer-list__publishing-anim}.updating{visibility:visible;animation:2s infinite arcgis-layer-list__updating-anim}.connection-status{visibility:visible;color:var(--calcite-color-status-warning);width:var(--calcite-spacing-xl);height:var(--calcite-spacing-xl)}.connection-status--connected{color:var(--calcite-color-status-success)}@keyframes arcgis-layer-list__updating-anim{0%,40%{color:transparent}50%,80%{color:var(--calcite-color-brand)}to{color:transparent}}@keyframes arcgis-layer-list__publishing-anim{0%,20%{transform:rotate(45deg)}80%,to{transform:rotate(135deg)}}`;
class v extends g {
  constructor() {
    super(...arguments), this.autoDestroyDisabled = !1, this.arcgisPropertyChange = p()("item", "parent");
  }
  static {
    this.properties = { _iconEl: 16, item: 0, parent: 0, messages: 0, autoDestroyDisabled: 5 };
  }
  static {
    this.styles = [y];
  }
  async destroy() {
    await this.manager.destroy();
  }
  _setIconEl(i) {
    this._iconEl = i;
  }
  getTooltipText(i, s, o, t) {
    const e = (c) => typeof c == "string" ? c : "";
    if (i)
      return e(t?.publishing);
    if (s)
      return e(t?.updating);
    switch (o) {
      case "connected":
        return e(t?.connected);
      case "paused":
        return e(t?.paused);
      default:
        return e(t?.disconnected);
    }
  }
  render() {
    if (!this.item)
      return null;
    const { publishing: i } = this.item, s = "updating" in this.item && this.item.updating && !this.parent, o = "connectionStatus" in this.item ? this.item.connectionStatus : void 0, t = !!o, e = i || s || t ? b({ connectionStatus: o, publishing: i }) : "blank", { messages: c } = this, r = this.getTooltipText(i, s, o, c);
    return a`<calcite-icon class=${h(f(n.statusIndicator, { [n.publishing]: i }, "updating" in n && { [n.updating]: s }, "connectionStatus" in n && { [n.connectionStatus]: t }, "connectionStatusConnected" in n && {
      [n.connectionStatusConnected]: t && o === "connected"
    }))} title=${c?.connectionStatus ?? d} .icon=${e} scale=s ${u(this._setIconEl)}></calcite-icon>${this._iconEl ? a`<calcite-tooltip placement=top .referenceElement=${this._iconEl}>${r}</calcite-tooltip>` : null}`;
  }
}
l("arcgis-layer-list-item-indicator", v);
export {
  v as A,
  n as c
};
