import * as tsplus_module_1 from "@tsplus/stdlib/data/Duration";
import * as tsplus_module_2 from "@effect/core/io/Schedule/operations/elapsed";
import * as tsplus_module_3 from "@effect/core/io/Schedule/operations/zip";
import * as tsplus_module_4 from "@effect/core/io/Schedule/operations/resetWhen";
import * as tsplus_module_5 from "@effect/core/io/Schedule/operations/map";
/**
 * Return a new schedule that automatically resets the schedule to its initial
 * state after some time of inactivity defined by `duration`.
 *
 * @tsplus fluent ets/Schedule resetAfter
 * @tsplus fluent ets/Schedule/WithState resetAfter
 */

export function resetAfter_(self, duration) {
  return tsplus_module_5.map_(tsplus_module_4.resetWhen_(tsplus_module_3.zip_(self, tsplus_module_2.elapsed), ({
    tuple: [, _]
  }) => tsplus_module_1.greaterThenOrEqual_(_, duration)), out => out.get(0));
}
/**
 * Return a new schedule that automatically resets the schedule to its initial
 * state after some time of inactivity defined by `duration`.
 *
 * @tsplus static ets/Schedule/Aspects resetAfter
 */

export const resetAfter = duration => self => resetAfter_(self, duration);
//# sourceMappingURL=resetAfter.mjs.map