import { n as u, C as b } from "../chunks/lib-cortex-element.CVMmyPMC.js";
import { c as m } from "../chunks/component.styles.CRO4Odto.js";
import { c as h } from "../chunks/custom-element.L4WJXn1j.js";
import { i as p, E as d, x as c } from "../chunks/lit-element.jLBm65_O.js";
import { e as f } from "../chunks/query.BBf1UFkC.js";
import v from "./menu-label.js";
const C = p`:host{display:block}:host([inert]),:host([is-empty]){display:none}`;
var y = Object.defineProperty, x = Object.getOwnPropertyDescriptor, a = (n, t, r, l) => {
  for (var e = l > 1 ? void 0 : l ? x(t, r) : t, i = n.length - 1, o; i >= 0; i--)
    (o = n[i]) && (e = (l ? o(t, r, e) : o(e)) || e);
  return l && e && y(t, r, e), e;
};
let s = class extends b {
  constructor() {
    super(...arguments), this.label = "", this.mutationObserver = null;
  }
  connectedCallback() {
    super.connectedCallback(), this.mutationObserver = new MutationObserver(() => this.handleSlotChange()), this.mutationObserver.observe(this, {
      attributeFilter: ["inert"],
      attributes: !0,
      subtree: !0
    });
  }
  disconnectedCallback() {
    super.disconnectedCallback(), this.mutationObserver?.disconnect(), this.mutationObserver = null;
  }
  handleSlotChange() {
    if (!this.defaultSlot)
      return;
    this.defaultSlot.assignedElements().some((t) => !t.inert) ? this.removeAttribute("is-empty") : this.setAttribute("is-empty", "");
  }
  render() {
    return c`
      ${this.label.length > 0 ? c`<cx-menu-label part="label">${this.label}</cx-menu-label>` : d}<slot @slotchange=${this.handleSlotChange}></slot>`;
  }
};
s.styles = [m, C];
s.dependencies = {
  "cx-menu-label": v
};
a([
  f("slot")
], s.prototype, "defaultSlot", 2);
a([
  u({ type: String })
], s.prototype, "label", 2);
s = a([
  h("cx-menu-section")
], s);
export {
  s as default
};
