import { getDateRangeTimestamps as i } from "../../../internal/Calendar/calendar/timerange/utils.js";
import { INITIAL_FILTERS as u } from "../constants.js";
import { EMPTY_OBJECT as l } from "../../../../utils/value/constants.js";
const s = Object.keys(u), g = new Set(s), p = Object.freeze({
  klarna: "Klarna",
  paypal: "PayPal",
  klarna_paynow: "Klarna Pay Now"
}), P = (e, n) => {
  const { lastFourDigits: a, description: t, type: r } = e ?? l;
  return a ? n === "detail" ? `•••• •••• •••• ${a}` : a : t || p[r] || r;
}, d = (e, n) => {
  const { from: a, to: t } = i(e.createdDate, n, e.balanceAccount?.timeZone);
  return {
    balanceAccountId: e.balanceAccount?.id,
    // using type cast to ensure correct type inference
    categories: e.categories,
    createdSince: new Date(a).toISOString(),
    createdUntil: new Date(t).toISOString(),
    currencies: e.currencies,
    paymentPspReference: e.paymentPspReference,
    statuses: e.statuses
  };
}, T = (e, n) => {
  const { balanceAccountId: a, categories: t, currencies: r, statuses: c, ...o } = d(e, n);
  return {
    ...o,
    balanceAccountId: a || void 0,
    categories: String(t) || void 0,
    currencies: String(r) || void 0,
    statuses: String(c) || void 0
  };
}, I = (e, n, a = g) => s.some((t) => {
  if (a.has(t)) {
    const r = e[t], c = n[t];
    switch (t) {
      case "categories":
      case "currencies":
      case "statuses":
        return String(r) !== String(c);
      default:
        return r !== c;
    }
  }
});
export {
  I as compareTransactionsFilters,
  T as getTransactionsFilterParams,
  d as getTransactionsFilterQueryParams,
  P as parsePaymentMethodType
};
