// ../src/helpers/formatClassString.ts
var formatClassString = (classesArray) => {
  return classesArray.filter((x) => !!x).join(" ");
};

// ../src/foundations/icons/sprite.svg
import { h } from "preact";
import { jsx, jsxs } from "preact/jsx-runtime";

// ../src/components/icon-sprite/icon-sprite.tsx
import { jsx as jsx2 } from "preact/jsx-runtime";
var IconUse = ({ iconName, classNames, attributes }) => {
  const componentClassName = "ds-icon";
  const classes = formatClassString([
    componentClassName,
    `${componentClassName}--sprite`,
    `${componentClassName}--${iconName}`,
    classNames
  ]);
  return /* @__PURE__ */ jsx2("i", { className: classes, ...attributes, children: /* @__PURE__ */ jsx2("svg", { children: /* @__PURE__ */ jsx2("use", { xlinkHref: `#ds-${iconName}` }) }) });
};

// ../src/components/teaser-dot/teaser-dot.tsx
import { jsx as jsx3 } from "preact/jsx-runtime";
var TeaserDot = ({ flashing, forcePx, classNames, attributes = {} }) => {
  const classes = formatClassString([
    "ds-teaser-dot",
    flashing && "ds-teaser-dot--flashing",
    forcePx && "ds-force-px",
    classNames
  ]);
  return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes });
};

// ../src/helpers/teaser.tsx
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
var Media = ({ media, rounded, isSquareImage }) => {
  const classNames = formatClassString([
    "ds-teaser__media",
    rounded && "ds-teaser__media--rounded",
    isSquareImage && "ds-teaser__media--square-image"
  ]);
  return media ? /* @__PURE__ */ jsx4("div", { className: classNames, children: media }) : null;
};
var Content = ({ children, bylinePicture }) => {
  return /* @__PURE__ */ jsxs2("div", { className: "ds-teaser__content", children: [
    /* @__PURE__ */ jsx4("div", { className: "ds-teaser__content-inner", children }),
    bylinePicture && /* @__PURE__ */ jsx4("div", { className: "ds-teaser__byline", children: bylinePicture })
  ] });
};
var Title = ({ title, highlight, isItalicHeadline }) => {
  return title ? /* @__PURE__ */ jsxs2("h2", { className: `ds-teaser__title ${isItalicHeadline ? "ds-teaser__title--italic" : ""}`, children: [
    highlight && /* @__PURE__ */ jsxs2("span", { className: "ds-teaser__highlight", children: [
      highlight,
      " "
    ] }),
    title
  ] }) : null;
};
var Body = ({ text, sticker, isFlashingDot }) => {
  return text ? /* @__PURE__ */ jsxs2("p", { className: "ds-teaser__text", children: [
    sticker && /* @__PURE__ */ jsxs2(Fragment, { children: [
      /* @__PURE__ */ jsx4(TeaserDot, { flashing: isFlashingDot }),
      /* @__PURE__ */ jsxs2("span", { className: "ds-teaser__sticker", children: [
        " ",
        sticker,
        " "
      ] })
    ] }),
    text
  ] }) : null;
};
var Vignette = ({ vignette, variant }) => {
  return vignette ? /* @__PURE__ */ jsxs2("div", { className: "ds-teaser__vignette", children: [
    variant === "podcast" && /* @__PURE__ */ jsx4(IconUse, { iconName: "headphones" }),
    vignette
  ] }) : null;
};

// ../src/components/teaser-card/teaser-card.tsx
import { jsx as jsx5 } from "preact/jsx-runtime";
var TeaserCard = ({ areaType, targetLink, theme, classNames, attributes, children }) => {
  const componentClassName = "ds-teaser";
  const classes = formatClassString([
    componentClassName,
    areaType && areaType !== "main" && `${componentClassName}--${areaType}`,
    areaType == "bauta" && "ds-dark",
    theme && `ds-theme--${theme}`,
    classNames
  ]);
  if (targetLink) {
    return /* @__PURE__ */ jsx5("a", { className: classes, href: targetLink, ...attributes, children });
  }
  return /* @__PURE__ */ jsx5("div", { className: classes, ...attributes, children });
};

// ../src/components/teaser-footer/teaser-footer.tsx
import { Fragment as Fragment2 } from "preact/jsx-runtime";
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
var TeaserFooter = (props) => {
  const { footerVariant, attributes = {}, classNames = "" } = props;
  const componentClassName = "ds-teaser-footer";
  const classes = formatClassString([componentClassName, `${componentClassName}--${footerVariant}`, classNames]);
  return footerVariant !== "default" ? /* @__PURE__ */ jsxs3("div", { className: classes, ...attributes, children: [
    footerVariant === "informationText" && /* @__PURE__ */ jsx6(InformationText, { ...props }),
    footerVariant === "podcast" && /* @__PURE__ */ jsxs3(Fragment3, { children: [
      /* @__PURE__ */ jsx6(IconUse, { iconName: "play_arrow-filled" }),
      /* @__PURE__ */ jsxs3("div", { children: [
        /* @__PURE__ */ jsx6("span", { className: `${componentClassName}__title`, children: "Lyssna p\xE5 avsnittet" }),
        /* @__PURE__ */ jsx6(InformationText, { ...props })
      ] })
    ] })
  ] }) : null;
};
function InformationText({ duration, publicationTime, sectionName }) {
  const strings = [duration, publicationTime, sectionName].filter(Boolean);
  if (strings.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsx6("div", { className: "ds-teaser-footer__notes", children: strings.map((text, index) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
    text,
    index < strings.length - 1 && " \u2022 "
  ] }, index)) });
}

// ../src/components/teaser-split/teaser-split.tsx
import { jsx as jsx7, jsxs as jsxs4 } from "preact/jsx-runtime";
var TeaserSplit = ({
  title,
  targetLink,
  variant,
  areaType,
  theme,
  text,
  vignette,
  highlight,
  sticker,
  media,
  isFlashingDot,
  publicationTime,
  duration,
  attributes = {},
  classNames
}) => {
  const componentClassName = "ds-teaser";
  const classes = formatClassString(["ds-teaser--split", variant && `${componentClassName}--${variant}`, classNames]);
  return /* @__PURE__ */ jsxs4(TeaserCard, { targetLink, areaType, theme, classNames: classes, ...attributes, children: [
    /* @__PURE__ */ jsx7(Media, { media, rounded: true }),
    /* @__PURE__ */ jsxs4(Content, { children: [
      /* @__PURE__ */ jsx7(Vignette, { vignette, variant }),
      /* @__PURE__ */ jsx7(Title, { title, highlight }),
      /* @__PURE__ */ jsx7(Body, { text, sticker, isFlashingDot }),
      variant === "podcast" && /* @__PURE__ */ jsx7(TeaserFooter, { footerVariant: "podcast", publicationTime, duration })
    ] })
  ] });
};
export {
  TeaserSplit
};
//# sourceMappingURL=teaser-split.js.map
