/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-277fc2a7.js"),i18n=require("./i18n-b46c3c64.js"),imageSource=require("./image-source-c6b8c632.js"),label=require("./label-5e56f4a8.js");require("./i18n-737701e2.js"),require("./reuse-50a5792c.js"),require("./prop.validators-9c1f1dbd.js"),require("./index-6912b26b.js"),require("./dev.utils-58fde089.js");const formatNameAsInitial=e=>0===e.length?"":e[0].toUpperCase(),formatLabelAsInitials=e=>{const a=e.split(/\s+/),t=a.at(0),i=a.at(-1);return a.length>=2&&t&&i?`${formatNameAsInitial(t)}${formatNameAsInitial(i)}`:formatNameAsInitial(e)},KolAvatarWc=class{constructor(e){index.registerInstance(this,e),this._src=void 0,this._label=void 0,this.state={_src:"",_label:""}}render(){return index.h(index.Host,{key:"672b71c600e54214bbaf86210fe439af3f187c83",class:"kol-avatar-wc"},index.h("div",{key:"8631bb174ac54c1677149d12979f6837dddd692d","aria-label":i18n.translate("kol-avatar-alt",{placeholders:{name:this.state._label}}),class:"container",role:"img"},this.state._src?index.h("img",{alt:"","aria-hidden":"true",class:"image",src:this.state._src}):index.h("span",{"aria-hidden":"true",class:"initials"},formatLabelAsInitials(this.state._label.trim()))))}validateSrc(e){imageSource.validateImageSource(this,e)}validateLabel(e){label.validateLabel(this,e,{required:!0})}componentWillLoad(){this.validateSrc(this._src),this.validateLabel(this._label)}static get watchers(){return{_src:["validateSrc"],_label:["validateLabel"]}}};exports.kol_avatar_wc=KolAvatarWc;