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