var _a;

import * as tsplus_module_1 from "@effect/core/io/Effect/operations/unit";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/ignore";
export const ChannelStateSym = /*#__PURE__*/Symbol.for("@effect/core/stream/Channel/ChannelState");
export const _R = /*#__PURE__*/Symbol.for("@effect/core/stream/Channel/ChannelState/R");
export const _E = /*#__PURE__*/Symbol.for("@effect/core/stream/Channel/ChannelState/E");
export class ChannelStateBase {
  constructor() {
    this[_a] = ChannelStateSym;
  }

}
_a = ChannelStateSym;
export class ChannelStateDone extends ChannelStateBase {
  constructor() {
    super(...arguments);
    this._tag = "Done";
  }

}
export class ChannelStateEmit extends ChannelStateBase {
  constructor() {
    super(...arguments);
    this._tag = "Emit";
  }

}
export class ChannelStateEffect extends ChannelStateBase {
  constructor(effect) {
    super();
    this.effect = effect;
    this._tag = "Effect";
  }

}
export class ChannelStateRead extends ChannelStateBase {
  constructor(upstream, onEffect, onEmit, onDone) {
    super();
    this.upstream = upstream;
    this.onEffect = onEffect;
    this.onEmit = onEmit;
    this.onDone = onDone;
    this._tag = "Read";
  }

}
export const ChannelState = {};
/**
 * @tsplus unify ets/Channel/State
 */

export function unifyChannelState(self) {
  return self;
}
/**
 * @tsplus macro remove
 */

export function concreteChannelState(_) {//
}
/**
 * @tsplus static ets/Channel/State/Ops Done
 */

export const channelStateDone = /*#__PURE__*/new ChannelStateDone();
/**
 * @tsplus static ets/Channel/State/Ops Emit
 */

export const channelStateEmit = /*#__PURE__*/new ChannelStateEmit();
/**
 * @tsplus static ets/Channel/State/Ops Effect
 */

export function channelStateEffect(effect) {
  return new ChannelStateEffect(effect);
}
/**
 * @tsplus static ets/Channel/State/Ops Read
 */

export function channelStateRead(upstream, onEffect, onEmit, onDone) {
  return new ChannelStateRead(upstream, onEffect, onEmit, onDone);
}
/**
 * @tsplus fluent ets/Channel/State effectOrUnit
 */

export function effectOrUnit(self, __tsplusTrace) {
  void 0;
  return self._tag === "Effect" ? self.effect : tsplus_module_1.unit;
}
/**
 * @tsplus fluent ets/Channel/State effectOrUndefinedIgnored
 */

export function effectOrUndefinedIgnored(self, __tsplusTrace) {
  void 0;
  return self._tag === "Effect" ? tsplus_module_1.unit_(tsplus_module_2.ignore(self.effect, __tsplusTrace), __tsplusTrace) : undefined;
}
//# sourceMappingURL=ChannelState.mjs.map