class r {
  constructor() {
    this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map();
  }
  add(t, ...i) {
    const e = i[0];
    if (this._map.set(t, e), e && typeof e == "object" && "id" in e) {
      if (this._idmap.has(e.id))
        throw new Error(`ID ${e.id} already exists in the registry`);
      this._idmap.set(e.id, t);
    }
    return this;
  }
  clear() {
    return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this;
  }
  remove(t) {
    const i = this._map.get(t);
    return i && typeof i == "object" && "id" in i && this._idmap.delete(i.id), this._map.delete(t), this;
  }
  get(t) {
    const i = t._zod.parent;
    if (i) {
      const e = { ...this.get(i) ?? {} };
      delete e.id;
      const s = { ...e, ...this._map.get(t) };
      return Object.keys(s).length ? s : void 0;
    }
    return this._map.get(t);
  }
  has(t) {
    return this._map.has(t);
  }
}
function n() {
  return new r();
}
const p = /* @__PURE__ */ n();
export {
  r as $ZodRegistry,
  p as globalRegistry,
  n as registry
};
//# sourceMappingURL=registries.js.map
