/*
 * 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 RULE_NAME="oj-tsx-prop-inline-definition";const SHORT="Inline defintion of complex objects in component property assignments can cause unnecessary changes to the DOM.";const LONG="When properties are assigned to objects or arrays, the value should not be defined inline with the property "+"assignment but rather should be defined separately.This will prevent unnecessary changes to the live DOM from "+"render to render.";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<template>":this._onTemplate}};Rule.prototype._onTemplate=function(ruleCtx,tsxComp){var props;if(props=tsxComp.properties){props.forEach(prop=>{this._onProp(ruleCtx,prop)})}};Rule.prototype._onProp=function(ruleCtx,tsxProp){if(tsxProp.node.type==="JSXAttribute"&&tsxProp.node.value.type==="JSXExpressionContainer"){let expr;if(expr=tsxProp.node.value.expression){if(expr.type!=="Identifier"&&expr.type!=="MemberExpression"){let compName=tsxProp.parent.name;let propName=tsxProp.name;let issue=new ruleCtx.Issue(`<${compName}> in-line property '${propName}' assignment of complex object`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};module.exports=Rule;