var o = Object.defineProperty;
var c = (e, n) => o(e, "name", { value: n, configurable: !0 });
import { isScalarZeroValue as r, scalarZeroValue as u } from "./scalars.js";
function i(e, n) {
  const a = e.localName;
  if (e.repeated)
    return n[a].length > 0;
  if (e.oneof)
    return n[e.oneof.localName].case === a;
  switch (e.kind) {
    case "enum":
    case "scalar":
      return e.opt || e.req ? n[a] !== void 0 : e.kind == "enum" ? n[a] !== e.T.values[0].no : !r(e.T, n[a]);
    case "message":
      return n[a] !== void 0;
    case "map":
      return Object.keys(n[a]).length > 0;
  }
}
c(i, "isFieldSet");
function p(e, n) {
  const a = e.localName, s = !e.opt && !e.req;
  if (e.repeated)
    n[a] = [];
  else if (e.oneof)
    n[e.oneof.localName] = { case: void 0 };
  else
    switch (e.kind) {
      case "map":
        n[a] = {};
        break;
      case "enum":
        n[a] = s ? e.T.values[0].no : void 0;
        break;
      case "scalar":
        n[a] = s ? u(e.T, e.L) : void 0;
        break;
      case "message":
        n[a] = void 0;
        break;
    }
}
c(p, "clearField");
export {
  p as clearField,
  i as isFieldSet
};
