import{_ as h}from"./tslib.es6-CxX45GIN-BGVaTf34.js";import{h as o,e as p,c as v,F as E}from"./index-B6uGkrgD.js";import{c as y}from"./clsx-COFh-Vc8-D7cYsJM5.js";import{t as a}from"./i18n-DvMeCREp-Du7miH0i.js";import{I as B}from"./component-N8_W7bhu-Q1tppvIJ.js";import{K as L}from"./Heading-D7bFHALO-CWSaVFum.js";const S=v.forBlock("kol-alert"),T=S("icon"),O={error:{label:a("kol-error"),icon:"kolicon-alert-error"},info:{label:a("kol-info"),icon:"kolicon-alert-info"},warning:{label:a("kol-warning"),icon:"kolicon-alert-warning"},success:{label:a("kol-success"),icon:"kolicon-alert-success"},default:{label:a("kol-message"),icon:"kolicon-alert-info"}},I=({type:e="default"})=>{const l=O[e||"default"];return o(E,null,o("span",{class:"visually-hidden"},l.label),o(B,{class:T,label:"",icons:l.icon}))},n=v.forBlock("kol-alert"),N=n("closer"),f=n("content"),F=()=>{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,l)=>{const{class:i={},alert:c=!1,hasCloser:d=!1,label:t,level:u=0,type:_="default",variant:s="msg",onAlertTimeout:r,onCloserClick:m}=e,b=h(e,["class","alert","hasCloser","label","level","type","variant","onAlertTimeout","onCloserClick"]),k=a("kol-close-alert");c&&(F(),setTimeout(()=>{r?.()},1e4));const g=n({hasCloser:!!d,[`type-${_}`]:!0,[`variant-${s}`]:!0}),C=n("heading",{[`h${u}`]:!0}),A=Object.assign({class:y(i,g)},b);return o("div",Object.assign({role:c?"alert":void 0},A,{"data-testid":"alert"}),o("div",{class:"kol-alert__container"},o(I,{label:t,type:_}),o("div",{class:"kol-alert__container-content"},t&&o(L,{class:C,level:u,id:"heading"},t),s==="msg"&&o("span",{class:f,"aria-describedby":t?"heading":void 0},l)),d&&o(p,{class:N+" kol-close-button","data-testid":"alert-close-button",_ariaDescription:t?.trim()||"",_hideLabel:!0,_icons:{left:{icon:"kolicon-cross"}},_label:k,_on:{onClick:m},_tooltipAlign:"left"})),s==="card"&&o("div",{class:f,"aria-describedby":t?"heading":void 0},l))};export{j as K};
//# sourceMappingURL=Alert-Yti79ERR-4xSe09mG.js.map
