const fileName_1 = "(@effect/core) _src/io/Fiber/operations/zipWith.ts";
import * as tsplus_module_1 from "@effect/core/io/Fiber/operations/id";
import * as tsplus_module_2 from "@effect/core/io/FiberId/operations/getOrElse";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/done";
import * as tsplus_module_4 from "@effect/core/io/Fiber/operations/await";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/zipWithPar";
import * as tsplus_module_7 from "@effect/core/io/Effect/operations/exit";
import * as tsplus_module_8 from "@effect/core/io/Fiber/operations/children";
import * as tsplus_module_9 from "@effect/core/io/Fiber/operations/inheritRefs";
import * as tsplus_module_10 from "@effect/core/io/Effect/operations/zipRight";
import * as tsplus_module_11 from "@effect/core/io/Fiber/operations/interruptAs";
import * as tsplus_module_12 from "@effect/core/io/Cause/definition";
import * as tsplus_module_13 from "@effect/core/io/Exit/operations/zipWith";
import * as tsplus_module_14 from "@effect/core/io/Effect/operations/zipWith";
import * as tsplus_module_15 from "@effect/core/io/Fiber/operations/poll";
import * as tsplus_module_16 from "@tsplus/stdlib/data/Maybe/map";
import * as tsplus_module_17 from "@tsplus/stdlib/data/Maybe/flatMap";
import { makeSynthetic } from "@effect/core/io/Fiber/definition";
/**
 * Zips this fiber with the specified fiber, combining their results using the
 * specified combiner function. Both joins and interruptions are performed in
 * sequential order from left to right.
 *
 * @tsplus fluent ets/Fiber zipWith
 * @tsplus fluent ets/RuntimeFiber zipWith
 */

export function zipWith_(self, that, f) {
  return makeSynthetic({
    id: tsplus_module_2.getOrElse_(tsplus_module_1.id(self), () => tsplus_module_1.id(that)),
    await: tsplus_module_7.exit(tsplus_module_6.zipWithPar_(tsplus_module_5.flatMap_(tsplus_module_4._await(self, fileName_1 + ":19:13"), exit => tsplus_module_3.done(() => exit, fileName_1 + ":20:37"), fileName_1 + ":20:15"), () => tsplus_module_5.flatMap_(tsplus_module_4._await(that, fileName_1 + ":22:19"), exit => tsplus_module_3.done(() => exit, fileName_1 + ":22:51"), fileName_1 + ":22:29"), f, fileName_1 + ":21:18"), fileName_1 + ":25:12"),
    children: tsplus_module_8.children(self, fileName_1 + ":26:28"),
    inheritRefs: tsplus_module_10.zipRight_(tsplus_module_9.inheritRefs(that, fileName_1 + ":27:34"), () => tsplus_module_9.inheritRefs(self, fileName_1 + ":27:55"), fileName_1 + ":27:38"),
    interruptAs: id => tsplus_module_14.zipWith_(tsplus_module_11.interruptAsNow_(self, id, fileName_1 + ":30:21"), () => tsplus_module_11.interruptAsNow_(that, id, fileName_1 + ":31:34"), (ea, eb) => tsplus_module_13.zipWith_(ea, eb, f, tsplus_module_12.combinePar), fileName_1 + ":31:17"),
    poll: tsplus_module_14.zipWith_(tsplus_module_15.poll(self, fileName_1 + ":33:12"), () => tsplus_module_15.poll(that, fileName_1 + ":34:25"), (oa, ob) => tsplus_module_17.flatMap_(oa, ea => tsplus_module_16.map_(ob, eb => tsplus_module_13.zipWith_(ea, eb, f, tsplus_module_12.combinePar))), fileName_1 + ":34:15")
  });
}
/**
 * Zips this fiber with the specified fiber, combining their results using the
 * specified combiner function. Both joins and interruptions are performed in
 * sequential order from left to right.
 *
 * @tsplus static ets/Fiber/Aspects zipWith
 */

export const zipWith = (that, f) => self => zipWith_(self, that, f);
//# sourceMappingURL=zipWith.mjs.map