"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../menu/index.js");require("../../spin/index.js");const q=require("./MentionsContext.js"),x=require("../../menu/src/Menu.js"),d=require("../../menu/src/MenuItem.js"),w=require("../../spin/Spin.js");function N(){}const I=e.defineComponent({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(c,{slots:i}){const{activeIndex:f,setActiveIndex:p,selectOption:v,onFocus:m=N,loading:o}=e.inject(q.default,{activeIndex:e.shallowRef(),loading:e.shallowRef(!1)});let u;const M=l=>{clearTimeout(u),u=setTimeout(()=>{m(l)})};return e.onBeforeUnmount(()=>{clearTimeout(u)}),()=>{const{prefixCls:l,options:n}=c,y=n[f.value]||{};return e.createVNode(x.default,{prefixCls:`${l}-menu`,activeKey:y.value,onSelect:({key:t})=>{const a=n.find(({value:s})=>s===t);v(a)},onMousedown:M},{default:()=>[!o.value&&n.map((t,a)=>{const{value:s,disabled:g,label:r=t.value,class:C,style:b}=t;return e.createVNode(d.default,{key:s,disabled:g,onMouseenter:()=>{p(a)},class:C,style:b},{default:()=>[i.option?.(t)??(typeof r=="function"?r(t):r)]})}),!o.value&&n.length===0?e.createVNode(d.default,{key:"notFoundContent",disabled:!0},{default:()=>[i.notFoundContent?.()]}):null,o.value&&e.createVNode(d.default,{key:"loading",disabled:!0},{default:()=>[e.createVNode(w.default,{size:"small"},null)]})]})}}});exports.default=I;
