import { n as a, C as c } from "../chunks/lib-cortex-element.CVMmyPMC.js";
import { c as g } from "../chunks/component.styles.CRO4Odto.js";
import { f as d } from "../chunks/form-control.styles.CaGWmeAS.js";
import { c as f } from "../chunks/custom-element.L4WJXn1j.js";
import { i as h, x as m } from "../chunks/lit-element.jLBm65_O.js";
import { e as _ } from "../chunks/query.BBf1UFkC.js";
const x = h`:host{isolation:isolate;width:100%;display:inline-block}.input-group{flex-wrap:nowrap;display:flex}.input-group ::slotted(cx-input){width:100%}`;
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, p = (t, e, u, o) => {
  for (var n = o > 1 ? void 0 : o ? v(e, u) : e, i = t.length - 1, l; i >= 0; i--)
    (l = t[i]) && (n = (o ? l(e, u, n) : l(n)) || n);
  return o && n && b(e, u, n), n;
};
function r(t) {
  const e = "cx-input, cx-select";
  return t.closest(e) ?? t.querySelector(e);
}
let s = class extends c {
  constructor() {
    super(...arguments), this.label = "";
  }
  handleFocus(t) {
    r(t.target)?.toggleAttribute("data-cx-input-group__input--focus", !0);
  }
  handleBlur(t) {
    r(t.target)?.toggleAttribute("data-cx-input-group__input--focus", !1);
  }
  handleMouseOver(t) {
    r(t.target)?.toggleAttribute("data-cx-input-group__input--hover", !0);
  }
  handleMouseOut(t) {
    r(t.target)?.toggleAttribute("data-cx-input-group__input--hover", !1);
  }
  handleSlotChange() {
    const t = [
      ...this.defaultSlot.assignedElements({ flatten: !0 })
    ];
    t.forEach((e) => {
      const u = t.indexOf(e), o = r(e);
      o && (o.toggleAttribute("data-cx-input-group__input", !0), o.toggleAttribute("data-cx-input-group__input--first", u === 0), o.toggleAttribute(
        "data-cx-input-group__input--inner",
        u > 0 && u < t.length - 1
      ), o.toggleAttribute(
        "data-cx-input-group__input--last",
        u === t.length - 1
      ));
    });
  }
  render() {
    return m`<div part="base" class="input-group" aria-label=${this.label} @focusout=${this.handleBlur} @focusin=${this.handleFocus} @mouseover=${this.handleMouseOver} @mouseout=${this.handleMouseOut}><slot @slotchange=${this.handleSlotChange}></slot></div>`;
  }
};
s.styles = [
  g,
  d,
  x
];
p([
  _("slot")
], s.prototype, "defaultSlot", 2);
p([
  a()
], s.prototype, "label", 2);
s = p([
  f("cx-input-group")
], s);
export {
  s as default
};
