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 { UMB_MEDIA_COLLECTION_CONTEXT } from '../../media-collection.context-token.js';
import { css, customElement, html, nothing, repeat } from '../../../../../../external/lit/index.js';
import { UmbTextStyles } from '../../../../../core/style/index.js';
import { UmbCollectionViewElementBase } from '../../../../../core/collection/index.js';
let UmbMediaGridCollectionViewElement = class UmbMediaGridCollectionViewElement extends UmbCollectionViewElementBase {
    constructor() {
        super();
        this.consumeContext(UMB_MEDIA_COLLECTION_CONTEXT, (collectionContext) => {
            collectionContext?.setupView(this);
        });
    }
    render() {
        if (this._loading)
            return nothing;
        return html `
			<div id="media-grid">
				${repeat(this._items, (item) => item.unique + item.status, (item) => this.#renderItem(item))}
			</div>
		`;
    }
    #renderItem(item) {
        const href = item.unique ? this._itemHrefs.get(item.unique) : undefined;
        return html ` <umb-entity-collection-item-card
			.item=${item}
			href=${href ?? nothing}
			?selectable=${this._isSelectableItem(item)}
			?select-only=${this._selectOnly}
			?selected=${this._isSelectedItem(item.unique)}
			@selected=${() => this._selectItem(item.unique)}
			@deselected=${() => this._deselectItem(item.unique)}>
			<umb-entity-actions-bundle
				slot="actions"
				.entityType=${item.entityType}
				.unique=${item.unique}></umb-entity-actions-bundle>
		</umb-entity-collection-item-card>`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			:host {
				display: flex;
				flex-direction: column;
			}

			#media-grid {
				display: grid;
				grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
				grid-auto-rows: 200px;
				gap: var(--uui-size-space-5);
			}
		`,
    ]; }
};
UmbMediaGridCollectionViewElement = __decorate([
    customElement('umb-media-grid-collection-view')
], UmbMediaGridCollectionViewElement);
export { UmbMediaGridCollectionViewElement };
export default UmbMediaGridCollectionViewElement;
