| 18225 | |
| 18226 | |
| 18227 | function buildBinaryCondition(head, tail, operator) { |
| 18228 | if (tail.length === 0) { |
| 18229 | return head; |
| 18230 | } |
| 18231 | const typeMap = { |
| 18232 | 'AND': 'AndCondition', |
| 18233 | 'OR': 'OrCondition', |
| 18234 | 'XOR': 'XorCondition' |
| 18235 | }; |
| 18236 | return tail.reduce((left, element) => { |
| 18237 | const [_, __, ___, right] = element; |
| 18238 | return { |
| 18239 | type: typeMap[operator], |
| 18240 | left: left, |
| 18241 | right: right |
| 18242 | }; |
| 18243 | }, head); |
| 18244 | } |
| 18245 | |
| 18246 | // Helper to check if a LabelOr chain is just simple labels (no AND, NOT, wildcard) |
| 18247 | function isSimpleOrChain(expr) { |