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, property, state } from '../../../external/lit/index.js';
import { UmbLitElement } from '../../core/lit-element/index.js';
import { UmbChangeEvent } from '../../core/event/index.js';
import { UMB_VALIDATION_EMPTY_LOCALIZATION_KEY, UmbFormControlMixin } from '../../core/validation/index.js';
/**
 * @element umb-property-editor-ui-eye-dropper
 */
let UmbPropertyEditorUIEyeDropperElement = class UmbPropertyEditorUIEyeDropperElement extends UmbFormControlMixin(UmbLitElement) {
    constructor() {
        super(...arguments);
        this.readonly = false;
        this.mandatory = false;
        this.mandatoryMessage = UMB_VALIDATION_EMPTY_LOCALIZATION_KEY;
        this._opacity = false;
        this._showPalette = false;
    }
    set config(config) {
        if (!config)
            return;
        this._opacity = config.getValueByAlias('showAlpha') ?? false;
        this._showPalette = config.getValueByAlias('showPalette') ?? false;
    }
    #onChange(event) {
        this.value = event.target.value;
        this.dispatchEvent(new UmbChangeEvent());
    }
    firstUpdated() {
        this.addFormControlElement(this.shadowRoot.querySelector('umb-input-eye-dropper'));
    }
    render() {
        return html `
			<umb-input-eye-dropper
				.opacity=${this._opacity}
				.showPalette=${this._showPalette}
				.value=${this.value}
				?required=${this.mandatory}
				.requiredMessage=${this.mandatoryMessage}
				?readonly=${this.readonly}
				@change=${this.#onChange}></umb-input-eye-dropper>
		`;
    }
};
__decorate([
    property({ type: Boolean, reflect: true })
], UmbPropertyEditorUIEyeDropperElement.prototype, "readonly", void 0);
__decorate([
    property({ type: Boolean })
], UmbPropertyEditorUIEyeDropperElement.prototype, "mandatory", void 0);
__decorate([
    property({ type: String })
], UmbPropertyEditorUIEyeDropperElement.prototype, "mandatoryMessage", void 0);
__decorate([
    state()
], UmbPropertyEditorUIEyeDropperElement.prototype, "_opacity", void 0);
__decorate([
    state()
], UmbPropertyEditorUIEyeDropperElement.prototype, "_showPalette", void 0);
UmbPropertyEditorUIEyeDropperElement = __decorate([
    customElement('umb-property-editor-ui-eye-dropper')
], UmbPropertyEditorUIEyeDropperElement);
export { UmbPropertyEditorUIEyeDropperElement };
export default UmbPropertyEditorUIEyeDropperElement;
