var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, customElement, css, state, property, nothing } from '../../../../../external/lit/index.js';
import { UmbLitElement } from '../../../../core/lit-element/index.js';
import { UmbTextStyles } from '../../../../core/style/index.js';
let UmbUserCollectionMenuItemElement = class UmbUserCollectionMenuItemElement extends UmbLitElement {
    constructor() {
        super(...arguments);
        this._isActive = false;
        this._isSelected = false;
        this._isSelectable = false;
    }
    set item(newVal) {
        this._item = newVal;
        if (this._item) {
            this.#initItem();
        }
    }
    get item() {
        return this._item;
    }
    set api(value) {
        this.#api = value;
        if (this.#api) {
            this.observe(this.#api.isSelectable, (value) => (this._isSelectable = value));
            this.observe(this.#api.isSelected, (value) => (this._isSelected = value));
            this.#initItem();
        }
    }
    get api() {
        return this.#api;
    }
    #api;
    #initItem() {
        if (!this.#api)
            return;
        if (!this._item)
            return;
        this.#api.setItem(this._item);
    }
    render() {
        const item = this._item;
        if (!item)
            return nothing;
        return html `
			<uui-menu-item
				label=${item?.name}
				?selectable=${this._isSelectable}
				?selected=${this._isSelected}
				@selected=${() => this.#api?.select()}
				@deselected=${() => this.#api?.deselect()}>
				<umb-user-avatar
					slot="icon"
					.name=${item.name}
					.kind=${item.kind}
					.imgUrls=${item.avatarUrls}></umb-user-avatar>
			</uui-menu-item>
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			umb-user-avatar {
				font-size: 10px;
			}
		`,
    ]; }
};
__decorate([
    property({ type: Object, attribute: false })
], UmbUserCollectionMenuItemElement.prototype, "item", null);
__decorate([
    property({ type: Object, attribute: false })
], UmbUserCollectionMenuItemElement.prototype, "api", null);
__decorate([
    state()
], UmbUserCollectionMenuItemElement.prototype, "_isActive", void 0);
__decorate([
    state()
], UmbUserCollectionMenuItemElement.prototype, "_isSelected", void 0);
__decorate([
    state()
], UmbUserCollectionMenuItemElement.prototype, "_isSelectable", void 0);
UmbUserCollectionMenuItemElement = __decorate([
    customElement('umb-user-collection-menu-item')
], UmbUserCollectionMenuItemElement);
export { UmbUserCollectionMenuItemElement };
export { UmbUserCollectionMenuItemElement as element };
