import { c as s } from "../../chunks/runtime.js";
import { g as i, r, d as n, a as o } from "../../chunks/component-utils.js";
import { LitElement as l, createEvent as a, noShadowRoot as c } from "@arcgis/lumina";
import { css as h } 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 d = h`@layer{geoscene-placement{display:flex;pointer-events:auto;box-shadow:none}.geoscene-placement__container{display:block}}`;
class m extends l {
  constructor() {
    super(), this._observer = void 0, this._moveChildren = () => {
      if (i(this).parentElement !== this.el)
        for (let t = this.el.firstElementChild; t !== null; t = this.el.firstElementChild)
          i(this).append(t);
    }, this.position = "bottom-left", this.geosceneReady = a();
    const e = this;
    e.el.childElem = document.createElement("div"), e.el.childElem.classList.add("geoscene-placement__container"), this.listen("geosceneReady", this._startObserving, { once: !0 });
  }
  static {
    this.properties = { position: 1, referenceElement: 1 };
  }
  static {
    this.shadowRootOptions = c;
  }
  static {
    this.styles = d;
  }
  connectedCallback() {
    super.connectedCallback(), this.el.view && this._startObserving();
  }
  willUpdate(e) {
    e.has("referenceElement") && r(this, this.referenceElement);
    const t = i(this);
    e.has("position") && t && this.position !== void 0 && this.el.view?.ui?.move(t, this.position);
  }
  loaded() {
    n(this), o(this);
  }
  disconnectedCallback() {
    super.disconnectedCallback();
    const e = i(this);
    e && this.el.view?.ui?.remove(e), this._observer?.disconnect();
  }
  _startObserving() {
    this._moveChildren(), this._observer = new MutationObserver(this._moveChildren), this._observer.observe(this.el, { childList: !0 });
  }
}
s("geoscene-placement", m);
export {
  m as GeoscenePlacement
};