import{defineComponent as X,createVNode as o}from"vue";import{ExclamationCircleFilled as Y,CloseCircleFilled as Z,CheckCircleFilled as _,InfoCircleFilled as ee}from"@antsoo-lib/icons";import b from"../_util/ActionButton.mjs";import x from"../_util/classNames.mjs";import{getTransitionName as g}from"../_util/transition.mjs";import{useLocaleReceiver as oe}from"../locale/LocaleReceiver.mjs";import te from"./Modal.mjs";function t(e){return typeof e=="function"?e():e}const fe=X({name:"ConfirmDialog",inheritAttrs:!1,props:["icon","onCancel","onOk","close","closable","zIndex","afterClose","visible","open","keyboard","centered","getContainer","maskStyle","okButtonProps","cancelButtonProps","okType","prefixCls","okCancel","width","mask","maskClosable","okText","cancelText","autoFocusButton","transitionName","maskTransitionName","type","title","content","direction","rootPrefixCls","bodyStyle","closeIcon","modalRender","focusTriggerAfterClose","wrapClassName","confirmPrefixCls","footer"],setup(e,{attrs:u}){const[T]=oe("Modal");return()=>{const{icon:r,onCancel:$,onOk:N,close:c,okText:P,closable:B=!1,zIndex:F,afterClose:v,keyboard:w,centered:m,getContainer:I,maskStyle:S,okButtonProps:h,cancelButtonProps:A,okCancel:z,width:O=416,mask:R=!0,maskClosable:D=!1,type:d,open:L,title:C,content:M,direction:j,closeIcon:E,modalRender:V,focusTriggerAfterClose:q,rootPrefixCls:a,bodyStyle:G,wrapClassName:H,footer:k}=e;let l=r;if(!r&&r!==null)switch(d){case"info":l=o(ee,null,null);break;case"success":l=o(_,null,null);break;case"error":l=o(Z,null,null);break;default:l=o(Y,null,null)}const J=e.okType||"primary",i=e.prefixCls||"ant-modal",n=`${i}-confirm`,K=u.style||{},p=z??d==="confirm",y=e.autoFocusButton===null?!1:e.autoFocusButton||"ok",s=`${i}-confirm`,Q=x(s,`${s}-${e.type}`,{[`${s}-rtl`]:j==="rtl"},u.class),f=T.value,U=p&&o(b,{actionFn:$,close:c,autofocus:y==="cancel",buttonProps:A,prefixCls:`${a}-btn`},{default:()=>[t(e.cancelText)||f.cancelText]});return o(te,{prefixCls:i,class:Q,wrapClassName:x({[`${s}-centered`]:!!m},H),onCancel:W=>c?.({triggerCancel:!0},W),open:L,title:"",footer:"",transitionName:g(a,"zoom",e.transitionName),maskTransitionName:g(a,"fade",e.maskTransitionName),mask:R,maskClosable:D,maskStyle:S,style:K,bodyStyle:G,width:O,zIndex:F,afterClose:v,keyboard:w,centered:m,getContainer:I,closable:B,closeIcon:E,modalRender:V,focusTriggerAfterClose:q},{default:()=>[o("div",{class:`${n}-body-wrapper`},[o("div",{class:`${n}-body`},[t(l),C===void 0?null:o("span",{class:`${n}-title`},[t(C)]),o("div",{class:`${n}-content`},[t(M)])]),k!==void 0?t(k):o("div",{class:`${n}-btns`},[U,o(b,{type:J,actionFn:N,close:c,autofocus:y==="ok",buttonProps:h,prefixCls:`${a}-btn`},{default:()=>[t(P)||(p?f.okText:f.justOkText)]})])])]})}}});export{fe as default};
