import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/unsafeGet";
import * as tsplus_module_2 from "@effect/core/stm/TRef/operations/unsafeGet";
import * as tsplus_module_3 from "@effect/core/stm/TRef/operations/unsafeSet";
import * as tsplus_module_4 from "@effect/core/stm/STM/operations/effect";
import { concreteTArray } from "@effect/core/stm/TArray/operations/_internal/InternalTArray";
/**
 * Atomically updates all elements using a pure function.
 *
 * @tsplus fluent ets/TArray transform
 */

export function transform_(self, f) {
  return tsplus_module_4.effect(journal => {
    let i = 0;
    void 0;

    while (i < self.chunk.length) {
      const current = tsplus_module_2.unsafeGet_(tsplus_module_1.unsafeGet_(self.chunk, i), journal);
      tsplus_module_3.unsafeSet_(tsplus_module_1.unsafeGet_(self.chunk, i), f(current), journal);
      i = i + 1;
    }
  });
}
/**
 * Atomically updates all elements using a pure function.
 *
 * @tsplus static ets/TArray/Aspects transform
 */

export const transform = f => self => transform_(self, f);
//# sourceMappingURL=transform.mjs.map