<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-01b1aee8.js');

const UxIwsECatalogFormHandler = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.scope = undefined;
        this.name = "";
    }
    setFormElements(event) {
        const checkbox = event.target;
        let value = event.detail.value;
        // fix for broken mobile table checkbox
        const checkboxInputs = checkbox.querySelectorAll(".ux-checkbox__input");
        if (checkboxInputs &amp;&amp; checkboxInputs.length &gt; 1) {
            const innerInput = checkbox.querySelector(".ux-checkbox__slot-container .ux-checkbox__input");
            if (innerInput !== null &amp;&amp; innerInput !== undefined) {
                value = innerInput.getAttribute("value");
            }
        }
        this.updateHiddenFormField(event.detail.checked, value);
    }
    componentDidLoad() {
        this.form = document.getElementById(`${this.scope}-form`);
        if (this.form === null)
            return;
        this.submitButton = document.querySelector(`ux-button[type="submit"][form="${this.scope}-form"]`);
        this.submitButton.disabled = true;
        if (this.submitButton !== null) {
            this.submitButton.addEventListener("click", this.handleSubmit.bind(this));
        }
    }
    updateHiddenFormField(checked, value) {
        const existingHiddenField = this.form.querySelector(`input[type="hidden"][value="${value}"]`);
        if (checked) {
            if (existingHiddenField === null) {
                const hiddenField = document.createElement("input");
                hiddenField.type = "hidden";
                hiddenField.name = this.name;
                hiddenField.value = value;
                this.form.appendChild(hiddenField);
            }
        }
        else {
            if (existingHiddenField !== null) {
                this.form.removeChild(existingHiddenField);
            }
        }
        const hiddenInputs = this.form.querySelectorAll('input[type="hidden"]');
        this.submitButton.disabled = hiddenInputs.length === 0;
    }
    handleSubmit(event) {
        event.preventDefault();
        this.form.submit();
    }
    get host() { return index.getElement(this); }
};

exports.ux_iws_e_catalog_form_handler = UxIwsECatalogFormHandler;

//# sourceMappingURL=ux-iws-e-catalog-form-handler.cjs.entry.js.map</pre></body></html>