import{anyType as e,objectType as t,stringType as n,withInstall as r}from"../_util/type.mjs";import i from"../_util/warning.mjs";import a from"../_util/classNames.mjs";import o from"../_util/omit.mjs";import s from"../_util/props-util/initDefaultProps.mjs";import c from"../locale/en_US.mjs";import{useLocaleReceiver as l}from"../locale/LocaleReceiver.mjs";import u from"../config-provider/hooks/useConfigInject.mjs";import{getTransitionName as d}from"../_util/transition.mjs";import f from"../_util/KeyCode.mjs";import{cloneVNodes as p}from"../_util/vnode.mjs";import m from"../_util/hooks/useMergedState.mjs";import h from"../tooltip/abstractTooltipProps.mjs";import{tooltipDefaultProps as g}from"../tooltip/Tooltip.mjs";import _ from"../popover/index.mjs";import{convertLegacyProps as v}from"../button/buttonTypes.mjs";import y from"../button/index.mjs";import b from"../_util/ActionButton.mjs";import x from"./style/index.mjs";import{computed as S,createVNode as C,defineComponent as w,ref as T,toRef as E}from"vue";import{ExclamationCircleFilled as D}from"@antsoo-lib/icons";var O=()=>({...h(),prefixCls:String,content:e(),title:e(),description:e(),okType:n(`primary`),disabled:{type:Boolean,default:!1},okText:e(),cancelText:e(),icon:e(),okButtonProps:t(),cancelButtonProps:t(),showCancel:{type:Boolean,default:!0},onConfirm:Function,onCancel:Function}),k=r(w({compatConfig:{MODE:3},name:`APopconfirm`,inheritAttrs:!1,props:s(O(),{...g(),trigger:`click`,placement:`top`,mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0,okType:`primary`,disabled:!1}),slots:Object,setup(e,{slots:t,emit:n,expose:r,attrs:s}){let h=T();i(e.visible===void 0,`Popconfirm`,"`visible` will be removed in next major version, please use `open` instead."),r({getPopupDomNode:()=>h.value?.getPopupDomNode?.()});let[g,w]=m(!1,{value:E(e,`open`)}),O=(t,r)=>{e.open===void 0&&w(t),n(`update:open`,t),n(`openChange`,t,r)},k=e=>{O(!1,e)},A=t=>e.onConfirm?.(t),j=t=>{O(!1,t),e.onCancel?.(t)},M=e=>{e.keyCode===f.ESC&&g&&O(!1,e)},N=t=>{let{disabled:n}=e;n||O(t)},{prefixCls:P,getPrefixCls:F}=u(`popconfirm`,e),I=S(()=>F()),L=S(()=>F(`btn`)),[R]=x(P),[z]=l(`Popconfirm`,c.Popconfirm),B=()=>{let{okButtonProps:n,cancelButtonProps:r,title:i=t.title?.(),description:a=t.description?.(),cancelText:o=t.cancel?.(),okText:s=t.okText?.(),okType:c,icon:l=t.icon?.()||C(D,null,null),showCancel:u=!0}=e,{cancelButton:d,okButton:f}=t,p={onClick:j,size:`small`,...r},m={onClick:A,...v(c),size:`small`,...n};return C(`div`,{class:`${P.value}-inner-content`},[C(`div`,{class:`${P.value}-message`},[l&&C(`span`,{class:`${P.value}-message-icon`},[l]),C(`div`,{class:[`${P.value}-message-title`,{[`${P.value}-message-title-only`]:!!a}]},[i])]),a&&C(`div`,{class:`${P.value}-description`},[a]),C(`div`,{class:`${P.value}-buttons`},[u?d?d(p):C(y,p,{default:()=>[o||z.value.cancelText]}):null,f?f(m):C(b,{buttonProps:{size:`small`,...v(c),...n},actionFn:A,close:k,prefixCls:L.value,quitOnNullishReturnValue:!0,emitEvent:!0},{default:()=>[s||z.value.okText]})])])};return()=>{let{placement:n,overlayClassName:r,trigger:i=`click`,...c}=e,l=o(c,[`title`,`content`,`cancelText`,`okText`,`onUpdate:open`,`onConfirm`,`onCancel`,`prefixCls`]),u=a(P.value,r);return R(C(_,{...l,...s,trigger:i,placement:n,onOpenChange:N,open:g.value,overlayClassName:u,transitionName:d(I.value,`zoom-big`,e.transitionName),ref:h,"data-popover-inject":!0},{default:()=>[p(t.default?.()||[],{onKeydown:e=>{M(e)}},!1)],content:B}))}}}));export{k as default,O as popconfirmProps};