"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("@antsoo-lib/icons"),R=require("../_util/classNames.js"),B=require("../_util/props-util/index.js"),k=require("../_util/transition.js"),N=require("../_util/type.js"),D=require("../_util/vnode.js"),i=require("../_util/vue-types/index.js"),L=require("../config-provider/hooks/useConfigInject.js"),j=require("./style/index.js"),_={success:l.CheckCircleFilled,info:l.InfoCircleFilled,error:l.CloseCircleFilled,warning:l.ExclamationCircleFilled},z={success:l.CheckCircleOutlined,info:l.InfoCircleOutlined,error:l.CloseCircleOutlined,warning:l.ExclamationCircleOutlined},G=N.tuple("success","info","warning","error"),I=()=>({type:i.default.oneOf(G),closable:{type:Boolean,default:void 0},closeText:i.default.any,message:i.default.any,description:i.default.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:i.default.any,closeIcon:i.default.any,onClose:Function}),J=e.defineComponent({compatConfig:{MODE:3},name:"AAlert",inheritAttrs:!1,props:I(),setup(t,{slots:c,emit:V,attrs:v,expose:b}){const{prefixCls:g,direction:q}=L.default("alert",t),[T,O]=j.default(g),a=e.shallowRef(!1),p=e.shallowRef(!1),$=e.shallowRef(),F=o=>{o.preventDefault();const s=$.value;s.style.height=`${s.offsetHeight}px`,s.style.height=`${s.offsetHeight}px`,a.value=!0,V("close",o)},m=()=>{a.value=!1,p.value=!0,t.afterClose?.()},y=e.computed(()=>{const{type:o}=t;return o!==void 0?o:t.banner?"warning":"info"});b({animationEnd:m});const S=e.shallowRef({});return()=>{const{banner:o,closeIcon:s=c.closeIcon?.()}=t;let{closable:h,showIcon:r}=t;const C=t.closeText??c.closeText?.(),u=t.description??c.description?.(),x=t.message??c.message?.(),d=t.icon??c.icon?.(),w=c.action?.();r=o&&r===void 0?!0:r;const A=(u?z:_)[y.value]||null;C&&(h=!0);const n=g.value,E=R.default(n,{[`${n}-${y.value}`]:!0,[`${n}-closing`]:a.value,[`${n}-with-description`]:!!u,[`${n}-no-icon`]:!r,[`${n}-banner`]:!!o,[`${n}-closable`]:h,[`${n}-rtl`]:q.value==="rtl",[O.value]:!0}),H=h?e.createVNode("button",{type:"button",onClick:F,class:`${n}-close-icon`,tabindex:0},[C?e.createVNode("span",{class:`${n}-close-text`},[C]):s===void 0?e.createVNode(l.CloseOutlined,null,null):s]):null,M=d&&(B.isValidElement(d)?D.cloneElement(d,{class:`${n}-icon`}):e.createVNode("span",{class:`${n}-icon`},[d]))||e.createVNode(A,{class:`${n}-icon`},null),P=k.getTransitionProps(`${n}-motion`,{appear:!1,css:!0,onAfterLeave:m,onBeforeLeave:f=>{f.style.maxHeight=`${f.offsetHeight}px`},onLeave:f=>{f.style.maxHeight="0px"}});return T(p.value?null:e.createVNode(e.Transition,P,{default:()=>[e.withDirectives(e.createVNode("div",{role:"alert",...v,style:[v.style,S.value],class:[v.class,E],"data-show":!a.value,ref:$},[r?M:null,e.createVNode("div",{class:`${n}-content`},[x?e.createVNode("div",{class:`${n}-message`},[x]):null,u?e.createVNode("div",{class:`${n}-description`},[u]):null]),w?e.createVNode("div",{class:`${n}-action`},[w]):null,H]),[[e.vShow,!a.value]])]}))}}}),K=N.withInstall(J);exports.alertProps=I;exports.default=K;
