import{_ as p}from"./tslib.es6-CxX45GIN-BGVaTf34.js";import{O as v,h as a,P as f,e as C,Q as L,i as k,R as E,F as S}from"./index-DCi8lcS0.js";import{c as y}from"./clsx-eK3rPvPS-B-dksMZM.js";import{t as n}from"./i18n-DaJ9SqJN-E9me0qMQ.js";import{K as T}from"./Heading-3zpCc-Ye-BV_8CJg5.js";const O=n("kol-error"),B=n("kol-info"),M=n("kol-warning"),I=n("kol-success"),K=n("kol-message"),s=({ariaLabel:e,icon:o})=>a(S,null,a("span",{class:"visually-hidden"},e),a(k,{class:E,_label:"",_icons:o})),R=({type:e,label:o})=>{switch(e){case"error":return a(s,{ariaLabel:O,icon:"codicon codicon-error",label:o});case"info":return a(s,{ariaLabel:B,icon:"codicon codicon-info",label:o});case"warning":return a(s,{ariaLabel:M,icon:"codicon codicon-warning",label:o});case"success":return a(s,{ariaLabel:I,icon:"codicon codicon-pass",label:o});default:return a(s,{ariaLabel:K,icon:"codicon codicon-comment",label:o})}},N=n("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{}},D=(e,o)=>{const{class:l={},alert:c=!1,hasCloser:d=!1,label:t,level:u=0,type:_="default",variant:r="msg",onAlertTimeout:i,onCloserClick:m}=e,b=p(e,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]);c&&(w(),setTimeout(()=>{i?.()},1e4));const g=v("kol-alert",{hasCloser:!!d,[`type-${_}`]:!0,[`variant-${r}`]:!0}),h=v("kol-alert","heading",{[`h${u}`]:!0}),A=Object.assign({class:y(l,g)},b);return a("div",Object.assign({role:c?"alert":void 0},A,{"data-testid":"alert"}),a("div",{class:"kol-alert__container"},a(R,{label:t,type:_}),a("div",{class:"kol-alert__container-content"},t&&a(T,{class:h,level:u,id:"heading"},t),r==="msg"&&a("span",{class:f,"aria-describedby":t?"heading":void 0},o)),d&&a(C,{class:L,"data-testid":"alert-close-button",_ariaDescription:t?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:N,_on:{onClick:m},_tooltipAlign:"left"})),r==="card"&&a("div",{class:f,"aria-describedby":t?"heading":void 0},o))};export{D as K};
//# sourceMappingURL=Alert-DPSkdS7s-DJ7woqvI.js.map
