const g = /\sid="(\S+)"/g, s = /* @__PURE__ */ new Map();
function o(e) {
  e = e.replace(/[0-9]+$/, "") || "a";
  const n = s.get(e) || 0;
  return s.set(e, n + 1), n ? `${e}${n}` : e;
}
function u(e) {
  const n = [];
  let t;
  for (; t = g.exec(e); ) n.push(t[1]);
  if (!n.length) return e;
  const c = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  return n.forEach((r) => {
    const a = o(r), p = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    e = e.replace(new RegExp('([#;"])(' + p + ')([")]|\\.[a-z])', "g"), "$1" + a + c + "$3");
  }), e = e.replace(new RegExp(c, "g"), ""), e;
}
export {
  u as replaceIDs
};
