@fncts/io 0.0.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/Channel/UpstreamPullRequest/api.d.ts +1 -1
  2. package/Channel/api.d.ts +2 -2
  3. package/Clock/api.d.ts +3 -1
  4. package/Clock/definition.d.ts +3 -1
  5. package/Clock/live.d.ts +2 -0
  6. package/Fiber/api/interruptFork.d.ts +1 -1
  7. package/FiberRef/constructors.d.ts +0 -53
  8. package/FiberRef/unsafe.d.ts +53 -0
  9. package/FiberRef.d.ts +1 -0
  10. package/Future/constructors.d.ts +3 -3
  11. package/IO/api/asyncIO.d.ts +6 -0
  12. package/IO/api/ensuringChildren.d.ts +7 -0
  13. package/IO/api/sequenceT.d.ts +2 -3
  14. package/IO/api/sleep.d.ts +3 -1
  15. package/IO/api/timeout.d.ts +14 -0
  16. package/IO/api.d.ts +2 -2
  17. package/IO/definition.d.ts +8 -4
  18. package/IO.d.ts +3 -0
  19. package/IOSpec.d.ts +10 -1
  20. package/InterruptStatus/constructors.d.ts +3 -3
  21. package/Latch.d.ts +3 -0
  22. package/Schedule/Decision.d.ts +1 -1
  23. package/Schedule/api.d.ts +1 -1
  24. package/Schedule.d.ts +0 -1
  25. package/Scope/Finalizer/definition.d.ts +1 -1
  26. package/Scope/ReleaseMap/definition.d.ts +1 -1
  27. package/Stream/api.d.ts +5 -22
  28. package/Stream/internal/DebounceState.d.ts +3 -3
  29. package/Stream/internal/Handoff.d.ts +9 -9
  30. package/Stream/internal/SinkEndReason.d.ts +6 -18
  31. package/TFuture/definition.d.ts +1 -1
  32. package/TSemaphore/definition.d.ts +1 -1
  33. package/_cjs/Cached.cjs +3 -3
  34. package/_cjs/Channel/ChildExecutorDecision.cjs +2 -2
  35. package/_cjs/Channel/UpstreamPullRequest/api.cjs +3 -3
  36. package/_cjs/Channel/UpstreamPullRequest/api.cjs.map +1 -1
  37. package/_cjs/Channel/UpstreamPullRequest.cjs +2 -2
  38. package/_cjs/Channel/UpstreamPullStrategy.cjs +1 -1
  39. package/_cjs/Channel/api/interruptWhen.cjs +1 -1
  40. package/_cjs/Channel/api/interruptWhen.cjs.map +1 -1
  41. package/_cjs/Channel/api/mapOutIOC.cjs +1 -1
  42. package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
  43. package/_cjs/Channel/api/mergeAllWith.cjs +1 -1
  44. package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
  45. package/_cjs/Channel/api/mergeWith.cjs +6 -6
  46. package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
  47. package/_cjs/Channel/api.cjs +14 -14
  48. package/_cjs/Channel/api.cjs.map +1 -1
  49. package/_cjs/Channel/core-api.cjs +1 -1
  50. package/_cjs/Channel/internal/ChannelExecutor.cjs +2 -2
  51. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  52. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +8 -7
  53. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
  54. package/_cjs/Channel.cjs +3 -3
  55. package/_cjs/Clock/api.cjs.map +1 -1
  56. package/_cjs/Clock/live.cjs +1 -1
  57. package/_cjs/Clock/live.cjs.map +1 -1
  58. package/_cjs/Clock.cjs +3 -3
  59. package/_cjs/Console.cjs +3 -3
  60. package/_cjs/Fiber/FiberContext.cjs +58 -57
  61. package/_cjs/Fiber/FiberContext.cjs.map +1 -1
  62. package/_cjs/Fiber/api/interruptFork.cjs +1 -1
  63. package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
  64. package/_cjs/Fiber/constructors.cjs +2 -2
  65. package/_cjs/Fiber/constructors.cjs.map +1 -1
  66. package/_cjs/Fiber.cjs +23 -23
  67. package/_cjs/FiberRef/constructors.cjs +3 -84
  68. package/_cjs/FiberRef/constructors.cjs.map +1 -1
  69. package/_cjs/FiberRef/unsafe.cjs +94 -0
  70. package/_cjs/FiberRef/unsafe.cjs.map +1 -0
  71. package/_cjs/FiberRef.cjs +18 -5
  72. package/_cjs/FiberRef.cjs.map +1 -1
  73. package/_cjs/FiberRefs/join.cjs +2 -2
  74. package/_cjs/FiberRefs/join.cjs.map +1 -1
  75. package/_cjs/FiberRefs.cjs +3 -3
  76. package/_cjs/FiberScope.cjs +2 -2
  77. package/_cjs/FiberState/constructors.cjs +1 -1
  78. package/_cjs/FiberState.cjs +3 -3
  79. package/_cjs/FiberStatus/constructors.cjs +1 -1
  80. package/_cjs/FiberStatus.cjs +2 -2
  81. package/_cjs/Future/constructors.cjs +2 -4
  82. package/_cjs/Future/constructors.cjs.map +1 -1
  83. package/_cjs/Future.cjs +3 -3
  84. package/_cjs/Hub.cjs +2 -2
  85. package/_cjs/IO/api/asyncIO.cjs +37 -0
  86. package/_cjs/IO/api/asyncIO.cjs.map +1 -0
  87. package/_cjs/IO/api/concurrency.cjs +1 -1
  88. package/_cjs/IO/api/core-scope.cjs +1 -1
  89. package/_cjs/IO/api/ensuringChildren.cjs +24 -0
  90. package/_cjs/IO/api/ensuringChildren.cjs.map +1 -0
  91. package/_cjs/IO/api/environment.cjs +1 -1
  92. package/_cjs/IO/api/interrupt.cjs +5 -5
  93. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  94. package/_cjs/IO/api/sleep.cjs.map +1 -1
  95. package/_cjs/IO/api/timeout.cjs +42 -0
  96. package/_cjs/IO/api/timeout.cjs.map +1 -0
  97. package/_cjs/IO/api.cjs +41 -40
  98. package/_cjs/IO/api.cjs.map +1 -1
  99. package/_cjs/IO/definition.cjs +9 -6
  100. package/_cjs/IO/definition.cjs.map +1 -1
  101. package/_cjs/IO/runtime.cjs +2 -2
  102. package/_cjs/IO/runtime.cjs.map +1 -1
  103. package/_cjs/IO.cjs +86 -47
  104. package/_cjs/IO.cjs.map +1 -1
  105. package/_cjs/IOEnv/services.cjs +1 -1
  106. package/_cjs/IOEnv.cjs +3 -3
  107. package/_cjs/InterruptStatus/constructors.cjs +3 -7
  108. package/_cjs/InterruptStatus/constructors.cjs.map +1 -1
  109. package/_cjs/InterruptStatus.cjs +2 -2
  110. package/_cjs/Layer/api.cjs +5 -3
  111. package/_cjs/Layer/api.cjs.map +1 -1
  112. package/_cjs/Layer.cjs +3 -3
  113. package/_cjs/Logger.cjs +3 -3
  114. package/_cjs/Queue/api.cjs +7 -7
  115. package/_cjs/Queue.cjs +5 -5
  116. package/_cjs/Random.cjs +3 -3
  117. package/_cjs/Ref/Atomic/Atomic.cjs +3 -3
  118. package/_cjs/Ref/Atomic/api.cjs +10 -6
  119. package/_cjs/Ref/Atomic/api.cjs.map +1 -1
  120. package/_cjs/Ref/Atomic.cjs +2 -2
  121. package/_cjs/Ref/Derived.cjs +2 -2
  122. package/_cjs/Ref/DerivedAll.cjs +1 -1
  123. package/_cjs/Ref/Synchronized/api.cjs +1 -1
  124. package/_cjs/Ref/Synchronized/constructors.cjs +1 -1
  125. package/_cjs/Ref/Synchronized/definition.cjs +1 -1
  126. package/_cjs/Ref/api/get.cjs +1 -1
  127. package/_cjs/Ref/api/match.cjs +1 -1
  128. package/_cjs/Ref/api/matchAll.cjs +1 -1
  129. package/_cjs/Ref/api/modify.cjs +1 -1
  130. package/_cjs/Ref/api/set.cjs +1 -1
  131. package/_cjs/Ref/api.cjs +8 -8
  132. package/_cjs/Ref/constructors.cjs +1 -1
  133. package/_cjs/Ref.cjs +9 -9
  134. package/_cjs/STM/api/core-api.cjs +1 -1
  135. package/_cjs/STM/api/core-constructors.cjs +1 -1
  136. package/_cjs/STM/api.cjs +2 -2
  137. package/_cjs/STM/driver.cjs +1 -1
  138. package/_cjs/STM/internal/Entry.cjs +1 -1
  139. package/_cjs/STM/internal/Journal.cjs +2 -2
  140. package/_cjs/STM.cjs +5 -5
  141. package/_cjs/Schedule/Decision.cjs.map +1 -1
  142. package/_cjs/Schedule/api/driver.cjs +11 -9
  143. package/_cjs/Schedule/api/driver.cjs.map +1 -1
  144. package/_cjs/Schedule/api.cjs +49 -49
  145. package/_cjs/Schedule/api.cjs.map +1 -1
  146. package/_cjs/Schedule.cjs +4 -17
  147. package/_cjs/Schedule.cjs.map +1 -1
  148. package/_cjs/Scope/Finalizer/definition.cjs +6 -4
  149. package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
  150. package/_cjs/Scope/Finalizer.cjs +1 -1
  151. package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -1
  152. package/_cjs/Scope/ReleaseMap/api.cjs +1 -1
  153. package/_cjs/Scope/ReleaseMap/constructors.cjs +1 -1
  154. package/_cjs/Scope/ReleaseMap/definition.cjs +4 -2
  155. package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
  156. package/_cjs/Scope/ReleaseMap.cjs +3 -3
  157. package/_cjs/Scope/api.cjs +1 -1
  158. package/_cjs/Scope.cjs +2 -2
  159. package/_cjs/ScopedRef.cjs +2 -2
  160. package/_cjs/Sink/api.cjs +1 -1
  161. package/_cjs/Sink/api.cjs.map +1 -1
  162. package/_cjs/Sink.cjs +2 -2
  163. package/_cjs/State/api.cjs +2 -2
  164. package/_cjs/State/definition.cjs +1 -1
  165. package/_cjs/State.cjs +2 -2
  166. package/_cjs/Stream/api/zipAllWith.cjs +1 -1
  167. package/_cjs/Stream/api/zipWith.cjs +1 -1
  168. package/_cjs/Stream/api.cjs +308 -308
  169. package/_cjs/Stream/api.cjs.map +1 -1
  170. package/_cjs/Stream/internal/DebounceState.cjs.map +1 -1
  171. package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
  172. package/_cjs/Stream/internal/SinkEndReason.cjs +2 -37
  173. package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
  174. package/_cjs/Stream.cjs +2 -2
  175. package/_cjs/Supervisor/constructors.cjs +1 -1
  176. package/_cjs/Supervisor.cjs +3 -3
  177. package/_cjs/TExit/constructors.cjs +1 -1
  178. package/_cjs/TExit.cjs +2 -2
  179. package/_cjs/TFuture/definition.cjs +4 -2
  180. package/_cjs/TFuture/definition.cjs.map +1 -1
  181. package/_cjs/TFuture.cjs +3 -3
  182. package/_cjs/TRef/api.cjs +2 -2
  183. package/_cjs/TRef/constructors.cjs +3 -3
  184. package/_cjs/TRef.cjs +3 -3
  185. package/_cjs/TSemaphore/api.cjs +1 -1
  186. package/_cjs/TSemaphore/definition.cjs +4 -2
  187. package/_cjs/TSemaphore/definition.cjs.map +1 -1
  188. package/_cjs/TSemaphore.cjs +3 -3
  189. package/_cjs/collection/immutable/Conc.cjs +3 -3
  190. package/_mjs/Channel/UpstreamPullRequest/api.mjs +1 -2
  191. package/_mjs/Channel/UpstreamPullRequest/api.mjs.map +1 -1
  192. package/_mjs/Channel/api/interruptWhen.mjs +1 -1
  193. package/_mjs/Channel/api/interruptWhen.mjs.map +1 -1
  194. package/_mjs/Channel/api/mapOutIOC.mjs +1 -1
  195. package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
  196. package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
  197. package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
  198. package/_mjs/Channel/api/mergeWith.mjs +6 -6
  199. package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
  200. package/_mjs/Channel/api.mjs +14 -14
  201. package/_mjs/Channel/api.mjs.map +1 -1
  202. package/_mjs/Channel/internal/ChannelExecutor.mjs +2 -2
  203. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  204. package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +8 -7
  205. package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
  206. package/_mjs/Clock/api.mjs.map +1 -1
  207. package/_mjs/Clock/live.mjs +1 -1
  208. package/_mjs/Clock/live.mjs.map +1 -1
  209. package/_mjs/Fiber/FiberContext.mjs +58 -57
  210. package/_mjs/Fiber/FiberContext.mjs.map +1 -1
  211. package/_mjs/Fiber/api/interruptFork.mjs +1 -1
  212. package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
  213. package/_mjs/Fiber/constructors.mjs +1 -1
  214. package/_mjs/Fiber/constructors.mjs.map +1 -1
  215. package/_mjs/FiberRef/constructors.mjs +3 -66
  216. package/_mjs/FiberRef/constructors.mjs.map +1 -1
  217. package/_mjs/FiberRef/unsafe.mjs +66 -0
  218. package/_mjs/FiberRef/unsafe.mjs.map +1 -0
  219. package/_mjs/FiberRef.mjs +2 -1
  220. package/_mjs/FiberRef.mjs.map +1 -1
  221. package/_mjs/FiberRefs/join.mjs +2 -2
  222. package/_mjs/FiberRefs/join.mjs.map +1 -1
  223. package/_mjs/Future/constructors.mjs +3 -4
  224. package/_mjs/Future/constructors.mjs.map +1 -1
  225. package/_mjs/IO/api/asyncIO.mjs +20 -0
  226. package/_mjs/IO/api/asyncIO.mjs.map +1 -0
  227. package/_mjs/IO/api/concurrency.mjs +1 -1
  228. package/_mjs/IO/api/ensuringChildren.mjs +11 -0
  229. package/_mjs/IO/api/ensuringChildren.mjs.map +1 -0
  230. package/_mjs/IO/api/environment.mjs +1 -1
  231. package/_mjs/IO/api/interrupt.mjs +4 -4
  232. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  233. package/_mjs/IO/api/sleep.mjs.map +1 -1
  234. package/_mjs/IO/api/timeout.mjs +23 -0
  235. package/_mjs/IO/api/timeout.mjs.map +1 -0
  236. package/_mjs/IO/api.mjs +41 -40
  237. package/_mjs/IO/api.mjs.map +1 -1
  238. package/_mjs/IO/definition.mjs +6 -4
  239. package/_mjs/IO/definition.mjs.map +1 -1
  240. package/_mjs/IO/runtime.mjs +2 -2
  241. package/_mjs/IO/runtime.mjs.map +1 -1
  242. package/_mjs/IO.mjs +3 -0
  243. package/_mjs/IO.mjs.map +1 -1
  244. package/_mjs/IOEnv/services.mjs +1 -1
  245. package/_mjs/InterruptStatus/constructors.mjs +3 -3
  246. package/_mjs/InterruptStatus/constructors.mjs.map +1 -1
  247. package/_mjs/Layer/api.mjs +4 -3
  248. package/_mjs/Layer/api.mjs.map +1 -1
  249. package/_mjs/Ref/Atomic/api.mjs +10 -6
  250. package/_mjs/Ref/Atomic/api.mjs.map +1 -1
  251. package/_mjs/Schedule/Decision.mjs.map +1 -1
  252. package/_mjs/Schedule/api/driver.mjs +10 -9
  253. package/_mjs/Schedule/api/driver.mjs.map +1 -1
  254. package/_mjs/Schedule/api.mjs +49 -49
  255. package/_mjs/Schedule/api.mjs.map +1 -1
  256. package/_mjs/Schedule.mjs +0 -1
  257. package/_mjs/Schedule.mjs.map +1 -1
  258. package/_mjs/Scope/Finalizer/definition.mjs +5 -4
  259. package/_mjs/Scope/Finalizer/definition.mjs.map +1 -1
  260. package/_mjs/Scope/ReleaseMap/definition.mjs +3 -2
  261. package/_mjs/Scope/ReleaseMap/definition.mjs.map +1 -1
  262. package/_mjs/Sink/api.mjs +1 -1
  263. package/_mjs/Sink/api.mjs.map +1 -1
  264. package/_mjs/Stream/api.mjs +308 -302
  265. package/_mjs/Stream/api.mjs.map +1 -1
  266. package/_mjs/Stream/internal/DebounceState.mjs.map +1 -1
  267. package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
  268. package/_mjs/Stream/internal/SinkEndReason.mjs +1 -30
  269. package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
  270. package/_mjs/TFuture/definition.mjs +3 -2
  271. package/_mjs/TFuture/definition.mjs.map +1 -1
  272. package/_mjs/TSemaphore/definition.mjs +3 -2
  273. package/_mjs/TSemaphore/definition.mjs.map +1 -1
  274. package/_src/Channel/UpstreamPullRequest/api.ts +2 -3
  275. package/_src/Channel/api.ts +3 -3
  276. package/_src/Channel/internal/ChannelExecutor.ts +2 -2
  277. package/_src/Channel/internal/SingleProducerAsyncInput.ts +1 -0
  278. package/_src/Clock/api.ts +1 -1
  279. package/_src/Clock/definition.ts +1 -1
  280. package/_src/Clock/live.ts +2 -2
  281. package/_src/Fiber/FiberContext.ts +3 -2
  282. package/_src/Fiber/api/interruptFork.ts +1 -1
  283. package/_src/Fiber/constructors.ts +1 -1
  284. package/_src/FiberRef/constructors.ts +1 -78
  285. package/_src/FiberRef/unsafe.ts +79 -0
  286. package/_src/FiberRef.ts +1 -0
  287. package/_src/FiberRefs/join.ts +2 -2
  288. package/_src/Future/constructors.ts +1 -1
  289. package/_src/IO/api/asyncIO.ts +16 -0
  290. package/_src/IO/api/ensuringChildren.ts +11 -0
  291. package/_src/IO/api/interrupt.ts +2 -1
  292. package/_src/IO/api/sequenceT.ts +1 -1
  293. package/_src/IO/api/sleep.ts +1 -1
  294. package/_src/IO/api/timeout.ts +19 -0
  295. package/_src/IO/api.ts +6 -4
  296. package/_src/IO/definition.ts +8 -4
  297. package/_src/IO.ts +3 -0
  298. package/_src/InterruptStatus/constructors.ts +2 -0
  299. package/_src/Layer/api.ts +1 -1
  300. package/_src/Ref/Atomic/api.ts +4 -0
  301. package/_src/Schedule/Decision.ts +0 -2
  302. package/_src/Schedule/api/driver.ts +1 -1
  303. package/_src/Schedule/api.ts +0 -3
  304. package/_src/Schedule.ts +0 -1
  305. package/_src/Scope/Finalizer/definition.ts +1 -1
  306. package/_src/Scope/ReleaseMap/definition.ts +1 -1
  307. package/_src/Stream/api.ts +199 -134
  308. package/_src/Stream/internal/DebounceState.ts +2 -2
  309. package/_src/Stream/internal/Handoff.ts +9 -9
  310. package/_src/Stream/internal/SinkEndReason.ts +7 -25
  311. package/_src/TFuture/definition.ts +2 -2
  312. package/_src/TSemaphore/definition.ts +1 -1
  313. package/package.json +3 -3
  314. package/runTests.d.ts +1 -0
  315. package/Schedule/Interval.d.ts +0 -71
  316. package/_cjs/Schedule/Interval.cjs +0 -154
  317. package/_cjs/Schedule/Interval.cjs.map +0 -1
  318. package/_mjs/Schedule/Interval.mjs +0 -114
  319. package/_mjs/Schedule/Interval.mjs.map +0 -1
  320. package/_src/Schedule/Interval.ts +0 -103
@@ -71,7 +71,7 @@ exports.interleave_ = interleave_;
71
71
  exports.interruptWhenFuture_ = interruptWhenFuture_;
72
72
  exports.interruptWhen_ = interruptWhen_;
73
73
  exports.intersperse_ = intersperse_;
74
- exports.mapAccumIO_ = exports.loopOnPartialChunks_ = exports.loopOnPartialChunksElements_ = exports.loopOnChunks_ = void 0;
74
+ exports.mapAccumIO_ = void 0;
75
75
  exports.mapAccum_ = mapAccum_;
76
76
  exports.mapChunksIO_ = mapChunksIO_;
77
77
  exports.mapChunks_ = void 0;
@@ -148,87 +148,87 @@ var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/requir
148
148
 
149
149
  var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/set"));
150
150
 
151
- var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/modify"));
151
+ var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/get"));
152
152
 
153
- var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
153
+ var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/modify"));
154
154
 
155
- var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
155
+ var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
156
156
 
157
- var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
157
+ var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/runScoped"));
158
158
 
159
- var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
159
+ var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
160
160
 
161
- var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/SinkEndReason"));
161
+ var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
162
162
 
163
- var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
163
+ var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
164
164
 
165
- var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
165
+ var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/SinkEndReason"));
166
166
 
167
- var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/core-scope"));
167
+ var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/join"));
168
168
 
169
- var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/runScoped"));
169
+ var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
170
170
 
171
- var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/Take"));
171
+ var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/core-scope"));
172
172
 
173
- var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/operations"));
173
+ var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
174
174
 
175
- var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
175
+ var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/Take"));
176
176
 
177
- var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
177
+ var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/operations"));
178
178
 
179
- var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
179
+ var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
180
180
 
181
- var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
181
+ var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/constructors"));
182
182
 
183
- var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Hub/api"));
183
+ var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
184
184
 
185
- var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/replicate"));
185
+ var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
186
186
 
187
- var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
187
+ var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Hub/api"));
188
188
 
189
- var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
189
+ var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/replicate"));
190
190
 
191
- var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
191
+ var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
192
192
 
193
- var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/get"));
193
+ var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
194
194
 
195
- var tsplus_module_36 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
195
+ var tsplus_module_36 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
196
196
 
197
- var tsplus_module_37 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/constructors"));
197
+ var tsplus_module_37 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
198
198
 
199
- var tsplus_module_38 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/DebounceState"));
199
+ var tsplus_module_38 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/Iterable/constructors"));
200
200
 
201
- var tsplus_module_39 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/join"));
201
+ var tsplus_module_39 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/constructors"));
202
202
 
203
- var tsplus_module_40 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Clock/api"));
203
+ var tsplus_module_40 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/DebounceState"));
204
204
 
205
- var tsplus_module_41 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/HashMap/api"));
205
+ var tsplus_module_41 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Clock/api"));
206
206
 
207
- var tsplus_module_42 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/api"));
207
+ var tsplus_module_42 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/HashMap/api"));
208
208
 
209
- var tsplus_module_43 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/STM/api"));
209
+ var tsplus_module_43 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/api"));
210
210
 
211
- var tsplus_module_44 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/constructors"));
211
+ var tsplus_module_44 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/STM/api"));
212
212
 
213
- var tsplus_module_45 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Sink/api"));
213
+ var tsplus_module_45 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/TSemaphore/constructors"));
214
214
 
215
- var tsplus_module_46 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Predicate/api"));
215
+ var tsplus_module_46 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Sink/api"));
216
216
 
217
- var tsplus_module_47 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/poll"));
217
+ var tsplus_module_47 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Predicate/api"));
218
218
 
219
- var tsplus_module_48 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/environment"));
219
+ var tsplus_module_48 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/poll"));
220
220
 
221
- var tsplus_module_49 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/collection/immutable/Conc/findIO"));
221
+ var tsplus_module_49 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/environment"));
222
222
 
223
- var tsplus_module_50 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/definition"));
223
+ var tsplus_module_50 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/collection/immutable/Conc/findIO"));
224
224
 
225
- var tsplus_module_51 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/Pull"));
225
+ var tsplus_module_51 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/definition"));
226
226
 
227
- var tsplus_module_52 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/takeBetween"));
227
+ var tsplus_module_52 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/internal/Pull"));
228
228
 
229
- var tsplus_module_53 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/interruptWhen"));
229
+ var tsplus_module_53 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Queue/api/takeBetween"));
230
230
 
231
- var tsplus_module_54 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/collection/immutable/Conc/mapIO"));
231
+ var tsplus_module_54 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/interruptWhen"));
232
232
 
233
233
  var tsplus_module_55 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/mapOutIOC"));
234
234
 
@@ -246,15 +246,13 @@ var tsplus_module_61 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/requir
246
246
 
247
247
  var tsplus_module_62 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/exceptions"));
248
248
 
249
- var tsplus_module_63 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/collection/immutable/Conc/takeWhileIO"));
250
-
251
- var tsplus_module_64 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
249
+ var tsplus_module_63 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Channel/api/toPull"));
252
250
 
253
251
  var _function = /*#__PURE__*/require("@fncts/base/data/function");
254
252
 
255
- var _definition2 = /*#__PURE__*/require("./definition.js");
253
+ var _definition2 = /*#__PURE__*/require("./definition.cjs");
256
254
 
257
- var _SinkEndReason2 = /*#__PURE__*/require("./internal/SinkEndReason.js");
255
+ var _SinkEndReason2 = /*#__PURE__*/require("./internal/SinkEndReason.cjs");
258
256
 
259
257
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
260
258
 
@@ -331,12 +329,6 @@ const halt = halt_1;
331
329
  exports.halt = halt;
332
330
  const interleaveWith_ = interleaveWith_1;
333
331
  exports.interleaveWith_ = interleaveWith_;
334
- const loopOnChunks_ = loopOnChunks_1;
335
- exports.loopOnChunks_ = loopOnChunks_;
336
- const loopOnPartialChunks_ = loopOnPartialChunks_1;
337
- exports.loopOnPartialChunks_ = loopOnPartialChunks_;
338
- const loopOnPartialChunksElements_ = loopOnPartialChunksElements_1;
339
- exports.loopOnPartialChunksElements_ = loopOnPartialChunksElements_;
340
332
  const map_ = map_1;
341
333
  exports.map_ = map_;
342
334
  const mapAccumIO_ = mapAccumIO_1;
@@ -414,7 +406,7 @@ exports.unwrapScoped = unwrapScoped;
414
406
  * @tsplus getter fncts.io.Stream absolve
415
407
  */
416
408
  function absolve(self) {
417
- return mapIO_1(self, either => tsplus_module_1.fromEither(() => either, fileName_1 + ":24:46"));
409
+ return mapIO_1(self, either => tsplus_module_1.fromEither(() => either, fileName_1 + ":25:46"));
418
410
  }
419
411
  /**
420
412
  * Aggregates elements of this stream using the provided sink for as long
@@ -462,44 +454,56 @@ function aggregateAsyncWithin_1(stream, sink, schedule) {
462
454
 
463
455
 
464
456
  function aggregateAsyncWithinEither_1(stream, sink, schedule) {
465
- const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new _SinkEndReason2.SinkEnd()), tsplus_module_6.make(() => tsplus_module_7.empty()), tsplus_module_8.driver(schedule));
466
- return flatMap_1(fromIO_1(deps), ([handoff, sinkEndReason, sinkLeftovers, scheduleDriver]) => {
467
- const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.emit(_in))), handoffProducer), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), _ => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))));
468
- const handoffConsumer = tsplus_module_10.unwrap(tsplus_module_1.flatMap_(tsplus_module_14.getAndSet_(sinkLeftovers, tsplus_module_7.empty()), leftovers => {
469
- if (tsplus_module_12.isEmpty(leftovers)) {
470
- return tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(leftovers), handoffConsumer), fileName_1 + ":100:31");
457
+ const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new _SinkEndReason2.ScheduleEnd()), tsplus_module_6.make(() => tsplus_module_7.empty()), tsplus_module_8.driver(schedule), tsplus_module_6.make(() => false));
458
+ return flatMap_1(fromIO_1(deps), ([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed]) => {
459
+ const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.emit(_in))), handoffProducer), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), _ => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))));
460
+ const handoffConsumer = tsplus_module_10.unwrap(() => tsplus_module_1.flatMap_(tsplus_module_15.getAndSet_(sinkLeftovers, tsplus_module_7.empty()), leftovers => {
461
+ if (tsplus_module_12.isNonEmpty(leftovers)) {
462
+ return tsplus_module_1.apSecond_(tsplus_module_13.set_(consumed, true), tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(leftovers), handoffConsumer), fileName_1 + ":101:52"), fileName_1 + ":101:38");
471
463
  } else {
472
464
  return tsplus_module_1.map_(tsplus_module_5.take(handoff), signal => tsplus_module_5.matchSignal_(signal, {
473
465
  Emit: ({
474
466
  els
475
- }) => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(els), handoffConsumer),
467
+ }) => tsplus_module_11.apSecond_(tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_13.set_(consumed, true)), tsplus_module_10.writeNow(els)), handoffConsumer),
476
468
  Halt: ({
477
469
  error
478
470
  }) => tsplus_module_11.failCause(() => error),
479
471
  End: ({
480
472
  reason
481
- }) => tsplus_module_10.fromIO(tsplus_module_13.set_(sinkEndReason, reason))
482
- }), fileName_1 + ":102:34");
473
+ }) => {
474
+ if (reason._tag === "ScheduleEnd"
475
+ /* SinkEndReasonTag.ScheduleEnd */
476
+ ) {
477
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_14.get(consumed), p => p ? tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, new _SinkEndReason2.ScheduleEnd())) : tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, new _SinkEndReason2.ScheduleEnd())), handoffConsumer), fileName_1 + ":110:37"));
478
+ } else {
479
+ return tsplus_module_10.fromIO(() => tsplus_module_13.set_(sinkEndReason, reason));
480
+ }
481
+ }
482
+ }), fileName_1 + ":103:34");
483
483
  }
484
- }, fileName_1 + ":98:55"));
485
-
486
- const scheduledAggregator = lastB => {
487
- const timeout = tsplus_module_1.matchCauseIO_(scheduleDriver.next(lastB, fileName_1 + ":116:42"), _ => tsplus_module_4.match_(tsplus_module_15.failureOrCause(_), () => tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.ScheduleTimeout())), cause => tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), c => tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.ScheduleEnd(c))), fileName_1 + ":116:62");
488
- return tsplus_module_11.flatMap_(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_21.forkScoped(timeout), fiber => {
489
- return tsplus_module_11.flatMap_(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail_(handoffConsumer, sink.channel)), ([leftovers, b]) => {
490
- return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_1.apSecond_(tsplus_module_20.interrupt(fiber), tsplus_module_13.set_(sinkLeftovers, tsplus_module_12.flatten(leftovers)), fileName_1 + ":128:59")), tsplus_module_10.unwrap(tsplus_module_14.modify_(sinkEndReason, reason => tsplus_module_19.matchSinkEndReason_(reason, {
491
- ScheduleEnd: ({
492
- c
493
- }) => (0, _function.tuple)(tsplus_module_10.as_(tsplus_module_10.writeNow(tsplus_module_18.from([tsplus_module_17.right(b), tsplus_module_17.left(c)])), () => tsplus_module_3.just(b)), new _SinkEndReason2.SinkEnd()),
494
- ScheduleTimeout: () => (0, _function.tuple)(tsplus_module_10.as_(tsplus_module_10.writeNow(tsplus_module_18.single(tsplus_module_17.right(b))), () => tsplus_module_3.just(b)), new _SinkEndReason2.SinkEnd()),
495
- SinkEnd: () => (0, _function.tuple)(tsplus_module_10.as_(tsplus_module_10.writeNow(tsplus_module_18.single(tsplus_module_17.right(b))), () => tsplus_module_3.just(b)), new _SinkEndReason2.SinkEnd()),
496
- UpstreamEnd: () => (0, _function.tuple)(tsplus_module_10.as_(tsplus_module_10.writeNow(tsplus_module_18.single(tsplus_module_17.right(b))), () => tsplus_module_3.nothing()), new _SinkEndReason2.UpstreamEnd())
497
- }))));
498
- });
499
- }, fileName_1 + ":126:31")), _ => tsplus_module_16.match_(_, () => tsplus_module_10.unit, () => scheduledAggregator(_)));
484
+ }, fileName_1 + ":99:55"));
485
+
486
+ function timeout(lastB) {
487
+ return scheduleDriver.next(lastB, fileName_1 + ":127:33");
488
+ }
489
+
490
+ const scheduledAggregator = (sinkFiber, scheduleFiber) => {
491
+ const forkSink = tsplus_module_1.apSecond_(tsplus_module_13.set_(consumed, false), tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail_(handoffConsumer, sink.channel)))), fileName_1 + ":135:30");
492
+
493
+ function handleSide(leftovers, b, c) {
494
+ return tsplus_module_10.unwrap(() => tsplus_module_1.apSecond_(tsplus_module_13.set_(sinkLeftovers, tsplus_module_12.flatten(leftovers)), tsplus_module_1.map_(tsplus_module_14.get(sinkEndReason), reason => tsplus_module_21.matchSinkEndReason_(reason, {
495
+ ScheduleEnd: () => tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(tsplus_module_14.get(consumed), consumed_ => tsplus_module_1.flatMap_(forkSink, sinkFiber => tsplus_module_1.map_(tsplus_module_16.forkScoped(timeout(tsplus_module_3.just(b))), scheduleFiber => {
496
+ const toWrite = tsplus_module_20.match_(c, () => tsplus_module_19.make(tsplus_module_18.right(b)), c => tsplus_module_19.make(tsplus_module_18.right(b), tsplus_module_18.left(c)));
497
+ return consumed_ ? tsplus_module_11.apSecond_(tsplus_module_10.write(() => toWrite), scheduledAggregator(sinkFiber, scheduleFiber)) : scheduledAggregator(sinkFiber, scheduleFiber);
498
+ }, fileName_1 + ":147:46"), fileName_1 + ":146:46"), fileName_1 + ":145:46")),
499
+ UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_14.get(consumed), p => p ? tsplus_module_10.write(() => tsplus_module_19.make(tsplus_module_18.right(b))) : tsplus_module_10.unit, fileName_1 + ":158:50"))
500
+ }), fileName_1 + ":140:34"), fileName_1 + ":139:49"));
501
+ }
502
+
503
+ return tsplus_module_10.unwrap(() => tsplus_module_24.raceWith_(tsplus_module_22.join(sinkFiber), () => tsplus_module_22.join(scheduleFiber), (sinkExit, scheduleFiber) => tsplus_module_1.apSecond_(tsplus_module_23.interrupt(scheduleFiber), tsplus_module_1.map_(tsplus_module_1.fromExit(() => sinkExit, fileName_1 + ":169:24"), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":169:38"), fileName_1 + ":168:38"), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO_(tsplus_module_1.fromExit(() => scheduleExit, fileName_1 + ":171:24"), cause => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), () => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.ScheduleEnd()))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":176:39"), fileName_1 + ":175:85"), cause => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing()), fileName_1 + ":179:39"), fileName_1 + ":178:74")), c => tsplus_module_1.apSecond_(tsplus_module_24.forkDaemon(tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.ScheduleEnd()))), tsplus_module_1.map_(tsplus_module_22.join(sinkFiber), ([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.just(c)), fileName_1 + ":183:35"), fileName_1 + ":182:81"), fileName_1 + ":171:51"), fileName_1 + ":165:32"));
500
504
  };
501
505
 
502
- return apSecond_1(scoped_1(tsplus_module_22.forkDaemon(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(stream.channel, handoffProducer)))), new _definition2.Stream(scheduledAggregator(tsplus_module_3.nothing())));
506
+ return unwrapScoped_1(tsplus_module_1.flatMap_(tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, handoffProducer))), () => tsplus_module_1.flatMap_(tsplus_module_16.forkScoped(tsplus_module_17.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail_(handoffConsumer, sink.channel)))), sinkFiber => tsplus_module_1.map_(tsplus_module_16.forkScoped(timeout(tsplus_module_3.nothing())), scheduleFiber => new _definition2.Stream(scheduledAggregator(sinkFiber, scheduleFiber)), fileName_1 + ":193:32"), fileName_1 + ":192:32"), fileName_1 + ":191:10"));
503
507
  });
504
508
  }
505
509
  /**
@@ -542,13 +546,13 @@ function as_(stream, b) {
542
546
 
543
547
 
544
548
  function asyncInterrupt_1(register, outputBuffer = 16) {
545
- return unwrapScoped_1(tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeBounded(outputBuffer), queue => tsplus_module_25.shutdown(queue)), output => tsplus_module_1.flatMap_(tsplus_module_26.runtime(fileName_1 + ":208:40"), runtime => tsplus_module_1.map_(tsplus_module_1.succeed(() => register((k, cb) => {
546
- const effect = tsplus_module_1.flatMap_(tsplus_module_24.fromPull(k), a => tsplus_module_25.offer_(output, a), fileName_1 + ":212:52");
547
- return runtime.unsafeRunAsyncWith(effect, cb || _function.constVoid, fileName_1 + ":213:46");
548
- }), fileName_1 + ":210:19"), eitherStream => tsplus_module_4.match_(eitherStream, canceler => {
549
- const loop = tsplus_module_10.unwrap(tsplus_module_1.match_(tsplus_module_1.flatMap_(tsplus_module_25.take(output), take => tsplus_module_24.done(take), fileName_1 + ":221:23"), maybeError => tsplus_module_16.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), as => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":222:21"));
549
+ return unwrapScoped_1(tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(outputBuffer), queue => tsplus_module_27.shutdown(queue)), output => tsplus_module_1.flatMap_(tsplus_module_28.runtime(fileName_1 + ":249:40"), runtime => tsplus_module_1.map_(tsplus_module_1.succeed(() => register((k, cb) => {
550
+ const effect = tsplus_module_1.flatMap_(tsplus_module_26.fromPull(k), a => tsplus_module_27.offer_(output, a), fileName_1 + ":253:52");
551
+ return runtime.unsafeRunAsyncWith(effect, cb || _function.constVoid, fileName_1 + ":254:46");
552
+ }), fileName_1 + ":251:19"), eitherStream => tsplus_module_4.match_(eitherStream, canceler => {
553
+ const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match_(tsplus_module_1.flatMap_(tsplus_module_27.take(output), take => tsplus_module_26.done(take), fileName_1 + ":262:23"), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), as => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":263:21"));
550
554
  return ensuring_1(new _definition2.Stream(loop), canceler);
551
- }, stream => unwrap_1(tsplus_module_1.as_(tsplus_module_25.shutdown(output), () => stream))), fileName_1 + ":209:29"), fileName_1 + ":208:29"), fileName_1 + ":207:29"));
555
+ }, stream => unwrap_1(tsplus_module_1.as_(tsplus_module_27.shutdown(output), () => stream))), fileName_1 + ":250:29"), fileName_1 + ":249:29"), fileName_1 + ":248:29"));
552
556
  }
553
557
  /**
554
558
  * Creates a stream from an asynchronous callback that can be called multiple times.
@@ -561,7 +565,7 @@ function asyncInterrupt_1(register, outputBuffer = 16) {
561
565
 
562
566
 
563
567
  function asyncMaybe_1(register, outputBuffer = 16) {
564
- return asyncInterrupt_1(k => tsplus_module_16.match_(register(k), () => tsplus_module_17.left(tsplus_module_1.unit), tsplus_module_17.right), outputBuffer);
568
+ return asyncInterrupt_1(k => tsplus_module_20.match_(register(k), () => tsplus_module_18.left(tsplus_module_1.unit), tsplus_module_18.right), outputBuffer);
565
569
  }
566
570
  /**
567
571
  * @tsplus static fncts.io.StreamOps async
@@ -580,10 +584,10 @@ function async(register, outputBuffer = 16) {
580
584
 
581
585
 
582
586
  function asyncIO(register, outputBuffer = 16) {
583
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeBounded(outputBuffer), _ => tsplus_module_25.shutdown(_)), output => tsplus_module_1.flatMap_(tsplus_module_26.runtime(fileName_1 + ":278:37"), runtime => tsplus_module_1.map_(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap_(tsplus_module_24.fromPull(k), a => tsplus_module_25.offer_(output, a), fileName_1 + ":282:39"), cb || _function.constVoid, fileName_1 + ":281:39")), () => {
584
- const loop = tsplus_module_10.unwrap(tsplus_module_1.matchCauseIO_(tsplus_module_1.flatMap_(tsplus_module_25.take(output), take => tsplus_module_24.done(take), fileName_1 + ":289:21"), cause => tsplus_module_1.as_(tsplus_module_25.shutdown(output), () => tsplus_module_4.match_(tsplus_module_15.failureOrCause(cause), maybeError => tsplus_module_16.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), tsplus_module_11.failCauseNow)), as => tsplus_module_1.succeed(() => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":298:33"), fileName_1 + ":290:26"));
587
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(outputBuffer), _ => tsplus_module_27.shutdown(_)), output => tsplus_module_1.flatMap_(tsplus_module_28.runtime(fileName_1 + ":319:37"), runtime => tsplus_module_1.map_(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap_(tsplus_module_26.fromPull(k), a => tsplus_module_27.offer_(output, a), fileName_1 + ":323:39"), cb || _function.constVoid, fileName_1 + ":322:39")), () => {
588
+ const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO_(tsplus_module_1.flatMap_(tsplus_module_27.take(output), take => tsplus_module_26.done(take), fileName_1 + ":330:21"), cause => tsplus_module_1.as_(tsplus_module_27.shutdown(output), () => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow), tsplus_module_11.failCauseNow)), as => tsplus_module_1.succeed(() => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(as), loop), fileName_1 + ":339:33"), fileName_1 + ":331:26"));
585
589
  return loop;
586
- }), fileName_1 + ":278:26"), fileName_1 + ":277:26")));
590
+ }), fileName_1 + ":319:26"), fileName_1 + ":318:26")));
587
591
  }
588
592
  /**
589
593
  * Returns a stream whose failure and success channels have been mapped by
@@ -603,7 +607,7 @@ function bimap_(stream, f, g) {
603
607
 
604
608
 
605
609
  function acquireRelease_(acquire, release) {
606
- return scoped_1(tsplus_module_28.acquireRelease(() => acquire, release));
610
+ return scoped_1(tsplus_module_30.acquireRelease(() => acquire, release));
607
611
  }
608
612
  /**
609
613
  * Creates a stream from a single value that will get cleaned up after the
@@ -614,7 +618,7 @@ function acquireRelease_(acquire, release) {
614
618
 
615
619
 
616
620
  function acquireReleaseExit_(acquire, release) {
617
- return scoped_1(tsplus_module_29.acquireReleaseExit(() => acquire, release, fileName_1 + ":338:45"));
621
+ return scoped_1(tsplus_module_31.acquireReleaseExit(() => acquire, release, fileName_1 + ":379:45"));
618
622
  }
619
623
  /**
620
624
  * Fan out the stream, producing a list of streams that have the same elements as this stream.
@@ -626,7 +630,7 @@ function acquireReleaseExit_(acquire, release) {
626
630
 
627
631
 
628
632
  function broadcast_(stream, n, maximumLag) {
629
- return tsplus_module_1.map_(broadcastedQueues_1(stream, n, maximumLag), c => tsplus_module_12.map_(c, hub => flattenTake_1(fromQueueWithShutdown_1(hub))), fileName_1 + ":355:9");
633
+ return tsplus_module_1.map_(broadcastedQueues_1(stream, n, maximumLag), c => tsplus_module_12.map_(c, hub => flattenTake_1(fromQueueWithShutdown_1(hub))), fileName_1 + ":396:9");
630
634
  }
631
635
  /**
632
636
  * Fan out the stream, producing a dynamic number of streams that have the same elements as this stream.
@@ -638,7 +642,7 @@ function broadcast_(stream, n, maximumLag) {
638
642
 
639
643
 
640
644
  function broadcastDynamic_(stream, maximumLag) {
641
- return tsplus_module_1.map_(broadcastedQueuesDynamic_1(stream, maximumLag), scoped => flattenTake_1(flatMap_1(scoped_1(scoped), fromQueue_1)), fileName_1 + ":371:9");
645
+ return tsplus_module_1.map_(broadcastedQueuesDynamic_1(stream, maximumLag), scoped => flattenTake_1(flatMap_1(scoped_1(scoped), fromQueue_1)), fileName_1 + ":412:9");
642
646
  }
643
647
  /**
644
648
  * Converts the stream to a managed list of queues. Every value will be replicated to every queue with the
@@ -651,7 +655,7 @@ function broadcastDynamic_(stream, maximumLag) {
651
655
 
652
656
 
653
657
  function broadcastedQueues_1(stream, n, maximumLag) {
654
- return tsplus_module_1.flatMap_(tsplus_module_30.makeBounded(maximumLag), hub => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_31.replicate(n, tsplus_module_30.subscribe(hub))), queues => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => queues), fileName_1 + ":389:21"), fileName_1 + ":388:21");
658
+ return tsplus_module_1.flatMap_(tsplus_module_32.makeBounded(maximumLag), hub => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_33.replicate(n, tsplus_module_32.subscribe(hub))), queues => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => queues), fileName_1 + ":430:21"), fileName_1 + ":429:21");
655
659
  }
656
660
  /**
657
661
  * Converts the stream to a managed dynamic amount of queues. Every chunk will be replicated to every queue with the
@@ -664,7 +668,7 @@ function broadcastedQueues_1(stream, n, maximumLag) {
664
668
 
665
669
 
666
670
  function broadcastedQueuesDynamic_1(stream, maximumLag) {
667
- return tsplus_module_1.map_(toHub_1(stream, maximumLag), hub => tsplus_module_30.subscribe(hub), fileName_1 + ":407:38");
671
+ return tsplus_module_1.map_(toHub_1(stream, maximumLag), hub => tsplus_module_32.subscribe(hub), fileName_1 + ":448:38");
668
672
  }
669
673
  /**
670
674
  * Allows a faster producer to progress independently of a slower consumer by buffering
@@ -677,9 +681,9 @@ function broadcastedQueuesDynamic_1(stream, maximumLag) {
677
681
  function buffer_(stream, capacity) {
678
682
  const queue = toQueueOfElements_1(stream, capacity);
679
683
  return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
680
- const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_25.take(queue)), exit => tsplus_module_32.match_(exit, cause => tsplus_module_16.match_(tsplus_module_15.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_18.single(value)), process)));
684
+ const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), exit => tsplus_module_34.match_(exit, cause => tsplus_module_20.match_(tsplus_module_25.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(value)), process)));
681
685
  return process;
682
- }, fileName_1 + ":420:16")));
686
+ }, fileName_1 + ":461:16")));
683
687
  }
684
688
  /**
685
689
  * @tsplus fluent fncts.io.Stream bufferChunks
@@ -689,9 +693,9 @@ function buffer_(stream, capacity) {
689
693
  function bufferChunks_(stream, capacity) {
690
694
  const queue = toQueue_1(stream, capacity);
691
695
  return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
692
- const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_25.take(queue)), take => tsplus_module_24.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
696
+ const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), take => tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
693
697
  return process;
694
- }, fileName_1 + ":442:16")));
698
+ }, fileName_1 + ":483:16")));
695
699
  }
696
700
  /**
697
701
  * Allows a faster producer to progress independently of a slower consumer by buffering
@@ -704,19 +708,19 @@ function bufferChunks_(stream, capacity) {
704
708
  function bufferUnbounded(stream) {
705
709
  const queue = toQueueUnbounded_1(stream);
706
710
  return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(queue, queue => {
707
- const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_25.take(queue)), take => tsplus_module_24.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
711
+ const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), take => tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process)));
708
712
  return process;
709
- }, fileName_1 + ":467:16")));
713
+ }, fileName_1 + ":508:16")));
710
714
  }
711
715
 
712
716
  function bufferSignalProducer(queue, ref) {
713
- const terminate = take => tsplus_module_10.fromIO(tsplus_module_1.flatMap_(tsplus_module_35.get(ref), latch => tsplus_module_1.flatMap_(tsplus_module_33.wait(latch), () => tsplus_module_1.flatMap_(tsplus_module_34.make(), p => tsplus_module_1.flatMap_(tsplus_module_25.offer_(queue, (0, _function.tuple)(take, p)), () => tsplus_module_1.flatMap_(tsplus_module_13.set_(ref, p), () => tsplus_module_1.map_(tsplus_module_33.wait(p), () => void 0), fileName_1 + ":493:10"), fileName_1 + ":492:10"), fileName_1 + ":491:20"), fileName_1 + ":490:10"), fileName_1 + ":489:24"));
717
+ const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap_(tsplus_module_14.get(ref), latch => tsplus_module_1.flatMap_(tsplus_module_35.wait(latch), () => tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, (0, _function.tuple)(take, p)), () => tsplus_module_1.flatMap_(tsplus_module_13.set_(ref, p), () => tsplus_module_1.map_(tsplus_module_35.wait(p), () => void 0), fileName_1 + ":534:10"), fileName_1 + ":533:10"), fileName_1 + ":532:20"), fileName_1 + ":531:10"), fileName_1 + ":530:24"));
714
718
 
715
- return tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_1.flatMap_(tsplus_module_34.make(), p => tsplus_module_1.flatMap_(tsplus_module_25.offer_(queue, (0, _function.tuple)(tsplus_module_24.chunk(inp), p)), added => tsplus_module_1.map_(tsplus_module_1.when_(tsplus_module_13.set_(ref, p), () => added, fileName_1 + ":503:28"), () => void 0), fileName_1 + ":502:26"), fileName_1 + ":501:26")), bufferSignalProducer(queue, ref)), e => terminate(tsplus_module_24.fail(e)), () => terminate(tsplus_module_24.end));
719
+ return tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, (0, _function.tuple)(tsplus_module_26.chunk(inp), p)), added => tsplus_module_1.map_(tsplus_module_1.when_(tsplus_module_13.set_(ref, p), () => added, fileName_1 + ":544:28"), () => void 0), fileName_1 + ":543:26"), fileName_1 + ":542:26")), bufferSignalProducer(queue, ref)), e => terminate(tsplus_module_26.fail(e)), () => terminate(tsplus_module_26.end));
716
720
  }
717
721
 
718
722
  function bufferSignalConsumer(queue) {
719
- const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_25.take(queue)), ([take, promise]) => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_33.succeed_(promise, undefined)), tsplus_module_24.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process))));
723
+ const process = tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_27.take(queue)), ([take, promise]) => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_35.succeed_(promise, undefined)), tsplus_module_26.match_(take, tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(value), process))));
720
724
  return process;
721
725
  }
722
726
  /**
@@ -728,7 +732,7 @@ function bufferSignalConsumer(queue) {
728
732
 
729
733
 
730
734
  function catchAll_1(stream, f) {
731
- return catchAllCause_1(stream, cause => tsplus_module_4.match_(tsplus_module_15.failureOrCause(cause), f, failCauseNow_1));
735
+ return catchAllCause_1(stream, cause => tsplus_module_4.match_(tsplus_module_25.failureOrCause(cause), f, failCauseNow_1));
732
736
  }
733
737
  /**
734
738
  * Switches over to the stream produced by the provided function in case this one
@@ -752,7 +756,7 @@ function catchAllCause_1(stream, f) {
752
756
 
753
757
 
754
758
  function catchJust_(stream, pf) {
755
- return catchAll_1(stream, e => tsplus_module_36.getOrElse_(pf(e), () => failNow_1(e)));
759
+ return catchAll_1(stream, e => tsplus_module_37.getOrElse_(pf(e), () => failNow_1(e)));
756
760
  }
757
761
  /**
758
762
  * Switches over to the stream produced by the provided function in case this one
@@ -764,7 +768,7 @@ function catchJust_(stream, pf) {
764
768
 
765
769
 
766
770
  function catchJustCause_(stream, pf) {
767
- return catchAllCause_1(stream, cause => tsplus_module_36.getOrElse_(pf(cause), () => failCauseNow_1(cause)));
771
+ return catchAllCause_1(stream, cause => tsplus_module_37.getOrElse_(pf(cause), () => failCauseNow_1(cause)));
768
772
  }
769
773
  /**
770
774
  * Returns a stream made of the concatenation in strict order of all the streams
@@ -785,12 +789,12 @@ function flatMap_1(stream, f) {
785
789
 
786
790
 
787
791
  function chunks(stream) {
788
- return mapChunks_1(stream, tsplus_module_18.single);
792
+ return mapChunks_1(stream, tsplus_module_19.single);
789
793
  }
790
794
 
791
795
  function changesWithWriter(f, last) {
792
796
  return tsplus_module_10.readWithCause(chunk => {
793
- const [newLast, newChunk] = tsplus_module_12.foldLeft_(chunk, [last, tsplus_module_7.empty()], ([maybeLast, os], o1) => tsplus_module_16.match_(maybeLast, () => [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)], o => f(o, o1) ? [tsplus_module_3.just(o1), os] : [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)]));
797
+ const [newLast, newChunk] = tsplus_module_12.foldLeft_(chunk, [last, tsplus_module_7.empty()], ([maybeLast, os], o1) => tsplus_module_20.match_(maybeLast, () => [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)], o => f(o, o1) ? [tsplus_module_3.just(o1), os] : [tsplus_module_3.just(o1), tsplus_module_12.append_(os, o1)]));
794
798
  return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(newChunk), changesWithWriter(f, newLast));
795
799
  }, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
796
800
  }
@@ -831,23 +835,21 @@ function collectWhile_(stream, pf) {
831
835
 
832
836
 
833
837
  function collectWhileIO_(stream, pf) {
834
- return loopOnPartialChunks_1(stream, (chunk, emit) => {
835
- const pfJust = a => tsplus_module_16.match_(pf(a), () => tsplus_module_1.succeedNow(false, fileName_1 + ":675:28"), effect => tsplus_module_1.as_(tsplus_module_1.flatMap_(effect, emit, fileName_1 + ":676:35"), () => true));
838
+ return new _definition2.Stream(tsplus_module_10.pipeTo_(stream.channel, collectWhileIOLoop(tsplus_module_38.empty()[Symbol.iterator](), pf)));
839
+ }
836
840
 
837
- const loop = chunk => {
838
- if (tsplus_module_12.isEmpty(chunk)) {
839
- return tsplus_module_1.succeedNow(true, fileName_1 + ":681:29");
840
- } else {
841
- return tsplus_module_1.flatMap_(pfJust(tsplus_module_12.unsafeHead(chunk)), cont => cont ? loop(tsplus_module_12.unsafeTail(chunk)) : tsplus_module_1.succeedNow(false, fileName_1 + ":683:105"), fileName_1 + ":683:48");
842
- }
843
- };
841
+ function collectWhileIOLoop(iterator, pf) {
842
+ const next = iterator.next();
844
843
 
845
- return loop(chunk);
846
- });
844
+ if (next.done) {
845
+ return tsplus_module_10.readWithCause(elem => collectWhileIOLoop(elem[Symbol.iterator](), pf), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
846
+ } else {
847
+ return tsplus_module_10.unwrap(() => tsplus_module_20.match_(pf(next.value), () => tsplus_module_1.succeedNow(tsplus_module_10.unit, fileName_1 + ":730:28"), b => tsplus_module_1.map_(b, b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), collectWhileIOLoop(iterator, pf)), fileName_1 + ":731:21")));
848
+ }
847
849
  }
848
850
 
849
851
  function combineProducer(handoff, latch) {
850
- return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_37.succeed(value))), combineProducer(handoff, latch)), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_37.failCause(tsplus_module_15.map_(cause, tsplus_module_3.just)))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_37.fail(tsplus_module_3.nothing()))), combineProducer(handoff, latch))));
852
+ return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.succeed(value))), combineProducer(handoff, latch)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.failCause(tsplus_module_25.map_(cause, tsplus_module_3.just)))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_39.fail(tsplus_module_3.nothing()))), combineProducer(handoff, latch))));
851
853
  }
852
854
  /**
853
855
  * Combines the elements from this stream and the specified stream by repeatedly applying the
@@ -862,15 +864,15 @@ function combineProducer(handoff, latch) {
862
864
 
863
865
 
864
866
  function combine_(stream, that, s, f) {
865
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), combineProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(that.channel, tsplus_module_10.writeChunk), combineProducer(right, latchR)))), () => (0, _function.tuple)(left, right, latchL, latchR)), fileName_1 + ":731:10"), fileName_1 + ":730:25"), fileName_1 + ":729:25"), fileName_1 + ":728:25"), fileName_1 + ":727:25"), ([left, right, latchL, latchR]) => {
866
- const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":735:59"), tsplus_module_1.fromExitNow, fileName_1 + ":735:78");
867
- const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":736:59"), tsplus_module_1.fromExitNow, fileName_1 + ":736:79");
868
- return unfoldIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, fileName_1 + ":737:100")), fileName_1 + ":737:75")).channel;
869
- }, fileName_1 + ":734:13")));
867
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), combineProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(that.channel, tsplus_module_10.writeChunk), combineProducer(right, latchR)))), () => (0, _function.tuple)(left, right, latchL, latchR)), fileName_1 + ":777:10"), fileName_1 + ":776:25"), fileName_1 + ":775:25"), fileName_1 + ":774:25"), fileName_1 + ":773:25"), ([left, right, latchL, latchR]) => {
868
+ const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":781:59"), tsplus_module_1.fromExitNow, fileName_1 + ":781:78");
869
+ const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":782:59"), tsplus_module_1.fromExitNow, fileName_1 + ":782:79");
870
+ return unfoldIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, fileName_1 + ":783:100")), fileName_1 + ":783:75")).channel;
871
+ }, fileName_1 + ":780:13")));
870
872
  }
871
873
 
872
874
  function combineChunksProducer(handoff, latch) {
873
- return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(chunk => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.chunk(chunk))), combineChunksProducer(handoff, latch)), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.failCause(cause))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.end)), combineChunksProducer(handoff, latch))));
875
+ return tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)), tsplus_module_10.readWithCause(chunk => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.chunk(chunk))), combineChunksProducer(handoff, latch)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.failCause(cause))), () => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.end)), combineChunksProducer(handoff, latch))));
874
876
  }
875
877
  /**
876
878
  * Combines the chunks from this stream and the specified stream by repeatedly applying the
@@ -883,11 +885,11 @@ function combineChunksProducer(handoff, latch) {
883
885
 
884
886
 
885
887
  function combineChunks_(stream, that, s, f) {
886
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(stream.channel, combineChunksProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(that.channel, combineChunksProducer(right, latchR)))), () => (0, _function.tuple)(left, right, latchL, latchR)), fileName_1 + ":782:10"), fileName_1 + ":781:25"), fileName_1 + ":780:25"), fileName_1 + ":779:25"), fileName_1 + ":778:25"), ([left, right, latchL, latchR]) => {
887
- const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":788:20"), take => tsplus_module_24.done(take), fileName_1 + ":789:19");
888
- const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":792:20"), take => tsplus_module_24.done(take), fileName_1 + ":793:19");
889
- return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, fileName_1 + ":794:102")), fileName_1 + ":794:80")).channel;
890
- }, fileName_1 + ":785:13")));
888
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchL => tsplus_module_1.flatMap_(tsplus_module_5.make(), latchR => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, combineChunksProducer(left, latchL)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(that.channel, combineChunksProducer(right, latchR)))), () => (0, _function.tuple)(left, right, latchL, latchR)), fileName_1 + ":828:10"), fileName_1 + ":827:25"), fileName_1 + ":826:25"), fileName_1 + ":825:25"), fileName_1 + ":824:25"), ([left, right, latchL, latchR]) => {
889
+ const pullLeft = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchL, undefined), tsplus_module_5.take(left), fileName_1 + ":834:20"), take => tsplus_module_26.done(take), fileName_1 + ":835:19");
890
+ const pullRight = tsplus_module_1.flatMap_(tsplus_module_1.apSecond_(tsplus_module_5.offer(latchR, undefined), tsplus_module_5.take(right), fileName_1 + ":838:20"), take => tsplus_module_26.done(take), fileName_1 + ":839:19");
891
+ return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap_(f(s, pullLeft, pullRight), exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, fileName_1 + ":840:102")), fileName_1 + ":840:80")).channel;
892
+ }, fileName_1 + ":831:13")));
891
893
  }
892
894
  /**
893
895
  * Concatenates the specified stream with this stream, resulting in a stream
@@ -940,51 +942,51 @@ function contramapEnvironment_(ra, f) {
940
942
 
941
943
 
942
944
  function debounce_(stream, duration) {
943
- return unwrap_1(tsplus_module_22.transplant(grafter => tsplus_module_1.map_(tsplus_module_5.make(), handoff => {
945
+ return unwrap_1(tsplus_module_24.transplant(grafter => tsplus_module_1.map_(tsplus_module_5.make(), handoff => {
944
946
  function enqueue(last) {
945
- return tsplus_module_1.map_(grafter(tsplus_module_1.fork(tsplus_module_1.as_(tsplus_module_40.sleep(duration, fileName_1 + ":866:37"), () => last))), f => consumer(tsplus_module_38.previous(f)), fileName_1 + ":866:66");
947
+ return tsplus_module_1.map_(grafter(tsplus_module_1.fork(tsplus_module_1.as_(tsplus_module_41.sleep(duration, fileName_1 + ":912:37"), () => last))), f => consumer(tsplus_module_40.previous(f)), fileName_1 + ":912:66");
946
948
  }
947
949
 
948
- const producer = tsplus_module_10.readWithCause(inp => tsplus_module_16.match_(tsplus_module_12.last(inp), () => producer, last => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.emit(tsplus_module_18.single(last)))), producer)), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), () => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))));
950
+ const producer = tsplus_module_10.readWithCause(inp => tsplus_module_20.match_(tsplus_module_12.last(inp), () => producer, last => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.emit(tsplus_module_19.single(last)))), producer)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.halt(cause))), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))));
949
951
 
950
952
  function consumer(state) {
951
- return tsplus_module_10.unwrap(tsplus_module_38.match_(state, {
953
+ return tsplus_module_10.unwrap(() => tsplus_module_40.match_(state, {
952
954
  NotStarted: () => tsplus_module_1.map_(tsplus_module_5.take(handoff), signal => tsplus_module_5.matchSignal_(signal, {
953
955
  Emit: ({
954
956
  els
955
- }) => tsplus_module_10.unwrap(enqueue(els)),
957
+ }) => tsplus_module_10.unwrap(() => enqueue(els)),
956
958
  Halt: ({
957
959
  error
958
960
  }) => tsplus_module_11.failCauseNow(error),
959
961
  End: () => tsplus_module_10.unit
960
- }), fileName_1 + ":881:33"),
962
+ }), fileName_1 + ":927:33"),
961
963
  Current: ({
962
964
  fiber
963
- }) => tsplus_module_1.map_(tsplus_module_39.join(fiber), signal => tsplus_module_5.matchSignal_(signal, {
965
+ }) => tsplus_module_1.map_(tsplus_module_22.join(fiber), signal => tsplus_module_5.matchSignal_(signal, {
964
966
  Emit: ({
965
967
  els
966
- }) => tsplus_module_10.unwrap(enqueue(els)),
968
+ }) => tsplus_module_10.unwrap(() => enqueue(els)),
967
969
  Halt: ({
968
970
  error
969
971
  }) => tsplus_module_11.failCauseNow(error),
970
972
  End: () => tsplus_module_10.unit
971
- }), fileName_1 + ":889:31"),
973
+ }), fileName_1 + ":935:31"),
972
974
  Previous: ({
973
975
  fiber
974
- }) => tsplus_module_22.raceWith_(tsplus_module_39.join(fiber), () => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_32.match_(ex, cause => tsplus_module_1.as_(tsplus_module_20.interrupt(current), () => tsplus_module_11.failCauseNow(cause)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), consumer(tsplus_module_38.current(current))), fileName_1 + ":903:38")), (ex, previous) => tsplus_module_32.match_(ex, cause => tsplus_module_1.as_(tsplus_module_20.interrupt(previous), () => tsplus_module_11.failCauseNow(cause)), signal => tsplus_module_5.matchSignal_(signal, {
976
+ }) => tsplus_module_24.raceWith_(tsplus_module_22.join(fiber), () => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_34.match_(ex, cause => tsplus_module_1.as_(tsplus_module_23.interrupt(current), () => tsplus_module_11.failCauseNow(cause)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), consumer(tsplus_module_40.current(current))), fileName_1 + ":949:38")), (ex, previous) => tsplus_module_34.match_(ex, cause => tsplus_module_1.as_(tsplus_module_23.interrupt(previous), () => tsplus_module_11.failCauseNow(cause)), signal => tsplus_module_5.matchSignal_(signal, {
975
977
  Emit: ({
976
978
  els
977
- }) => tsplus_module_1.apSecond_(tsplus_module_20.interrupt(previous), enqueue(els), fileName_1 + ":910:73"),
979
+ }) => tsplus_module_1.apSecond_(tsplus_module_23.interrupt(previous), enqueue(els), fileName_1 + ":956:73"),
978
980
  Halt: ({
979
981
  error
980
- }) => tsplus_module_1.as_(tsplus_module_20.interrupt(previous), () => tsplus_module_11.failCauseNow(error)),
981
- End: () => tsplus_module_1.map_(tsplus_module_39.join(previous), chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), tsplus_module_10.unit), fileName_1 + ":912:55")
982
- })), fileName_1 + ":897:36")
982
+ }) => tsplus_module_1.as_(tsplus_module_23.interrupt(previous), () => tsplus_module_11.failCauseNow(error)),
983
+ End: () => tsplus_module_1.map_(tsplus_module_22.join(previous), chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), tsplus_module_10.unit), fileName_1 + ":958:55")
984
+ })), fileName_1 + ":943:36")
983
985
  }));
984
986
  }
985
987
 
986
- return apSecond_1(scoped_1(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(stream.channel, producer)))), new _definition2.Stream(consumer(tsplus_module_38.notStarted)));
987
- }, fileName_1 + ":864:26"), fileName_1 + ":862:18"));
988
+ return apSecond_1(scoped_1(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(stream.channel, producer)))), new _definition2.Stream(consumer(tsplus_module_40.notStarted)));
989
+ }, fileName_1 + ":910:26"), fileName_1 + ":908:18"));
988
990
  }
989
991
 
990
992
  function defaultIfEmptyWriter(fb) {
@@ -1010,10 +1012,10 @@ function defaultIfEmpty_(fa, fb) {
1010
1012
 
1011
1013
 
1012
1014
  function distributedWith_(self, n, maximumLag, decide) {
1013
- return tsplus_module_1.flatMap_(tsplus_module_34.make(), p => tsplus_module_1.flatMap_(distributedWithDynamic_1(self, maximumLag, a => tsplus_module_1.flatMap_(tsplus_module_33.wait(p), f => f(a), fileName_1 + ":968:31"), () => tsplus_module_1.unit), next => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_12.map_(tsplus_module_18.range(0, n), id => tsplus_module_1.map_(next, ([key, queue]) => [[key, id], queue], fileName_1 + ":973:48"))), entries => {
1014
- const [mappings, queues] = tsplus_module_12.foldRight_(entries, [tsplus_module_41.makeDefault(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_41.set_(mappings, mapping[0], mapping[1]), tsplus_module_12.append_(queues, queue)]);
1015
- return tsplus_module_1.as_(tsplus_module_33.succeed_(p, a => tsplus_module_1.map_(decide(a), f => key => f(tsplus_module_36.toUndefined(tsplus_module_41.get_(mappings, key))), fileName_1 + ":979:48")), () => queues);
1016
- }, fileName_1 + ":974:18"), fileName_1 + ":971:15"), fileName_1 + ":964:77");
1015
+ return tsplus_module_1.flatMap_(tsplus_module_36.make(), p => tsplus_module_1.flatMap_(distributedWithDynamic_1(self, maximumLag, a => tsplus_module_1.flatMap_(tsplus_module_35.wait(p), f => f(a), fileName_1 + ":1014:31"), () => tsplus_module_1.unit), next => tsplus_module_1.flatMap_(tsplus_module_1.sequenceIterable(tsplus_module_12.map_(tsplus_module_19.range(0, n), id => tsplus_module_1.map_(next, ([key, queue]) => [[key, id], queue], fileName_1 + ":1019:48"))), entries => {
1016
+ const [mappings, queues] = tsplus_module_12.foldRight_(entries, [tsplus_module_42.makeDefault(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_42.set_(mappings, mapping[0], mapping[1]), tsplus_module_12.append_(queues, queue)]);
1017
+ return tsplus_module_1.as_(tsplus_module_35.succeed_(p, a => tsplus_module_1.map_(decide(a), f => key => f(tsplus_module_37.toUndefined(tsplus_module_42.get_(mappings, key))), fileName_1 + ":1025:48")), () => queues);
1018
+ }, fileName_1 + ":1020:18"), fileName_1 + ":1017:15"), fileName_1 + ":1010:77");
1017
1019
  }
1018
1020
  /**
1019
1021
  * More powerful version of `ZStream#distributedWith`. This returns a function that will produce
@@ -1028,22 +1030,22 @@ function distributedWith_(self, n, maximumLag, decide) {
1028
1030
 
1029
1031
 
1030
1032
  function distributedWithDynamic_1(self, maximumLag, decide, done = () => tsplus_module_1.unit) {
1031
- const offer = queuesRef => a => tsplus_module_1.flatMap_(decide(a), shouldProcess => tsplus_module_1.flatMap_(tsplus_module_35.get(queuesRef), queues => tsplus_module_1.flatMap_(tsplus_module_1.foldLeft_(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
1033
+ const offer = queuesRef => a => tsplus_module_1.flatMap_(decide(a), shouldProcess => tsplus_module_1.flatMap_(tsplus_module_14.get(queuesRef), queues => tsplus_module_1.flatMap_(tsplus_module_1.foldLeft_(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
1032
1034
  if (shouldProcess(id)) {
1033
- return tsplus_module_1.matchCauseIO_(tsplus_module_25.offer_(queue, tsplus_module_37.succeed(a)), c => tsplus_module_15.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append_(b, id), fileName_1 + ":1009:52") : tsplus_module_1.failCauseNow(c, fileName_1 + ":1009:84"), () => tsplus_module_1.succeedNow(b, fileName_1 + ":1010:34"), fileName_1 + ":1008:61");
1035
+ return tsplus_module_1.matchCauseIO_(tsplus_module_27.offer_(queue, tsplus_module_39.succeed(a)), c => tsplus_module_25.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append_(b, id), fileName_1 + ":1055:52") : tsplus_module_1.failCauseNow(c, fileName_1 + ":1055:84"), () => tsplus_module_1.succeedNow(b, fileName_1 + ":1056:34"), fileName_1 + ":1054:61");
1034
1036
  } else {
1035
- return tsplus_module_1.succeedNow(b, fileName_1 + ":1013:33");
1037
+ return tsplus_module_1.succeedNow(b, fileName_1 + ":1059:33");
1036
1038
  }
1037
- }, fileName_1 + ":1006:20"), ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_14.update_(queuesRef, map => tsplus_module_41.removeMany_(map, ids)) : tsplus_module_1.unit, fileName_1 + ":1015:19"), fileName_1 + ":1004:30"), fileName_1 + ":1003:30");
1039
+ }, fileName_1 + ":1052:20"), ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_15.update_(queuesRef, map => tsplus_module_42.removeMany_(map, ids)) : tsplus_module_1.unit, fileName_1 + ":1061:19"), fileName_1 + ":1050:30"), fileName_1 + ":1049:30");
1038
1040
 
1039
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_41.makeDefault()), ref => tsplus_module_1.flatMap_(tsplus_module_35.get(ref), qs => tsplus_module_1.foreach_(tsplus_module_41.values(qs), q => tsplus_module_25.shutdown(q), fileName_1 + ":1022:43"), fileName_1 + ":1022:24")), queuesRef => tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_43.atomically(tsplus_module_44.make(1)), queuesLock => tsplus_module_1.flatMap_(tsplus_module_6.make(() => tsplus_module_1.flatMap_(tsplus_module_27.makeBounded(maximumLag), queue => tsplus_module_1.flatMap_(tsplus_module_1.succeed(() => Symbol(), fileName_1 + ":1033:41"), id => tsplus_module_1.map_(tsplus_module_14.update_(queuesRef, map => tsplus_module_41.set_(map, id, queue)), () => (0, _function.tuple)(id, queue)), fileName_1 + ":1033:30"), fileName_1 + ":1032:30")), newQueue => {
1040
- const finalize = endTake => tsplus_module_42.withPermitSelf(queuesLock)(tsplus_module_1.asUnit(tsplus_module_1.flatMap_(tsplus_module_13.set_(newQueue, tsplus_module_1.flatMap_(tsplus_module_27.makeBounded(1), queue => tsplus_module_1.flatMap_(tsplus_module_25.offer_(queue, endTake), () => {
1041
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_42.makeDefault()), ref => tsplus_module_1.flatMap_(tsplus_module_14.get(ref), qs => tsplus_module_1.foreach_(tsplus_module_42.values(qs), q => tsplus_module_27.shutdown(q), fileName_1 + ":1068:43"), fileName_1 + ":1068:24")), queuesRef => tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_44.atomically(tsplus_module_45.make(1)), queuesLock => tsplus_module_1.flatMap_(tsplus_module_6.make(() => tsplus_module_1.flatMap_(tsplus_module_29.makeBounded(maximumLag), queue => tsplus_module_1.flatMap_(tsplus_module_1.succeed(() => Symbol(), fileName_1 + ":1079:41"), id => tsplus_module_1.map_(tsplus_module_15.update_(queuesRef, map => tsplus_module_42.set_(map, id, queue)), () => (0, _function.tuple)(id, queue)), fileName_1 + ":1079:30"), fileName_1 + ":1078:30")), newQueue => {
1042
+ const finalize = endTake => tsplus_module_43.withPermitSelf(queuesLock)(tsplus_module_1.asUnit(tsplus_module_1.flatMap_(tsplus_module_13.set_(newQueue, tsplus_module_1.flatMap_(tsplus_module_29.makeBounded(1), queue => tsplus_module_1.flatMap_(tsplus_module_27.offer_(queue, endTake), () => {
1041
1043
  const id = Symbol();
1042
- return tsplus_module_1.map_(tsplus_module_14.update_(queuesRef, map => tsplus_module_41.set_(map, id, queue)), () => (0, _function.tuple)(id, queue));
1043
- }, fileName_1 + ":1045:20"), fileName_1 + ":1044:34")), () => tsplus_module_1.flatMap_(tsplus_module_1.map_(tsplus_module_35.get(queuesRef), map => tsplus_module_41.values(map), fileName_1 + ":1053:53"), queues => tsplus_module_1.flatMap_(tsplus_module_1.foreach_(queues, queue => tsplus_module_1.catchJustCause_(tsplus_module_25.offer_(queue, endTake), c => tsplus_module_15.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit) : tsplus_module_3.nothing()), fileName_1 + ":1055:31"), () => tsplus_module_1.map_(done(endTake), () => void 0), fileName_1 + ":1054:20"), fileName_1 + ":1053:35"), fileName_1 + ":1051:23")));
1044
+ return tsplus_module_1.map_(tsplus_module_15.update_(queuesRef, map => tsplus_module_42.set_(map, id, queue)), () => (0, _function.tuple)(id, queue));
1045
+ }, fileName_1 + ":1091:20"), fileName_1 + ":1090:34")), () => tsplus_module_1.flatMap_(tsplus_module_1.map_(tsplus_module_14.get(queuesRef), map => tsplus_module_42.values(map), fileName_1 + ":1099:53"), queues => tsplus_module_1.flatMap_(tsplus_module_1.foreach_(queues, queue => tsplus_module_1.catchJustCause_(tsplus_module_27.offer_(queue, endTake), c => tsplus_module_25.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit) : tsplus_module_3.nothing()), fileName_1 + ":1101:31"), () => tsplus_module_1.map_(done(endTake), () => void 0), fileName_1 + ":1100:20"), fileName_1 + ":1099:35"), fileName_1 + ":1097:23")));
1044
1046
 
1045
- return tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_1.matchCauseIO_(runForeachScoped_1(self, offer(queuesRef)), cause => finalize(tsplus_module_37.failCause(tsplus_module_15.map_(cause, tsplus_module_3.just))), () => finalize(tsplus_module_37.fail(tsplus_module_3.nothing())), fileName_1 + ":1067:63")), () => tsplus_module_42.withPermitSelf(queuesLock)(tsplus_module_1.flatten(tsplus_module_35.get(newQueue))));
1046
- }, fileName_1 + ":1029:29"), fileName_1 + ":1028:29"), add => add, fileName_1 + ":1026:18"), fileName_1 + ":1020:24");
1047
+ return tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_1.matchCauseIO_(runForeachScoped_1(self, offer(queuesRef)), cause => finalize(tsplus_module_39.failCause(tsplus_module_25.map_(cause, tsplus_module_3.just))), () => finalize(tsplus_module_39.fail(tsplus_module_3.nothing())), fileName_1 + ":1113:63")), () => tsplus_module_43.withPermitSelf(queuesLock)(tsplus_module_1.flatten(tsplus_module_14.get(newQueue))));
1048
+ }, fileName_1 + ":1075:29"), fileName_1 + ":1074:29"), add => add, fileName_1 + ":1072:18"), fileName_1 + ":1066:24");
1047
1049
  }
1048
1050
  /**
1049
1051
  * Converts this stream to a stream that executes its effects but emits no
@@ -1084,7 +1086,7 @@ function drop_1(stream, n) {
1084
1086
 
1085
1087
 
1086
1088
  function dropWhile_1(stream, p) {
1087
- return pipeThrough_1(stream, tsplus_module_45.dropWhile(p));
1089
+ return pipeThrough_1(stream, tsplus_module_46.dropWhile(p));
1088
1090
  }
1089
1091
  /**
1090
1092
  * Drops all elements of the stream until the specified predicate evaluates
@@ -1095,7 +1097,7 @@ function dropWhile_1(stream, p) {
1095
1097
 
1096
1098
 
1097
1099
  function dropUntil_(stream, p) {
1098
- return drop_1(dropWhile_1(stream, tsplus_module_46.invert(p)), 1);
1100
+ return drop_1(dropWhile_1(stream, tsplus_module_47.invert(p)), 1);
1099
1101
  }
1100
1102
  /**
1101
1103
  * Returns a stream whose failures and successes have been lifted into an
@@ -1109,7 +1111,7 @@ function dropUntil_(stream, p) {
1109
1111
 
1110
1112
 
1111
1113
  function either(stream) {
1112
- return catchAll_1(map_1(stream, tsplus_module_17.right), e => succeedNow_1(tsplus_module_17.left(e)));
1114
+ return catchAll_1(map_1(stream, tsplus_module_18.right), e => succeedNow_1(tsplus_module_18.left(e)));
1113
1115
  }
1114
1116
  /**
1115
1117
  * @tsplus static fncts.io.StreamOps empty
@@ -1121,7 +1123,7 @@ const empty = empty_1;
1121
1123
  exports.empty = empty;
1122
1124
 
1123
1125
  function endWhenWriter(fiber) {
1124
- return tsplus_module_10.unwrap(tsplus_module_1.map_(tsplus_module_47.poll(fiber), maybeExit => tsplus_module_16.match_(maybeExit, () => tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(inp), endWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_32.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1155:19"));
1126
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_48.poll(fiber), maybeExit => tsplus_module_20.match_(maybeExit, () => tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(inp), endWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_34.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1201:19"));
1125
1127
  }
1126
1128
  /**
1127
1129
  * Halts the evaluation of this stream when the provided IO completes. The given IO
@@ -1137,7 +1139,7 @@ function endWhenWriter(fiber) {
1137
1139
 
1138
1140
 
1139
1141
  function endWhen_(stream, io) {
1140
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_21.forkScoped(io), fiber => tsplus_module_10.pipeTo_(stream.channel, endWhenWriter(fiber)), fileName_1 + ":1181:59")));
1142
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_16.forkScoped(io), fiber => tsplus_module_10.pipeTo_(stream.channel, endWhenWriter(fiber)), fileName_1 + ":1227:59")));
1141
1143
  }
1142
1144
  /**
1143
1145
  * @tsplus fluent fncts.io.Stream ensuring
@@ -1153,7 +1155,7 @@ function ensuring_1(self, finalizer) {
1153
1155
 
1154
1156
 
1155
1157
  function environment_1() {
1156
- return fromIO_1(tsplus_module_48.environment(fileName_1 + ":1195:38"));
1158
+ return fromIO_1(tsplus_module_49.environment(fileName_1 + ":1241:38"));
1157
1159
  }
1158
1160
  /**
1159
1161
  * Accesses the environment of the stream.
@@ -1213,7 +1215,7 @@ function fail(error) {
1213
1215
 
1214
1216
 
1215
1217
  function failCauseNow_1(cause) {
1216
- return fromIO_1(tsplus_module_1.failCauseNow(cause, fileName_1 + ":1249:39"));
1218
+ return fromIO_1(tsplus_module_1.failCauseNow(cause, fileName_1 + ":1295:39"));
1217
1219
  }
1218
1220
  /**
1219
1221
  * The stream that always halts with `cause`.
@@ -1223,7 +1225,7 @@ function failCauseNow_1(cause) {
1223
1225
 
1224
1226
 
1225
1227
  function failCause(cause) {
1226
- return fromIO_1(tsplus_module_1.failCause(cause, fileName_1 + ":1258:36"));
1228
+ return fromIO_1(tsplus_module_1.failCause(cause, fileName_1 + ":1304:36"));
1227
1229
  }
1228
1230
 
1229
1231
  function filter_(fa, predicate) {
@@ -1235,7 +1237,17 @@ function filter_(fa, predicate) {
1235
1237
 
1236
1238
 
1237
1239
  function filterIO_(fa, f) {
1238
- return loopOnPartialChunksElements_1(fa, (a, emit) => tsplus_module_1.flatMap_(f(a), r => r ? emit(a) : tsplus_module_1.unit, fileName_1 + ":1277:66"));
1240
+ return new _definition2.Stream(tsplus_module_10.pipeTo_(fa.channel, filterIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
1241
+ }
1242
+
1243
+ function filterIOLoop(iterator, f) {
1244
+ const next = iterator.next();
1245
+
1246
+ if (next.done) {
1247
+ return tsplus_module_10.readWithCause(elem => filterIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1248
+ } else {
1249
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => b ? tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(next.value)), filterIOLoop(iterator, f)) : filterIOLoop(iterator, f), fileName_1 + ":1339:24"));
1250
+ }
1239
1251
  }
1240
1252
  /**
1241
1253
  * @tsplus fluent fncts.io.Stream filterMap
@@ -1251,7 +1263,17 @@ function filterMap_1(fa, f) {
1251
1263
 
1252
1264
 
1253
1265
  function filterMapIO_(fa, f) {
1254
- return loopOnPartialChunksElements_1(fa, (a, emit) => tsplus_module_1.flatMap_(f(a), maybeB => tsplus_module_16.match_(maybeB, () => tsplus_module_1.unit, emit), fileName_1 + ":1294:66"));
1266
+ return new _definition2.Stream(tsplus_module_10.pipeTo_(fa.channel, filterMapIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
1267
+ }
1268
+
1269
+ function filterMapIOLoop(iterator, f) {
1270
+ const next = iterator.next();
1271
+
1272
+ if (next.done) {
1273
+ return tsplus_module_10.readWithCause(elem => filterMapIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1274
+ } else {
1275
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => tsplus_module_20.match_(b, () => filterMapIOLoop(iterator, f), b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), filterMapIOLoop(iterator, f))), fileName_1 + ":1378:24"));
1276
+ }
1255
1277
  }
1256
1278
  /**
1257
1279
  * Finds the first element emitted by this stream that satisfies the provided predicate.
@@ -1261,7 +1283,7 @@ function filterMapIO_(fa, f) {
1261
1283
 
1262
1284
 
1263
1285
  function find_(stream, p) {
1264
- const loop = tsplus_module_10.readWith(inp => tsplus_module_16.match_(tsplus_module_12.find_(inp, p), () => loop, a => tsplus_module_10.writeNow(tsplus_module_18.single(a))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1286
+ const loop = tsplus_module_10.readWith(inp => tsplus_module_20.match_(tsplus_module_12.find_(inp, p), () => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1265
1287
  return new _definition2.Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
1266
1288
  }
1267
1289
  /**
@@ -1272,7 +1294,7 @@ function find_(stream, p) {
1272
1294
 
1273
1295
 
1274
1296
  function findIO_(stream, f) {
1275
- const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.map_(tsplus_module_49.findIO_(inp, f), maybeA => tsplus_module_16.match_(maybeA, () => loop, a => tsplus_module_10.writeNow(tsplus_module_18.single(a))), fileName_1 + ":1327:26")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1297
+ const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_50.findIO_(inp, f), maybeA => tsplus_module_20.match_(maybeA, () => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a))), fileName_1 + ":1418:26")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1276
1298
  return new _definition2.Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
1277
1299
  }
1278
1300
  /**
@@ -1297,9 +1319,9 @@ function flatten_1(self) {
1297
1319
 
1298
1320
  function flattenExitOption_1(stream) {
1299
1321
  const processChunk = (chunk, cont) => {
1300
- const [toEmit, rest] = tsplus_module_12.splitWhere_(chunk, _ => !tsplus_module_50.isSuccess(_));
1301
- const next = tsplus_module_16.match_(tsplus_module_12.head(rest), () => cont, exit => tsplus_module_32.match_(exit, cause => tsplus_module_16.match_(tsplus_module_15.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), () => tsplus_module_11.endNow(undefined)));
1302
- return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_12.filterMap_(toEmit, exit => tsplus_module_32.match_(exit, () => tsplus_module_3.nothing(), tsplus_module_3.just))), next);
1322
+ const [toEmit, rest] = tsplus_module_12.splitWhere_(chunk, _ => !tsplus_module_51.isSuccess(_));
1323
+ const next = tsplus_module_20.match_(tsplus_module_12.head(rest), () => cont, exit => tsplus_module_34.match_(exit, cause => tsplus_module_20.match_(tsplus_module_25.flipCauseOption(cause), () => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow), () => tsplus_module_11.endNow(undefined)));
1324
+ return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_12.filterMap_(toEmit, exit => tsplus_module_34.match_(exit, () => tsplus_module_3.nothing(), tsplus_module_3.just))), next);
1303
1325
  };
1304
1326
 
1305
1327
  const process = tsplus_module_10.readWithCause(chunk => processChunk(chunk, process), tsplus_module_11.failCauseNow, _ => tsplus_module_11.endNow(undefined));
@@ -1354,7 +1376,7 @@ function fromChunkNow_1(c) {
1354
1376
 
1355
1377
 
1356
1378
  function fromChunk_1(c) {
1357
- return new _definition2.Stream(tsplus_module_10.unwrap(tsplus_module_1.succeedNow(tsplus_module_10.write(c), fileName_1 + ":1427:49")));
1379
+ return new _definition2.Stream(tsplus_module_10.unwrap(() => tsplus_module_1.succeedNow(tsplus_module_10.write(c), fileName_1 + ":1518:49")));
1358
1380
  }
1359
1381
  /**
1360
1382
  * Creates a single-valued stream from a managed resource
@@ -1364,7 +1386,7 @@ function fromChunk_1(c) {
1364
1386
 
1365
1387
 
1366
1388
  function scoped_1(stream) {
1367
- return new _definition2.Stream(tsplus_module_10.scoped(() => tsplus_module_1.map_(stream, tsplus_module_18.single, fileName_1 + ":1436:46")));
1389
+ return new _definition2.Stream(tsplus_module_10.scoped(() => tsplus_module_1.map_(stream, tsplus_module_19.single, fileName_1 + ":1527:46")));
1368
1390
  }
1369
1391
  /**
1370
1392
  * Creates a stream from an effect producing a value of type `A`
@@ -1374,7 +1396,7 @@ function scoped_1(stream) {
1374
1396
 
1375
1397
 
1376
1398
  function fromIO_1(fa) {
1377
- return fromIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":1445:40"));
1399
+ return fromIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":1536:40"));
1378
1400
  }
1379
1401
  /**
1380
1402
  * Creates a stream from an effect producing a value of type `A` or an empty Stream
@@ -1384,12 +1406,12 @@ function fromIO_1(fa) {
1384
1406
 
1385
1407
 
1386
1408
  function fromIOMaybe_1(fa) {
1387
- return new _definition2.Stream(tsplus_module_10.unwrap(tsplus_module_1.match_(fa, maybeError => tsplus_module_16.match_(maybeError, () => tsplus_module_10.unit, tsplus_module_10.failNow), a => tsplus_module_10.writeNow(tsplus_module_18.single(a)), fileName_1 + ":1456:15")));
1409
+ return new _definition2.Stream(tsplus_module_10.unwrap(() => tsplus_module_1.match_(fa, maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_10.unit, tsplus_module_10.failNow), a => tsplus_module_10.writeNow(tsplus_module_19.single(a)), fileName_1 + ":1547:15")));
1388
1410
  }
1389
1411
 
1390
1412
  function fromAsyncIterableLoop(iterator) {
1391
- return tsplus_module_10.unwrap(tsplus_module_1.async(k => {
1392
- iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), fileName_1 + ":1473:30")) : k(tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_18.single(result.value)), fromAsyncIterableLoop(iterator)), fileName_1 + ":1474:30")));
1413
+ return tsplus_module_10.unwrap(() => tsplus_module_1.async(k => {
1414
+ iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), fileName_1 + ":1564:30")) : k(tsplus_module_1.succeedNow(tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(result.value)), fromAsyncIterableLoop(iterator)), fileName_1 + ":1565:30")));
1393
1415
  }));
1394
1416
  }
1395
1417
  /**
@@ -1407,7 +1429,7 @@ function fromAsyncIterable(iterable) {
1407
1429
 
1408
1430
  function fromIterable(iterable, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE) {
1409
1431
  return unwrap_1(tsplus_module_1.succeed(() => {
1410
- const loop = iterator => tsplus_module_10.unwrap(tsplus_module_1.succeed(() => {
1432
+ const loop = iterator => tsplus_module_10.unwrap(() => tsplus_module_1.succeed(() => {
1411
1433
  let result = iterator.next();
1412
1434
 
1413
1435
  if (result.done) {
@@ -1415,7 +1437,7 @@ function fromIterable(iterable, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE)
1415
1437
  }
1416
1438
 
1417
1439
  if (maxChunkSize === 1) {
1418
- return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_18.single(result.value)), loop(iterator));
1440
+ return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(result.value)), loop(iterator));
1419
1441
  } else {
1420
1442
  const out = Array(maxChunkSize);
1421
1443
  out[0] = result.value;
@@ -1426,12 +1448,12 @@ function fromIterable(iterable, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE)
1426
1448
  count++;
1427
1449
  }
1428
1450
 
1429
- return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_18.from(out)), loop(iterator));
1451
+ return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.from(out)), loop(iterator));
1430
1452
  }
1431
- }, fileName_1 + ":1495:21"));
1453
+ }, fileName_1 + ":1586:21"));
1432
1454
 
1433
1455
  return new _definition2.Stream(loop(iterable[Symbol.iterator]()));
1434
- }, fileName_1 + ":1492:15"));
1456
+ }, fileName_1 + ":1583:15"));
1435
1457
  }
1436
1458
  /**
1437
1459
  * @tsplus static fncts.io.StreamOps fromIterableSingle
@@ -1439,15 +1461,15 @@ function fromIterable(iterable, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE)
1439
1461
 
1440
1462
 
1441
1463
  function fromIterableSingle(iterable) {
1442
- return flatMap_1(fromIO_1(tsplus_module_1.succeed(() => iterable[Symbol.iterator](), fileName_1 + ":1523:34")), iterator => repeatIOMaybe_1(tsplus_module_1.defer(() => {
1464
+ return flatMap_1(fromIO_1(tsplus_module_1.succeed(() => iterable[Symbol.iterator](), fileName_1 + ":1614:34")), iterator => repeatIOMaybe_1(tsplus_module_1.defer(() => {
1443
1465
  const value = iterator.next();
1444
1466
 
1445
1467
  if (value.done) {
1446
- return tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":1528:28");
1468
+ return tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":1619:28");
1447
1469
  } else {
1448
- return tsplus_module_1.succeedNow(value.value, fileName_1 + ":1530:31");
1470
+ return tsplus_module_1.succeedNow(value.value, fileName_1 + ":1621:31");
1449
1471
  }
1450
- }, fileName_1 + ":1525:15")));
1472
+ }, fileName_1 + ":1616:15")));
1451
1473
  }
1452
1474
  /**
1453
1475
  * @tsplus static fncts.io.StreamOps fromPull
@@ -1455,7 +1477,7 @@ function fromIterableSingle(iterable) {
1455
1477
 
1456
1478
 
1457
1479
  function fromPull_1(scopedPull) {
1458
- return unwrapScoped_1(tsplus_module_1.map_(scopedPull, pull => repeatIOChunkMaybe_1(pull), fileName_1 + ":1541:44"));
1480
+ return unwrapScoped_1(tsplus_module_1.map_(scopedPull, pull => repeatIOChunkMaybe_1(pull), fileName_1 + ":1632:44"));
1459
1481
  }
1460
1482
  /**
1461
1483
  * Creates a stream from a `Queue` of values
@@ -1465,13 +1487,13 @@ function fromPull_1(scopedPull) {
1465
1487
 
1466
1488
 
1467
1489
  function fromQueue_1(queue, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE) {
1468
- return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause_(tsplus_module_1.map_(tsplus_module_52.takeBetween_(queue, 1, maxChunkSize), tsplus_module_18.from, fileName_1 + ":1556:11"), c => tsplus_module_1.flatMap_(tsplus_module_25.isShutdown(queue), down => {
1469
- if (down && tsplus_module_15.interrupted(c)) {
1470
- return tsplus_module_51.end;
1490
+ return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause_(tsplus_module_1.map_(tsplus_module_53.takeBetween_(queue, 1, maxChunkSize), tsplus_module_19.from, fileName_1 + ":1647:11"), c => tsplus_module_1.flatMap_(tsplus_module_27.isShutdown(queue), down => {
1491
+ if (down && tsplus_module_25.interrupted(c)) {
1492
+ return tsplus_module_52.end;
1471
1493
  } else {
1472
- return tsplus_module_51.failCause(c);
1494
+ return tsplus_module_52.failCause(c);
1473
1495
  }
1474
- }, fileName_1 + ":1558:33"), fileName_1 + ":1557:21"));
1496
+ }, fileName_1 + ":1649:33"), fileName_1 + ":1648:21"));
1475
1497
  }
1476
1498
  /**
1477
1499
  * @tsplus static fncts.io.StreamOps fromQueueWithShutdown
@@ -1479,7 +1501,7 @@ function fromQueue_1(queue, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE) {
1479
1501
 
1480
1502
 
1481
1503
  function fromQueueWithShutdown_1(queue, maxChunkSize = _definition2.DEFAULT_CHUNK_SIZE) {
1482
- return ensuring_1(fromQueue_1(queue, maxChunkSize), tsplus_module_25.shutdown(queue));
1504
+ return ensuring_1(fromQueue_1(queue, maxChunkSize), tsplus_module_27.shutdown(queue));
1483
1505
  }
1484
1506
  /**
1485
1507
  * Halt a stream with the specified exception
@@ -1503,7 +1525,7 @@ function halt_1(u) {
1503
1525
  }
1504
1526
 
1505
1527
  function haltWhenWriter(fiber) {
1506
- return tsplus_module_10.unwrap(tsplus_module_1.map_(tsplus_module_47.poll(fiber), maybeExit => tsplus_module_16.match_(maybeExit, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_32.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1601:19"));
1528
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_48.poll(fiber), maybeExit => tsplus_module_20.match_(maybeExit, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenWriter(fiber)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_34.match_(exit, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)), fileName_1 + ":1692:19"));
1507
1529
  }
1508
1530
  /**
1509
1531
  * Halts the evaluation of this stream when the provided IO completes. The
@@ -1520,11 +1542,11 @@ function haltWhenWriter(fiber) {
1520
1542
 
1521
1543
 
1522
1544
  function haltWhen_(fa, io) {
1523
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_21.forkScoped(io), fiber => tsplus_module_10.pipeTo_(fa.channel, haltWhenWriter(fiber)), fileName_1 + ":1628:59")));
1545
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_16.forkScoped(io), fiber => tsplus_module_10.pipeTo_(fa.channel, haltWhenWriter(fiber)), fileName_1 + ":1719:59")));
1524
1546
  }
1525
1547
 
1526
1548
  function haltWhenFutureWriter(future) {
1527
- return tsplus_module_10.unwrap(tsplus_module_1.map_(tsplus_module_33.poll(future), maybeIO => tsplus_module_16.match_(maybeIO, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenFutureWriter(future)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(tsplus_module_1.match_(io, tsplus_module_10.failNow, () => tsplus_module_10.unit, fileName_1 + ":1643:40"))), fileName_1 + ":1635:20"));
1549
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(tsplus_module_35.poll(future), maybeIO => tsplus_module_20.match_(maybeIO, () => tsplus_module_10.readWith(i => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(i), haltWhenFutureWriter(future)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match_(io, tsplus_module_10.failNow, () => tsplus_module_10.unit, fileName_1 + ":1734:40"))), fileName_1 + ":1726:20"));
1528
1550
  }
1529
1551
  /**
1530
1552
  * Halts the evaluation of this stream when the provided promise resolves.
@@ -1544,11 +1566,11 @@ function haltWhenFuture_(fa, future) {
1544
1566
 
1545
1567
 
1546
1568
  function interleave_(sa, sb) {
1547
- return interleaveWith_1(sa, sb, forever_1(fromChunk_1(() => tsplus_module_18.make(true, false))));
1569
+ return interleaveWith_1(sa, sb, forever_1(fromChunk_1(() => tsplus_module_19.make(true, false))));
1548
1570
  }
1549
1571
 
1550
1572
  function interleaveWithProducer(handoff) {
1551
- return tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.single(value))), interleaveWithProducer(handoff)), cause => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.failCause(cause))), () => tsplus_module_10.fromIO(tsplus_module_5.offer(handoff, tsplus_module_24.end)));
1573
+ return tsplus_module_10.readWithCause(value => tsplus_module_11.apSecond_(tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.single(value))), interleaveWithProducer(handoff)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.failCause(cause))), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(handoff, tsplus_module_26.end)));
1552
1574
  }
1553
1575
  /**
1554
1576
  * Combines this stream and the specified stream deterministically using the
@@ -1563,21 +1585,21 @@ function interleaveWithProducer(handoff) {
1563
1585
 
1564
1586
 
1565
1587
  function interleaveWith_1(sa, sb, b) {
1566
- return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sa.channel, tsplus_module_10.writeChunk), interleaveWithProducer(left)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_23.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sb.channel, tsplus_module_10.writeChunk), interleaveWithProducer(right)))), () => (0, _function.tuple)(left, right)), fileName_1 + ":1698:10"), fileName_1 + ":1697:24"), fileName_1 + ":1696:24"), ([left, right]) => {
1588
+ return new _definition2.Stream(tsplus_module_10.unwrapScoped(tsplus_module_1.map_(tsplus_module_1.flatMap_(tsplus_module_5.make(), left => tsplus_module_1.flatMap_(tsplus_module_5.make(), right => tsplus_module_1.flatMap_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sa.channel, tsplus_module_10.writeChunk), interleaveWithProducer(left)))), () => tsplus_module_1.map_(tsplus_module_1.fork(tsplus_module_17.runScoped(tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(sb.channel, tsplus_module_10.writeChunk), interleaveWithProducer(right)))), () => (0, _function.tuple)(left, right)), fileName_1 + ":1789:10"), fileName_1 + ":1788:24"), fileName_1 + ":1787:24"), ([left, right]) => {
1567
1589
  const process = (leftDone, rightDone) => tsplus_module_10.readWithCause(b => {
1568
1590
  if (b && !leftDone) {
1569
- return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_5.take(left)), take => tsplus_module_24.match_(take, rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
1591
+ return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_5.take(left)), take => tsplus_module_26.match_(take, rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
1570
1592
  }
1571
1593
 
1572
1594
  if (!b && !rightDone) {
1573
- return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_5.take(right)), take => tsplus_module_24.match_(take, leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
1595
+ return tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_5.take(right)), take => tsplus_module_26.match_(take, leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(chunk), process(leftDone, rightDone))));
1574
1596
  }
1575
1597
 
1576
1598
  return process(leftDone, rightDone);
1577
1599
  }, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
1578
1600
 
1579
1601
  return tsplus_module_10.pipeTo_(tsplus_module_10.concatMap_(b.channel, tsplus_module_10.writeChunk), process(false, false));
1580
- }, fileName_1 + ":1701:13")));
1602
+ }, fileName_1 + ":1792:13")));
1581
1603
  }
1582
1604
 
1583
1605
  function intersperseWriter(middle, isFirst) {
@@ -1617,7 +1639,7 @@ function intersperse_(stream, middle) {
1617
1639
 
1618
1640
 
1619
1641
  function interruptWhen_(stream, io) {
1620
- return new _definition2.Stream(tsplus_module_53.interruptWhen_(stream.channel, io));
1642
+ return new _definition2.Stream(tsplus_module_54.interruptWhen_(stream.channel, io));
1621
1643
  }
1622
1644
  /**
1623
1645
  * @tsplus fluent fncts.io.Stream interruptWhen
@@ -1625,49 +1647,7 @@ function interruptWhen_(stream, io) {
1625
1647
 
1626
1648
 
1627
1649
  function interruptWhenFuture_(fa, future) {
1628
- return new _definition2.Stream(tsplus_module_53.interruptWhenFuture_(fa.channel, future));
1629
- }
1630
- /**
1631
- * Loops over the stream chunks concatenating the result of f
1632
- *
1633
- * @tsplus fluent fncts.io.Stream loopOnChunks
1634
- */
1635
-
1636
-
1637
- function loopOnChunks_1(stream, f) {
1638
- const loop = tsplus_module_10.readWithCause(chunk => tsplus_module_11.flatMap_(f(chunk), cont => cont ? loop : tsplus_module_11.endNow(false)), tsplus_module_11.failCauseNow, _ => tsplus_module_11.succeedNow(false));
1639
- return new _definition2.Stream(tsplus_module_10.pipeTo_(stream.channel, loop));
1640
- }
1641
- /**
1642
- * Loops on chunks emitting partially
1643
- *
1644
- * @tsplus fluent fncts.io.Stream loopOnPartialChunks
1645
- */
1646
-
1647
-
1648
- function loopOnPartialChunks_1(stream, f) {
1649
- return loopOnChunks_1(stream, chunk => tsplus_module_10.unwrap(tsplus_module_1.defer(() => {
1650
- let outputChunk = tsplus_module_7.empty();
1651
- return tsplus_module_1.catchAll_(tsplus_module_1.map_(f(chunk, a => tsplus_module_1.succeed(() => {
1652
- outputChunk = tsplus_module_12.append_(outputChunk, a);
1653
- }, fileName_1 + ":1822:21")), cont => tsplus_module_11.apSecond_(tsplus_module_10.write(() => outputChunk), tsplus_module_11.endNow(cont)), fileName_1 + ":1826:15"), failure => tsplus_module_1.succeed(() => {
1654
- if (tsplus_module_12.isEmpty(outputChunk)) {
1655
- return tsplus_module_10.failNow(failure);
1656
- } else {
1657
- return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk), tsplus_module_10.failNow(failure));
1658
- }
1659
- }, fileName_1 + ":1828:23"), fileName_1 + ":1827:20");
1660
- }, fileName_1 + ":1819:15")));
1661
- }
1662
- /**
1663
- * Loops on chunks elements emitting partially
1664
- *
1665
- * @tsplus fluent fncts.io.Stream loopOnPartialChunksElements
1666
- */
1667
-
1668
-
1669
- function loopOnPartialChunksElements_1(stream, f) {
1670
- return loopOnPartialChunks_1(stream, (as, emit) => tsplus_module_1.as_(tsplus_module_54.mapIO_(as, a => f(a, emit)), () => true));
1650
+ return new _definition2.Stream(tsplus_module_54.interruptWhenFuture_(fa.channel, future));
1671
1651
  }
1672
1652
  /**
1673
1653
  * Transforms the elements of this stream using the supplied function.
@@ -1682,7 +1662,7 @@ function map_1(stream, f) {
1682
1662
 
1683
1663
  function mapAccumAccumulator(currS, f) {
1684
1664
  return tsplus_module_10.readWith(inp => {
1685
- const [bs, nextS] = tsplus_module_12.mapAccum_(inp, currS, f);
1665
+ const [nextS, bs] = tsplus_module_12.mapAccum_(inp, currS, f);
1686
1666
  return tsplus_module_11.apSecond_(tsplus_module_10.writeNow(bs), mapAccumAccumulator(nextS, f));
1687
1667
  }, tsplus_module_10.failNow, () => tsplus_module_10.unit);
1688
1668
  }
@@ -1698,18 +1678,18 @@ function mapAccum_(stream, s, f) {
1698
1678
  }
1699
1679
 
1700
1680
  function mapAccumIOAccumulator(s, f) {
1701
- return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.defer(() => {
1681
+ return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.defer(() => {
1702
1682
  const outputChunk = tsplus_module_12.builder();
1703
1683
 
1704
1684
  const emit = b => tsplus_module_1.succeed(() => {
1705
1685
  outputChunk.append(b);
1706
- }, fileName_1 + ":1899:23");
1686
+ }, fileName_1 + ":1928:23");
1707
1687
 
1708
- return tsplus_module_1.match_(tsplus_module_1.foldLeft_(inp, s, (s1, a) => tsplus_module_1.flatMap_(f(s1, a), ([b, s2]) => tsplus_module_1.as_(emit(b), () => s2), fileName_1 + ":1902:65"), fileName_1 + ":1902:29"), e => {
1688
+ return tsplus_module_1.match_(tsplus_module_1.foldLeft_(inp, s, (s1, a) => tsplus_module_1.flatMap_(f(s1, a), ([b, s2]) => tsplus_module_1.as_(emit(b), () => s2), fileName_1 + ":1931:65"), fileName_1 + ":1931:29"), e => {
1709
1689
  const partialResult = outputChunk.result();
1710
1690
  return tsplus_module_12.isNonEmpty(partialResult) ? tsplus_module_11.apSecond_(tsplus_module_10.writeNow(partialResult), tsplus_module_10.failNow(e)) : tsplus_module_10.failNow(e);
1711
- }, s => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk.result()), mapAccumIOAccumulator(s, f)), fileName_1 + ":1902:101");
1712
- }, fileName_1 + ":1896:17")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1691
+ }, s => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(outputChunk.result()), mapAccumIOAccumulator(s, f)), fileName_1 + ":1931:101");
1692
+ }, fileName_1 + ":1925:17")), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1713
1693
  }
1714
1694
  /**
1715
1695
  * Statefully and effectfully maps over the elements of this stream to produce
@@ -1751,7 +1731,7 @@ function mapChunksIO_(stream, f) {
1751
1731
 
1752
1732
 
1753
1733
  function mapConcat_(stream, f) {
1754
- return mapConcatChunk_1(stream, a => tsplus_module_18.from(f(a)));
1734
+ return mapConcatChunk_1(stream, a => tsplus_module_19.from(f(a)));
1755
1735
  }
1756
1736
  /**
1757
1737
  * Maps each element to a chunk, and flattens the chunks into the output of
@@ -1784,7 +1764,7 @@ function mapConcatChunkIO_(stream, f) {
1784
1764
 
1785
1765
 
1786
1766
  function mapConcatIO_(stream, f) {
1787
- return mapConcatChunk_1(mapIO_1(stream, a => tsplus_module_1.map_(f(a), tsplus_module_18.from, fileName_1 + ":1996:38")), _function.identity);
1767
+ return mapConcatChunk_1(mapIO_1(stream, a => tsplus_module_1.map_(f(a), tsplus_module_19.from, fileName_1 + ":2025:38")), _function.identity);
1788
1768
  }
1789
1769
  /**
1790
1770
  * Transforms the errors emitted by this stream using `f`.
@@ -1814,7 +1794,17 @@ function mapErrorCause_(fa, f) {
1814
1794
 
1815
1795
 
1816
1796
  function mapIO_1(stream, f) {
1817
- return loopOnPartialChunksElements_1(stream, (a, emit) => tsplus_module_1.flatMap_(f(a), emit, fileName_1 + ":2026:70"));
1797
+ return new _definition2.Stream(tsplus_module_10.pipeTo_(stream.channel, mapIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
1798
+ }
1799
+
1800
+ function mapIOLoop(iterator, f) {
1801
+ const next = iterator.next();
1802
+
1803
+ if (next.done) {
1804
+ return tsplus_module_10.readWithCause(elem => mapIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1805
+ } else {
1806
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(b)), mapIOLoop(iterator, f)), fileName_1 + ":2071:24"));
1807
+ }
1818
1808
  }
1819
1809
  /**
1820
1810
  * Maps over elements of the stream with the specified effectful function,
@@ -1828,7 +1818,7 @@ function mapIO_1(stream, f) {
1828
1818
 
1829
1819
 
1830
1820
  function mapIOC_(stream, n, f) {
1831
- return new _definition2.Stream(tsplus_module_10.mapOut_(tsplus_module_55.mapOutIOC_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), n, f), tsplus_module_18.single));
1821
+ return new _definition2.Stream(tsplus_module_10.mapOut_(tsplus_module_55.mapOutIOC_(tsplus_module_10.concatMap_(stream.channel, tsplus_module_10.writeChunk), n, f), tsplus_module_19.single));
1832
1822
  }
1833
1823
  /**
1834
1824
  * Maps each element of this stream to another stream and returns the
@@ -1861,11 +1851,11 @@ function mergeMapIO_(stream, f, n, bufferSize = 16) {
1861
1851
 
1862
1852
 
1863
1853
  function mergeEither_1(fa, fb) {
1864
- return mergeWith_1(fa, fb, tsplus_module_17.left, tsplus_module_17.right);
1854
+ return mergeWith_1(fa, fb, tsplus_module_18.left, tsplus_module_18.right);
1865
1855
  }
1866
1856
 
1867
1857
  function mergeWithHandler(terminate) {
1868
- return exit => terminate || !tsplus_module_50.isSuccess(exit) ? tsplus_module_57.done(tsplus_module_1.fromExitNow(exit, fileName_1 + ":2093:71")) : tsplus_module_57.wait(tsplus_module_1.fromExitNow);
1858
+ return exit => terminate || !tsplus_module_51.isSuccess(exit) ? tsplus_module_57.done(tsplus_module_1.fromExitNow(exit, fileName_1 + ":2140:71")) : tsplus_module_57.wait(tsplus_module_1.fromExitNow);
1869
1859
  }
1870
1860
  /**
1871
1861
  * @tsplus fluent fncts.io.Stream mergeWith
@@ -1885,7 +1875,7 @@ function mergeWith_1(sa, sb, l, r, strategy = "Both") {
1885
1875
 
1886
1876
 
1887
1877
  function onError_(stream, cleanup) {
1888
- return catchAllCause_1(stream, cause => fromIO_1(tsplus_module_1.apSecond_(cleanup(cause), tsplus_module_1.failCauseNow(cause, fileName_1 + ":2130:88"), fileName_1 + ":2130:72")));
1878
+ return catchAllCause_1(stream, cause => fromIO_1(tsplus_module_1.apSecond_(cleanup(cause), tsplus_module_1.failCauseNow(cause, fileName_1 + ":2177:88"), fileName_1 + ":2177:72")));
1889
1879
  }
1890
1880
  /**
1891
1881
  * Switches to the provided stream in case this one fails with a typed error.
@@ -1909,7 +1899,7 @@ function orElse_1(stream, that) {
1909
1899
 
1910
1900
 
1911
1901
  function orElseEither_(stream, that) {
1912
- return orElse_1(map_1(stream, tsplus_module_17.left), () => map_1(that(), tsplus_module_17.right));
1902
+ return orElse_1(map_1(stream, tsplus_module_18.left), () => map_1(that(), tsplus_module_18.right));
1913
1903
  }
1914
1904
  /**
1915
1905
  * Fails with given error in case this one fails with a typed error.
@@ -1931,7 +1921,7 @@ function orElseFail_(stream, e) {
1931
1921
 
1932
1922
 
1933
1923
  function orElseOptional_(stream, that) {
1934
- return catchAll_1(stream, maybeError => tsplus_module_16.match_(maybeError, () => that(), e => failNow_1(tsplus_module_3.just(e))));
1924
+ return catchAll_1(stream, maybeError => tsplus_module_20.match_(maybeError, () => that(), e => failNow_1(tsplus_module_3.just(e))));
1935
1925
  }
1936
1926
  /**
1937
1927
  * Succeeds with the specified value if this one fails with a typed error.
@@ -1995,7 +1985,7 @@ class Rechunker {
1995
1985
  const result = this.builder;
1996
1986
  this.builder = [];
1997
1987
  this.pos = 0;
1998
- return tsplus_module_18.from(result);
1988
+ return tsplus_module_19.from(result);
1999
1989
  }
2000
1990
 
2001
1991
  return null;
@@ -2003,7 +1993,7 @@ class Rechunker {
2003
1993
 
2004
1994
  emitOfNotEmpty() {
2005
1995
  if (this.pos !== 0) {
2006
- return tsplus_module_10.writeNow(tsplus_module_18.from(this.builder));
1996
+ return tsplus_module_10.writeNow(tsplus_module_19.from(this.builder));
2007
1997
  } else {
2008
1998
  return tsplus_module_10.unit;
2009
1999
  }
@@ -2062,7 +2052,7 @@ function rechunk_(stream, n) {
2062
2052
 
2063
2053
 
2064
2054
  function repeatValue(a) {
2065
- return new _definition2.Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(tsplus_module_18.single(a))));
2055
+ return new _definition2.Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(tsplus_module_19.single(a))));
2066
2056
  }
2067
2057
  /**
2068
2058
  * Creates a stream from an effect producing a value of type `A` which repeats forever.
@@ -2072,7 +2062,7 @@ function repeatValue(a) {
2072
2062
 
2073
2063
 
2074
2064
  function repeatIO(fa) {
2075
- return repeatIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2335:42"));
2065
+ return repeatIOMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2382:42"));
2076
2066
  }
2077
2067
  /**
2078
2068
  * Creates a stream from an effect producing values of type `A` until it fails with None.
@@ -2082,7 +2072,7 @@ function repeatIO(fa) {
2082
2072
 
2083
2073
 
2084
2074
  function repeatIOMaybe_1(fa) {
2085
- return repeatIOChunkMaybe_1(tsplus_module_1.map_(fa, tsplus_module_18.single, fileName_1 + ":2344:35"));
2075
+ return repeatIOChunkMaybe_1(tsplus_module_1.map_(fa, tsplus_module_19.single, fileName_1 + ":2391:35"));
2086
2076
  }
2087
2077
  /**
2088
2078
  * Creates a stream from an effect producing chunks of `A` values which repeats forever.
@@ -2092,7 +2082,7 @@ function repeatIOMaybe_1(fa) {
2092
2082
 
2093
2083
 
2094
2084
  function repeatIOChunk(fa) {
2095
- return repeatIOChunkMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2353:40"));
2085
+ return repeatIOChunkMaybe_1(tsplus_module_1.mapError_(fa, tsplus_module_3.just, fileName_1 + ":2400:40"));
2096
2086
  }
2097
2087
  /**
2098
2088
  * Creates a stream from an effect producing chunks of `A` values until it fails with None.
@@ -2102,7 +2092,7 @@ function repeatIOChunk(fa) {
2102
2092
 
2103
2093
 
2104
2094
  function repeatIOChunkMaybe_1(fa) {
2105
- return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll_(tsplus_module_1.map_(fa, chunk => tsplus_module_3.just((0, _function.tuple)(chunk, undefined)), fileName_1 + ":2364:11"), maybeError => tsplus_module_16.match_(maybeError, () => tsplus_module_1.succeedNow(tsplus_module_3.nothing(), fileName_1 + ":2365:69"), tsplus_module_1.failNow), fileName_1 + ":2365:16"));
2095
+ return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll_(tsplus_module_1.map_(fa, chunk => tsplus_module_3.just((0, _function.tuple)(chunk, undefined)), fileName_1 + ":2411:11"), maybeError => tsplus_module_20.match_(maybeError, () => tsplus_module_1.succeedNow(tsplus_module_3.nothing(), fileName_1 + ":2412:69"), tsplus_module_1.failNow), fileName_1 + ":2412:16"));
2106
2096
  }
2107
2097
  /**
2108
2098
  * Runs the sink on the stream to produce either the sink's result or an error.
@@ -2122,7 +2112,7 @@ function run_1(stream, sink) {
2122
2112
 
2123
2113
 
2124
2114
  function runCollect(stream) {
2125
- return run_1(stream, tsplus_module_45.collectAll());
2115
+ return run_1(stream, tsplus_module_46.collectAll());
2126
2116
  }
2127
2117
  /**
2128
2118
  * Runs the stream and collects ignore its elements.
@@ -2132,7 +2122,7 @@ function runCollect(stream) {
2132
2122
 
2133
2123
 
2134
2124
  function runDrain(stream) {
2135
- return run_1(stream, tsplus_module_45.drain);
2125
+ return run_1(stream, tsplus_module_46.drain);
2136
2126
  }
2137
2127
  /**
2138
2128
  * @tsplus fluent fncts.io.Stream runForeachScoped
@@ -2140,7 +2130,7 @@ function runDrain(stream) {
2140
2130
 
2141
2131
 
2142
2132
  function runForeachScoped_1(self, f) {
2143
- return runScoped_1(self, tsplus_module_45.foreach(f));
2133
+ return runScoped_1(self, tsplus_module_46.foreach(f));
2144
2134
  }
2145
2135
  /**
2146
2136
  * Like `into`, but provides the result as a `Managed` to allow for scope
@@ -2151,8 +2141,8 @@ function runForeachScoped_1(self, f) {
2151
2141
 
2152
2142
 
2153
2143
  function runIntoElementsScoped_1(stream, queue) {
2154
- const writer = tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_12.foldLeft_(inp, tsplus_module_10.unit, (channel, a) => tsplus_module_11.apSecond_(channel, tsplus_module_10.writeNow(tsplus_module_37.succeed(a)))), writer), err => tsplus_module_10.writeNow(tsplus_module_37.fail(tsplus_module_3.just(err))), () => tsplus_module_10.writeNow(tsplus_module_37.fail(tsplus_module_3.nothing())));
2155
- return tsplus_module_1.asUnit(tsplus_module_23.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), exit => tsplus_module_25.offer_(queue, exit)))));
2144
+ const writer = tsplus_module_10.readWith(inp => tsplus_module_11.apSecond_(tsplus_module_12.foldLeft_(inp, tsplus_module_10.unit, (channel, a) => tsplus_module_11.apSecond_(channel, tsplus_module_10.writeNow(tsplus_module_39.succeed(a)))), writer), err => tsplus_module_10.writeNow(tsplus_module_39.fail(tsplus_module_3.just(err))), () => tsplus_module_10.writeNow(tsplus_module_39.fail(tsplus_module_3.nothing())));
2145
+ return tsplus_module_1.asUnit(tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), exit => tsplus_module_27.offer_(queue, exit)))));
2156
2146
  }
2157
2147
  /**
2158
2148
  * Like `Stream#into`, but provides the result as a `Managed` to allow for scope
@@ -2163,8 +2153,8 @@ function runIntoElementsScoped_1(stream, queue) {
2163
2153
 
2164
2154
 
2165
2155
  function runIntoQueueScoped_1(stream, queue) {
2166
- const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_24.chunk(inp)), writer), cause => tsplus_module_10.writeNow(tsplus_module_24.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_24.end));
2167
- return tsplus_module_1.asUnit(tsplus_module_23.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), take => tsplus_module_25.offer_(queue, take)))));
2156
+ const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_26.chunk(inp)), writer), cause => tsplus_module_10.writeNow(tsplus_module_26.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_26.end));
2157
+ return tsplus_module_1.asUnit(tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO_(tsplus_module_10.pipeTo_(stream.channel, writer), take => tsplus_module_27.offer_(queue, take)))));
2168
2158
  }
2169
2159
  /**
2170
2160
  * Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
@@ -2175,7 +2165,7 @@ function runIntoQueueScoped_1(stream, queue) {
2175
2165
 
2176
2166
 
2177
2167
  function runIntoHubScoped_1(stream, hub) {
2178
- return runIntoQueueScoped_1(stream, tsplus_module_30.toQueue(hub));
2168
+ return runIntoQueueScoped_1(stream, tsplus_module_32.toQueue(hub));
2179
2169
  }
2180
2170
  /**
2181
2171
  * Runs the sink on the stream to produce either the sink's result or an error.
@@ -2185,7 +2175,7 @@ function runIntoHubScoped_1(stream, hub) {
2185
2175
 
2186
2176
 
2187
2177
  function runScoped_1(stream, sink) {
2188
- return tsplus_module_23.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeToOrFail_(stream.channel, sink.channel)));
2178
+ return tsplus_module_17.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeToOrFail_(stream.channel, sink.channel)));
2189
2179
  }
2190
2180
  /**
2191
2181
  * Statefully maps over the elements of this stream to produce all intermediate results
@@ -2196,7 +2186,7 @@ function runScoped_1(stream, sink) {
2196
2186
 
2197
2187
 
2198
2188
  function scan_(sa, b, f) {
2199
- return scanIO_1(sa, b, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2484:46"));
2189
+ return scanIO_1(sa, b, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2531:46"));
2200
2190
  }
2201
2191
  /**
2202
2192
  * Statefully and effectfully maps over the elements of this stream to produce all
@@ -2207,7 +2197,7 @@ function scan_(sa, b, f) {
2207
2197
 
2208
2198
 
2209
2199
  function scanIO_1(sa, b, f) {
2210
- return concat_1(succeedNow_1(b), mapAccumIO_1(sa, b, (b, a) => tsplus_module_1.map_(f(b, a), b => [b, b], fileName_1 + ":2498:76")));
2200
+ return concat_1(succeedNow_1(b), mapAccumIO_1(sa, b, (b, a) => tsplus_module_1.map_(f(b, a), b => [b, b], fileName_1 + ":2545:76")));
2211
2201
  }
2212
2202
  /**
2213
2203
  * Statefully maps over the elements of this stream to produce all
@@ -2218,7 +2208,7 @@ function scanIO_1(sa, b, f) {
2218
2208
 
2219
2209
 
2220
2210
  function scanReduce_(fa, f) {
2221
- return scanReduceIO_1(fa, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2508:49"));
2211
+ return scanReduceIO_1(fa, (b, a) => tsplus_module_1.succeedNow(f(b, a), fileName_1 + ":2555:49"));
2222
2212
  }
2223
2213
  /**
2224
2214
  * Statefully and effectfully maps over the elements of this stream to produce
@@ -2229,7 +2219,7 @@ function scanReduce_(fa, f) {
2229
2219
 
2230
2220
 
2231
2221
  function scanReduceIO_1(fa, f) {
2232
- return mapAccumIO_1(fa, tsplus_module_3.nothing(), (s, a) => tsplus_module_16.match_(s, () => tsplus_module_1.succeedNow([a, tsplus_module_3.just(a)], fileName_1 + ":2523:26"), b => tsplus_module_1.map_(f(b, a), b => [b, tsplus_module_3.just(b)], fileName_1 + ":2524:25")));
2222
+ return mapAccumIO_1(fa, tsplus_module_3.nothing(), (s, a) => tsplus_module_20.match_(s, () => tsplus_module_1.succeedNow([a, tsplus_module_3.just(a)], fileName_1 + ":2570:26"), b => tsplus_module_1.map_(f(b, a), b => [b, tsplus_module_3.just(b)], fileName_1 + ":2571:25")));
2233
2223
  }
2234
2224
  /**
2235
2225
  * Creates a single-valued pure stream
@@ -2239,7 +2229,7 @@ function scanReduceIO_1(fa, f) {
2239
2229
 
2240
2230
 
2241
2231
  function succeedNow_1(o) {
2242
- return fromChunkNow_1(tsplus_module_18.single(o));
2232
+ return fromChunkNow_1(tsplus_module_19.single(o));
2243
2233
  }
2244
2234
  /**
2245
2235
  * Creates a single-valued pure stream
@@ -2249,7 +2239,7 @@ function succeedNow_1(o) {
2249
2239
 
2250
2240
 
2251
2241
  function succeed(a) {
2252
- return fromChunk_1(() => tsplus_module_18.single(a()));
2242
+ return fromChunk_1(() => tsplus_module_19.single(a()));
2253
2243
  }
2254
2244
 
2255
2245
  function takeLoop(n) {
@@ -2288,12 +2278,22 @@ function take_(stream, n) {
2288
2278
 
2289
2279
 
2290
2280
  function takeUntilIO_(ma, f) {
2291
- return loopOnPartialChunks_1(ma, (chunk, emit) => tsplus_module_1.map_(tsplus_module_63.takeWhileIO_(chunk, v => tsplus_module_1.apSecond_(emit(v), tsplus_module_1.map_(f(v), b => !b, fileName_1 + ":2587:52"), fileName_1 + ":2587:43")), taken => tsplus_module_12.isEmpty(tsplus_module_12.take_(tsplus_module_12.drop_(taken, taken.length), 1)), fileName_1 + ":2588:11"));
2281
+ return new _definition2.Stream(tsplus_module_10.pipeTo_(ma.channel, takeUntilIOLoop(tsplus_module_38.empty()[Symbol.iterator](), f)));
2282
+ }
2283
+
2284
+ function takeUntilIOLoop(iterator, f) {
2285
+ const next = iterator.next();
2286
+
2287
+ if (next.done) {
2288
+ return tsplus_module_10.readWithCause(elem => takeUntilIOLoop(elem[Symbol.iterator](), f), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
2289
+ } else {
2290
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(next.value), b => b ? tsplus_module_10.writeNow(tsplus_module_19.single(next.value)) : tsplus_module_11.apSecond_(tsplus_module_10.writeNow(tsplus_module_19.single(next.value)), takeUntilIOLoop(iterator, f)), fileName_1 + ":2648:24"));
2291
+ }
2292
2292
  }
2293
2293
 
2294
2294
  function takeUntilLoop(p) {
2295
2295
  return tsplus_module_10.readWith(chunk => {
2296
- const taken = tsplus_module_12.takeWhile_(chunk, tsplus_module_46.invert(p));
2296
+ const taken = tsplus_module_12.takeWhile_(chunk, tsplus_module_47.invert(p));
2297
2297
  const last = tsplus_module_12.take_(tsplus_module_12.drop_(chunk, taken.length), 1);
2298
2298
 
2299
2299
  if (tsplus_module_12.isEmpty(last)) {
@@ -2333,11 +2333,11 @@ function tap_(ma, f) {
2333
2333
 
2334
2334
 
2335
2335
  function throttleEnforce_(sa, costFn, units, duration, burst = 0) {
2336
- return throttleEnforceIO_1(sa, chunk => tsplus_module_1.succeedNow(costFn(chunk), fileName_1 + ":2640:55"), units, duration, burst);
2336
+ return throttleEnforceIO_1(sa, chunk => tsplus_module_1.succeedNow(costFn(chunk), fileName_1 + ":2705:55"), units, duration, burst);
2337
2337
  }
2338
2338
 
2339
2339
  function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp) {
2340
- return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(tsplus_module_1.zipWith_(costFn(inp), tsplus_module_40.currentTime, (weight, current) => {
2340
+ return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith_(costFn(inp), tsplus_module_41.currentTime, (weight, current) => {
2341
2341
  const elapsed = current - timestamp;
2342
2342
  const cycles = elapsed / duration;
2343
2343
 
@@ -2361,7 +2361,7 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
2361
2361
 
2362
2362
 
2363
2363
  function throttleEnforceIO_1(sa, costFn, units, duration, burst = 0) {
2364
- return new _definition2.Stream(tsplus_module_11.flatMap_(tsplus_module_10.fromIO(tsplus_module_40.currentTime), current => tsplus_module_10.pipeTo_(sa.channel, throttleEnforceIOLoop(costFn, units, duration, burst, units, current))));
2364
+ return new _definition2.Stream(tsplus_module_11.flatMap_(tsplus_module_10.fromIO(() => tsplus_module_41.currentTime), current => tsplus_module_10.pipeTo_(sa.channel, throttleEnforceIOLoop(costFn, units, duration, burst, units, current))));
2365
2365
  }
2366
2366
  /**
2367
2367
  * Converts the stream to a managed hub of chunks. After the managed hub is used,
@@ -2372,7 +2372,7 @@ function throttleEnforceIO_1(sa, costFn, units, duration, burst = 0) {
2372
2372
 
2373
2373
 
2374
2374
  function toHub_1(stream, capacity) {
2375
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_30.makeBounded(capacity), _ => tsplus_module_30.shutdown(_)), hub => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => hub), fileName_1 + ":2706:18");
2375
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_32.makeBounded(capacity), _ => tsplus_module_32.shutdown(_)), hub => tsplus_module_1.map_(tsplus_module_1.fork(runIntoHubScoped_1(stream, hub)), () => hub), fileName_1 + ":2771:18");
2376
2376
  }
2377
2377
  /**
2378
2378
  * Interpret the stream as a managed pull
@@ -2382,7 +2382,7 @@ function toHub_1(stream, capacity) {
2382
2382
 
2383
2383
 
2384
2384
  function toPull_1(stream) {
2385
- return tsplus_module_1.map_(tsplus_module_64.toPull(stream.channel), io => tsplus_module_1.flatMap_(tsplus_module_1.mapError_(io, tsplus_module_3.just, fileName_1 + ":2719:16"), r => tsplus_module_4.match_(r, () => tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":2719:68"), tsplus_module_1.succeedNow), fileName_1 + ":2719:36"), fileName_1 + ":2718:35");
2385
+ return tsplus_module_1.map_(tsplus_module_63.toPull(stream.channel), io => tsplus_module_1.flatMap_(tsplus_module_1.mapError_(io, tsplus_module_3.just, fileName_1 + ":2784:16"), r => tsplus_module_4.match_(r, () => tsplus_module_1.failNow(tsplus_module_3.nothing(), fileName_1 + ":2784:68"), tsplus_module_1.succeedNow), fileName_1 + ":2784:36"), fileName_1 + ":2783:35");
2386
2386
  }
2387
2387
  /**
2388
2388
  * Converts the stream to a managed queue of chunks. After the managed queue is used,
@@ -2393,7 +2393,7 @@ function toPull_1(stream) {
2393
2393
 
2394
2394
 
2395
2395
  function toQueue_1(stream, capacity = 2) {
2396
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeBounded(capacity), _ => tsplus_module_25.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2731:20");
2396
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2796:20");
2397
2397
  }
2398
2398
  /**
2399
2399
  * @tsplus fluent fncts.io.Stream toQueueDropping
@@ -2401,7 +2401,7 @@ function toQueue_1(stream, capacity = 2) {
2401
2401
 
2402
2402
 
2403
2403
  function toQueueDropping_(stream, capacity = 2) {
2404
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeDropping(capacity), _ => tsplus_module_25.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2745:20");
2404
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeDropping(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2810:20");
2405
2405
  }
2406
2406
  /**
2407
2407
  * @tsplus fluent fncts.io.Stream toQueueOfElements
@@ -2409,7 +2409,7 @@ function toQueueDropping_(stream, capacity = 2) {
2409
2409
 
2410
2410
 
2411
2411
  function toQueueOfElements_1(stream, capacity = 2) {
2412
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeBounded(capacity), _ => tsplus_module_25.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoElementsScoped_1(stream, queue)), () => queue), fileName_1 + ":2759:20");
2412
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeBounded(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoElementsScoped_1(stream, queue)), () => queue), fileName_1 + ":2824:20");
2413
2413
  }
2414
2414
  /**
2415
2415
  * @tsplus fluent fncts.io.Stream toQueueSliding
@@ -2417,7 +2417,7 @@ function toQueueOfElements_1(stream, capacity = 2) {
2417
2417
 
2418
2418
 
2419
2419
  function toQueueSliding_(stream, capacity = 2) {
2420
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeSliding(capacity), _ => tsplus_module_25.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2773:20");
2420
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeSliding(capacity), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2838:20");
2421
2421
  }
2422
2422
  /**
2423
2423
  * Converts the stream into an unbounded managed queue. After the managed queue
@@ -2428,11 +2428,11 @@ function toQueueSliding_(stream, capacity = 2) {
2428
2428
 
2429
2429
 
2430
2430
  function toQueueUnbounded_1(stream) {
2431
- return tsplus_module_1.flatMap_(tsplus_module_28.acquireRelease(() => tsplus_module_27.makeUnbounded(), _ => tsplus_module_25.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2787:20");
2431
+ return tsplus_module_1.flatMap_(tsplus_module_30.acquireRelease(() => tsplus_module_29.makeUnbounded(), _ => tsplus_module_27.shutdown(_)), queue => tsplus_module_1.map_(tsplus_module_1.fork(runIntoQueueScoped_1(stream, queue)), () => queue), fileName_1 + ":2852:20");
2432
2432
  }
2433
2433
 
2434
2434
  function unfoldChunkIOLoop(s, f) {
2435
- return tsplus_module_10.unwrap(tsplus_module_1.map_(f(s), m => tsplus_module_16.match_(m, () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkIOLoop(s, f))), fileName_1 + ":2798:13"));
2435
+ return tsplus_module_10.unwrap(() => tsplus_module_1.map_(f(s), m => tsplus_module_20.match_(m, () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkIOLoop(s, f))), fileName_1 + ":2863:13"));
2436
2436
  }
2437
2437
  /**
2438
2438
  * Creates a stream by effectfully peeling off the "layers" of a value of type `S`
@@ -2452,11 +2452,11 @@ function unfoldChunkIO_1(s, f) {
2452
2452
 
2453
2453
 
2454
2454
  function unfoldIO_1(s, f) {
2455
- return unfoldChunkIO_1(s, _ => tsplus_module_1.map_(f(_), m => tsplus_module_36.map_(m, ([a, s]) => (0, _function.tuple)(tsplus_module_18.single(a), s)), fileName_1 + ":2822:42"));
2455
+ return unfoldChunkIO_1(s, _ => tsplus_module_1.map_(f(_), m => tsplus_module_37.map_(m, ([a, s]) => (0, _function.tuple)(tsplus_module_19.single(a), s)), fileName_1 + ":2887:42"));
2456
2456
  }
2457
2457
 
2458
2458
  function unfoldChunkLoop(s, f) {
2459
- return tsplus_module_16.match_(f(s), () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkLoop(s, f)));
2459
+ return tsplus_module_20.match_(f(s), () => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap_(tsplus_module_10.writeNow(as), () => unfoldChunkLoop(s, f)));
2460
2460
  }
2461
2461
  /**
2462
2462
  * @tsplus static fncts.io.StreamOps unfoldChunk
@@ -2472,7 +2472,7 @@ function unfoldChunk_1(s, f) {
2472
2472
 
2473
2473
 
2474
2474
  function unfold(s, f) {
2475
- return unfoldChunk_1(s, s => tsplus_module_36.map_(f(s), ([a, s]) => (0, _function.tuple)(tsplus_module_18.single(a), s)));
2475
+ return unfoldChunk_1(s, s => tsplus_module_37.map_(f(s), ([a, s]) => (0, _function.tuple)(tsplus_module_19.single(a), s)));
2476
2476
  }
2477
2477
  /**
2478
2478
  * Creates a stream produced from an IO
@@ -2509,9 +2509,9 @@ function unwrapScoped_1(stream) {
2509
2509
 
2510
2510
  function zipWithLatest_(fa, fb, f) {
2511
2511
  function pullNonEmpty(pull) {
2512
- return tsplus_module_1.flatMap_(pull, chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull) : tsplus_module_1.succeedNow(chunk, fileName_1 + ":2886:90"), fileName_1 + ":2886:24");
2512
+ return tsplus_module_1.flatMap_(pull, chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull) : tsplus_module_1.succeedNow(chunk, fileName_1 + ":2951:90"), fileName_1 + ":2951:24");
2513
2513
  }
2514
2514
 
2515
- return fromPull_1(tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fa), pullNonEmpty, fileName_1 + ":2890:36"), left => tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fb), pullNonEmpty, fileName_1 + ":2891:36"), right => toPull_1(flatMap_1(fromIOMaybe_1(tsplus_module_22.raceWith_(left, () => right, (leftDone, rightFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(leftDone, fileName_1 + ":2896:53"), tsplus_module_39.join(rightFiber), (l, r) => (0, _function.tuple)(l, r, true)), (rightDone, leftFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(rightDone, fileName_1 + ":2897:53"), tsplus_module_39.join(leftFiber), (r, l) => (0, _function.tuple)(l, r, false)), fileName_1 + ":2894:24")), ([l, r, leftFirst]) => flatMap_1(fromIO_1(tsplus_module_6.make(() => (0, _function.tuple)(tsplus_module_12.unsafeGet_(l, l.length - 1), tsplus_module_12.unsafeGet_(r, r.length - 1)))), latest => concat_1(fromChunk_1(() => leftFirst ? tsplus_module_12.map_(r, b => f(tsplus_module_12.unsafeGet_(l, l.length - 1), b)) : tsplus_module_12.map_(l, a => f(a, tsplus_module_12.unsafeGet_(r, r.length - 1)))), flatMap_1(mapIO_1(mergeEither_1(repeatIOMaybe_1(left), repeatIOMaybe_1(right)), ab => tsplus_module_4.match_(ab, leftChunk => tsplus_module_14.modify_(latest, ([_, rightLatest]) => (0, _function.tuple)(tsplus_module_12.map_(leftChunk, a => f(a, rightLatest)), (0, _function.tuple)(tsplus_module_12.unsafeGet_(leftChunk, leftChunk.length - 1), rightLatest))), rightChunk => tsplus_module_14.modify_(latest, ([leftLatest, _]) => (0, _function.tuple)(tsplus_module_12.map_(rightChunk, b => f(leftLatest, b)), (0, _function.tuple)(leftLatest, tsplus_module_12.unsafeGet_(rightChunk, rightChunk.length - 1)))))), fromChunkNow_1))))), fileName_1 + ":2891:22"), fileName_1 + ":2890:22"));
2515
+ return fromPull_1(tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fa), pullNonEmpty, fileName_1 + ":2955:36"), left => tsplus_module_1.flatMap_(tsplus_module_1.map_(toPull_1(fb), pullNonEmpty, fileName_1 + ":2956:36"), right => toPull_1(flatMap_1(fromIOMaybe_1(tsplus_module_24.raceWith_(left, () => right, (leftDone, rightFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(leftDone, fileName_1 + ":2961:53"), tsplus_module_22.join(rightFiber), (l, r) => (0, _function.tuple)(l, r, true)), (rightDone, leftFiber) => tsplus_module_1.zipWith_(tsplus_module_1.fromExitNow(rightDone, fileName_1 + ":2962:53"), tsplus_module_22.join(leftFiber), (r, l) => (0, _function.tuple)(l, r, false)), fileName_1 + ":2959:24")), ([l, r, leftFirst]) => flatMap_1(fromIO_1(tsplus_module_6.make(() => (0, _function.tuple)(tsplus_module_12.unsafeGet_(l, l.length - 1), tsplus_module_12.unsafeGet_(r, r.length - 1)))), latest => concat_1(fromChunk_1(() => leftFirst ? tsplus_module_12.map_(r, b => f(tsplus_module_12.unsafeGet_(l, l.length - 1), b)) : tsplus_module_12.map_(l, a => f(a, tsplus_module_12.unsafeGet_(r, r.length - 1)))), flatMap_1(mapIO_1(mergeEither_1(repeatIOMaybe_1(left), repeatIOMaybe_1(right)), ab => tsplus_module_4.match_(ab, leftChunk => tsplus_module_15.modify_(latest, ([_, rightLatest]) => (0, _function.tuple)(tsplus_module_12.map_(leftChunk, a => f(a, rightLatest)), (0, _function.tuple)(tsplus_module_12.unsafeGet_(leftChunk, leftChunk.length - 1), rightLatest))), rightChunk => tsplus_module_15.modify_(latest, ([leftLatest, _]) => (0, _function.tuple)(tsplus_module_12.map_(rightChunk, b => f(leftLatest, b)), (0, _function.tuple)(leftLatest, tsplus_module_12.unsafeGet_(rightChunk, rightChunk.length - 1)))))), fromChunkNow_1))))), fileName_1 + ":2956:22"), fileName_1 + ":2955:22"));
2516
2516
  }
2517
2517
  //# sourceMappingURL=api.cjs.map