import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_3 from "@effect/core/stream/Sink/operations/foldWeightedDecomposeEffect";
/**
 * Creates a sink that effectfully folds elements of type `In` into a
 * structure of type `S`, until `max` worth of elements (determined by the
 * `costFn`) have been folded.
 *
 * @note Elements that have an individual cost larger than `max` will force the
 * sink to cross the `max` cost. See `foldWeightedDecomposeEffect` for a variant
 * that can handle these cases.
 *
 * @tsplus static ets/Sink/Ops foldWeightedEffect
 */

export function foldWeightedEffect(z, costFn, max, f, __tsplusTrace) {
  return tsplus_module_3.foldWeightedDecomposeEffect(z, costFn, max, i => tsplus_module_2.succeedNow(tsplus_module_1.single(i), __tsplusTrace), f, __tsplusTrace);
}
//# sourceMappingURL=foldWeightedEffect.mjs.map