/*
 * 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-popup-sibling";const LONG="Due to an integration issue between Preact and the JET popup components (such as <oj-popup>, <oj-dialog> and <oj-drawer-popup>) "+"where both Preact and the components themselves perform reparenting of the popup DOM, the popup component should be wrapped "+"in its own wrapper element. e.g. replace<br><br>"+"<div><br>"+" &nbsp;&nbsp;<oj-dialog>Hello</oj-dialog><br>"+" &nbsp;&nbsp;<oj-button>Open Popup</oj-button><br>"+"</div><br><br>"+"with:"+"<br><br><div><br>"+"&nbsp;&nbsp;<div><br>"+"&nbsp;&nbsp;&nbsp;&nbsp;<oj-dialog>Hello</oj-dialog><br>"+"&nbsp;&nbsp;</div><br>"+"&nbsp;&nbsp;<oj-button>Open Popup</oj-button><br>"+"</div>";const SHORT="Pop-up components should not have siblings.";class Rule{getName(){return RULENAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(){return{"Tsx<oj-popup>":this._onPopup,"Tsx<oj-dialog>":this._onPopup,"Tsx<oj-drawer-popup>":this._onPopup}}_onPopup(ruleCtx,tsxComp){var parent=tsxComp.parent;if(parent?.children&&parent.children.length>1){let issue=new ruleCtx.Issue(`<${tsxComp.name}> has a sibling in parent <${parent.name}>. Pop-up components should have no siblings.`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;