| 107 | const oldest = (root: HTMLElement, name: RegExp) => entry(root, name).at(-1)! |
| 108 | |
| 109 | const steps = (root: HTMLElement) => |
| 110 | Array.from(root.querySelectorAll(".chain .step")).map((step) => ({ |
| 111 | step, |
| 112 | kind: step.getAttribute("data-step")! + |
| 113 | (step.hasAttribute("data-index") |
| 114 | ? " " + step.getAttribute("data-index") |
| 115 | : ""), |
| 116 | what: text(step.querySelector(".what")), |
| 117 | args: text(step.querySelector(".args")) |
| 118 | })) |
| 119 | |
| 120 | const step = (root: HTMLElement, kind: string, what?: RegExp) => { |
| 121 | const found = steps(root).find((step) => step.kind === kind && (what === undefined || what.test(step.what))) |