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 { UmbMediaPickerFolderFilter } from '../../components/input-media/input-media.context.js';
import { UmbChangeEvent } from '../../../../core/event/index.js';
import { html, customElement, property, state } from '../../../../../external/lit/index.js';
import { UmbLitElement } from '../../../../core/lit-element/index.js';
let UmbPropertyEditorUIMediaEntityPickerElement = class UmbPropertyEditorUIMediaEntityPickerElement extends UmbLitElement {
    constructor() {
        super(...arguments);
        /**
         * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
         * @type {boolean}
         * @attr
         * @default false
         */
        this.readonly = false;
        this._min = 0;
        this._max = Infinity;
    }
    set config(config) {
        if (!config)
            return;
        const minMax = config?.getValueByAlias('validationLimit');
        this._min = minMax?.min ?? 0;
        this._max = minMax?.max ?? Infinity;
    }
    #onChange(event) {
        this.value = event.target.value;
        this.dispatchEvent(new UmbChangeEvent());
    }
    render() {
        return html `
			<umb-input-media
				.min=${this._min}
				.max=${this._max}
				.value=${this.value}
				.folderFilter=${UmbMediaPickerFolderFilter.FOLDERS_ONLY}
				?readonly=${this.readonly}
				@change=${this.#onChange}></umb-input-media>
		`;
    }
};
__decorate([
    property({ type: String })
], UmbPropertyEditorUIMediaEntityPickerElement.prototype, "value", void 0);
__decorate([
    property({ type: Boolean, reflect: true })
], UmbPropertyEditorUIMediaEntityPickerElement.prototype, "readonly", void 0);
__decorate([
    state()
], UmbPropertyEditorUIMediaEntityPickerElement.prototype, "_min", void 0);
__decorate([
    state()
], UmbPropertyEditorUIMediaEntityPickerElement.prototype, "_max", void 0);
UmbPropertyEditorUIMediaEntityPickerElement = __decorate([
    customElement('umb-property-editor-ui-media-entity-picker')
], UmbPropertyEditorUIMediaEntityPickerElement);
export { UmbPropertyEditorUIMediaEntityPickerElement };
export default UmbPropertyEditorUIMediaEntityPickerElement;
