// tracing: off
import { pipe } from "../../Function"
import * as H from "../../Hub"
import * as T from "../_internal/effect"
import * as M from "../_internal/managed"
import { intoHubManaged_ } from "./intoHubManaged"
/**
 * Converts the stream to a managed hub of chunks. After the managed hub is used,
 * the hub will never again produce values and should be discarded.
 */

export function toHub_(self, capacity) {
  return M.tap_(
    T.toManagedRelease_(H.makeBounded(capacity), (_) => H.shutdown(_)),
    (hub) => M.fork(intoHubManaged_(self, hub))
  )
}
/**
 * Converts the stream to a managed hub of chunks. After the managed hub is used,
 * the hub will never again produce values and should be discarded.
 */

export function toHub(capacity) {
  return (self) => toHub_(self, capacity)
}
//# sourceMappingURL=toHub.js.map
