const e=require("../_util/classNames.js"),t=require("../_util/raf.js"),n=require("../_util/props-util/initDefaultProps.js"),r=require("../_util/props-util/index.js"),i=require("../config-provider/hooks/useConfigInject.js"),a=require("../_util/vue-types/index.js"),o=require("../_util/transition.js"),s=require("../_util/vnode.js"),c=require("../_util/firstNotUndefined.js"),l=require("../_util/placements.js"),u=require("../vc-tooltip/index.js"),d=require("./abstractTooltipProps.js"),f=require("./style/index.js"),p=require("./util.js");let m=require("vue");var h=(e,t)=>{let n={},r={...e};return t.forEach(t=>{e&&t in e&&(n[t]=e[t],delete r[t])}),{picked:n,omitted:r}},g=()=>({...d.default(),title:a.default.any}),_=()=>({trigger:`hover`,align:{},placement:`top`,mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),v=(0,m.defineComponent)({compatConfig:{MODE:3},name:`ATooltip`,inheritAttrs:!1,props:n.default(g(),{trigger:`hover`,align:{},placement:`top`,mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),slots:Object,setup(n,{slots:a,emit:d,attrs:g,expose:_}){let{prefixCls:v,getPopupContainer:y,direction:b,rootPrefixCls:x}=i.default(`tooltip`,n),S=(0,m.computed)(()=>n.open??n.visible),C=(0,m.ref)(c.default([n.open,n.visible])),w=(0,m.ref)(),T;(0,m.watch)(S,e=>{t.default.cancel(T),T=t.default(()=>{C.value=!!e})});let E=()=>{let e=n.title??a.title;return!e&&e!==0},D=e=>{let t=E();S.value===void 0&&(C.value=!t&&e),t||(d(`update:visible`,e),d(`visibleChange`,e),d(`update:open`,e),d(`openChange`,e))};_({getPopupDomNode:()=>w.value.getPopupDomNode(),open:C,forcePopupAlign:()=>w.value?.forcePopupAlign()});let O=(0,m.computed)(()=>{let{builtinPlacements:e,autoAdjustOverflow:t,arrow:r,arrowPointAtCenter:i}=n,a=i;return typeof r==`object`&&(a=r.pointAtCenter??i),e||l.default({arrowPointAtCenter:a,autoAdjustOverflow:t})}),k=e=>e||e===``,A=e=>{let t=e.type;if(typeof t==`object`&&e.props&&((t.__ANT_BUTTON===!0||t===`button`)&&k(e.props.disabled)||t.__ANT_SWITCH===!0&&(k(e.props.disabled)||k(e.props.loading))||t.__ANT_RADIO===!0&&k(e.props.disabled))){let{picked:t,omitted:n}=h(r.getStyle(e),[`position`,`left`,`right`,`top`,`bottom`,`float`,`display`,`zIndex`]),i={display:`inline-block`,...t,cursor:`not-allowed`,lineHeight:1,width:e.props&&e.props.block?`100%`:void 0},a=s.cloneElement(e,{style:{...n,pointerEvents:`none`}},!0);return(0,m.createVNode)(`span`,{style:i,class:`${v.value}-disabled-compatible-wrapper`},[a])}return e},j=()=>n.title??a.title?.(),M=(e,t)=>{let n=O.value,r=Object.keys(n).find(e=>n[e].points[0]===t.points?.[0]&&n[e].points[1]===t.points?.[1]);if(r){let n=e.getBoundingClientRect(),i={top:`50%`,left:`50%`};r.includes(`top`)||r.includes(`Bottom`)?i.top=`${n.height-t.offset[1]}px`:(r.includes(`Top`)||r.includes(`bottom`))&&(i.top=`${-t.offset[1]}px`),r.includes(`left`)||r.includes(`Right`)?i.left=`${n.width-t.offset[0]}px`:(r.includes(`right`)||r.includes(`Left`))&&(i.left=`${-t.offset[0]}px`),e.style.transformOrigin=`${i.left} ${i.top}`}},N=(0,m.computed)(()=>p.parseColor(v.value,n.color)),P=(0,m.computed)(()=>g[`data-popover-inject`]),[F,I]=f.default(v,(0,m.computed)(()=>!P.value));return()=>{let{openClassName:t,overlayClassName:i,overlayStyle:c,overlayInnerStyle:l}=n,d=r.filterEmpty(a.default?.())??null;d=d.length===1?d[0]:d;let f=C.value;if(S.value===void 0&&E()&&(f=!1),!d)return null;let p=A(r.isValidElement(d)&&!r.isFragment(d)?d:(0,m.createVNode)(`span`,null,[d])),h=e.default({[t||`${v.value}-open`]:!0,[p.props&&p.props.class]:p.props&&p.props.class}),_=e.default(i,{[`${v.value}-rtl`]:b.value===`rtl`},N.value.className,I.value),T={...N.value.overlayStyle,...l},k=N.value.arrowStyle,P={...g,...n,prefixCls:v.value,arrow:!!n.arrow,getPopupContainer:y?.value,builtinPlacements:O.value,visible:f,ref:w,overlayClassName:_,overlayStyle:{...k,...c},overlayInnerStyle:T,onVisibleChange:D,onPopupAlign:M,transitionName:o.getTransitionName(x.value,`zoom-big-fast`,n.transitionName)};return F((0,m.createVNode)(u.default,P,{default:()=>[C.value?s.cloneElement(p,{class:h}):p],arrowContent:()=>(0,m.createVNode)(`span`,{class:`${v.value}-arrow-content`},null),overlay:j}))}}});exports.default=v,exports.tooltipDefaultProps=_,exports.tooltipProps=g;