// #region Imports
import { DomServiceLocator } from '../../Dom/Dom';
export function queryShadow(root, selector, options) {
    const opts = typeof options === 'boolean'
        ? { strict: options }
        : {
            strict: false,
            ...options
        };
    const from = root.shadowRoot;
    if (from) {
        const el = DomServiceLocator.current.findDescendant(from, selector ?? '');
        if (opts.strict && !el) {
            throw new Error('The descendant element does not exist');
        }
        if (el) {
            return el;
        }
        console.warn(`[QueryShadow] Could not resolve element. From '${from.nodeName}' and descendant '${selector}'. Resolved in shadow DOM.`);
        return null;
    }
    return null;
}
//# sourceMappingURL=QueryShadow.js.map