/*
 * 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_NAME="oj-tsx-event";const DESCRIPT="JSX component event attributes (e.g. \"onojXxx\" or onYyyChanged) must be defined events for the component.";const SHORT_DESCRIPT="Web component event attributes must be valid";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.register=function(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxEvent":this._onEvent}};Rule.prototype._onEvent=function(ruleCtx,tsxProp){var tagName,evName,evKebab;tagName=tsxProp.parent?.name;if(!this._metaLib.isWCTag(tagName)){return}evName=tsxProp.name;if(this._metaLib.isTagEvent(tagName,evName)||this._tsxUtils.isCommonAttr(evName)||this._tsxUtils.isCommonEventAttr(evName)){return}if(!this._specialCase(tagName,evName)){let issue=new ruleCtx.Issue(`<${tagName}> event '${evName}' is unknown`);ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._specialCase=function(tagName,attrName){if(tagName==="oj-messages"&&attrName==="on-oj-close"){return true}return this._metaLib.isRuleIgnored(tagName,RULE_NAME)};module.exports=Rule;