"use strict"
var __createBinding =
  (this && this.__createBinding) ||
  (Object.create
    ? function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        Object.defineProperty(o, k2, {
          enumerable: true,
          get: function () {
            return m[k]
          }
        })
      }
    : function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        o[k2] = m[k]
      })
var __setModuleDefault =
  (this && this.__setModuleDefault) ||
  (Object.create
    ? function (o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v })
      }
    : function (o, v) {
        o["default"] = v
      })
var __importStar =
  (this && this.__importStar) ||
  function (mod) {
    if (mod && mod.__esModule) return mod
    var result = {}
    if (mod != null)
      for (var k in mod)
        if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
          __createBinding(result, mod, k)
    __setModuleDefault(result, mod)
    return result
  }
Object.defineProperty(exports, "__esModule", { value: true })
exports.annotate =
  exports.update =
  exports.overwrite =
  exports.get =
  exports.concat =
  exports.TestAnnotationMap =
    void 0
const tracing_1 = __importStar(require("../../Tracing"))
const fileName_1 = "(@effect-ts/system): _src/Testing/TestAnnotationMap/index.ts"
const HashMap = __importStar(require("../../Collections/Immutable/HashMap"))
const L = __importStar(require("../../Collections/Immutable/List"))
const O = __importStar(require("../../Option"))
class TestAnnotationMap {
  constructor(map) {
    this.map = map
  }
}
exports.TestAnnotationMap = TestAnnotationMap
TestAnnotationMap.empty = new TestAnnotationMap(HashMap.make())
function concat(self, that) {
  const l = L.from(self.map)
  const r = L.from(that.map)
  return new TestAnnotationMap(
    L.reduce_(L.concat_(l, r), TestAnnotationMap.empty.map, (acc, [key, value]) =>
      HashMap.set_(
        acc,
        key,
        O.fold_(
          HashMap.get_(acc, key),
          () => value,
          (x) => key.combine(x, value)
        )
      )
    )
  )
}
exports.concat = concat
function get(key) {
  return (tam) =>
    O.fold_(
      HashMap.get_(tam.map, key),
      () => key.initial,
      (a) => a
    )
}
exports.get = get
function overwrite(key, value) {
  return (tam) => new TestAnnotationMap(HashMap.set_(tam.map, key, value))
}
exports.overwrite = overwrite
function update(key, f) {
  return (tam) => overwrite(key, f(get(key)(tam)))(tam)
}
exports.update = update
function annotate(key, value) {
  return (tam) => update(key, (_) => key.combine(_, value))(tam)
}
exports.annotate = annotate
//# sourceMappingURL=index.js.map
