import{defineComponent as O,createVNode as t,Fragment as L}from"vue";import A from"@ant-design/icons-vue/CloseOutlined";import k from"../_util/classNames.mjs";import E from"../_util/props-util/initDefaultProps.mjs";import{canUseDocElement as j}from"../_util/styleChecker.mjs";import{getTransitionName as v}from"../_util/transition.mjs";import{objectType as l}from"../_util/type.mjs";import a from"../_util/vue-types/index.mjs";import D from"../_util/warning.mjs";import"../button/index.mjs";import{convertLegacyProps as M}from"../button/buttonTypes.mjs";import R from"../config-provider/hooks/useConfigInject.mjs";import{useLocaleReceiver as $}from"../locale/LocaleReceiver.mjs";import z from"../vc-dialog/DialogWrap.mjs";import U from"../vc-util/Dom/addEventListener.mjs";import W from"./style/index.mjs";import T from"../button/button.mjs";let d;const V=e=>{d={x:e.pageX,y:e.pageY},setTimeout(()=>d=null,100)};j()&&U(document.documentElement,"click",V,!0);const X=()=>({prefixCls:String,visible:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},confirmLoading:{type:Boolean,default:void 0},title:a.any,closable:{type:Boolean,default:void 0},closeIcon:a.any,onOk:Function,onCancel:Function,"onUpdate:visible":Function,"onUpdate:open":Function,onChange:Function,afterClose:Function,centered:{type:Boolean,default:void 0},width:[String,Number],footer:a.any,okText:a.any,okType:String,cancelText:a.any,icon:a.any,maskClosable:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},okButtonProps:l(),cancelButtonProps:l(),destroyOnClose:{type:Boolean,default:void 0},wrapClassName:String,maskTransitionName:String,transitionName:String,getContainer:{type:[String,Function,Boolean,Object],default:void 0},zIndex:Number,bodyStyle:l(),maskStyle:l(),mask:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},wrapProps:Object,focusTriggerAfterClose:{type:Boolean,default:void 0},modalRender:Function,mousePosition:l()}),se=O({compatConfig:{MODE:3},name:"AModal",inheritAttrs:!1,props:E(X(),{width:520,confirmLoading:!1,okType:"primary"}),setup(e,{emit:r,slots:i,attrs:f}){const[m]=$("Modal"),{prefixCls:o,rootPrefixCls:p,direction:x,getPopupContainer:P}=R("modal",e),[B,g]=W(o);D(e.visible===void 0);const y=n=>{r("update:visible",!1),r("update:open",!1),r("cancel",n),r("change",!1)},N=n=>{r("ok",n)},b=()=>{const{okText:n=i.okText?.(),okType:s,cancelText:c=i.cancelText?.(),confirmLoading:u}=e;return t(L,null,[t(T,{onClick:y,...e.cancelButtonProps},{default:()=>[c||m.value.cancelText]}),t(T,{...M(s),loading:u,onClick:N,...e.okButtonProps},{default:()=>[n||m.value.okText]})])};return()=>{const{prefixCls:n,visible:s,open:c,wrapClassName:u,centered:S,getContainer:w,closeIcon:F=i.closeIcon?.(),focusTriggerAfterClose:h=!0,...C}=e,I=k(u,{[`${o.value}-centered`]:!!S,[`${o.value}-wrap-rtl`]:x.value==="rtl"});return B(t(z,{...C,...f,rootClassName:g.value,class:k(g.value,f.class),getContainer:w||P?.value,prefixCls:o.value,wrapClassName:I,visible:c??s,onClose:y,focusTriggerAfterClose:h,transitionName:v(p.value,"zoom",e.transitionName),maskTransitionName:v(p.value,"fade",e.maskTransitionName),mousePosition:C.mousePosition??d},{...i,footer:i.footer||b,closeIcon:()=>t("span",{class:`${o.value}-close-x`},[F||t(A,{class:`${o.value}-close-icon`},null)])}))}}});export{se as default,X as modalProps};
