/*
 * 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 RULE_NAME="oj-css-style-bp-display";const DESCRIPT="For best practices, CSS property 'display:none' should not be used. Use of JET <oj-if> is recommended.";const DECLARATION="Declaration";function getName(){return RULE_NAME};function getShortDescription(){return DESCRIPT};function getDescription(){return DESCRIPT};function register(){return{"css-rule":_onRule}};function _onRule(ruleCtx,rule){var block,decl,i;if(!(rule.prelude&&rule.prelude.children&&rule.prelude.children.length)){return}block=rule.block.children;for(i=0;i<block.length;i++){decl=block[i];if(decl.type===DECLARATION){if(decl.property==="display"&&_propValue(decl)==="none"){if(!_isCssVar(decl)){_emitIssue(ruleCtx,decl)}}}}};function _emitIssue(ruleCtx,o){var issue;issue=new ruleCtx.Issue("CSS 'display:none' - for best practices, use <oj-if>");issue.setPosition(ruleCtx.utils.CssUtils.getPosition(ruleCtx,o.loc));ruleCtx.reporter.addIssue(issue,ruleCtx)};function _propValue(decl){var val,ret;if(decl.value&&decl.value.type==="Value"){val=decl.value;if(val.children&&val.children.length){val=val.children[0];if(val.type==="Identifier"){ret=val.name}}}return ret};function _isCssVar(decl){var c,v;c=decl.value.children;v=c[0];return v.name==="var"};module.exports={getName,getDescription,getShortDescription,register};