import{bw as a,as as e,i as t,s as l}from"./index.M4bJ7AyN.js";import{u as i}from"./i18n.DI4_U1ww.js";import{u as r,aa as s,aC as n,l as o,i as v,X as p,ap as c,aj as u,V as g,g as m,a6 as d}from"./vue-vendor.CIPxpJKQ.js";const b=["src","alt"],f=["src","alt"],h="/images/img_live_ing_bowen.png",z=l(r({__name:"index",props:{avatar:{},size:{},type:{},showLive:{type:Boolean,default:!1},liveInset:{},liveRippleInset:{},liveLabel:{},liveLabelBottom:{},liveLabelFontSize:{},liveLabelMode:{default:"plain"}},setup(l){const r=l,z=a(),{t:x}=i(),y=m(()=>{if(r.size)return{width:`${r.size}px`,height:`${r.size}px`}}),$=m(()=>{const a=r.size??56;return a<=45?{inset:0,rippleInset:8,labelBottom:3,labelFontSize:8}:a<=56?{inset:1,rippleInset:10,labelBottom:4,labelFontSize:9}:{inset:2,rippleInset:12,labelBottom:6,labelFontSize:10}}),_=m(()=>{const a=r.liveInset??$.value.inset;return{top:`${a}px`,left:`${a}px`,width:`calc(100% - ${2*a}px)`,height:`calc(100% - ${2*a}px)`}}),I=m(()=>{const a=r.liveRippleInset??$.value.rippleInset;return{inset:`-${a}px`,width:`calc(100% + ${2*a}px)`,height:`calc(100% + ${2*a}px)`}}),L=m(()=>({bottom:`${r.liveLabelBottom??$.value.labelBottom}px`,fontSize:`${r.liveLabelFontSize??$.value.labelFontSize}px`})),w=m(()=>r.liveLabel||x("common.live")),S=m(()=>({backgroundImage:`url(${j.value})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundColor:"#1f1f1f"})),j=m(()=>"/images/defaultAvatar.jpg"),k=m(()=>Object.entries(z.appConfig.uploadAvatars).map(a=>({name:a[0],image:a[1]}))),B=s(A());function A(){if(!r.avatar)return j.value;if(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+=*$/.test(r.avatar))return r.avatar;const a=k.value.find(a=>a.name===r.avatar);return a?a.image:r.avatar.includes("http")?e(r.avatar,t.AVATAR,r.size):j.value}n(()=>r.avatar,(a,e)=>{B.value=A()},{immediate:!0});const F=a=>{B.value=j.value};return(a,e)=>l.showLive?(d(),o("div",{key:0,class:"avatar-live",style:p(c(y))},[v("img",{src:h,alt:"","aria-hidden":"true",class:"avatar-live-ripple ripple-1",style:p(c(I))},null,4),v("img",{src:h,alt:"","aria-hidden":"true",class:"avatar-live-ripple ripple-2",style:p(c(I))},null,4),v("img",{class:"avatar avatar-live-core",src:c(B),alt:l.avatar,style:p([c(_),c(S)]),loading:"eager",decoding:"async",fetchpriority:"high",onError:F},null,44,b),v("img",{src:"/images/img_live_ing_avatar_frame.png",alt:"live frame",class:"avatar-live-frame"}),v("span",{class:g(["avatar-live-label",{"avatar-live-label--pill":"pill"===l.liveLabelMode}]),style:p(c(L))},u(c(w)),7)],4)):(d(),o("img",{key:1,class:"avatar",src:c(B),alt:l.avatar,style:p([c(y),c(S)]),loading:"eager",decoding:"async",fetchpriority:"high",onError:F},null,44,f))}}),[["__scopeId","data-v-1341681e"]]);export{z as _};