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