import { c as h } from "../../chunks/runtime.js";
import { makeAccessorController as r, reEmitEvent as e, reCreateAccessor as n } from "@arcgis/lumina/controllers/accessor";
import { watch as s } from "@geoscene/core/core/reactiveUtils.js";
import o from "@geoscene/core/views/LinkChartView.js";
import w from "@geoscene/core/WebLinkChart.js";
import { LitElement as c, createEvent as a, noShadowRoot as p } from "@arcgis/lumina";
import { c as v, i as l } from "../../chunks/component-utils.js";
import { css as m } 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 g = m`@layer{geoscene-link-chart{display:block;height:100%;.geoscene-view{height:100%;width:100%}}}`, d = r(
  w,
  /**
   * Since omitProps is only needed for typing, not runtime, `{} as { ... }` is
   * a hack to remove them from the runtime code. This argument is not used at
   * all at runtime. For makeViewModelController and makeWidgetController, the
   * minifier is able to remove them automatically. However, minifier does not
   * remove them for makeAccessorController as makeAccessorController is defined
   * in an externalized package.
   */
  {}
), y = r(o, {});
class u extends c {
  constructor() {
    super(), this._map = d(this), this.view = y(this), this.allLayerViews = this.view.allLayerViews, this.autoDestroyDisabled = !1, this.background = this.view.background, this.basemap = this._map.basemap, this.basemapView = this.view.basemapView, this.constraints = this.view.constraints, this.displayFilterDisabled = this.view.displayFilterEnabled, this.fatalError = this.view.fatalError, this.graphics = this.view.graphics, this.highlights = this.view.highlights, this.layerViews = this.view.layerViews, this.magnifier = this.view.magnifier, this.map = this.view.map, this.navigation = this.view.navigation, this.padding = this.view.padding, this.popup = this.view.popup, this.popupDisabled = this.view.popupEnabled, this.ready = this.view.ready, this.resizeAlign = this.view.resizeAlign, this.resolution = this.view.resolution, this.rotation = this.view.rotation, this.spatialReference = this.view.spatialReference, this.suspended = this.view.suspended, this.theme = this.view.theme, this.timeExtent = this.view.timeExtent, this.timeZone = this.view.timeZone, this.updating = this.view.updating, this.geosceneViewChange = a(), this.geosceneViewClick = e(() => this.view, "click"), this.geosceneViewDoubleClick = e(() => this.view, "double-click"), this.geosceneViewDrag = e(() => this.view, "drag"), this.geosceneViewHold = e(() => this.view, "hold"), this.geosceneViewImmediateClick = e(() => this.view, "immediate-click"), this.geosceneViewImmediateDoubleClick = e(() => this.view, "immediate-double-click"), this.geosceneViewKeyDown = e(() => this.view, "key-down"), this.geosceneViewKeyUp = e(() => this.view, "key-up"), this.geosceneViewLayerviewCreate = e(() => this.view, "layerview-create"), this.geosceneViewLayerviewCreateError = e(() => this.view, "layerview-create-error"), this.geosceneViewLayerviewDestroy = e(() => this.view, "layerview-destroy"), this.geosceneViewMouseWheel = e(() => this.view, "mouse-wheel"), this.geosceneViewPointerDown = e(() => this.view, "pointer-down"), this.geosceneViewPointerEnter = e(() => this.view, "pointer-enter"), this.geosceneViewPointerLeave = e(() => this.view, "pointer-leave"), this.geosceneViewPointerMove = e(() => this.view, "pointer-move"), this.geosceneViewPointerUp = e(() => this.view, "pointer-up"), this.geosceneViewReadyChange = a(), this.view.ui = {
      components: ["attribution"]
    };
  }
  static {
    this.properties = { _map: 16, view: 32, allLayerViews: 0, autoDestroyDisabled: 5, background: 0, basemap: 1, basemapView: 0, center: 1, constraints: 0, displayFilterDisabled: 5, extent: 0, fatalError: 0, focusAreas: 0, graphics: 0, highlights: 0, interacting: 32, itemId: 3, layerViews: 0, magnifier: 0, map: 0, navigating: 32, navigation: 0, padding: 0, popup: 0, popupDisabled: 5, ready: 4, resizeAlign: 1, resolution: 8, rotation: 9, scale: 9, spatialReference: 0, stationary: 32, suspended: 7, theme: 0, timeExtent: 0, timeZone: 1, updating: 4, viewpoint: 0, zoom: 9 };
  }
  static {
    this.shadowRootOptions = p;
  }
  static {
    this.styles = g;
  }
  get center() {
    return this.view.center;
  }
  set center(i) {
    const t = v(i, this.view);
    t && (this.view.center = t);
  }
  get extent() {
    return this.view.extent;
  }
  set extent(i) {
    this.extent?.equals(i) || (this.view.extent = i);
  }
  get focusAreas() {
    return this.map ? this.map?.focusAreas : {
      areas: [],
      style: "bright"
    };
  }
  set focusAreas(i) {
    this.map && (this.map.focusAreas = i);
  }
  get interacting() {
    return this.view.interacting;
  }
  get itemId() {
    return this._map.portalItem?.id;
  }
  set itemId(i) {
    n(this._map, this), this._map.portalItem = { id: i }, this.view.map = this._map;
  }
  get navigating() {
    return this.view.navigating;
  }
  get scale() {
    return this.view.scale;
  }
  set scale(i) {
    this.view.scale = i;
  }
  get stationary() {
    return this.view.stationary;
  }
  get viewpoint() {
    return this.view.viewpoint;
  }
  set viewpoint(i) {
    l(this.viewpoint, i) && (this.view.viewpoint = i);
  }
  get zoom() {
    return this.view.zoom;
  }
  set zoom(i) {
    this.view.zoom = i;
  }
  async addLayer(i, t) {
    this.map?.add(i, t);
  }
  async addLayers(i, t) {
    this.map?.addMany(i, t);
  }
  async closePopup() {
    this.view.closePopup();
  }
  async destroy() {
    await this.manager.destroy();
  }
  async goTo(i, t) {
    return await this.view.goTo(i, t);
  }
  async openPopup(i) {
    await this.view.openPopup(i);
  }
  toMap(i) {
    return this.view.toMap(i);
  }
  toScreen(i, t) {
    return this.view.toScreen(i, t);
  }
  async tryFatalErrorRecovery() {
    this.view.tryFatalErrorRecovery();
  }
  async whenLayerView(i) {
    return await this.view.whenLayerView(i);
  }
  async viewOnReady(i, t) {
    return await this.componentOnReady(), await this.view.whenReady().then(() => i?.()).catch(t);
  }
  load() {
    const i = this;
    i.el.childElem = document.createElement("div"), i.el.append(i.el.childElem), this.view.container = i.el.childElem;
  }
  loaded() {
    this.map ||= this._map, this.manager.onLifecycle(() => [
      s(() => this.map, (i) => {
        i && (this._map = i);
      }, { initial: !0, sync: !0 }),
      s(() => this.view.stationary, () => this.geosceneViewChange.emit(), { initial: !0 }),
      s(() => this.view.ready, () => this.geosceneViewReadyChange.emit(), { initial: this.view.ready })
    ]);
  }
}
h("geoscene-link-chart", u);
export {
  u as GeosceneLinkChart
};