import { jsxs as L, jsx as I } from "react/jsx-runtime";
import { useState as f } from "react";
import { createRecipeContext as N } from "@chakra-ui/react";
import { n as e, u as A } from "./normalize-messages-BN9BAFXe.es.js";
import { I as h } from "./image-DRigLU80.es.js";
const { withContext: M } = /* @__PURE__ */ N({ key: "nimbusAvatar" }), $ = /* @__PURE__ */ M(
  "figure"
), x = {
  avatarLabel: (a) => `Avatar image for ${a.fullName}`
}, S = {
  avatarLabel: (a) => `Avatarbild für ${a.fullName}`
}, _ = {
  avatarLabel: (a) => `Imagen de avatar para ${a.fullName}`
}, C = {
  avatarLabel: (a) => `Image d'avatar pour ${a.fullName}`
}, R = {
  avatarLabel: (a) => `Avatar para ${a.fullName}`
}, w = {
  en: /* @__PURE__ */ e(x),
  de: /* @__PURE__ */ e(S),
  es: /* @__PURE__ */ e(_),
  "fr-FR": /* @__PURE__ */ e(C),
  "pt-BR": /* @__PURE__ */ e(R)
};
function y(a, t) {
  return a.split("")[0].toUpperCase() + t.split("")[0].toUpperCase();
}
const E = (a) => {
  const t = A(w), { ref: v, firstName: r, lastName: o, src: s, alt: p, ...g } = a, [l, n] = f(!1), [m, i] = f(!1), c = `${r} ${o}`, u = {
    "aria-label": t.format("avatarLabel", {
      fullName: c
    }),
    ref: v,
    ...g
  }, d = () => {
    n(!0), i(!1);
  }, b = () => {
    n(!1), i(!0);
  };
  return /* @__PURE__ */ L($, { ...u, children: [
    !s || !l || m ? y(r, o) : null,
    s && /* @__PURE__ */ I(
      h,
      {
        src: s,
        alt: p || c,
        onLoad: d,
        onError: b,
        display: l && !m ? "block" : "none"
      }
    )
  ] });
};
E.displayName = "Avatar";
export {
  E as A
};
//# sourceMappingURL=avatar-XKmhQ3Wm.es.js.map
