/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { BaseAdapter, locateTargetHeuristic } from '../core';
export class FocusIndicatorAdapter extends BaseAdapter {
    constructor(component) {
        super(component);
        this._targetElement = null;
    }
    destroy() {
        this._targetElement = null;
    }
    hasTargetElement() {
        return !!this._targetElement;
    }
    addTargetListener(type, listener) {
        var _a;
        (_a = this._targetElement) === null || _a === void 0 ? void 0 : _a.addEventListener(type, listener);
    }
    removeTargetListener(type, listener) {
        var _a;
        (_a = this._targetElement) === null || _a === void 0 ? void 0 : _a.removeEventListener(type, listener);
    }
    getTargetElement() {
        return this._targetElement;
    }
    setTargetElement(el) {
        this._targetElement = el;
    }
    trySetTarget(value) {
        this._targetElement = locateTargetHeuristic(this._component, value);
    }
    isActive(selector, el) {
        const targetedEl = el !== null && el !== void 0 ? el : this._targetElement;
        return !!(targetedEl === null || targetedEl === void 0 ? void 0 : targetedEl.matches(selector));
    }
}
