"use strict";const g=require("react/jsx-runtime"),u=require("react"),$=require("@chakra-ui/react"),z=require("./avatar.recipe-XvknqPJq.cjs.js"),e=require("./normalize-messages-CaDzkuUm.cjs.js"),A=require("./image-CGOYoc2s.cjs.js"),{withContext:I}=$.createRecipeContext({recipe:z.avatarRecipe}),R=I("figure"),q={avatarLabel:a=>`Avatar image for ${a.fullName}`},S={avatarLabel:a=>`Avatarbild für ${a.fullName}`},_={avatarLabel:a=>`Imagen de avatar para ${a.fullName}`},h={avatarLabel:a=>`Image d'avatar pour ${a.fullName}`},x={avatarLabel:a=>`Avatar para ${a.fullName}`},C={en:e.normalizeMessages(q),de:e.normalizeMessages(S),es:e.normalizeMessages(_),"fr-FR":e.normalizeMessages(h),"pt-BR":e.normalizeMessages(x)};function j(a,s){return a.split("")[0].toUpperCase()+s.split("")[0].toUpperCase()}const v=a=>{const s=e.useLocalizedStringFormatter(C),{ref:f,firstName:r,lastName:o,src:t,alt:p,...d}=a,[n,l]=u.useState(!1),[i,c]=u.useState(!1),m=`${r} ${o}`,b={"aria-label":s.format("avatarLabel",{fullName:m}),ref:f,...d},L=()=>{l(!0),c(!1)},M=()=>{l(!1),c(!0)},N=!t||!n||i;return g.jsxs(R,{...b,children:[N?j(r,o):null,t&&g.jsx(A.Image,{src:t,alt:p||m,onLoad:L,onError:M,display:n&&!i?"block":"none"})]})};v.displayName="Avatar";exports.Avatar=v;
//# sourceMappingURL=avatar-BVQ91Ccd.cjs.js.map
