/*
 * Copyright (c) 2018, 2025, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULE="oj-tsx-acc-avatar-aria-role";const SHORT="<oj-avatar> and <oj-c-avatar> must have an 'aria-label' or 'aria-labelledby' attribute if role=\"img\" has been specified";const LONG="For accessibility, <oj-avatar> and <oj-c-avatar> must have an <i>'aria-label'</i> or </i>'aria-labelledby'</i> attribute if <i>role='img'</i> has been specified";const ROLE="role";const ARIA_LABEL="aria-label";const ARIA_LABELLEDBY="aria-labelledby";function getName(){return RULE}function getShortDescription(){return SHORT}function getDescription(){return LONG}function register(){return{"Tsx<oj-avatar>":_onAvatar,"Tsx<oj-c-avatar>":_onAvatar}};function _onAvatar(ruleCtx,tsxComp){var tsxUtils=ruleCtx.utils.tsxUtils;var tsxProp;if(tsxProp=_isRoleImg(tsxComp,tsxUtils)){if(!(tsxUtils.getProperty(tsxComp,ARIA_LABEL)||tsxUtils.getProperty(tsxComp,ARIA_LABELLEDBY))){let issue=new ruleCtx.Issue(`'role' attribute of 'img' specified on <${tsxComp.name}>, but 'aria-label' or 'aria-labelledby' is missing`);tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isRoleImg(tsxComp,tsxUtils){var tsxProp;if((tsxProp=tsxUtils.getProperty(tsxComp,ROLE))||(tsxProp=tsxUtils.isPropertyString(tsxProp))){return tsxProp.node.value.value==="img"?tsxProp:null}};module.exports={getName,getDescription,getShortDescription,register};