import{wrapPromiseFn as e}from"../_util/util.mjs";import t from"../_util/classNames.mjs";import n from"../config-provider/hooks/useConfigInject.mjs";import{getMotion as r}from"../vc-trigger/utils/motionUtil.mjs";import i from"../vc-notification/useNotification.mjs";import a from"./style/index.mjs";import{PureContent as o}from"./PurePanel.mjs";import{computed as s,createVNode as c,defineComponent as l,shallowRef as u}from"vue";import{CloseOutlined as d}from"@antsoo-lib/icons";var f=8,p=3,m=l({name:`Holder`,inheritAttrs:!1,props:[`top`,`prefixCls`,`getContainer`,`maxCount`,`duration`,`rtl`,`transitionName`,`onAllRemoved`,`animation`,`staticGetContainer`],setup(e,{expose:o}){let{getPrefixCls:l,getPopupContainer:u}=n(`message`,e),m=s(()=>l(`message`,e.prefixCls)),[,h]=a(m),g=()=>{let t=e.top??f;return{left:`50%`,transform:`translateX(-50%)`,top:typeof t==`number`?`${t}px`:t}},_=()=>t(h.value,e.rtl?`${m.value}-rtl`:``),v=()=>r({prefixCls:m.value,animation:e.animation??`move-up`,transitionName:e.transitionName}),y=c(`span`,{class:`${m.value}-close-x`},[c(d,{class:`${m.value}-close-icon`},null)]),[b,x]=i({getStyles:g,prefixCls:m.value,getClassName:_,motion:v,closable:!1,closeIcon:y,duration:e.duration??p,getContainer:e.staticGetContainer??u.value,maxCount:e.maxCount,onAllRemoved:e.onAllRemoved});return o({...b,prefixCls:m,hashId:h}),x}}),h=0;function g(n){let r=u(null),i=Symbol(`messageHolderKey`),a=e=>{r.value?.close(e)},s=n=>{if(!r.value){let e=()=>{};return e.then=()=>{},e}let{open:i,prefixCls:s,hashId:l}=r.value,u=`${s}-notice`,{content:d,icon:f,type:p,key:m,class:g,onClose:_,...v}=n,y=m;return y??(h+=1,y=`antd-message-${h}`),e(e=>(i({...v,key:y,content:()=>c(o,{prefixCls:s,type:p,icon:typeof f==`function`?f():f},{default:()=>[typeof d==`function`?d():d]}),placement:`top`,class:t(p&&`${u}-${p}`,l,g),onClose:()=>{_?.(),e()}}),()=>{a(y)}))},l={open:s,destroy:e=>{e===void 0?r.value?.destroy():a(e)}};return[`info`,`success`,`warning`,`error`,`loading`].forEach(e=>{l[e]=(t,n,r)=>{let i;i=t&&typeof t==`object`&&`content`in t?t:{content:t};let a,o;typeof n==`function`?o=n:(a=n,o=r);let c={onClose:o,duration:a,...i,type:e};return s(c)}}),[l,()=>c(m,{key:i,...n,ref:r},null)]}function _(e){return g(e)}export{_ as default,g as useInternalMessage};