import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
import { nothing } from 'lit';
import { avatarSizeClass, defaultClasses, defaultStyles, facingClass, onClickAction, } from '../attributes.js';
import { blockTypeToString } from '../block-type.js';
import { classMap } from './util.js';
export function renderAvatarBlock(block, ctx) {
    const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
    if (!block.config?.avatarConfig) {
        console.error('Invalid block: Avatar missing AvatarConfig');
        return nothing;
    }
    const { thingId, facing, size, background } = block.config.avatarConfig;
    const classes = {
        ...defaultClasses(block, ctx),
        ...avatarSizeClass(size),
        ...facingClass(facing),
    };
    const styles = {
        ...defaultStyles(block, ctx),
    };
    const onClick = onClickAction(block, ctx);
    return html `<div
    class="${classMap(classes)}"
    style="${styleMap(styles)}"
    @click="${ifDefined(onClick)}"
    data-block-type="${blockTypeToString(block.type)}"
  ></div>`;
}
//# sourceMappingURL=renderAvatarBlock.js.map