sortFragmentWithIndex = ([a, i], [b, j]) => {
	const stageCmp = a.stage - b.stage;
	if (stageCmp !== 0) return stageCmp;
	const positionCmp = a.position - b.position;
	if (positionCmp !== 0) return positionCmp;
	return i - j;
}
@template T
@param {[InitFragment<T>, number]} a first pair
@param {[InitFragment<T>, number]} b second pair
@returns {number} sort value