"use client"
import{j as a}from"./chunk-IODNXUBC.mjs";import{useState as l}from"react";import{sha256 as o}from"js-sha256";function t(e){if(e!=null&&e.image)return e.image;if(!(e!=null&&e.id))return"https://api.dicebear.com/9.x/micah/svg";let n=`https://api.dicebear.com/9.x/micah/svg?seed=${encodeURIComponent(e.id)}`,r=`https://api.dicebear.com/9.x/micah/png/${encodeURIComponent(`seed=${encodeURIComponent(e.id)}`)}`;return e.email?`https://www.gravatar.com/avatar/${o(e.email)}?d=${encodeURIComponent(r)}`:n}import{jsx as i}from"react/jsx-runtime";function f({user:e={},className:n}){if(!e)return i("div",{className:a("h-10 w-10 animate-pulse rounded-full border border-gray-300 bg-gray-100",n)});let[r,d]=l(t(e));return i("img",{alt:`Avatar for ${e.name||e.email}`,referrerPolicy:"no-referrer",src:r,className:a("h-10 w-10 rounded-full border border-gray-300",n),draggable:!1,onError:()=>{d(`https://api.dicebear.com/9.x/micah/svg?seed=${encodeURIComponent(e.id||"")}`)}})}function h({id:e,className:n}){return i("img",{src:`https://api.dicebear.com/9.x/shapes/svg?seed=${e}`,alt:"avatar",className:a("h-10 w-10 rounded-full",n),draggable:!1})}export{t as a,f as b,h as c};
