// #region Imports
import { DomServiceLocator } from '../../Dom/Dom';
export function query(root, selector, options) {
    const from = options?.shadow
        ? root.shadowRoot
        : root;
    if (from) {
        const el = DomServiceLocator.current.findDescendant(from, `${selector}`);
        if (options?.strict && !el) {
            const exceptionMessage = 'The descendant element does not exist';
            throw new Error(exceptionMessage);
        }
        if (el) {
            return el;
        }
        const msg = options?.shadow
            ? `### MOSAIK: Could not reslove element. From '${from.nodeName}' and descendant '${selector}'. Resolved in shadow dom.`
            : `### MOSAIK: Could not reslove element. From '${from.nodeName}' and descendant '${selector}'. Resolved in light dom.`;
        console.warn(msg);
        return null;
    }
    return null;
}
//# sourceMappingURL=Query.js.map