import U from"./Icon.sNzKdesA.js";import{_ as H}from"./Avatar.AyoIKaT6.js";import O from"./Kbd.a8Ge3uSy.js";import{_ as B}from"./_plugin-vue_export-helper.x3n3nnut.js";import{f as j,i as w,s as z,o,c as i,x as s,t as u,k as l,a as b,F as q,v as A,j as y,w as S,H as v,K as N,X as K,d as L}from"./entry.2xM5grDS.js";import{Y as M}from"./combobox.ekQqWuxB.js";import"./Icon.rhzHF9SY.js";import"./index.aIcZnwHK.js";import"./selectMenu.72ERhOvP.js";import"./dom.NeoUuiI0.js";import"./use-tracked-pointer.sE1Z_KNy.js";import"./focus-management.Eyc_TquK.js";import"./open-closed.qjT4kOuT.js";import"./use-resolve-button-type.xzwqX3sR.js";import"./use-outside-click.1YMc5Wv5.js";import"./hidden.lsv8X6XQ.js";import"./use-controllable.bdAjzUtv.js";import"./disposables.MoseSqH0.js";import"./micro-task.ZxAilEVg.js";const T=j({components:{HComboboxOption:M,UIcon:U,UAvatar:H,UKbd:O},props:{group:{type:Object,required:!0},query:{type:String,default:""},groupAttribute:{type:String,required:!0},commandAttribute:{type:String,required:!0},selectedIcon:{type:String,required:!0},ui:{type:Object,required:!0}},setup(e){const $=w(()=>{const n=e.group[e.groupAttribute];return typeof n=="function"?n(e.query):n});function C(n,{indices:I,value:g}){if(n===g)return"";let t="",d=0;I.forEach(p=>{const r=p[1]+1,k=r-p[0]>=e.query.length;t+=[g.substring(d,p[0]),k&&"<mark>",g.substring(p[0],r),k&&"</mark>"].filter(Boolean).join(""),d=r}),t+=g.substring(d);const h=t.indexOf("<mark>");return h>60&&(t=`...${t.substring(h-60)}`),t}return{label:$,highlight:C}}}),V=["aria-label"],E=["innerHTML"];function F(e,$,C,n,I,g){const t=U,d=H,h=O,p=z("HComboboxOption");return o(),i("div",{class:s(e.ui.group.wrapper),role:"option"},[e.label?(o(),i("h2",{key:0,class:s(e.ui.group.label)},u(e.label),3)):l("",!0),b("div",{class:s(e.ui.group.container),role:"listbox","aria-label":e.group[e.groupAttribute]},[(o(!0),i(q,null,A(e.group.commands,(r,k)=>(o(),y(p,{key:`${e.group.key}-${k}`,value:r,disabled:r.disabled,as:"template"},{default:S(({active:a,selected:c})=>[b("div",{class:s([e.ui.group.command.base,a?e.ui.group.command.active:e.ui.group.command.inactive,r.disabled?"cursor-not-allowed":"cursor-pointer"])},[b("div",{class:s(e.ui.group.command.container)},[v(e.$slots,`${e.group.key}-icon`,{group:e.group,command:r,active:a,selected:c},()=>[r.icon?(o(),y(t,{key:0,name:r.icon,class:s([e.ui.group.command.icon.base,a?e.ui.group.command.icon.active:e.ui.group.command.icon.inactive,r.iconClass]),"aria-hidden":"true"},null,8,["name","class"])):r.avatar?(o(),y(d,N({key:1},{size:e.ui.group.command.avatar.size,...r.avatar},{class:e.ui.group.command.avatar.base,"aria-hidden":"true"}),null,16,["class"])):r.chip?(o(),i("span",{key:2,class:s(e.ui.group.command.chip.base),style:K({background:`#${r.chip}`})},null,6)):l("",!0)]),b("div",{class:s([e.ui.group.command.label,r.disabled&&e.ui.group.command.disabled])},[v(e.$slots,`${e.group.key}-command`,{group:e.group,command:r,active:a,selected:c},()=>{var m,f;return[r.prefix?(o(),i("span",{key:0,class:s(["flex-shrink-0",r.prefixClass||e.ui.group.command.prefix])},u(r.prefix),3)):l("",!0),b("span",{class:s(["truncate",{"flex-none":r.suffix||((m=r.matches)==null?void 0:m.length)}])},u(r[e.commandAttribute]),3),(f=r.matches)!=null&&f.length?(o(),i("span",{key:1,class:s(["truncate",r.suffixClass||e.ui.group.command.suffix]),innerHTML:e.highlight(r[e.commandAttribute],r.matches[0])},null,10,E)):r.suffix?(o(),i("span",{key:2,class:s(["truncate",r.suffixClass||e.ui.group.command.suffix])},u(r.suffix),3)):l("",!0)]})],2)],2),c?(o(),y(t,{key:0,name:e.selectedIcon,class:s(e.ui.group.command.selectedIcon.base),"aria-hidden":"true"},null,8,["name","class"])):a&&(e.group.active||e.$slots[`${e.group.key}-active`])?v(e.$slots,`${e.group.key}-active`,{key:1,group:e.group,command:r,active:a,selected:c},()=>[e.group.active?(o(),i("span",{key:0,class:s(e.ui.group.active)},u(e.group.active),3)):l("",!0)]):v(e.$slots,`${e.group.key}-inactive`,{key:2,group:e.group,command:r,active:a,selected:c},()=>{var m;return[(m=r.shortcuts)!=null&&m.length?(o(),i("span",{key:0,class:s(e.ui.group.command.shortcuts)},[(o(!0),i(q,null,A(r.shortcuts,f=>(o(),y(h,{key:f},{default:S(()=>[L(u(f),1)]),_:2},1024))),128))],2)):!r.disabled&&e.group.inactive?(o(),i("span",{key:1,class:s(e.ui.group.inactive)},u(e.group.inactive),3)):l("",!0)]})],2)]),_:2},1032,["value","disabled"]))),128))],10,V)],2)}const ue=B(T,[["render",F]]);export{ue as default};
