/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as t,h as e,H as i}from"./index-9ca46203.js";import{L as a,z as s,y as o,v as l,k as n,w as c,au as r,av as d}from"./index-0489af72.js";import{t as h}from"./i18n-3bac791b.js";import{w as b}from"./validation-7e615a5b.js";import{b as v,c as f,g as u}from"./component-names-61247f2f.js";import"./i18n-fddf0324.js";const p=a=>e(u,{class:"heading-icon",_label:"string"==typeof a.label&&a.label.length>0?"":a.ariaLabel,_icons:a.icon}),_=a=>{switch(a.type){case"error":return e(p,{ariaLabel:h("kol-error"),icon:"codicon codicon-error",label:a.label});case"info":return e(p,{ariaLabel:h("kol-info"),icon:"codicon codicon-info",label:a.label});case"warning":return e(p,{ariaLabel:h("kol-warning"),icon:"codicon codicon-warning",label:a.label});case"success":return e(p,{ariaLabel:h("kol-success"),icon:"codicon codicon-pass",label:a.label});default:return e(p,{ariaLabel:h("kol-message"),icon:"codicon codicon-comment",label:a.label})}},g=class{constructor(e){t(this,e),this.close=()=>{var e;void 0!==(null===(e=this._on)||void 0===e?void 0:e.onClose)&&this._on.onClose(new Event("Close"))},this.on={onClick:this.close},this.validateOnValue=e=>"object"==typeof e&&null!==e&&"function"==typeof e.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 t;if(this.state._alert){try{a.debug(["Navigator should vibrate ...",navigator.vibrate([100,75,100,75,100])])}catch(t){a.debug("Navigator does not support vibration.")}setTimeout((()=>{this.validateAlert(!1)}),1e4)}return e(i,{key:"056ebeba8b0ebc0d76a98e3855a0022e1c689e09",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},e("div",{key:"e2807b51c729dc7814aa46bc40f371d9b785b590",class:"heading"},e(_,{key:"207367acb5c59e0977feb68adefb0a7cdb0f4668",label:this.state._label,type:this.state._type}),e("div",{key:"1d9b3c352e84393eb31fbd056a6aa9ec639d13cd",class:"heading-content"},"string"==typeof this.state._label&&(null===(t=this.state._label)||void 0===t?void 0:t.length)>0&&e(v,{_label:this.state._label,_level:this.state._level}),"msg"===this.state._variant&&e("div",{class:"content"},e("slot",null))),this.state._hasCloser&&e(f,{class:"close",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:h("kol-close"),_on:this.on,_tooltipAlign:"left"})),"card"===this.state._variant&&e("div",{class:"content"},e("slot",null)))}validateAlert(e){s(this,"_alert",e)}validateHasCloser(e){o(this,e)}validateLabel(e){l(this,e)}validateLevel(e){b(this,e)}validateOn(e){this.validateOnValue(e)&&n(this,"_on",{onClose:e.onClose})}validateType(e){c(this,"_type",(e=>"string"==typeof e&&r.includes(e)),new Set(`String {${r.join(", ")}`),e)}validateVariant(e){c(this,"_variant",(e=>"string"==typeof e&&d.includes(e)),new Set(`AlertVariant {${d.join(", ")}`),e)}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{g as kol_alert_wc};