import {
  colorContextProvider
} from "/node_modules/.vite/deps/chunk-QKIOAKEK.js?v=bff2a436";
import {
  Logger
} from "/node_modules/.vite/deps/chunk-CAYODABQ.js?v=bff2a436";
import {
  colorContextConsumer
} from "/node_modules/.vite/deps/chunk-KBYEGRCV.js?v=bff2a436";
import {
  LitElement,
  __classPrivateFieldGet,
  __classPrivateFieldSet,
  __decorate,
  classMap,
  css,
  customElement,
  html,
  isServer,
  property
} from "/node_modules/.vite/deps/chunk-F6B56SAQ.js?v=bff2a436";
import "/node_modules/.vite/deps/chunk-G3PMV62Z.js?v=bff2a436";

// node_modules/@patternfly/pfe-core/controllers/slot-controller.js
var _SlotController_instances;
var _a;
var _SlotController_nodes;
var _SlotController_logger;
var _SlotController_firstUpdated;
var _SlotController_mo;
var _SlotController_slotNames;
var _SlotController_deprecations;
var _SlotController_onSlotChange;
var _SlotController_onMutation;
var _SlotController_getChildrenForSlot;
var _SlotController_initSlot;
function isObjectConfigSpread(config) {
  return config.length === 1 && typeof config[0] === "object" && config[0] !== null;
}
var isSlot = (n) => (child) => n === SlotController.default ? !child.hasAttribute("slot") : child.getAttribute("slot") === n;
var SlotController = class {
  constructor(host, ...config) {
    _SlotController_instances.add(this);
    this.host = host;
    _SlotController_nodes.set(this, /* @__PURE__ */ new Map());
    _SlotController_logger.set(this, void 0);
    _SlotController_firstUpdated.set(this, false);
    _SlotController_mo.set(this, new MutationObserver((records) => __classPrivateFieldGet(this, _SlotController_onMutation, "f").call(this, records)));
    _SlotController_slotNames.set(this, void 0);
    _SlotController_deprecations.set(this, {});
    _SlotController_onSlotChange.set(this, (event) => {
      const slotName = event.target.name;
      __classPrivateFieldGet(this, _SlotController_initSlot, "f").call(this, slotName);
      this.host.requestUpdate();
    });
    _SlotController_onMutation.set(this, async (records) => {
      const changed = [];
      for (const { addedNodes, removedNodes } of records) {
        for (const node of [...addedNodes, ...removedNodes]) {
          if (node instanceof HTMLElement && node.slot) {
            __classPrivateFieldGet(this, _SlotController_initSlot, "f").call(this, node.slot);
            changed.push(node.slot);
          }
        }
      }
      this.host.requestUpdate();
    });
    _SlotController_initSlot.set(this, (slotName) => {
      const name = slotName || _a.default;
      const elements = __classPrivateFieldGet(this, _SlotController_nodes, "f").get(name)?.slot?.assignedElements?.() ?? __classPrivateFieldGet(this, _SlotController_instances, "m", _SlotController_getChildrenForSlot).call(this, name);
      const selector = slotName ? `slot[name="${slotName}"]` : "slot:not([name])";
      const slot = this.host.shadowRoot?.querySelector?.(selector) ?? null;
      const nodes = slot?.assignedNodes?.();
      const hasContent = !!elements.length || !!nodes?.filter((x) => x.textContent?.trim()).length;
      __classPrivateFieldGet(this, _SlotController_nodes, "f").set(name, { elements, name: slotName ?? "", hasContent, slot });
      __classPrivateFieldGet(this, _SlotController_logger, "f").debug(slotName, hasContent);
    });
    __classPrivateFieldSet(this, _SlotController_logger, new Logger(this.host), "f");
    if (isObjectConfigSpread(config)) {
      const [{ slots, deprecations }] = config;
      __classPrivateFieldSet(this, _SlotController_slotNames, slots, "f");
      __classPrivateFieldSet(this, _SlotController_deprecations, deprecations ?? {}, "f");
    } else if (config.length >= 1) {
      __classPrivateFieldSet(this, _SlotController_slotNames, config, "f");
      __classPrivateFieldSet(this, _SlotController_deprecations, {}, "f");
    } else {
      __classPrivateFieldSet(this, _SlotController_slotNames, [null], "f");
    }
    host.addController(this);
  }
  async hostConnected() {
    this.host.addEventListener("slotchange", __classPrivateFieldGet(this, _SlotController_onSlotChange, "f"));
    __classPrivateFieldSet(this, _SlotController_firstUpdated, false, "f");
    __classPrivateFieldGet(this, _SlotController_mo, "f").observe(this.host, { childList: true });
    __classPrivateFieldGet(this, _SlotController_nodes, "f").clear();
    __classPrivateFieldGet(this, _SlotController_slotNames, "f").forEach(__classPrivateFieldGet(this, _SlotController_initSlot, "f"));
    Object.values(__classPrivateFieldGet(this, _SlotController_deprecations, "f")).forEach(__classPrivateFieldGet(this, _SlotController_initSlot, "f"));
    this.host.requestUpdate();
    await this.host.updateComplete;
    this.host.requestUpdate();
  }
  hostUpdated() {
    if (!__classPrivateFieldGet(this, _SlotController_firstUpdated, "f")) {
      __classPrivateFieldGet(this, _SlotController_slotNames, "f").forEach(__classPrivateFieldGet(this, _SlotController_initSlot, "f"));
      __classPrivateFieldSet(this, _SlotController_firstUpdated, true, "f");
    }
  }
  hostDisconnected() {
    __classPrivateFieldGet(this, _SlotController_mo, "f").disconnect();
  }
  /**
   * Given a slot name or slot names, returns elements assigned to the requested slots as an array.
   * If no value is provided, it returns all children not assigned to a slot (without a slot attribute).
   * @param slotNames slots to query
   * @example Get header-slotted elements
   *          ```js
   *          this.getSlotted('header')
   *          ```
   * @example Get header- and footer-slotted elements
   *          ```js
   *          this.getSlotted('header', 'footer')
   *          ```
   * @example Get default-slotted elements
   *          ```js
   *          this.getSlotted();
   *          ```
   */
  getSlotted(...slotNames) {
    if (!slotNames.length) {
      return __classPrivateFieldGet(this, _SlotController_nodes, "f").get(_a.default)?.elements ?? [];
    } else {
      return slotNames.flatMap((slotName) => __classPrivateFieldGet(this, _SlotController_nodes, "f").get(slotName)?.elements ?? []);
    }
  }
  /**
   * Returns a boolean statement of whether or not any of those slots exists in the light DOM.
   * @param names The slot names to check.
   * @example this.hasSlotted('header');
   */
  hasSlotted(...names) {
    if (isServer) {
      return this.host.getAttribute("ssr-hint-has-slotted")?.split(",").map((name) => name.trim()).some((name) => names.includes(name === "default" ? null : name)) ?? false;
    } else {
      const slotNames = Array.from(names, (x) => x == null ? _a.default : x);
      if (!slotNames.length) {
        slotNames.push(_a.default);
      }
      return slotNames.some((x) => __classPrivateFieldGet(this, _SlotController_nodes, "f").get(x)?.hasContent ?? false);
    }
  }
  /**
   * Whether or not all the requested slots are empty.
   * @param  names The slot names to query.  If no value is provided, it returns the default slot.
   * @example this.isEmpty('header', 'footer');
   * @example this.isEmpty();
   * @returns
   */
  isEmpty(...names) {
    return !this.hasSlotted(...names);
  }
};
_a = SlotController, _SlotController_nodes = /* @__PURE__ */ new WeakMap(), _SlotController_logger = /* @__PURE__ */ new WeakMap(), _SlotController_firstUpdated = /* @__PURE__ */ new WeakMap(), _SlotController_mo = /* @__PURE__ */ new WeakMap(), _SlotController_slotNames = /* @__PURE__ */ new WeakMap(), _SlotController_deprecations = /* @__PURE__ */ new WeakMap(), _SlotController_onSlotChange = /* @__PURE__ */ new WeakMap(), _SlotController_onMutation = /* @__PURE__ */ new WeakMap(), _SlotController_initSlot = /* @__PURE__ */ new WeakMap(), _SlotController_instances = /* @__PURE__ */ new WeakSet(), _SlotController_getChildrenForSlot = function _SlotController_getChildrenForSlot2(name) {
  const children = Array.from(this.host.children);
  return children.filter(isSlot(name));
};
SlotController.default = Symbol("default slot");
SlotController.anonymous = _a.default;

// node_modules/@rhds/elements/elements/rh-card/rh-card.js
var _RhCard_instances;
var _RhCard_slots;
var _RhCard_isPromo;
var _RhCard_isStandardPromo;
var _RhCard_computedPalette_get;
var _RhCard_computedContext_get;
var styles = css`:host{display:block;container-name:card;container-type:inline-size;height:max-content}#body.empty,#footer.empty,#header.empty,#image.empty{display:none!important}::slotted(*){line-height:inherit}::slotted(a){color:var(--rh-color-interactive-primary-default)}::slotted(a:hover){color:var(--rh-color-interactive-primary-hover)}::slotted(a:focus-within){color:var(--rh-color-interactive-primary-focus)}::slotted(a:active){color:var(--rh-color-interactive-primary-active)}::slotted(a:visited){color:var(--rh-color-interactive-primary-visited-default)}::slotted(a:visited:hover){color:var(--rh-color-interactive-primary-visited-hover)}::slotted(a:visited:focus-within){color:var(--rh-color-interactive-primary-visited-focus)}::slotted(a:visited:active){color:var(--rh-color-interactive-primary-visited-active)}#container{align-self:stretch;display:flex;flex-direction:column;justify-items:flex-start;overflow:hidden;border-radius:var(--_border-radius,var(--rh-border-width-lg,3px));font-family:var(--rh-font-family-body-text,RedHatText,"Red Hat Text",Helvetica,Arial,sans-serif)!important;line-height:var(--rh-line-height-body-text,1.5);border-style:solid;border-width:var(--rh-border-width-sm,1px);border-color:var(--rh-color-border-subtle);width:100%;height:100%;background-color:var(--rh-color-surface);color:var(--rh-color-text-primary)}.on.light{--rh-color-surface:var(--rh-color-surface-lightest,#fff)}.on.dark{--rh-color-surface:var(--rh-color-surface-darkest,#151515)}#container.on.palette-light{--rh-color-surface:var(--rh-color-surface-light,#e0e0e0)}#container.on.palette-lighter{--rh-color-surface:var(--rh-color-surface-lighter,#f2f2f2)}#container.on.palette-lightest{--rh-color-surface:var(--rh-color-surface-lightest,#fff)}#container.on.palette-dark{--rh-color-surface:var(--rh-color-surface-dark,#383838)}#container.on.palette-darker{--rh-color-surface:var(--rh-color-surface-darker,#1f1f1f)}#container.on.palette-darkest{--rh-color-surface:var(--rh-color-surface-darkest,#151515)}#body,#footer,#header{margin-inline:var(--rh-space-xl,24px)}#body ::slotted(:is(h1,h2,h3,h4,h5,h6)),#header ::slotted(:is(h1,h2,h3,h4,h5,h6)){font-family:var(--rh-font-family-heading,RedHatDisplay,"Red Hat Display",Helvetica,Arial,sans-serif)}#image ::slotted(*){display:block;max-width:100%}#header{display:flex;flex-direction:column;gap:var(--rh-space-lg,16px);box-sizing:border-box;font-family:var(--rh-card-heading-font-family,var(--rh-font-family-heading,RedHatDisplay,"Red Hat Display",Helvetica,Arial,sans-serif))!important;font-size:var(--rh-card-heading-font-size,var(--rh-font-size-heading-sm,1.5rem));font-weight:var(--rh-card-heading-font-weight,var(--rh-font-weight-body-text-medium,500))!important;margin-block-start:var(--rh-space-lg,16px);background-color:var(--_header-bg,#0000)}:is(#container,#container.light,#container.lighter,#container.lightest){--_header-bg:var(--rh-card-header-background-on-light,#0000)}:is(#container.dark,#container.darker,#container.darkest){--_header-bg:var(--rh-card-header-background-on-dark,#0000)}#body{margin-block:var(--rh-space-2xl,32px) var(--rh-space-xl,24px)}#body:has(+.empty){margin-block-end:var(--rh-space-2xl,32px)}#footer{display:flex;gap:.5em;margin-block:auto var(--rh-space-xl,24px)}#container #body ::slotted(:is(h1,h2,h3,h4,h5,h6)),#container #header ::slotted(:is(h1,h2,h3,h4,h5,h6)){font-family:inherit!important;font-weight:inherit!important;line-height:var(--rh-line-height-heading,1.3)!important}#header ::slotted(:is(h1,h2,h3,h4,h5,h6)){font-size:inherit!important;margin:unset!important}#body ::slotted(:is(h1,h2,h3,h4,h5,h6)){font-size:var(--rh-card-heading-font-size,var(--rh-font-size-heading-sm,1.5rem))!important}#body ::slotted(:not([slot]):first-child){margin-block-start:0}#body ::slotted(:not([slot]):last-child){margin-block-end:0}@container card (min-width: 768px){#body,#footer,#header{margin-inline:var(--rh-space-2xl,32px)}#body,#header{margin-block-start:var(--rh-space-2xl,32px)}#footer{margin-block-end:var(--rh-space-2xl,32px)}}:host([variant=promo]){display:block;container-name:card promo}#container.promo{--_promo-heading-font-weight:var(--rh-card-heading-font-weight,var(--rh-font-weight-body-text-medium,500));--_promo-heading-size:var(--rh-card-heading-font-size,var(--rh-font-size-heading-xs,1.25rem));--_promo-paragraph-font-size:var(--rh-font-size-body-text-lg,1.125rem);--_promo-paragraph-margin-block-end:var(--rh-space-lg,16px);--_promo-standard-inline-padding:var(--rh-space-2xl,32px);height:auto}#container.promo:not(.standard,.has-image){grid-template-columns:auto}.promo #body{margin:var(--rh-space-2xl,32px)}.promo.has-image #body{order:-5}.promo.has-header #header{margin:0;margin-block-end:var(--rh-space-lg,16px)}.promo.has-footer #footer{margin-block:var(--rh-space-xl,24px) 0;margin-inline:0}.promo #header ::slotted(*){font-family:var(--rh-card-heading-font-family,var(--rh-font-family-heading,RedHatDisplay,"Red Hat Display",Helvetica,Arial,sans-serif))!important;font-size:var(--_promo-heading-size)!important;font-weight:var(--_promo-heading-font-weight)!important;margin-block:0 var(--_promo-heading-margin-block-end)!important}.promo:is(.has-image,.has-header) #body ::slotted(p){font-size:var(--_promo-paragraph-font-size)!important;margin-block-end:var(--_promo-paragraph-margin-block-end)!important}#container.promo.standard{display:flex;padding:var(--_promo-standard-inline-padding);width:auto}#container.promo.standard.dark{background-color:var(--rh-color-surface-darker,#1f1f1f)}.promo.standard #body{display:contents}.promo.standard #body ::slotted(:not([slot])){font-family:var(--rh-card-heading-font-family,var(--rh-font-family-heading,RedHatDisplay,"Red Hat Display",Helvetica,Arial,sans-serif))!important;font-size:var(--rh-font-size-body-text-xl,1.25rem)!important;font-weight:var(--rh-font-weight-body-text-medium,500);line-height:var(--rh-line-height-heading,1.3)!important}:host([variant=promo][full-width]) #container{border-color:#0000;padding-block:var(--rh-space-4xl,64px);padding-inline:var(--rh-space-lg,16px);width:auto}:host([variant=promo][full-width]) #body{margin:0}:host([variant=promo][full-width]) #body ::slotted(p){--_promo-paragraph-font-size:var(--rh-font-size-body-text-md,1rem)}:host([variant=promo][full-width]) #header ::slotted(*){--_promo-heading-size:var(--rh-card-heading-font-size,var(--rh-font-size-body-text-2xl,1.5rem))}:host([variant=promo][full-width]) .has-image #footer{margin-block-end:var(--rh-space-2xl,32px)}@container promo (min-width: 768px){#container.promo{align-items:center;display:grid;grid-template-columns:2fr 1fr;min-height:250px}.promo #image{justify-self:end}.promo #body{margin:var(--rh-space-3xl,48px);max-width:70ch}.promo #header ::slotted(*){--_promo-heading-size:var(--rh-card-heading-font-size,var(--rh-font-size-heading-sm,1.5rem))}#container.promo.standard{--_promo-standard-inline-padding:var(--rh-space-3xl,48px);column-gap:var(--rh-space-xl,24px);flex-direction:row;justify-content:space-between;min-height:auto}.promo.standard #footer{flex:0 0 auto;margin-block:0}:host([variant=promo][full-width]) #container{column-gap:var(--rh-space-2xl,32px);min-height:auto;padding-inline:var(--rh-space-4xl,64px)}:host([variant=promo][full-width]) #body ::slotted(p){--_promo-paragraph-font-size:var(--rh-font-size-body-text-lg,1.125rem)}:host([variant=promo][full-width]) #header ::slotted(*){--_promo-heading-size:var(--rh-card-heading-font-size,var(--rh-font-size-heading-md,1.75rem))}:host([variant=promo][full-width]) .has-image #footer{margin-block-end:0}}@container promo (min-width: 1200px){:host([variant=promo][full-width]) #container{padding-inline:var(--rh-space-7xl,128px)}}`;
var RhCard = class RhCard2 extends LitElement {
  constructor() {
    super(...arguments);
    _RhCard_instances.add(this);
    this.fullWidth = false;
    _RhCard_slots.set(this, new SlotController(this, "header", "image", null, "footer"));
    _RhCard_isPromo.set(this, this.variant === "promo");
    _RhCard_isStandardPromo.set(this, false);
  }
  willUpdate() {
    __classPrivateFieldSet(this, _RhCard_isPromo, this.variant === "promo", "f");
    __classPrivateFieldSet(this, _RhCard_isStandardPromo, __classPrivateFieldGet(this, _RhCard_isPromo, "f") && __classPrivateFieldGet(this, _RhCard_slots, "f").hasSlotted(null) && __classPrivateFieldGet(this, _RhCard_slots, "f").isEmpty("image") && __classPrivateFieldGet(this, _RhCard_slots, "f").isEmpty("header"), "f");
  }
  render() {
    const promo = this.variant === "promo";
    const standard = __classPrivateFieldGet(this, _RhCard_isStandardPromo, "f");
    const computedPalette = __classPrivateFieldGet(this, _RhCard_instances, "a", _RhCard_computedPalette_get);
    const computedContext = __classPrivateFieldGet(this, _RhCard_instances, "a", _RhCard_computedContext_get);
    const on = computedContext ?? this.on ?? "light";
    const { variant = "" } = this;
    const hasHeader = __classPrivateFieldGet(this, _RhCard_slots, "f").hasSlotted("header");
    const hasFooter = __classPrivateFieldGet(this, _RhCard_slots, "f").hasSlotted("footer");
    const hasImage = __classPrivateFieldGet(this, _RhCard_slots, "f").hasSlotted("image");
    const hasBody = __classPrivateFieldGet(this, _RhCard_slots, "f").hasSlotted(null);
    const header = html`
      <div id="header"
           part="header"
           class="${classMap({ empty: !hasHeader })}">
        <slot name="header"></slot>
      </div>`;
    const footer = html`
      <div id="footer"
           part="footer"
           class="${classMap({ empty: !hasFooter })}">
        <slot name="footer"></slot>
      </div>`;
    return html`
     <div id="container"
          part="container"
          class="${classMap({
      standard,
      "on": true,
      [on]: true,
      [variant]: !!variant,
      [`palette-${computedPalette}`]: !!computedPalette,
      "palette": !!this.colorPalette,
      "has-body": hasBody,
      "has-header": hasHeader,
      "has-footer": hasFooter,
      "has-image": hasImage
    })}">${promo ? "" : header}
        <div id="image"
             part="image"
             class="${classMap({ empty: !hasImage })}">
          <slot name="image"></slot>
        </div>
        <div id="body"
             part="body"
             class="${classMap({ empty: !hasBody })}">
          ${!promo ? "" : header}
          <slot></slot>
          ${!promo ? "" : footer}
        </div>
        ${promo ? "" : footer}
      </div>
    `;
  }
};
_RhCard_slots = /* @__PURE__ */ new WeakMap();
_RhCard_isPromo = /* @__PURE__ */ new WeakMap();
_RhCard_isStandardPromo = /* @__PURE__ */ new WeakMap();
_RhCard_instances = /* @__PURE__ */ new WeakSet();
_RhCard_computedPalette_get = function _RhCard_computedPalette_get2() {
  if (__classPrivateFieldGet(this, _RhCard_isStandardPromo, "f")) {
    return `${this.colorPalette}er`.replace(/(er|est){1,2}/, "er");
  } else if (__classPrivateFieldGet(this, _RhCard_isPromo, "f")) {
    return `${this.colorPalette}est`.replace(/(er|est){1,2}/, "est");
  } else {
    switch (this.colorPalette) {
      case "lightest":
      case "lighter":
      case "darkest":
        return this.colorPalette;
      case "light":
        return "lighter";
      case "darker":
      case "dark":
        return "darkest";
    }
  }
};
_RhCard_computedContext_get = function _RhCard_computedContext_get2() {
  return this.colorPalette ? this.colorPalette?.includes("light") ? "light" : "dark" : void 0;
};
RhCard.styles = [styles];
__decorate([
  colorContextProvider(),
  property({ reflect: true, attribute: "color-palette" })
], RhCard.prototype, "colorPalette", void 0);
__decorate([
  property({ reflect: true })
], RhCard.prototype, "variant", void 0);
__decorate([
  property({ reflect: true, attribute: "full-width", type: Boolean })
], RhCard.prototype, "fullWidth", void 0);
__decorate([
  colorContextConsumer()
], RhCard.prototype, "on", void 0);
RhCard = __decorate([
  customElement("rh-card")
], RhCard);
export {
  RhCard
};
//# sourceMappingURL=@rhds_elements_rh-card_rh-card__js.js.map
