import{k as J,n as K,_ as H,r as Q,q as Y,P as v,a as Z,cJ as ee,cK as oe,cL as ne,cM as te,aX as le,U as ie,cN as ae,aO as se,g as re,V as ce,i as de,Q as ue,aj as ge,a3 as pe,t as me,ak as fe,b as N}from"./bootstrap-Bqxdt4iG.js";import{a1 as ve,a3 as w,E as $e,p as s,aU as ye}from"../jse/index-index-BUJ_4tQs.js";const B=(e,o,n,i,a)=>({backgroundColor:e,border:`${i.lineWidth}px ${i.lineType} ${o}`,[`${a}-icon`]:{color:n}}),he=e=>{const{componentCls:o,motionDurationSlow:n,marginXS:i,marginSM:a,fontSize:u,fontSizeLG:r,lineHeight:g,borderRadiusLG:$,motionEaseInOutCirc:c,alertIconSizeLG:d,colorText:m,paddingContentVerticalSM:f,alertPaddingHorizontal:y,paddingMD:C,paddingContentHorizontalLG:S}=e;return{[o]:H(H({},Q(e)),{position:"relative",display:"flex",alignItems:"center",padding:`${f}px ${y}px`,wordWrap:"break-word",borderRadius:$,[`&${o}-rtl`]:{direction:"rtl"},[`${o}-content`]:{flex:1,minWidth:0},[`${o}-icon`]:{marginInlineEnd:i,lineHeight:0},"&-description":{display:"none",fontSize:u,lineHeight:g},"&-message":{color:m},[`&${o}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${n} ${c}, opacity ${n} ${c},
        padding-top ${n} ${c}, padding-bottom ${n} ${c},
        margin-bottom ${n} ${c}`},[`&${o}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${o}-with-description`]:{alignItems:"flex-start",paddingInline:S,paddingBlock:C,[`${o}-icon`]:{marginInlineEnd:a,fontSize:d,lineHeight:0},[`${o}-message`]:{display:"block",marginBottom:i,color:m,fontSize:r},[`${o}-description`]:{display:"block"}},[`${o}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},Ce=e=>{const{componentCls:o,colorSuccess:n,colorSuccessBorder:i,colorSuccessBg:a,colorWarning:u,colorWarningBorder:r,colorWarningBg:g,colorError:$,colorErrorBorder:c,colorErrorBg:d,colorInfo:m,colorInfoBorder:f,colorInfoBg:y}=e;return{[o]:{"&-success":B(a,i,n,e,o),"&-info":B(y,f,m,e,o),"&-warning":B(g,r,u,e,o),"&-error":H(H({},B(d,c,$,e,o)),{[`${o}-description > pre`]:{margin:0,padding:0}})}}},Se=e=>{const{componentCls:o,iconCls:n,motionDurationMid:i,marginXS:a,fontSizeIcon:u,colorIcon:r,colorIconHover:g}=e;return{[o]:{"&-action":{marginInlineStart:a},[`${o}-close-icon`]:{marginInlineStart:a,padding:0,overflow:"hidden",fontSize:u,lineHeight:`${u}px`,backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${n}-close`]:{color:r,transition:`color ${i}`,"&:hover":{color:g}}},"&-close-text":{color:r,transition:`color ${i}`,"&:hover":{color:g}}}}},xe=e=>[he(e),Ce(e),Se(e)],Ie=J("Alert",e=>{const{fontSizeHeading3:o}=e,n=K(e,{alertIconSizeLG:o,alertPaddingHorizontal:12});return[xe(n)]}),be={success:se,info:ae,error:ie,warning:le},we={success:te,info:ne,error:oe,warning:ee},Be=me("success","info","warning","error"),He=()=>({type:v.oneOf(Be),closable:{type:Boolean,default:void 0},closeText:v.any,message:v.any,description:v.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:v.any,closeIcon:v.any,onClose:Function}),Te=ve({compatConfig:{MODE:3},name:"AAlert",inheritAttrs:!1,props:He(),setup(e,o){let{slots:n,emit:i,attrs:a,expose:u}=o;const{prefixCls:r,direction:g}=Z("alert",e),[$,c]=Ie(r),d=w(!1),m=w(!1),f=w(),y=l=>{l.preventDefault();const p=f.value;p.style.height=`${p.offsetHeight}px`,p.style.height=`${p.offsetHeight}px`,d.value=!0,i("close",l)},C=()=>{var l;d.value=!1,m.value=!0,(l=e.afterClose)===null||l===void 0||l.call(e)},S=$e(()=>{const{type:l}=e;return l!==void 0?l:e.banner?"warning":"info"});u({animationEnd:C});const R=w({});return()=>{var l,p,T,_,E,z,A,O,L,M;const{banner:D,closeIcon:W=(l=n.closeIcon)===null||l===void 0?void 0:l.call(n)}=e;let{closable:F,showIcon:h}=e;const P=(p=e.closeText)!==null&&p!==void 0?p:(T=n.closeText)===null||T===void 0?void 0:T.call(n),x=(_=e.description)!==null&&_!==void 0?_:(E=n.description)===null||E===void 0?void 0:E.call(n),k=(z=e.message)!==null&&z!==void 0?z:(A=n.message)===null||A===void 0?void 0:A.call(n),I=(O=e.icon)!==null&&O!==void 0?O:(L=n.icon)===null||L===void 0?void 0:L.call(n),G=(M=n.action)===null||M===void 0?void 0:M.call(n);h=D&&h===void 0?!0:h;const V=(x?we:be)[S.value]||null;P&&(F=!0);const t=r.value,j=re(t,{[`${t}-${S.value}`]:!0,[`${t}-closing`]:d.value,[`${t}-with-description`]:!!x,[`${t}-no-icon`]:!h,[`${t}-banner`]:!!D,[`${t}-closable`]:F,[`${t}-rtl`]:g.value==="rtl",[c.value]:!0}),X=F?s("button",{type:"button",onClick:y,class:`${t}-close-icon`,tabindex:0},[P?s("span",{class:`${t}-close-text`},[P]):W===void 0?s(ce,null,null):W]):null,U=I&&(de(I)?ue(I,{class:`${t}-icon`}):s("span",{class:`${t}-icon`},[I]))||s(V,{class:`${t}-icon`},null),q=ge(`${t}-motion`,{appear:!1,css:!0,onAfterLeave:C,onBeforeLeave:b=>{b.style.maxHeight=`${b.offsetHeight}px`},onLeave:b=>{b.style.maxHeight="0px"}});return $(m.value?null:s(pe,q,{default:()=>[ye(s("div",N(N({role:"alert"},a),{},{style:[a.style,R.value],class:[a.class,j],"data-show":!d.value,ref:f}),[h?U:null,s("div",{class:`${t}-content`},[k?s("div",{class:`${t}-message`},[k]):null,x?s("div",{class:`${t}-description`},[x]):null]),G?s("div",{class:`${t}-action`},[G]):null,X]),[[fe,!d.value]])]}))}}}),ze=Y(Te);export{ze as A};
