import e from"../_util/classNames.mjs";import{skipFlattenKey as t}from"../_util/props-util/index.mjs";import n from"../_util/vue-types/index.mjs";import{cloneElement as r}from"../_util/vnode.mjs";import i from"../vc-trigger/index.mjs";import a from"./placements.mjs";import{Fragment as o,computed as s,createVNode as c,defineComponent as l,ref as u,watch as d}from"vue";var f=l({compatConfig:{MODE:3},props:{minOverlayWidthMatchTrigger:{type:Boolean,default:void 0},arrow:{type:Boolean,default:!1},prefixCls:n.string.def(`rc-dropdown`),transitionName:String,overlayClassName:n.string.def(``),openClassName:String,animation:n.any,align:n.object,overlayStyle:{type:Object,default:void 0},placement:n.string.def(`bottomLeft`),overlay:n.any,trigger:n.oneOfType([n.string,n.arrayOf(n.string)]).def(`hover`),alignPoint:{type:Boolean,default:void 0},showAction:n.array,hideAction:n.array,getPopupContainer:Function,visible:{type:Boolean,default:void 0},defaultVisible:{type:Boolean,default:!1},mouseEnterDelay:n.number.def(.15),mouseLeaveDelay:n.number.def(.1)},emits:[`visibleChange`,`overlayClick`],setup(n,{slots:l,emit:f,expose:p}){let m=u(!!n.visible);d(()=>n.visible,e=>{e!==void 0&&(m.value=e)});let h=u();p({triggerRef:h});let g=e=>{n.visible===void 0&&(m.value=!1),f(`overlayClick`,e)},_=e=>{n.visible===void 0&&(m.value=e),f(`visibleChange`,e)},v=()=>{let e=l.overlay?.(),i={prefixCls:`${n.prefixCls}-menu`,onClick:g};return c(o,{key:t},[n.arrow&&c(`div`,{class:`${n.prefixCls}-arrow`},null),r(e,i,!1)])},y=s(()=>{let{minOverlayWidthMatchTrigger:e=!n.alignPoint}=n;return e}),b=()=>{let e=l.default?.();return m.value&&e?r(e[0],{class:n.openClassName||`${n.prefixCls}-open`},!1):e},x=s(()=>!n.hideAction&&n.trigger.includes(`contextmenu`)?[`click`]:n.hideAction);return()=>{let{prefixCls:t,arrow:r,showAction:o,overlayStyle:s,trigger:l,placement:u,align:d,getPopupContainer:f,transitionName:p,animation:g,overlayClassName:S,...C}=n;return c(i,{...C,prefixCls:t,ref:h,popupClassName:e(S,{[`${t}-show-arrow`]:r}),popupStyle:s,builtinPlacements:a,action:l,showAction:o,hideAction:x.value||[],popupPlacement:u,popupAlign:d,popupTransitionName:p,popupAnimation:g,popupVisible:m.value,stretch:y.value?`minWidth`:``,onPopupVisibleChange:_,getPopupContainer:f},{popup:v,default:b})}}});export{f as default};