reactaform 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -446,30 +446,30 @@ class ne {
446
446
  return n !== void 0 ? n : t;
447
447
  }
448
448
  }
449
- const ar = typeof process < "u" && process.env.NODE_ENV === "test";
449
+ const or = typeof process < "u" && process.env.NODE_ENV === "test";
450
450
  function lt(e, r = 300, t) {
451
- const n = pe(), a = pe(e), o = pe(null), c = t?.leading === !0, s = t?.trailing !== !1;
451
+ const n = pe(), o = pe(e), a = pe(null), c = t?.leading === !0, s = t?.trailing !== !1;
452
452
  Ue(() => {
453
- a.current = e;
453
+ o.current = e;
454
454
  }, [e]), Ue(() => () => {
455
455
  n.current && clearTimeout(n.current);
456
456
  }, []);
457
457
  const i = (f) => {
458
- a.current(...f);
458
+ o.current(...f);
459
459
  }, d = ge(() => {
460
- n.current && (clearTimeout(n.current), n.current = void 0), o.current = null;
460
+ n.current && (clearTimeout(n.current), n.current = void 0), a.current = null;
461
461
  }, []), m = ge(() => {
462
- n.current && (clearTimeout(n.current), n.current = void 0), s && o.current && (i(o.current), o.current = null);
462
+ n.current && (clearTimeout(n.current), n.current = void 0), s && a.current && (i(a.current), a.current = null);
463
463
  }, [s]);
464
464
  return { callback: ge(
465
465
  (...f) => {
466
- if (ar) {
466
+ if (or) {
467
467
  i(f);
468
468
  return;
469
469
  }
470
470
  const b = c && !n.current;
471
- o.current = f, b && i(f), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
472
- n.current = void 0, s && o.current && (i(o.current), o.current = null);
471
+ a.current = f, b && i(f), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
472
+ n.current = void 0, s && a.current && (i(a.current), a.current = null);
473
473
  }, r);
474
474
  },
475
475
  [c, s, r]
@@ -488,8 +488,8 @@ const V = {
488
488
  }, U = (...e) => {
489
489
  const r = [];
490
490
  for (const t of e)
491
- t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n, a]) => {
492
- a && r.push(n);
491
+ t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n, o]) => {
492
+ o && r.push(n);
493
493
  }));
494
494
  return r.join(" ");
495
495
  };
@@ -499,16 +499,16 @@ function ie(e) {
499
499
  function ut(e) {
500
500
  if (!e) return !1;
501
501
  const r = e.trim();
502
- let t = 0, n = 0, a = 0;
502
+ let t = 0, n = 0, o = 0;
503
503
  if (r.startsWith("#")) {
504
504
  const c = r.substring(1);
505
- c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16), a = parseInt(c[2] + c[2], 16)) : (c.length === 6 || c.length === 8) && (t = parseInt(c.substring(0, 2), 16), n = parseInt(c.substring(2, 4), 16), a = parseInt(c.substring(4, 6), 16));
505
+ c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16), o = parseInt(c[2] + c[2], 16)) : (c.length === 6 || c.length === 8) && (t = parseInt(c.substring(0, 2), 16), n = parseInt(c.substring(2, 4), 16), o = parseInt(c.substring(4, 6), 16));
506
506
  } else if (r.startsWith("rgb")) {
507
507
  const c = r.match(/\d+(\.\d+)?/g);
508
- c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))), a = Math.min(255, Math.max(0, parseFloat(c[2]))));
508
+ c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))), o = Math.min(255, Math.max(0, parseFloat(c[2]))));
509
509
  } else
510
510
  return !1;
511
- return (t * 299 + n * 587 + a * 114) / 1e3 < 128;
511
+ return (t * 299 + n * 587 + o * 114) / 1e3 < 128;
512
512
  }
513
513
  const mt = () => /* @__PURE__ */ D(
514
514
  "svg",
@@ -527,7 +527,7 @@ const mt = () => /* @__PURE__ */ D(
527
527
  ]
528
528
  }
529
529
  ), dt = ({ content: e, size: r = "medium", animation: t = !0 }) => {
530
- const { t: n, theme: a, formStyle: o, fieldStyle: c } = B(), [s, i] = l.useState(!1), [d, m] = l.useState({ x: 0, y: 0 }), [u, f] = l.useState(!1), b = l.useRef(null), C = l.useRef(null), N = l.useRef(null), h = l.useId(), y = ie(a), [E, F] = l.useState(void 0);
530
+ const { t: n, theme: o, formStyle: a, fieldStyle: c } = B(), [s, i] = l.useState(!1), [d, m] = l.useState({ x: 0, y: 0 }), [u, f] = l.useState(!1), b = l.useRef(null), C = l.useRef(null), N = l.useRef(null), h = l.useId(), y = ie(o), [E, F] = l.useState(void 0);
531
531
  l.useLayoutEffect(() => {
532
532
  if (!b.current) return;
533
533
  const I = "rgba(255,255,255,0.1)", g = getComputedStyle(b.current).getPropertyValue("--reactaform-primary-bg").trim();
@@ -587,11 +587,11 @@ const mt = () => /* @__PURE__ */ D(
587
587
  return (S && j ? j[S] : void 0) ?? {};
588
588
  };
589
589
  return {
590
- icon: { ...v.icon, ...g(o, "tooltip", "icon"), ...g(c, "tooltip", "icon") },
591
- text: { ...v.text, ...g(o, "tooltip", "text"), ...g(c, "tooltip", "text") },
590
+ icon: { ...v.icon, ...g(a, "tooltip", "icon"), ...g(c, "tooltip", "icon") },
591
+ text: { ...v.text, ...g(a, "tooltip", "text"), ...g(c, "tooltip", "text") },
592
592
  textVisible: v.textVisible
593
593
  };
594
- }, [y, r, t, o, c, E]);
594
+ }, [y, r, t, a, c, E]);
595
595
  l.useLayoutEffect(() => {
596
596
  if (!s || !b.current || !C.current) {
597
597
  f(!1);
@@ -649,26 +649,26 @@ const mt = () => /* @__PURE__ */ D(
649
649
  ),
650
650
  s && ($ ? de.createPortal(R, $) : R)
651
651
  ] });
652
- }, or = l.memo(dt), ve = l.memo(({
652
+ }, ar = l.memo(dt), ve = l.memo(({
653
653
  field: e,
654
654
  error: r,
655
655
  children: t,
656
656
  showLabel: n = !0
657
657
  }) => {
658
- const { t: a } = B(), o = e.labelLayout === "column-center" ? "center" : "left", c = l.useMemo(() => {
658
+ const { t: o } = B(), a = e.labelLayout === "column-center" ? "center" : "left", c = l.useMemo(() => {
659
659
  const d = {
660
660
  display: "flex",
661
661
  flexDirection: "column",
662
662
  gap: "var(--reactaform-label-gap, 4px)"
663
663
  };
664
- return d["--label-align"] = o, d;
665
- }, [o]), s = l.useMemo(() => ({
666
- textAlign: o,
664
+ return d["--label-align"] = a, d;
665
+ }, [a]), s = l.useMemo(() => ({
666
+ textAlign: a,
667
667
  width: "100%",
668
668
  minWidth: "unset",
669
669
  display: "block",
670
670
  marginBottom: "10px"
671
- }), [o]), i = l.useMemo(() => ({
671
+ }), [a]), i = l.useMemo(() => ({
672
672
  display: "flex",
673
673
  alignItems: "center",
674
674
  gap: "var(--reactaform-inline-gap, 8px)",
@@ -682,12 +682,12 @@ const mt = () => /* @__PURE__ */ D(
682
682
  className: V.label,
683
683
  htmlFor: e.name,
684
684
  style: s,
685
- children: a(e.displayName)
685
+ children: o(e.displayName)
686
686
  }
687
687
  ),
688
688
  /* @__PURE__ */ D("div", { style: i, children: [
689
689
  /* @__PURE__ */ p("div", { style: { flex: 1, minWidth: 0 }, children: t }),
690
- e.tooltip && /* @__PURE__ */ p(or, { content: e.tooltip })
690
+ e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
691
691
  ] }),
692
692
  r && /* @__PURE__ */ p(Me, { id: `${e.name}-error`, children: r })
693
693
  ] });
@@ -699,7 +699,7 @@ const ir = l.memo(({
699
699
  children: t,
700
700
  rightAlign: n = !1
701
701
  }) => {
702
- const { t: a } = B(), o = l.useMemo(() => ({
702
+ const { t: o } = B(), a = l.useMemo(() => ({
703
703
  display: "flex",
704
704
  alignItems: "center",
705
705
  gap: "3px"
@@ -712,13 +712,13 @@ const ir = l.memo(({
712
712
  className: V.label,
713
713
  htmlFor: e.name,
714
714
  style: { textAlign: "left" },
715
- children: a(e.displayName)
715
+ children: o(e.displayName)
716
716
  }
717
717
  ),
718
718
  /* @__PURE__ */ D("div", { children: [
719
- /* @__PURE__ */ D("div", { style: o, children: [
719
+ /* @__PURE__ */ D("div", { style: a, children: [
720
720
  n ? /* @__PURE__ */ p("div", { style: { display: "flex", flex: 1, justifyContent: "flex-end" }, children: t }) : t,
721
- e.tooltip && /* @__PURE__ */ p(or, { content: e.tooltip })
721
+ e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
722
722
  ] }),
723
723
  r && /* @__PURE__ */ p(Me, { id: `${e.name}-error`, children: r })
724
724
  ] })
@@ -783,8 +783,8 @@ sr.displayName = "InstanceName";
783
783
  class ft extends ne {
784
784
  registerInCategory(r, t, n) {
785
785
  this.get(r) || this.register(r, {});
786
- const a = this.get(r);
787
- a[t] = n;
786
+ const o = this.get(r);
787
+ o[t] = n;
788
788
  }
789
789
  getFromCategory(r, t) {
790
790
  return this.get(r)?.[t];
@@ -804,7 +804,7 @@ function gt(e, r, t) {
804
804
  lr.registerInCategory(e, r, t);
805
805
  }
806
806
  function ht(e, r) {
807
- if (an(e)) {
807
+ if (on(e)) {
808
808
  console.warn(
809
809
  `[ReactaForm] Can't override builtin type field validation handler for type "${e}".`
810
810
  );
@@ -831,22 +831,22 @@ const We = /* @__PURE__ */ new Map(), _e = /* @__PURE__ */ new Map();
831
831
  function fr(e, r, t, n) {
832
832
  if (!r || !r.validationHandlerName)
833
833
  return null;
834
- let a, o;
834
+ let o, a;
835
835
  if (typeof r.validationHandlerName == "string")
836
- a = e, o = r.validationHandlerName;
836
+ o = e, a = r.validationHandlerName;
837
837
  else if (Array.isArray(r.validationHandlerName)) {
838
838
  const [i, d] = r.validationHandlerName;
839
839
  if (d)
840
- a = i, o = d;
840
+ o = i, a = d;
841
841
  else if (i)
842
- a = e, o = i;
842
+ o = e, a = i;
843
843
  else
844
844
  return null;
845
845
  } else
846
846
  return null;
847
- const c = `${a}:${o}`;
847
+ const c = `${o}:${a}`;
848
848
  let s = We.get(c);
849
- if (s === void 0 && (s = ur(a, o) || null, We.set(c, s)), s)
849
+ if (s === void 0 && (s = ur(o, a) || null, We.set(c, s)), s)
850
850
  try {
851
851
  return s(r.name, t, n) || null;
852
852
  } catch (i) {
@@ -854,15 +854,15 @@ function fr(e, r, t, n) {
854
854
  }
855
855
  return null;
856
856
  }
857
- function ua(e, r, t, n) {
857
+ function uo(e, r, t, n) {
858
858
  return fr(e, r, t, n);
859
859
  }
860
860
  function pr(e, r, t, n) {
861
- const a = dr(r.type);
862
- if (a) {
863
- const o = a(r, t, n);
864
- if (o)
865
- return o;
861
+ const o = dr(r.type);
862
+ if (o) {
863
+ const a = o(r, t, n);
864
+ if (a)
865
+ return a;
866
866
  } else if (String(t ?? "").trim() === "")
867
867
  return r.required ? n("Value required") : null;
868
868
  return fr(e, r, t, n);
@@ -871,21 +871,21 @@ async function yt(e, r, t) {
871
871
  if (!e || typeof e.validationHandlerName != "string")
872
872
  return null;
873
873
  const n = e.validationHandlerName;
874
- let a = _e.get(n);
875
- if (a === void 0 && (a = mr(n) || null, _e.set(n, a)), a)
874
+ let o = _e.get(n);
875
+ if (o === void 0 && (o = mr(n) || null, _e.set(n, o)), o)
876
876
  try {
877
- const o = a(r, t);
878
- return bt(o) ? await o || null : o || null;
879
- } catch (o) {
880
- return [String(o instanceof Error ? o.message : o)];
877
+ const a = o(r, t);
878
+ return bt(a) ? await a || null : a || null;
879
+ } catch (a) {
880
+ return [String(a instanceof Error ? a.message : a)];
881
881
  }
882
882
  return null;
883
883
  }
884
884
  function T(e, r) {
885
- const { definitionName: t, t: n, fieldValidationMode: a } = B();
885
+ const { definitionName: t, t: n, fieldValidationMode: o } = B();
886
886
  return l.useCallback(
887
- (o) => a === "realTime" ? pr(t, e, o, n) : r ?? null,
888
- [t, e, n, a, r]
887
+ (a) => o === "onEdit" || o === "realTime" ? pr(t, e, a, n) : r ?? null,
888
+ [t, e, n, o, r]
889
889
  );
890
890
  }
891
891
  const gr = ({
@@ -893,12 +893,12 @@ const gr = ({
893
893
  value: r = !1,
894
894
  onChange: t,
895
895
  onError: n,
896
- error: a
896
+ error: o
897
897
  }) => {
898
- const { t: o } = B(), s = T(e, a)(r);
898
+ const { t: a } = B(), s = T(e, o)(r);
899
899
  l.useEffect(() => {
900
- a || n?.(s);
901
- }, [s, a, n]);
900
+ o || n?.(s);
901
+ }, [s, o, n]);
902
902
  const i = l.useCallback(
903
903
  (u) => {
904
904
  t?.(u.target.checked);
@@ -926,7 +926,7 @@ const gr = ({
926
926
  className: V.label,
927
927
  htmlFor: m,
928
928
  style: { textAlign: "left", justifyContent: "flex-start" },
929
- children: o(e.displayName)
929
+ children: a(e.displayName)
930
930
  }
931
931
  ),
932
932
  /* @__PURE__ */ p(
@@ -958,24 +958,24 @@ const gr = ({
958
958
  gr.displayName = "CheckboxInput";
959
959
  const vt = l.memo(gr);
960
960
  function _({ value: e, onChange: r, onError: t, validate: n }) {
961
- const a = l.useRef(null), o = l.useRef(null), c = l.useRef(t), [s, i] = l.useState(null);
961
+ const o = l.useRef(null), a = l.useRef(null), c = l.useRef(t), [s, i] = l.useState(null);
962
962
  l.useEffect(() => {
963
963
  c.current = t;
964
964
  }, [t]), l.useEffect(() => {
965
965
  const m = String(e ?? "");
966
- if (!(document.activeElement === a.current)) {
966
+ if (!(document.activeElement === o.current)) {
967
967
  const f = n(m);
968
- f !== o.current && (o.current = f, c.current?.(f ?? null), i(f)), a.current && a.current.value !== m && (a.current.value = m);
968
+ f !== a.current && (a.current = f, c.current?.(f ?? null), i(f)), o.current && o.current.value !== m && (o.current.value = m);
969
969
  }
970
970
  }, [e, n]);
971
971
  const d = l.useCallback(
972
972
  (m) => {
973
973
  const u = m.target.value, f = n(u);
974
- f !== o.current && (o.current = f, i(f), c.current?.(f ?? null)), r?.(u);
974
+ f !== a.current && (a.current = f, i(f), c.current?.(f ?? null)), r?.(u);
975
975
  },
976
976
  [r, n]
977
977
  );
978
- return { inputRef: a, error: s, handleChange: d };
978
+ return { inputRef: o, error: s, handleChange: d };
979
979
  }
980
980
  const Ke = [
981
981
  { label: "Black", value: "#000000" },
@@ -1008,9 +1008,9 @@ const Ke = [
1008
1008
  value: r,
1009
1009
  onChange: t,
1010
1010
  onError: n,
1011
- error: a
1011
+ error: o
1012
1012
  }) => {
1013
- const { t: o } = B(), c = T(e, a), s = l.useMemo(
1013
+ const { t: a } = B(), c = T(e, o), s = l.useMemo(
1014
1014
  () => he(r),
1015
1015
  [r]
1016
1016
  ), { inputRef: i, error: d, handleChange: m } = _({
@@ -1067,7 +1067,7 @@ const Ke = [
1067
1067
  ),
1068
1068
  "aria-invalid": !!d,
1069
1069
  children: [
1070
- Ke.map((M) => /* @__PURE__ */ p("option", { value: M.value, children: o(M.label) }, M.value)),
1070
+ Ke.map((M) => /* @__PURE__ */ p("option", { value: M.value, children: a(M.label) }, M.value)),
1071
1071
  !h && /* @__PURE__ */ D("option", { value: u, children: [
1072
1072
  "(",
1073
1073
  y,
@@ -1122,8 +1122,8 @@ const Nt = l.memo(hr), Ge = (e) => {
1122
1122
  return Ge(e) ? e : "";
1123
1123
  const t = Ge(e);
1124
1124
  if (t) {
1125
- const n = t.getUTCFullYear(), a = String(t.getUTCMonth() + 1).padStart(2, "0"), o = String(t.getUTCDate()).padStart(2, "0");
1126
- return `${n}-${a}-${o}`;
1125
+ const n = t.getUTCFullYear(), o = String(t.getUTCMonth() + 1).padStart(2, "0"), a = String(t.getUTCDate()).padStart(2, "0");
1126
+ return `${n}-${o}-${a}`;
1127
1127
  }
1128
1128
  return "";
1129
1129
  }, br = ({
@@ -1131,13 +1131,13 @@ const Nt = l.memo(hr), Ge = (e) => {
1131
1131
  value: r,
1132
1132
  onChange: t,
1133
1133
  onError: n,
1134
- error: a
1134
+ error: o
1135
1135
  }) => {
1136
- const o = T(e, a), c = Je(r), { inputRef: s, error: i, handleChange: d } = _({
1136
+ const a = T(e, o), c = Je(r), { inputRef: s, error: i, handleChange: d } = _({
1137
1137
  value: c,
1138
1138
  onChange: t,
1139
1139
  onError: n,
1140
- validate: o
1140
+ validate: a
1141
1141
  });
1142
1142
  return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
1143
1143
  "input",
@@ -1157,13 +1157,13 @@ const Nt = l.memo(hr), Ge = (e) => {
1157
1157
  };
1158
1158
  br.displayName = "DateInput";
1159
1159
  const kt = l.memo(br), yr = ({ field: e }) => {
1160
- const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml: a = !1 } = e;
1160
+ const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml: o = !1 } = e;
1161
1161
  return /* @__PURE__ */ p(
1162
1162
  "div",
1163
1163
  {
1164
1164
  className: V.description,
1165
1165
  style: { textAlign: n },
1166
- ...a ? { dangerouslySetInnerHTML: { __html: r(t) } } : { children: r(t) }
1166
+ ...o ? { dangerouslySetInnerHTML: { __html: r(t) } } : { children: r(t) }
1167
1167
  }
1168
1168
  );
1169
1169
  };
@@ -1173,13 +1173,13 @@ const It = l.memo(yr), vr = ({
1173
1173
  value: r,
1174
1174
  onChange: t,
1175
1175
  onError: n,
1176
- error: a
1176
+ error: o
1177
1177
  }) => {
1178
- const { t: o, theme: c, formStyle: s, fieldStyle: i } = B(), d = l.useRef(null), m = l.useRef(n), [u, f] = l.useState(!1), [b, C] = l.useState(null);
1178
+ const { t: a, theme: c, formStyle: s, fieldStyle: i } = B(), d = l.useRef(null), m = l.useRef(n), [u, f] = l.useState(!1), [b, C] = l.useState(null);
1179
1179
  l.useEffect(() => {
1180
1180
  m.current = n;
1181
1181
  }, [n]);
1182
- const N = T(e, a), [h, y] = l.useState(null), E = l.useRef(null);
1182
+ const N = T(e, o), [h, y] = l.useState(null), E = l.useRef(null);
1183
1183
  l.useEffect(() => {
1184
1184
  const g = String(r ?? "");
1185
1185
  let w = N(g);
@@ -1198,8 +1198,8 @@ const It = l.memo(yr), vr = ({
1198
1198
  w !== E.current && (E.current = w, y(w), m.current?.(w ?? null)), t?.(g), f(!1);
1199
1199
  }, $ = l.useMemo(() => {
1200
1200
  const g = e.options.find((w) => String(w.value) === String(r));
1201
- return g ? o(g.label) : "";
1202
- }, [e.options, r, o]), R = (g, w, x) => {
1201
+ return g ? a(g.label) : "";
1202
+ }, [e.options, r, a]), R = (g, w, x) => {
1203
1203
  if (!w) return {};
1204
1204
  const S = g?.[w];
1205
1205
  return (x && S ? S[x] : void 0) ?? {};
@@ -1258,7 +1258,7 @@ const It = l.memo(yr), vr = ({
1258
1258
  onClose: () => f(!1),
1259
1259
  controlRef: d,
1260
1260
  theme: c,
1261
- t: o
1261
+ t: a
1262
1262
  }
1263
1263
  )
1264
1264
  ] });
@@ -1267,15 +1267,15 @@ const It = l.memo(yr), vr = ({
1267
1267
  options: r,
1268
1268
  selectedValue: t,
1269
1269
  onSelect: n,
1270
- onClose: a,
1271
- controlRef: o,
1270
+ onClose: o,
1271
+ controlRef: a,
1272
1272
  theme: c,
1273
1273
  t: s
1274
1274
  }) => {
1275
1275
  const i = l.useRef(null), [d, m] = l.useState(-1), { formStyle: u, fieldStyle: f } = B(), b = ie(c ?? "light");
1276
1276
  l.useLayoutEffect(() => {
1277
- if (!o.current) return;
1278
- const v = o.current.closest("[data-reactaform-theme]"), g = document.getElementById("popup-root");
1277
+ if (!a.current) return;
1278
+ const v = a.current.closest("[data-reactaform-theme]"), g = document.getElementById("popup-root");
1279
1279
  if (v && g) {
1280
1280
  const w = getComputedStyle(v);
1281
1281
  g.style.setProperty(
@@ -1289,7 +1289,7 @@ const It = l.memo(yr), vr = ({
1289
1289
  w.getPropertyValue("--reactaform-option-menu-hover-bg")
1290
1290
  );
1291
1291
  }
1292
- }, [o]);
1292
+ }, [a]);
1293
1293
  const C = (v, g, w) => {
1294
1294
  if (!g) return {};
1295
1295
  const k = v?.[g];
@@ -1320,10 +1320,10 @@ const It = l.memo(yr), vr = ({
1320
1320
  l.useEffect(() => {
1321
1321
  const v = (g) => {
1322
1322
  const w = g.target;
1323
- !i.current?.contains(w) && !o.current?.contains(w) && a();
1323
+ !i.current?.contains(w) && !a.current?.contains(w) && o();
1324
1324
  };
1325
1325
  return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
1326
- }, [a, o]), l.useEffect(() => {
1326
+ }, [o, a]), l.useEffect(() => {
1327
1327
  if (i.current && r.length > 0) {
1328
1328
  const v = r.findIndex((g) => String(g.value) === t);
1329
1329
  requestAnimationFrame(() => m(v >= 0 ? v : 0));
@@ -1338,7 +1338,7 @@ const It = l.memo(yr), vr = ({
1338
1338
  if (typeof window > "u") return;
1339
1339
  const v = () => {
1340
1340
  let x = e.x, k = e.y, S = y;
1341
- const A = o?.current;
1341
+ const A = a?.current;
1342
1342
  if (A) {
1343
1343
  const j = A.getBoundingClientRect();
1344
1344
  x = j.left, k = j.bottom, S = Math.max(80, Math.round(j.width));
@@ -1347,11 +1347,11 @@ const It = l.memo(yr), vr = ({
1347
1347
  };
1348
1348
  v(), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v);
1349
1349
  let g = null;
1350
- const w = o?.current;
1350
+ const w = a?.current;
1351
1351
  return typeof ResizeObserver < "u" && w && (g = new ResizeObserver(() => v()), g.observe(w)), () => {
1352
1352
  window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v), g && w && g.unobserve(w);
1353
1353
  };
1354
- }, [o, e.x, e.y]), typeof window > "u") return null;
1354
+ }, [a, e.x, e.y]), typeof window > "u") return null;
1355
1355
  let I = document.getElementById("popup-root");
1356
1356
  return I || (I = document.createElement("div"), I.id = "popup-root", document.body.appendChild(I)), de.createPortal(
1357
1357
  /* @__PURE__ */ p(
@@ -1401,7 +1401,7 @@ const It = l.memo(yr), vr = ({
1401
1401
  S.preventDefault(), S.stopPropagation(), n(String(v.value));
1402
1402
  break;
1403
1403
  case "Escape":
1404
- S.preventDefault(), a(), o?.current?.focus();
1404
+ S.preventDefault(), o(), a?.current?.focus();
1405
1405
  break;
1406
1406
  }
1407
1407
  },
@@ -1431,13 +1431,13 @@ const Mt = l.memo(vr), xr = ({
1431
1431
  value: r,
1432
1432
  onChange: t,
1433
1433
  onError: n,
1434
- error: a
1434
+ error: o
1435
1435
  }) => {
1436
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
1436
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
1437
1437
  value: r,
1438
1438
  onChange: t,
1439
1439
  onError: n,
1440
- validate: o
1440
+ validate: a
1441
1441
  });
1442
1442
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
1443
1443
  "input",
@@ -1458,7 +1458,7 @@ const Ft = l.memo(xr), wr = ({ field: e }) => {
1458
1458
  const { theme: r } = B(), {
1459
1459
  color: t = ie(r) ? "#444444" : "#CCCCCC",
1460
1460
  thickness: n = 1,
1461
- margin: a = "8px 0"
1461
+ margin: o = "8px 0"
1462
1462
  } = e;
1463
1463
  return /* @__PURE__ */ p(
1464
1464
  "div",
@@ -1468,20 +1468,20 @@ const Ft = l.memo(xr), wr = ({ field: e }) => {
1468
1468
  height: "0",
1469
1469
  // ensures only 1 line
1470
1470
  borderTop: `${n}px solid ${t}`,
1471
- margin: a
1471
+ margin: o
1472
1472
  }
1473
1473
  }
1474
1474
  );
1475
1475
  };
1476
1476
  wr.displayName = "FieldSeparator";
1477
- const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error: a }) => {
1478
- const { t: o, theme: c } = B(), [s, i] = l.useState(!1), d = l.useRef(null), m = l.useRef(n), u = l.useRef(null), [f, b] = l.useState(null), C = ie(c);
1477
+ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
1478
+ const { t: a, theme: c } = B(), [s, i] = l.useState(!1), d = l.useRef(null), m = l.useRef(n), u = l.useRef(null), [f, b] = l.useState(null), C = ie(c);
1479
1479
  l.useEffect(() => {
1480
1480
  m.current = n;
1481
1481
  }, [n]);
1482
1482
  const N = (g, w) => w.some(
1483
1483
  (x) => x.name === g.name && x.size === g.size && x.lastModified === g.lastModified
1484
- ), h = T(e, a);
1484
+ ), h = T(e, o);
1485
1485
  l.useEffect(() => {
1486
1486
  const g = h(r ?? []);
1487
1487
  t?.(r), g !== u.current && (u.current = g, b(g), m.current?.(g ?? null));
@@ -1566,7 +1566,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
1566
1566
  {
1567
1567
  type: "button",
1568
1568
  onClick: () => $(Array.isArray(r) ? x : void 0),
1569
- "aria-label": o("Remove file"),
1569
+ "aria-label": a("Remove file"),
1570
1570
  style: {
1571
1571
  background: "transparent",
1572
1572
  border: "none",
@@ -1630,7 +1630,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
1630
1630
  (g.key === "Enter" || g.key === " ") && (g.preventDefault(), d.current?.click());
1631
1631
  },
1632
1632
  role: "button",
1633
- "aria-label": e.multiple ? o("Choose Files or Drag & Drop") : o("Choose File or Drag & Drop"),
1633
+ "aria-label": e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop"),
1634
1634
  "aria-invalid": !!f,
1635
1635
  "aria-describedby": f ? `${e.name}-error` : void 0,
1636
1636
  children: [
@@ -1660,7 +1660,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
1660
1660
  color: "var(--reactaform-text-color, #111827)",
1661
1661
  flex: 1,
1662
1662
  textAlign: "left"
1663
- }, children: s ? o("Drop files here") : e.multiple ? o("Choose Files or Drag & Drop") : o("Choose File or Drag & Drop") })
1663
+ }, children: s ? a("Drop files here") : e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop") })
1664
1664
  ]
1665
1665
  }
1666
1666
  ),
@@ -1673,13 +1673,13 @@ const Vt = l.memo(Sr), Cr = ({
1673
1673
  value: r,
1674
1674
  onChange: t,
1675
1675
  onError: n,
1676
- error: a
1676
+ error: o
1677
1677
  }) => {
1678
- const o = T(e, a), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
1678
+ const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
1679
1679
  value: c,
1680
1680
  onChange: t,
1681
1681
  onError: n,
1682
- validate: o
1682
+ validate: a
1683
1683
  });
1684
1684
  return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
1685
1685
  "input",
@@ -1702,13 +1702,13 @@ const At = l.memo(Cr), Nr = ({
1702
1702
  value: r,
1703
1703
  onChange: t,
1704
1704
  onError: n,
1705
- error: a
1705
+ error: o
1706
1706
  }) => {
1707
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
1707
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
1708
1708
  value: r,
1709
1709
  onChange: t,
1710
1710
  onError: n,
1711
- validate: o
1711
+ validate: a
1712
1712
  });
1713
1713
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
1714
1714
  "input",
@@ -1742,7 +1742,7 @@ function Dt() {
1742
1742
  return "/";
1743
1743
  }
1744
1744
  const kr = ({ field: e, value: r }) => {
1745
- const { language: t, t: n } = B(), a = e.alignment || "center", o = {
1745
+ const { language: t, t: n } = B(), o = e.alignment || "center", a = {
1746
1746
  left: "flex-start",
1747
1747
  center: "center",
1748
1748
  right: "flex-end"
@@ -1786,7 +1786,7 @@ const kr = ({ field: e, value: r }) => {
1786
1786
  "data-testid": "image-wrapper",
1787
1787
  style: {
1788
1788
  display: "flex",
1789
- justifyContent: o[a] || "center",
1789
+ justifyContent: a[o] || "center",
1790
1790
  margin: "0 0"
1791
1791
  },
1792
1792
  children: /* @__PURE__ */ p(
@@ -1807,13 +1807,13 @@ const zt = l.memo(kr), Ir = ({
1807
1807
  value: r,
1808
1808
  onChange: t,
1809
1809
  onError: n,
1810
- error: a
1810
+ error: o
1811
1811
  }) => {
1812
- const o = T(e, a), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
1812
+ const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
1813
1813
  value: c,
1814
1814
  onChange: t,
1815
1815
  onError: n,
1816
- validate: o
1816
+ validate: a
1817
1817
  });
1818
1818
  return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
1819
1819
  "input",
@@ -1836,13 +1836,13 @@ const Pt = l.memo(Ir), Er = ({
1836
1836
  value: r,
1837
1837
  onChange: t,
1838
1838
  onError: n,
1839
- error: a
1839
+ error: o
1840
1840
  }) => {
1841
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
1841
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
1842
1842
  value: r,
1843
1843
  onChange: t,
1844
1844
  onError: n,
1845
- validate: o
1845
+ validate: a
1846
1846
  });
1847
1847
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
1848
1848
  "input",
@@ -1864,13 +1864,13 @@ const Lt = l.memo(Er), Mr = ({
1864
1864
  value: r,
1865
1865
  onChange: t,
1866
1866
  onError: n,
1867
- error: a
1867
+ error: o
1868
1868
  }) => {
1869
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
1869
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
1870
1870
  value: r,
1871
1871
  onChange: t,
1872
1872
  onError: n,
1873
- validate: o
1873
+ validate: a
1874
1874
  });
1875
1875
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
1876
1876
  "textarea",
@@ -1897,13 +1897,13 @@ const Ot = l.memo(Mr), Fr = ({
1897
1897
  value: r,
1898
1898
  onChange: t,
1899
1899
  onError: n,
1900
- error: a
1900
+ error: o
1901
1901
  }) => {
1902
- const o = l.useRef(
1902
+ const a = l.useRef(
1903
1903
  n
1904
1904
  );
1905
1905
  l.useEffect(() => {
1906
- o.current = n;
1906
+ a.current = n;
1907
1907
  }, [n]);
1908
1908
  const { t: c, theme: s, formStyle: i, fieldStyle: d } = B(), m = (x, k, S) => {
1909
1909
  if (!k) return {};
@@ -1915,10 +1915,10 @@ const Ot = l.memo(Mr), Fr = ({
1915
1915
  ), y = l.useMemo(() => {
1916
1916
  const x = Array.isArray(r) ? r : [], k = new Set(h.map((S) => S.value));
1917
1917
  return x.filter((S) => k.has(S));
1918
- }, [r, h]), E = T(e, a), [F, M] = l.useState(null), $ = l.useRef(null);
1918
+ }, [r, h]), E = T(e, o), [F, M] = l.useState(null), $ = l.useRef(null);
1919
1919
  l.useEffect(() => {
1920
1920
  const x = E(Array.isArray(r) ? r : []);
1921
- x !== $.current && ($.current = x, M(x), o.current?.(x ?? null));
1921
+ x !== $.current && ($.current = x, M(x), a.current?.(x ?? null));
1922
1922
  }, [r, E]);
1923
1923
  const R = () => {
1924
1924
  if (!u.current) return;
@@ -1926,7 +1926,7 @@ const Ot = l.memo(Mr), Fr = ({
1926
1926
  N({ x: x.left, y: x.bottom }), b((k) => !k);
1927
1927
  }, I = (x) => {
1928
1928
  const k = y.includes(x) ? y.filter((A) => A !== x) : [...y, x], S = E(k);
1929
- S !== $.current && ($.current = S, M(S), o.current?.(S ?? null)), t?.(k);
1929
+ S !== $.current && ($.current = S, M(S), a.current?.(S ?? null)), t?.(k);
1930
1930
  }, v = l.useMemo(
1931
1931
  () => ({
1932
1932
  height: "var(--reactaform-input-height, 2.5rem)",
@@ -2032,14 +2032,14 @@ const Ot = l.memo(Mr), Fr = ({
2032
2032
  options: r,
2033
2033
  selectedValues: t,
2034
2034
  onToggleOption: n,
2035
- onClose: a,
2036
- controlRef: o,
2035
+ onClose: o,
2036
+ controlRef: a,
2037
2037
  theme: c
2038
2038
  }) => {
2039
2039
  const s = l.useRef(null), [i, d] = l.useState(-1), { formStyle: m, fieldStyle: u } = B(), f = ie(c ?? "light");
2040
2040
  l.useLayoutEffect(() => {
2041
- if (!o.current) return;
2042
- const I = o.current.closest("[data-reactaform-theme]"), v = document.getElementById("popup-root");
2041
+ if (!a.current) return;
2042
+ const I = a.current.closest("[data-reactaform-theme]"), v = document.getElementById("popup-root");
2043
2043
  if (I && v) {
2044
2044
  const g = getComputedStyle(I);
2045
2045
  v.style.setProperty(
@@ -2053,7 +2053,7 @@ const Ot = l.memo(Mr), Fr = ({
2053
2053
  g.getPropertyValue("--reactaform-option-menu-hover-bg")
2054
2054
  );
2055
2055
  }
2056
- }, [o]);
2056
+ }, [a]);
2057
2057
  const b = (I, v, g) => {
2058
2058
  if (!v) return {};
2059
2059
  const x = I?.[v];
@@ -2090,10 +2090,10 @@ const Ot = l.memo(Mr), Fr = ({
2090
2090
  l.useEffect(() => {
2091
2091
  const I = (v) => {
2092
2092
  const g = v.target;
2093
- !s.current?.contains(g) && !o.current?.contains(g) && a();
2093
+ !s.current?.contains(g) && !a.current?.contains(g) && o();
2094
2094
  };
2095
2095
  return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
2096
- }, [a, o]), l.useEffect(() => {
2096
+ }, [o, a]), l.useEffect(() => {
2097
2097
  s.current && r.length > 0 && requestAnimationFrame(
2098
2098
  () => d((I) => I === -1 ? 0 : I)
2099
2099
  );
@@ -2109,7 +2109,7 @@ const Ot = l.memo(Mr), Fr = ({
2109
2109
  if (typeof window > "u") return;
2110
2110
  const I = () => {
2111
2111
  let w = e.x, x = e.y, k = h;
2112
- const S = o?.current;
2112
+ const S = a?.current;
2113
2113
  if (S) {
2114
2114
  const A = S.getBoundingClientRect();
2115
2115
  w = A.left, x = A.bottom, k = Math.max(80, Math.round(A.width));
@@ -2118,11 +2118,11 @@ const Ot = l.memo(Mr), Fr = ({
2118
2118
  };
2119
2119
  I(), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I);
2120
2120
  let v = null;
2121
- const g = o?.current;
2121
+ const g = a?.current;
2122
2122
  return typeof ResizeObserver < "u" && g && (v = new ResizeObserver(() => I()), v.observe(g)), () => {
2123
2123
  window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), v && g && v.unobserve(g);
2124
2124
  };
2125
- }, [o, e.x, e.y]), typeof window > "u") return null;
2125
+ }, [a, e.x, e.y]), typeof window > "u") return null;
2126
2126
  let R = document.getElementById("popup-root");
2127
2127
  return R || (R = document.createElement("div"), R.id = "popup-root", document.body.appendChild(R)), de.createPortal(
2128
2128
  /* @__PURE__ */ p(
@@ -2172,7 +2172,7 @@ const Ot = l.memo(Mr), Fr = ({
2172
2172
  k.preventDefault(), k.stopPropagation(), n(I.value);
2173
2173
  break;
2174
2174
  case "Escape":
2175
- k.preventDefault(), a(), o?.current?.focus();
2175
+ k.preventDefault(), o(), a?.current?.focus();
2176
2176
  break;
2177
2177
  }
2178
2178
  },
@@ -2220,13 +2220,13 @@ const jt = l.memo(Fr), $r = ({
2220
2220
  value: r,
2221
2221
  onChange: t,
2222
2222
  onError: n,
2223
- error: a
2223
+ error: o
2224
2224
  }) => {
2225
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
2225
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
2226
2226
  value: String(r ?? ""),
2227
2227
  onChange: t,
2228
2228
  onError: n,
2229
- validate: o
2229
+ validate: a
2230
2230
  }), d = Math.max(1, Math.round(e.step ?? 1));
2231
2231
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
2232
2232
  "input",
@@ -2255,13 +2255,13 @@ const Bt = l.memo($r), Vr = ({
2255
2255
  value: r,
2256
2256
  onChange: t,
2257
2257
  onError: n,
2258
- error: a
2258
+ error: o
2259
2259
  }) => {
2260
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
2260
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
2261
2261
  value: r,
2262
2262
  onChange: t,
2263
2263
  onError: n,
2264
- validate: o
2264
+ validate: a
2265
2265
  });
2266
2266
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
2267
2267
  "input",
@@ -2283,9 +2283,9 @@ const Ht = l.memo(Vr), Ar = ({
2283
2283
  value: r,
2284
2284
  onChange: t,
2285
2285
  onError: n,
2286
- error: a
2286
+ error: o
2287
2287
  }) => {
2288
- const { t: o } = B(), c = T(e, a), s = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", i = l.useRef(n);
2288
+ const { t: a } = B(), c = T(e, o), s = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", i = l.useRef(n);
2289
2289
  l.useEffect(() => {
2290
2290
  i.current = n;
2291
2291
  }, [n]);
@@ -2365,7 +2365,7 @@ const Ht = l.memo(Vr), Ar = ({
2365
2365
  flex: s === "column" ? 1 : void 0,
2366
2366
  fontWeight: 400
2367
2367
  },
2368
- children: o(h.label)
2368
+ children: a(h.label)
2369
2369
  }
2370
2370
  )
2371
2371
  ]
@@ -2388,8 +2388,8 @@ const qt = l.memo(Ar), Ut = {
2388
2388
  marginRight: "0.25rem",
2389
2389
  userSelect: "none",
2390
2390
  transition: "color 0.12s ease"
2391
- }, Rr = ({ field: e, value: r, onChange: t, onError: n, error: a }) => {
2392
- const { t: o } = B(), c = T(e, a), s = e.max ?? 5, i = e.icon?.trim() || "★", [d, m] = l.useState(null), u = l.useRef([]), f = l.useMemo(() => Math.min(Math.max(r ?? 0, 0), s), [r, s]), b = l.useMemo(() => c(f) ?? null, [c, f]);
2391
+ }, Rr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
2392
+ const { t: a } = B(), c = T(e, o), s = e.max ?? 5, i = e.icon?.trim() || "★", [d, m] = l.useState(null), u = l.useRef([]), f = l.useMemo(() => Math.min(Math.max(r ?? 0, 0), s), [r, s]), b = l.useMemo(() => c(f) ?? null, [c, f]);
2393
2393
  l.useEffect(() => {
2394
2394
  n?.(b);
2395
2395
  }, [b, n]);
@@ -2436,7 +2436,7 @@ const qt = l.memo(Ar), Ut = {
2436
2436
  tabIndex: f > 0 ? y === f - 1 ? 0 : -1 : y === 0 ? 0 : -1,
2437
2437
  "aria-checked": E,
2438
2438
  "aria-label": `Rating ${y + 1}`,
2439
- title: o(`${e.displayName} ${y + 1}`),
2439
+ title: a(`${e.displayName} ${y + 1}`),
2440
2440
  onClick: () => C(y + 1),
2441
2441
  onKeyDown: ($) => N($, y),
2442
2442
  onMouseEnter: () => m(y),
@@ -2456,9 +2456,9 @@ const _t = l.memo(Rr), Dr = ({
2456
2456
  value: r,
2457
2457
  onChange: t,
2458
2458
  onError: n,
2459
- error: a
2459
+ error: o
2460
2460
  }) => {
2461
- const { t: o } = B(), c = T(e, a), { inputRef: s, error: i, handleChange: d } = _({
2461
+ const { t: a } = B(), c = T(e, o), { inputRef: s, error: i, handleChange: d } = _({
2462
2462
  value: r,
2463
2463
  onChange: t,
2464
2464
  onError: n,
@@ -2484,7 +2484,7 @@ const _t = l.memo(Rr), Dr = ({
2484
2484
  {
2485
2485
  type: "button",
2486
2486
  onClick: f,
2487
- "aria-label": o(m ? "Hide password" : "Show password"),
2487
+ "aria-label": a(m ? "Hide password" : "Show password"),
2488
2488
  style: {
2489
2489
  background: "transparent",
2490
2490
  border: "none",
@@ -2500,15 +2500,15 @@ const _t = l.memo(Rr), Dr = ({
2500
2500
  ] }) });
2501
2501
  };
2502
2502
  Dr.displayName = "PasswordInput";
2503
- const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, error: a }) => {
2504
- const o = T(e, a), c = e.min ?? 0, s = e.max ?? 100, [i, d] = l.useState(
2503
+ const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
2504
+ const a = T(e, o), c = e.min ?? 0, s = e.max ?? 100, [i, d] = l.useState(
2505
2505
  () => isNaN(Number(r)) ? String(c) : String(Number(r))
2506
2506
  );
2507
2507
  l.useEffect(() => {
2508
2508
  const b = isNaN(Number(r)) ? String(c) : String(Number(r));
2509
2509
  d(b);
2510
2510
  }, [r, c]);
2511
- const m = l.useMemo(() => o(i) ?? null, [o, i]);
2511
+ const m = l.useMemo(() => a(i) ?? null, [a, i]);
2512
2512
  l.useEffect(() => {
2513
2513
  n?.(m);
2514
2514
  }, [m, n]);
@@ -2567,9 +2567,9 @@ const Gt = l.memo(zr), Pr = ({
2567
2567
  value: r,
2568
2568
  onChange: t,
2569
2569
  onError: n,
2570
- error: a
2570
+ error: o
2571
2571
  }) => {
2572
- const { t: o, formStyle: c, fieldStyle: s } = B(), d = T(e, a)(r);
2572
+ const { t: a, formStyle: c, fieldStyle: s } = B(), d = T(e, o)(r);
2573
2573
  l.useEffect(() => {
2574
2574
  n?.(d);
2575
2575
  }, [d, n]);
@@ -2638,7 +2638,7 @@ const Gt = l.memo(zr), Pr = ({
2638
2638
  className: V.label,
2639
2639
  htmlFor: e.name,
2640
2640
  style: { textAlign: "left", justifyContent: "flex-start" },
2641
- children: o(e.displayName)
2641
+ children: a(e.displayName)
2642
2642
  }
2643
2643
  ),
2644
2644
  /* @__PURE__ */ D("label", { style: b, children: [
@@ -2649,7 +2649,7 @@ const Gt = l.memo(zr), Pr = ({
2649
2649
  type: "checkbox",
2650
2650
  checked: y,
2651
2651
  readOnly: !0,
2652
- "aria-label": o(e.displayName),
2652
+ "aria-label": a(e.displayName),
2653
2653
  "aria-invalid": !1,
2654
2654
  "aria-describedby": void 0,
2655
2655
  style: C,
@@ -2691,13 +2691,13 @@ const Jt = l.memo(Pr), xe = ({
2691
2691
  value: r,
2692
2692
  onChange: t,
2693
2693
  onError: n,
2694
- error: a
2694
+ error: o
2695
2695
  }) => {
2696
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
2696
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
2697
2697
  value: r,
2698
2698
  onChange: t,
2699
2699
  onError: n,
2700
- validate: o
2700
+ validate: a
2701
2701
  });
2702
2702
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
2703
2703
  "input",
@@ -2720,13 +2720,13 @@ const Lr = ({
2720
2720
  value: r,
2721
2721
  onChange: t,
2722
2722
  onError: n,
2723
- error: a
2723
+ error: o
2724
2724
  }) => {
2725
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
2725
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
2726
2726
  value: r,
2727
2727
  onChange: t,
2728
2728
  onError: n,
2729
- validate: o
2729
+ validate: a
2730
2730
  });
2731
2731
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
2732
2732
  "input",
@@ -2753,27 +2753,27 @@ function Xt({
2753
2753
  onClose: t,
2754
2754
  onClickOption: n
2755
2755
  }) {
2756
- const a = l.useRef(null), o = l.useRef(!1), [c, s] = l.useState({
2756
+ const o = l.useRef(null), a = l.useRef(!1), [c, s] = l.useState({
2757
2757
  top: e?.y ?? 0,
2758
2758
  left: e?.x ?? 0,
2759
2759
  ready: !1
2760
2760
  }), i = typeof window < "u" ? document.getElementById("popup-root") || document.body : null;
2761
2761
  return l.useEffect(() => {
2762
2762
  function d(m) {
2763
- o.current || m.target.dataset?.popupMenu === "item" || a.current && m.target instanceof Node && !a.current.contains(m.target) && t();
2763
+ a.current || m.target.dataset?.popupMenu === "item" || o.current && m.target instanceof Node && !o.current.contains(m.target) && t();
2764
2764
  }
2765
2765
  return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
2766
2766
  }, [t]), l.useLayoutEffect(() => {
2767
- if (!a.current || !e || e.x == null || e.y == null)
2767
+ if (!o.current || !e || e.x == null || e.y == null)
2768
2768
  return;
2769
- const d = a.current.getBoundingClientRect(), m = window.innerWidth, u = window.innerHeight;
2769
+ const d = o.current.getBoundingClientRect(), m = window.innerWidth, u = window.innerHeight;
2770
2770
  let f = e.x, b = e.y;
2771
2771
  f + d.width > m && (f = Math.max(0, m - d.width - 10)), b + d.height > u && (b = Math.max(0, e.y - d.height - 5)), s({ top: b, left: f, ready: !0 });
2772
2772
  }, [e, r]), !i || r === void 0 || r.length === 0 || !e || e.x == null || e.y == null ? null : de.createPortal(
2773
2773
  /* @__PURE__ */ p(
2774
2774
  "div",
2775
2775
  {
2776
- ref: a,
2776
+ ref: o,
2777
2777
  onMouseDown: (d) => {
2778
2778
  d.stopPropagation();
2779
2779
  },
@@ -2797,11 +2797,11 @@ function Xt({
2797
2797
  {
2798
2798
  "data-popup-menu": "item",
2799
2799
  onMouseDown: (u) => {
2800
- u.stopPropagation(), o.current = !0;
2800
+ u.stopPropagation(), a.current = !0;
2801
2801
  },
2802
2802
  onClick: (u) => {
2803
2803
  u.stopPropagation(), u.preventDefault(), n(d), t(), setTimeout(() => {
2804
- o.current = !1;
2804
+ a.current = !1;
2805
2805
  }, 100);
2806
2806
  },
2807
2807
  style: {
@@ -2949,22 +2949,22 @@ const $e = {
2949
2949
  ...Object.keys(Ae)
2950
2950
  ]);
2951
2951
  for (const e of Zt) {
2952
- const r = {}, t = $e[e] ?? [], n = Ve[e] ?? {}, a = Ae[e] ?? {};
2953
- for (const o of t) {
2954
- const c = n[o];
2955
- r[o] = {
2956
- name: typeof c == "string" ? c : String(o),
2957
- shortName: o,
2958
- factor: o in a ? a[o] : void 0
2952
+ const r = {}, t = $e[e] ?? [], n = Ve[e] ?? {}, o = Ae[e] ?? {};
2953
+ for (const a of t) {
2954
+ const c = n[a];
2955
+ r[a] = {
2956
+ name: typeof c == "string" ? c : String(a),
2957
+ shortName: a,
2958
+ factor: a in o ? o[a] : void 0
2959
2959
  };
2960
2960
  }
2961
- for (const [o, c] of Object.entries(n))
2962
- if (!r[o]) {
2963
- const s = typeof c == "string" ? c : String(o);
2964
- r[o] = { name: s, shortName: o, factor: o in a ? a[o] : void 0 };
2961
+ for (const [a, c] of Object.entries(n))
2962
+ if (!r[a]) {
2963
+ const s = typeof c == "string" ? c : String(a);
2964
+ r[a] = { name: s, shortName: a, factor: a in o ? o[a] : void 0 };
2965
2965
  }
2966
- for (const [o, c] of Object.entries(a))
2967
- r[o] || (r[o] = { name: String(o), shortName: String(o), factor: c });
2966
+ for (const [a, c] of Object.entries(o))
2967
+ r[a] || (r[a] = { name: String(a), shortName: String(a), factor: c });
2968
2968
  Re[e] = r;
2969
2969
  }
2970
2970
  function Or(e, r, t) {
@@ -2984,15 +2984,15 @@ function Tr(e) {
2984
2984
  const r = Re[e];
2985
2985
  if (!r) return null;
2986
2986
  const t = {}, n = [];
2987
- for (const [o, c] of Object.entries(r))
2988
- typeof c.factor == "number" && (t[o] = c.factor), n.push(o);
2987
+ for (const [a, c] of Object.entries(r))
2988
+ typeof c.factor == "number" && (t[a] = c.factor), n.push(a);
2989
2989
  return {
2990
2990
  default: Object.keys(r)[0] ?? "",
2991
2991
  units: n,
2992
2992
  factors: t
2993
2993
  };
2994
2994
  }
2995
- const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2995
+ const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2996
2996
  __proto__: null,
2997
2997
  convertTemperature: Or,
2998
2998
  dimensionUnitDisplayMap: Ve,
@@ -3005,8 +3005,8 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3005
3005
  inputValue: r,
3006
3006
  selectedUnit: t,
3007
3007
  dimension: n,
3008
- unitFactors: a,
3009
- onConversionSelect: o,
3008
+ unitFactors: o,
3009
+ onConversionSelect: a,
3010
3010
  t: c
3011
3011
  }) => {
3012
3012
  const [s, i] = l.useState(!1), [d, m] = l.useState(null), [u, f] = l.useState([]), b = l.useCallback(
@@ -3018,7 +3018,7 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3018
3018
  m({ x: E.left, y: E.bottom });
3019
3019
  const F = [];
3020
3020
  if (n === "temperature")
3021
- a.units.forEach(($) => {
3021
+ o.units.forEach(($) => {
3022
3022
  const R = Or(t, $, y);
3023
3023
  Number.isFinite(R) && F.push({
3024
3024
  label: `${R.toFixed(6)} ${c($)}`,
@@ -3027,8 +3027,8 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3027
3027
  });
3028
3028
  });
3029
3029
  else {
3030
- const $ = a.factors[t];
3031
- $ !== void 0 && Object.entries(a.factors).forEach(([R, I]) => {
3030
+ const $ = o.factors[t];
3031
+ $ !== void 0 && Object.entries(o.factors).forEach(([R, I]) => {
3032
3032
  const v = y / $ * I;
3033
3033
  Number.isFinite(v) && F.push({
3034
3034
  label: `${v.toFixed(6)} ${c(R)}`,
@@ -3039,12 +3039,12 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3039
3039
  }
3040
3040
  f(F), i(F.length > 0);
3041
3041
  },
3042
- [e, r, t, n, a, c]
3042
+ [e, r, t, n, o, c]
3043
3043
  ), C = l.useCallback(
3044
3044
  (h) => {
3045
- i(!1), m(null), o(h);
3045
+ i(!1), m(null), a(h);
3046
3046
  },
3047
- [o]
3047
+ [a]
3048
3048
  ), N = l.useCallback(() => {
3049
3049
  i(!1), m(null);
3050
3050
  }, []);
@@ -3088,36 +3088,36 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3088
3088
  });
3089
3089
  jr.displayName = "ConversionButton";
3090
3090
  const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
3091
- const { t: a } = B(), o = T(e), c = e.dimension, s = l.useMemo(() => c ? Tr(c) : null, [c]), i = String(r?.[0] ?? ""), d = String(r?.[1] ?? s?.default ?? ""), [m, u] = l.useState(i), [f, b] = l.useState(d);
3091
+ const { t: o } = B(), a = T(e), c = e.dimension, s = l.useMemo(() => c ? Tr(c) : null, [c]), i = String(r?.[0] ?? ""), d = String(r?.[1] ?? s?.default ?? ""), [m, u] = l.useState(i), [f, b] = l.useState(d);
3092
3092
  l.useEffect(() => {
3093
3093
  u(i);
3094
3094
  }, [i]), l.useEffect(() => {
3095
3095
  b(d);
3096
3096
  }, [d]);
3097
- const C = o([m, f]);
3097
+ const C = a([m, f]);
3098
3098
  l.useEffect(() => {
3099
3099
  n?.(C);
3100
3100
  }, [C, n]);
3101
3101
  const N = l.useCallback(
3102
3102
  (M) => {
3103
3103
  const $ = M.target.value;
3104
- u($), o([$, f]), t?.([$, f]);
3104
+ u($), a([$, f]), t?.([$, f]);
3105
3105
  },
3106
- [f, o, t]
3106
+ [f, a, t]
3107
3107
  ), h = l.useCallback(
3108
3108
  (M) => {
3109
3109
  const $ = M.target.value;
3110
- b($), o([m, $]), t?.([m, $]);
3110
+ b($), a([m, $]), t?.([m, $]);
3111
3111
  },
3112
- [m, o, t]
3112
+ [m, a, t]
3113
3113
  ), y = l.useCallback(
3114
3114
  (M) => {
3115
3115
  u(M.value), b(M.unit), t?.([M.value, M.unit]);
3116
3116
  },
3117
3117
  [t]
3118
3118
  ), E = l.useMemo(
3119
- () => s ? s.units.map((M) => /* @__PURE__ */ p("option", { value: M, children: a(M) }, M)) : [],
3120
- [s, a]
3119
+ () => s ? s.units.map((M) => /* @__PURE__ */ p("option", { value: M, children: o(M) }, M)) : [],
3120
+ [s, o]
3121
3121
  );
3122
3122
  if (!c || !s) return null;
3123
3123
  const F = !!C || !m.trim();
@@ -3157,7 +3157,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
3157
3157
  dimension: c,
3158
3158
  unitFactors: s,
3159
3159
  onConversionSelect: y,
3160
- t: a
3160
+ t: o
3161
3161
  }
3162
3162
  )
3163
3163
  ] }) });
@@ -3168,13 +3168,13 @@ const Qt = l.memo(Br), Hr = ({
3168
3168
  value: r,
3169
3169
  onChange: t,
3170
3170
  onError: n,
3171
- error: a
3171
+ error: o
3172
3172
  }) => {
3173
- const o = T(e, a), { inputRef: c, error: s, handleChange: i } = _({
3173
+ const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
3174
3174
  value: r,
3175
3175
  onChange: t,
3176
3176
  onError: n,
3177
- validate: o
3177
+ validate: a
3178
3178
  });
3179
3179
  return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
3180
3180
  "input",
@@ -3193,19 +3193,19 @@ const Qt = l.memo(Br), Hr = ({
3193
3193
  };
3194
3194
  Hr.displayName = "UrlInput";
3195
3195
  const en = l.memo(Hr), se = new ne();
3196
- function da(e, r) {
3196
+ function fo(e, r) {
3197
3197
  se.register(e, r);
3198
3198
  }
3199
3199
  function rn(e) {
3200
3200
  return se.get(e);
3201
3201
  }
3202
- function fa(e) {
3202
+ function po(e) {
3203
3203
  return se.has(e);
3204
3204
  }
3205
- function pa(e) {
3205
+ function go(e) {
3206
3206
  return se.unregister(e);
3207
3207
  }
3208
- function ga() {
3208
+ function ho() {
3209
3209
  return se.list();
3210
3210
  }
3211
3211
  const qr = ({
@@ -3214,7 +3214,7 @@ const qr = ({
3214
3214
  handleChange: t,
3215
3215
  handleError: n
3216
3216
  }) => {
3217
- const { t: a } = B(), [o, c] = l.useState(!1), [s, i] = l.useState(null), d = l.useCallback(async () => {
3217
+ const { t: o } = B(), [a, c] = l.useState(!1), [s, i] = l.useState(null), d = l.useCallback(async () => {
3218
3218
  if (!e.action) {
3219
3219
  console.warn(`Button "${e.name}" has no action defined`);
3220
3220
  return;
@@ -3227,16 +3227,16 @@ const qr = ({
3227
3227
  }
3228
3228
  c(!0), i(null);
3229
3229
  try {
3230
- await f(r, t, n, a);
3230
+ await f(r, t, n, o);
3231
3231
  } catch (b) {
3232
3232
  const C = b instanceof Error ? b.message : String(b);
3233
3233
  console.error(`Button handler "${e.action}" failed:`, C), i(C);
3234
3234
  } finally {
3235
3235
  c(!1);
3236
3236
  }
3237
- }, [e, r, t, n, a]), u = { ...{
3238
- cursor: o ? "wait" : "pointer",
3239
- opacity: o ? 0.6 : 1
3237
+ }, [e, r, t, n, o]), u = { ...{
3238
+ cursor: a ? "wait" : "pointer",
3239
+ opacity: a ? 0.6 : 1
3240
3240
  } };
3241
3241
  return e.width && typeof e.width == "number" && e.width > 0 && (u.width = `${e.width}px`), /* @__PURE__ */ p(O, { field: e, rightAlign: !0, error: s, children: /* @__PURE__ */ p(
3242
3242
  "button",
@@ -3244,11 +3244,11 @@ const qr = ({
3244
3244
  type: "button",
3245
3245
  className: V.button,
3246
3246
  onClick: d,
3247
- disabled: o,
3248
- "aria-label": a(e.displayName),
3249
- "aria-busy": o,
3247
+ disabled: a,
3248
+ "aria-label": o(e.displayName),
3249
+ "aria-busy": a,
3250
3250
  style: u,
3251
- children: a(o ? "Processing..." : e.displayName)
3251
+ children: o(a ? "Processing..." : e.displayName)
3252
3252
  }
3253
3253
  ) });
3254
3254
  };
@@ -3315,11 +3315,11 @@ const tn = l.memo(qr), nn = {
3315
3315
  unit: Qt,
3316
3316
  url: en
3317
3317
  };
3318
- function an(e) {
3318
+ function on(e) {
3319
3319
  return e in De;
3320
3320
  }
3321
- function on(e, r) {
3322
- const { wait: t = 200, leading: n, trailing: a } = r, o = l.memo((c) => {
3321
+ function an(e, r) {
3322
+ const { wait: t = 200, leading: n, trailing: o } = r, a = l.memo((c) => {
3323
3323
  const s = l.useRef(c.onChange);
3324
3324
  l.useEffect(() => {
3325
3325
  s.current = c.onChange;
@@ -3329,14 +3329,14 @@ function on(e, r) {
3329
3329
  s.current?.(...m);
3330
3330
  },
3331
3331
  t,
3332
- { leading: n, trailing: a }
3332
+ { leading: n, trailing: o }
3333
3333
  );
3334
3334
  return l.useEffect(() => d, [d]), l.createElement(
3335
3335
  e,
3336
3336
  { ...c, onChange: i }
3337
3337
  );
3338
3338
  });
3339
- return o.displayName = "DebouncedFieldWrapper", o;
3339
+ return a.displayName = "DebouncedFieldWrapper", a;
3340
3340
  }
3341
3341
  function Ur(e, r, t) {
3342
3342
  const n = r;
@@ -3344,15 +3344,15 @@ function Ur(e, r, t) {
3344
3344
  console.warn(`Can't overwrite base component type "${e}".`);
3345
3345
  return;
3346
3346
  }
3347
- const a = nn[e];
3348
- if (a === !1) {
3347
+ const o = nn[e];
3348
+ if (o === !1) {
3349
3349
  me.register(e, n);
3350
3350
  return;
3351
3351
  }
3352
- const o = a ?? { wait: 200 };
3353
- ar ? me.register(e, n) : me.register(
3352
+ const a = o ?? { wait: 200 };
3353
+ or ? me.register(e, n) : me.register(
3354
3354
  e,
3355
- on(n, o)
3355
+ an(n, a)
3356
3356
  );
3357
3357
  }
3358
3358
  function Wr(e, r) {
@@ -3368,15 +3368,15 @@ function sn() {
3368
3368
  }), Ye = !0);
3369
3369
  }
3370
3370
  const ze = l.memo(
3371
- ({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap: a }) => {
3372
- const o = _r(e.type), c = r[e.name], s = a ? a[e.name] ?? null : void 0, i = l.useMemo(() => c, [c]), d = l.useCallback(
3371
+ ({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap: o }) => {
3372
+ const a = _r(e.type), c = r[e.name], s = o ? o[e.name] ?? null : void 0, i = l.useMemo(() => c, [c]), d = l.useCallback(
3373
3373
  (u) => t(e.name, u),
3374
3374
  [t, e.name]
3375
3375
  ), m = l.useCallback(
3376
3376
  (u) => n?.(e.name, u),
3377
3377
  [n, e.name]
3378
3378
  );
3379
- return o ? e.type === "button" ? /* @__PURE__ */ p(o, { ...{
3379
+ return a ? e.type === "button" ? /* @__PURE__ */ p(a, { ...{
3380
3380
  field: e,
3381
3381
  value: null,
3382
3382
  valuesMap: r,
@@ -3384,7 +3384,7 @@ const ze = l.memo(
3384
3384
  handleError: n || (() => {
3385
3385
  })
3386
3386
  } }) : /* @__PURE__ */ p(
3387
- o,
3387
+ a,
3388
3388
  {
3389
3389
  field: e,
3390
3390
  value: i,
@@ -3398,7 +3398,7 @@ const ze = l.memo(
3398
3398
  );
3399
3399
  ze.displayName = "FieldRenderer";
3400
3400
  const Kr = l.memo(
3401
- ({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange: a, handleError: o, errorsMap: c, t: s }) => {
3401
+ ({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange: o, handleError: a, errorsMap: c, t: s }) => {
3402
3402
  const [i, d] = l.useState(r), m = l.useCallback(() => d((u) => !u), []);
3403
3403
  return /* @__PURE__ */ D("fieldset", { className: "reactaform-group", children: [
3404
3404
  /* @__PURE__ */ D("legend", { onClick: m, className: "reactaform-group_legend", children: [
@@ -3410,8 +3410,8 @@ const Kr = l.memo(
3410
3410
  {
3411
3411
  field: u,
3412
3412
  valuesMap: n,
3413
- handleChange: a,
3414
- handleError: o,
3413
+ handleChange: o,
3414
+ handleError: a,
3415
3415
  errorsMap: c
3416
3416
  },
3417
3417
  u.name
@@ -3421,62 +3421,62 @@ const Kr = l.memo(
3421
3421
  );
3422
3422
  Kr.displayName = "FieldGroup";
3423
3423
  const Pe = (e, r, t, n) => {
3424
- const a = r[e];
3425
- if (!a?.children) return;
3426
- const o = t[e], c = o != null ? String(o) : "", s = a.children[c];
3424
+ const o = r[e];
3425
+ if (!o?.children) return;
3426
+ const a = t[e], c = a != null ? String(a) : "", s = o.children[c];
3427
3427
  if (Array.isArray(s))
3428
3428
  for (const i of s)
3429
3429
  typeof i == "string" && r[i] && (n[i] = !0, Pe(i, r, t, n));
3430
3430
  }, Gr = (e, r, t) => {
3431
3431
  const n = r[e];
3432
3432
  if (!n?.children) return;
3433
- const a = Object.values(n.children).flat();
3434
- for (const o of a)
3435
- typeof o == "string" && o in t && (t[o] = !1, Gr(o, r, t));
3433
+ const o = Object.values(n.children).flat();
3434
+ for (const a of o)
3435
+ typeof a == "string" && a in t && (t[a] = !1, Gr(a, r, t));
3436
3436
  }, cn = (e, r, t, n) => {
3437
- const a = { ...t };
3438
- return e.forEach((o) => {
3439
- (!o.parents || Object.keys(o.parents).length === 0) && (a[o.name] = !0, Pe(o.name, n, r, a));
3440
- }), a;
3441
- }, ln = (e, r, t, n, a) => {
3442
- const o = { ...e }, c = r[n];
3443
- if (Gr(n, r, o), a != null && c?.children) {
3444
- const s = String(a), i = c.children[s];
3437
+ const o = { ...t };
3438
+ return e.forEach((a) => {
3439
+ (!a.parents || Object.keys(a.parents).length === 0) && (o[a.name] = !0, Pe(a.name, n, r, o));
3440
+ }), o;
3441
+ }, ln = (e, r, t, n, o) => {
3442
+ const a = { ...e }, c = r[n];
3443
+ if (Gr(n, r, a), o != null && c?.children) {
3444
+ const s = String(o), i = c.children[s];
3445
3445
  if (Array.isArray(i))
3446
3446
  for (const d of i)
3447
- typeof d == "string" && r[d] && (o[d] = !0, Pe(d, r, t, o));
3447
+ typeof d == "string" && r[d] && (a[d] = !0, Pe(d, r, t, a));
3448
3448
  }
3449
- return o;
3449
+ return a;
3450
3450
  }, un = (e, r) => {
3451
3451
  const t = /* @__PURE__ */ new Map();
3452
- let n = null, a = null, o = 0;
3452
+ let n = null, o = null, a = 0;
3453
3453
  for (const c of e) {
3454
3454
  const s = c.group;
3455
3455
  if (!s) {
3456
- n = null, a = null;
3456
+ n = null, o = null;
3457
3457
  continue;
3458
3458
  }
3459
3459
  if (s === n)
3460
- r[c.name].group = a ?? s;
3460
+ r[c.name].group = o ?? s;
3461
3461
  else {
3462
3462
  if (!t.has(s))
3463
- t.set(s, 1), a = null, r[c.name].group = s;
3463
+ t.set(s, 1), o = null, r[c.name].group = s;
3464
3464
  else {
3465
3465
  const i = t.get(s), d = `${s}(${i})`;
3466
- t.set(s, i + 1), a = d, r[c.name].group = d, o++;
3466
+ t.set(s, i + 1), o = d, r[c.name].group = d, a++;
3467
3467
  }
3468
3468
  n = s;
3469
3469
  }
3470
3470
  }
3471
- return o;
3471
+ return a;
3472
3472
  }, mn = (e, r = {}) => {
3473
3473
  const { includeEmpty: t = !0 } = r, n = [];
3474
- let a = null, o = [], c = 0;
3474
+ let o = null, a = [], c = 0;
3475
3475
  for (const i of e) {
3476
3476
  const d = i.group || null;
3477
- d !== a ? ((o.length > 0 || t) && n.push({ name: a, fields: o }), a = d, o = [i]) : o.push(i);
3477
+ d !== o ? ((a.length > 0 || t) && n.push({ name: o, fields: a }), o = d, a = [i]) : a.push(i);
3478
3478
  }
3479
- (o.length > 0 || t) && n.push({ name: a, fields: o }), c = n.filter((i) => i.fields.length === 0).length;
3479
+ (a.length > 0 || t) && n.push({ name: o, fields: a }), c = n.filter((i) => i.fields.length === 0).length;
3480
3480
  const s = Math.max(0, ...n.map((i) => i.fields.length));
3481
3481
  return {
3482
3482
  groups: n,
@@ -3504,12 +3504,12 @@ Jr(
3504
3504
  version: e.version,
3505
3505
  definition: e.name,
3506
3506
  values: t
3507
- }, a = JSON.stringify(n, null, 2);
3508
- alert(a);
3507
+ }, o = JSON.stringify(n, null, 2);
3508
+ alert(o);
3509
3509
  }
3510
3510
  );
3511
- async function pn(e, r, t, n, a, o, c) {
3512
- const s = a ? Object.values(a).filter(Boolean) : [];
3511
+ async function pn(e, r, t, n, o, a, c) {
3512
+ const s = o ? Object.values(o).filter(Boolean) : [];
3513
3513
  if (s.length > 0)
3514
3514
  return {
3515
3515
  success: !1,
@@ -3580,9 +3580,9 @@ async function pn(e, r, t, n, a, o, c) {
3580
3580
  };
3581
3581
  }
3582
3582
  const m = (u) => u ? Array.isArray(u) ? u.map((f) => String(f)) : typeof u == "string" ? u.trim() ? [u] : [] : [String(u)] : [];
3583
- if (o)
3583
+ if (a)
3584
3584
  try {
3585
- const u = await o(e, r?.name ?? null, i, n), f = m(u);
3585
+ const u = await a(e, r?.name ?? null, i, n), f = m(u);
3586
3586
  if (f.length > 0)
3587
3587
  return {
3588
3588
  success: !1,
@@ -3665,14 +3665,14 @@ const Yr = ({
3665
3665
  ) : null;
3666
3666
  Yr.displayName = "SubmissionMessage";
3667
3667
  const gn = ({ onClick: e, disabled: r = !1, t }) => {
3668
- const [n, a] = l.useState(!1);
3668
+ const [n, o] = l.useState(!1);
3669
3669
  return /* @__PURE__ */ p(
3670
3670
  "button",
3671
3671
  {
3672
3672
  onClick: e,
3673
3673
  disabled: r,
3674
- onMouseEnter: () => a(!0),
3675
- onMouseLeave: () => a(!1),
3674
+ onMouseEnter: () => o(!0),
3675
+ onMouseLeave: () => o(!1),
3676
3676
  style: {
3677
3677
  padding: "var(--reactaform-button-padding, var(--reactaform-space) 12px)",
3678
3678
  backgroundColor: r ? "var(--reactaform-button-disabled-bg, #cccccc)" : "var(--reactaform-button-bg, var(--reactaform-success-color))",
@@ -3695,15 +3695,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3695
3695
  instance: r,
3696
3696
  onSubmit: t = void 0,
3697
3697
  onValidation: n = void 0,
3698
- chunkSize: a = 50,
3699
- chunkDelay: o = 50
3698
+ chunkSize: o = 50,
3699
+ chunkDelay: a = 50
3700
3700
  }) => {
3701
3701
  const { properties: c, displayName: s } = e, i = B(), { t: d, formStyle: m, language: u, displayInstanceName: f } = i, b = {
3702
3702
  ...i,
3703
3703
  definitionName: e?.name ?? i.definitionName
3704
3704
  }, [C, N] = l.useState("en"), [h, y] = l.useState([]), [E, F] = l.useState({}), [M, $] = l.useState(
3705
3705
  {}
3706
- ), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je, ae] = l.useState(r.name || ""), Y = l.useRef(r), fe = l.useRef(!1);
3706
+ ), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je, oe] = l.useState(r.name || ""), Y = l.useRef(r), fe = l.useRef(!1);
3707
3707
  l.useEffect(() => {
3708
3708
  const z = Object.fromEntries(
3709
3709
  c.map((L) => [
@@ -3714,9 +3714,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3714
3714
  c.forEach((L) => {
3715
3715
  L.parents && Object.entries(L.parents).forEach(([Q, re]) => {
3716
3716
  const X = z[Q];
3717
- X && re.forEach((ot) => {
3717
+ X && re.forEach((at) => {
3718
3718
  X.children || (X.children = {});
3719
- const qe = String(ot);
3719
+ const qe = String(at);
3720
3720
  X.children[qe] = [
3721
3721
  ...X.children[qe] || [],
3722
3722
  L.name
@@ -3739,18 +3739,18 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3739
3739
  const J = Object.fromEntries(q.map((L) => [L.name, !1])), G = requestAnimationFrame(() => {
3740
3740
  y(q), F(z), $(P), I(
3741
3741
  cn(q, P, J, z)
3742
- ), ce(!0), ae(r.name);
3742
+ ), ce(!0), oe(r.name);
3743
3743
  });
3744
3744
  return () => cancelAnimationFrame(G);
3745
3745
  }, [c, r, e]), l.useEffect(() => {
3746
3746
  if (!K || A >= h.length) return;
3747
3747
  const z = setTimeout(() => {
3748
3748
  j(
3749
- (q) => Math.min(q + a, h.length)
3749
+ (q) => Math.min(q + o, h.length)
3750
3750
  );
3751
- }, o);
3751
+ }, a);
3752
3752
  return () => clearTimeout(z);
3753
- }, [K, A, h.length, a, o]);
3753
+ }, [K, A, h.length, o, a]);
3754
3754
  const Be = l.useCallback(
3755
3755
  (z, q) => {
3756
3756
  x(null), S(null), $((J) => ({ ...J, [z]: q }));
@@ -3777,10 +3777,10 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3777
3777
  let z = 0;
3778
3778
  return z = requestAnimationFrame(() => {
3779
3779
  if (fe.current) {
3780
- fe.current = !1, Y.current = r, ae(r.name || "");
3780
+ fe.current = !1, Y.current = r, oe(r.name || "");
3781
3781
  return;
3782
3782
  }
3783
- Y.current = r, x(null), S(null), ae(r.name || "");
3783
+ Y.current = r, x(null), S(null), oe(r.name || "");
3784
3784
  }), () => cancelAnimationFrame(z);
3785
3785
  }, [r, r.name]);
3786
3786
  const He = l.useCallback((z, q) => {
@@ -3806,9 +3806,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3806
3806
  const P = await pn(e, Y.current, M, d, q, t, n), J = typeof P.message == "string" ? P.message : String(P.message), G = Object.values(P.errors ?? {}).join(`
3807
3807
  `);
3808
3808
  x(G ? J + `
3809
- ` + G : J), S(P.success), P.success || (Y.current.name = z ?? Y.current.name, ae(z ?? ""));
3810
- }, at = l.useMemo(
3811
- () => b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
3809
+ ` + G : J), S(P.success), P.success || (Y.current.name = z ?? Y.current.name, oe(z ?? ""));
3810
+ }, ot = l.useMemo(
3811
+ () => b.fieldValidationMode === "onEdit" || b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
3812
3812
  [v, b.fieldValidationMode]
3813
3813
  );
3814
3814
  return /* @__PURE__ */ p(Ee.Provider, { value: b, children: /* @__PURE__ */ D("div", { style: m.container, children: [
@@ -3829,7 +3829,7 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3829
3829
  {
3830
3830
  name: je,
3831
3831
  onChange: (z) => {
3832
- ae(z), x(null), S(null);
3832
+ oe(z), x(null), S(null);
3833
3833
  }
3834
3834
  }
3835
3835
  ),
@@ -3872,7 +3872,7 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3872
3872
  }
3873
3873
  )
3874
3874
  ] }),
3875
- /* @__PURE__ */ p(gn, { onClick: nt, disabled: at, t: d })
3875
+ /* @__PURE__ */ p(gn, { onClick: nt, disabled: ot, t: d })
3876
3876
  ] }) });
3877
3877
  }, Xr = {
3878
3878
  en: { name: "English", nativeName: "English" },
@@ -3905,15 +3905,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3905
3905
  uk: { name: "Ukrainian", nativeName: "Українська" },
3906
3906
  vi: { name: "Vietnamese", nativeName: "Tiếng Việt" },
3907
3907
  "zh-tw": { name: "Chinese (Traditional)", nativeName: "繁體中文" }
3908
- }, ha = () => Xr, be = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set(), we = /* @__PURE__ */ new Map(), bn = async (e) => {
3908
+ }, bo = () => Xr, be = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set(), we = /* @__PURE__ */ new Map(), bn = async (e) => {
3909
3909
  try {
3910
3910
  let r = {};
3911
3911
  const t = e.toLowerCase();
3912
3912
  if (t === "en")
3913
3913
  r = {};
3914
3914
  else if (Xr[t]) {
3915
- const a = `https://reactaform.com/locales/${t}/common.json`, o = await fetch(a);
3916
- o.ok && (r = await o.json());
3915
+ const o = `https://reactaform.com/locales/${t}/common.json`, a = await fetch(o);
3916
+ a.ok && (r = await a.json());
3917
3917
  } else
3918
3918
  r = {};
3919
3919
  return {
@@ -3968,9 +3968,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3968
3968
  try {
3969
3969
  let n = r;
3970
3970
  !r.includes("/") && !r.includes(".") && (n = `/locales/${e}/${r}.json`);
3971
- const a = await fetch(n);
3972
- if (!a.ok)
3973
- return a.status === 404 ? (le.set(t, {}), we.set(t, {
3971
+ const o = await fetch(n);
3972
+ if (!o.ok)
3973
+ return o.status === 404 ? (le.set(t, {}), we.set(t, {
3974
3974
  loadedAt: /* @__PURE__ */ new Date(),
3975
3975
  size: 0,
3976
3976
  source: "user"
@@ -3981,14 +3981,14 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
3981
3981
  }) : (te.add(t), {
3982
3982
  success: !1,
3983
3983
  translations: {},
3984
- error: `HTTP ${a.status}`,
3984
+ error: `HTTP ${o.status}`,
3985
3985
  fromCache: !1
3986
3986
  });
3987
- const o = a.headers.get("content-type") || "";
3988
- !o.includes("application/json") && !o.includes("text/json") && Zr() && console.warn(
3989
- `Translation file at ${n} has unexpected content-type: ${o}`
3987
+ const a = o.headers.get("content-type") || "";
3988
+ !a.includes("application/json") && !a.includes("text/json") && Zr() && console.warn(
3989
+ `Translation file at ${n} has unexpected content-type: ${a}`
3990
3990
  );
3991
- const c = await a.text();
3991
+ const c = await o.text();
3992
3992
  if (!c) {
3993
3993
  const d = "Empty translation file";
3994
3994
  return te.add(t), { success: !1, translations: {}, error: d };
@@ -4024,11 +4024,11 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
4024
4024
  fromCache: !1
4025
4025
  };
4026
4026
  } catch (n) {
4027
- const a = `Failed to load user translations: ${n instanceof Error ? n.message : "Unknown error"}`;
4027
+ const o = `Failed to load user translations: ${n instanceof Error ? n.message : "Unknown error"}`;
4028
4028
  return te.add(t), {
4029
4029
  success: !1,
4030
4030
  translations: {},
4031
- error: a
4031
+ error: o
4032
4032
  };
4033
4033
  }
4034
4034
  };
@@ -4042,15 +4042,15 @@ function Zr() {
4042
4042
  }
4043
4043
  function xn(e, r) {
4044
4044
  return r.length === 0 ? e : e.replace(/\{\{(\d+)\}\}/g, (t, n) => {
4045
- const a = parseInt(n, 10) - 1, o = r[a];
4046
- return o == null ? t : String(o);
4045
+ const o = parseInt(n, 10) - 1, a = r[o];
4046
+ return a == null ? t : String(a);
4047
4047
  });
4048
4048
  }
4049
- const wn = (e, r, t) => (n, ...a) => {
4050
- let o = n, c = !1;
4051
- return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (o = n, c = !0) : n in t ? (o = t[n], c = !0) : n in r ? (o = r[n], c = !0) : o = n, o = xn(o, a), !c && Zr() && console.debug(
4049
+ const wn = (e, r, t) => (n, ...o) => {
4050
+ let a = n, c = !1;
4051
+ return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (a = n, c = !0) : n in t ? (a = t[n], c = !0) : n in r ? (a = r[n], c = !0) : a = n, a = xn(a, o), !c && Zr() && console.debug(
4052
4052
  `Missing translation for "${n}" in language "${e}"`
4053
- ), o);
4053
+ ), a);
4054
4054
  };
4055
4055
  function Sn(e) {
4056
4056
  return /^[-+]?\d*$/.test(e);
@@ -4065,26 +4065,26 @@ const Nn = ",", kn = (e) => !e || e.trim() === "" ? [] : e.split(Nn).map((r) =>
4065
4065
  return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
4066
4066
  if (!Sn(n))
4067
4067
  return t("Must be a valid integer");
4068
- const a = parseInt(n, 10);
4069
- if (Number.isNaN(a)) return t("Must be a valid integer");
4070
- if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
4068
+ const o = parseInt(n, 10);
4069
+ if (Number.isNaN(o)) return t("Must be a valid integer");
4070
+ if (e.min !== void 0 && (e.minInclusive ? o < e.min : o <= e.min))
4071
4071
  return t(
4072
4072
  "Must be {{1}} {{2}}",
4073
4073
  e.minInclusive ? "≥" : ">",
4074
4074
  e.min
4075
4075
  );
4076
- if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
4076
+ if (e.max !== void 0 && (e.maxInclusive ? o > e.max : o >= e.max))
4077
4077
  return t(
4078
4078
  "Must be {{1}} {{2}}",
4079
4079
  e.maxInclusive ? "≤" : "<",
4080
4080
  e.max
4081
4081
  );
4082
4082
  if (e.step !== void 0) {
4083
- const o = Number(e.step);
4084
- if (!Number.isInteger(o))
4083
+ const a = Number(e.step);
4084
+ if (!Number.isInteger(a))
4085
4085
  return t("Invalid step value");
4086
- if (a % o !== 0)
4087
- return t("Must be a multiple of {{1}}", o);
4086
+ if (o % a !== 0)
4087
+ return t("Must be a multiple of {{1}}", a);
4088
4088
  }
4089
4089
  };
4090
4090
  function In(e, r, t) {
@@ -4093,19 +4093,19 @@ function In(e, r, t) {
4093
4093
  return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
4094
4094
  if (!Cn(n))
4095
4095
  return t("Each value must be a valid integer");
4096
- const a = kn(n);
4097
- if (e.minCount !== void 0 && a.length < e.minCount)
4096
+ const o = kn(n);
4097
+ if (e.minCount !== void 0 && o.length < e.minCount)
4098
4098
  return t("Minimum number of values: {{1}}", `${e.minCount}`);
4099
- if (e.maxCount !== void 0 && a.length > e.maxCount)
4099
+ if (e.maxCount !== void 0 && o.length > e.maxCount)
4100
4100
  return t("Maximum number of values: {{1}}", `${e.maxCount}`);
4101
- for (const o of a) {
4102
- if (e.min !== void 0 && (e.minInclusive ? o < e.min : o <= e.min))
4101
+ for (const a of o) {
4102
+ if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
4103
4103
  return t(
4104
4104
  "Each value must be {{1}} {{2}}",
4105
4105
  e.minInclusive ? "≥" : ">",
4106
4106
  e.min
4107
4107
  );
4108
- if (e.max !== void 0 && (e.maxInclusive ? o > e.max : o >= e.max))
4108
+ if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
4109
4109
  return t(
4110
4110
  "Each value must be {{1}} {{2}}",
4111
4111
  e.maxInclusive ? "≤" : "<",
@@ -4117,23 +4117,23 @@ function Qr(e, r, t) {
4117
4117
  const n = String(r);
4118
4118
  if (n.trim() === "")
4119
4119
  return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
4120
- const a = Number(n);
4121
- if (Number.isNaN(a)) return t("Must be a valid float");
4120
+ const o = Number(n);
4121
+ if (Number.isNaN(o)) return t("Must be a valid float");
4122
4122
  if (e.min !== void 0) {
4123
- const o = e.type === "slider" ? !0 : e.minInclusive ?? !0;
4124
- if (o ? a < e.min : a <= e.min)
4123
+ const a = e.type === "slider" ? !0 : e.minInclusive ?? !0;
4124
+ if (a ? o < e.min : o <= e.min)
4125
4125
  return t(
4126
4126
  "Must be {{1}} {{2}}",
4127
- o ? "≥" : ">",
4127
+ a ? "≥" : ">",
4128
4128
  e.min
4129
4129
  );
4130
4130
  }
4131
4131
  if (e.max !== void 0) {
4132
- const o = e.type === "slider" ? !0 : e.maxInclusive ?? !0;
4133
- if (o ? a > e.max : a >= e.max)
4132
+ const a = e.type === "slider" ? !0 : e.maxInclusive ?? !0;
4133
+ if (a ? o > e.max : o >= e.max)
4134
4134
  return t(
4135
4135
  "Must be {{1}} {{2}}",
4136
- o ? "≤" : "<",
4136
+ a ? "≤" : "<",
4137
4137
  e.max
4138
4138
  );
4139
4139
  }
@@ -4149,19 +4149,19 @@ function Vn(e, r, t) {
4149
4149
  return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
4150
4150
  if (!Mn(n))
4151
4151
  return t("Each value must be a valid float");
4152
- const a = $n(n);
4153
- if (e.minCount !== void 0 && a.length < e.minCount)
4152
+ const o = $n(n);
4153
+ if (e.minCount !== void 0 && o.length < e.minCount)
4154
4154
  return t("Minimum number of values: {{1}}", e.minCount);
4155
- if (e.maxCount !== void 0 && a.length > e.maxCount)
4155
+ if (e.maxCount !== void 0 && o.length > e.maxCount)
4156
4156
  return t("Maximum number of values: {{1}}", e.maxCount);
4157
- for (const o of a) {
4158
- if (e.min !== void 0 && (e.minInclusive ? o < e.min : o <= e.min))
4157
+ for (const a of o) {
4158
+ if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
4159
4159
  return t(
4160
4160
  "Each value must be {{1}} {{2}}",
4161
4161
  e.minInclusive ? "≥" : ">",
4162
4162
  e.min
4163
4163
  );
4164
- if (e.max !== void 0 && (e.maxInclusive ? o > e.max : o >= e.max))
4164
+ if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
4165
4165
  return t(
4166
4166
  "Each value must be {{1}} {{2}}",
4167
4167
  e.maxInclusive ? "≤" : "<",
@@ -4170,10 +4170,10 @@ function Vn(e, r, t) {
4170
4170
  }
4171
4171
  }
4172
4172
  const ye = /* @__PURE__ */ new WeakMap();
4173
- function Oe(e, r, t, n, ...a) {
4173
+ function Oe(e, r, t, n, ...o) {
4174
4174
  if (e.pattern == null)
4175
4175
  return;
4176
- const o = String(r);
4176
+ const a = String(r);
4177
4177
  let c = null;
4178
4178
  if (e.pattern) {
4179
4179
  const s = ye.get(e);
@@ -4187,15 +4187,15 @@ function Oe(e, r, t, n, ...a) {
4187
4187
  ye.set(e, { pattern: e.pattern, regex: null }), c = null;
4188
4188
  }
4189
4189
  }
4190
- if (c && !c.test(o))
4191
- return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...a) : t("Input does not match pattern: {{1}}", e.pattern);
4190
+ if (c && !c.test(a))
4191
+ return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...o) : t("Input does not match pattern: {{1}}", e.pattern);
4192
4192
  }
4193
4193
  function ue(e, r, t) {
4194
4194
  const n = String(r);
4195
4195
  if (n === "")
4196
4196
  return e.minLength !== void 0 || e.maxLength !== void 0 ? e.required ? t("Value required when minLength or maxLength is set") : void 0 : e.required ? t("Value required") : void 0;
4197
- const a = Math.max(e.minLength ?? 0, 0);
4198
- return n.length < a ? t("Must be at least {{1}} characters", a) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Oe(e, r, t, "Invalid text format");
4197
+ const o = Math.max(e.minLength ?? 0, 0);
4198
+ return n.length < o ? t("Must be at least {{1}} characters", o) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Oe(e, r, t, "Invalid text format");
4199
4199
  }
4200
4200
  const Se = (e) => {
4201
4201
  if (!e) return null;
@@ -4211,20 +4211,20 @@ const Se = (e) => {
4211
4211
  function Rn(e, r, t) {
4212
4212
  if (r == null || String(r).trim() === "")
4213
4213
  return e.required ? t("Value required") : void 0;
4214
- const n = String(r).trim(), a = Se(n);
4215
- if (a === null)
4214
+ const n = String(r).trim(), o = Se(n);
4215
+ if (o === null)
4216
4216
  return t("Invalid date format");
4217
- const { minTime: o, maxTime: c } = An(e);
4218
- if (o !== null && a < o)
4217
+ const { minTime: a, maxTime: c } = An(e);
4218
+ if (a !== null && o < a)
4219
4219
  return t("Date must be on or after {{1}}", e.minDate);
4220
- if (c !== null && a > c)
4220
+ if (c !== null && o > c)
4221
4221
  return t("Date must be on or before {{1}}", e.maxDate);
4222
4222
  }
4223
4223
  function Dn(e, r, t) {
4224
4224
  const n = String(r);
4225
4225
  if (!n || n.trim() === "")
4226
4226
  return e.required || e.min || e.max ? t("Value required") : void 0;
4227
- const a = (c) => {
4227
+ const o = (c) => {
4228
4228
  const s = c.split(":").map((m) => parseInt(m, 10));
4229
4229
  if (s.some((m) => Number.isNaN(m))) return NaN;
4230
4230
  const i = s.length;
@@ -4241,16 +4241,16 @@ function Dn(e, r, t) {
4241
4241
  else
4242
4242
  return NaN;
4243
4243
  return d;
4244
- }, o = a(n);
4245
- if (Number.isNaN(o)) return t("Invalid time format");
4244
+ }, a = o(n);
4245
+ if (Number.isNaN(a)) return t("Invalid time format");
4246
4246
  if (e.min && typeof e.min == "string") {
4247
- const c = a(e.min);
4248
- if (!Number.isNaN(c) && o < c)
4247
+ const c = o(e.min);
4248
+ if (!Number.isNaN(c) && a < c)
4249
4249
  return t("Time must be on or after {{1}}", e.min);
4250
4250
  }
4251
4251
  if (e.max && typeof e.max == "string") {
4252
- const c = a(e.max);
4253
- if (!Number.isNaN(c) && o > c)
4252
+ const c = o(e.max);
4253
+ if (!Number.isNaN(c) && a > c)
4254
4254
  return t("Time must be on or before {{1}}", e.max);
4255
4255
  }
4256
4256
  }
@@ -4291,8 +4291,8 @@ function jn(e, r, t) {
4291
4291
  }
4292
4292
  }
4293
4293
  function Bn(e, r, t) {
4294
- const n = Array.isArray(r) ? r : [], a = n[0], o = n[1] ? String(n[1]).trim() : "";
4295
- return String(a ?? "").trim() === "" || o === "" ? e.required ? t("Value required") : void 0 : Qr(e, a, t);
4294
+ const n = Array.isArray(r) ? r : [], o = n[0], a = n[1] ? String(n[1]).trim() : "";
4295
+ return String(o ?? "").trim() === "" || a === "" ? e.required ? t("Value required") : void 0 : Qr(e, o, t);
4296
4296
  }
4297
4297
  function Hn(e, r, t) {
4298
4298
  if (Array.isArray(r))
@@ -4306,17 +4306,17 @@ function qn(e, r, t) {
4306
4306
  const n = String(r);
4307
4307
  if (n === "" || n === null || n === void 0)
4308
4308
  return e.required ? t("Value required") : void 0;
4309
- if (!e.options?.some((a) => String(a.value) === n))
4309
+ if (!e.options?.some((o) => String(o.value) === n))
4310
4310
  return t("Invalid option selected");
4311
4311
  }
4312
4312
  function Un(e, r, t) {
4313
- const a = String(r ?? "").trim();
4314
- if (a === "")
4313
+ const o = String(r ?? "").trim();
4314
+ if (o === "")
4315
4315
  return e.required ? t("Value required") : void 0;
4316
- const o = a.split(",").map((c) => c.trim()).filter((c) => c !== "");
4317
- if (o.length === 0)
4316
+ const a = o.split(",").map((c) => c.trim()).filter((c) => c !== "");
4317
+ if (a.length === 0)
4318
4318
  return e.required ? t("Value required") : void 0;
4319
- for (const c of o)
4319
+ for (const c of a)
4320
4320
  if (!e.options?.some((s) => String(s.value) === c))
4321
4321
  return t("Invalid option selected");
4322
4322
  }
@@ -4332,22 +4332,22 @@ function Gn(e, r, t) {
4332
4332
  const n = String(r ?? "").trim();
4333
4333
  if (n === "")
4334
4334
  return e.required ? t("Value required") : void 0;
4335
- let a = r;
4336
- if (typeof r != "number" && (a = parseFloat(n)), Number.isNaN(a) || a <= 0)
4335
+ let o = r;
4336
+ if (typeof r != "number" && (o = parseFloat(n)), Number.isNaN(o) || o <= 0)
4337
4337
  return t("Invalid value");
4338
- if (e.max !== void 0 && a > e.max)
4338
+ if (e.max !== void 0 && o > e.max)
4339
4339
  return t("Must be ≤ {{1}}", e.max);
4340
4340
  }
4341
4341
  function Jn(e, r, t) {
4342
4342
  const n = String(r);
4343
4343
  if (n.trim() === "")
4344
4344
  return e.required ? t("Value required") : void 0;
4345
- const a = Number(n);
4346
- if (Number.isNaN(a)) return t("Must be a valid float");
4347
- const o = e.min ?? 0, c = e.max ?? 100;
4348
- if (a < o)
4349
- return t("Must be ≥ {{1}}", o);
4350
- if (a > c)
4345
+ const o = Number(n);
4346
+ if (Number.isNaN(o)) return t("Must be a valid float");
4347
+ const a = e.min ?? 0, c = e.max ?? 100;
4348
+ if (o < a)
4349
+ return t("Must be ≥ {{1}}", a);
4350
+ if (o > c)
4351
4351
  return t("Must be ≤ {{1}}", c);
4352
4352
  }
4353
4353
  let Qe = !1;
@@ -4462,13 +4462,13 @@ const Yn = (e) => ({
4462
4462
  definitionName: r = "",
4463
4463
  defaultStyle: t,
4464
4464
  defaultLanguage: n = "en",
4465
- defaultTheme: a = "light",
4466
- defaultLocalizeName: o = "",
4467
- defaultFieldValidationMode: c = "realTime",
4465
+ defaultTheme: o = "light",
4466
+ defaultLocalizeName: a = "",
4467
+ defaultFieldValidationMode: c = "onEdit",
4468
4468
  className: s = "reactaform-container",
4469
4469
  defaultDisplayInstanceName: i = !0
4470
4470
  }) => {
4471
- const d = r, m = o, u = a, f = n, b = l.useMemo(
4471
+ const d = r, m = a, u = o, f = n, b = l.useMemo(
4472
4472
  () => t ?? {},
4473
4473
  [t]
4474
4474
  ), [C, N] = l.useState({}), [h, y] = l.useState({});
@@ -4557,7 +4557,7 @@ function Qn(e) {
4557
4557
  }
4558
4558
  return null;
4559
4559
  }
4560
- async function ba(e, r = {}) {
4560
+ async function yo(e, r = {}) {
4561
4561
  const { validateSchema: t = !0 } = r;
4562
4562
  try {
4563
4563
  if (!e || typeof e != "string")
@@ -4565,26 +4565,26 @@ async function ba(e, r = {}) {
4565
4565
  const n = e.trim();
4566
4566
  if (!n)
4567
4567
  return { success: !1, error: "jsonData is empty" };
4568
- let a;
4568
+ let o;
4569
4569
  try {
4570
- a = JSON.parse(n);
4571
- } catch (o) {
4570
+ o = JSON.parse(n);
4571
+ } catch (a) {
4572
4572
  return {
4573
4573
  success: !1,
4574
- error: `Invalid JSON format: ${o instanceof Error ? o.message : "Unknown parsing error"}`
4574
+ error: `Invalid JSON format: ${a instanceof Error ? a.message : "Unknown parsing error"}`
4575
4575
  };
4576
4576
  }
4577
4577
  if (t) {
4578
- const o = Qn(a);
4579
- if (o)
4580
- return { success: !1, error: `Schema validation failed: ${o}` };
4578
+ const a = Qn(o);
4579
+ if (a)
4580
+ return { success: !1, error: `Schema validation failed: ${a}` };
4581
4581
  }
4582
- return { success: !0, definition: a };
4582
+ return { success: !0, definition: o };
4583
4583
  } catch (n) {
4584
4584
  return { success: !1, error: `Unexpected error loading definition: ${n instanceof Error ? n.message : "Unknown error"}` };
4585
4585
  }
4586
4586
  }
4587
- function ea(e, r) {
4587
+ function eo(e, r) {
4588
4588
  try {
4589
4589
  if (!e)
4590
4590
  return { success: !1, error: "Definition is required" };
@@ -4596,13 +4596,13 @@ function ea(e, r) {
4596
4596
  version: e.version ?? "1.0.0",
4597
4597
  values: {}
4598
4598
  }, n = e.properties || [];
4599
- return Array.isArray(n) && n.forEach((a) => {
4600
- const o = a;
4601
- if (o.type === "unit") {
4602
- const c = o.defaultUnit, s = Number(o.defaultValue) || void 0;
4603
- t.values[o.name] = [s || 0, c || "m"];
4599
+ return Array.isArray(n) && n.forEach((o) => {
4600
+ const a = o;
4601
+ if (a.type === "unit") {
4602
+ const c = a.defaultUnit, s = Number(a.defaultValue) || void 0;
4603
+ t.values[a.name] = [s || 0, c || "m"];
4604
4604
  } else
4605
- o.defaultValue !== void 0 && (t.values[o.name] = o.defaultValue);
4605
+ a.defaultValue !== void 0 && (t.values[a.name] = a.defaultValue);
4606
4606
  }), { success: !0, instance: t };
4607
4607
  } catch (t) {
4608
4608
  return {
@@ -4611,7 +4611,7 @@ function ea(e, r) {
4611
4611
  };
4612
4612
  }
4613
4613
  }
4614
- function ya(e) {
4614
+ function vo(e) {
4615
4615
  try {
4616
4616
  if (!e)
4617
4617
  return { success: !1, error: "Instance data is required" };
@@ -4635,7 +4635,7 @@ function ya(e) {
4635
4635
  };
4636
4636
  }
4637
4637
  }
4638
- function va(e, r, t) {
4638
+ function xo(e, r, t) {
4639
4639
  try {
4640
4640
  if (!e)
4641
4641
  return { success: !1, error: "Instance is required" };
@@ -4648,9 +4648,9 @@ function va(e, r, t) {
4648
4648
  definition: r.name,
4649
4649
  version: r.version,
4650
4650
  values: {}
4651
- }, a = n.values, o = {};
4651
+ }, o = n.values, a = {};
4652
4652
  (r.properties || []).forEach((i) => {
4653
- o[i.name] = i;
4653
+ a[i.name] = i;
4654
4654
  });
4655
4655
  const c = (i, d, m) => {
4656
4656
  if (i == null) return i;
@@ -4695,14 +4695,14 @@ function va(e, r, t) {
4695
4695
  return i;
4696
4696
  }, s = e.values || {};
4697
4697
  Object.keys(s).forEach((i) => {
4698
- const d = s[i], m = o[i];
4698
+ const d = s[i], m = a[i];
4699
4699
  if (!m)
4700
4700
  return;
4701
4701
  const u = Array.isArray(d) ? "array" : d === null ? "null" : typeof d, f = (m.type || "").toLowerCase();
4702
- u === f || f === "string" && typeof d == "string" ? a[i] = d : a[i] = c(d, f, m);
4702
+ u === f || f === "string" && typeof d == "string" ? o[i] = d : o[i] = c(d, f, m);
4703
4703
  }), (r.properties || []).forEach((i) => {
4704
4704
  const d = i.name;
4705
- d in a || (a[d] = i.defaultValue);
4705
+ d in o || (o[d] = i.defaultValue);
4706
4706
  });
4707
4707
  try {
4708
4708
  typeof t == "function" && t?.(e, n, r);
@@ -4717,30 +4717,30 @@ function va(e, r, t) {
4717
4717
  };
4718
4718
  }
4719
4719
  }
4720
- function ra(e) {
4720
+ function ro(e) {
4721
4721
  const [r, t] = l.useState(null);
4722
4722
  return l.useEffect(() => {
4723
4723
  const n = document.querySelector("[data-reactaform-theme]");
4724
4724
  if (!n) return;
4725
- const a = n.closest("[data-reactaform-theme]");
4726
- if (!a) return;
4727
- const o = () => t(a.getAttribute("data-reactaform-theme"));
4728
- o();
4725
+ const o = n.closest("[data-reactaform-theme]");
4726
+ if (!o) return;
4727
+ const a = () => t(o.getAttribute("data-reactaform-theme"));
4728
+ a();
4729
4729
  const c = new MutationObserver((s) => {
4730
4730
  for (const i of s)
4731
- i.type === "attributes" && i.attributeName === "data-reactaform-theme" && o();
4731
+ i.type === "attributes" && i.attributeName === "data-reactaform-theme" && a();
4732
4732
  });
4733
- return c.observe(a, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => c.disconnect();
4733
+ return c.observe(o, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => c.disconnect();
4734
4734
  }, [e]), r;
4735
4735
  }
4736
- const xa = ({
4736
+ const wo = ({
4737
4737
  definitionData: e,
4738
4738
  instance: r,
4739
4739
  language: t,
4740
4740
  className: n,
4741
- theme: a,
4742
- style: o,
4743
- fieldValidationMode: c = "realTime",
4741
+ theme: o,
4742
+ style: a,
4743
+ fieldValidationMode: c = "onEdit",
4744
4744
  displayInstanceName: s = !0,
4745
4745
  onSubmit: i = void 0,
4746
4746
  onValidation: d = void 0
@@ -4751,7 +4751,7 @@ const xa = ({
4751
4751
  } catch {
4752
4752
  return null;
4753
4753
  }
4754
- }, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...o }, f = ra(), b = a ?? f ?? "light", C = t ?? "en";
4754
+ }, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...a }, f = ro(), b = o ?? f ?? "light", C = t ?? "en";
4755
4755
  l.useEffect(() => {
4756
4756
  let h = document.getElementById("popup-root");
4757
4757
  h || (h = document.createElement("div"), h.id = "popup-root", document.body.appendChild(h));
@@ -4759,7 +4759,7 @@ const xa = ({
4759
4759
  const N = l.useMemo(() => {
4760
4760
  if (r) return r;
4761
4761
  if (!m) return null;
4762
- const h = ea(m, m.name);
4762
+ const h = eo(m, m.name);
4763
4763
  return !h.success || !h.instance ? null : h.instance;
4764
4764
  }, [r, m]);
4765
4765
  return m ? N ? /* @__PURE__ */ p(
@@ -4813,73 +4813,73 @@ function rt(e, r, t) {
4813
4813
  return !1;
4814
4814
  }
4815
4815
  }
4816
- function ta(e) {
4816
+ function to(e) {
4817
4817
  const r = [];
4818
4818
  if (e.components)
4819
4819
  for (const t of Object.keys(e.components)) {
4820
4820
  const n = _r(t);
4821
4821
  if (n) {
4822
- let a;
4823
- for (const [o, c] of Z)
4822
+ let o;
4823
+ for (const [a, c] of Z)
4824
4824
  if (c.components && c.components[t] === n) {
4825
- a = o;
4825
+ o = a;
4826
4826
  break;
4827
4827
  }
4828
- a && a !== e.name && r.push({
4828
+ o && o !== e.name && r.push({
4829
4829
  type: "component",
4830
4830
  name: t,
4831
- existingPlugin: a,
4831
+ existingPlugin: o,
4832
4832
  newPlugin: e.name
4833
4833
  });
4834
4834
  }
4835
4835
  }
4836
4836
  if (e.fieldCustomValidators)
4837
4837
  for (const [t, n] of Object.entries(e.fieldCustomValidators))
4838
- for (const a of Object.keys(n)) {
4839
- const c = W.fieldValidators.get(t)?.get(a);
4840
- ur(t, a) && c && c !== e.name && r.push({
4838
+ for (const o of Object.keys(n)) {
4839
+ const c = W.fieldValidators.get(t)?.get(o);
4840
+ ur(t, o) && c && c !== e.name && r.push({
4841
4841
  type: "fieldCustomValidator",
4842
- name: `${t}:${a}`,
4842
+ name: `${t}:${o}`,
4843
4843
  existingPlugin: c,
4844
4844
  newPlugin: e.name
4845
4845
  });
4846
4846
  }
4847
4847
  if (e.fieldTypeValidators)
4848
4848
  for (const t of Object.keys(e.fieldTypeValidators)) {
4849
- const n = dr(t), a = W.fieldTypeValidators.get(t);
4850
- n && a && a !== e.name && r.push({
4849
+ const n = dr(t), o = W.fieldTypeValidators.get(t);
4850
+ n && o && o !== e.name && r.push({
4851
4851
  type: "fieldTypeValidator",
4852
4852
  name: `type:${t}`,
4853
- existingPlugin: a,
4853
+ existingPlugin: o,
4854
4854
  newPlugin: e.name
4855
4855
  });
4856
4856
  }
4857
4857
  if (e.formValidators)
4858
4858
  for (const t of Object.keys(e.formValidators)) {
4859
- const n = mr(t), a = W.formValidators.get(t);
4860
- n && a && a !== e.name && r.push({
4859
+ const n = mr(t), o = W.formValidators.get(t);
4860
+ n && o && o !== e.name && r.push({
4861
4861
  type: "formValidator",
4862
4862
  name: t,
4863
- existingPlugin: a,
4863
+ existingPlugin: o,
4864
4864
  newPlugin: e.name
4865
4865
  });
4866
4866
  }
4867
4867
  if (e.submissionHandlers)
4868
4868
  for (const t of Object.keys(e.submissionHandlers)) {
4869
- const n = fn(t), a = W.submissionHandlers.get(t);
4870
- n && a && a !== e.name && r.push({
4869
+ const n = fn(t), o = W.submissionHandlers.get(t);
4870
+ n && o && o !== e.name && r.push({
4871
4871
  type: "submissionHandler",
4872
4872
  name: t,
4873
- existingPlugin: a,
4873
+ existingPlugin: o,
4874
4874
  newPlugin: e.name
4875
4875
  });
4876
4876
  }
4877
4877
  return r;
4878
4878
  }
4879
- function oe(e, r, t, n, a, o, c, s) {
4879
+ function ae(e, r, t, n, o, a, c, s) {
4880
4880
  for (const i of Object.keys(e)) {
4881
4881
  let d;
4882
- if (s ? d = a.find((m) => m.type === "fieldCustomValidator" && m.name === `${s}:${i}`) : e === n.components ? d = a.find((m) => m.type === "component" && m.name === i) : e === n.formValidators ? d = a.find((m) => m.type === "formValidator" && m.name === i) : e === n.fieldTypeValidators ? d = a.find((m) => m.type === "fieldTypeValidator" && m.name === `type:${i}`) : e === n.submissionHandlers && (d = a.find((m) => m.type === "submissionHandler" && m.name === i)), rt(d || null, o, c))
4882
+ if (s ? d = o.find((m) => m.type === "fieldCustomValidator" && m.name === `${s}:${i}`) : e === n.components ? d = o.find((m) => m.type === "component" && m.name === i) : e === n.formValidators ? d = o.find((m) => m.type === "formValidator" && m.name === i) : e === n.fieldTypeValidators ? d = o.find((m) => m.type === "fieldTypeValidator" && m.name === `type:${i}`) : e === n.submissionHandlers && (d = o.find((m) => m.type === "submissionHandler" && m.name === i)), rt(d || null, a, c))
4883
4883
  if (s) {
4884
4884
  const m = r.get(s) || /* @__PURE__ */ new Map();
4885
4885
  m.set(i, n.name), r.set(s, m), t(i, e[i]);
@@ -4890,19 +4890,19 @@ function oe(e, r, t, n, a, o, c, s) {
4890
4890
  ) : r.set(i, n.name), t(i, e[i]);
4891
4891
  }
4892
4892
  }
4893
- function wa(e, r) {
4893
+ function So(e, r) {
4894
4894
  const t = r?.conflictResolution || "error";
4895
4895
  if (Z.has(e.name)) {
4896
- const a = {
4896
+ const o = {
4897
4897
  type: "plugin",
4898
4898
  name: e.name,
4899
4899
  existingPlugin: e.name,
4900
4900
  newPlugin: e.name
4901
4901
  };
4902
- if (!rt(a, t, r?.onConflict)) return;
4902
+ if (!rt(o, t, r?.onConflict)) return;
4903
4903
  }
4904
- const n = ta(e);
4905
- if (e.components && oe(
4904
+ const n = to(e);
4905
+ if (e.components && ae(
4906
4906
  e.components,
4907
4907
  W.components,
4908
4908
  Wr,
@@ -4911,18 +4911,18 @@ function wa(e, r) {
4911
4911
  t,
4912
4912
  r?.onConflict
4913
4913
  ), e.fieldCustomValidators)
4914
- for (const [a, o] of Object.entries(e.fieldCustomValidators))
4915
- oe(
4916
- o,
4914
+ for (const [o, a] of Object.entries(e.fieldCustomValidators))
4915
+ ae(
4916
+ a,
4917
4917
  W.fieldValidators,
4918
- (c, s) => gt(a, c, s),
4918
+ (c, s) => gt(o, c, s),
4919
4919
  e,
4920
4920
  n,
4921
4921
  t,
4922
4922
  r?.onConflict,
4923
- a
4923
+ o
4924
4924
  );
4925
- e.formValidators && oe(
4925
+ e.formValidators && ae(
4926
4926
  e.formValidators,
4927
4927
  W.formValidators,
4928
4928
  pt,
@@ -4930,7 +4930,7 @@ function wa(e, r) {
4930
4930
  n,
4931
4931
  t,
4932
4932
  r?.onConflict
4933
- ), e.fieldTypeValidators && oe(
4933
+ ), e.fieldTypeValidators && ae(
4934
4934
  e.fieldTypeValidators,
4935
4935
  W.fieldTypeValidators,
4936
4936
  ht,
@@ -4938,7 +4938,7 @@ function wa(e, r) {
4938
4938
  n,
4939
4939
  t,
4940
4940
  r?.onConflict
4941
- ), e.submissionHandlers && oe(
4941
+ ), e.submissionHandlers && ae(
4942
4942
  e.submissionHandlers,
4943
4943
  W.submissionHandlers,
4944
4944
  Jr,
@@ -4948,7 +4948,7 @@ function wa(e, r) {
4948
4948
  r?.onConflict
4949
4949
  ), e.setup && e.setup(), Z.set(e.name, e);
4950
4950
  }
4951
- function Sa(e, r = !1) {
4951
+ function Co(e, r = !1) {
4952
4952
  const t = Z.get(e);
4953
4953
  if (!t) return !1;
4954
4954
  if (t.cleanup && t.cleanup(), r) {
@@ -4956,12 +4956,12 @@ function Sa(e, r = !1) {
4956
4956
  for (const n of Object.keys(t.components))
4957
4957
  W.components.delete(n);
4958
4958
  if (t.fieldCustomValidators)
4959
- for (const [n, a] of Object.entries(t.fieldCustomValidators)) {
4960
- const o = W.fieldValidators.get(n);
4961
- if (o) {
4962
- for (const c of Object.keys(a))
4963
- o.delete(c);
4964
- o.size === 0 && W.fieldValidators.delete(n);
4959
+ for (const [n, o] of Object.entries(t.fieldCustomValidators)) {
4960
+ const a = W.fieldValidators.get(n);
4961
+ if (a) {
4962
+ for (const c of Object.keys(o))
4963
+ a.delete(c);
4964
+ a.size === 0 && W.fieldValidators.delete(n);
4965
4965
  }
4966
4966
  }
4967
4967
  if (t.formValidators)
@@ -4976,16 +4976,16 @@ function Sa(e, r = !1) {
4976
4976
  }
4977
4977
  return Z.delete(e), !0;
4978
4978
  }
4979
- function Ca(e) {
4979
+ function No(e) {
4980
4980
  return Z.get(e);
4981
4981
  }
4982
- function Na() {
4982
+ function ko() {
4983
4983
  return Array.from(Z.values());
4984
4984
  }
4985
- function ka(e) {
4985
+ function Io(e) {
4986
4986
  return Z.has(e);
4987
4987
  }
4988
- function Ia(e) {
4988
+ function Eo(e) {
4989
4989
  for (const [r, t] of Object.entries(e))
4990
4990
  Wr(r, t);
4991
4991
  }
@@ -5010,12 +5010,12 @@ function Ce(e) {
5010
5010
  return !!r && typeof r.name == "string" && typeof r.size == "number";
5011
5011
  }
5012
5012
  }
5013
- function Ea(e, r, t = {}) {
5013
+ function Mo(e, r, t = {}) {
5014
5014
  try {
5015
5015
  const {
5016
5016
  includeMetadata: n = !1,
5017
- dateFormat: a = "iso",
5018
- fileHandling: o = "metadata",
5017
+ dateFormat: o = "iso",
5018
+ fileHandling: a = "metadata",
5019
5019
  prettify: c = !1,
5020
5020
  excludeFields: s = [],
5021
5021
  includeOnlyFields: i = []
@@ -5038,7 +5038,7 @@ function Ea(e, r, t = {}) {
5038
5038
  if (y === void 0) continue;
5039
5039
  const E = C.get(h);
5040
5040
  try {
5041
- u[h] = na(y, E, { dateFormat: a, fileHandling: o });
5041
+ u[h] = no(y, E, { dateFormat: o, fileHandling: a });
5042
5042
  } catch (F) {
5043
5043
  d.push(`Error serializing field '${h}': ${String(F)}`), u[h] = null;
5044
5044
  }
@@ -5064,8 +5064,8 @@ function Ea(e, r, t = {}) {
5064
5064
  };
5065
5065
  }
5066
5066
  }
5067
- function na(e, r, t = {}) {
5068
- const { dateFormat: n = "iso", fileHandling: a = "metadata" } = t;
5067
+ function no(e, r, t = {}) {
5068
+ const { dateFormat: n = "iso", fileHandling: o = "metadata" } = t;
5069
5069
  if (e == null)
5070
5070
  return null;
5071
5071
  if (r)
@@ -5075,7 +5075,7 @@ function na(e, r, t = {}) {
5075
5075
  case "date-time":
5076
5076
  return er(e, n);
5077
5077
  case "file":
5078
- return rr(e, a);
5078
+ return rr(e, o);
5079
5079
  case "int":
5080
5080
  case "integer":
5081
5081
  return typeof e == "string" ? parseInt(e, 10) : e;
@@ -5086,11 +5086,11 @@ function na(e, r, t = {}) {
5086
5086
  return typeof e == "string" ? e === "true" : !!e;
5087
5087
  case "int-array":
5088
5088
  case "float-array":
5089
- return Array.isArray(e) ? e.map((o) => typeof o == "string" ? Number(o) : o) : e;
5089
+ return Array.isArray(e) ? e.map((a) => typeof a == "string" ? Number(a) : a) : e;
5090
5090
  default:
5091
5091
  return e;
5092
5092
  }
5093
- return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e, a) : e;
5093
+ return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e, o) : e;
5094
5094
  }
5095
5095
  function er(e, r) {
5096
5096
  let t = null;
@@ -5134,12 +5134,12 @@ function tr(e, r) {
5134
5134
  _note: "Base64 encoding requires async implementation"
5135
5135
  };
5136
5136
  }
5137
- function Ma(e, r, t = {}) {
5137
+ function Fo(e, r, t = {}) {
5138
5138
  try {
5139
5139
  const {
5140
5140
  strict: n = !1,
5141
- validateTypes: a = !0,
5142
- preserveUnknownFields: o = !0,
5141
+ validateTypes: o = !0,
5142
+ preserveUnknownFields: a = !0,
5143
5143
  dateFormat: c = "auto"
5144
5144
  } = t;
5145
5145
  if (!e || typeof e != "string")
@@ -5169,13 +5169,13 @@ function Ma(e, r, t = {}) {
5169
5169
  continue;
5170
5170
  }
5171
5171
  try {
5172
- m[h] = aa(y, N, { validateTypes: a, dateFormat: c });
5172
+ m[h] = oo(y, N, { validateTypes: o, dateFormat: c });
5173
5173
  } catch (E) {
5174
5174
  const F = `Error deserializing field '${h}': ${String(E)}`;
5175
5175
  n ? d.push(F) : (i.push(F), m[h] = y);
5176
5176
  }
5177
5177
  }
5178
- if (o)
5178
+ if (a)
5179
5179
  for (const [N, h] of Object.entries(s))
5180
5180
  !b.has(N) && N !== "_metadata" && (n && i.push(`Unknown field '${N}' preserved`), m[N] = h);
5181
5181
  const C = d.length > 0;
@@ -5192,8 +5192,8 @@ function Ma(e, r, t = {}) {
5192
5192
  };
5193
5193
  }
5194
5194
  }
5195
- function aa(e, r, t = {}) {
5196
- const { validateTypes: n = !0, dateFormat: a = "auto" } = t;
5195
+ function oo(e, r, t = {}) {
5196
+ const { validateTypes: n = !0, dateFormat: o = "auto" } = t;
5197
5197
  if (e == null)
5198
5198
  return e;
5199
5199
  try {
@@ -5201,7 +5201,7 @@ function aa(e, r, t = {}) {
5201
5201
  case "date":
5202
5202
  case "datetime":
5203
5203
  case "date-time":
5204
- return oa(e, a, n);
5204
+ return ao(e, o, n);
5205
5205
  case "int":
5206
5206
  case "integer":
5207
5207
  return Ne(e, n);
@@ -5209,7 +5209,7 @@ function aa(e, r, t = {}) {
5209
5209
  case "number":
5210
5210
  return ke(e, n);
5211
5211
  case "boolean":
5212
- return ia(e, n);
5212
+ return io(e, n);
5213
5213
  case "int-array":
5214
5214
  return nr(e, "integer", n);
5215
5215
  case "float-array":
@@ -5223,13 +5223,13 @@ function aa(e, r, t = {}) {
5223
5223
  default:
5224
5224
  return e;
5225
5225
  }
5226
- } catch (o) {
5226
+ } catch (a) {
5227
5227
  if (n)
5228
- throw new Error(`Type conversion failed: ${String(o)}`);
5228
+ throw new Error(`Type conversion failed: ${String(a)}`);
5229
5229
  return e;
5230
5230
  }
5231
5231
  }
5232
- function Fa(e, r = {}) {
5232
+ function $o(e, r = {}) {
5233
5233
  try {
5234
5234
  const { prettify: t = !0, includeMetadata: n = !0 } = r;
5235
5235
  if (!e || typeof e != "object")
@@ -5237,16 +5237,16 @@ function Fa(e, r = {}) {
5237
5237
  success: !1,
5238
5238
  error: "Definition must be a valid object"
5239
5239
  };
5240
- const a = { ...e };
5241
- return n && (a._metadata = {
5240
+ const o = { ...e };
5241
+ return n && (o._metadata = {
5242
5242
  serializedAt: (/* @__PURE__ */ new Date()).toISOString(),
5243
- version: a.version || "1.0.0",
5244
- propertyCount: (Array.isArray(a.properties) ? a.properties.length : 0) || 0
5243
+ version: o.version || "1.0.0",
5244
+ propertyCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0
5245
5245
  }), {
5246
5246
  success: !0,
5247
- data: t ? JSON.stringify(a, null, 2) : JSON.stringify(a),
5247
+ data: t ? JSON.stringify(o, null, 2) : JSON.stringify(o),
5248
5248
  metadata: {
5249
- fieldCount: (Array.isArray(a.properties) ? a.properties.length : 0) || 0,
5249
+ fieldCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0,
5250
5250
  excludedFields: [],
5251
5251
  warnings: []
5252
5252
  }
@@ -5258,13 +5258,13 @@ function Fa(e, r = {}) {
5258
5258
  };
5259
5259
  }
5260
5260
  }
5261
- function $a(e, r = {}) {
5261
+ function Vo(e, r = {}) {
5262
5262
  try {
5263
5263
  const { strict: t = !1, validateTypes: n = !0 } = r;
5264
- let a;
5264
+ let o;
5265
5265
  if (typeof e == "string")
5266
5266
  try {
5267
- a = JSON.parse(e);
5267
+ o = JSON.parse(e);
5268
5268
  } catch (m) {
5269
5269
  return {
5270
5270
  success: !1,
@@ -5272,43 +5272,43 @@ function $a(e, r = {}) {
5272
5272
  };
5273
5273
  }
5274
5274
  else if (e && typeof e == "object")
5275
- a = { ...e };
5275
+ o = { ...e };
5276
5276
  else
5277
5277
  return {
5278
5278
  success: !1,
5279
5279
  error: "Input must be a string or object"
5280
5280
  };
5281
- const o = [], c = [], s = ["name", "version", "displayName"];
5281
+ const a = [], c = [], s = ["name", "version", "displayName"];
5282
5282
  for (const m of s)
5283
- if (!(m in a) || !a[m])
5283
+ if (!(m in o) || !o[m])
5284
5284
  if (t)
5285
5285
  c.push(`Required field '${m}' is missing`);
5286
5286
  else
5287
- switch (o.push(`Missing field '${m}', using default`), m) {
5287
+ switch (a.push(`Missing field '${m}', using default`), m) {
5288
5288
  case "name":
5289
- a.name = "unnamed-definition";
5289
+ o.name = "unnamed-definition";
5290
5290
  break;
5291
5291
  case "version":
5292
- a.version = "1.0.0";
5292
+ o.version = "1.0.0";
5293
5293
  break;
5294
5294
  case "displayName":
5295
- a.displayName = a.name || "Unnamed Definition";
5295
+ o.displayName = o.name || "Unnamed Definition";
5296
5296
  break;
5297
5297
  }
5298
- const i = Array.isArray(a.properties) ? a.properties : null;
5299
- i ? a.properties = i.map((m, u) => {
5298
+ const i = Array.isArray(o.properties) ? o.properties : null;
5299
+ i ? o.properties = i.map((m, u) => {
5300
5300
  const f = ee(m) ? m : {}, b = { ...f };
5301
5301
  if (!f.name) {
5302
5302
  const C = `Property at index ${u} missing 'name'`;
5303
- t ? c.push(C) : (o.push(`${C}, using 'field_${u}'`), b.name = `field_${u}`);
5303
+ t ? c.push(C) : (a.push(`${C}, using 'field_${u}'`), b.name = `field_${u}`);
5304
5304
  }
5305
- return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (o.push(`Property '${f.name || u}' missing 'type', using 'string'`), b.type = "string")), f.defaultValue === void 0 && (b.defaultValue = null), f.required === void 0 && (b.required = !1), b;
5306
- }) : t ? c.push("Properties must be an array") : (o.push("Properties not found or invalid, using empty array"), a.properties = []);
5305
+ return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (a.push(`Property '${f.name || u}' missing 'type', using 'string'`), b.type = "string")), f.defaultValue === void 0 && (b.defaultValue = null), f.required === void 0 && (b.required = !1), b;
5306
+ }) : t ? c.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), o.properties = []);
5307
5307
  const d = c.length > 0;
5308
5308
  return {
5309
5309
  success: !d,
5310
- data: a,
5311
- warnings: o.length > 0 ? o : void 0,
5310
+ data: o,
5311
+ warnings: a.length > 0 ? a : void 0,
5312
5312
  validationErrors: d ? c : void 0
5313
5313
  };
5314
5314
  } catch (t) {
@@ -5318,7 +5318,7 @@ function $a(e, r = {}) {
5318
5318
  };
5319
5319
  }
5320
5320
  }
5321
- function oa(e, r, t) {
5321
+ function ao(e, r, t) {
5322
5322
  if (e instanceof Date)
5323
5323
  return e;
5324
5324
  if (typeof e == "number") {
@@ -5383,7 +5383,7 @@ function ke(e, r) {
5383
5383
  throw new Error(`Cannot convert ${typeof e} to number`);
5384
5384
  return e;
5385
5385
  }
5386
- function ia(e, r) {
5386
+ function io(e, r) {
5387
5387
  if (typeof e == "boolean")
5388
5388
  return e;
5389
5389
  if (typeof e == "string") {
@@ -5402,22 +5402,22 @@ function ia(e, r) {
5402
5402
  function nr(e, r, t) {
5403
5403
  if (!Array.isArray(e)) {
5404
5404
  if (typeof e == "string")
5405
- return e.split(",").map((a) => a.trim()).filter(Boolean).map((a) => r === "integer" ? Ne(a, t) : ke(a, t));
5405
+ return e.split(",").map((o) => o.trim()).filter(Boolean).map((o) => r === "integer" ? Ne(o, t) : ke(o, t));
5406
5406
  if (t)
5407
5407
  throw new Error(`Expected array, got ${typeof e}`);
5408
5408
  return e;
5409
5409
  }
5410
- return e.map((n, a) => {
5410
+ return e.map((n, o) => {
5411
5411
  try {
5412
5412
  return r === "integer" ? Ne(n, t) : ke(n, t);
5413
- } catch (o) {
5413
+ } catch (a) {
5414
5414
  if (t)
5415
- throw new Error(`Array element ${a}: ${o}`);
5415
+ throw new Error(`Array element ${o}: ${a}`);
5416
5416
  return n;
5417
5417
  }
5418
5418
  });
5419
5419
  }
5420
- function sa() {
5420
+ function so() {
5421
5421
  if (!document.getElementById("reactaform-styles"))
5422
5422
  try {
5423
5423
  const e = document.createElement("style");
@@ -5425,47 +5425,47 @@ function sa() {
5425
5425
  } catch {
5426
5426
  }
5427
5427
  }
5428
- typeof document < "u" && sa();
5428
+ typeof document < "u" && so();
5429
5429
  export {
5430
5430
  V as CSS_CLASSES,
5431
- xa as ReactaForm,
5431
+ wo as ReactaForm,
5432
5432
  Zn as ReactaFormProvider,
5433
5433
  hn as ReactaFormRenderer,
5434
5434
  O as StandardFieldLayout,
5435
- ma as Units,
5435
+ mo as Units,
5436
5436
  U as combineClasses,
5437
- ea as createInstanceFromDefinition,
5438
- $a as deserializeDefinition,
5439
- Ma as deserializeInstance,
5440
- Na as getAllPlugins,
5437
+ eo as createInstanceFromDefinition,
5438
+ Vo as deserializeDefinition,
5439
+ Fo as deserializeInstance,
5440
+ ko as getAllPlugins,
5441
5441
  rn as getButtonHandler,
5442
5442
  _r as getComponent,
5443
- Ca as getPlugin,
5444
- ha as getSupportedLanguages,
5445
- fa as hasButtonHandler,
5446
- ka as hasPlugin,
5447
- sa as injectReactaFormStyles,
5443
+ No as getPlugin,
5444
+ bo as getSupportedLanguages,
5445
+ po as hasButtonHandler,
5446
+ Io as hasPlugin,
5447
+ so as injectReactaFormStyles,
5448
5448
  ie as isDarkTheme,
5449
- ga as listButtonHandlers,
5450
- ya as loadInstance,
5451
- ba as loadJsonDefinition,
5452
- da as registerButtonHandler,
5449
+ ho as listButtonHandlers,
5450
+ vo as loadInstance,
5451
+ yo as loadJsonDefinition,
5452
+ fo as registerButtonHandler,
5453
5453
  Wr as registerComponent,
5454
- Ia as registerComponents,
5454
+ Eo as registerComponents,
5455
5455
  gt as registerFieldCustomValidationHandler,
5456
5456
  ht as registerFieldTypeValidationHandler,
5457
5457
  pt as registerFormValidationHandler,
5458
- wa as registerPlugin,
5458
+ So as registerPlugin,
5459
5459
  Jr as registerSubmissionHandler,
5460
- Fa as serializeDefinition,
5461
- Ea as serializeInstance,
5462
- pa as unregisterButtonHandler,
5463
- Sa as unregisterPlugin,
5464
- va as upgradeInstanceToLatestDefinition,
5460
+ $o as serializeDefinition,
5461
+ Mo as serializeInstance,
5462
+ go as unregisterButtonHandler,
5463
+ Co as unregisterPlugin,
5464
+ xo as upgradeInstanceToLatestDefinition,
5465
5465
  lt as useDebouncedCallback,
5466
5466
  T as useFieldValidator,
5467
5467
  B as useReactaFormContext,
5468
5468
  _ as useUncontrolledValidatedInput,
5469
- ua as validateFieldValue,
5469
+ uo as validateFieldValue,
5470
5470
  fr as validateFieldWithCustomHandler
5471
5471
  };