var i = Object.defineProperty;
var a = (n, e) => i(n, "name", { value: e, configurable: !0 });
import { assert as f } from "./assert.js";
const s = Symbol("@bufbuild/protobuf/enum-type");
function j(n) {
  const e = n[s];
  return f(e, "missing enum type on enum object"), e;
}
a(j, "getEnumType");
function p(n, e, c, o) {
  n[s] = b(e, c.map((t) => ({
    no: t.no,
    name: t.name,
    localName: n[t.no]
  })));
}
a(p, "setEnumType");
function b(n, e, c) {
  const o = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), m = [];
  for (const u of e) {
    const r = l(u);
    m.push(r), o[u.name] = r, t[u.no] = r;
  }
  return {
    typeName: n,
    values: m,
    // We do not surface options at this time
    // options: opt?.options ?? Object.create(null),
    findName(u) {
      return o[u];
    },
    findNumber(u) {
      return t[u];
    }
  };
}
a(b, "makeEnumType");
function E(n, e, c) {
  const o = {};
  for (const t of e) {
    const m = l(t);
    o[m.localName] = m.no, o[m.no] = m.localName;
  }
  return p(o, n, e), o;
}
a(E, "makeEnum");
function l(n) {
  return "localName" in n ? n : Object.assign(Object.assign({}, n), { localName: n.name });
}
a(l, "normalizeEnumValue");
export {
  j as getEnumType,
  E as makeEnum,
  b as makeEnumType,
  p as setEnumType
};
