/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
const require_styles_styler = require("../../../styles/styler.cjs");
let lodash_isFunction_js = require("lodash/isFunction.js");
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js, 1);
//#region src/components/client/Avatar/utils.ts
/** Strategies for generating text abbreviation */
const abbrevStrategies = {
	first: (initials) => initials[0] ?? "",
	last: (initials) => initials[initials.length - 1] ?? "",
	firstAndLast: (initials) => initials.length === 1 ? initials[0] : `${initials[0]}${initials[initials.length - 1]}`,
	firstTwo: (initials) => initials.slice(0, 2).join(""),
	firstThree: (initials) => initials.slice(0, 3).join(""),
	firstOfEach: (initials) => initials.join("")
};
/**
* Generates an abbreviation from a name using a specified strategy.
*
* @param name - The full name.
* @param strategy - Abbreviation strategy key or custom function.
* @returns The generated abbreviation.
*/
const generateAvatarAbbreviation = (name, strategy = "firstAndLast") => {
	if (!name) return "";
	if ((0, lodash_isFunction_js.default)(strategy)) return strategy(name);
	const initials = name.trim().split(/\s+/).map((word) => word[0].toUpperCase());
	return abbrevStrategies[strategy](initials);
};
/**
* Builds the root CSS classes for the Avatar.
*
* @param size - The size of the Avatar.
* @returns A string of CSS classes.
*/
const buildAvatarRootClasses = (size = "md", styles) => {
	const { className: stylesClassName, ...restStyles } = styles ?? {};
	return require_styles_styler.getStyles({
		avatarSizeRoot: size,
		...restStyles,
		className: require_styles_styler.cx("shrink-0", "text-center", "inline-flex", "justify-center", "items-center", "overflow-visible", "truncate", stylesClassName)
	});
};
const buildInlineSizeStyles = (customSize) => {
	const rootStyles = customSize ? {
		height: customSize,
		width: customSize
	} : {};
	return {
		root: rootStyles,
		contents: {
			...rootStyles,
			boxSizing: "content-box"
		}
	};
};
const DEFAULT_AVATAR_VARIANT = "primary";
const DEFAULT_AVATAR_SIZE = "md";
//#endregion
exports.DEFAULT_AVATAR_SIZE = DEFAULT_AVATAR_SIZE;
exports.DEFAULT_AVATAR_VARIANT = DEFAULT_AVATAR_VARIANT;
exports.buildAvatarRootClasses = buildAvatarRootClasses;
exports.buildInlineSizeStyles = buildInlineSizeStyles;
exports.generateAvatarAbbreviation = generateAvatarAbbreviation;
