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