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