import{bC as R,bZ as j,co as k,cp as q,bI as D,a9 as K,cq as G,cr as b,cs as C,n as I,D as u,p as y,ba as V,q as Z,d as J,r as d,a7 as Q,aE as U,aa as X,G as Y,bc as oo,s as eo,v as H,bj as ro,a as $,aM as no,L as v,M as so,y as to,aB as lo,b7 as io,b6 as ao,b5 as co,b8 as uo}from"./index-BJD7BFLS.js";function go(o,e,l,g){if(!R(o))return o;e=j(e,o);for(var r=-1,t=e.length,x=t-1,i=o;i!=null&&++r<t;){var n=k(e[r]),c=l;if(n==="__proto__"||n==="constructor"||n==="prototype")return o;if(r!=x){var h=i[n];c=void 0,c===void 0&&(c=R(h)?h:q(e[r+1])?[]:{})}D(i,n,c),i=i[n]}return o}function mo(o,e,l){return o==null?o:go(o,e,l)}function ho(o){const{lineHeight:e,borderRadius:l,fontWeightStrong:g,baseColor:r,dividerColor:t,actionColor:x,textColor1:i,textColor2:n,closeColorHover:c,closeColorPressed:h,closeIconColor:m,closeIconColorHover:p,closeIconColorPressed:a,infoColor:s,successColor:z,warningColor:P,errorColor:S,fontSize:T}=o;return Object.assign(Object.assign({},G),{fontSize:T,lineHeight:e,titleFontWeight:g,borderRadius:l,border:`1px solid ${t}`,color:x,titleTextColor:i,iconColor:n,contentTextColor:n,closeBorderRadius:l,closeColorHover:c,closeColorPressed:h,closeIconColor:m,closeIconColorHover:p,closeIconColorPressed:a,borderInfo:`1px solid ${b(r,C(s,{alpha:.25}))}`,colorInfo:b(r,C(s,{alpha:.08})),titleTextColorInfo:i,iconColorInfo:s,contentTextColorInfo:n,closeColorHoverInfo:c,closeColorPressedInfo:h,closeIconColorInfo:m,closeIconColorHoverInfo:p,closeIconColorPressedInfo:a,borderSuccess:`1px solid ${b(r,C(z,{alpha:.25}))}`,colorSuccess:b(r,C(z,{alpha:.08})),titleTextColorSuccess:i,iconColorSuccess:z,contentTextColorSuccess:n,closeColorHoverSuccess:c,closeColorPressedSuccess:h,closeIconColorSuccess:m,closeIconColorHoverSuccess:p,closeIconColorPressedSuccess:a,borderWarning:`1px solid ${b(r,C(P,{alpha:.33}))}`,colorWarning:b(r,C(P,{alpha:.08})),titleTextColorWarning:i,iconColorWarning:P,contentTextColorWarning:n,closeColorHoverWarning:c,closeColorPressedWarning:h,closeIconColorWarning:m,closeIconColorHoverWarning:p,closeIconColorPressedWarning:a,borderError:`1px solid ${b(r,C(S,{alpha:.25}))}`,colorError:b(r,C(S,{alpha:.08})),titleTextColorError:i,iconColorError:S,contentTextColorError:n,closeColorHoverError:c,closeColorPressedError:h,closeIconColorError:m,closeIconColorHoverError:p,closeIconColorPressedError:a})}const fo={common:K,self:ho},vo=I("alert",`
 line-height: var(--n-line-height);
 border-radius: var(--n-border-radius);
 position: relative;
 transition: background-color .3s var(--n-bezier);
 background-color: var(--n-color);
 text-align: start;
 word-break: break-word;
`,[u("border",`
 border-radius: inherit;
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 transition: border-color .3s var(--n-bezier);
 border: var(--n-border);
 pointer-events: none;
 `),y("closable",[I("alert-body",[u("title",`
 padding-right: 24px;
 `)])]),u("icon",{color:"var(--n-icon-color)"}),I("alert-body",{padding:"var(--n-padding)"},[u("title",{color:"var(--n-title-text-color)"}),u("content",{color:"var(--n-content-text-color)"})]),V({originalTransition:"transform .3s var(--n-bezier)",enterToProps:{transform:"scale(1)"},leaveToProps:{transform:"scale(0.9)"}}),u("icon",`
 position: absolute;
 left: 0;
 top: 0;
 align-items: center;
 justify-content: center;
 display: flex;
 width: var(--n-icon-size);
 height: var(--n-icon-size);
 font-size: var(--n-icon-size);
 margin: var(--n-icon-margin);
 `),u("close",`
 transition:
 color .3s var(--n-bezier),
 background-color .3s var(--n-bezier);
 position: absolute;
 right: 0;
 top: 0;
 margin: var(--n-close-margin);
 `),y("show-icon",[I("alert-body",{paddingLeft:"calc(var(--n-icon-margin-left) + var(--n-icon-size) + var(--n-icon-margin-right))"})]),y("right-adjust",[I("alert-body",{paddingRight:"calc(var(--n-close-size) + var(--n-padding) + 2px)"})]),I("alert-body",`
 border-radius: var(--n-border-radius);
 transition: border-color .3s var(--n-bezier);
 `,[u("title",`
 transition: color .3s var(--n-bezier);
 font-size: 16px;
 line-height: 19px;
 font-weight: var(--n-title-font-weight);
 `,[Z("& +",[u("content",{marginTop:"9px"})])]),u("content",{transition:"color .3s var(--n-bezier)",fontSize:"var(--n-font-size)"})]),u("icon",{transition:"color .3s var(--n-bezier)"})]),bo=Object.assign(Object.assign({},H.props),{title:String,showIcon:{type:Boolean,default:!0},type:{type:String,default:"default"},bordered:{type:Boolean,default:!0},closable:Boolean,onClose:Function,onAfterLeave:Function,onAfterHide:Function}),po=J({name:"Alert",inheritAttrs:!1,props:bo,slots:Object,setup(o){const{mergedClsPrefixRef:e,mergedBorderedRef:l,inlineThemeDisabled:g,mergedRtlRef:r}=eo(o),t=H("Alert","-alert",vo,fo,o,e),x=ro("Alert",r,e),i=$(()=>{const{common:{cubicBezierEaseInOut:a},self:s}=t.value,{fontSize:z,borderRadius:P,titleFontWeight:S,lineHeight:T,iconSize:_,iconMargin:E,iconMarginRtl:A,closeIconSize:W,closeBorderRadius:w,closeSize:B,closeMargin:L,closeMarginRtl:O,padding:M}=s,{type:f}=o,{left:F,right:N}=no(E);return{"--n-bezier":a,"--n-color":s[v("color",f)],"--n-close-icon-size":W,"--n-close-border-radius":w,"--n-close-color-hover":s[v("closeColorHover",f)],"--n-close-color-pressed":s[v("closeColorPressed",f)],"--n-close-icon-color":s[v("closeIconColor",f)],"--n-close-icon-color-hover":s[v("closeIconColorHover",f)],"--n-close-icon-color-pressed":s[v("closeIconColorPressed",f)],"--n-icon-color":s[v("iconColor",f)],"--n-border":s[v("border",f)],"--n-title-text-color":s[v("titleTextColor",f)],"--n-content-text-color":s[v("contentTextColor",f)],"--n-line-height":T,"--n-border-radius":P,"--n-font-size":z,"--n-title-font-weight":S,"--n-icon-size":_,"--n-icon-margin":E,"--n-icon-margin-rtl":A,"--n-close-size":B,"--n-close-margin":L,"--n-close-margin-rtl":O,"--n-padding":M,"--n-icon-margin-left":F,"--n-icon-margin-right":N}}),n=g?so("alert",$(()=>o.type[0]),i,o):void 0,c=to(!0),h=()=>{const{onAfterLeave:a,onAfterHide:s}=o;a&&a(),s&&s()};return{rtlEnabled:x,mergedClsPrefix:e,mergedBordered:l,visible:c,handleCloseClick:()=>{var a;Promise.resolve((a=o.onClose)===null||a===void 0?void 0:a.call(o)).then(s=>{s!==!1&&(c.value=!1)})},handleAfterLeave:()=>{h()},mergedTheme:t,cssVars:g?void 0:i,themeClass:n?.themeClass,onRender:n?.onRender}},render(){var o;return(o=this.onRender)===null||o===void 0||o.call(this),d(oo,{onAfterLeave:this.handleAfterLeave},{default:()=>{const{mergedClsPrefix:e,$slots:l}=this,g={class:[`${e}-alert`,this.themeClass,this.closable&&`${e}-alert--closable`,this.showIcon&&`${e}-alert--show-icon`,!this.title&&this.closable&&`${e}-alert--right-adjust`,this.rtlEnabled&&`${e}-alert--rtl`],style:this.cssVars,role:"alert"};return this.visible?d("div",Object.assign({},Q(this.$attrs,g)),this.closable&&d(U,{clsPrefix:e,class:`${e}-alert__close`,onClick:this.handleCloseClick}),this.bordered&&d("div",{class:`${e}-alert__border`}),this.showIcon&&d("div",{class:`${e}-alert__icon`,"aria-hidden":"true"},X(l.icon,()=>[d(lo,{clsPrefix:e},{default:()=>{switch(this.type){case"success":return d(uo,null);case"info":return d(co,null);case"warning":return d(ao,null);case"error":return d(io,null);default:return null}}})])),d("div",{class:[`${e}-alert-body`,this.mergedBordered&&`${e}-alert-body--bordered`]},Y(l.header,r=>{const t=r||this.title;return t?d("div",{class:`${e}-alert-body__title`},t):null}),l.default&&d("div",{class:`${e}-alert-body__content`},l))):null}})}});function Io(o,e){const l=o.slice(),g=[];let r=0;for(let t=0;t<o.length;t++){if(e(o[t],t,l)){g.push(o[t]);continue}if(!Object.hasOwn(o,t)){delete o[r++];continue}o[r++]=o[t]}return o.length=r,g}export{po as N,go as b,Io as r,mo as s};
