import * as tsplus_module_1 from "@effect/core/stream/Stream/operations/repeatEither";
import * as tsplus_module_2 from "@effect/core/stream/Stream/operations/collectRight";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_4 from "@effect/core/stream/Channel/operations/write";
import * as tsplus_module_5 from "@effect/core/stream/Channel/operations/repeated";
import * as tsplus_module_6 from "@effect/core/stream/Channel/operations/succeed";
import * as tsplus_module_7 from "@effect/core/stream/Channel/operations/flatMap";
import { StreamInternal } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * Repeats the entire stream using the specified schedule. The stream will
 * execute normally, and then repeat again according to the provided schedule.
 *
 * @tsplus fluent ets/Stream repeat
 */

export function repeatNow_(self, schedule, __tsplusTrace) {
  return tsplus_module_2.collectRight(tsplus_module_1.repeatEither_(self, schedule, __tsplusTrace), __tsplusTrace);
}
/**
 * Repeats the entire stream using the specified schedule. The stream will
 * execute normally, and then repeat again according to the provided schedule.
 *
 * @tsplus static ets/Stream/Aspects repeat
 */

export const repeatNow = (schedule, __tsplusTrace) => self => repeatNow_(self, schedule, __tsplusTrace);
/**
 * Repeats the provided value infinitely.
 *
 * @tsplus static ets/Stream/Ops repeat
 */

export function repeat(a, __tsplusTrace) {
  return new StreamInternal(tsplus_module_7.flatMap_(tsplus_module_6.succeed(a), a => tsplus_module_5.repeated(tsplus_module_4.write(() => tsplus_module_3.single(a)), __tsplusTrace)));
}
//# sourceMappingURL=repeat.mjs.map