import { useMemo as u, useEffect as p } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { useFetch as a } from "../../../../hooks/useFetch.js";
import { useConfigContext as d } from "../../../../core/ConfigContext/preact/context.js";
import { EMPTY_OBJECT as C } from "../../../../utils/value/constants.js";
const T = (t, i, m, f, c) => {
  const { getPayByLinkSettings: o } = d().endpoints, { data: r, isFetching: n, error: s } = a(
    u(
      () => ({
        fetchOptions: {
          enabled: !!o && i && !!t,
          onSuccess: () => {
            m(!1), c(!1);
          }
        },
        queryFn: async () => o?.(C, { path: { storeId: t } })
      }),
      [o, t, i, m, c]
    )
  ), e = u(() => (!r || !r?.termsOfServiceUrl) && !n && !s ? { termsOfServiceUrl: "" } : r, [r, n, s]);
  return p(() => {
    f(e);
  }, [e, f]), { data: e, isFetching: n, error: s };
};
export {
  T as useStoreTermsAndConditions
};
