/*
 * 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-css-bp-float";const DESCRIPTION="Use of CSS 'float' is discouraged  - use the JET float utility classes.  For example - see the "+"<a href='https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=display&demo=floatstart'>start</a> and "+"<a href='https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=display&demo=floatend'>end</a> classes.";const SHORT_DESCRIPTION="Use of CSS 'float' is discouraged  - use the JET float utility classes";const DECLARATION="Declaration";const FLOAT="float";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._CssUtils=regCtx.utils.CssUtils;return{"css-rule":this._onRule,"style":this._onStyle}}_onRule(ruleCtx,rule){var block,decl,issue,i;block=rule.block.children;for(i=0;i<block.length;i++){decl=block[i];if(decl.type===DECLARATION&&decl.property===FLOAT&&!_isCssVar(decl)){issue=new ruleCtx.Issue("CSS 'float' - best practices: use the JET float classes");issue.setPosition(this._CssUtils.getPosition(ruleCtx,decl.loc));issue.setSeverity("minor");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}_onStyle(ruleCtx,attr,value){var prop,issue,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();if(prop===FLOAT){issue=new ruleCtx.Issue("'float' property in 'style' attribute. Best practices: use the JET float classes");issue.setMsgKey(RULENAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}function _isCssVar(decl){var c,v;c=decl.value.children;if(c){v=c[0];return v.name==="var"}return false};module.exports=Rule;