/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as registerInstance,h,H as Host}from"./index-cf24d1fe.js";import{t as translate}from"./i18n-8640d789.js";import{v as validateImageSource}from"./image-source-87526275.js";import{v as validateLabel}from"./label-084ed1e7.js";import"./i18n-7ea9f137.js";import"./reuse-523ba2ac.js";import"./prop.validators-5a58fa40.js";import"./index-5728f164.js";import"./dev.utils-fab45cbc.js";const formatNameAsInitial=a=>0===a.length?"":a[0].toUpperCase(),formatLabelAsInitials=a=>{const t=a.split(/\s+/),e=t.at(0),s=t.at(-1);return t.length>=2&&e&&s?`${formatNameAsInitial(e)}${formatNameAsInitial(s)}`:formatNameAsInitial(a)},KolAvatarWc=class{constructor(a){registerInstance(this,a),this._src=void 0,this._label=void 0,this.state={_src:"",_label:""}}render(){return h(Host,{key:"672b71c600e54214bbaf86210fe439af3f187c83",class:"kol-avatar-wc"},h("div",{key:"8631bb174ac54c1677149d12979f6837dddd692d","aria-label":translate("kol-avatar-alt",{placeholders:{name:this.state._label}}),class:"container",role:"img"},this.state._src?h("img",{alt:"","aria-hidden":"true",class:"image",src:this.state._src}):h("span",{"aria-hidden":"true",class:"initials"},formatLabelAsInitials(this.state._label.trim()))))}validateSrc(a){validateImageSource(this,a)}validateLabel(a){validateLabel(this,a,{required:!0})}componentWillLoad(){this.validateSrc(this._src),this.validateLabel(this._label)}static get watchers(){return{_src:["validateSrc"],_label:["validateLabel"]}}};export{KolAvatarWc as kol_avatar_wc};