function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
import { Avatar, ConfigProvider, Tooltip } from "antd";
import classNames from "classnames";
import React from "react";
import { useStyle } from "./style";
var COLOR_LIST = [
    '#f56a00',
    '#7265e6',
    '#ffbf00',
    '#00a2ae',
    '#f44336',
    '#87d068'
];
export var ContributorAvatar = function(props) {
    var tmp = props.item, name = (tmp === void 0 ? {} : tmp).name, _props_index = props.index, index = _props_index === void 0 ? 0 : _props_index;
    return /*#__PURE__*/ React.createElement(Tooltip, {
        title: name
    }, /*#__PURE__*/ React.createElement("div", {
        className: props.className
    }, /*#__PURE__*/ React.createElement(Avatar, {
        size: 14,
        alt: name,
        style: {
            backgroundColor: COLOR_LIST[index % COLOR_LIST.length],
            cursor: 'pointer'
        }
    }, name === null || name === void 0 ? void 0 : name.slice(0, 2))));
};
export var AvatarList = function(param) {
    var displayList = param.displayList, style = param.style;
    var context = React.useContext(ConfigProvider.ConfigContext);
    var baseCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-contributor-avatar-list');
    var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
    return wrapSSR(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
        className: classNames(hashId, baseCls),
        style: _object_spread({}, style)
    }, displayList.map(function(item, index) {
        return /*#__PURE__*/ React.createElement(ContributorAvatar, {
            key: item.name,
            className: classNames("".concat(baseCls, "-item"), hashId),
            item: item,
            index: index
        });
    }))));
};
