// src/components/user-action/Button.tsx
import { forwardRef } from "react";
import clsx from "clsx";
import { jsx, jsxs } from "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 = 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__ */ jsxs(
    "button",
    {
      ref,
      onClick,
      className: clsx(
        "group font-semibold",
        colorClasses,
        "not-disabled:hover:brightness-90",
        "disabled:text-disabled disabled:bg-disabled-background",
        ButtonUtil.paddingMapping[size],
        className
      ),
      ...restProps,
      children: [
        startIcon && /* @__PURE__ */ jsx(
          "span",
          {
            className: clsx(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: startIcon
          }
        ),
        children,
        endIcon && /* @__PURE__ */ jsx(
          "span",
          {
            className: clsx(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: endIcon
          }
        )
      ]
    }
  );
});
var TextButton = ({
  children,
  color = "neutral",
  size = "medium",
  startIcon,
  endIcon,
  onClick,
  coloredHoverBackground = true,
  className,
  ...restProps
}) => {
  const colorClasses = {
    primary: "not-disabled:bg-transparent not-disabled:text-button-text-primary-text not-disabled:focus-visible:outline-button-text-primary-text",
    negative: "not-disabled:bg-transparent not-disabled:text-button-text-negative-text not-disabled:focus-visible:outline-button-text-negative-text",
    neutral: "not-disabled:bg-transparent not-disabled:text-button-text-neutral-text not-disabled:focus-visible:outline-button-text-neutral-text"
  }[color];
  const backgroundColor = {
    primary: "not-disabled:hover:bg-button-text-primary-text/20 not-disabled:focus-visible:bg-button-text-primary-text/20",
    negative: "not-disabled:hover:bg-button-text-negative-text/20 not-disabled:focus-visible:bg-button-text-negative-text/20",
    neutral: "not-disabled:hover:bg-button-text-neutral-text/20 not-disabled:focus-visible:bg-button-text-neutral-text/20"
  }[color];
  const iconColorClasses = {
    primary: "not-group-disabled:text-button-text-primary-icon",
    negative: "not-group-disabled:text-button-text-negative-icon",
    neutral: "not-group-disabled:text-button-text-neutral-icon"
  }[color];
  return /* @__PURE__ */ jsxs(
    "button",
    {
      onClick,
      className: clsx(
        "group font-semibold",
        "disabled:text-disabled",
        colorClasses,
        {
          [backgroundColor]: coloredHoverBackground,
          "not-disabled:hover:bg-button-text-hover-background": !coloredHoverBackground
        },
        ButtonUtil.paddingMapping[size],
        className
      ),
      ...restProps,
      children: [
        startIcon && /* @__PURE__ */ jsx(
          "span",
          {
            className: clsx(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: startIcon
          }
        ),
        children,
        endIcon && /* @__PURE__ */ jsx(
          "span",
          {
            className: clsx(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: endIcon
          }
        )
      ]
    }
  );
};
var IconButton = 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__ */ jsx(
    "button",
    {
      ref,
      className: clsx(
        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/i18n/LocaleProvider.tsx
import { createContext, useContext, useEffect, useMemo, useState as useState2 } from "react";

// src/hooks/useLocalStorage.ts
import { useCallback, useState } from "react";

// src/utils/resolveSetState.ts
function resolveSetState(action, prev) {
  return typeof action === "function" ? action(prev) : action;
}

// src/i18n/translations.ts
import { TranslationGen } from "@helpwave/internationalization";
var hightideTranslationLocales = ["de-DE", "en-US"];
var hightideTranslation = {
  "de-DE": {
    "add": `Hinzuf\xFCgen`,
    "age": `Alter`,
    "all": `Alle`,
    "apply": `Anwenden`,
    "back": `Zur\xFCck`,
    "cancel": `Abbrechen`,
    "carousel": `Karussell`,
    "change": `\xC4ndern`,
    "chooseLanguage": `W\xE4hle deine bevorzugte Sprache`,
    "chooseSlide": `W\xE4hle die angezeigte Slide aus`,
    "chooseTheme": `W\xE4hle dein bevorzugtes Farbschema.`,
    "clear": `L\xF6schen`,
    "click": `Klicken`,
    "clickToCopy": `Zum kopieren klicken`,
    "clickToSelect": `Zum Ausw\xE4hlen dr\xFCcken`,
    "close": `Schlie\xDFen`,
    "confirm": `Best\xE4tigen`,
    "copied": `Kopiert`,
    "copy": `Kopieren`,
    "create": `Erstellen`,
    "decline": `Ablehnen`,
    "delete": `L\xF6schen`,
    "discard": `Verwerfen`,
    "discardChanges": `\xC4nderungen Verwerfen`,
    "done": `Fertig`,
    "edit": `Bearbeiten`,
    "endDate": `Ende`,
    "enterText": `Text hier eingeben`,
    "entryDate": `Eintragsdatum`,
    "error": `Fehler`,
    "errorOccurred": `Ein Fehler ist aufgetreten`,
    "exit": `Beenden`,
    "fieldRequiredError": `Dieses Feld ist erforderlich.`,
    "filter": `Filter`,
    "gender": ({ gender }) => {
      return TranslationGen.resolveSelect(gender, {
        "male": `M\xE4nnlich`,
        "female": `Weiblich`,
        "other": `Divers`
      });
    },
    "goodToSeeYou": `Sch\xF6n dich zu sehen`,
    "identifier": `Identifikator`,
    "invalidEmail": `Die E-Mail ist ung\xFCltig.`,
    "invalidEmailError": `Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.`,
    "language": `Sprache`,
    "less": `Weniger`,
    "loading": `L\xE4dt`,
    "locale": `Locale`,
    "max": `Max`,
    "maxLengthError": `Maximale L\xE4nge \xFCberschritten.`,
    "min": `Min`,
    "minLengthError": `Mindestl\xE4nge nicht erreicht.`,
    "more": `Mehr`,
    "name": `Name`,
    "next": `Weiter`,
    "no": `Nein`,
    "none": `Nichts`,
    "notEmpty": `Das Feld darf nicht leer sein.`,
    "nothingFound": `Nichts gefunden`,
    "of": `von`,
    "optional": `Optional`,
    "outOfRangeNumber": ({ min, max }) => {
      return `Der Wert muss zwischen ${min} und ${max} liegen.`;
    },
    "outOfRangeSelectionItems": ({ min, max }) => {
      return `Es m\xFCssen zwischen ${min} und ${max} Elemente ausgew\xE4hlt werden.`;
    },
    "outOfRangeString": ({ min, max }) => {
      return `Der Wert muss zwischen ${min} und ${max} Zeichen lang sein.`;
    },
    "pleaseWait": `Bitte warten...`,
    "previous": `Vorherige`,
    "remove": `Entfernen`,
    "required": `Erforderlich`,
    "reset": `Zur\xFCcksetzen`,
    "save": `Speichern`,
    "saved": `Gespeichert`,
    "search": `Suche`,
    "select": `Select`,
    "selectOption": `Option ausw\xE4hlen`,
    "show": `Anzeigen`,
    "showLess": `Weniger anzeigen`,
    "showMore": `Mehr anzeigen`,
    "showSlide": ({ index }) => {
      return `Zeige Slide ${index}`;
    },
    "slide": `Slide`,
    "slideNavigation": `Slide Navigation`,
    "slideOf": ({ index, length }) => {
      return `Slide ${index} von ${length} slides`;
    },
    "startDate": `Start`,
    "street": `Stra\xDFe`,
    "submit": `Abschicken`,
    "success": `Erfolg`,
    "text": `Text`,
    "themeMode": ({ theme }) => {
      return TranslationGen.resolveSelect(theme, {
        "dark": `Dunkel`,
        "light": `Hell`,
        "system": `System`
      });
    },
    "themes": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Farbschema`,
        "other": `Farbschemas`
      });
    },
    "time.ago": `vor`,
    "time.agoDays": ({ days }) => {
      return `var ${days} Tagen`;
    },
    "time.april": `April`,
    "time.august": `August`,
    "time.century": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Jahrhundert`,
        "other": `Jahrhunderte`
      });
    },
    "time.day": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Tag`,
        "other": `Tage`
      });
    },
    "time.decade": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Jahrzehnt`,
        "other": `Jahrzehnte`
      });
    },
    "time.december": `December`,
    "time.february": `Febuar`,
    "time.hour": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Stunde`,
        "other": `Stunden`
      });
    },
    "time.in": `in`,
    "time.inDays": ({ days }) => {
      return `in ${days} Tagen`;
    },
    "time.january": `Januar`,
    "time.july": `Juli`,
    "time.june": `Juni`,
    "time.march": `M\xE4rz`,
    "time.may": `Mai`,
    "time.microsecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Mikrosekunde`,
        "other": `Mikrosekunden`
      });
    },
    "time.millisecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Millisekunde`,
        "other": `Millisekunden`
      });
    },
    "time.minute": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Minute`,
        "other": `Minuten`
      });
    },
    "time.month": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Monat`,
        "other": `Monate`
      });
    },
    "time.monthName": ({ month }) => {
      return TranslationGen.resolveSelect(month, {
        "january": `Januar`,
        "february": `Februar`,
        "march": `M\xE4rz`,
        "april": `April`,
        "may": `Mai`,
        "june": `Juni`,
        "july": `Juli`,
        "august": `August`,
        "september": `September`,
        "october": `Oktober`,
        "november": `November`,
        "december": `Dezember`,
        "other": `Unbekannter Monat`
      });
    },
    "time.nanosecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Nanosekunde`,
        "other": `Nanosekunden`
      });
    },
    "time.november": `November`,
    "time.october": `October`,
    "time.second": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Sekunde`,
        "other": `Sekunden`
      });
    },
    "time.september": `September`,
    "time.today": `Heute`,
    "time.tomorrow": `Morgen`,
    "time.year": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Jahr`,
        "other": `Jahre`
      });
    },
    "time.yesterday": `Gestern`,
    "tooFewSelectionItems": ({ min }) => {
      return `Es m\xFCssen mindestens ${min} Elemente ausgew\xE4hlt werden.`;
    },
    "tooLong": ({ max }) => {
      return `Der Wert darf h\xF6chstens ${max} Zeichen enthalten.`;
    },
    "tooManySelectionItems": ({ max }) => {
      return `Es m\xFCssen maximal ${max} Elemente ausgew\xE4hlt werden.`;
    },
    "tooShort": ({ min }) => {
      return `Der Wert muss mindestens ${min} Zeichen enthalten.`;
    },
    "unsavedChanges": `Ungespeicherte \xC4nderungen`,
    "unsavedChangesSaveQuestion": `M\xF6chtest du die \xC4nderungen speichern?`,
    "update": `Update`,
    "value": `Wert`,
    "welcome": `Willkommen`,
    "yes": `Ja`
  },
  "en-US": {
    "add": `Add`,
    "age": `Age`,
    "all": `All`,
    "apply": `Apply`,
    "back": `Back`,
    "cancel": `Cancel`,
    "carousel": `Carousel`,
    "change": `Change`,
    "chooseLanguage": `Choose your language`,
    "chooseSlide": `Choose slide to display`,
    "chooseTheme": `Choose your preferred color theme.`,
    "clear": `Clear`,
    "click": `Click`,
    "clickToCopy": `Click to Copy`,
    "clickToSelect": `Click to select`,
    "close": `Close`,
    "confirm": `Confirm`,
    "copied": `Copied`,
    "copy": `Copy`,
    "create": `Create`,
    "decline": `Decline`,
    "delete": `Delete`,
    "discard": `Discard`,
    "discardChanges": `Discard Changes`,
    "done": `Done`,
    "edit": `Edit`,
    "endDate": `End`,
    "enterText": `Enter text here`,
    "entryDate": `Entry Date`,
    "error": `Error`,
    "errorOccurred": `An error occurred`,
    "exit": `Exit`,
    "fieldRequiredError": `This field is required.`,
    "filter": `Filter`,
    "gender": ({ gender }) => {
      return TranslationGen.resolveSelect(gender, {
        "male": `Male`,
        "female": `Female`,
        "other": `Other`
      });
    },
    "goodToSeeYou": `Good to see you`,
    "identifier": `Identifier`,
    "invalidEmail": `The email is not valid.`,
    "invalidEmailError": `Please enter a valid email address.`,
    "language": `Language`,
    "less": `Less`,
    "loading": `Loading`,
    "locale": `Locale`,
    "max": `Max`,
    "maxLengthError": `Maximum length exceeded.`,
    "min": `Min`,
    "minLengthError": `Minimum length not met.`,
    "more": `More`,
    "name": `Name`,
    "next": `Next`,
    "no": `No`,
    "none": `None`,
    "notEmpty": `The field cannot be empty.`,
    "nothingFound": `Nothing found`,
    "of": `of`,
    "optional": `Optional`,
    "outOfRangeNumber": ({ min, max }) => {
      return `The value must be between ${min} and ${max}.`;
    },
    "outOfRangeSelectionItems": ({ min, max }) => {
      return `Between ${min} and ${max} items must be selected.`;
    },
    "outOfRangeString": ({ min, max }) => {
      return `The value needs to have between ${min} and ${max} characters.`;
    },
    "pleaseWait": `Please wait...`,
    "previous": `Previous`,
    "remove": `Remove`,
    "required": `Required`,
    "reset": `Reset`,
    "save": `Save`,
    "saved": `Saved`,
    "search": `Search`,
    "select": `Select`,
    "selectOption": `Select an option`,
    "show": `Show`,
    "showLess": `Show less`,
    "showMore": `Show more`,
    "showSlide": ({ index }) => {
      return `Show Slide ${index}`;
    },
    "slide": `Slide`,
    "slideNavigation": `Slide navigation`,
    "slideOf": ({ index, length }) => {
      return `Slide ${index} of ${length} slides`;
    },
    "startDate": `Start`,
    "street": `Street`,
    "submit": `Submit`,
    "success": `Success`,
    "text": `Text`,
    "themeMode": ({ theme }) => {
      return TranslationGen.resolveSelect(theme, {
        "dark": `Dark`,
        "light": `Light`,
        "system": `System`
      });
    },
    "themes": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Theme`,
        "other": `Themes`
      });
    },
    "time.ago": `ago`,
    "time.agoDays": ({ days }) => {
      return `days ${days} ago`;
    },
    "time.april": `April`,
    "time.august": `August`,
    "time.century": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Century`,
        "other": `Centuries`
      });
    },
    "time.day": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Day`,
        "other": `Days`
      });
    },
    "time.decade": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Decade`,
        "other": `Decades`
      });
    },
    "time.december": `December`,
    "time.february": `Febuary`,
    "time.hour": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Hour`,
        "other": `Hours`
      });
    },
    "time.in": `in`,
    "time.inDays": ({ days }) => {
      return `in ${days} days`;
    },
    "time.january": `January`,
    "time.july": `July`,
    "time.june": `June`,
    "time.march": `March`,
    "time.may": `May`,
    "time.microsecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Microsecond`,
        "other": `Microseconds`
      });
    },
    "time.millisecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Millisecond`,
        "other": `Milliseconds`
      });
    },
    "time.minute": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Minute`,
        "other": `Minutes`
      });
    },
    "time.month": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Month`,
        "other": `Months`
      });
    },
    "time.monthName": ({ month }) => {
      return TranslationGen.resolveSelect(month, {
        "january": `January`,
        "february": `February`,
        "march": `March`,
        "april": `April`,
        "may": `May`,
        "june": `June`,
        "july": `July`,
        "august": `August`,
        "september": `September`,
        "october": `October`,
        "november": `November`,
        "december": `December`,
        "other": `Unknown Month`
      });
    },
    "time.nanosecond": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Nanosecond`,
        "other": `Nanoseconds`
      });
    },
    "time.november": `November`,
    "time.october": `October`,
    "time.second": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Second`,
        "other": `Seconds`
      });
    },
    "time.september": `September`,
    "time.today": `Today`,
    "time.tomorrow": `Tomorrow`,
    "time.year": ({ count }) => {
      return TranslationGen.resolveSelect(count, {
        "=1": `Year`,
        "other": `Years`
      });
    },
    "time.yesterday": `Yesterday`,
    "tooFewSelectionItems": ({ min }) => {
      return `Select at least ${min} items.`;
    },
    "tooLong": ({ max }) => {
      return `The value requires less than ${max} characters.`;
    },
    "tooManySelectionItems": ({ max }) => {
      return `Select at most ${max} items.`;
    },
    "tooShort": ({ min }) => {
      return `The value requires at least ${min} characters.`;
    },
    "unsavedChanges": `Unsaved Changes`,
    "unsavedChangesSaveQuestion": `Do you want to save your changes?`,
    "update": `Update`,
    "value": `Value`,
    "welcome": `Welcome`,
    "yes": `Yes`
  }
};

// src/i18n/util.ts
var localsNames = {
  "en-US": "English (US)",
  "de-DE": "Deutsch"
};
var DEFAULT_LOCALE = "en-US";
function localeToLanguage(locale) {
  return locale.split("-")[0];
}
var LocalizationUtil = {
  locals: hightideTranslationLocales,
  localToLanguage: localeToLanguage,
  DEFAULT_LOCALE,
  languagesLocalNames: localsNames
};

// src/i18n/LocaleProvider.tsx
import { jsx as jsx2 } from "react/jsx-runtime";
var LocaleContext = createContext({
  locale: LocalizationUtil.DEFAULT_LOCALE,
  setLocale: (v) => v
});
var useLocale = () => {
  const context = useContext(LocaleContext);
  if (!context) {
    throw new Error("useLocale must be used within LocaleContext. Try adding a LocaleProvider around your app.");
  }
  return context;
};

// src/i18n/useHightideTranslation.ts
import { combineTranslation, ICUUtil } from "@helpwave/internationalization";

// src/utils/array.ts
var moveItems = (list, move = 0) => {
  const result = [];
  let start = move;
  if (start < 0) {
    start = list.length - move;
  }
  start = start % list.length;
  for (let i = 0; i < list.length; i++) {
    result[i] = list[(i + start) % list.length];
  }
  return result;
};
function resolveSingleOrArray(value) {
  if (Array.isArray(value)) {
    return value;
  } else if (value) {
    return [value];
  }
  return [];
}
var ArrayUtil = {
  unique: (list) => {
    const seen = /* @__PURE__ */ new Set();
    return list.filter((item) => {
      if (seen.has(item)) {
        return false;
      }
      seen.add(item);
      return true;
    });
  },
  difference: (list, removeList) => {
    const remove = new Set(removeList);
    return list.filter((item) => !remove.has(item));
  },
  moveItems,
  resolveSingleOrArray
};

// src/i18n/useHightideTranslation.ts
function useHightideTranslation(extensions, overwrites) {
  const { locale: inferredLocale } = useLocale();
  const locale = overwrites?.locale ?? inferredLocale;
  const translationExtensions = ArrayUtil.resolveSingleOrArray(extensions);
  return combineTranslation([
    ...translationExtensions,
    hightideTranslation
  ], locale);
}

// src/components/dialog/ConfirmDialog.tsx
import clsx3 from "clsx";

// src/components/dialog/Dialog.tsx
import { useId as useId2 } from "react";
import { useEffect as useEffect5, useRef as useRef2, useState as useState6 } from "react";
import clsx2 from "clsx";
import { X } from "lucide-react";

// src/hooks/focus/useFocusTrap.ts
import { useCallback as useCallback2, useEffect as useEffect3, useId, useRef, useState as useState4 } from "react";

// src/hooks/focus/useIsMounted.ts
import { useEffect as useEffect2, useLayoutEffect, useState as useState3 } from "react";
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
var useIsomorphicEffect = isClient ? useLayoutEffect : useEffect2;
var useIsMounted = () => {
  const [isMounted, setIsMounted] = useState3(false);
  useIsomorphicEffect(() => {
    setIsMounted(true);
    return () => {
      setIsMounted(false);
    };
  }, []);
  return isMounted;
};

// src/hooks/focus/useFocusTrap.ts
var createFocusGuard = () => {
  const div = document.createElement("div");
  Object.assign(div.style, {
    opacity: "0",
    outline: "none",
    boxShadow: "none",
    position: "fixed",
    pointerEvents: "none",
    touchAction: "none"
  });
  div.tabIndex = 0;
  div.setAttribute("data-hw-focus-guard", "");
  document.body.appendChild(div);
  return div;
};
function getContainedFocusableElements(element) {
  return element?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
}
var FocusTrapService = class {
  constructor() {
    // The last entry is always the active one
    this.listeners = [];
    this.onFocusIn = (event) => {
      const active = this.getActive();
      if (!active || !active.container.current) return;
      const { container } = active;
      if (!container.current.contains(event.target)) {
        this.focusElement();
      }
    };
  }
  getActive() {
    if (this.listeners.length === 0) return void 0;
    return this.listeners[this.listeners.length - 1];
  }
  focusElement() {
    const active = this.getActive();
    if (!active) return;
    const { container, initialFocusElement } = active;
    const containerElement = container.current;
    if (initialFocusElement?.current) {
      initialFocusElement.current.focus();
    } else {
      const elements = getContainedFocusableElements(containerElement);
      if (elements && elements.length > 0) {
        const first = elements.item(0);
        first.focus();
      } else {
        containerElement.focus();
      }
    }
  }
  removeGuards() {
    document.querySelectorAll("[data-hw-focus-guard]").forEach((node) => node.remove());
  }
  addGuards() {
    document.body.insertAdjacentElement("afterbegin", createFocusGuard());
    document.body.insertAdjacentElement("beforeend", createFocusGuard());
  }
  activate() {
    document.addEventListener("focusin", this.onFocusIn);
    this.addGuards();
  }
  deactivate() {
    document.removeEventListener("focusin", this.onFocusIn);
    this.removeGuards();
  }
  register(listener) {
    this.listeners.push(listener);
    if (this.listeners.length === 1) {
      this.activate();
    }
    const active = listener;
    this.listeners.forEach((listener2) => {
      const { focus, pause } = listener2;
      if (listener2 === active) {
        focus();
      } else {
        pause();
      }
    });
  }
  unregister(id) {
    const index = this.listeners.findIndex((trap) => trap.id === id);
    if (index !== -1) {
      const isActive = index === this.listeners.length - 1;
      const listener = this.listeners[index];
      this.listeners = this.listeners.filter((listener2) => listener2.id !== id);
      if (isActive) {
        this.deactivate();
        listener.focusLast();
        const active = this.getActive();
        this.listeners.forEach((listener2) => {
          const { pause, unpause } = listener2;
          if (listener2 === active) {
            unpause();
          } else {
            pause();
          }
        });
        if (this.listeners.length > 0) {
          this.activate();
        }
      }
    } else {
      console.warn(`Unable to unregister id ${id}: not found`);
    }
  }
};
var service = new FocusTrapService();
var useFocusTrap = ({
  container,
  active = true,
  initialFocus,
  focusFirst = true
}) => {
  const lastFocusRef = useRef(null);
  const [paused, setPaused] = useState4(false);
  const isMounted = useIsMounted();
  const id = useId();
  const focusElement = useCallback2(() => {
    const containerElement = container.current;
    if (initialFocus?.current) {
      initialFocus.current.focus();
    } else {
      const elements = getContainedFocusableElements(containerElement);
      if (elements && elements.length > 0) {
        const first = elements.item(0);
        first.focus();
      } else {
        containerElement.focus();
      }
    }
  }, [container, initialFocus]);
  useEffect3(() => {
    if (active && isMounted) {
      let pause = function() {
        setPaused(true);
      }, unpause = function() {
        setPaused(false);
        if (!container.current.contains(document.activeElement)) {
          focusElement();
        }
      }, focus = function() {
        focusElement();
        setPaused(false);
      }, focusLast = function() {
        lastFocusRef.current?.focus();
      };
      if (!lastFocusRef.current) {
        lastFocusRef.current = document.activeElement;
      }
      service.register({ id, pause, focus, focusLast, unpause, container, initialFocusElement: initialFocus });
      return () => {
        service.unregister(id);
        lastFocusRef.current = void 0;
      };
    }
  }, [active, container, focusElement, id, initialFocus, isMounted]);
  useEffect3(() => {
    if (active && !paused && isMounted) {
      let onKeyDown = function(event) {
        const key = event.key;
        const elements = getContainedFocusableElements(containerElement);
        const active2 = document.activeElement;
        const index = [...elements].findIndex((value) => value === active2);
        if (index === -1 || event.altKey || event.ctrlKey || event.metaKey) {
          return;
        }
        if (key === "Tab") {
          const next = event.shiftKey ? -1 : 1;
          const nextIndex = (index + next + elements.length) % elements.length;
          const nextElement = elements[nextIndex];
          nextElement.focus();
          event.preventDefault();
        }
      };
      const containerElement = container.current;
      containerElement.addEventListener("keydown", onKeyDown);
      return () => {
        containerElement.removeEventListener("keydown", onKeyDown);
      };
    }
  }, [active, paused, isMounted, container, initialFocus, focusFirst, focusElement]);
};

// src/hooks/useLogOnce.ts
import { useEffect as useEffect4, useState as useState5 } from "react";
var defaultOptions = {
  type: "warning"
};
var useLogOnce = (message, condition, options) => {
  const [hasLogged, setHasLogged] = useState5(false);
  const { type } = { ...defaultOptions, ...options };
  useEffect4(() => {
    if (!hasLogged && condition) {
      switch (type) {
        case "info":
          console.info(message);
          break;
        case "error":
          console.error(message);
          break;
        case "warning":
          console.warn(message);
          break;
      }
      setHasLogged(true);
    }
  }, [condition]);
};

// src/components/dialog/Dialog.tsx
import { createPortal } from "react-dom";
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
var Dialog = ({
  children,
  isOpen,
  titleElement,
  description,
  isModal = true,
  onClose,
  backgroundClassName,
  position = "center",
  isAnimated = true,
  containerClassName,
  ...props
}) => {
  const translation = useHightideTranslation();
  const [visible, setVisible] = useState6(isOpen);
  const generatedId = useId2();
  const id = props.id ?? generatedId;
  const ref = useRef2(null);
  useEffect5(() => {
    if (isOpen) {
      setVisible(true);
    } else {
      if (!isAnimated) {
        setVisible(false);
      }
    }
  }, [isAnimated, isOpen]);
  const onCloseWrapper = () => {
    if (!isModal) return;
    onClose?.();
  };
  useLogOnce("Dialog: onClose should be defined for modal dialogs", isModal && !onClose);
  useFocusTrap({
    container: ref,
    active: visible,
    focusFirst: true
  });
  const positionMap = {
    top: "fixed top-8 left-1/2 -translate-x-1/2",
    center: "fixed left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2",
    none: ""
  };
  const positionStyle = positionMap[position];
  if (!visible) return;
  return createPortal(
    /* @__PURE__ */ jsxs2("div", { id: `dialog-container-${id}`, className: clsx2("fixed inset-0 h-screen w-screen", containerClassName), children: [
      /* @__PURE__ */ jsx3(
        "div",
        {
          id: `dialog-background-${id}`,
          hidden: !visible,
          className: clsx2(
            "fixed inset-0 h-screen w-screen bg-overlay-shadow",
            {
              "motion-safe:animate-fade-in": isOpen,
              "motion-safe:animate-fade-out": !isOpen
            },
            backgroundClassName
          ),
          onAnimationEnd: () => {
            if (!isOpen) {
              setVisible(false);
            }
          },
          onClick: onCloseWrapper,
          "aria-hidden": true
        }
      ),
      /* @__PURE__ */ jsxs2(
        "div",
        {
          ...props,
          id: `dialog-${id}`,
          ref,
          hidden: !visible,
          onKeyDown: (event) => {
            if (event.key === "Escape") {
              onCloseWrapper();
            }
          },
          onAnimationEnd: () => {
            if (!isOpen) {
              setVisible(false);
            }
          },
          className: clsx2(
            "flex-col-2 p-4 bg-overlay-background text-overlay-text rounded-xl shadow-hw-bottom max-w-[calc(100vw_-_2rem)] max-h-[calc(100vh_-_2rem)]",
            {
              "motion-safe:animate-pop-in": isOpen,
              "motion-safe:animate-pop-out": !isOpen
            },
            positionStyle,
            props.className
          ),
          children: [
            /* @__PURE__ */ jsx3("div", { className: "typography-title-lg mr-8", children: titleElement }),
            description && /* @__PURE__ */ jsx3("div", { className: "text-description", children: description }),
            isModal && /* @__PURE__ */ jsx3(
              "div",
              {
                className: "absolute top-0 right-0",
                style: {
                  paddingTop: "inherit",
                  paddingRight: "inherit"
                },
                children: /* @__PURE__ */ jsx3(
                  IconButton,
                  {
                    color: "neutral",
                    size: "tiny",
                    "aria-label": translation("close"),
                    onClick: onCloseWrapper,
                    children: /* @__PURE__ */ jsx3(X, {})
                  }
                )
              }
            ),
            children
          ]
        }
      )
    ] }),
    document.body
  );
};

// src/components/dialog/ConfirmDialog.tsx
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
var ConfirmDialog = ({
  children,
  onCancel,
  onConfirm,
  onDecline,
  confirmType = "positive",
  buttonOverwrites,
  className,
  ...restProps
}) => {
  const translation = useHightideTranslation();
  const mapping = {
    neutral: "neutral",
    negative: "negative",
    positive: "positive",
    primary: "primary"
  };
  return /* @__PURE__ */ jsxs3(Dialog, { ...restProps, onClose: onCancel, className: clsx3("justify-between", className), children: [
    /* @__PURE__ */ jsx4("div", { className: "flex-col-2 grow", children }),
    /* @__PURE__ */ jsxs3("div", { className: "flex-row-4 mt-3 justify-end", children: [
      onCancel && /* @__PURE__ */ jsx4(
        SolidButton,
        {
          color: buttonOverwrites?.[0].color ?? "neutral",
          onClick: onCancel,
          disabled: buttonOverwrites?.[0].disabled ?? false,
          children: buttonOverwrites?.[0].text ?? translation("cancel")
        }
      ),
      onDecline && /* @__PURE__ */ jsx4(
        SolidButton,
        {
          color: buttonOverwrites?.[1].color ?? "negative",
          onClick: onDecline,
          disabled: buttonOverwrites?.[1].disabled ?? false,
          children: buttonOverwrites?.[1].text ?? translation("decline")
        }
      ),
      /* @__PURE__ */ jsx4(
        SolidButton,
        {
          color: buttonOverwrites?.[2].color ?? mapping[confirmType],
          onClick: onConfirm,
          disabled: buttonOverwrites?.[2].disabled ?? false,
          children: buttonOverwrites?.[2].text ?? translation("confirm")
        }
      )
    ] })
  ] });
};

// src/components/dialog/DiscardChangesDialog.tsx
import { jsx as jsx5 } from "react/jsx-runtime";
var DiscardChangesDialog = ({
  children,
  onCancel,
  onSave,
  onDontSave,
  titleOverwrite,
  descriptionOverwrite,
  ...props
}) => {
  const translation = useHightideTranslation();
  return /* @__PURE__ */ jsx5(
    ConfirmDialog,
    {
      ...props,
      titleElement: titleOverwrite ?? translation("unsavedChanges"),
      description: descriptionOverwrite ?? translation("unsavedChangesSaveQuestion"),
      onConfirm: onSave,
      onCancel,
      onDecline: onDontSave,
      buttonOverwrites: [{ text: translation("cancel") }, { text: translation("discardChanges") }, { text: translation("save") }],
      children
    }
  );
};

// src/components/user-action/input/Input.tsx
import { forwardRef as forwardRef2, useImperativeHandle, useRef as useRef3 } from "react";
import clsx4 from "clsx";

// src/hooks/useDelay.ts
import { useEffect as useEffect6, useState as useState7 } from "react";
var defaultOptions2 = {
  delay: 3e3,
  disabled: false
};
function useDelay(options) {
  const [timer, setTimer] = useState7(void 0);
  const { delay, disabled } = {
    ...defaultOptions2,
    ...options
  };
  const clearTimer = () => {
    clearTimeout(timer);
    setTimer(void 0);
  };
  const restartTimer = (onDelayFinish) => {
    if (disabled) {
      return;
    }
    clearTimeout(timer);
    setTimer(setTimeout(() => {
      onDelayFinish();
      setTimer(void 0);
    }, delay));
  };
  useEffect6(() => {
    return () => {
      clearTimeout(timer);
    };
  }, [timer]);
  useEffect6(() => {
    if (disabled) {
      clearTimeout(timer);
      setTimer(void 0);
    }
  }, [disabled, timer]);
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
}

// src/hooks/focus/useFocusManagement.ts
import { useCallback as useCallback3 } from "react";
function useFocusManagement() {
  const getFocusableElements = useCallback3(() => {
    return Array.from(
      document.querySelectorAll(
        'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
      )
    ).filter(
      (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
    );
  }, []);
  const getNextFocusElement = useCallback3(() => {
    const elements = getFocusableElements();
    if (elements.length === 0) {
      return void 0;
    }
    let nextElement = elements[0];
    if (document.activeElement instanceof HTMLElement) {
      const currentIndex = elements.indexOf(document.activeElement);
      nextElement = elements[(currentIndex + 1) % elements.length];
    }
    return nextElement;
  }, [getFocusableElements]);
  const focusNext = useCallback3(() => {
    const nextElement = getNextFocusElement();
    nextElement?.focus();
  }, [getNextFocusElement]);
  const getPreviousFocusElement = useCallback3(() => {
    const elements = getFocusableElements();
    if (elements.length === 0) {
      return void 0;
    }
    let previousElement = elements[0];
    if (document.activeElement instanceof HTMLElement) {
      const currentIndex = elements.indexOf(document.activeElement);
      if (currentIndex === 0) {
        previousElement = elements[elements.length - 1];
      } else {
        previousElement = elements[currentIndex - 1];
      }
    }
    return previousElement;
  }, [getFocusableElements]);
  const focusPrevious = useCallback3(() => {
    const previousElement = getPreviousFocusElement();
    if (previousElement) previousElement.focus();
  }, [getPreviousFocusElement]);
  return {
    getFocusableElements,
    getNextFocusElement,
    getPreviousFocusElement,
    focusNext,
    focusPrevious
  };
}

// src/hooks/useOverwritableState.ts
import { useEffect as useEffect7, useState as useState8 } from "react";
var useOverwritableState = (initialValue, onChange) => {
  const [state, setState] = useState8(initialValue);
  useEffect7(() => {
    setState(initialValue);
  }, [initialValue]);
  const onChangeWrapper = (action) => {
    const resolved = resolveSetState(action, state);
    setState(resolved);
    onChange?.(state);
  };
  return [state, onChangeWrapper];
};

// src/components/user-action/input/Input.tsx
import { jsx as jsx6 } from "react/jsx-runtime";
var defaultEditCompleteOptions = {
  allowEnterComplete: false,
  onBlur: true,
  afterDelay: true,
  delay: 2500
};
var Input = forwardRef2(function Input2({
  value,
  onChange,
  onChangeText,
  onEditCompleted,
  editCompleteOptions,
  disabled = false,
  invalid = false,
  defaultStyle = true,
  className,
  ...props
}, forwardedRef) {
  const {
    onBlur: allowEditCompleteOnBlur,
    afterDelay,
    delay,
    allowEnterComplete
  } = { ...defaultEditCompleteOptions, ...editCompleteOptions };
  const {
    restartTimer,
    clearTimer
  } = useDelay({ delay, disabled: !afterDelay });
  const innerRef = useRef3(null);
  useImperativeHandle(forwardedRef, () => innerRef.current);
  const { focusNext } = useFocusManagement();
  return /* @__PURE__ */ jsx6(
    "input",
    {
      ...props,
      ref: innerRef,
      value,
      disabled,
      className: defaultStyle ? clsx4(
        "px-3 py-2 rounded-md text-sm h-10 border-2 border-transparent focus-style-none",
        {
          "bg-input-background text-input-text hover:border-primary focus:border-primary": !disabled && !invalid,
          "bg-negative/20 text-negative hover:border-negative focus-visible:border-negative": !disabled && invalid,
          "bg-disabled-background text-disabled border-disabled-border": disabled
        },
        className
      ) : className,
      onKeyDown: (event) => {
        props.onKeyDown?.(event);
        if (!allowEnterComplete) {
          return;
        }
        if (event.key === "Enter" && !event.shiftKey) {
          event.preventDefault();
          innerRef.current?.blur();
          onEditCompleted?.(event.target.value);
          focusNext();
        }
      },
      onBlur: (event) => {
        props.onBlur?.(event);
        if (allowEditCompleteOnBlur) {
          onEditCompleted?.(event.target.value);
          clearTimer();
        }
      },
      onChange: (event) => {
        onChange?.(event);
        const value2 = event.target.value;
        restartTimer(() => {
          innerRef.current?.blur();
          onEditCompleted?.(value2);
        });
        onChangeText?.(value2);
      },
      "aria-invalid": props["aria-invalid"] ?? invalid,
      "aria-disabled": props["aria-disabled"] ?? disabled
    }
  );
});

// src/components/dialog/InputDialog.tsx
import { jsx as jsx7 } from "react/jsx-runtime";
var InputDialog = ({
  inputs,
  buttonOverwrites,
  ...props
}) => {
  return /* @__PURE__ */ jsx7(
    ConfirmDialog,
    {
      buttonOverwrites,
      ...props,
      children: inputs.map((inputProps, index) => /* @__PURE__ */ jsx7(Input, { ...inputProps }, `input ${index}`))
    }
  );
};

// src/components/user-action/select/Select.tsx
import {
  createContext as createContext2,
  forwardRef as forwardRef4,
  useCallback as useCallback6,
  useContext as useContext2,
  useEffect as useEffect9,
  useId as useId4,
  useImperativeHandle as useImperativeHandle2,
  useMemo as useMemo2,
  useRef as useRef4,
  useState as useState10
} from "react";
import clsx7 from "clsx";

// src/components/layout/Expandable.tsx
import { forwardRef as forwardRef3, useCallback as useCallback4, useId as useId3 } from "react";
import { ChevronDown } from "lucide-react";
import clsx5 from "clsx";
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
var ExpansionIcon = ({ isExpanded, className }) => {
  return /* @__PURE__ */ jsx8(
    ChevronDown,
    {
      "aria-hidden": true,
      className: clsx5(
        "min-w-6 w-6 min-h-6 h-6 transition-transform motion-safe:duration-200 motion-reduce:duration-0 ease-in-out",
        { "rotate-180": isExpanded },
        className
      )
    }
  );
};
var Expandable = forwardRef3(function Expandable2({
  children,
  id: providedId,
  label,
  icon,
  isExpanded = false,
  onChange,
  clickOnlyOnHeader = true,
  disabled = false,
  className,
  headerClassName,
  contentClassName,
  contentExpandedClassName
}, ref) {
  const defaultIcon = useCallback4((expanded) => /* @__PURE__ */ jsx8(ExpansionIcon, { isExpanded: expanded }), []);
  icon ??= defaultIcon;
  const generatedId = useId3();
  const id = providedId ?? generatedId;
  return /* @__PURE__ */ jsxs4(
    "div",
    {
      ref,
      onClick: () => !clickOnlyOnHeader && !disabled && onChange?.(!isExpanded),
      className: clsx5(
        "flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm",
        { "cursor-pointer": !clickOnlyOnHeader && !disabled },
        className
      ),
      children: [
        /* @__PURE__ */ jsxs4(
          "button",
          {
            onClick: () => clickOnlyOnHeader && !disabled && onChange?.(!isExpanded),
            className: clsx5(
              "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
              {
                "group-hover:brightness-97": !isExpanded,
                "hover:brightness-97": isExpanded && !disabled,
                "cursor-pointer": clickOnlyOnHeader && !disabled
              },
              headerClassName
            ),
            "aria-expanded": isExpanded,
            "aria-controls": `${id}-content`,
            "aria-disabled": disabled ?? void 0,
            children: [
              label,
              icon(isExpanded)
            ]
          }
        ),
        /* @__PURE__ */ jsx8(
          "div",
          {
            id: `${id}-content`,
            className: clsx5(
              "flex-col-2 px-4 transition-all duration-300 ease-in-out",
              {
                [clsx5("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
                "max-h-0 opacity-0 overflow-hidden": !isExpanded
              },
              contentClassName
            ),
            role: "region",
            children
          }
        )
      ]
    }
  );
});
var ExpandableUncontrolled = forwardRef3(function ExpandableUncontrolled2({
  isExpanded,
  onChange,
  ...props
}, ref) {
  const [usedIsExpanded, setUsedIsExpanded] = useOverwritableState(isExpanded, onChange);
  return /* @__PURE__ */ jsx8(
    Expandable,
    {
      ...props,
      ref,
      isExpanded: usedIsExpanded,
      onChange: setUsedIsExpanded
    }
  );
});

// src/utils/match.ts
var match = (key, values) => {
  return values[key];
};

// src/components/user-action/select/Select.tsx
import { CheckIcon, Plus, XIcon } from "lucide-react";

// src/components/layout/Chip.tsx
import clsx6 from "clsx";
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
var Chip = ({
  children,
  trailingIcon,
  color = "default",
  size = "md",
  icon = false,
  variant = "normal",
  className = "",
  ...restProps
}) => {
  const colorMapping = {
    default: "text-tag-default-text bg-tag-default-background",
    dark: "text-tag-dark-text bg-tag-dark-background",
    red: "text-tag-red-text bg-tag-red-background",
    yellow: "text-tag-yellow-text bg-tag-yellow-background",
    green: "text-tag-green-text bg-tag-green-background",
    blue: "text-tag-blue-text bg-tag-blue-background",
    pink: "text-tag-pink-text bg-tag-pink-background",
    orange: "text-tag-orange-text bg-tag-orange-background"
  }[color];
  const colorMappingIcon = {
    default: "text-tag-default-icon",
    dark: "text-tag-dark-icon",
    red: "text-tag-red-icon",
    yellow: "text-tag-yellow-icon",
    green: "text-tag-green-icon",
    blue: "text-tag-blue-icon",
    pink: "text-tag-pink-icon",
    orange: "text-tag-orange-icon"
  }[color];
  return /* @__PURE__ */ jsxs5(
    "div",
    {
      ...restProps,
      className: clsx6(
        `flex-row-0 w-fit font-semibold`,
        colorMapping,
        !icon ? {
          "px-1 py-0.5": size === "sm",
          "px-2 py-1": size === "md",
          "px-4 py-2": size === "lg"
        } : {
          "p-0.5": size === "sm",
          "p-1": size === "md",
          "p-2": size === "lg"
        },
        {
          "rounded-md": variant === "normal",
          "rounded-full": variant === "fullyRounded"
        },
        className
      ),
      children: [
        children,
        trailingIcon && /* @__PURE__ */ jsx9("span", { className: colorMappingIcon, children: trailingIcon })
      ]
    }
  );
};

// src/hooks/useFloatingElement.ts
import { useCallback as useCallback5, useEffect as useEffect8, useState as useState9 } from "react";

// src/utils/math.ts
var clamp = (value, range = [0, 1]) => {
  const [min, max] = range;
  return Math.min(Math.max(value, min), max);
};

// src/hooks/useFloatingElement.ts
function calculatePosition({
  windowRect,
  containerRect,
  anchorRect,
  options
}) {
  const { verticalAlignment, horizontalAlignment, gap, screenPadding } = options;
  const windowWidth = windowRect.width;
  const windowHeight = windowRect.height;
  const maxWidth = windowWidth - 2 * screenPadding;
  const maxHeight = windowHeight - 2 * screenPadding;
  const width = Math.min(containerRect.width, maxWidth);
  const height = Math.min(containerRect.height, maxHeight);
  const leftSuggestion = {
    beforeStart: anchorRect.left - width - gap,
    afterStart: anchorRect.left,
    center: anchorRect.left + anchorRect.width / 2 - width / 2,
    beforeEnd: anchorRect.right - width,
    afterEnd: anchorRect.right + gap
  }[horizontalAlignment];
  const topSuggestion = {
    beforeStart: anchorRect.top - height - gap,
    afterStart: anchorRect.top,
    center: anchorRect.top + anchorRect.height / 2 - height / 2,
    beforeEnd: anchorRect.bottom - height,
    afterEnd: anchorRect.bottom + gap
  }[verticalAlignment];
  const left = clamp(leftSuggestion, [
    screenPadding,
    windowWidth - screenPadding - width
  ]);
  const top = clamp(topSuggestion, [
    screenPadding,
    windowHeight - screenPadding - height
  ]);
  return {
    left,
    top,
    maxWidth,
    maxHeight
  };
}
function useFloatingElement({
  active = true,
  windowRef,
  anchorRef,
  containerRef,
  isPolling = false,
  pollingInterval = 100,
  verticalAlignment = "afterEnd",
  horizontalAlignment = "afterStart",
  screenPadding = 16,
  gap = 4
}) {
  const [style, setStyle] = useState9();
  const isMounted = useIsMounted();
  const calculate = useCallback5(() => {
    const containerRect = containerRef.current.getBoundingClientRect();
    const windowRect = windowRef?.current.getBoundingClientRect() ?? {
      top: 0,
      bottom: window.innerHeight,
      left: 0,
      right: window.innerWidth,
      width: window.innerWidth,
      height: window.innerHeight
    };
    const anchorElement = anchorRef?.current;
    if (anchorRef && !anchorElement) {
      console.warn("FloatingContainer anchor provided, but its value is undefined");
    }
    const anchorRect = anchorElement?.getBoundingClientRect() ?? windowRect;
    const calculateProps = {
      windowRect,
      anchorRect,
      containerRect,
      options: {
        horizontalAlignment,
        verticalAlignment,
        screenPadding,
        gap
      }
    };
    setStyle(calculatePosition(calculateProps));
  }, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
  const height = containerRef.current?.getBoundingClientRect().height;
  const width = containerRef.current?.getBoundingClientRect().width;
  useEffect8(() => {
    if (active && isMounted) {
      calculate();
    } else {
      setStyle(void 0);
    }
  }, [calculate, active, isMounted, height, width]);
  useEffect8(() => {
    window.addEventListener("resize", calculate);
    let timeout;
    if (isPolling) {
      timeout = setInterval(calculate, pollingInterval);
    }
    return () => {
      window.removeEventListener("resize", calculate);
      if (timeout) {
        clearInterval(timeout);
      }
    };
  }, [calculate, isPolling, pollingInterval]);
  return style;
}

// src/components/user-action/select/Select.tsx
import { createPortal as createPortal2 } from "react-dom";
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
var defaultToggleOpenOptions = {
  highlightStartPositionBehavior: "first"
};
var SelectContext = createContext2(null);
function useSelectContext() {
  const ctx = useContext2(SelectContext);
  if (!ctx) {
    throw new Error("SelectContext must be used within a ListBoxPrimitive");
  }
  return ctx;
}
var SelectRoot = ({
  children,
  id,
  value,
  onValueChanged,
  values,
  onValuesChanged,
  isOpen = false,
  disabled = false,
  invalid = false,
  isMultiSelect = false,
  iconAppearance = "left"
}) => {
  const triggerRef = useRef4(null);
  const generatedId = useId4();
  const usedId = id ?? generatedId;
  const [internalState, setInternalState] = useState10({
    isOpen,
    options: []
  });
  const selectedValues = useMemo2(
    () => isMultiSelect ? values ?? [] : [value].filter(Boolean),
    [isMultiSelect, value, values]
  );
  const selectedOptions = useMemo2(
    () => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
    [selectedValues, internalState.options]
  );
  const state = {
    ...internalState,
    id: usedId,
    disabled,
    invalid,
    value: selectedValues,
    selectedOptions
  };
  const config = {
    isMultiSelect,
    iconAppearance
  };
  const registerItem = useCallback6((item) => {
    setInternalState((prev) => {
      const updatedOptions = [...prev.options, item];
      updatedOptions.sort((a, b) => {
        const aEl = a.ref.current;
        const bEl = b.ref.current;
        if (!aEl || !bEl) return 0;
        return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
      });
      return {
        ...prev,
        options: updatedOptions
      };
    });
  }, []);
  const unregisterItem = useCallback6((value2) => {
    setInternalState((prev) => {
      const updatedOptions = prev.options.filter((i) => i.value !== value2);
      return {
        ...prev,
        options: updatedOptions
      };
    });
  }, []);
  const toggleSelection = (value2, isSelected) => {
    if (disabled) {
      return;
    }
    const option = state.options.find((i) => i.value === value2);
    if (!option) {
      console.error(`SelectOption with value: ${value2} not found`);
      return;
    }
    let newValue;
    if (isMultiSelect) {
      const isSelectedBefore = state.value.includes(value2);
      const isSelectedAfter = isSelected ?? !isSelectedBefore;
      if (!isSelectedAfter) {
        newValue = state.value.filter((v) => v !== value2);
      } else {
        newValue = [...state.value, value2];
      }
    } else {
      newValue = [value2];
    }
    if (!isMultiSelect) {
      onValueChanged?.(newValue[0]);
    } else {
      onValuesChanged?.(newValue);
    }
    setInternalState((prevState) => ({
      ...prevState,
      highlightedValue: value2
    }));
  };
  const highlightItem = (value2) => {
    if (disabled) {
      return;
    }
    setInternalState((prevState) => ({
      ...prevState,
      highlightedValue: value2
    }));
  };
  const registerTrigger = useCallback6((ref) => {
    triggerRef.current = ref.current;
  }, []);
  const unregisterTrigger = useCallback6(() => {
    triggerRef.current = null;
  }, []);
  const toggleOpen = (isOpen2, toggleOpenOptions) => {
    const { highlightStartPositionBehavior } = { ...defaultToggleOpenOptions, ...toggleOpenOptions };
    let firstSelectedValue;
    let firstEnabledValue;
    for (let i = 0; i < state.options.length; i++) {
      const currentOption = state.options[highlightStartPositionBehavior === "first" ? i : state.options.length - i - 1];
      if (!currentOption.disabled) {
        if (!firstEnabledValue) {
          firstEnabledValue = currentOption.value;
        }
        if (selectedValues.includes(currentOption.value)) {
          firstSelectedValue = currentOption.value;
          break;
        }
      }
    }
    setInternalState((prevState) => ({
      ...prevState,
      isOpen: isOpen2 ?? !prevState.isOpen,
      highlightedValue: firstSelectedValue ?? firstEnabledValue
    }));
  };
  const moveHighlightedIndex = (delta) => {
    let highlightedIndex = state.options.findIndex((value2) => value2.value === internalState.highlightedValue);
    if (highlightedIndex === -1) {
      highlightedIndex = 0;
    }
    const optionLength = state.options.length;
    const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
    const isForward = delta >= 0;
    let highlightedValue = state.options[startIndex].value;
    for (let i = 0; i < state.options.length; i++) {
      const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
      if (!state.options[index].disabled) {
        highlightedValue = state.options[index].value;
        break;
      }
    }
    setInternalState((prevState) => ({
      ...prevState,
      highlightedValue
    }));
  };
  useEffect9(() => {
    if (!internalState.highlightedValue) return;
    const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
    if (highlighted) {
      highlighted.ref.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
    } else {
      console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
    }
  }, [internalState.highlightedValue]);
  const contextValue = {
    state,
    config,
    item: {
      register: registerItem,
      unregister: unregisterItem,
      toggleSelection,
      highlightItem,
      moveHighlightedIndex
    },
    trigger: {
      ref: triggerRef,
      register: registerTrigger,
      unregister: unregisterTrigger,
      toggleOpen
    }
  };
  return /* @__PURE__ */ jsx10(SelectContext.Provider, { value: contextValue, children });
};
var SelectOption = forwardRef4(
  function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
    const { state, config, item, trigger } = useSelectContext();
    const { register, unregister, toggleSelection, highlightItem } = item;
    const itemRef = useRef4(null);
    iconAppearance ??= config.iconAppearance;
    const label = children ?? value;
    useEffect9(() => {
      register({
        value,
        label,
        disabled,
        ref: itemRef
      });
      return () => unregister(value);
    }, [value, disabled, register, unregister, children, label]);
    const isHighlighted = state.highlightedValue === value;
    const isSelected = state.value.includes(value);
    return /* @__PURE__ */ jsxs6(
      "li",
      {
        ...restProps,
        ref: (node) => {
          itemRef.current = node;
          if (typeof ref === "function") ref(node);
          else if (ref) ref.current = node;
        },
        id: value,
        role: "option",
        "aria-disabled": disabled,
        "aria-selected": isSelected,
        "data-highlighted": isHighlighted ? "" : void 0,
        "data-selected": isSelected ? "" : void 0,
        "data-disabled": disabled ? "" : void 0,
        className: clsx7(
          "flex-row-1 items-center px-2 py-1 rounded-md",
          "data-highlighted:bg-primary/20",
          "data-disabled:text-disabled data-disabled:cursor-not-allowed",
          "not-data-disabled:cursor-pointer",
          className
        ),
        onClick: (event) => {
          if (!disabled) {
            toggleSelection(value);
            if (!config.isMultiSelect) {
              trigger.toggleOpen(false);
            }
            restProps.onClick?.(event);
          }
        },
        onMouseEnter: (event) => {
          if (!disabled) {
            highlightItem(value);
            restProps.onMouseEnter?.(event);
          }
        },
        children: [
          iconAppearance === "left" && /* @__PURE__ */ jsx10(
            CheckIcon,
            {
              className: clsx7("w-4 h-4", { "opacity-0": !isSelected || disabled }),
              "aria-hidden": true
            }
          ),
          label,
          iconAppearance === "right" && /* @__PURE__ */ jsx10(
            CheckIcon,
            {
              className: clsx7("w-4 h-4", { "opacity-0": !isSelected || disabled }),
              "aria-hidden": true
            }
          )
        ]
      }
    );
  }
);
var SelectButton = forwardRef4(function SelectButton2({ placeholder, selectedDisplay, ...props }, ref) {
  const translation = useHightideTranslation();
  const { state, trigger } = useSelectContext();
  const { register, unregister, toggleOpen } = trigger;
  const innerRef = useRef4(null);
  useImperativeHandle2(ref, () => innerRef.current);
  useEffect9(() => {
    register(innerRef);
    return () => unregister();
  }, [register, unregister]);
  const disabled = !!props?.disabled || !!state.disabled;
  const invalid = state.invalid;
  const hasValue = state.value.length > 0;
  return /* @__PURE__ */ jsxs6(
    "button",
    {
      ...props,
      ref: innerRef,
      id: state.id,
      disabled,
      onClick: (event) => {
        props.onClick?.(event);
        toggleOpen(!state.isOpen);
      },
      onKeyDown: (event) => {
        props.onKeyDown?.(event);
        switch (event.key) {
          case "ArrowDown":
            toggleOpen(true, { highlightStartPositionBehavior: "first" });
            event.preventDefault();
            event.stopPropagation();
            break;
          case "ArrowUp":
            toggleOpen(true, { highlightStartPositionBehavior: "last" });
            event.preventDefault();
            event.stopPropagation();
            break;
        }
      },
      className: clsx7(
        "flex-row-2 items-center justify-between rounded-md px-3 py-2",
        {
          "bg-input-background text-placeholder": !hasValue && !disabled && !invalid,
          "bg-input-background text-input-text": hasValue && !disabled && !invalid,
          "bg-negative/20": !disabled && invalid,
          "text-placeholder": !hasValue && !disabled,
          "text-negative": hasValue && !disabled && invalid,
          "bg-disabled-background text-disabled": disabled
        },
        props.className
      ),
      "data-placeholder": !hasValue ? "" : void 0,
      "data-disabled": disabled ? "" : void 0,
      "data-invalid": invalid ? "" : void 0,
      "aria-invalid": invalid,
      "aria-disabled": disabled,
      "aria-haspopup": "listbox",
      "aria-expanded": state.isOpen,
      "aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
      children: [
        hasValue ? selectedDisplay?.(state.value) ?? /* @__PURE__ */ jsx10("div", { className: clsx7("flex flex-wrap gap-x-1 gap-y-2"), children: state.selectedOptions.map(({ value, label }, index) => /* @__PURE__ */ jsxs6("span", { className: "flex-row-0", children: [
          label,
          index < state.value.length - 1 && /* @__PURE__ */ jsx10("span", { children: "," })
        ] }, value)) }) : placeholder ?? translation("clickToSelect"),
        /* @__PURE__ */ jsx10(
          ExpansionIcon,
          {
            isExpanded: state.isOpen,
            className: clsx7({
              "text-input-text": !disabled && !invalid,
              "text-negative": !disabled && invalid,
              "text-disabled": disabled
            })
          }
        )
      ]
    }
  );
});
var SelectChipDisplay = forwardRef4(function SelectChipDisplay2({ ...props }, ref) {
  const { state, trigger, item } = useSelectContext();
  const { register, unregister, toggleOpen } = trigger;
  const innerRef = useRef4(null);
  useImperativeHandle2(ref, () => innerRef.current);
  useEffect9(() => {
    register(innerRef);
    return () => unregister();
  }, [register, unregister]);
  const disabled = !!props?.disabled || !!state.disabled;
  const invalid = state.invalid;
  return /* @__PURE__ */ jsxs6(
    "div",
    {
      ...props,
      ref: innerRef,
      className: clsx7(
        "flex flex-wrap flex-row gap-2 items-center bg-input-background text-input-text rounded-md px-2.5 py-2.5",
        props.className
      ),
      "data-disabled": disabled ? "" : void 0,
      "data-invalid": invalid ? "" : void 0,
      "aria-invalid": invalid,
      "aria-disabled": disabled,
      children: [
        state.selectedOptions.map(({ value, label }) => /* @__PURE__ */ jsxs6(Chip, { className: "gap-x-2", children: [
          label,
          /* @__PURE__ */ jsx10(
            TextButton,
            {
              onClick: () => {
                item.toggleSelection(value, false);
              },
              size: "none",
              color: "negative",
              className: "flex-row-0 items-center px-0.5 py-0.5 w-6 h-6 rounded",
              children: /* @__PURE__ */ jsx10(XIcon, { className: "w-5 h-5" })
            }
          )
        ] }, value)),
        /* @__PURE__ */ jsx10(
          IconButton,
          {
            id: state.id,
            onClick: () => toggleOpen(),
            onKeyDown: (event) => {
              switch (event.key) {
                case "ArrowDown":
                  toggleOpen(true, { highlightStartPositionBehavior: "first" });
                  break;
                case "ArrowUp":
                  toggleOpen(true, { highlightStartPositionBehavior: "last" });
              }
            },
            size: "small",
            color: "neutral",
            "aria-invalid": invalid,
            "aria-disabled": disabled,
            "aria-haspopup": "listbox",
            "aria-expanded": state.isOpen,
            "aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
            children: /* @__PURE__ */ jsx10(Plus, {})
          }
        )
      ]
    }
  );
});
var SelectContent = forwardRef4(
  function SelectContent2({
    alignment,
    orientation = "vertical",
    containerClassName,
    ...props
  }, ref) {
    const innerRef = useRef4(null);
    useImperativeHandle2(ref, () => innerRef.current);
    const { trigger, state, config, item } = useSelectContext();
    const position = useFloatingElement({
      active: state.isOpen,
      anchorRef: trigger.ref,
      containerRef: innerRef,
      ...alignment
    });
    useFocusTrap({
      container: innerRef,
      active: state.isOpen && !!position
    });
    return createPortal2(
      /* @__PURE__ */ jsxs6(
        "div",
        {
          id: `select-container-${state.id}`,
          className: clsx7("fixed inset-0 w-screen h-screen", containerClassName),
          hidden: !state.isOpen,
          children: [
            /* @__PURE__ */ jsx10(
              "div",
              {
                id: `select-background-${state.id}`,
                onClick: () => trigger.toggleOpen(false),
                className: clsx7("fixed inset-0 w-screen h-screen")
              }
            ),
            /* @__PURE__ */ jsx10(
              "ul",
              {
                ...props,
                id: `${state.id}-listbox`,
                ref: innerRef,
                onKeyDown: (event) => {
                  switch (event.key) {
                    case "Escape":
                      trigger.toggleOpen(false);
                      event.preventDefault();
                      event.stopPropagation();
                      break;
                    case match(orientation, {
                      vertical: "ArrowDown",
                      horizontal: "ArrowUp"
                    }):
                      item.moveHighlightedIndex(1);
                      event.preventDefault();
                      break;
                    case match(orientation, {
                      vertical: "ArrowUp",
                      horizontal: "ArrowDown"
                    }):
                      item.moveHighlightedIndex(-1);
                      event.preventDefault();
                      break;
                    case "Home":
                      event.preventDefault();
                      break;
                    case "End":
                      event.preventDefault();
                      break;
                    case "Enter":
                    // Fall through
                    case " ":
                      if (state.highlightedValue) {
                        item.toggleSelection(state.highlightedValue);
                        if (!config.isMultiSelect) {
                          trigger.toggleOpen(false);
                        }
                        event.preventDefault();
                      }
                      break;
                  }
                },
                className: clsx7("flex-col-0 p-2 bg-menu-background text-menu-text rounded-md shadow-hw-bottom focus-style-within overflow-auto", props.className),
                style: {
                  opacity: position ? void 0 : 0,
                  position: "fixed",
                  ...position
                },
                role: "listbox",
                "aria-multiselectable": config.isMultiSelect,
                "aria-orientation": orientation,
                tabIndex: position ? 0 : void 0,
                children: props.children
              }
            )
          ]
        }
      ),
      document.body
    );
  }
);
var Select = forwardRef4(function Select2({
  children,
  contentPanelProps,
  buttonProps,
  ...props
}, ref) {
  return /* @__PURE__ */ jsxs6(SelectRoot, { ...props, isMultiSelect: false, children: [
    /* @__PURE__ */ jsx10(
      SelectButton,
      {
        ref,
        ...buttonProps,
        selectedDisplay: (values) => {
          const value = values[0];
          if (!buttonProps?.selectedDisplay) return void 0;
          return buttonProps.selectedDisplay(value);
        }
      }
    ),
    /* @__PURE__ */ jsx10(SelectContent, { ...contentPanelProps, children })
  ] });
});
var SelectUncontrolled = forwardRef4(function SelectUncontrolled2({
  value: initialValue,
  onValueChanged,
  ...props
}, ref) {
  const [value, setValue] = useOverwritableState(initialValue, onValueChanged);
  return /* @__PURE__ */ jsx10(
    Select,
    {
      ...props,
      ref,
      value,
      onValueChanged: setValue
    }
  );
});
var MultiSelect = forwardRef4(function MultiSelect2({
  children,
  contentPanelProps,
  buttonProps,
  ...props
}, ref) {
  return /* @__PURE__ */ jsxs6(SelectRoot, { ...props, isMultiSelect: true, children: [
    /* @__PURE__ */ jsx10(SelectButton, { ref, ...buttonProps }),
    /* @__PURE__ */ jsx10(SelectContent, { ...contentPanelProps, children })
  ] });
});
var MultiSelectUncontrolled = forwardRef4(function MultiSelectUncontrolled2({
  values: initialValues,
  onValuesChanged,
  ...props
}, ref) {
  const [values, setValues] = useOverwritableState(initialValues, onValuesChanged);
  return /* @__PURE__ */ jsx10(
    MultiSelect,
    {
      ...props,
      ref,
      values,
      onValuesChanged: setValues
    }
  );
});
var MultiSelectChipDisplay = forwardRef4(function MultiSelectChipDisplay2({
  children,
  contentPanelProps,
  chipDisplayProps,
  ...props
}, ref) {
  return /* @__PURE__ */ jsxs6(SelectRoot, { ...props, isMultiSelect: true, children: [
    /* @__PURE__ */ jsx10(SelectChipDisplay, { ref, ...chipDisplayProps }),
    /* @__PURE__ */ jsx10(SelectContent, { ...contentPanelProps, children })
  ] });
});
var MultiSelectChipDisplayUncontrolled = forwardRef4(function MultiSelectChipDisplayUncontrolled2({
  values: initialValues,
  onValuesChanged,
  ...props
}, ref) {
  const [values, setValues] = useOverwritableState(initialValues, onValuesChanged);
  return /* @__PURE__ */ jsx10(
    MultiSelectChipDisplay,
    {
      ...props,
      ref,
      values,
      onValuesChanged: setValues
    }
  );
});

// src/components/dialog/LanguageDialog.tsx
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
var LanguageDialog = ({
  onClose,
  titleOverwrite,
  descriptionOverwrite,
  ...props
}) => {
  const { locale, setLocale } = useLocale();
  const translation = useHightideTranslation();
  return /* @__PURE__ */ jsx11(
    Dialog,
    {
      titleElement: titleOverwrite ?? translation("language"),
      description: descriptionOverwrite ?? translation("chooseLanguage"),
      onClose,
      ...props,
      children: /* @__PURE__ */ jsxs7("div", { className: "w-64", children: [
        /* @__PURE__ */ jsx11(
          Select,
          {
            value: locale,
            onValueChanged: (language) => setLocale(language),
            contentPanelProps: { containerClassName: "z-200" },
            buttonProps: {
              selectedDisplay: (locale2) => LocalizationUtil.languagesLocalNames[locale2]
            },
            children: LocalizationUtil.locals.map((local) => /* @__PURE__ */ jsx11(SelectOption, { value: local, children: LocalizationUtil.languagesLocalNames[local] }, local))
          }
        ),
        /* @__PURE__ */ jsx11("div", { className: "flex-row-4 mt-3 justify-end", children: /* @__PURE__ */ jsx11(SolidButton, { color: "positive", onClick: onClose, children: translation("done") }) })
      ] })
    }
  );
};

// src/components/dialog/ThemeDialog.tsx
import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
import clsx8 from "clsx";

// src/theming/useTheme.tsx
import { createContext as createContext3, useCallback as useCallback7, useContext as useContext3, useEffect as useEffect10, useMemo as useMemo3, useState as useState11 } from "react";
import { jsx as jsx12 } from "react/jsx-runtime";
var themes = ["light", "dark", "system"];
var ThemeUtil = {
  themes
};
var ThemeContext = createContext3(null);
var useTheme = () => {
  const context = useContext3(ThemeContext);
  if (!context) {
    throw new Error("useTheme must be used within ThemeContext. Try adding a ThemeProvider around your app.");
  }
  return context;
};

// src/components/dialog/ThemeDialog.tsx
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
var ThemeIcon = ({ theme, className }) => {
  if (theme === "dark") {
    return /* @__PURE__ */ jsx13(MoonIcon, { className: clsx8("w-4 h-4", className) });
  } else if (theme === "light") {
    return /* @__PURE__ */ jsx13(SunIcon, { className: clsx8("w-4 h-4", className) });
  } else {
    return /* @__PURE__ */ jsx13(MonitorCog, { className: clsx8("w-4 h-4", className) });
  }
};
var ThemeDialog = ({
  onClose,
  titleOverwrite,
  descriptionOverwrite,
  ...props
}) => {
  const { theme, setTheme } = useTheme();
  const translation = useHightideTranslation();
  return /* @__PURE__ */ jsx13(
    Dialog,
    {
      titleElement: titleOverwrite ?? translation("themes", { count: 1 }),
      description: descriptionOverwrite ?? translation("chooseTheme"),
      onClose,
      ...props,
      children: /* @__PURE__ */ jsxs8("div", { className: "w-64", children: [
        /* @__PURE__ */ jsx13(
          Select,
          {
            value: theme,
            onValueChanged: (theme2) => setTheme(theme2),
            iconAppearance: "right",
            contentPanelProps: {
              containerClassName: "z-200"
            },
            buttonProps: {
              selectedDisplay: (value) => /* @__PURE__ */ jsxs8("div", { className: "flex-row-2 items-center", children: [
                /* @__PURE__ */ jsx13(ThemeIcon, { theme }),
                translation("themeMode", { theme: value })
              ] }),
              className: "min-w-32"
            },
            children: ThemeUtil.themes.map((theme2) => /* @__PURE__ */ jsx13(SelectOption, { value: theme2, className: "gap-x-6 justify-between", children: /* @__PURE__ */ jsxs8("div", { className: "flex-row-2 items-center", children: [
              /* @__PURE__ */ jsx13(ThemeIcon, { theme: theme2 }),
              translation("themeMode", { theme: theme2 })
            ] }) }, theme2))
          }
        ),
        /* @__PURE__ */ jsx13("div", { className: "flex-row-4 mt-3 justify-end", children: /* @__PURE__ */ jsx13(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
      ] })
    }
  );
};
export {
  ConfirmDialog,
  Dialog,
  DiscardChangesDialog,
  InputDialog,
  LanguageDialog,
  ThemeDialog
};
//# sourceMappingURL=index.js.map