import{_ as C,K as p}from"./Heading-DT8fK42U-BBz359Il.js";import{V as v,h as a,W as f,e as L,X as k,i as E,Y as S,F as y}from"./index-DscFWUNz.js";import{c as T}from"./clsx-eK3rPvPS-BT_IL7Fz.js";import{t as s}from"./i18n-CdSCDnmA-Bln0Fy0B.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const O=s("kol-error"),B=s("kol-info"),M=s("kol-warning"),I=s("kol-success"),K=s("kol-message"),n=({ariaLabel:e,icon:o})=>a(y,null,a("span",{class:"visually-hidden"},e),a(E,{class:S,_label:"",_icons:o})),N=({type:e,label:o})=>{switch(e){case"error":return a(n,{ariaLabel:O,icon:"codicon codicon-error",label:o});case"info":return a(n,{ariaLabel:B,icon:"codicon codicon-info",label:o});case"warning":return a(n,{ariaLabel:M,icon:"codicon codicon-warning",label:o});case"success":return a(n,{ariaLabel:I,icon:"codicon codicon-pass",label:o});default:return a(n,{ariaLabel:K,icon:"codicon codicon-comment",label:o})}},R=s("kol-close-alert"),w=()=>{if(typeof navigator>"u"||typeof navigator.vibrate!="function")return;const e=navigator.userActivation;if((e?.isActive||e?.hasBeenActive)&&matchMedia("(any-pointer: coarse)").matches)try{navigator.vibrate([100,75,100,75,100])}catch{}},j=(e,o)=>{const{class:c={},alert:d=!1,hasCloser:u=!1,label:t,level:_=0,type:r="default",variant:i="msg",onAlertTimeout:l,onCloserClick:b}=e,g=C(e,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]);d&&(w(),setTimeout(()=>{l?.()},1e4));const m=v("kol-alert",{hasCloser:!!u,[`type-${r}`]:!0,[`variant-${i}`]:!0}),h=v("kol-alert","heading",{[`h${_}`]:!0}),A=Object.assign({class:T(c,m),role:d?r==="error"?"alert":"status":void 0},g);return a("div",Object.assign({},A,{"data-testid":"alert"}),a("div",{class:"kol-alert__container"},a(N,{label:t,type:r}),a("div",{class:"kol-alert__container-content"},t&&a(p,{class:h,level:_,id:"heading"},t),i==="msg"&&a("span",{class:f,"aria-describedby":t?"heading":void 0},o)),u&&a(L,{class:k,"data-testid":"alert-close-button",_ariaDescription:t?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:R,_on:{onClick:b},_tooltipAlign:"left"})),i==="card"&&a("div",{class:f,"aria-describedby":t?"heading":void 0},o))};export{j as K};
//# sourceMappingURL=Alert-R2nEqfd2-D16I8H-s.js.map
