/*!
 * KoliBri - The accessible HTML-Standard
 */
const MAX_TIMEOUT_DURATION = 5000;
function waitForThemed(host) {
    return new Promise((resolve, reject) => {
        let timeoutId;
        const observer = new MutationObserver(() => {
            if (host.hasAttribute('data-themed')) {
                if (timeoutId) {
                    clearTimeout(timeoutId);
                }
                observer.disconnect();
                resolve();
            }
        });
        observer.observe(host, {
            attributes: true,
            attributeFilter: ['data-themed'],
        });
        if (host.hasAttribute('data-themed')) {
            observer.disconnect();
            resolve();
            return;
        }
        timeoutId = setTimeout(() => {
            observer.disconnect();
            reject(new Error('Timeout waiting for data-themed attribute'));
        }, MAX_TIMEOUT_DURATION);
    });
}
export { MAX_TIMEOUT_DURATION, waitForThemed };
//# sourceMappingURL=element-themed.js.map
