/*
 * 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="ojc-tsx-button-defslot";const DESCRIPTION="<oj-c-button> does not have a default slot defined for it. (To label a button, the 'label' property should be used.)";const SHORT_DESCRIPTION="There is no default slot for <oj-c-button>.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-c-button>":this._onBtn}}_onBtn(ruleCtx,tsxComp){var nodes,node;if((nodes=this._tsxUtils.getChildren(tsxComp))&&nodes.length){for(node of nodes){if(!this._tsxUtils.getPropertyValue(node,"slot")){this._emitIssue(ruleCtx,1);return}}}if(nodes=tsxComp.node.children){for(node of nodes){if(node.type==="JSXText"&&node.value.trim().length){this._emitIssue(ruleCtx,2);break}}}}_emitIssue(ruleCtx,msgType){let msg=msgType===1?"<oj-c-button> cannot use the default slot.":"<oj-c-button> cannot use the default slot as a label. Use the 'label' attribute.";let issue=new ruleCtx.Issue(msg);if(msgType===2){issue.setMsgKey(RULENAME+"_1")}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;