/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as e,h as a,H as t}from"./index-cf24d1fe.js";import{t as i}from"./i18n-8640d789.js";import{w as s}from"./validation-2329d751.js";import{b as o,c,g as l}from"./component-names-0a8a1a6c.js";import{L as r}from"./dev.utils-fab45cbc.js";import{b as n,s as d,w as f}from"./prop.validators-5a58fa40.js";import{v as h}from"./has-closer-f40b362c.js";import{v as b}from"./label-084ed1e7.js";import"./i18n-7ea9f137.js";import"./reuse-523ba2ac.js";import"./index-5728f164.js";const v=["default","info","success","warning","error"],u=["card","msg"],p=e=>a(l,{class:"heading-icon",_label:"string"==typeof e.label&&e.label.length>0?"":e.ariaLabel,_icons:e.icon}),m=e=>{switch(e.type){case"error":return a(p,{ariaLabel:i("kol-error"),icon:"codicon codicon-error",label:e.label});case"info":return a(p,{ariaLabel:i("kol-info"),icon:"codicon codicon-info",label:e.label});case"warning":return a(p,{ariaLabel:i("kol-warning"),icon:"codicon codicon-warning",label:e.label});case"success":return a(p,{ariaLabel:i("kol-success"),icon:"codicon codicon-pass",label:e.label});default:return a(p,{ariaLabel:i("kol-message"),icon:"codicon codicon-comment",label:e.label})}},_=class{constructor(a){e(this,a),this.close=()=>{var a;void 0!==(null===(a=this._on)||void 0===a?void 0:a.onClose)&&this._on.onClose(new Event("Close"))},this.on={onClick:this.close},this.validateOnValue=a=>"object"==typeof a&&null!==a&&"function"==typeof a.onClose,this._alert=!1,this._hasCloser=!1,this._label=void 0,this._level=1,this._on=void 0,this._type="default",this._variant="msg",this.state={_level:1}}render(){var e,s;if(this.state._alert){try{r.debug(["Navigator should vibrate ...",navigator.vibrate([100,75,100,75,100])])}catch(e){r.debug("Navigator does not support vibration.")}setTimeout((()=>{this.validateAlert(!1)}),1e4)}return a(t,{key:"ecb2cd45b14f92cc1c337d2b81382a8cc820e869",class:{"kol-alert-wc":!0,alert:!0,[this.state._type]:!0,[this.state._variant]:!0,hasCloser:!!this.state._hasCloser},role:this.state._alert?"alert":void 0},a("div",{key:"b190de9f62c33d970daabc1b5638132da33c936e",class:"heading"},a(m,{key:"e1da8b194a13ec6f9270efc2234caadcee77e827",label:this.state._label,type:this.state._type}),a("div",{key:"7ffd000cfbe218c582791e8646ff5caf9bad5b25",class:"heading-content"},"string"==typeof this.state._label&&(null===(e=this.state._label)||void 0===e?void 0:e.length)>0&&a(o,{key:"f9e7c598243a4868b80b248fdf4dfdeed5d24a2b",_label:this.state._label,_level:this.state._level}),"msg"===this.state._variant&&a("div",{key:"b5b70319b6c7747872e9d8072a1fe7565938f7c1",class:"content"},a("slot",{key:"b75edf24762d861147d5ee5fa0701b4c5a30eed1"}))),this.state._hasCloser&&a(c,{key:"cd46afacd1afbc415e1184604b3b1ac9af901c97",class:"close",_ariaDescription:(null===(s=this.state._label)||void 0===s?void 0:s.trim())||"",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:i("kol-close-alert"),_on:this.on,_tooltipAlign:"left"})),"card"===this.state._variant&&a("div",{key:"2a9670974b00907497abd255e02194301df0c0a2",class:"content"},a("slot",{key:"9bd3de7e485b9865d5f74dfbce4f421d4b1dc9b5"})))}validateAlert(a){n(this,"_alert",a)}validateHasCloser(a){h(this,a)}validateLabel(a){b(this,a)}validateLevel(a){s(this,a)}validateOn(a){this.validateOnValue(a)&&d(this,"_on",{onClose:a.onClose})}validateType(a){f(this,"_type",(a=>"string"==typeof a&&v.includes(a)),new Set(`String {${v.join(", ")}`),a)}validateVariant(a){f(this,"_variant",(a=>"string"==typeof a&&u.includes(a)),new Set(`AlertVariant {${u.join(", ")}`),a)}componentWillLoad(){this.validateAlert(this._alert),this.validateHasCloser(this._hasCloser),this.validateLabel(this._label),this.validateLevel(this._level),this.validateOn(this._on),this.validateType(this._type),this.validateVariant(this._variant)}static get watchers(){return{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}}};export{_ as kol_alert_wc};