import{defineComponent as p,computed as r,createVNode as C}from"vue";import x from"../../_util/props-util/initDefaultProps.mjs";import{useConfigContextInject as v}from"../../config-provider/context.mjs";import{useLocaleReceiver as k}from"../../locale/LocaleReceiver.mjs";import g from"../../locale/en_US.mjs";import T from"../ConfirmDialog.mjs";const y=()=>({config:Object,afterClose:Function,destroyAction:Function,open:Boolean}),h=p({name:"HookModal",inheritAttrs:!1,props:x(y(),{config:{width:520,okType:"primary"}}),setup(o,{expose:c}){const a=r(()=>o.open),e=r(()=>o.config),{direction:i,getPrefixCls:n}=v(),s=n("modal"),f=n(),u=()=>{o?.afterClose(),e.value.afterClose?.()},l=(...d)=>{o.destroyAction(...d)};c({destroy:l});const m=e.value.okCancel??e.value.type==="confirm",[t]=k("Modal",g.Modal);return()=>C(T,{prefixCls:s,rootPrefixCls:f,...e.value,close:l,open:a.value,afterClose:u,okText:e.value.okText||(m?t?.value.okText:t?.value.justOkText),direction:e.value.direction||i.value,cancelText:e.value.cancelText||t?.value.cancelText},null)}});export{h as default};
