/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as e } from "../../chunks/runtime.js";
import { css as t, html as s } from "lit";
import { createRef as i, ref as r } from "lit-html/directives/ref.js";
import { LitElement as l } from "@arcgis/lumina";
const n = t`:host{display:block}`;
class o extends l {
  constructor() {
    super(...arguments), this.legendRef = i();
  }
  static {
    this.properties = { mapView: 0, legendRef: 0 };
  }
  static {
    this.styles = n;
  }
  render() {
    return this.mapView && s`<arcgis-legend auto-destroy-disabled respect-layer-definition-expression .view=${this.mapView} ${r(this.legendRef)}></arcgis-legend>` || "";
  }
  disconnectedCallback() {
    super.disconnectedCallback(), this.legendRef.value && this.legendRef.value.destroy();
  }
}
e("map-legend", o);
export {
  o as MapLegend
};
