"use client";
import {
  useFunkitTranslation
} from "./chunk-7GWX2ZS4.js";

// src/providers/FunkitConfigContext.tsx
import {
  createContext,
  useContext,
  useMemo
} from "react";
var DEFAULT_TEXT_CUSTOMIZATIONS = {
  virtualFiat: "Deposit with SEPA",
  brokerageOrExchange: "Connect Exchange",
  debitOrCredit: "Deposit with Card",
  accountBalance: "Wallet",
  selectAccount: "Select an exchange",
  perpsTransferTitle: "Transfer",
  sourceMethodTitle: "Your source",
  tokensListTitle: "Your tokens",
  transferTokens: "Transfer Crypto",
  bitcoinLightning: "Bitcoin on Cash App",
  receiveDropdownTitle: "",
  // Default to empty
  receiveDropdownLabel: "Asset to Receive",
  confirmationScreen: {
    payAmountLabel: "You send",
    receiveAmountLabel: "You receive"
  },
  paymentMethodSubtitles: {}
};
var DEFAULT_UI_CUSTOMIZATIONS = {
  alignTitle: "center",
  alwaysShowTopDivider: false,
  showModalTitle: true,
  callToActionsUppercase: false,
  enableCompactList: false,
  checkoutHistory: {
    showGetHelpAsAlert: true,
    simplifiedUi: false
  },
  confirmationScreen: {
    preferDestinationWhenSame: false,
    showAmountSummaryAbovePaymentMethod: false,
    showDisclaimerAsAlert: true,
    showInstantTimeEstimate: false,
    showLeftAlignedDollarValueWithLabel: false,
    showPaymentAmountUsd: false,
    showReceiveAmountUsd: false,
    showSelectedRoute: false,
    stepIndicatorType: "spinner",
    showTokenAmount: true,
    showTransactionDigest: "none"
  },
  sourceChangeScreen: {
    bottomBarCloseButton: {
      enabled: false,
      labelKey: "common.close"
    },
    showTargetAssetSelection: false,
    showWalletOnInsufficientBalance: false,
    showWalletConnect: true,
    showCustomTopComponentDivider: false,
    paymentMethodIcons: {}
  },
  inputAmountScreen: {
    allowTokenAmountInput: true
  },
  selectAssetScreen: {
    isSecondaryTokenSymbolVisible: true,
    navigateOnAssetClick: false
  },
  transferCryptoScreen: {
    showYouSendYouReceive: false
  },
  withdrawalScreen: {},
  selectBrokerageScreen: {},
  connectExchangeScreen: {},
  customIcons: {},
  customFontFamily: {
    primary: "",
    secondary: "",
    tertiary: ""
  }
};
var DEFAULT_FUNKIT_CONFIG = {
  apiKey: "",
  appName: "",
  textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
  uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
};
var FunkitConfigContext = createContext(
  DEFAULT_FUNKIT_CONFIG
);
function useFunkitConfig() {
  const originalFunkitConfig = useContext(FunkitConfigContext);
  const { t } = useFunkitTranslation();
  const translatedDefaults = useMemo(() => {
    return {
      virtualFiat: t("textCustomizations.virtualFiat"),
      brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
      debitOrCredit: t("textCustomizations.debitOrCredit"),
      accountBalance: t("textCustomizations.accountBalance"),
      selectAccount: t("textCustomizations.selectAccount"),
      perpsTransferTitle: t("perpsTransfer.title"),
      sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
      tokensListTitle: t("textCustomizations.tokensListTitle"),
      transferTokens: t("textCustomizations.transferTokens"),
      bitcoinLightning: t("textCustomizations.bitcoinLightning"),
      receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
      receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
      confirmationScreen: {
        payAmountLabel: t("textCustomizations.payAmountLabel"),
        receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
      },
      paymentMethodSubtitles: {}
    };
  }, [t]);
  const finalFunkitConfig = useMemo(() => {
    return {
      ...DEFAULT_FUNKIT_CONFIG,
      ...originalFunkitConfig,
      textCustomizations: {
        ...translatedDefaults,
        ...originalFunkitConfig.textCustomizations,
        confirmationScreen: {
          ...translatedDefaults.confirmationScreen,
          ...originalFunkitConfig.textCustomizations?.confirmationScreen
        },
        paymentMethodSubtitles: {
          ...translatedDefaults.paymentMethodSubtitles,
          ...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
        }
      },
      uiCustomizations: {
        ...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
        ...originalFunkitConfig.uiCustomizations,
        checkoutHistory: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
          ...originalFunkitConfig.uiCustomizations?.checkoutHistory
        },
        confirmationScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
          ...originalFunkitConfig.uiCustomizations?.confirmationScreen
        },
        connectExchangeScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
          ...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
        },
        inputAmountScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
          ...originalFunkitConfig.uiCustomizations?.inputAmountScreen
        },
        selectAssetScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
          ...originalFunkitConfig.uiCustomizations?.selectAssetScreen
        },
        selectBrokerageScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
          ...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
        },
        sourceChangeScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
          ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
          bottomBarCloseButton: {
            ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
            ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
          }
        },
        transferCryptoScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
          ...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
        },
        withdrawalScreen: {
          ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
          ...originalFunkitConfig.uiCustomizations?.withdrawalScreen
        }
      }
    };
  }, [originalFunkitConfig, translatedDefaults]);
  return finalFunkitConfig;
}

export {
  useFunkitConfig
};
