/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as o } from "../../chunks/runtime.js";
import { css as h, html as t } from "lit";
import { useDirection as n } from "@arcgis/lumina/controllers";
import { watch as e } from "@arcgis/core/core/reactiveUtils.js";
import l from "@arcgis/core/views/VideoView.js";
import { LitElement as c, createEvent as m, safeClassMap as d } from "@arcgis/lumina";
import { makeAccessorController as p } from "@arcgis/lumina/controllers/accessor";
import { createRef as s, ref as a } from "lit/directives/ref.js";
import { C as r } from "../../chunks/resources.js";
import { c as f, s as y, S as w } from "../../chunks/slots.js";
import { s as v } from "../../chunks/esri-main.js";
const u = h`:host{width:100%;height:100%}`, R = p(l, {
  omitProps: ["container", "navigation", "scale", "ui"]
});
class g extends c {
  constructor() {
    super(), this._containerRef = s(), this._direction = n(), this._mapRef = s(), this._slotGroupRefs = f(), this.autoDestroyDisabled = !1, this.view = R(this), this.attributionMode = this.view.attributionMode, this.ready = this.view.ready, this.layer = this.view.layer, this.map = this.view.map, this.operationalDataVisible = this.view.operationalDataVisible, this.arcgisViewReadyChange = m();
  }
  static {
    this.properties = { autoDestroyDisabled: 5, view: 32, aria: 0, attributionMode: 1, ready: 36, layer: 0, map: 0, operationalDataVisible: 5 };
  }
  static {
    this.styles = [v, y, u];
  }
  get aria() {
    return this.view?.aria;
  }
  set aria(i) {
    this.view && (this.view.aria = i);
  }
  async destroy() {
    await this.manager.destroy();
  }
  loaded() {
    const i = this;
    i.el.childElem = this._mapRef.value, this.view.container ??= i.el.childElem, this.manager.onLifecycle(() => [
      e(() => this.layer, () => {
        this.layer && this.view && (this.view.layer = this.layer, this.layer.loaded || this.layer.load());
      }, { initial: !0 }),
      e(() => this.view.ready, () => {
        this.view.ready && this.arcgisViewReadyChange.emit();
      }, { initial: this.view.ready })
    ]);
  }
  renderMain() {
    return t`<div class=${`root ${r.base}`} ${a(this._mapRef)}></div>`;
  }
  render() {
    return t`${this.renderMain()}<section class=${d(r.containerUI)} ${a(this._containerRef)}>${w({ direction: this._direction, slotGroupRefs: this._slotGroupRefs })}</section>`;
  }
}
o("arcgis-video", g);
export {
  g as ArcgisVideo
};
