"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),h=require("@aplus-frontend/antdv/es/config-provider"),y=require("@aplus-frontend/antdv/es/modal/ConfirmDialog"),w=require("@aplus-frontend/antdv/es/modal/locale"),P=require("lodash-unified");require("../../config-provider/index.js");const s=require("./destroyFns.js"),b=require("./util.js"),C=require("../../config-provider/config-provider.js"),v=e=>{const u=document.createDocumentFragment();let n={...P.omit(e,["parentContext","appContext"]),close:c,open:!0,centered:!0},l=null;function d(...r){l&&(o.render(null,u),l=null);const i=r.some(t=>t&&t.triggerCancel);e.onCancel&&i&&e.onCancel(()=>{},...r.slice(1));for(let t=0;t<s.default.length;t++)if(s.default[t]===c){s.default.splice(t,1);break}}function c(...r){n={...n,open:!1,afterClose:()=>{typeof e.afterClose=="function"&&e.afterClose(),d.apply(this,r)}},n.visible&&delete n.visible,f(n)}function f(r){typeof r=="function"?n=r(n):n={...n,...r},l&&o.render(o.cloneVNode(l,{...n}),u)}const x=r=>{const i={...h.globalConfigForApi,...C.globalConfigCached.value},t=i.prefixCls,a=r.prefixCls||`${t}-modal`,m=i.iconPrefixCls,p=w.getConfirmLocale();return o.createVNode(C.ConfigProvider,o.mergeProps(i,{prefixCls:t}),{default:()=>[o.createVNode(y,o.mergeProps(r,{rootPrefixCls:t,prefixCls:a,iconPrefixCls:m,locale:p,cancelText:r.cancelText||p.cancelText}),null)]})};function g(r){const i=b.getModalGlobalAppContext(),t=o.createVNode(x,{...r});return t.appContext=e.appContext||i||t.appContext,o.render(t,u),t}return l=g(n),s.default.push(c),{destroy:c,update:f}};function q(e){return{...e,type:"warning"}}function N(e){return{...e,type:"info"}}function S(e){return{...e,type:"success"}}function T(e){return{...e,type:"error"}}function V(e){return{...e,type:"confirm"}}exports.default=v;exports.withConfirm=V;exports.withError=T;exports.withInfo=N;exports.withSuccess=S;exports.withWarn=q;
