import { jsx as _jsx } from "@stencil/core/jsx-runtime";
import { Host } from "@stencil/core";
export class Avatar {
    host;
    // MARK: Props
    size = "m";
    shape = "circle";
    name = '';
    initials;
    // MARK: States
    // MARK: Events
    // MARK: Lifecycle
    getInitials() {
        let initials = '';
        if (this.initials) {
            initials = this.initials.toUpperCase().slice(0, 2);
        }
        else if (this.name.trim().length > 0) {
            initials = this.name
                .split(' ')
                .map((part) => part[0])
                .join('')
                .toUpperCase()
                .slice(0, 2);
        }
        return initials;
    }
    // MARK: Render
    render() {
        const { size, shape } = this;
        return (_jsx(Host, { size: size, shape: shape, part: "root", children: _jsx("div", { class: "dds-avatar", part: "avatar", children: this.getInitials() }, 'f2568da0435ef226012b8259fa3042b455a70495') }, '1e5dd2608f5487dd25a523e3ad4b66e4efe2b22b'));
    }
    static get is() { return "dds-avatar"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["../reset.css", "avatar.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["../reset.css", "avatar.css"]
        };
    }
    static get properties() {
        return {
            "size": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "\"s\" | \"m\" | \"l\"",
                    "resolved": "\"l\" | \"m\" | \"s\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "size",
                "defaultValue": "\"m\""
            },
            "shape": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "\"circle\" | \"square\"",
                    "resolved": "\"circle\" | \"square\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "shape",
                "defaultValue": "\"circle\""
            },
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "name",
                "defaultValue": "''"
            },
            "initials": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | undefined",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "initials"
            }
        };
    }
    static get elementRef() { return "host"; }
}
