import { bw as f, bx as s, by as t, bz as c, bA as d, bB as A, aX as o, bC as O, bD as b } from "./index-CjwA7HmM.mjs";
class p extends Error {
  constructor(r) {
    super(r);
  }
}
class y extends p {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const l = f([
  s("mintAuthorityOption"),
  t("mintAuthority"),
  c("supply"),
  d("decimals"),
  A("isInitialized"),
  s("freezeAuthorityOption"),
  t("freezeAuthority")
]);
l.span;
async function E(e, r, n = !1, u = O, a = b) {
  if (!n && !o.isOnCurve(r.toBuffer()))
    throw new y();
  const [i] = await o.findProgramAddress([r.toBuffer(), u.toBuffer(), e.toBuffer()], a);
  return i;
}
export {
  b as ASSOCIATED_TOKEN_PROGRAM_ID,
  l as MintLayout,
  O as TOKEN_PROGRAM_ID,
  p as TokenError,
  y as TokenOwnerOffCurveError,
  E as getAssociatedTokenAddress
};
