/*
 * 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-html-ojtag-deprecated";const SHORT="Deprecated custom components should not be used";const LONG="Deprecated custom components should not be used. Refer to the diagnostic issued for a suggested replacement.";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";const DOT=".";class Rule{getName(){return RULE_NAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{"webcomp":this._onWC}}_onWC(ruleCtx,tag){var status;if(tag==="oj-slot"){return}if(!(status=this._metaLib.isTagDeprecated(tag))){return}let descript=status.description?` ${status.description}`:"";let since=status.since?" (since "+status.since+")":null;let value="";if(descript&&!descript.endsWith(DOT)){descript+=DOT}if(status.value&&status.value.length){value=` Available alternative${status.value.length===1?" is":"s are"}`;value+=`: <${status.value.join(">, ")}>.`}let issue=new ruleCtx.Issue(`<${tag}> is deprecated${since}.${descript}${value}`);if(this._metaLib.isJetTag(tag)||tag===OJ_DYNAMIC||tag===OJ_DYN){if(status.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(status.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}}else{issue.setMsgKey(RULE_NAME+MSG_ID_USER)}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;