import * as tsplus_module_1 from "@effect/core/stm/TRef/operations/unsafeGet";
import * as tsplus_module_2 from "@effect/core/stm/TMap/operations/indexOf";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Chunk/unsafeGet";
import * as tsplus_module_4 from "@tsplus/stdlib/structure/Equals";
import * as tsplus_module_5 from "@tsplus/stdlib/collections/List/partition";
import * as tsplus_module_6 from "@tsplus/stdlib/collections/List/definition";
import * as tsplus_module_7 from "@effect/core/stm/TRef/operations/unsafeSet";
import * as tsplus_module_8 from "@tsplus/stdlib/collections/Chunk/definition";
import * as tsplus_module_9 from "@tsplus/stdlib/collections/Chunk/forEach";
import * as tsplus_module_10 from "@effect/core/stm/STM/operations/effect";
import { concreteTArray } from "@effect/core/stm/TArray/operations/_internal/InternalTArray";
import { concreteTMap } from "@effect/core/stm/TMap/operations/_internal/InternalTMap";
/**
 * Deletes all entries associated with the specified keys.
 *
 * @tsplus fluent ets/TMap deleteAll
 */

export function deleteAll_(self, ks) {
  void 0;
  return tsplus_module_10.effect(journal => {
    tsplus_module_9.forEach_(tsplus_module_8.from(ks), k => {
      const buckets = tsplus_module_1.unsafeGet_(self.tBuckets, journal);
      void 0;
      const idx = tsplus_module_2.indexOf(k, buckets.chunk.length);
      const bucket = tsplus_module_1.unsafeGet_(tsplus_module_3.unsafeGet_(buckets.chunk, idx), journal);
      const {
        tuple: [toRemove, toRetain]
      } = tsplus_module_5.partition_(bucket, _ => !tsplus_module_4.equals(_.get(0), k));

      if (tsplus_module_6.isCons(toRemove)) {
        const currSize = tsplus_module_1.unsafeGet_(self.tSize, journal);
        tsplus_module_7.unsafeSet_(tsplus_module_3.unsafeGet_(buckets.chunk, idx), toRetain, journal);
        tsplus_module_7.unsafeSet_(self.tSize, currSize - 1, journal);
      }
    });
  });
}
/**
 * Deletes all entries associated with the specified keys.
 *
 * @tsplus static ets/TMap/Aspects deleteAll
 */

export const deleteAll = ks => self => deleteAll_(self, ks);
//# sourceMappingURL=deleteAll.mjs.map