import { jsx as o } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import x from "../PaymentRefund/PaymentRefund.js";
import S from "../PaymentDetails/PaymentDetails.js";
import C from "../../../../internal/DataOverviewDetails/DataOverviewDetailsSkeleton.js";
import { ActiveView as l } from "../../types.js";
import { useLandedPageEvent as V } from "../../../../../hooks/useAnalytics/useLandedPageEvent.js";
import { useState as p, useRef as j, useMemo as n, useEffect as F } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { useModalContext as N } from "../../../../internal/Modal/Modal.js";
import { sharedTransactionDetailsEventProperties as O } from "../../constants.js";
/* empty css                     */
import Y from "../../hooks/useRefundMetadata/useRefundMetadata.js";
import { EMPTY_ARRAY as A } from "../../../../../utils/value/constants.js";
const Z = ({
  dataCustomization: R,
  extraFields: v,
  fetchingTransaction: D,
  refreshTransaction: b,
  transaction: e,
  transactionNavigator: k
}) => {
  const [w, s] = p(l.DETAILS), [d, f] = p(!1), { withinModal: I } = N(), {
    fullRefundFailed: L,
    fullRefundInProgress: P,
    refundableAmount: E,
    refundAmounts: u,
    refundAvailable: M,
    refundCurrency: a,
    refundDisabled: i,
    refundedAmount: m,
    refundedState: T,
    refundMode: g,
    refundLocked: t
  } = Y(e), y = j(t), r = n(() => t || d, [t, d]), c = n(() => i || r, [i, r]), h = n(() => Object.freeze(e.lineItems ?? A), [e.lineItems]);
  if (V({
    ...O,
    ...I && { fromPage: "Transactions overview" }
  }), F(() => {
    (y.current = t) && f(!1);
  }, [t]), D)
    return /* @__PURE__ */ o(C, { skeletonRowNumber: 5 });
  switch (w) {
    case l.REFUND:
      return /* @__PURE__ */ o(
        x,
        {
          currency: a,
          disabled: c,
          lineItems: h,
          maxAmount: E,
          mode: g,
          refreshTransaction: b,
          refundedAmount: m,
          refundingAmounts: u.in_progress ?? A,
          setActiveView: s,
          setLocked: f,
          transaction: e
        }
      );
    default:
      return /* @__PURE__ */ o(
        S,
        {
          dataCustomization: R,
          extraFields: v,
          fullRefundFailed: L,
          fullRefundInProgress: P,
          refundAmounts: u,
          refundAvailable: M,
          refundCurrency: a,
          refundDisabled: c,
          refundedAmount: m,
          refundedState: T,
          refundLocked: r,
          setActiveView: s,
          transaction: e,
          transactionNavigator: k
        }
      );
  }
};
export {
  Z as TransactionDataContent,
  Z as default
};
