import e from"../_util/warning.mjs";import t from"../_util/classNames.mjs";import n from"../_util/omit.mjs";import r from"../_util/props-util/initDefaultProps.mjs";import{isValidElement as i}from"../_util/props-util/index.mjs";import a from"../config-provider/hooks/useConfigInject.mjs";import o from"../vc-util/devWarning.mjs";import{cloneElement as s}from"../_util/vnode.mjs";import c from"../_util/placements.mjs";import{useProvideOverride as l}from"../menu/src/OverrideContext.mjs";import u from"../vc-dropdown/index.mjs";import d from"./props.mjs";import f from"./style/index.mjs";import p from"./dropdown-button.mjs";import{computed as m,createVNode as h,defineComponent as g}from"vue";import{RightOutlined as _}from"@antsoo-lib/icons";var v=g({compatConfig:{MODE:3},name:`ADropdown`,inheritAttrs:!1,props:r(d(),{mouseEnterDelay:.15,mouseLeaveDelay:.1,placement:`bottomLeft`,trigger:`hover`}),slots:Object,setup(r,{slots:d,attrs:p,emit:g}){let{prefixCls:v,rootPrefixCls:y,direction:b,getPopupContainer:x}=a(`dropdown`,r),[S,C]=f(v),w=m(()=>{let{placement:e=``,transitionName:t}=r;return t===void 0?e.includes(`top`)?`${y.value}-slide-down`:`${y.value}-slide-up`:t});l({prefixCls:m(()=>`${v.value}-menu`),expandIcon:m(()=>h(`span`,{class:`${v.value}-menu-submenu-arrow`},[h(_,{class:`${v.value}-menu-submenu-arrow-icon`},null)])),mode:m(()=>`vertical`),selectable:m(()=>!1),onClick:()=>{},validator:({mode:t})=>{e(!t||t===`vertical`,`Dropdown`,`mode="${t}" is not supported for Dropdown's Menu.`)}});let T=()=>{let e=r.overlay||d.overlay?.(),t=Array.isArray(e)?e[0]:e;if(!t)return null;let n=t.props||{};o(!n.mode||n.mode===`vertical`,`Dropdown`,`mode="${n.mode}" is not supported for Dropdown's Menu.`);let{selectable:a=!1,expandIcon:c=t.children?.expandIcon?.()}=n,l=c!==void 0&&i(c)?c:h(`span`,{class:`${v.value}-menu-submenu-arrow`},[h(_,{class:`${v.value}-menu-submenu-arrow-icon`},null)]);return i(t)?s(t,{mode:`vertical`,selectable:a,expandIcon:()=>l}):t},E=m(()=>{let e=r.placement;if(!e)return b.value===`rtl`?`bottomRight`:`bottomLeft`;if(e.includes(`Center`)){let t=e.slice(0,e.indexOf(`Center`));return o(!e.includes(`Center`),`Dropdown`,`You are using '${e}' placement in Dropdown, which is deprecated. Try to use '${t}' instead.`),t}return e}),D=m(()=>typeof r.visible==`boolean`?r.visible:r.open),O=e=>{g(`update:visible`,e),g(`visibleChange`,e),g(`update:open`,e),g(`openChange`,e)};return()=>{let{arrow:e,trigger:i,disabled:a,overlayClassName:o}=r,l=d.default?.()[0],f=s(l,Object.assign({class:t(l?.props?.class,{[`${v.value}-rtl`]:b.value===`rtl`},`${v.value}-trigger`)},a?{disabled:a}:{})),m=t(o,C.value,{[`${v.value}-rtl`]:b.value===`rtl`}),g=a?[]:i,_;g&&g.includes(`contextmenu`)&&(_=!0);let y=c({arrowPointAtCenter:typeof e==`object`&&e.pointAtCenter,autoAdjustOverflow:!0}),k=n({...r,...p,visible:D.value,builtinPlacements:y,overlayClassName:m,arrow:!!e,alignPoint:_,prefixCls:v.value,getPopupContainer:x?.value,transitionName:w.value,trigger:g,onVisibleChange:O,placement:E.value},[`overlay`,`onUpdate:visible`]);return S(h(u,k,{default:()=>[f],overlay:T}))}}});v.Button=p;export{v as default};