function l(t, o) {
  return o = { exports: {} }, t(o, o.exports), o.exports;
}
var p = l(function(t) {
  var o = t.exports = function(r, e) {
    if (e || (e = 16), r === void 0 && (r = 128), r <= 0)
      return "0";
    for (var i = Math.log(Math.pow(2, r)) / Math.log(e), n = 2; i === 1 / 0; n *= 2)
      i = Math.log(Math.pow(2, r / n)) / Math.log(e) * n;
    for (var u = i - Math.floor(i), a = "", n = 0; n < Math.floor(i); n++) {
      var f = Math.floor(Math.random() * e).toString(e);
      a = f + a;
    }
    if (u) {
      var s = Math.pow(e, u), f = Math.floor(Math.random() * s).toString(e);
      a = f + a;
    }
    var c = parseInt(a, e);
    return c !== 1 / 0 && c >= Math.pow(2, r) ? o(r, e) : a;
  };
  o.rack = function(r, e, i) {
    var n = function(a) {
      var f = 0;
      do {
        if (f++ > 10)
          if (i)
            r += i;
          else
            throw new Error("too many ID collisions, use more bits");
        var s = o(r, e);
      } while (Object.hasOwnProperty.call(u, s));
      return u[s] = a, s;
    }, u = n.hats = {};
    return n.get = function(a) {
      return n.hats[a];
    }, n.set = function(a, f) {
      return n.hats[a] = f, n;
    }, n.bits = r || 128, n.base = e || 16, n;
  };
});
function h(t) {
  if (!(this instanceof h))
    return new h(t);
  t = t || [128, 36, 1], this._seed = t.length ? p.rack(t[0], t[1], t[2]) : t;
}
h.prototype.next = function(t) {
  return this._seed(t || true);
};
h.prototype.nextPrefixed = function(t, o) {
  var r;
  do
    r = t + this.next(true);
  while (this.assigned(r));
  return this.claim(r, o), r;
};
h.prototype.claim = function(t, o) {
  this._seed.set(t, o || true);
};
h.prototype.assigned = function(t) {
  return this._seed.get(t) || false;
};
h.prototype.unclaim = function(t) {
  delete this._seed.hats[t];
};
h.prototype.clear = function() {
  var t = this._seed.hats, o;
  for (o in t)
    this.unclaim(o);
};
export {
  h as default
};
