import { r as registerInstance, c as createEvent, h, g as getElement } from './index-148a7577.js';
import { r as randomIdGenerator } from './randomIdGenerator.util-56406f2e.js';
import { d as detectFocusOutside } from './detectFocusOutside.util-a8676bee.js';
import './detectClosest.util-58a7504f.js';

const UtilDetectFocusOutside = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afOnFocusOutside = createEvent(this, "afOnFocusOutside", 7);
        this.afOnFocusInside = createEvent(this, "afOnFocusInside", 7);
        this.afDataIdentifier = randomIdGenerator('data-digi-util-detect-focus-outside');
    }
    componentWillLoad() {
        this.$el.setAttribute(this.afDataIdentifier, '');
    }
    focusinHandler(e) {
        const target = e.target;
        const selector = `[${this.afDataIdentifier}]`;
        if (detectFocusOutside(target, selector)) {
            this.afOnFocusOutside.emit(e);
        }
        else {
            this.afOnFocusInside.emit(e);
        }
    }
    render() {
        return h("slot", { key: '97e05fb2f9c26c26d7705d319a3b404021329bc1' });
    }
    get $el() { return getElement(this); }
};

export { UtilDetectFocusOutside as digi_util_detect_focus_outside };
