import * as tsplus_module_1 from "@tsplus/stdlib/collections/HashSet/add";
import * as tsplus_module_2 from "@effect/core/stm/TRef/operations/set";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/map";
import * as tsplus_module_4 from "@effect/core/stm/STM/operations/flatMap";
import * as tsplus_module_5 from "@effect/core/stm/TRef/operations/get";
import * as tsplus_module_6 from "@effect/core/stm/TRef/operations/make";
import { InternalTDequeue } from "@effect/core/stm/THub/operations/_internal/InternalTDequeue";
/**
 * @tsplus static ets/THub/TDequeue/Ops make
 * @tsplus static ets/THub/TDequeue/Ops __call
 */

export function make(hubSize, publisherHead, publisherTail, requestedCapacity, subscriberCount, subscribers) {
  return tsplus_module_4.flatMap_(tsplus_module_5.get(publisherTail), currentPublisherTail => tsplus_module_4.flatMap_(tsplus_module_6.make(() => currentPublisherTail), subscriberHead => tsplus_module_4.flatMap_(tsplus_module_5.get(subscriberCount), currentSubscriberCount => tsplus_module_4.flatMap_(tsplus_module_5.get(subscribers), currentSubscribers => tsplus_module_4.flatMap_(tsplus_module_2.set_(subscriberCount, currentSubscriberCount + 1), () => tsplus_module_3.map_(tsplus_module_2.set_(subscribers, tsplus_module_1.add_(currentSubscribers, subscriberHead)), () => new InternalTDequeue(hubSize, publisherHead, requestedCapacity, subscriberHead, subscriberCount, subscribers)))))));
}
//# sourceMappingURL=make.mjs.map