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