import { card as r } from "@universityofmaryland/web-elements-library/composite";
import { toUMDElement as n } from "@universityofmaryland/web-utilities-library/adapters";
import { Slots as t, Register as l, Model as w, Attributes as a, Lifecycle as y } from "@universityofmaryland/web-model-library";
import { e as c } from "./_event-Duz7QGRD.js";
import * as f from "@universityofmaryland/web-utilities-library/validation";
import { createStyledSlotOrClone as b } from "@universityofmaryland/web-utilities-library/elements";
const k = ({ tagName: e }) => {
  const i = {
    headline: {
      required: !0,
      ...t.element.allowed.subHeadline
    },
    body: t.element.allowed.text
  }, d = (o) => ({
    image: f.getValidatedSlotImage({
      element: o,
      slotName: t.name.assets.image
    }),
    eyebrow: t.eyebrow.default({ element: o }),
    headline: t.headline.default({ element: o }),
    text: t.text.default({ element: o }),
    date: t.date.default({ element: o }),
    actions: t.actions.default({ element: o }),
    isTransparent: a.isVisual.transparent({ element: o }),
    isThemeDark: a.isTheme.dark({ element: o })
  }), s = (o) => {
    const u = a.isVisual.aligned({ element: o }), v = a.isVisual.bordered({ element: o }), p = a.isDisplay.list({ element: o }), m = d(o);
    return p ? r.list({
      ...m,
      isAligned: u
    }) : r.block({
      ...m,
      isAligned: u,
      hasBorder: v
    });
  };
  return () => {
    l.registerWebComponent({
      name: e,
      element: w.createCustomElement({
        tagName: e,
        slots: i,
        createComponent: s
      })
    });
  };
};
var h = k;
const x = "umd-element-article", C = h({ tagName: x });
var j = C;
const D = "umd-element-event", T = {
  headline: {
    ...t.element.allowed.headline,
    required: !0
  },
  text: t.element.allowed.text,
  "date-start-iso": t.element.allowed.time,
  "date-end-iso": t.element.allowed.time,
  location: t.element.allowed.text,
  image: t.element.allowed.imageLink,
  eyebrow: t.element.allowed.eyebrow,
  actions: t.element.allowed.actions
}, S = (e) => {
  const i = c(e);
  if (!i)
    return { element: document.createElement("div"), styles: "" };
  if (a.isDisplay.feature({ element: e })) {
    const s = c(e, {
      isLargeSize: !0,
      isDateSignDark: !1
    });
    return r.block({
      actions: t.actions.default({ element: e }),
      dateSign: n(s?.dateSign),
      eventMeta: n(s?.eventMeta),
      eyebrow: t.eyebrow.default({ element: e }),
      hasEyebrowRibbon: !0,
      headline: t.headline.default({ element: e }),
      image: t.assets.image({ element: e }),
      isThemeDark: a.isTheme.dark({ element: e }),
      isTransparent: a.isVisual.transparent({ element: e }),
      text: t.text.default({ element: e })
    });
  }
  if (a.isDisplay.promo({ element: e })) {
    const s = c(e, {
      isThemeDark: !0,
      // Force dark theme for meta in overlay
      isDateSignDark: !1
    });
    return r.overlay.image({
      actions: t.actions.default({ element: e }),
      backgroundImage: t.assets.image({ element: e }),
      dateSign: n(s?.dateSign),
      eventMeta: n(s?.eventMeta),
      headline: t.headline.default({ element: e }),
      isThemeDark: a.isTheme.dark({ element: e }),
      text: t.text.default({ element: e })
    });
  }
  if (a.isDisplay.list({ element: e })) {
    const s = c(e, {
      isLargeSize: !0
    });
    return r.list({
      actions: t.actions.default({ element: e }),
      dateSign: n(s?.dateSign),
      eventMeta: n(s?.eventMeta),
      headline: t.headline.default({ element: e }),
      image: t.assets.image({ element: e }),
      isThemeDark: a.isTheme.dark({ element: e }),
      text: t.text.default({ element: e })
    });
  }
  const { eventMeta: d } = i;
  return r.block({
    actions: t.actions.default({ element: e }),
    eventMeta: n(d),
    headline: t.headline.default({ element: e }),
    image: t.assets.image({ element: e }),
    isThemeDark: a.isTheme.dark({ element: e }),
    isTransparent: a.isVisual.transparent({ element: e }),
    text: t.text.default({ element: e })
  });
}, $ = l.webComponent({
  tagName: D,
  slots: T,
  createComponent: S
});
var F = $;
const N = "umd-element-card-icon", M = {
  headline: {
    ...t.element.allowed.headline,
    required: !0
  },
  text: t.element.allowed.text,
  image: t.element.allowed.image
}, E = (e) => r.overlay.icon({
  image: f.getValidatedSlotImage({
    element: e,
    slotName: t.name.assets.image
  }),
  headline: t.headline.default({ element: e }),
  text: t.text.default({ element: e }),
  isThemeDark: a.isTheme.dark({ element: e })
}), V = l.webComponent({
  tagName: N,
  slots: M,
  createComponent: E
});
var G = V;
const _ = "umd-element-card-overlay", q = {
  headline: {
    ...t.element.allowed.headline,
    required: !0
  },
  text: t.element.allowed.text,
  eyebrow: t.element.allowed.eyebrow,
  image: t.element.allowed.image,
  actions: t.element.allowed.actions,
  date: t.element.allowed.time,
  "cta-icon": {
    allowedElements: ["a"]
  }
}, g = ({ element: e }) => ({
  eyebrow: t.eyebrow.default({ element: e }),
  headline: t.headline.default({ element: e }),
  text: t.text.default({ element: e }),
  date: t.date.default({ element: e }),
  actions: t.actions.default({ element: e }),
  ctaIcon: b({
    element: e,
    slotRef: t.name.CTA_ICON
  }),
  isQuote: a.isVisual.quote({ element: e }),
  isThemeDark: a.isTheme.dark({ element: e }),
  isThemeLight: a.isTheme.light({ element: e })
}), I = (e) => {
  if (a.isLayout.image({ element: e })) {
    const i = r.overlay.image({
      ...g({ element: e }),
      backgroundImage: t.assets.image({ element: e })
    });
    if (i)
      return i;
  }
  return r.overlay.color({ ...g({ element: e }) });
}, L = l.webComponent({
  tagName: _,
  slots: q,
  createComponent: I,
  afterConnect: y.hooks.loadOnConnect
});
var J = L, K = h({ tagName: "umd-element-card" });
const O = "umd-element-card-video", A = {
  video: {
    ...t.element.allowed.video,
    required: !0
  }
}, R = (e) => {
  const i = t.assets.video({ element: e }), d = a.isDisplay.short({ element: e }), s = a.isVisual.play({ element: e });
  return i ? d ? r.video.short({
    video: i
  }) : r.video.block({
    video: i,
    isAutoplay: s
  }) : (console.error("Video slot is required for umd-element-card-video"), { element: document.createElement("div"), styles: "" });
}, z = l.webComponent({
  tagName: O,
  slots: A,
  createComponent: R
});
var P = z;
export {
  j as a,
  F as e,
  G as i,
  J as o,
  K as s,
  P as v
};
//# sourceMappingURL=video-C2XikZ0X.js.map
