import{aY as O,d as k,a6 as g,T,aZ as S,z as u,Z as B,a8 as m,af as h,h as a,j as P,ad as N,ag as R,aK as w,a$ as I,Q as C,S as f,R as x,X as y,bs as $,b as F,b4 as K,b1 as U,bt as E,k as V,bu as q,ai as _}from"./index-bb1600c6.js";const j=O("n-popconfirm"),z={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},b=I(z),L=k({name:"NPopconfirmPanel",props:z,setup(e){const{localeRef:t}=g("Popconfirm"),{inlineThemeDisabled:s}=T(),{mergedClsPrefixRef:n,mergedThemeRef:p,props:r}=S(j),d=u(()=>{const{common:{cubicBezierEaseInOut:i},self:{fontSize:c,iconSize:v,iconColor:l}}=p.value;return{"--n-bezier":i,"--n-font-size":c,"--n-icon-size":v,"--n-icon-color":l}}),o=s?B("popconfirm-panel",void 0,d,r):void 0;return Object.assign(Object.assign({},g("Popconfirm")),{mergedClsPrefix:n,cssVars:s?void 0:d,localizedPositiveText:u(()=>e.positiveText||t.value.positiveText),localizedNegativeText:u(()=>e.negativeText||t.value.negativeText),positiveButtonProps:m(r,"positiveButtonProps"),negativeButtonProps:m(r,"negativeButtonProps"),handlePositiveClick(i){e.onPositiveClick(i)},handleNegativeClick(i){e.onNegativeClick(i)},themeClass:o==null?void 0:o.themeClass,onRender:o==null?void 0:o.onRender})},render(){var e;const{mergedClsPrefix:t,showIcon:s,$slots:n}=this,p=h(n.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&a(P,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&a(P,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(e=this.onRender)===null||e===void 0||e.call(this),a("div",{class:[`${t}-popconfirm__panel`,this.themeClass],style:this.cssVars},N(n.default,r=>s||r?a("div",{class:`${t}-popconfirm__body`},s?a("div",{class:`${t}-popconfirm__icon`},h(n.icon,()=>[a(R,{clsPrefix:t},{default:()=>a(w,null)})])):null,r):null),p?a("div",{class:[`${t}-popconfirm__action`]},p):null)}}),M=C("popconfirm",[f("body",`
 font-size: var(--n-font-size);
 display: flex;
 align-items: center;
 flex-wrap: nowrap;
 position: relative;
 `,[f("icon",`
 display: flex;
 font-size: var(--n-icon-size);
 color: var(--n-icon-color);
 transition: color .3s var(--n-bezier);
 margin: 0 8px 0 0;
 `)]),f("action",`
 display: flex;
 justify-content: flex-end;
 `,[x("&:not(:first-child)","margin-top: 8px"),C("button",[x("&:not(:last-child)","margin-right: 8px;")])])]),W=Object.assign(Object.assign(Object.assign({},y.props),q),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),D=k({name:"Popconfirm",props:W,__popover__:!0,setup(e){const{mergedClsPrefixRef:t}=T(),s=y("Popconfirm","-popconfirm",M,$,e,t),n=F(null);function p(o){const{onPositiveClick:i,"onUpdate:show":c}=e;Promise.resolve(i?i(o):!0).then(v=>{var l;v!==!1&&((l=n.value)===null||l===void 0||l.setShow(!1),c&&_(c,!1))})}function r(o){const{onNegativeClick:i,"onUpdate:show":c}=e;Promise.resolve(i?i(o):!0).then(v=>{var l;v!==!1&&((l=n.value)===null||l===void 0||l.setShow(!1),c&&_(c,!1))})}return K(j,{mergedThemeRef:s,mergedClsPrefixRef:t,props:e}),Object.assign(Object.assign({},{setShow(o){var i;(i=n.value)===null||i===void 0||i.setShow(o)},syncPosition(){var o;(o=n.value)===null||o===void 0||o.syncPosition()}}),{mergedTheme:s,popoverInstRef:n,handlePositiveClick:p,handleNegativeClick:r})},render(){const{$slots:e,$props:t,mergedTheme:s}=this;return a(V,E(t,b,{theme:s.peers.Popover,themeOverrides:s.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:e.activator||e.trigger,default:()=>{const n=U(t,b);return a(L,Object.assign(Object.assign({},n),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),e)}})}});export{D as _};
