/*
 * 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-form-noflex";const DESCRIPTION="Flex styling, as indicated by the 'oj-flex class', should only be applied in cases where the developer can then "+"indicate any managed child elements using the 'oj-flex-item' class. It cannot be applied to JET components "+"where the developer has no direct access to any child elements, for example, form controls. Doing so may "+"inadvertently interfere with the internal layout of those components.";const SHORT_DESCRIPTION="Flex styling, as indicated by the 'oj-flex' class, should only be applied in cases where the developer can then "+"indicate any managed child elements using the oj-flex-item class.";const FORM_CONTROLS=["oj-checkboxset","oj-radioset","oj-slider","oj-switch","oj-text-area","oj-c-text-area"];class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{ojtag:this._onOjTag}}_onOjTag(ruleCtx,tag){var attrs,clazz,flex;if(!_isFormControl(tag)){return}attrs=ruleCtx.node.attribs;if(attrs){clazz=attrs["class"];if(clazz){flex=_isOjFlex(clazz);if(flex){let issue=new ruleCtx.Issue(`"Form control <${tag}> should not use JET flex class '${flex}'`);let attrPos=ruleCtx.utils.DomUtils.getAttribPosition(ruleCtx.data,ruleCtx.tagNode,"class");issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}function _isOjFlex(clazz){var ar,attr,ret,i;ar=clazz.split(" ");for(i=0;i<ar.length;i++){attr=ar[i].trim();if(attr==="oj-flex"){ret=attr;break}}return ret};function _isFormControl(tag){return tag.startsWith("oj-input-")||tag.startsWith("oj-combobox-")||tag.startsWith("oj-label-")||tag.startsWith("oj-select-")||tag.startsWith("oj-color-")||tag.startsWith("oj-c-input-")||tag.startsWith("oj-c-select-")||FORM_CONTROLS.includes(tag)};module.exports=Rule;