var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/layout/Carousel.tsx
var Carousel_exports = {};
__export(Carousel_exports, {
  Carousel: () => Carousel,
  CarouselSlide: () => CarouselSlide,
  default: () => CarouselTabs
});
module.exports = __toCommonJS(Carousel_exports);
var import_react4 = require("react");
var import_clsx2 = __toESM(require("clsx"));
var import_lucide_react = require("lucide-react");

// src/utils/array.ts
var defaultRangeOptions = {
  allowEmptyRange: false,
  stepSize: 1,
  exclusiveStart: false,
  exclusiveEnd: true
};
var range = (endOrRange, options) => {
  const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options };
  let start = 0;
  let end;
  if (typeof endOrRange === "number") {
    end = endOrRange;
  } else {
    start = endOrRange[0];
    end = endOrRange[1];
  }
  if (!exclusiveEnd) {
    end -= 1;
  }
  if (exclusiveStart) {
    start += 1;
  }
  if (end - 1 < start) {
    if (!allowEmptyRange) {
      console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`);
    }
    return [];
  }
  return Array.from({ length: end - start }, (_, index) => index * stepSize + start);
};
var createLoopingListWithIndex = (list, startIndex = 0, length = 0, forwards = true) => {
  if (length < 0) {
    console.warn(`createLoopingList: length must be >= 0, given ${length}`);
  } else if (length === 0) {
    length = list.length;
  }
  const returnList = [];
  if (forwards) {
    for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {
      returnList.push([i, list[i]]);
    }
  } else {
    for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {
      returnList.push([i, list[i]]);
    }
  }
  return returnList;
};

// src/components/user-action/Button.tsx
var import_react = require("react");
var import_clsx = __toESM(require("clsx"));
var import_jsx_runtime = require("react/jsx-runtime");
var ButtonColorUtil = {
  solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
  text: ["primary", "negative", "neutral"],
  outline: ["primary"]
};
var IconButtonUtil = {
  icon: [...ButtonColorUtil.solid, "transparent"]
};
var paddingMapping = {
  none: "",
  small: "btn-sm",
  medium: "btn-md",
  large: "btn-lg"
};
var iconPaddingMapping = {
  none: "",
  tiny: "icon-btn-xs",
  small: "icon-btn-sm",
  medium: "icon-btn-md",
  large: "icon-btn-lg"
};
var ButtonUtil = {
  paddingMapping,
  iconPaddingMapping
};
var SolidButton = (0, import_react.forwardRef)(function SolidButton2({
  children,
  color = "primary",
  size = "medium",
  startIcon,
  endIcon,
  onClick,
  className,
  ...restProps
}, ref) {
  const colorClasses = {
    primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
    secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
    tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
    positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
    warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
    negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
    neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
  }[color];
  const iconColorClasses = {
    primary: "not-group-disabled:text-button-solid-primary-icon",
    secondary: "not-group-disabled:text-button-solid-secondary-icon",
    tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
    positive: "not-group-disabled:text-button-solid-positive-icon",
    warning: "not-group-disabled:text-button-solid-warning-icon",
    negative: "not-group-disabled:text-button-solid-negative-icon",
    neutral: "not-group-disabled:text-button-solid-neutral-icon"
  }[color];
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
    "button",
    {
      ref,
      onClick,
      className: (0, import_clsx.default)(
        "group font-semibold",
        colorClasses,
        "not-disabled:hover:brightness-90",
        "disabled:text-disabled disabled:bg-disabled-background",
        ButtonUtil.paddingMapping[size],
        className
      ),
      ...restProps,
      children: [
        startIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          "span",
          {
            className: (0, import_clsx.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: startIcon
          }
        ),
        children,
        endIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          "span",
          {
            className: (0, import_clsx.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: endIcon
          }
        )
      ]
    }
  );
});
var IconButton = (0, import_react.forwardRef)(function IconButton2({
  children,
  color = "primary",
  size = "medium",
  className,
  ...restProps
}, ref) {
  const colorClasses = {
    primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
    secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
    tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
    positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
    warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
    negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
    neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
    transparent: "not-disabled:bg-transparent"
  }[color];
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    "button",
    {
      ref,
      className: (0, import_clsx.default)(
        colorClasses,
        "not-disabled:hover:brightness-90",
        "disabled:text-disabled",
        {
          "disabled:bg-disabled-background": color !== "transparent",
          "disabled:opacity-70": color === "transparent",
          "not-disabled:hover:bg-button-text-hover-background": color === "transparent"
        },
        ButtonUtil.iconPaddingMapping[size],
        className
      ),
      ...restProps,
      children
    }
  );
});

// src/localization/LanguageProvider.tsx
var import_react3 = require("react");

// src/hooks/useLocalStorage.ts
var import_react2 = require("react");

// src/localization/util.ts
var languages = ["en", "de"];
var languagesLocalNames = {
  en: "English",
  de: "Deutsch"
};
var DEFAULT_LANGUAGE = "en";
var LanguageUtil = {
  languages,
  DEFAULT_LANGUAGE,
  languagesLocalNames
};

// src/localization/LanguageProvider.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var LanguageContext = (0, import_react3.createContext)({
  language: LanguageUtil.DEFAULT_LANGUAGE,
  setLanguage: (v) => v
});
var useLanguage = () => {
  const context = (0, import_react3.useContext)(LanguageContext);
  if (!context) {
    throw new Error("useLanguage must be used within LanguageContext. Try adding a LanguageProvider around your app.");
  }
  return context;
};

// src/localization/useTranslation.ts
var TranslationPluralCount = {
  zero: 0,
  one: 1,
  two: 2,
  few: 3,
  many: 11,
  other: -1
};
var useTranslation = (translations, overwriteTranslation = {}) => {
  const { language: languageProp, translation: overwrite } = overwriteTranslation;
  const { language: inferredLanguage } = useLanguage();
  const usedLanguage = languageProp ?? inferredLanguage;
  const usedTranslations = [...translations];
  if (overwrite) {
    usedTranslations.push(overwrite);
  }
  return (key, options) => {
    const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
    try {
      for (let i = translations.length - 1; i >= 0; i--) {
        const translation = translations[i];
        const localizedTranslation = translation[usedLanguage];
        if (!localizedTranslation) {
          continue;
        }
        const value = localizedTranslation[key];
        if (!value) {
          continue;
        }
        let forProcessing;
        if (typeof value !== "string") {
          if (count === TranslationPluralCount.zero && value?.zero) {
            forProcessing = value.zero;
          } else if (count === TranslationPluralCount.one && value?.one) {
            forProcessing = value.one;
          } else if (count === TranslationPluralCount.two && value?.two) {
            forProcessing = value.two;
          } else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
            forProcessing = value.few;
          } else if (count > TranslationPluralCount.many && value?.many) {
            forProcessing = value.many;
          } else {
            forProcessing = value.other;
          }
        } else {
          forProcessing = value;
        }
        forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
          return replacements[placeholder] ?? `{{key:${placeholder}}}`;
        });
        return forProcessing;
      }
    } catch (e) {
      console.error(e);
    }
    return `{{${usedLanguage}:${key}}}`;
  };
};

// src/components/layout/Carousel.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var CarouselContext = (0, import_react4.createContext)(null);
var useCarouselContext = () => {
  const context = (0, import_react4.useContext)(CarouselContext);
  if (!context) {
    console.error("useCarouselContext must be used within CarouselContext");
  }
  return context;
};
var defaultCarouselTabTranslationType = {
  en: {
    showSlide: `Show Slide {{index}}`,
    slideNavigation: "Slide navigation"
  },
  de: {
    showSlide: "Zeige Slide {{index}}",
    slideNavigation: "Slide Navigation"
  }
};
function CarouselTabs({
  onChange
}) {
  const translation = useTranslation([
    defaultCarouselTabTranslationType
  ]);
  const { id, slideCount, currentIndex, isLooping } = useCarouselContext();
  const tabRefs = (0, import_react4.useRef)([]);
  const handleKeyDown = (event, index) => {
    let newIndex = index;
    if (event.key === "ArrowRight") {
      newIndex = isLooping ? (index + 1) % slideCount : Math.max(index + 1, slideCount - 1);
    } else if (event.key === "ArrowLeft") {
      newIndex = isLooping ? (index - 1 + slideCount) % slideCount : Math.max(index - 1, 0);
    } else {
      return;
    }
    event.preventDefault();
    onChange(newIndex);
    tabRefs.current[newIndex]?.focus();
  };
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
    "div",
    {
      className: "flex-row-1 items-center justify-center w-full my-2",
      role: "tablist",
      "aria-label": translation("slideNavigation"),
      id: `${id}-tablist`,
      children: range(slideCount).map((index) => {
        const isSelected = currentIndex === index;
        return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
          "button",
          {
            id: `${id}-tab-${index}`,
            ref: (el) => tabRefs.current[index] = el,
            onClick: () => onChange(index),
            onKeyDown: (e) => handleKeyDown(e, index),
            className: (0, import_clsx2.default)(
              "w-8 min-w-8 h-3 min-h-3 first:rounded-l-md last:rounded-r-md",
              {
                "bg-carousel-dot-disabled hover:bg-carousel-dot-active": currentIndex !== index,
                "bg-carousel-dot-active hover:brightness-90": currentIndex === index
              }
            ),
            role: "tab",
            tabIndex: isSelected ? 0 : -1,
            "aria-label": translation("showSlide", { replacements: { index: (index + 1).toString() } }),
            "aria-selected": isSelected,
            "aria-controls": `slide-${index}`,
            "aria-disabled": isSelected
          },
          index
        );
      })
    }
  );
}
var defaultCarouselSlideTranslationType = {
  en: {
    slide: "Slide",
    slideOf: `Slide {{index}} of {{length}} slides`
  },
  de: {
    slide: "Slide",
    slideOf: `Slide {{index}} von {{length}} slides`
  }
};
var CarouselSlide = (0, import_react4.forwardRef)(
  function CarouselSlide2({
    index,
    isSelected,
    ...props
  }, ref) {
    const translation = useTranslation([defaultCarouselSlideTranslationType]);
    const { id, slideCount } = useCarouselContext();
    return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
      "div",
      {
        ...props,
        ref,
        id: `${id}-slide-${index}`,
        className: (0, import_clsx2.default)("focus-style-none group/slide", props.className),
        tabIndex: isSelected ? 0 : void 0,
        role: "group",
        "aria-roledescription": translation("slide"),
        "aria-label": translation("slideOf", {
          replacements: {
            index: (index + 1).toString(),
            length: slideCount.toString()
          }
        }),
        "aria-hidden": isSelected ? void 0 : true
      }
    );
  }
);
var defaultCarouselTranslationType = {
  en: {
    slide: "Slide",
    carousel: "Carousel",
    slideOf: `Slide {{index}} of {{length}} slides`,
    chooseSlide: "Choose slide to display"
  },
  de: {
    slide: "Slide",
    carousel: "Karussell",
    slideOf: `Slide {{index}} von {{length}} slides`,
    chooseSlide: "W\xE4hle die angezeigte Slide aus"
  }
};
var Carousel = ({
  children,
  animationTime = 200,
  isLooping = false,
  isAutoPlaying = false,
  autoLoopingTimeOut = 5e3,
  autoLoopAnimationTime = 1e3,
  hintNext = false,
  arrows = false,
  dots = true,
  blurColor = "from-background",
  heightClassName = "h-96",
  slideClassName = "w-[70%] desktop:w-1/2",
  slideContainerProps,
  onSlideChanged,
  ...props
}) => {
  const translation = useTranslation([defaultCarouselTranslationType]);
  const slideRefs = (0, import_react4.useRef)([]);
  const [currentIndex, setCurrentIndex] = (0, import_react4.useState)(0);
  const [hasFocus, setHasFocus] = (0, import_react4.useState)(false);
  const [dragState, setDragState] = (0, import_react4.useState)();
  const isPaused = hasFocus;
  const carouselContainerRef = (0, import_react4.useRef)(null);
  const [disableClick, setDisableClick] = (0, import_react4.useState)(false);
  const timeOut = (0, import_react4.useRef)(void 0);
  const length = (0, import_react4.useMemo)(() => children.length, [children]);
  const paddingItemCount = 3;
  const generatedId = "carousel" + (0, import_react4.useId)();
  const id = props.id ?? generatedId;
  if (isAutoPlaying && !isLooping) {
    console.error("When isAutoLooping is true, isLooping should also be true");
    isLooping = true;
  }
  autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut);
  animationTime = Math.max(100, animationTime);
  autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime);
  (0, import_react4.useEffect)(() => {
    const carousel = carouselContainerRef.current;
    if (carousel) {
      let onFocus = function() {
        setHasFocus(true);
      }, onBlur = function() {
        setHasFocus(false);
      };
      carousel?.addEventListener("focusin", onFocus);
      carousel?.addEventListener("focusout", onBlur);
      return () => {
        carousel?.removeEventListener("focusin", onFocus);
        carousel?.removeEventListener("focusin", onFocus);
      };
    }
  }, []);
  const getStyleOffset = (index) => {
    const baseOffset = -50 + (index - currentIndex) * 100;
    return `${baseOffset}%`;
  };
  const canGoLeft = () => {
    return isLooping || currentIndex !== 0;
  };
  const canGoRight = (0, import_react4.useCallback)(() => {
    return isLooping || currentIndex !== length - 1;
  }, [currentIndex, isLooping, length]);
  const left = () => {
    if (canGoLeft()) {
      setCurrentIndex(currentIndex - 1);
    }
  };
  const right = (0, import_react4.useCallback)(() => {
    if (canGoRight()) {
      setCurrentIndex((currentIndex + length + 1) % length);
    }
  }, [canGoRight, currentIndex, length]);
  (0, import_react4.useEffect)(() => {
    if (!timeOut.current && !isPaused) {
      if (autoLoopingTimeOut > 0) {
        timeOut.current = setTimeout(() => {
          right();
          timeOut.current = void 0;
        }, autoLoopingTimeOut);
      } else {
        right();
      }
    }
    if ((isPaused || !!dragState) && timeOut.current) {
      clearTimeout(timeOut.current);
      timeOut.current = void 0;
    }
  }, [right, isPaused, autoLoopingTimeOut, dragState]);
  let items = children.map((item, index) => ({
    index,
    item
  }));
  let before = [];
  let after = [];
  if (isLooping) {
    before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
      index,
      item
    }));
    after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
      index,
      item
    }));
    items = [...before, ...items, ...after];
  }
  const handlePointerDown = (e) => {
    setDragState({
      dragOffsetX: 0,
      dragStartX: e.clientX
    });
  };
  const handlePointerMove = (e) => {
    if (!dragState) return;
    setDragState((prevState) => ({ dragStartX: prevState.dragStartX, dragOffsetX: e.clientX - prevState.dragStartX }));
  };
  const handlePointerUp = () => {
    if (!dragState) return;
    if (dragState.dragOffsetX > 50) {
      left();
    } else if (dragState.dragOffsetX < -50) {
      right();
    }
    setDragState(void 0);
  };
  (0, import_react4.useEffect)(() => {
    setDisableClick(!dragState);
  }, [dragState]);
  (0, import_react4.useEffect)(() => {
    onSlideChanged?.(currentIndex);
  }, [currentIndex]);
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CarouselContext.Provider, { value: { id, currentIndex, slideCount: length, isLooping }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
    "div",
    {
      ref: carouselContainerRef,
      ...props,
      className: (0, import_clsx2.default)("flex-col-2 items-center w-full", props.className),
      id,
      role: "region",
      "aria-roledescription": translation("slide"),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
          "div",
          {
            ...slideContainerProps,
            className: (0, import_clsx2.default)(`relative w-full overflow-hidden`, heightClassName, slideContainerProps?.className),
            children: [
              hintNext ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
                "div",
                {
                  onPointerDown: handlePointerDown,
                  onPointerMove: handlePointerMove,
                  onPointerUp: handlePointerUp,
                  onPointerLeave: handlePointerUp,
                  className: (0, import_clsx2.default)(`flex-row-2 relative h-full`, heightClassName),
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex-row-2 relative h-full w-full px-2 overflow-hidden", children: items.map(({
                      item,
                      index
                    }, listIndex) => {
                      const isInItems = before.length <= listIndex && listIndex < items.length - after.length;
                      return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                        CarouselSlide,
                        {
                          ref: isInItems ? slideRefs[index] : void 0,
                          index,
                          isSelected: isInItems && currentIndex === index,
                          className: (0, import_clsx2.default)(
                            `absolute left-[50%] h-full overflow-hidden transition-transform ease-in-out`,
                            slideClassName
                          ),
                          onClick: () => !disableClick && setCurrentIndex(index),
                          style: {
                            translate: `calc(${getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0))} + ${dragState ? dragState.dragOffsetX : 0}px)`,
                            transitionDuration: dragState ? "0ms" : (isAutoPlaying && !isPaused ? autoLoopAnimationTime : animationTime) + "ms"
                          },
                          children: item
                        },
                        listIndex
                      );
                    }) }),
                    /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                      "div",
                      {
                        className: (0, import_clsx2.default)(`hidden desktop:block pointer-events-none absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)
                      }
                    ),
                    /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                      "div",
                      {
                        className: (0, import_clsx2.default)(`hidden desktop:block pointer-events-none absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)
                      }
                    )
                  ]
                }
              ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                "div",
                {
                  ref: slideRefs[currentIndex],
                  className: (0, import_clsx2.default)("px-16 h-full"),
                  tabIndex: 0,
                  role: "group",
                  "aria-roledescription": translation("slide"),
                  "aria-label": translation("slideOf", {
                    replacements: {
                      index: (currentIndex + 1).toString(),
                      length: items.length.toString()
                    }
                  }),
                  children: children[currentIndex]
                }
              ),
              arrows && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
                /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                  IconButton,
                  {
                    color: "neutral",
                    className: (0, import_clsx2.default)("absolute z-10 left-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoLeft() }),
                    disabled: !canGoLeft(),
                    onClick: () => left(),
                    children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronLeft, { size: 24 })
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
                  IconButton,
                  {
                    color: "neutral",
                    className: (0, import_clsx2.default)("absolute z-10 right-2 top-1/2 -translate-y-1/2 shadow-md", { hidden: !canGoRight() }),
                    disabled: !canGoRight(),
                    onClick: () => right(),
                    children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronRight, { size: 24 })
                  }
                )
              ] })
            ]
          }
        ),
        dots && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CarouselTabs, { onChange: setCurrentIndex })
      ]
    }
  ) });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Carousel,
  CarouselSlide
});
//# sourceMappingURL=Carousel.js.map