import * as tsplus_module_1 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_2 from "@tsplus/stdlib/collections/Chunk/map";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Chunk/flatMap";
import * as tsplus_module_4 from "@effect/core/stream/Channel/operations/mapOut";
import * as tsplus_module_5 from "@effect/core/stream/Channel/operations/concatMap";
import { concreteStream, StreamInternal } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * Composes this stream with the specified stream to create a cartesian
 * product of elements. The `that` stream would be run multiple times, for
 * every element in the `this` stream.
 *
 * See also `Stream.zip` for the more common point-wise variant.
 *
 * @tsplus fluent ets/Stream cross
 */

export function cross_(self, that, __tsplusTrace) {
  void 0;
  return new StreamInternal(tsplus_module_5.concatMap_(self.channel, a => {
    const that0 = that();
    void 0;
    return tsplus_module_4.mapOut_(that0.channel, b => tsplus_module_3.flatMap_(a, a => tsplus_module_2.map_(b, b => tsplus_module_1.make(a, b))));
  }));
}
/**
 * Composes this stream with the specified stream to create a cartesian
 * product of elements. The `that` stream would be run multiple times, for
 * every element in the `this` stream.
 *
 * See also `Stream.zip` for the more common point-wise variant.
 *
 * @tsplus static ets/Stream/Aspects cross
 */

export const cross = (that, __tsplusTrace) => self => cross_(self, that, __tsplusTrace);
//# sourceMappingURL=cross.mjs.map