const w = (e) => {
  const n = e.indexOf("?");
  return n === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(n + 1));
};
function d(e) {
  if (typeof window > "u")
    return null;
  const { search: n, hash: r } = window.location, t = new URLSearchParams(n).get(e);
  return t !== null ? t : w(r).get(e);
}
function S(e) {
  if (typeof window > "u" || !e.length)
    return;
  const { pathname: n, search: r, hash: t } = window.location, i = new URLSearchParams(r);
  e.forEach((a) => {
    i.delete(a);
  });
  const c = t.indexOf("?");
  let o = t;
  if (c !== -1) {
    const a = t.slice(0, c), s = new URLSearchParams(t.slice(c + 1));
    e.forEach((l) => {
      s.delete(l);
    }), o = s.toString() ? `${a}?${s.toString()}` : a;
  }
  const h = i.toString(), u = h ? `${n}?${h}${o}` : `${n}${o}`;
  `${n}${r}${t}` !== u && window.history.replaceState(null, document.title, u);
}
export {
  d as getQueryParameter,
  S as removeQueryParameters
};
//# sourceMappingURL=url.mjs.map
