import{_ as p}from"./tslib.es6-CxX45GIN-BGVaTf34.js";import{c as L,h as e,e as E,i as S,t as y,F as T}from"./index-DpEJCboz.js";import{c as B}from"./clsx-COFh-Vc8-D7cYsJM5.js";import{t as s}from"./i18n-DvMeCREp-BgVX-WbF.js";import{K as O}from"./Heading-OHdEuqsD-DAduMFLn.js";const c=y();c("kol-alert","closer");c("kol-alert","content");const M=c("kol-alert","icon"),I=s("kol-error"),K=s("kol-info"),N=s("kol-warning"),R=s("kol-success"),w=s("kol-message"),r=({ariaLabel:a,icon:t})=>e(T,null,e("span",{class:"visually-hidden"},a),e(S,{class:M,_label:"",_icons:t})),F=({type:a,label:t})=>{switch(a){case"error":return e(r,{ariaLabel:I,icon:"kolicon-alert-error",label:t});case"info":return e(r,{ariaLabel:K,icon:"kolicon-alert-info",label:t});case"warning":return e(r,{ariaLabel:N,icon:"kolicon-alert-warning",label:t});case"success":return e(r,{ariaLabel:R,icon:"kolicon-alert-success",label:t});default:return e(r,{ariaLabel:w,icon:"kolicon-alert-info",label:t})}},n=L.forBlock("kol-alert"),$=n("closer"),b=n("content"),G=()=>{if(typeof navigator>"u"||typeof navigator.vibrate!="function")return;const a=navigator.userActivation;if((a?.isActive||a?.hasBeenActive)&&matchMedia("(any-pointer: coarse)").matches)try{navigator.vibrate([100,75,100,75,100])}catch{}},P=(a,t)=>{const{class:u={},alert:d=!1,hasCloser:_=!1,label:o,level:v=0,type:f="default",variant:l="msg",onAlertTimeout:i,onCloserClick:m}=a,g=p(a,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]),k=s("kol-close-alert");d&&(G(),setTimeout(()=>{i?.()},1e4));const h=n({hasCloser:!!_,[`type-${f}`]:!0,[`variant-${l}`]:!0}),A=n("heading",{[`h${v}`]:!0}),C=Object.assign({class:B(u,h)},g);return e("div",Object.assign({role:d?"alert":void 0},C,{"data-testid":"alert"}),e("div",{class:"kol-alert__container"},e(F,{label:o,type:f}),e("div",{class:"kol-alert__container-content"},o&&e(O,{class:A,level:v,id:"heading"},o),l==="msg"&&e("span",{class:b,"aria-describedby":o?"heading":void 0},t)),_&&e(E,{class:$+" kol-close-button","data-testid":"alert-close-button",_ariaDescription:o?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"kolicon-cross"}},_label:k,_on:{onClick:m},_tooltipAlign:"left"})),l==="card"&&e("div",{class:b,"aria-describedby":o?"heading":void 0},t))};export{P as K};
//# sourceMappingURL=Alert-BsbKAp99-C_ZQLftv.js.map
