"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.forEachChunkManaged = exports.forEachChunkManaged_ = exports.forEachManaged = exports.forEachManaged_ = exports.forEachWhile = exports.forEachWhile_ = exports.forEachChunk = exports.forEachChunk_ = exports.forEachWhileManaged = exports.forEachWhileManaged_ = exports.forEach = exports.forEach_ = void 0;
const SK = __importStar(require("../Sink"));
const run_1 = require("./run");
const runManaged_1 = require("./runManaged");
/**
 * Consumes all elements of the stream, passing them to the specified callback.
 */
function forEach_(self, f) {
    return (0, run_1.run_)(self, SK.forEach(f));
}
exports.forEach_ = forEach_;
/**
 * Consumes all elements of the stream, passing them to the specified callback.
 */
function forEach(f) {
    return (self) => forEach_(self, f);
}
exports.forEach = forEach;
/**
 * Like `Stream#forEachWhile`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachWhileManaged_(self, f) {
    return (0, runManaged_1.runManaged_)(self, SK.forEachWhile(f));
}
exports.forEachWhileManaged_ = forEachWhileManaged_;
/**
 * Like `Stream#forEachWhile`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachWhileManaged(f) {
    return (self) => forEachWhileManaged_(self, f);
}
exports.forEachWhileManaged = forEachWhileManaged;
/**
 * Consumes all elements of the stream, passing them to the specified callback.
 */
function forEachChunk_(self, f) {
    return (0, run_1.run_)(self, SK.forEachChunk(f));
}
exports.forEachChunk_ = forEachChunk_;
/**
 * Consumes all elements of the stream, passing them to the specified callback.
 */
function forEachChunk(f) {
    return (self) => (0, run_1.run_)(self, SK.forEachChunk(f));
}
exports.forEachChunk = forEachChunk;
/**
 * Consumes elements of the stream, passing them to the specified callback,
 * and terminating consumption when the callback returns `false`.
 */
function forEachWhile_(self, f) {
    return (0, run_1.run_)(self, SK.forEachWhile(f));
}
exports.forEachWhile_ = forEachWhile_;
/**
 * Consumes elements of the stream, passing them to the specified callback,
 * and terminating consumption when the callback returns `false`.
 */
function forEachWhile(f) {
    return (self) => forEachWhile_(self, f);
}
exports.forEachWhile = forEachWhile;
/**
 * Like `forEach`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachManaged_(self, f) {
    return (0, runManaged_1.runManaged_)(self, SK.forEach(f));
}
exports.forEachManaged_ = forEachManaged_;
/**
 * Like `forEach`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachManaged(f) {
    return (self) => forEachManaged_(self, f);
}
exports.forEachManaged = forEachManaged;
/**
 * Like `Stream#forEachChunk`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachChunkManaged_(self, f) {
    return (0, runManaged_1.runManaged_)(self, SK.forEachChunk(f));
}
exports.forEachChunkManaged_ = forEachChunkManaged_;
/**
 * Like `Stream#forEachChunk`, but returns a `Managed` so the finalization order
 * can be controlled.
 */
function forEachChunkManaged(f) {
    return (self) => forEachChunkManaged_(self, f);
}
exports.forEachChunkManaged = forEachChunkManaged;
//# sourceMappingURL=forEach.js.map