| 61 | ]); |
| 62 | |
| 63 | export function parseSelectorChain(expression: string): SelectorChain { |
| 64 | const raw = expression.trim(); |
| 65 | if (!raw) { |
| 66 | throw new AppError('INVALID_ARGS', 'Selector expression cannot be empty'); |
| 67 | } |
| 68 | const segments = splitByFallback(raw); |
| 69 | if (segments.length === 0) { |
| 70 | throw new AppError('INVALID_ARGS', 'Selector expression cannot be empty'); |
| 71 | } |
| 72 | return { |
| 73 | raw, |
| 74 | selectors: segments.map((segment) => parseSelector(segment)), |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | export function tryParseSelectorChain(expression: string): SelectorChain | null { |
| 79 | try { |