/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as t,h as r}from"./index-C_yiBYg2.js";import"./common-Dd0zJQbD.js";import{h as a,v as s}from"./color-BOIEtqEM.js";import{v as o}from"./image-source-BfBEJ0rX.js";import{v as i}from"./label-Dnmzb2S_.js";import{t as e}from"./i18n-LBpyQ66X.js";import"./i18n-CfLoIZ8T.js";const l=t=>0===t.length?"":t[0].toUpperCase(),d=t=>{const r=t.split(/\s+/),a=r[0],o=r[r.length-1];return r.length>=2&&a&&o?`${l(a)}${l(o)}`:l(t)},c=class{constructor(r){t(this,r),this.bgColorStr="#d3d3d3",this.colorStr="#000",this.handleColorChange=t=>{const r=a(t);this.bgColorStr=r.backgroundColor,this.colorStr=r.foregroundColor},this._color="#d3d3d3",this.state={_src:"",_label:"",_color:{backgroundColor:"#d3d3d3",foregroundColor:"#000"}}}render(){return r("div",{key:"04d0b5653648f532391c0b8f611ef3bd7d4e8bbf","aria-label":e("kol-avatar-alt",{placeholders:{name:this.state._label}}),class:"kol-avatar",role:"img",style:{backgroundColor:this.bgColorStr,color:this.colorStr}},this.state._src?r("img",{alt:"","aria-hidden":"true",class:"kol-avatar__image",src:this.state._src}):r("span",{"aria-hidden":"true",class:"kol-avatar__initials"},d(this.state._label.trim())))}validateColor(t){s(this,t,{defaultValue:"#d3d3d3",hooks:{beforePatch:this.handleColorChange}})}validateSrc(t){o(this,t)}validateLabel(t){i(this,t,{required:!0})}componentWillLoad(){this.validateColor(this._color),this.validateSrc(this._src),this.validateLabel(this._label)}static get watchers(){return{_color:["validateColor"],_src:["validateSrc"],_label:["validateLabel"]}}};export{c as kol_avatar_wc};