/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { cx, getStyles } from "../../../styles/styler.js";
import { IconSlot } from "../../IconSlot.js";
import { Box } from "../../Box.js";
import { DEFAULT_AVATAR_VARIANT, buildAvatarRootClasses, buildInlineSizeStyles } from "./utils.js";
import { Building, Person } from "@yahoo/uds-icons";
import { forwardRef, useMemo } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/components/client/Avatar/AvatarIcon.tsx
/** Maps avatar variant to icon */
const mapVariantToIcon = {
	primary: Person,
	secondary: Building
};
/**
* **AvatarIcon Component**
*
* Renders an Avatar with an icon representation.
*
* @param props - Props for icon variant.
* @returns The AvatarIcon element.
*/
const AvatarIcon = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT, customSize, icon, slotProps, className, ...props }, ref) => {
	const classNames = useMemo(() => ({
		root: buildAvatarRootClasses(size, {
			avatarIconVariantRoot: variant,
			overflow: "hidden",
			className: cx("overflow-hidden", className)
		}),
		iconContainer: cx("w-full", "h-full", "shrink-0", "overflow-hidden", "text-center", "inline-flex", "justify-center", "items-center"),
		icon: getStyles({ avatarSizeIcon: size })
	}), [
		className,
		size,
		variant
	]);
	const inlineStyles = useMemo(() => buildInlineSizeStyles(customSize), [customSize]);
	const iconSvg = icon ?? mapVariantToIcon[variant ?? "primary"];
	return /* @__PURE__ */ jsx(Box, {
		ref,
		className: classNames.root,
		style: inlineStyles.root,
		...props,
		children: /* @__PURE__ */ jsx(Box, {
			className: classNames.iconContainer,
			style: inlineStyles.contents,
			children: /* @__PURE__ */ jsx(IconSlot, {
				icon: iconSvg,
				iconProps: {
					variant: "fill",
					color: "current",
					...slotProps?.icon
				},
				className: classNames.icon
			})
		})
	});
});
AvatarIcon.displayName = "AvatarIcon";
//#endregion
export { AvatarIcon };
