'use strict';

const ariaAttributes = [
    'role',
    'aria-activedescendant',
    'aria-atomic',
    'aria-autocomplete',
    'aria-braillelabel',
    'aria-brailleroledescription',
    'aria-busy',
    'aria-checked',
    'aria-colcount',
    'aria-colindex',
    'aria-colindextext',
    'aria-colspan',
    'aria-controls',
    'aria-current',
    'aria-describedby',
    'aria-description',
    'aria-details',
    'aria-disabled',
    'aria-errormessage',
    'aria-expanded',
    'aria-flowto',
    'aria-haspopup',
    'aria-hidden',
    'aria-invalid',
    'aria-keyshortcuts',
    'aria-label',
    'aria-labelledby',
    'aria-level',
    'aria-live',
    'aria-multiline',
    'aria-multiselectable',
    'aria-orientation',
    'aria-owns',
    'aria-placeholder',
    'aria-posinset',
    'aria-pressed',
    'aria-readonly',
    'aria-relevant',
    'aria-required',
    'aria-roledescription',
    'aria-rowcount',
    'aria-rowindex',
    'aria-rowindextext',
    'aria-rowspan',
    'aria-selected',
    'aria-setsize',
    'aria-sort',
    'aria-valuemax',
    'aria-valuemin',
    'aria-valuenow',
    'aria-valuetext',
];

const inheritAttributes = (el, attributes = []) => {
    const attributeObject = {};
    attributes.forEach((attr) => {
        if (el.hasAttribute(attr)) {
            const value = el.getAttribute(attr);
            if (value !== null) {
                attributeObject[attr] = el.getAttribute(attr);
            }
            el.removeAttribute(attr);
        }
    });
    return attributeObject;
};
class AttributeObserver {
    constructor(element, callback) {
        this.element = element;
        this.callback = callback;
    }
    startObserving(attributes) {
        this.mutationObserver = new MutationObserver((mutationsList) => {
            for (const mutation of mutationsList) {
                if (mutation.type === 'attributes' && mutation.attributeName) {
                    const newValue = this.element.getAttribute(mutation.attributeName);
                    if (newValue !== null) {
                        this.callback(mutation.attributeName, newValue);
                    }
                }
            }
        });
        this.mutationObserver.observe(this.element, {
            attributes: true,
            attributeFilter: attributes,
        });
    }
    stopObserving() {
        if (this.mutationObserver) {
            this.mutationObserver.disconnect();
        }
    }
}

exports.AttributeObserver = AttributeObserver;
exports.ariaAttributes = ariaAttributes;
exports.inheritAttributes = inheritAttributes;
//# sourceMappingURL=attribute-CH1-zDDl.js.map

//# sourceMappingURL=attribute-CH1-zDDl.js.map