import { INTERACTION as e } from "../../types/hinkal.types.mjs";
import "../../types/index.mjs";
import { getERC20Token as t } from "../utils/erc20tokenFunctions.mjs";
import { getInteractionFromAction as n } from "./interaction-to-action.mjs";
import { processGasEstimates as r } from "./process-gas-estimates.mjs";
//#region libs/shared/common/src/functions/pre-transaction/getFlatFees.ts
var i = async (i, a, o, s, c, l = []) => {
	let u, d = n(o);
	if (d === e.NONE) throw Error("No interaction was choosen");
	let f;
	switch (d) {
		case e.WITHDRAW:
			u = t(a[0], i);
			break;
		case e.SWAP:
			u = t(a[1], i);
			break;
		case e.CLAIMING:
			u = t(a[1], i);
			break;
		case e.EMPORIUM:
			f = s.findIndex((e) => e > 0n), u = t(a[f], i);
			break;
		default: break;
	}
	let p, m, h = s.length;
	u && ({priceOfTransactionInToken: p, priceOfTransactionInUSD: m} = await r(i, u, o, h, void 0, l));
	let g = Array(h).fill(0n);
	switch (d) {
		case e.WITHDRAW:
			g[0] = p || 0n;
			break;
		case e.SWAP:
			g[1] = p || 0n;
			break;
		case e.CLAIMING:
			g[1] = p || 0n;
			break;
		case e.EMPORIUM:
			f !== void 0 && f !== -1 && (g[f] = p || 0n);
			break;
		default: break;
	}
	return {
		flatFees: g,
		priceOfTransactionInToken: p,
		feeUnit: u,
		priceOfTransactionInUSD: m
	};
};
//#endregion
export { i as getFlatFees };
