import { c as h } from "../../chunks/runtime.js";
import { css as n, html as e } from "lit";
import { useDirection as l } from "@arcgis/lumina/controllers";
import { watch as t } from "@arcgis/core/core/reactiveUtils.js";
import c from "@arcgis/core/views/VideoView.js";
import { LitElement as m, createEvent as d, safeClassMap as s } from "@arcgis/lumina";
import { makeAccessorController as y } from "@arcgis/lumina/controllers/accessor";
import { createRef as a, ref as r } from "lit/directives/ref.js";
import { s as f, C as o, a as p } from "../../chunks/slots.js";
import { s as w } from "../../chunks/esri-main.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
const v = n`:host{width:100%;height:100%}`, u = y(c, {
  omitProps: ["container", "navigation", "scale", "ui"]
});
class g extends m {
  constructor() {
    super(), this._containerRef = a(), this._direction = l(), this._mapRef = a(), this.autoDestroyDisabled = !1, this.view = u(this), this.aria = this.view.aria, this.ready = this.view.ready, this.layer = this.view.layer, this.map = this.view.map, this.arcgisViewReadyChange = d();
  }
  static {
    this.properties = { autoDestroyDisabled: 5, view: 32, aria: 0, ready: 4, layer: 0, map: 0 };
  }
  static {
    this.styles = [w, f, v];
  }
  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(() => [
      t(() => this.layer, () => {
        this.layer && this.view && (this.view.layer = this.layer, this.layer.loaded || this.layer.load());
      }, { initial: !0 }),
      t(() => this.view.ready, () => {
        this.view.ready && this.arcgisViewReadyChange.emit();
      }, { initial: this.view.ready })
    ]);
  }
  renderMain() {
    return e`<div class=${s(o.base)} ${r(this._mapRef)}></div>`;
  }
  render() {
    return e`<section class=${s(o.containerUI)} ${r(this._containerRef)}>${p(this._direction)}</section>${this.renderMain()}`;
  }
}
h("arcgis-video", g);
export {
  g as ArcgisVideo
};
