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