import { useState as T, useRef as _, useCallback as A, useEffect as N } from "../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { FilterParam as t } from "../components/types.js";
import { getTimeRangeSelectionDefaultPresetOptions as f, TIME_RANGE_SELECTION_PRESET_OPTION_KEYS as l } from "../components/internal/DatePicker/components/TimeRangeSelector/useTimeRangeSelection.js";
import { DEFAULT_TRANSACTIONS_OVERVIEW_MULTI_SELECTION_FILTER_PARAMS as O } from "../components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/constants.js";
const S = (e, a, r) => {
  const o = f(), s = a ? `common.filters.types.date.rangeSelect.options.${a}` : l.LAST_30_DAYS, { from: n, to: i } = o[s];
  return { defaultFilterParams: {
    ...e === "transactions" && {
      ...O,
      [t.MIN_AMOUNT]: void 0,
      [t.MAX_AMOUNT]: void 0
    },
    ...e !== "paymentLinks" && {
      [t.BALANCE_ACCOUNT]: void 0
    },
    ...e === "paymentLinks" && {
      [t.MERCHANT_REFERENCE]: void 0,
      [t.PAYMENT_LINK_ID]: void 0,
      [t.MIN_AMOUNT]: void 0,
      [t.MAX_AMOUNT]: void 0
    },
    [t.CREATED_SINCE]: new Date(n).toISOString(),
    [t.CREATED_UNTIL]: new Date(i).toISOString()
  }, defaultTimeRange: s, timeRangeOptions: r || o };
}, d = (e, a, r, o) => {
  const [s, n] = T(() => Date.now()), i = S(e, r, o), E = _(i), m = A(() => n(Date.now()), [n]);
  return N(() => {
    m();
  }, [a, m]), { defaultParams: E, nowTimestamp: s, refreshNowTimestamp: m };
};
export {
  d as default
};
