var h = (i) => {
  throw TypeError(i);
};
var a = (i, e, t) => e.has(i) || h("Cannot " + t);
var m = (i, e, t) => (a(i, e, "read from private field"), t ? t.call(i) : e.get(i)), T = (i, e, t) => e.has(i) ? h("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), c = (i, e, t, o) => (a(i, e, "write to private field"), o ? o.call(i, t) : e.set(i, t), t);
import { isValidTimeout as l, isServer as u } from "./utils.js";
var s, r, v = (r = class {
  constructor() {
    T(this, s);
  }
  destroy() {
    this.clearGcTimeout();
  }
  scheduleGc() {
    this.clearGcTimeout(), l(this.gcTime) && c(this, s, setTimeout(() => {
      this.optionalRemove();
    }, this.gcTime));
  }
  updateGcTime(i) {
    this.gcTime = Math.max(
      this.gcTime || 0,
      i ?? (u ? 1 / 0 : 5 * 60 * 1e3)
    );
  }
  clearGcTimeout() {
    m(this, s) && (clearTimeout(m(this, s)), c(this, s, void 0));
  }
}, s = new WeakMap(), r);
export {
  v as Removable
};
//# sourceMappingURL=removable.js.map
