import { jsx as t } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useMemo as I, useCallback as L } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { classes as o, TRANSACTION_ANALYTICS_SUBCATEGORY_LIST as S, TRANSACTION_ANALYTICS_CATEGORY as O } from "../../constants.js";
import { useTransactionsOverviewContext as w } from "../../context/TransactionsOverviewContext.js";
import { useLandedPageEvent as Y } from "../../../../../hooks/useAnalytics/useLandedPageEvent.js";
import { useDurationEvent as _ } from "../../../../../hooks/useAnalytics/useDurationEvent.js";
import k from "../TransactionsList/TransactionsList.js";
import x from "../TransactionTotals/TransactionTotals.js";
import D from "../Balances/Balances.js";
import { Alert as G } from "../../../../internal/Alert/Alert.js";
import { AlertTypeOption as W } from "../../../../internal/Alert/types.js";
import { ButtonVariant as P } from "../../../../internal/Button/types.js";
import j from "../../../../../core/Context/preact/useCoreContext.js";
import q from "../../../../internal/Button/Button.js";
import { Fragment as z } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
const d = {
  category: O,
  subCategory: S
}, st = () => {
  const {
    accountBalancesResult: i,
    balanceAccounts: p,
    currenciesLookupResult: l,
    isLoadingBalanceAccount: T,
    filters: A,
    onContactSupport: f,
    onRecordSelection: v,
    showDetails: C,
    transactionsListResult: g,
    transactionsTotalsResult: m,
    dataCustomization: N
  } = w(), { i18n: a } = j(), { error: R, isWaiting: b } = i, { error: B, isWaiting: y } = m, { currenciesDictionary: s, defaultCurrencySortedCurrencies: e } = l, { sortedBalances: E, sortedTotals: h } = I(() => {
    const n = e.map((r) => s[r].balances), c = e.map((r) => s[r].totals);
    return { sortedBalances: n, sortedTotals: c };
  }, [s, e]), u = L(
    ({ canRefresh: n, refresh: c }, r) => /* @__PURE__ */ t(
      G,
      {
        className: o.totalsError,
        type: W.WARNING,
        title: a.get(r),
        description: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(q, { variant: P.TERTIARY, onClick: c, disabled: !n, children: a.get("common.actions.refresh.labels.default") }) })
      }
    ),
    [a]
  );
  return Y(d), _(d), /* @__PURE__ */ t(z, { children: [
    /* @__PURE__ */ t("div", { className: o.summary, children: [
      /* @__PURE__ */ t("div", { className: o.summaryItem, children: B ? u(m, "transactions.overview.totals.error") : /* @__PURE__ */ t(x, { totals: h, loadingTotals: y }) }),
      /* @__PURE__ */ t("div", { className: o.summaryItem, children: R ? u(i, "transactions.overview.balances.error") : /* @__PURE__ */ t(D, { balances: E, loadingBalances: b }) })
    ] }),
    /* @__PURE__ */ t(
      k,
      {
        balanceAccount: A.balanceAccount,
        currenciesLookupResult: l,
        dataCustomization: N,
        loadingBalanceAccounts: T || !p,
        onContactSupport: f,
        onRecordSelection: v,
        showDetails: C,
        transactionsListResult: g
      }
    )
  ] });
};
export {
  st as default
};
