import { jsx } from "react/jsx-runtime";
import { forwardRef, useMemo } from "react";
/* empty css                   */
import Avatar$1 from "../../node_modules/@mui/material/Avatar/Avatar.js";
const Avatar = forwardRef(
  ({
    label = "Unknown",
    type = "withoutPicture",
    src,
    size = "large",
    alt,
    className = "",
    ...args
  }, ref) => {
    const initials = useMemo(() => {
      if (type === "withPicture") {
        return "";
      }
      return label.trim().split(" ").filter((word) => word).map((word) => {
        var _a;
        return ((_a = word[0]) == null ? void 0 : _a.toUpperCase()) ?? "";
      }).join("") || "";
    }, [label, type]);
    const displayInitials = useMemo(() => {
      const maxChars = type === "onlyName" ? 1 : 2;
      return initials.substring(0, maxChars);
    }, [initials, type]);
    const classStr = useMemo(() => {
      let retVal = `ia-styles ia-avatar ${className}`;
      switch (size) {
        case "small":
          retVal += " ia-avatar-small";
          break;
        case "medium":
          retVal += " ia-avatar-medium";
          break;
        case "large":
        default:
          retVal += " ia-avatar-large";
          break;
      }
      return retVal.trim();
    }, [size, className]);
    return /* @__PURE__ */ jsx(
      Avatar$1,
      {
        ref,
        alt: alt ?? label,
        className: classStr,
        src: type === "withPicture" ? src : void 0,
        ...args,
        children: displayInitials
      }
    );
  }
);
Avatar.displayName = "Avatar";
export {
  Avatar
};
