import{$i as e,Ai as t,Li as n,Lt as r,Ni as i,Oi as a,Qi as o,Si as s,Wi as c,Xi as l,Zi as u,_i as d,di as f,fi as p,gi as m,hi as h,ji as g,ki as _,pi as v,ri as y,vi as b,wi as x}from"./CzLxtfx3.js";import{a as S,i as C,n as w,o as T,r as E}from"./Ma7Xng1O.js";import{t as D}from"./CyXInIBg.js";var O={class:`relative`},k=[`title`,`aria-label`,`disabled`,`aria-expanded`],A=[`onClick`],j={class:`whitespace-nowrap`},M=x({__name:`IconMenuSelect`,props:{icon:{},title:{},options:{},modelValue:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(x,{emit:M}){let N=x,P=M,F=c(null),I=c(null),L=c(!1),{floatingStyles:R}=w(F,I,{placement:`bottom-end`,middleware:[S(8),C(),T({padding:8})],whileElementsMounted:E}),{onKeydown:z}=D({isOpen:L,triggerEl:F,menuEl:I,close:()=>{L.value=!1}});function B(e){P(`update:modelValue`,e),L.value=!1}function V(e){let t=e.target;!F.value?.contains(t)&&!I.value?.contains(t)&&(L.value=!1)}return a(()=>document.addEventListener(`click`,V)),_(()=>document.removeEventListener(`click`,V)),(a,c)=>(t(),b(`div`,O,[h(`button`,{ref_key:`reference`,ref:F,type:`button`,class:u([`flex h-9 w-9 items-center justify-center rounded-[0.625rem] border border-base-content/10 bg-base-200/80 text-base-content/70 transition-all duration-200 hover:border-primary/30 hover:bg-primary/15 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-base-content/10 disabled:hover:bg-base-200/80 disabled:hover:text-base-content/70`,{"border-primary/30 bg-primary/15 text-primary":l(L)}]),title:N.title,"aria-label":N.title,disabled:N.disabled,"aria-haspopup":`menu`,"aria-expanded":l(L),onClick:c[0]||=f(e=>L.value=!l(L),[`stop`])},[(t(),m(i(N.icon),{size:18}))],10,k),(t(),m(v,{to:`body`},[s(y,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:n(()=>[l(L)?(t(),b(`div`,{key:0,ref_key:`floating`,ref:I,style:o(l(R)),role:`menu`,class:`z-70 max-h-80 min-w-40 overflow-y-auto rounded-xl border border-base-content/10 bg-base-300/98 p-1.5 shadow-[0_10px_40px_rgb(0_0_0/0.3)] backdrop-blur-[12px]`,onKeydown:c[1]||=(...e)=>l(z)&&l(z)(...e)},[(t(!0),b(p,null,g(x.options,n=>(t(),b(`button`,{key:n.value,type:`button`,role:`menuitem`,class:u([`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-[0.8125rem] text-base-content transition-all duration-150 hover:bg-base-content/8`,{"bg-primary/15 text-primary":n.value===x.modelValue}]),onClick:e=>B(n.value)},[h(`span`,j,e(n.label),1),n.value===x.modelValue?(t(),m(l(r),{key:0,size:16})):d(``,!0)],10,A))),128))],36)):d(``,!0)]),_:1})]))]))}}),N=Object.assign(M,{__name:`IconMenuSelect`});export{N as t};