import { g as b } from "./utils-nUjUW0ze.js";
import { ao as u } from "./StoreProvider-CBB99upB.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, i = new e.Error().stack;
  i && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[i] = "6ef8db23-dfea-4988-91a7-c6fe018c4489", e._sentryDebugIdIdentifier = "sentry-dbid-6ef8db23-dfea-4988-91a7-c6fe018c4489");
} catch {
}
const o = (e, i) => ({
  getLabel: (l, t) => {
    let n = e.labels?.[l] ?? t ?? l;
    if (e.labels && !e.labels?.[l] && Object.keys(e.labels).length) {
      const s = Object.keys(e.labels).find(
        (a) => typeof e.labels?.[a] == "object"
      );
      s && (n = e.labels[s][l] ?? n);
    }
    return i((s) => s[n]);
  },
  getMask: (l) => e.masks?.[l],
  isRequiredField: (l, t = !0) => e.requiredFields ? e.requiredFields.includes(l) && (l !== "role" || l === "role" && e.taskType !== "individual") : t,
  isOptionalField: (l) => e.optionalFields?.includes(l) ?? !1,
  isVisibleField(l, t = !0) {
    return this.isRequiredField(l, t) || this.isOptionalField(l);
  },
  isReadOnly: (l) => e.readOnly || (e.readOnlyFields ? e.readOnlyFields.includes(l) : !1),
  isObscured: (l) => e.obscuredFields ? e.obscuredFields.includes(l) : !1,
  isTrusted: (l) => e.trustedFields ? e.trustedFields.includes(l) : !1,
  getErrorMessage: (l, t, n) => t?.[l]?.errorMessage || !!n?.[l],
  getFieldData: (l, t) => b(l, t),
  getFieldValid: (l, t) => u(l).reduce(
    (n, [s, a]) => t.includes(s) ? { ...n, [s]: a } : n,
    {}
  ),
  getFieldErrors: (l, t, n) => Object.keys(l).reduce(
    (s, a) => {
      if (n.includes(a)) {
        const d = l?.[a]?.errorMessage;
        return d ? { ...s, [a]: d } : { ...s, [a]: !!t?.[a] };
      }
      return s;
    },
    {}
  ),
  getFieldLabels: (l, t) => l.reduce(
    (n, s) => {
      let a = e.labels?.[s] ?? t?.[s] ?? s;
      if (e.labels && !e.labels?.[s] && Object.keys(e.labels).length) {
        const d = Object.keys(e.labels).find(
          (r) => typeof e.labels?.[r] == "object"
        );
        d && (a = e.labels[d][s] ?? a);
      }
      return { ...n, [s]: i((d) => d[a]) };
    },
    {}
  )
});
export {
  o as c
};
