import { GC_TIME_LONG, STALE_TIME_DEFAULT } from './chunk-XOPLS4S6.js';
import { QueryClient } from '@tanstack/react-query';

function createElevasisQueryClient(options = {}) {
  const { defaultOptions, onMutationError, ...queryClientOptions } = options;
  return new QueryClient({
    ...queryClientOptions,
    defaultOptions: {
      ...defaultOptions,
      queries: {
        staleTime: STALE_TIME_DEFAULT,
        gcTime: GC_TIME_LONG,
        retry: 1,
        refetchOnWindowFocus: false,
        ...defaultOptions?.queries
      },
      mutations: {
        ...defaultOptions?.mutations,
        onError: onMutationError ?? defaultOptions?.mutations?.onError
      }
    }
  });
}

export { createElevasisQueryClient };
