import { Platform } from '../../Accessability/Platform';
import { ControllerBase } from './Abstracts/ControllerBase';
/**
 * ReactiveController that detects platform properties and sets them as attributes on the HTML root element.
 *
 * @public
 */
export class PlatformController extends ControllerBase {
    // #region Ctor
    constructor(host) {
        super(host);
    }
    // #endregion
    // #region Properties
    /**
     * Called when the host element is connected to the document's DOM.
     *
     * @public
     */
    hostConnected() {
        this.setPlatformAttributes();
    }
    /**
     * Sets the platform attributes on the root element based on the current browser and device.
     *
     * @private
     */
    setPlatformAttributes() {
        const root = document.documentElement;
        const platformAttributes = {
            'is-platform-ie': Platform.Browser.isIE(window),
            'is-platform-edge': Platform.Browser.isEdge(window),
            'is-platform-firefox': Platform.Browser.isFireFox(window),
            'is-platform-chrome': Platform.Browser.isChrome(window),
            'is-platform-opera': Platform.Browser.isOpera(window),
            'is-platform-safari': Platform.Browser.isSafari(window),
            'is-platform-mobile': Platform.isMobile(window),
            'is-platform-desktop': Platform.isDesktop(window),
            'is-platform-pwa': Platform.isWebApp()
        };
        for (const [attribute, value] of Object.entries(platformAttributes)) {
            if (value) {
                root.setAttribute(attribute, '');
            }
        }
    }
}
//# sourceMappingURL=PlatformController.js.map