import * as i0 from '@angular/core';
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

class WindowService {
    constructor() {
        this.bodyClassChanged$ = new BehaviorSubject(this.nativeWindow.document.body.classList);
    }
    get nativeWindow() {
        return window;
    }
    get bodyClass$() {
        return this.bodyClassChanged$.asObservable();
    }
    observeBody() {
        this.observer = new MutationObserver((mutationsList) => {
            if (mutationsList.find(mutationType => mutationType.attributeName === 'class')) {
                this.bodyClassChanged$.next(this.nativeWindow.document.body.classList);
            }
        });
        this.observer.observe(this.nativeWindow.document.body, { attributes: true });
    }
    ngOnDestroy() {
        if (this.observer) {
            this.observer.disconnect();
        }
    }
    static { this.ɵfac = function WindowService_Factory(t) { return new (t || WindowService)(); }; }
    static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: WindowService, factory: WindowService.ɵfac, providedIn: 'root' }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WindowService, [{
        type: Injectable,
        args: [{
                providedIn: 'root'
            }]
    }], null, null); })();

/**
 * Generated bundle index. Do not edit.
 */

export { WindowService };
//# sourceMappingURL=ironsource-fusion-ui-services-window.mjs.map
