Converts a GroupResolver chain (subGroup nested N levels deep) into a tree — pure, doesn't touch jsPDF
walks depth-first in the actual render order, so 'continuous' rowNumber/runningTotal
accumulate through state across leaf segments in the right order (per-group reset at the start of a segment, same as before)
Converts a GroupResolver chain (subGroup nested N levels deep) into a tree — pure, doesn't touch jsPDF walks depth-first in the actual render order, so 'continuous' rowNumber/runningTotal accumulate through state across leaf segments in the right order (per-group reset at the start of a segment, same as before)