import { carousel as c } from "@universityofmaryland/web-elements-library/composite";
import { createSlot as v } from "@universityofmaryland/web-utilities-library/elements";
import { Attributes as a, Register as u, Lifecycle as p, Slots as o } from "@universityofmaryland/web-model-library";
import { imageHasAlt as f } from "@universityofmaryland/web-utilities-library/accessibility";
const z = "umd-element-carousel", x = {
  blocks: {
    required: !0
  }
}, R = a.handler.common.resize(
  (t) => t.events?.resize()
), I = (t) => {
  const i = t.shadowRoot, r = a.isTheme.dark({
    element: t
  }), s = t.getAttribute("left-button"), d = t.getAttribute("right-button"), l = t.getAttribute("mobile-hint"), n = t.getAttribute("hint"), e = t.getAttribute("tablet-size"), m = t.getAttribute("desktop-size"), b = t.getAttribute("tablet-count"), g = t.getAttribute("desktop-count"), h = t.getAttribute("max-count"), w = t.getAttribute("grid-gap-pixels"), C = t.querySelector(
    `[slot="${o.name.BLOCKS}"]`
  ), y = Array.from(
    C.querySelectorAll(":scope > *")
  );
  let S = !0, A = !0, $ = !0, k = !0;
  s === "false" && (S = !1), d === "false" && (A = !1), l === "false" && ($ = !1), n === "false" && (k = !1), (() => {
    const q = v(o.name.BLOCKS);
    i.appendChild(q);
  })();
  const N = i.querySelector(
    `[name="${o.name.BLOCKS}"]`
  );
  return c.macro({
    slide: C,
    shadowRef: N,
    blocks: y,
    isThemeDark: r,
    hasLeftButton: S,
    hasRightButton: A,
    mobileHint: $,
    hint: k,
    tabletSize: e ? parseInt(e) : void 0,
    desktopSize: m ? parseInt(m) : void 0,
    tabletCount: b ? parseInt(b) : void 0,
    desktopCount: g ? parseInt(g) : void 0,
    maxCount: h ? parseInt(h) : void 0,
    gridGap: w
  });
}, T = u.webComponent({
  tagName: z,
  slots: x,
  createComponent: I,
  attributes: [R],
  afterConnect: p.hooks.loadOnConnect
});
var ct = T;
const B = "umd-element-carousel-cards", E = {
  cards: {
    required: !0
  },
  headline: o.element.allowed.headline,
  text: o.element.allowed.text,
  actions: o.element.allowed.actions
}, O = a.handler.common.resize(
  (t) => t.events?.resize()
), D = (t) => {
  const i = t.shadowRoot, r = t.querySelector(
    `[slot="${o.name.CARDS}"]`
  ), s = Array.from(
    r.querySelectorAll(":scope > *")
  );
  (() => {
    const n = v(o.name.CARDS);
    i.appendChild(n);
  })();
  const l = i.querySelector(
    `[name="${o.name.CARDS}"]`
  );
  return c.cards({
    slide: r,
    shadowRef: l,
    cards: s,
    headline: o.headline.default({ element: t }),
    text: o.text.default({ element: t }),
    actions: o.actions.default({ element: t })
  });
}, L = u.webComponent({
  tagName: B,
  slots: E,
  createComponent: D,
  attributes: [O],
  afterConnect: p.hooks.loadOnConnect
});
var ut = L;
const H = "umd-element-carousel-image", _ = {
  images: {
    required: !0,
    allowedElements: ["img", "div"]
  },
  headlines: {
    allowedElements: ["div"]
  },
  texts: {
    allowedElements: ["div"]
  }
}, G = a.handler.common.resize(
  (t) => t.events?.SetEventReize()
), M = (t) => {
  const i = Array.from(
    t.querySelectorAll(`[slot="${o.name.IMAGES}"] > *`)
  ), r = Array.from(
    t.querySelectorAll(`[slot="${o.name.HEADLINES}"] > *`)
  ), s = Array.from(
    t.querySelectorAll(`[slot="${o.name.TEXTS}"] > *`)
  ), d = r.map(
    (e) => e.cloneNode(!0)
  ), l = s.map(
    (e) => e.cloneNode(!0)
  ), n = i.map((e) => e.nodeName === "IMG" && f(e) ? e.cloneNode(!0) : null).filter((e) => e !== null);
  return c.image({
    images: n,
    headlines: d,
    texts: l,
    isThemeDark: a.isTheme.dark({ element: t }),
    isFullScreenOption: a.includesFeature.fullScreenOption({
      element: t
    })
  });
}, F = u.webComponent({
  tagName: H,
  slots: _,
  createComponent: M,
  attributes: [G]
});
var dt = F;
const K = "umd-element-carousel-multiple-image", X = {
  images: {
    required: !0,
    allowedElements: ["div", "img"]
  }
}, j = a.handler.common.resize(
  (t) => t.events?.SetEventReize()
), J = (t) => {
  const r = Array.from(
    t.querySelectorAll(`[slot="${o.name.IMAGES}"] > *`)
  ).map((s) => s.nodeName === "IMG" && f(s) ? s.cloneNode(!0) : null).filter((s) => s !== null);
  return c.images({
    images: r,
    isThemeDark: a.isTheme.dark({ element: t }),
    isFullScreenOption: a.includesFeature.fullScreenOption({
      element: t
    })
  });
}, P = u.webComponent({
  tagName: K,
  slots: X,
  createComponent: J,
  attributes: [j]
});
var mt = P;
const Q = "umd-element-carousel-thumbnail", U = {
  blocks: {
    required: !0
  }
}, V = a.handler.common.resize(
  (t) => t.events?.resize()
), W = (t) => {
  const r = Array.from(
    t.querySelectorAll(`[slot="${o.name.BLOCKS}"] > *`)
  ).map(
    (s) => s.cloneNode(!0)
  );
  return c.thumbnail({
    blocks: r,
    isThemeDark: a.isTheme.dark({ element: t })
  });
}, Y = u.webComponent({
  tagName: Q,
  slots: U,
  createComponent: W,
  attributes: [V],
  afterConnect: p.hooks.loadOnConnect
});
var bt = Y;
const Z = "umd-element-carousel-image-wide", tt = {
  slides: {
    required: !0,
    allowedElements: ["figure", "div"]
  }
}, et = a.handler.common.resize(
  (t) => t.events?.resize()
), ot = (t) => {
  const i = t.getAttribute("title"), r = t.getAttribute("animation-time"), s = t.getAttribute("mobile-breakpoint"), l = Array.from(
    t.querySelectorAll('[slot="slides"] > *')
  ).map((n) => {
    const e = n.querySelector("img"), m = n.querySelector("[data-headline]"), b = n.querySelector("[data-text]");
    return e && !f(e) ? (console.warn("Carousel slide image missing alt text:", e), null) : {
      image: e ? e.cloneNode(!0) : null,
      headline: m ? m.cloneNode(!0) : void 0,
      text: b ? b.cloneNode(!0) : void 0
    };
  }).filter((n) => n && n.image);
  return c.wide({
    slides: l,
    title: i || void 0,
    isThemeDark: a.isTheme.dark({ element: t }),
    animationTime: r ? parseInt(r) : void 0,
    mobileBreakpoint: s ? parseInt(s) : void 0
  });
}, st = u.webComponent({
  tagName: Z,
  slots: tt,
  createComponent: ot,
  attributes: [et],
  afterConnect: p.hooks.loadOnConnect
});
var pt = st;
export {
  ct as b,
  ut as c,
  mt as m,
  dt as s,
  bt as t,
  pt as w
};
//# sourceMappingURL=wide-B08z0PJj.js.map
