import { n as p, C as c } from "../chunks/lib-cortex-element.CVMmyPMC.js";
import { c as f } from "../chunks/component.styles.CRO4Odto.js";
import { c as d } from "../chunks/custom-element.L4WJXn1j.js";
import { H as h } from "../chunks/slot.j5oheLJC.js";
import { w as u } from "../chunks/watch.BCJD77bD.js";
import { i as x, x as o } from "../chunks/lit-element.jLBm65_O.js";
import { r as _ } from "../chunks/state.CSDxrqLd.js";
import { e as g } from "../chunks/query.BBf1UFkC.js";
import { e as y } from "../chunks/class-map.BiVq-cVR.js";
import { o as b } from "../chunks/if-defined.BRoBj_Rp.js";
const v = x`:host{display:inline-flex}.breadcrumb-item{font-family:var(--cx-font-sans);font-size:var(--cx-font-size-small);font-weight:var(--cx-font-weight-semibold);color:var(--cx-color-neutral);line-height:var(--cx-line-height-large);white-space:nowrap;align-items:center;display:inline-flex}.breadcrumb-item__label{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;color:inherit;border-radius:var(--cx-border-radius-small);cursor:pointer;transition:var(--cx-transition-fast) --color;background:0 0;border:none;margin:0;padding:0;text-decoration:none;display:inline-block}:host(:not(:last-of-type)) .breadcrumb-item__label,:host(:not(:last-of-type)) .breadcrumb-item__label:hover,:host(:not(:last-of-type)) .breadcrumb-item__label:active{color:var(--cx-color-primary)}.breadcrumb-item__label:focus{outline:none}.breadcrumb-item__label:focus-visible{outline:var(--cx-focus-ring);outline-offset:var(--cx-focus-ring-offset)}.breadcrumb-item__prefix,.breadcrumb-item__suffix{flex:none;align-items:center;display:flex}.breadcrumb-item--has-prefix .breadcrumb-item__prefix{margin-inline-end:var(--cx-spacing-x-small);display:inline-flex}.breadcrumb-item--has-suffix .breadcrumb-item__suffix{margin-inline-start:var(--cx-spacing-x-small);display:inline-flex}:host(:last-of-type) .breadcrumb-item__separator{display:none}.breadcrumb-item__separator{margin:0 var(--cx-spacing-x-small);-webkit-user-select:none;user-select:none;align-items:center;display:inline-flex}`;
var w = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (i, a, l, s) => {
  for (var t = s > 1 ? void 0 : s ? C(a, l) : a, n = i.length - 1, m; n >= 0; n--)
    (m = i[n]) && (t = (s ? m(a, l, t) : m(t)) || t);
  return s && t && w(a, l, t), t;
};
let e = class extends c {
  constructor() {
    super(...arguments), this.hasSlotController = new h(
      this,
      "prefix",
      "suffix"
    ), this.renderType = "button", this.rel = "noreferrer noopener";
  }
  setRenderType() {
    const i = this.defaultSlot.assignedElements({ flatten: !0 }).filter((a) => a.tagName.toLowerCase() === "cx-dropdown").length > 0;
    if (this.href) {
      this.renderType = "link";
      return;
    }
    if (i) {
      this.renderType = "dropdown";
      return;
    }
    this.renderType = "button";
  }
  hrefChanged() {
    this.setRenderType();
  }
  handleSlotChange() {
    this.setRenderType();
  }
  render() {
    return o`<div part="base" class=${y({
      "breadcrumb-item": !0,
      "breadcrumb-item--has-prefix": this.hasSlotController.test("prefix"),
      "breadcrumb-item--has-suffix": this.hasSlotController.test("suffix")
    })}><span part="prefix" class="breadcrumb-item__prefix"><slot name="prefix"></slot></span>${this.renderType === "link" ? o`<a part="label" class="breadcrumb-item__label breadcrumb-item__label--link" href=${this.href} target=${b(this.target ? this.target : void 0)} rel=${b(this.target ? this.rel : void 0)}><slot @slotchange=${this.handleSlotChange}></slot></a>` : ""}
        ${this.renderType === "button" ? o`<button part="label" type="button" class="breadcrumb-item__label breadcrumb-item__label--button"><slot @slotchange=${this.handleSlotChange}></slot></button>` : ""}
        ${this.renderType === "dropdown" ? o`<div part="label" class="breadcrumb-item__label breadcrumb-item__label--drop-down"><slot @slotchange=${this.handleSlotChange}></slot></div>` : ""}<span part="suffix" class="breadcrumb-item__suffix"><slot name="suffix"></slot></span><span part="separator" class="breadcrumb-item__separator" aria-hidden="true"><slot name="separator"></slot></span></div>`;
  }
};
e.styles = [f, v];
r([
  g("slot:not([name])")
], e.prototype, "defaultSlot", 2);
r([
  _()
], e.prototype, "renderType", 2);
r([
  p()
], e.prototype, "href", 2);
r([
  p()
], e.prototype, "target", 2);
r([
  p()
], e.prototype, "rel", 2);
r([
  u("href", { waitUntilFirstUpdate: !0 })
], e.prototype, "hrefChanged", 1);
e = r([
  d("cx-breadcrumb-item")
], e);
export {
  e as default
};
