const i = () => {
  const t = window.location.hash;
  if (t.includes("?")) {
    const e = t.split("?")[1];
    return Object.fromEntries(new URLSearchParams(e));
  }
  return Object.fromEntries(new URLSearchParams(window.location.search));
};
function h(t) {
  const e = new URL(window.location.href);
  if (window.location.hash.startsWith("#/")) {
    const [r, n = ""] = window.location.hash.split("?"), s = new URLSearchParams(n);
    Object.entries(t).forEach(([a, c]) => {
      s.set(a, c);
    });
    const o = `${r}?${s.toString()}`;
    window.history.replaceState(null, "", o);
  } else
    Object.entries(t).forEach(([r, n]) => {
      e.searchParams.set(r, n);
    }), window.history.replaceState(null, "", e.toString());
}
function w() {
  return i();
}
export {
  w as getUrlQuery,
  h as setUrlQuery
};
