/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-5cf289dd.js"),i18n=require("./i18n-86815e80.js"),validation=require("./validation-d73ffd53.js"),componentNames=require("./component-names-b370a3a3.js"),dev_utils=require("./dev.utils-3e595d38.js"),prop_validators=require("./prop.validators-476ef807.js"),hasCloser=require("./has-closer-7819610c.js"),label=require("./label-c3e352c8.js");require("./i18n-bbd0642f.js"),require("./reuse-daa2baf3.js"),require("./index-1285d2d1.js");const alertTypeOptions=["default","info","success","warning","error"],alertVariantOptions=["card","msg"],Icon=e=>index.h(componentNames.KolIconTag,{class:"heading-icon",_label:"string"==typeof e.label&&e.label.length>0?"":e.ariaLabel,_icons:e.icon}),AlertIcon=e=>{switch(e.type){case"error":return index.h(Icon,{ariaLabel:i18n.translate("kol-error"),icon:"codicon codicon-error",label:e.label});case"info":return index.h(Icon,{ariaLabel:i18n.translate("kol-info"),icon:"codicon codicon-info",label:e.label});case"warning":return index.h(Icon,{ariaLabel:i18n.translate("kol-warning"),icon:"codicon codicon-warning",label:e.label});case"success":return index.h(Icon,{ariaLabel:i18n.translate("kol-success"),icon:"codicon codicon-pass",label:e.label});default:return index.h(Icon,{ariaLabel:i18n.translate("kol-message"),icon:"codicon codicon-comment",label:e.label})}},KolAlertWc=class{constructor(e){index.registerInstance(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 e;if(this.state._alert){try{dev_utils.Log.debug(["Navigator should vibrate ...",navigator.vibrate([100,75,100,75,100])])}catch(e){dev_utils.Log.debug("Navigator does not support vibration.")}setTimeout((()=>{this.validateAlert(!1)}),1e4)}return index.h(index.Host,{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},index.h("div",{key:"b190de9f62c33d970daabc1b5638132da33c936e",class:"heading"},index.h(AlertIcon,{key:"e1da8b194a13ec6f9270efc2234caadcee77e827",label:this.state._label,type:this.state._type}),index.h("div",{key:"7ffd000cfbe218c582791e8646ff5caf9bad5b25",class:"heading-content"},"string"==typeof this.state._label&&(null===(e=this.state._label)||void 0===e?void 0:e.length)>0&&index.h(componentNames.KolHeadingWcTag,{key:"f9e7c598243a4868b80b248fdf4dfdeed5d24a2b",_label:this.state._label,_level:this.state._level}),"msg"===this.state._variant&&index.h("div",{key:"b5b70319b6c7747872e9d8072a1fe7565938f7c1",class:"content"},index.h("slot",{key:"b75edf24762d861147d5ee5fa0701b4c5a30eed1"}))),this.state._hasCloser&&index.h(componentNames.KolButtonWcTag,{key:"cd46afacd1afbc415e1184604b3b1ac9af901c97",class:"close",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_label:i18n.translate("kol-close-alert",{placeholders:{label:this.state._label}}),_on:this.on,_tooltipAlign:"left"})),"card"===this.state._variant&&index.h("div",{key:"2a9670974b00907497abd255e02194301df0c0a2",class:"content"},index.h("slot",{key:"9bd3de7e485b9865d5f74dfbce4f421d4b1dc9b5"})))}validateAlert(e){prop_validators.watchBoolean(this,"_alert",e)}validateHasCloser(e){hasCloser.validateHasCloser(this,e)}validateLabel(e){label.validateLabel(this,e)}validateLevel(e){validation.watchHeadingLevel(this,e)}validateOn(e){this.validateOnValue(e)&&prop_validators.setState(this,"_on",{onClose:e.onClose})}validateType(e){prop_validators.watchValidator(this,"_type",(e=>"string"==typeof e&&alertTypeOptions.includes(e)),new Set(`String {${alertTypeOptions.join(", ")}`),e)}validateVariant(e){prop_validators.watchValidator(this,"_variant",(e=>"string"==typeof e&&alertVariantOptions.includes(e)),new Set(`AlertVariant {${alertVariantOptions.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"]}}};exports.kol_alert_wc=KolAlertWc;