/*
 * 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-html-wctag-anti-pattern";const DESCRIPTION="Some components, or component features, may be present but are not applicable for "+"use in all design systems and as such may be flagged as anti-patterns in the content "+"of a particular theme. In these cases, the feature should not be used if targeting the "+"design system in question.";const SHORT_DESCRIPTION="The specified component is an anti pattern for code written for the designated theme.";const ANTIPATTERN="antiPattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;this._theme=regCtx.config.theme;return{webcomp:this._onWebComp}}_onWebComp(ruleCtx,tagName){var stats,stat;if((stats=this._metaLib.getTagStatus(tagName,ANTIPATTERN))&&stats.length){stat=stats[0];if(stat.themes&&this._themeMatches(stat.themes)){this._emitIssue(ruleCtx,tagName,stat)}}}_emitIssue(ruleCtx,tagName,stat){var issue,since,descript,themes,multi;since=stat.since?` (since ${stat.since})`:"";descript=stat.description;descript=descript?` ${descript}`:"";descript=descript&&!descript.endsWith(".")?descript+".":descript;themes="'"+stat.themes.join("', '")+"'";if(multi=stat.themes.length>1){let x;if((x=themes.lastIndexOf(","))>=0){themes=themes.substring(0,x)+" and"+themes.substring(x+1)}}themes=`${multi?"s":""} ${themes}`;issue=new ruleCtx.Issue(`<${tagName}> is an anti-pattern in theme${themes}${since}.${descript}`);ruleCtx.reporter.addIssue(issue,ruleCtx)}_themeMatches(themes){return themes.includes(this._theme)}}module.exports=Rule;