import { jsx as e } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import v from "classnames";
import { useMemo as f } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { classes as r } from "../../constants.js";
import { useTransactionsOverviewContext as S } from "../../context/TransactionsOverviewContext.js";
import b from "../../../../internal/SegmentedControl/SegmentedControl.js";
import g from "../TransactionFilters/TransactionFilters.js";
import T from "../TransactionsExport/TransactionsExport.js";
/* empty css                          */
import x from "../../../../../core/Context/preact/useCoreContext.js";
import { Fragment as i } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
import { Header as C } from "../../../../internal/Header/Header.js";
import { FilterBarMobileSwitch as B } from "../../../../internal/FilterBar/FilterBar.js";
const R = ({ children: h }) => {
  const { filterBarState: a, hideTitle: w, isTransactionsView: s, transactionsListResult: n, transactionsViewState: u } = S(), { activeView: l, onViewChange: m, viewTabs: o } = u, { isMobileContainer: t } = a, { i18n: c } = x(), p = f(
    () => s ? /* @__PURE__ */ e(T, { disabled: !n.page }) : null,
    [s, n.page]
  ), d = f(
    () => o.length > 1 ? /* @__PURE__ */ e(
      b,
      {
        "aria-label": c.get("transactions.overview.viewSelect.a11y.label"),
        activeItem: l,
        items: o,
        onChange: m
      }
    ) : null,
    [l, m, o, c]
  );
  return /* @__PURE__ */ e("div", { className: v(r.root, { [r.rootSmall]: t }), children: [
    /* @__PURE__ */ e(C, { hideTitle: w, titleKey: "transactions.overview.title", children: /* @__PURE__ */ e("div", { className: v({ [r.filterBarSmall]: t }), children: [
      t && p,
      /* @__PURE__ */ e(B, { ...a }),
      !t && /* @__PURE__ */ e(i, { children: d })
    ] }) }),
    t && /* @__PURE__ */ e(i, { children: d }),
    /* @__PURE__ */ e("div", { role: "toolbar", className: r.toolbar, children: [
      /* @__PURE__ */ e(g, {}),
      !t && /* @__PURE__ */ e(i, { children: p })
    ] }),
    h
  ] });
};
export {
  R as default
};
