import { av as f, aw as c, P as o, L as t } from "./unsignedTransaction-DCDxTFq8.mjs";
import { ax as x } from "./unsignedTransaction-DCDxTFq8.mjs";
import "./platform-Cil_UtAQ.mjs";
import { p as s, u as p, b as O } from "./web3-CUwFm9Lx.mjs";
class d extends Error {
  constructor(r) {
    super(r);
  }
}
class m extends d {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const A = t.struct([
  t.u32("mintAuthorityOption"),
  s("mintAuthority"),
  p("supply"),
  t.u8("decimals"),
  O("isInitialized"),
  t.u32("freezeAuthorityOption"),
  s("freezeAuthority")
]);
A.span;
async function T(e, r, u = !1, a = f, n = c) {
  if (!u && !o.isOnCurve(r.toBuffer()))
    throw new m();
  const [i] = await o.findProgramAddress([r.toBuffer(), a.toBuffer(), e.toBuffer()], n);
  return i;
}
export {
  c as ASSOCIATED_TOKEN_PROGRAM_ID,
  A as MintLayout,
  x as TOKEN_2022_PROGRAM_ID,
  f as TOKEN_PROGRAM_ID,
  d as TokenError,
  m as TokenOwnerOffCurveError,
  T as getAssociatedTokenAddress
};
