/*
 * 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-treeview-actionable-content";const DESCRIPTION="<oj-tree-view> does not support actionable/interactive content (i.e. buttons, links, Inputs, etc) "+"inside templated content.";const SHORT_DESCRIPTION=DESCRIPTION;const TAG_START=["oj-input-","oj-select-","oj-color-","oj-radioset-","oj-combobox-","oj-slider-","oj-switch-","oj-text-area-"];const TAGS=["a","button","input","select","textarea"];class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-tree-view>":this._onTreeView}}_onTreeView(ruleCtx){if(ruleCtx.tagNode.children){this._findTemplates(ruleCtx,ruleCtx.tagNode.children)}}_findTemplates(ruleCtx,content){content.forEach(node=>{if(node.type==="tag"&&node.name==="template"){this._onTemplate(ruleCtx,node)}if(node.children){this._findTemplates(ruleCtx,node.children)}})}_onTemplate(ruleCtx,template){var content;if(content=template.children){content.forEach(node=>{if(node.type==="tag"){if(_isActionable(node.name)){this._emitIssue(ruleCtx,node)}}})}}_emitIssue(ruleCtx,node){var issue,pos;issue=new ruleCtx.Issue(`Actionable templated content <${node.name}> is not permitted in <oj-tree-view>`);pos=ruleCtx.utils.DomUtils.getLineCol(ruleCtx.data,node.startIndex);issue.setPosition(pos.row,pos.col,node.startIndex,node.startIndex+node.name.length+1);ruleCtx.reporter.addIssue(issue,ruleCtx)}}function _isActionable(tagName){var i;for(i=0;i<TAG_START.length;i++){if(tagName.startsWith(TAG_START[i])){return true}}for(i=0;i<TAGS.length;i++){if(TAGS.includes(tagName)){return true}}return false}module.exports=Rule;