1import{o as h}from"./zF-A6mWY.js";import{h as v,f as E,T as A,aQ as O,o as l,c as u,k as g,as as B,bt as P,n as i,ao as m,ap as y,r as T,d as U,R as $,aT as d,v as s,b7 as w,b8 as c,aS as I,aU as M}from"./C2i3VHsF.js";import{_ as k,u as D}from"./BXfSPKp2.js";function b(e,t){if(e)return e;let a=t??"button";if(typeof a=="string"&&a.toLowerCase()==="button")return"button"}function V(e,t){let a=v(b(e.value.type,e.value.as));return E(()=>{a.value=b(e.value.type,e.value.as)}),A(()=>{var n;a.value||h(t)&&h(t)instanceof HTMLButtonElement&&!((n=h(t))!=null&&n.hasAttribute("type"))&&(a.value="button")}),a}const L={wrapper:"relative inline-flex items-center justify-center flex-shrink-0",background:"bg-gray-100 dark:bg-gray-800",rounded:"rounded-full",text:"font-medium leading-none text-gray-900 dark:text-white truncate",placeholder:"font-medium leading-none text-gray-500 dark:text-gray-400 truncate",size:{"3xs":"h-4 w-4 text-[8px]","2xs":"h-5 w-5 text-[10px]",xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-14 w-14 text-xl","2xl":"h-16 w-16 text-2xl","3xl":"h-20 w-20 text-3xl"},chip:{base:"absolute rounded-full ring-1 ring-white dark:ring-gray-900 flex items-center justify-center text-white dark:text-gray-900 font-medium",background:"bg-{color}-500 dark:bg-{color}-400",position:{"top-right":"top-0 right-0","bottom-right":"bottom-0 right-0","top-left":"top-0 left-0","bottom-left":"bottom-0 left-0"},size:{"3xs":"h-[4px] min-w-[4px] text-[4px] p-px","2xs":"h-[5px] min-w-[5px] text-[5px] p-px",xs:"h-1.5 min-w-[0.375rem] text-[6px] p-px",sm:"h-2 min-w-[0.5rem] text-[7px] p-0.5",md:"h-2.5 min-w-[0.625rem] text-[8px] p-0.5",lg:"h-3 min-w-[0.75rem] text-[10px] p-0.5",xl:"h-3.5 min-w-[0.875rem] text-[11px] p-1","2xl":"h-4 min-w-[1rem] text-[12px] p-1","3xl":"h-5 min-w-[1.25rem] text-[14px] p-1"}},icon:{base:"text-gray-500 dark:text-gray-400 flex-shrink-0",size:{"3xs":"h-2 w-2","2xs":"h-2.5 w-2.5",xs:"h-3 w-3",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7","2xl":"h-8 w-8","3xl":"h-10 w-10"}},default:{size:"sm",icon:null,chipColor:null,chipPosition:"top-right"}},r=I(d.ui.strategy,d.ui.avatar,L),N=U({components:{UIcon:k},inheritAttrs:!1,props:{as:{type:[String,Object],default:"img"},src:{type:[String,Boolean],default:null},alt:{type:String,default:null},text:{type:String,default:null},icon:{type:String,default:()=>r.default.icon},size:{type:String,default:()=>r.default.size,validator(e){return Object.keys(r.size).includes(e)}},chipColor:{type:String,default:()=>r.default.chipColor,validator(e){return["gray",...d.ui.colors].includes(e)}},chipPosition:{type:String,default:()=>r.default.chipPosition,validator(e){return Object.keys(r.chip.position).includes(e)}},chipText:{type:[String,Number],default:null},imgClass:{type:String,default:""},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},setup(e){const{ui:t,attrs:a}=D("avatar",M(e,"ui"),r),n=s(()=>typeof e.src=="boolean"?null:e.src),f=s(()=>(e.alt||"").split(" ").map(j=>j.charAt(0)).join("").substring(0,2)),x=s(()=>w(c(t.value.wrapper,(o.value||!n.value)&&t.value.background,t.value.rounded,t.value.size[e.size]),e.class)),p=s(()=>w(c(t.value.rounded,t.value.size[e.size]),e.imgClass)),C=s(()=>c(t.value.icon.base,t.value.icon.size[e.size])),z=s(()=>c(t.value.chip.base,t.value.chip.size[e.size],t.value.chip.position[e.chipPosition],t.value.chip.background.replaceAll("{color}",e.chipColor))),o=v(!1);$(()=>e.src,()=>{o.value&&(o.value=!1)});function S(){o.value=!0}return{ui:t,attrs:a,wrapperClass:x,imgClass:p,iconClass:C,chipClass:z,url:n,placeholder:f,error:o,onError:S}}});function R(e,t,a,n,f,x){const p=k;return l(),u("span",{class:i(e.wrapperClass)},[e.url&&!e.error?(l(),g(P(e.as),B({key:0,class:e.imgClass,alt:e.alt,src:e.url},e.attrs,{onError:e.onError}),null,16,["class","alt","src","onError"])):e.text?(l(),u("span",{key:1,class:i(e.ui.text)},m(e.text),3)):e.icon?(l(),g(p,{key:2,name:e.icon,class:i(e.iconClass)},null,8,["name","class"])):e.placeholder?(l(),u("span",{key:3,class:i(e.ui.placeholder)},m(e.placeholder),3)):y("",!0),e.chipColor?(l(),u("span",{key:4,class:i(e.chipClass)},m(e.chipText),3)):y("",!0),T(e.$slots,"default")],2)}const q=Object.assign(O(N,[["render",R]]),{__name:"UAvatar"});export{q as _,V as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.