/*
 * 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 RULENAME="oj-tsx-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"];const CLASS="class";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{TsxJetComponent:this._onOjTag}}_onOjTag(ruleCtx,tsxComp){var clazz,flex;if(!_isFormControl(tsxComp.name)){return}if(this._tsxUtils.isPropertyString(tsxComp,CLASS)){clazz=this._tsxUtils.getPropertyRawValue(tsxComp,CLASS,true);if(flex=_isOjFlex(clazz)){let issue=new ruleCtx.Issue(`Form control <${tsxComp.name}> should not use JET flex class '${flex}'`);this._tsxUtils.setIssuePosition(issue,this._tsxUtils.getProperty(tsxComp,CLASS));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;