import { __decorate } from "tslib";
import { observable } from '@ni/fast-element';
/**
 * Observable class to subscribe to changes in the page's lang attribute
 */
class DocumentElementLang {
    constructor() {
        this.lang = document.documentElement.lang;
        const observer = new MutationObserver(mutations => {
            for (const mutation of mutations) {
                if (mutation.type === 'attributes'
                    && mutation.attributeName === 'lang') {
                    this.lang = mutation.target.lang;
                }
            }
        });
        observer.observe(document.documentElement, {
            attributeFilter: ['lang']
        });
    }
}
__decorate([
    observable
], DocumentElementLang.prototype, "lang", void 0);
export const documentElementLang = new DocumentElementLang();
//# sourceMappingURL=document-element-lang.js.map