import { c as t } from "../../chunks/runtime.js";
import { usePropertyChange as a } from "@arcgis/lumina/controllers";
import s from "@geoscene/core/layers/OrientedImageryLayer.js";
import r from "@geoscene/core/widgets/OrientedImageryViewer.js";
import { LitElement as o, createEvent as d, noShadowRoot as n } from "@arcgis/lumina";
import { m as l } from "../../chunks/useWidget.js";
import { css as g } 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 h = g`@layer{geoscene-oriented-imagery-viewer{display:block}}`, m = l(r);
class y extends o {
  constructor() {
    super(...arguments), this.widget = m(this), this._hasOrientedImageryLayerToAdd = !1, this.viewModel = this.widget.viewModel, this.autoDestroyDisabled = !1, this.currentCoverageVisible = this.widget.currentCoverageVisible, this.dataCaptureEnabled = this.widget.dataCaptureEnabled, this.disabled = this.widget.disabled, this.galleryOpened = this.widget.galleryOpened, this.icon = this.widget.icon, this.imageEnhancementToolActive = this.widget.imageEnhancementToolActive, this.imageGalleryEnabled = this.widget.imageGalleryEnabled, this.imageOverlaysOpened = this.widget.imageOverlaysOpened, this.isAdditionalCoverageVisible = this.widget.isAdditionalCoverageVisible, this.isAdditionalPointSourcesVisible = this.widget.isAdditionalPointSourcesVisible, this.label = this.widget.label, this.layer = this.widget.layer, this.mapImageConversionToolState = this.widget.mapImageConversionToolState, this.navigationToolActive = this.widget.navigationToolActive, this.position = "bottom-left", this.referencePoint = this.widget.referencePoint, this.geoscenePropertyChange = a()("imageGalleryEnabled", "layer"), this.geosceneReady = d();
  }
  static {
    this.properties = { autoDestroyDisabled: 5, currentCoverageVisible: 5, dataCaptureEnabled: 5, disabled: 5, galleryOpened: 5, icon: 1, imageEnhancementToolActive: 5, imageGalleryEnabled: 4, imageOverlaysOpened: 5, isAdditionalCoverageVisible: 5, isAdditionalPointSourcesVisible: 5, label: 1, layer: 0, mapImageConversionToolState: 5, navigationToolActive: 5, orientedImageryLayerItemId: 1, position: 1, referenceElement: 1, referencePoint: 0 };
  }
  static {
    this.shadowRootOptions = n;
  }
  static {
    this.styles = h;
  }
  async destroy() {
    await this.manager.destroy();
  }
  willUpdate(e) {
    if (e.has("orientedImageryLayerItemId")) {
      const i = this.orientedImageryLayerItemId;
      i && this.widget && (this.layer = new s({ portalItem: { id: i } }), this.widget.view ? this.widget.view.map?.add(this.layer) : this._hasOrientedImageryLayerToAdd = !0);
    }
  }
  loaded() {
    this._hasOrientedImageryLayerToAdd && (this.widget.view ? this._onReady() : this.el.addEventListener("geosceneReady", () => {
      this._onReady();
    }, { once: !0 }));
  }
  _onReady() {
    const { layer: e } = this;
    e && (this.widget.view?.map?.add(e), this._hasOrientedImageryLayerToAdd = !1);
  }
}
t("geoscene-oriented-imagery-viewer", y);
export {
  y as GeosceneOrientedImageryViewer
};