import * as tsplus_module_1 from "@effect/core/io/Effect/operations/setRuntimeConfig";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/yieldNow";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/zipRight";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/acquireUseReleaseDiscard";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/runtimeConfig";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/flatMap";
export const withRuntimeConfig = withRuntimeConfig_1;
/**
 * Runs the specified effect on the specified runtime configuration, restoring
 * the old runtime configuration when it completes execution.
 *
 * @tsplus static ets/Effect/Ops withRuntimeConfig
 */

function withRuntimeConfig_1(runtimeConfig, effect, __tsplusTrace) {
  return tsplus_module_6.flatMap_(tsplus_module_5.runtimeConfig, currentRuntimeConfig => tsplus_module_4.acquireUseReleaseDiscard(() => tsplus_module_3.zipRight_(tsplus_module_1.setRuntimeConfig(runtimeConfig, __tsplusTrace), () => tsplus_module_2.yieldNow, __tsplusTrace), effect, () => tsplus_module_1.setRuntimeConfig(() => currentRuntimeConfig, __tsplusTrace)), __tsplusTrace);
}
/**
 * Runs the specified effect on the specified runtime configuration, restoring
 * the old runtime configuration when it completes execution.
 *
 * @tsplus fluent ets/Effect withRuntimeConfig
 */


export function withRuntimeConfigNow_(self, runtimeConfig, __tsplusTrace) {
  return withRuntimeConfig_1(runtimeConfig, () => self, __tsplusTrace);
}
/**
 * Runs the specified effect on the specified runtime configuration, restoring
 * the old runtime configuration when it completes execution.
 *
 * @tsplus static ets/Effect/Aspects withRuntimeConfig
 */

export const withRuntimeConfigNow = (runtimeConfig, __tsplusTrace) => self => withRuntimeConfigNow_(self, runtimeConfig, __tsplusTrace);
//# sourceMappingURL=withRuntimeConfig.mjs.map