const fileName_1 = "(@effect/core) _src/io/Schedule/operations/elapsed.ts";
import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Duration";
import * as tsplus_module_3 from "@effect/core/io/Schedule/Interval";
import * as tsplus_module_4 from "@effect/core/io/Schedule/Decision";
import * as tsplus_module_5 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_6 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_7 from "@effect/core/io/Effect/operations/succeed";
import { makeWithState } from "@effect/core/io/Schedule/operations/_internal/makeWithState";
/**
 * A schedule that occurs everywhere, which returns the total elapsed duration
 * since the first step.
 *
 * @tsplus static ets/Schedule/Ops elapsed
 */

export const elapsed = /*#__PURE__*/makeWithState( /*#__PURE__*/tsplus_module_1.emptyOf(), (now, _, state) => tsplus_module_7.succeed(() => tsplus_module_6.fold_(state, () => tsplus_module_5.make(tsplus_module_1.some(now), tsplus_module_2.millis(0), tsplus_module_4._continue(tsplus_module_3.after(now))), start => tsplus_module_5.make(tsplus_module_1.some(start), new tsplus_module_2.Duration(now - start), tsplus_module_4._continue(tsplus_module_3.after(now)))), fileName_1 + ":17:17"));
//# sourceMappingURL=elapsed.mjs.map