src/vs/base/browser/ui/dialog/dialog.ts/Dialog/rearrangeButtons
class Dialog:	private rearrangeButtons(buttons: Array<string>, cancelId: number | undefined): ButtonMapEntry[] {
		const buttonMap: ButtonMapEntry[] = [];
		if (buttons.length === 0) {
			return buttonMap;
		}

		// Maps each button to its current label and old index so that when we move them around it's not a problem
		buttons.forEach((button, index) => {
			buttonMap.push({ label: button, index });
		});

		// macOS/linux: reverse button order if `cancelId` is defined
		if (isMacintosh || isLinux) {
			if (cancelId !== undefined && cancelId < buttons.length) {
				const cancelButton = buttonMap.splice(cancelId, 1)[0];
				buttonMap.reverse();
				buttonMap.splice(buttonMap.length - 1, 0, cancelButton);
			}
		}

		return buttonMap;
	}