import{renderHelper as e}from"../_util/util.mjs";import t from"../_util/classNames.mjs";import n from"../vc-notification/index.mjs";import r from"./style/index.mjs";import{getPlacementStyle as i}from"./util.mjs";import a from"./useNotification.mjs";import{globalConfig as o}from"../config-provider/index.mjs";import{createVNode as s}from"vue";import{CheckCircleOutlined as c,CloseCircleOutlined as l,CloseOutlined as u,ExclamationCircleOutlined as d,InfoCircleOutlined as f}from"@antsoo-lib/icons";var p={},m=4.5,h=`24px`,g=`24px`,_=``,v=`topRight`,y=()=>document.body,b=null,x=!1,S;function C(e){let{duration:t,placement:n,bottom:r,top:i,getContainer:a,closeIcon:o,prefixCls:s}=e;s!==void 0&&(_=s),t!==void 0&&(m=t),n!==void 0&&(v=n),r!==void 0&&(g=typeof r==`number`?`${r}px`:r),i!==void 0&&(h=typeof i==`number`?`${i}px`:i),a!==void 0&&(y=a),o!==void 0&&(b=o),e.rtl!==void 0&&(x=e.rtl),e.maxCount!==void 0&&(S=e.maxCount)}function w({prefixCls:a,placement:c=v,getContainer:l=y,top:d,bottom:f,closeIcon:m=b,appContext:C},w){let{getPrefixCls:T}=o(),E=T(`notification`,a||_),D=`${E}-${c}-${x}`,O=p[D];if(O){Promise.resolve(O).then(e=>{w(e)});return}let k=t(`${E}-${c}`,{[`${E}-rtl`]:x===!0});n.newInstance({name:`notification`,prefixCls:a||_,useStyle:r,class:k,style:i(c,d??h,f??g),appContext:C,getContainer:l,closeIcon:({prefixCls:t})=>s(`span`,{class:`${t}-close-x`},[e(m,{},s(u,{class:`${t}-close-icon`},null))]),maxCount:S,hasTransitionName:!0},e=>{p[D]=e,w(e)})}var T={success:c,info:f,error:l,warning:d};function E(t){let{icon:n,type:r,description:i,message:a,btn:o}=t,c=t.duration===void 0?m:t.duration;w(t,l=>{l.notice({content:({prefixCls:t})=>{let c=`${t}-notice`,l=null;if(n)l=()=>s(`span`,{class:`${c}-icon`},[e(n)]);else if(r){let e=T[r];l=()=>s(e,{class:`${c}-icon ${c}-icon-${r}`},null)}return s(`div`,{class:l?`${c}-with-icon`:``},[l&&l(),s(`div`,{class:`${c}-message`},[!i&&l?s(`span`,{class:`${c}-message-single-line-auto-margin`},null):null,e(a)]),s(`div`,{class:`${c}-description`},[e(i)]),o?s(`span`,{class:`${c}-btn`},[e(o)]):null])},duration:c,closable:!0,onClose:t.onClose,onClick:t.onClick,key:t.key,style:t.style||{},class:t.class})})}var D={open:E,close(e){Object.keys(p).forEach(t=>Promise.resolve(p[t]).then(t=>{t.removeNotice(e)}))},config:C,destroy(){Object.keys(p).forEach(e=>{Promise.resolve(p[e]).then(e=>{e.destroy()}),delete p[e]})}};[`success`,`info`,`warning`,`error`].forEach(e=>{D[e]=t=>D.open({...t,type:e})}),D.warn=D.warning,D.useNotification=a;export{D as default};