function flushSync(fn) {
	var result;

	if (fn) {
		is_flushing = true;
		flush_queued_root_effects();

		is_flushing = true;
		result = fn();
	}

	while (true) {
		flush_tasks();

		if (queued_root_effects.length === 0) {
			// this would be reset in `flush_queued_root_effects` but since we are early returning here,
			// we need to reset it here as well in case the first time there's 0 queued root effects
			is_flushing = false;
			last_scheduled_effect = null;
			if (DEV) {
				dev_effect_stack = [];
			}
			return /** @type {T} */ (result);
		}

		is_flushing = true;
		flush_queued_root_effects();
	}
}
Synchronously flush any pending updates.
Returns void if no callback is provided, otherwise returns the result of calling the callback.
@template [T=void]
@param {(() => T) | undefined} [fn]
@returns {T}