'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7a477838.js');
const randomIdGenerator_util = require('./randomIdGenerator.util-e7f4b6de.js');
const detectFocusOutside_util = require('./detectFocusOutside.util-03c62976.js');
require('./detectClosest.util-85b3507b.js');

const UtilDetectFocusOutside = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.afOnFocusOutside = index.createEvent(this, "afOnFocusOutside", 7);
        this.afOnFocusInside = index.createEvent(this, "afOnFocusInside", 7);
        this.afDataIdentifier = randomIdGenerator_util.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_util.detectFocusOutside(target, selector)) {
            this.afOnFocusOutside.emit(e);
        }
        else {
            this.afOnFocusInside.emit(e);
        }
    }
    render() {
        return index.h("slot", { key: '97e05fb2f9c26c26d7705d319a3b404021329bc1' });
    }
    get $el() { return index.getElement(this); }
};

exports.digi_util_detect_focus_outside = UtilDetectFocusOutside;
