import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{$ as t}from"./vendor-primevue-7po8Zk9v.js";import{$ as n,A as r,Bt as i,D as a,E as o,Et as s,F as c,Ft as l,L as u,Lt as d,gt as f,ht as p,it as m,k as h,zt as g}from"./vendor-vue-core-D3IvUUeM.js";import{t as _}from"./src-ByuP5s1t.js";var v={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},y={class:`text-sm font-inter`},b={key:1,class:`text-xs`},x={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},S={class:`text-sm font-inter`},C={key:1,class:`text-xs`},w=`cursor-pointer transition-opacity hover:opacity-80`,T=u({__name:`TopbarBadge`,props:{badge:{},displayMode:{default:`full`},reverseOrder:{type:Boolean,default:!1},noPadding:{type:Boolean,default:!1},backgroundColor:{default:`var(--comfy-menu-bg)`}},setup(e){let u=e,T=s(),togglePopover=e=>{T.value?.toggle(e)},E=o(()=>u.badge.variant??`info`),D=o(()=>({backgroundColor:u.backgroundColor})),O=o(()=>{switch(E.value){case`error`:return`bg-danger-100 text-white`;case`warning`:return`bg-gold-600 text-black`;case`info`:default:return`bg-white text-black`}}),k=o(()=>{switch(E.value){case`error`:return`text-danger-100`;case`warning`:return`text-warning-background`;case`info`:default:return`text-text-primary`}}),A=o(()=>k.value),j=o(()=>{if(u.badge.icon)return u.badge.icon;switch(E.value){case`error`:return`pi pi-exclamation-circle`;case`warning`:return`icon-[lucide--triangle-alert]`;case`info`:default:return}}),M=o(()=>{switch(E.value){case`error`:return`bg-danger-100`;case`warning`:return`bg-gold-600`;case`info`:default:return`bg-slate-100`}}),N=o(()=>({root:{class:_(`absolute z-50`)},content:{class:_(`mt-1 rounded-lg`,`bg-base-background`,`text-base-foreground`,`shadow-lg`,`border border-border-default`)}}));return(e,o)=>{let s=m(`tooltip`);return e.displayMode===`icon-only`?(n(),r(`div`,{key:0,class:d([`relative inline-flex h-full shrink-0 items-center justify-center px-2`,w]),style:g(D.value),onClick:togglePopover},[j.value?(n(),r(`i`,{key:0,class:d([`shrink-0 text-base`,j.value,A.value])},null,2)):e.badge.label?(n(),r(`div`,{key:1,class:d([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):(n(),r(`div`,{key:2,class:d([`size-2 shrink-0 rounded-full`,M.value])},null,2)),c(l(t),{ref_key:`popover`,ref:T,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:p(()=>[a(`div`,v,[e.badge.label?(n(),r(`div`,{key:0,class:d([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):h(``,!0),a(`div`,y,i(e.badge.text),1),e.badge.tooltip?(n(),r(`div`,b,i(e.badge.tooltip),1)):h(``,!0)])]),_:1},8,[`pt`])],4)):e.displayMode===`compact`?(n(),r(`div`,{key:1,class:`relative inline-flex h-full`,style:g(D.value)},[a(`div`,{class:d([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`,w]]),onClick:togglePopover},[j.value?(n(),r(`i`,{key:0,class:d([`shrink-0 text-base`,j.value,A.value])},null,2)):h(``,!0),e.badge.label?(n(),r(`div`,{key:1,class:d([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):h(``,!0)],2),c(l(t),{ref_key:`popover`,ref:T,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:p(()=>[a(`div`,x,[e.badge.label?(n(),r(`div`,{key:0,class:d([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):h(``,!0),a(`div`,S,i(e.badge.text),1),e.badge.tooltip?(n(),r(`div`,C,i(e.badge.tooltip),1)):h(``,!0)])]),_:1},8,[`pt`])],4)):f((n(),r(`div`,{key:2,class:d([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`]]),style:g(D.value)},[j.value?(n(),r(`i`,{key:0,class:d([`shrink-0 text-base`,j.value,A.value])},null,2)):h(``,!0),e.badge.label?(n(),r(`div`,{key:1,class:d([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):h(``,!0),a(`div`,{class:d([`font-inter text-sm`,k.value])},i(e.badge.text),3)],6)),[[s,e.badge.tooltip]])}}});export{T as t};
//# sourceMappingURL=TopbarBadge-7alRBk84.js.map