import * as tsplus_module_1 from "@effect/core/io/Cause/definition";
import * as tsplus_module_2 from "@effect/core/io/Fiber/status";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/HashSet/empty";
import * as tsplus_module_4 from "@tsplus/stdlib/collections/List/empty";
import * as tsplus_module_5 from "@effect/core/io/Fiber/_internal/cancelerState";
import * as tsplus_module_6 from "@tsplus/stdlib/collections/HashSet/reduce";
export const FiberState = {};
/**
 * @tsplus unify ets/Fiber/State
 */

export function unifyFiberState(self) {
  return self;
}
export class Executing {
  constructor(status, observers, suppressed, interruptors, asyncCanceler, mailbox) {
    this.status = status;
    this.observers = observers;
    this.suppressed = suppressed;
    this.interruptors = interruptors;
    this.asyncCanceler = asyncCanceler;
    this.mailbox = mailbox;
    this._tag = "Executing";
  }

}
export class Done {
  constructor(value) {
    this.value = value;
    this._tag = "Done";
    this.suppressed = tsplus_module_1.empty;
    this.status = tsplus_module_2.statusDone;
    this.interruptors = tsplus_module_3.empty();
  }

}
/**
 * @tsplus static ets/Fiber/State/Ops Executing
 */

export function executing(status, observers, suppressed, interruptors, asyncCanceler, mailbox) {
  return new Executing(status, observers, suppressed, interruptors, asyncCanceler, mailbox);
}
/**
 * @tsplus static ets/Fiber/State/Ops Done
 */

export function done(value) {
  return new Done(value);
}
/**
 * @tsplus static ets/Fiber/State/Ops initial
 */

export function initial() {
  return new Executing(tsplus_module_2.statusRunning(false), tsplus_module_4.empty(), tsplus_module_1.empty, tsplus_module_3.empty(), tsplus_module_5.empty, undefined);
}
/**
 * @tsplus getter ets/Fiber/State isInterrupting
 */

export function isInterrupting(self) {
  return tsplus_module_2.isInterrupting(self.status);
}
/**
 * @tsplus getter ets/Fiber/State interruptorsCause
 */

export function interruptorsCause(state) {
  return tsplus_module_6.reduce_(state.interruptors, tsplus_module_1.empty, (acc, interruptor) => tsplus_module_1.combineSeq(acc, tsplus_module_1.interrupt(interruptor)));
}
//# sourceMappingURL=fiberState.mjs.map