/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Async } from "@vertexvis/utils";
export function retryIfNotAborted(abortSignal, fn, fallback, opts) {
    return Async.retry(() => {
        if (!abortSignal.aborted) {
            return fn();
        }
        // Intentionally return a resolved fallback promise if the AbortSignal
        // associated to this attempt has been aborted to avoid attempts
        // to rerun the function after another process has aborted this one.
        return Promise.resolve(fallback);
    }, opts);
}
//# sourceMappingURL=utils.js.map
