const e=require("../_util/classNames.js"),t=require("../vc-notification/index.js"),n=require("./style/index.js"),r=require("./useMessage.js");let i=require("vue"),a=require("@antsoo-lib/icons");var o=3,s,c,l=1,u=``,d=`move-up`,f=!1,p=()=>document.body,m,h=!1;function g(){return l++}function _(e){e.top!==void 0&&(s=e.top,c=null),e.duration!==void 0&&(o=e.duration),e.prefixCls!==void 0&&(u=e.prefixCls),e.getContainer!==void 0&&(p=e.getContainer,c=null),e.transitionName!==void 0&&(d=e.transitionName,c=null,f=!0),e.maxCount!==void 0&&(m=e.maxCount,c=null),e.rtl!==void 0&&(h=e.rtl)}function v(e,r){if(c){r(c);return}t.default.newInstance({appContext:e.appContext,prefixCls:e.prefixCls||u,rootPrefixCls:e.rootPrefixCls,transitionName:d,hasTransitionName:f,style:{top:s},getContainer:p||e.getPopupContainer,maxCount:m,name:`message`,useStyle:n.default},e=>{if(c){r(c);return}c=e,r(e)})}var y={info:a.InfoCircleFilled,success:a.CheckCircleFilled,error:a.CloseCircleFilled,warning:a.ExclamationCircleFilled,loading:a.LoadingOutlined},b=Object.keys(y);function x(t){let n=t.duration===void 0?o:t.duration,r=t.key||g(),a=new Promise(a=>{let o=()=>(typeof t.onClose==`function`&&t.onClose(),a(!0));v(t,a=>{a.notice({key:r,duration:n,style:t.style||{},class:t.class,content:({prefixCls:n})=>{let r=y[t.type],a=r?(0,i.createVNode)(r,null,null):``;return(0,i.createVNode)(`div`,{class:e.default(`${n}-custom-content`,{[`${n}-${t.type}`]:t.type,[`${n}-rtl`]:h===!0})},[typeof t.icon==`function`?t.icon():t.icon||a,(0,i.createVNode)(`span`,null,[typeof t.content==`function`?t.content():t.content])])},onClose:o,onClick:t.onClick})})}),s=()=>{c&&c.removeNotice(r)};return s.then=(e,t)=>a.then(e,t),s.promise=a,s}function S(e){return Object.prototype.toString.call(e)===`[object Object]`&&!!e.content}var C={open:x,config:_,destroy(e){if(c)if(e){let{removeNotice:t}=c;t(e)}else{let{destroy:e}=c;e(),c=null}}};function w(e,t){e[t]=(n,r,i)=>S(n)?e.open({...n,type:t}):(typeof r==`function`&&(i=r,r=void 0),e.open({content:n,duration:r,type:t,onClose:i}))}b.forEach(e=>w(C,e)),C.warn=C.warning,C.useMessage=r.default,exports.attachTypeApi=w,exports.default=C,exports.getKeyThenIncreaseKey=g,exports.typeList=b;