/*
 * 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-nested";const DESCRIPTION="The following JET components cannot be nested: <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const SHORT_DESCRIPTION="Cannot nest <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const COMP_LIST=["oj-list-view","oj-table","oj-stream-list","oj-waterfall-layout","oj-tree-view","oj-data-grid"];const TAG="tag";const BODY="body";const OJ_SELECT_SINGLE="oj-select-single";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{webcomp:this._onWC}}_onWC(ruleCtx,tag){var ar,node,issue,i;if(ruleCtx.ojTag&&COMP_LIST.includes(tag)){ar=ruleCtx.elemStack;for(i=ar.length-2;i>=0;i--){node=ar[i];if(node.type!==TAG){continue}if(node.name===OJ_SELECT_SINGLE||this._metaLib.isInterfaceImplemented(tag,"SelectSingleElement")){break}if(node.name===tag){issue=new ruleCtx.Issue(`Nesting of <${tag}> is not supported`);ruleCtx.reporter.addIssue(issue,ruleCtx);break}else if(node.name===BODY){break}}}}};module.exports=Rule;