/*
 * Copyright (c) 2018, 2026, 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 RULENAME="oj-tsx-unsup-theme";const SHORT_DESCRIPTION="Some web component elements and/or their attributes may not be supported in the specified JET theme";const DESCRIPTION=SHORT_DESCRIPTION+". Refer to the JET API documentation for the version being audited. "+"The theme used by the audit can be set by the JAF configuration property 'theme'.";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxWebComponent":this._onWebComp}}_onWebComp(ruleCtx,tsxComp){var issue,tsxProps;if(!this._metaLib.isTagSupportedInTheme(tsxComp.name)){issue=new ruleCtx.Issue(`<${tsxComp.name}> is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}if(tsxProps=tsxComp.properties){tsxProps.forEach(tsxProp=>{this._fnAttrib(ruleCtx,tsxProp)})}}_fnAttrib(ruleCtx,tsxProp){if(!tsxProp.name||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(!this._metaLib.isAttrSupportedInTheme(tsxProp.parent.name,tsxProp.name)){let issue=new ruleCtx.Issue(`<${tsxProp.parent.name}> attribute '${tsxProp.name}' is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setMsgKey(RULENAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;