'use strict';

var gov_log = require('./gov.log-C5EH15b_.js');
var string_utils = require('./string.utils-BG4pUfEi.js');
var helpers_types = require('./helpers.types-vap8QfRH.js');

const validateWcagProp = (value, propName, component) => {
    if (value === undefined || String(value).length === 0) {
        gov_log.govWarningLog(`[${component}]: The (${propName}) attribute is important for correct accessibility.`);
    }
};
const validateWcagRef = (referenceId, name, component) => {
    if (typeof referenceId === 'undefined' || referenceId === undefined) {
        return true;
    }
    if (String(referenceId).length === 0) {
        gov_log.govWarningLog(`[${component}]: Attribute (${name}) is defined with an empty value.`);
        return false;
    }
    let strings = [];
    const referenceIds = string_utils.splitByWhitespace(referenceId);
    if (Array.isArray(referenceIds)) {
        strings = referenceIds.filter(function (e) {
            return helpers_types.isString(e) ? e.trim().length > 0 : false;
        });
    }
    return !!strings.filter(referenceId => {
        if (gov_log.documentNode().getElementById(referenceId) === null) {
            //govWarningLog(`[${component}][${name}]: Reference to element with id (${referenceId}) does not exist.`)
            return false;
        }
        else {
            return true;
        }
    }).length;
};
const validateAccessibleLabel = (label, labelledBy, component, el = undefined) => {
    if (helpers_types.isString(label) && label.length > 0) {
        return true;
    }
    if (typeof labelledBy === 'string' && labelledBy.length > 0) {
        const labelledByEl = gov_log.documentNode().getElementById(labelledBy);
        if (labelledByEl) {
            return true;
        }
    }
    gov_log.govWarningLog(`[${component}]: The element has no defined aria-label or aria-labelledby attribute.`, el);
    return false;
};

exports.validateAccessibleLabel = validateAccessibleLabel;
exports.validateWcagProp = validateWcagProp;
exports.validateWcagRef = validateWcagRef;
//# sourceMappingURL=wcag-Bvzxnp5D.js.map

//# sourceMappingURL=wcag-Bvzxnp5D.js.map