/*
 * 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-aria-prop";const LONG="Attributes beginning with <i>'aria-'</i> must be valid WAI-ARIA definitions.";const ARIA="aria-";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";function Rule(){};Rule.prototype.getName=function(){return RULE};Rule.prototype.getShortDescription=function(){return LONG};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){this._tsxUtils.extractTsxProperties(ruleCtx,tsxRC,this._onProp.bind(this))};Rule.prototype._onProp=function(ruleCtx,tsxProp){var propName;if(tsxProp===null||tsxProp.parent.isPreact||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(!(propName=tsxProp.name)){return}if(propName.startsWith(ARIA)&&!this._tsxUtils.isAriaAttr(propName)){let issue=new ruleCtx.Issue(`<${tsxProp.parent.name}> attribute '${propName}' is not a valid WAI-ARIA definition`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports=Rule;