import { SHJDatasourceV2 as c } from "../index.mjs";
import { DataSourceUtils as o } from "../utils/utils.mjs";
const d = (t, s, e) => {
  try {
    let a = {};
    const r = new URLSearchParams(window.location.search);
    if (r.toString() && (a = Object.fromEntries(r.entries())), Object.keys(a).length === 0 && window.location.hash) {
      const n = window.location.hash.indexOf("?");
      if (n !== -1) {
        const i = window.location.hash.substring(n + 1), h = new URLSearchParams(i);
        a = Object.fromEntries(h.entries());
      }
    }
    c.processData(t.source, a, t.id, s).then((n) => {
      e(n);
    }).catch(() => {
      e(o.noneData(t.id));
    });
    return;
  } catch {
    e(o.noneData(t.id));
  }
};
export {
  d as parseUrlData
};
