import { bigintMax as e, countTotalAmountInUtxos as t } from "../utils/amounts.utils.mjs";
import { transactionErrorCodes as n } from "../../error-handling/error-codes.constants.mjs";
import { Utxo as r } from "../../data-structures/utxo/Utxo.mjs";
//#region libs/shared/common/src/functions/pre-transaction/outputUtxoProcessing.ts
var i = (i, a, o, s, c, l = !0, u, d) => {
	let f = t(a), { erc20TokenAddress: p, mintAddress: m } = a[0];
	if (l && o < 0n && f + o < 0n) throw Error(n.INSUFFICIENT_FUNDS_TO_TRANSACT);
	let h = [new r({
		amount: e(f + o, 0n),
		erc20TokenAddress: p,
		mintAddress: m,
		shieldedPrivateKey: i.getShieldedPrivateKey(),
		timeStamp: s,
		tokenId: c
	})];
	if (u !== void 0 && d !== void 0) {
		let [e, t, n] = u.split(",");
		h.push(new r({
			amount: d,
			erc20TokenAddress: p,
			randomization: BigInt(e),
			stealthAddress: t,
			encryptionKey: n,
			timeStamp: s
		}));
	}
	return { outputUtxos: h };
};
//#endregion
export { i as outputUtxoProcessing };
