import { T as f, A as c } from "./unsignedTransaction-Brbbx5Uc.mjs";
import { c as I } from "./unsignedTransaction-Brbbx5Uc.mjs";
import { P as e, a2 as p, an as s, a5 as O } from "./address-QpeLv2yn.mjs";
import { p as o, u as m, b as A } from "./web3-Atnj-SZ3.mjs";
class d extends Error {
  constructor(r) {
    super(r);
  }
}
class l extends d {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const y = p([
  s("mintAuthorityOption"),
  o("mintAuthority"),
  m("supply"),
  O("decimals"),
  A("isInitialized"),
  s("freezeAuthorityOption"),
  o("freezeAuthority")
]);
y.span;
async function h(t, r, a = !1, n = f, u = c) {
  if (!a && !e.isOnCurve(r.toBuffer()))
    throw new l();
  const [i] = await e.findProgramAddress([r.toBuffer(), n.toBuffer(), t.toBuffer()], u);
  return i;
}
export {
  c as ASSOCIATED_TOKEN_PROGRAM_ID,
  y as MintLayout,
  I as TOKEN_2022_PROGRAM_ID,
  f as TOKEN_PROGRAM_ID,
  d as TokenError,
  l as TokenOwnerOffCurveError,
  h as getAssociatedTokenAddress
};
