| 261 | * offen, ob das Panel noch das alte Symbol zeigt. |
| 262 | */ |
| 263 | const twinState = (page) => |
| 264 | page.evaluate(() => { |
| 265 | const text = (element) => element?.textContent?.replace(/\s+/g, ' ').trim() ?? ''; |
| 266 | const panel = document.querySelector('[data-testid="atlas-twin"]'); |
| 267 | return { |
| 268 | symbol: globalThis.__atlasTwin?.symbol ?? '', |
| 269 | qualifiedName: globalThis.__atlasTwin?.qualifiedName ?? '', |
| 270 | sections: (globalThis.__atlasTwin?.sectionNames ?? []).length, |
| 271 | domStatus: panel?.getAttribute('data-status') ?? '', |
| 272 | domSubject: text(document.querySelector('[data-testid="atlas-twin-subject"]')), |
| 273 | domEmpty: text(document.querySelector('[data-testid="atlas-twin-empty"]')), |
| 274 | path: globalThis.__atlasReader?.document?.path ?? '', |
| 275 | caretLine: globalThis.__atlasReader?.editor?.getPosition?.()?.lineNumber ?? 0, |
| 276 | }; |
| 277 | }); |
| 278 | |
| 279 | /** Steht wirklich kein Subjekt mehr im Twin? Griff und Schirm muessen es sagen. */ |
| 280 | const TWIN_IS_EMPTY = () => |