import { useMemo as l } from "../../../../../preact@10.29.0/node_modules/preact/hooks/dist/hooks.module.js";
import { m as u, R as a } from "./StoreProvider-CBB99upB.js";
import { skipToken as g } from "../../../../../@tanstack_query-core@5.95.2/node_modules/@tanstack/query-core/build/modern/utils.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "b0f60122-b064-4092-933f-46864d4cf67e", e._sentryDebugIdIdentifier = "sentry-dbid-b0f60122-b064-4092-933f-46864d4cf67e");
} catch {
}
const c = u();
function h(e, t) {
  const o = l(() => {
    if (!e) return;
    const s = Array.isArray(t) ? t : [t], n = e.entityAssociations?.filter((i) => s.includes(i.type)) ?? [];
    return n.length > 1 && c.warn(
      `Multiple matching associations found for types: ${s.join(", ")} - returning the first.
        ${n.map((i) => JSON.stringify(i, null, 2)).join(`
`)}`
    ), n[0];
  }, [e, t]), { data: r, refetch: f, isLoading: d } = a(
    o?.legalEntityId ?? g
  );
  return { data: r, refetch: f, isLoading: d };
}
export {
  h as u
};
