/*!
 * KoliBri - The accessible HTML-Standard
 */
import{_ as e}from"./tslib.es6-CxX45GIN.js";import{h as o,F as a}from"./index-C_yiBYg2.js";import{c as n}from"./clsx-eK3rPvPS.js";import{e as i,d as s}from"./component-names-C3fyby67.js";import{t as l}from"./i18n-LBpyQ66X.js";import{a as t,b as c,c as r,d}from"./bem-Dj4gWVFO.js";import{K as u}from"./Heading-1FTzB33X.js";const b=l("kol-error"),f=l("kol-info"),m=l("kol-warning"),v=l("kol-success"),p=l("kol-message"),g=({ariaLabel:e,icon:l})=>o(a,null,o("span",{class:"visually-hidden"},e),o(i,{class:t,_label:"",_icons:l})),y=({type:a,label:e})=>{switch(a){case"error":return o(g,{ariaLabel:b,icon:"codicon codicon-error",label:e});case"info":return o(g,{ariaLabel:f,icon:"codicon codicon-info",label:e});case"warning":return o(g,{ariaLabel:m,icon:"codicon codicon-warning",label:e});case"success":return o(g,{ariaLabel:v,icon:"codicon codicon-pass",label:e});default:return o(g,{ariaLabel:p,icon:"codicon codicon-comment",label:e})}},_=l("kol-close-alert"),h=()=>{if("undefined"==typeof navigator||"function"!=typeof navigator.vibrate)return;const o=navigator.userActivation;if(((null==o?void 0:o.isActive)||(null==o?void 0:o.hasBeenActive))&&matchMedia("(any-pointer: coarse)").matches)try{navigator.vibrate([100,75,100,75,100])}catch(o){}},k=(a,i)=>{const{class:l={},alert:t=!1,hasCloser:b=!1,label:m,level:v=0,type:g="default",variant:p="msg",onAlertTimeout:f,onCloserClick:k}=a,C=e(a,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]);t&&(h(),setTimeout(()=>{null==f||f()},1e4));const j=c("kol-alert",{hasCloser:!!b,[`type-${g}`]:!0,[`variant-${p}`]:!0}),L=c("kol-alert","heading",{[`h${v}`]:!0}),A=Object.assign({class:n(l,j)},C);return o("div",Object.assign({role:t?"alert":void 0},A,{"data-testid":"alert"}),o("div",{class:"kol-alert__container"},o(y,{label:m,type:g}),o("div",{class:"kol-alert__container-content"},m&&o(u,{class:L,level:v,id:"heading"},m),"msg"===p&&o("span",{class:r,"aria-describedby":m?"heading":void 0},i)),b&&o(s,{class:d,"data-testid":"alert-close-button",_ariaDescription:(null==m?void 0:m.trim())||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:_,_on:{onClick:k},_tooltipAlign:"left"})),"card"===p&&o("div",{class:r,"aria-describedby":m?"heading":void 0},i))};export{k as K};