@golemui/core 1.6.0-rc.1 → 2.0.0-rc.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,93 @@
1
+ ## 2.0.0-rc.0 (2026-10-08)
2
+
3
+ ### 🚀 Features
4
+
5
+ - ⚠️ **gui-components:** Make @golemui/gui-components a standalone project ([#406](https://github.com/golemui/golemui/pull/406))
6
+
7
+ ### ⚠️ Breaking Changes
8
+
9
+ - **gui-components:** Make @golemui/gui-components a standalone project ([#406](https://github.com/golemui/golemui/pull/406))
10
+ Deprecate Flex layout
11
+ * fix(gui-components): add migration guide to v2.0
12
+ BREAKING CHANGE: GolemUI 2.0 makes @golemui/gui-components a standalone project.
13
+ - Styles: index.css no longer includes the form container, repeater and
14
+ invalid submit button styles. Import @golemui/gui-shared/forms.css after it.
15
+ - Styles: every rule is in a golemui.* cascade layer, so unlayered app CSS,
16
+ including global resets, now overrides component styles.
17
+ - Styles: component selectors are no longer nested under .gui-form, and
18
+ narrow layouts query the gui-container container instead of gui-form.
19
+ - Layouts: a grid without direction is now a stack instead of a row. Add
20
+ direction: 'row' to keep a row.
21
+ - Layouts: flex is deprecated and renders as a grid. Grid gaps are tokens
22
+ (none to xl) instead of pixels, justify places children along a row, and
23
+ autoFit, columnGap, rowGap and align are deprecated. The root layout is grid.
24
+ - Markup: tabs, accordions and alerts render gui-tabs, gui-accordion and
25
+ gui-alert. Their old classes (.gui-accordion__section,
26
+ .gui-alert-notification--*, .active) are gone, as are the .gui-flex and
27
+ .gui-grid__widget classes. Errors render as divs instead of a ul.
28
+ - Elements: every event is prefixed with gui- (input/change -> gui-input and
29
+ gui-change, blur -> gui-blur, inputError -> gui-input-error, and so on),
30
+ bubbles and is composed.
31
+ - Elements: multi-word attributes are kebab-case (autogrow -> auto-grow).
32
+ - Elements: gui-button's actionType is now type, and invalid is removed.
33
+ - Elements: touched is unset by default, so errors show as soon as they are set.
34
+ - Packages: @golemui/gui-components only peers on lit, and @golemui/gui-shared
35
+ now depends on it. @golemui/gui-components/internals no longer exports
36
+ createIntersectionObserver or NO_AVAILABLE_TIMES_MESSAGE.
37
+ * chore: update gitignore
38
+ * refactor(lit): move ssr to lit-utils
39
+ move ssr to lit-utils
40
+ * docs: update readme
41
+ * refactor(lit): move ssr to lit-utils, add ssr to components
42
+ * fix(gui-components): report missing upload service when dependencies are set
43
+ * fix(gui-components): avoid duplicated ids in all pickers
44
+ * fix(gui-components): set caret icon as a CSS property
45
+ * test: check ssr parity across frameworks with components
46
+ * ci: add workflow to test lit-labs/ssr against our implementation
47
+ * feat(gui-components): add timeLabel prop to date-time inputs
48
+ * chore: fix lint errors
49
+ * chore: improve ssr performance
50
+ * docs: move components ssr docs to website
51
+ * fix(gui-components): send value in numeric inputs
52
+ * feat(gui-components): add nitro plugin for nuxt users
53
+ * fix(gui-components): avoid ssr rendering for time lists
54
+ * chore: reset harnesses
55
+ * docs: update components readme
56
+ * fix(gui-components): misc issues related with required, aria and styling
57
+ * test(gui-components): fix tests
58
+ * test(gui-components): fix firefox test failing by 0.000001
59
+ * fix(gui-components): fix layout issues with pickers
60
+ * fix(schemas): make grid a the reserved root
61
+ * fix(schemas): make grid a the reserved root
62
+ * docs: fix astro template, update migration guide
63
+ * fix(gui-components): avoid double hints in pickers
64
+ * fix(gui-react): fix singleOpen in react accordion
65
+ * fix(gui-components): fix currency stepping
66
+ * fix(gui-components): reset value on form reset
67
+ * fix(gui-components): Segmented date and time inputs keep an outdated validity
68
+ * fix(gui-components): block pickers submissions with partly typed or impossible dates
69
+ * fix(gui-components): Dates and times outside their bounds now block a native submit
70
+ * fix(gui-components): block native submit with pending uploads in progress
71
+ * test: fix typing issues with specs
72
+
73
+ ### ❤️ Thank You
74
+
75
+ - Raúl Jiménez @Elecash
76
+
77
+ ## 1.6.0 (2026-10-03)
78
+
79
+ ### 🚀 Features
80
+
81
+ - **schemas:** convert a JSON Schema into a form definition ([#402](https://github.com/golemui/golemui/pull/402))
82
+
83
+ ### ❤️ Thank You
84
+
85
+ - Mud Scientist @mudscientist
86
+
87
+ ## 1.6.0-rc.1 (2026-10-02)
88
+
89
+ This was a version bump only for core to align it with other projects, there were no code changes.
90
+
1
91
  ## 1.6.0-rc.0 (2026-10-02)
2
92
 
3
93
  ### 🚀 Features
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BehaviorSubject as lr, distinctUntilChanged as Ne, Subject as ot, pipe as ar, map as Et } from "rxjs";
2
- import { Decoder as me, err as x, ok as Ve, object as Z, array as Le, string as w, oneOf as b, boolean as fr, optional as y, succeed as _, number as ge, literal as z, lazy as wt, discriminatedUnion as pr, record as hr, formatIssuePath as mr } from "ts.data.json";
2
+ import { Decoder as me, err as X, ok as Ve, object as Z, array as Le, string as w, oneOf as b, boolean as fr, optional as y, succeed as _, number as ge, literal as z, lazy as wt, discriminatedUnion as pr, record as hr, formatIssuePath as mr } from "ts.data.json";
3
3
  import "@standard-schema/spec";
4
4
  function gr(e, t) {
5
5
  const r = e["~standard"].validate(t);
@@ -13,12 +13,12 @@ function yr(e) {
13
13
  function Y(e) {
14
14
  return new me((t) => {
15
15
  if (typeof t != "object" || t === null)
16
- return x([{ message: `Expected object literal, got "${typeof t}"`, path: [] }]);
16
+ return X([{ message: `Expected object literal, got "${typeof t}"`, path: [] }]);
17
17
  const r = {};
18
18
  for (const [n, o] of Object.entries(e)) {
19
19
  const i = o.decoder.decode(t[n]);
20
20
  if (!i.isOk())
21
- return x(
21
+ return X(
22
22
  i.issues.map((s) => ({
23
23
  message: s.message,
24
24
  path: [n, ...s.path]
@@ -29,7 +29,7 @@ function Y(e) {
29
29
  if (s.startsWith(n + ".")) {
30
30
  const d = o.decoder.decode(c);
31
31
  if (!d.isOk())
32
- return x(
32
+ return X(
33
33
  d.issues.map((l) => ({
34
34
  message: l.message,
35
35
  path: [s, ...l.path]
@@ -44,7 +44,7 @@ function Y(e) {
44
44
  }
45
45
  const vr = (e) => typeof e != "function" && e.kind === "display", ie = (e) => typeof e != "function" && e.kind === "action", I = (e) => typeof e != "function" && e.kind === "input", M = (e) => typeof e != "function" && e.kind === "layout", W = (e) => typeof e == "function", $r = Z({ in: Le(w()) }), _e = Z({ when: w() }), ye = b([$r, _e]), Sr = Z({ from: Le(w()) }), ve = b([Sr, _e]), Pe = b([fr(), _e]), Ar = new me((e) => {
46
46
  const t = typeof e;
47
- return t === "function" ? Ve(e) : x([{ message: `Expected a function, got '${t}'`, path: [] }]);
47
+ return t === "function" ? Ve(e) : X([{ message: `Expected a function, got '${t}'`, path: [] }]);
48
48
  }), D = (e) => b([e, Ar]), Me = Y({
49
49
  load: { suffixed: !0, decoder: D(y(w())) },
50
50
  click: { suffixed: !0, decoder: D(y(w())) },
@@ -91,7 +91,7 @@ const vr = (e) => typeof e != "function" && e.kind === "display", ie = (e) => ty
91
91
  });
92
92
  return r.uid = r.uid || n.uid, r.type = n.type, r.path = n.path, Ve(r);
93
93
  } else
94
- return x([{ message: `Expected a function, got '${t}'`, path: [] }]);
94
+ return X([{ message: `Expected a function, got '${t}'`, path: [] }]);
95
95
  }), Or = Y({
96
96
  kind: { decoder: z("input") },
97
97
  uid: { decoder: y(w()) },
@@ -211,7 +211,7 @@ function ci(e) {
211
211
  ...e,
212
212
  form: {
213
213
  uid: "",
214
- type: "flex",
214
+ type: "grid",
215
215
  kind: "layout",
216
216
  children: e.form
217
217
  }
@@ -225,7 +225,7 @@ const It = Z({
225
225
  formDef: It.parse({
226
226
  form: {
227
227
  kind: "layout",
228
- type: "flex",
228
+ type: "grid",
229
229
  children: []
230
230
  }
231
231
  }),
@@ -408,7 +408,7 @@ function Ce(e) {
408
408
  }
409
409
  return t;
410
410
  }
411
- const X = (e) => !W(e) && e.type === "repeater", Se = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((t) => parseInt(t[1], 10)), We = "items";
411
+ const x = (e) => !W(e) && e.type === "repeater", Se = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((t) => parseInt(t[1], 10)), We = "items";
412
412
  function De(e, t) {
413
413
  const r = {
414
414
  resolvedSources: {},
@@ -416,7 +416,7 @@ function De(e, t) {
416
416
  repeaterRows: {}
417
417
  };
418
418
  for (const n of Object.values(e))
419
- r.resolvedSources[n.uid] = n, X(n) && kt(n, n.path, [], t, r);
419
+ r.resolvedSources[n.uid] = n, x(n) && kt(n, n.path, [], t, r);
420
420
  return r;
421
421
  }
422
422
  function kt(e, t, r, n, o) {
@@ -438,7 +438,7 @@ function kt(e, t, r, n, o) {
438
438
  });
439
439
  }
440
440
  function Nr(e, t, r, n, o, i) {
441
- if (X(e) && X(t))
441
+ if (x(e) && x(t))
442
442
  return { repeater: t, declaredPath: e.path };
443
443
  if (!W(e))
444
444
  return;
@@ -611,11 +611,11 @@ const Te = {}, f = (e, t, r = Te[e]) => Te[e] = (...n) => t(...n) || r?.(...n),
611
611
  // == catches both undefined and null
612
612
  Te[e[0]]?.(...e.slice(1)) ?? U(`Unknown operator: ${e[0]}`, e?.loc)
613
613
  ) : e === void 0 ? () => {
614
- } : (t) => t?.[e], de = 46, Q = 48, ue = 57, xr = 69, Xr = 101, Qr = 43, qr = 45, oe = 95, Nt = 110, Jr = 97, Zr = 102, Yr = 65, en = 70, Vt = (e) => e.indexOf("_") < 0 ? e : e.replaceAll("_", ""), Ke = (e) => {
614
+ } : (t) => t?.[e], de = 46, Q = 48, ue = 57, Xr = 69, xr = 101, Qr = 43, qr = 45, oe = 95, Nt = 110, Jr = 97, Zr = 102, Yr = 65, en = 70, Vt = (e) => e.indexOf("_") < 0 ? e : e.replaceAll("_", ""), Ke = (e) => {
615
615
  let t = Vt(B(
616
616
  (r) => (
617
617
  // . is decimal only if NOT followed by another . (range operator)
618
- r === de && m.charCodeAt(h + 1) !== de || r >= Q && r <= ue || r === oe || ((r === xr || r === Xr) && ((r = m.charCodeAt(h + 1)) >= Q && r <= ue || r === Qr || r === qr) ? 2 : 0)
618
+ r === de && m.charCodeAt(h + 1) !== de || r >= Q && r <= ue || r === oe || ((r === Xr || r === xr) && ((r = m.charCodeAt(h + 1)) >= Q && r <= ue || r === Qr || r === qr) ? 2 : 0)
619
619
  )
620
620
  ));
621
621
  return m.charCodeAt(h) === Nt ? (C(), [, BigInt(t)]) : (e = +t) != e ? U() : [, e];
@@ -700,12 +700,12 @@ $("==", Ut);
700
700
  $("!=", Ut);
701
701
  f("==", (e, t) => (e = u(e), t = u(t), (r) => e(r) == t(r)));
702
702
  f("!=", (e, t) => (e = u(e), t = u(t), (r) => e(r) != t(r)));
703
- const Ht = 110, xe = 120, zt = 140;
703
+ const Ht = 110, Xe = 120, zt = 140;
704
704
  $("+", Ht);
705
705
  $("-", Ht);
706
- $("*", xe);
707
- $("/", xe);
708
- $("%", xe);
706
+ $("*", Xe);
707
+ $("/", Xe);
708
+ $("%", Xe);
709
709
  V("+", zt);
710
710
  V("-", zt);
711
711
  f("+", (e, t) => t !== void 0 ? (e = u(e), t = u(t), (r) => e(r) + t(r)) : (e = u(e), (r) => +e(r)));
@@ -716,14 +716,14 @@ f("%", (e, t) => (e = u(e), t = u(t), (r) => e(r) % t(r)));
716
716
  const le = 150;
717
717
  O("++", le, (e) => e ? ["++", e, null] : ["++", S(le - 1)]);
718
718
  O("--", le, (e) => e ? ["--", e, null] : ["--", S(le - 1)]);
719
- const Xe = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e) : e[0] === "." ? (r = u(e[1]), n = e[2], (o) => t(r(o), n)) : e[0] === "[]" && e.length === 3 ? (r = u(e[1]), n = u(e[2]), (o) => t(r(o), n(o))) : e[0] === "()" && e.length === 2 ? Xe(e[1], t) : (
719
+ const xe = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e) : e[0] === "." ? (r = u(e[1]), n = e[2], (o) => t(r(o), n)) : e[0] === "[]" && e.length === 3 ? (r = u(e[1]), n = u(e[2]), (o) => t(r(o), n(o))) : e[0] === "()" && e.length === 2 ? xe(e[1], t) : (
720
720
  // unwrap parens: (x)++
721
721
  (() => {
722
722
  throw Error("Invalid increment target");
723
723
  })()
724
724
  );
725
- f("++", (e, t) => Xe(e, t === null ? (r, n) => r[n]++ : (r, n) => ++r[n]));
726
- f("--", (e, t) => Xe(e, t === null ? (r, n) => r[n]-- : (r, n) => --r[n]));
725
+ f("++", (e, t) => xe(e, t === null ? (r, n) => r[n]++ : (r, n) => ++r[n]));
726
+ f("--", (e, t) => xe(e, t === null ? (r, n) => r[n]-- : (r, n) => --r[n]));
727
727
  const pn = 5, hn = 10;
728
728
  Rt(",", hn);
729
729
  Rt(";", pn, !0);
@@ -857,7 +857,7 @@ const Je = 5, In = 10, On = 20, Pn = (e) => e[0]?.[0] === "," ? e[0].slice(1) :
857
857
  te("let", Je + 1, () => Kt("let"));
858
858
  te("const", Je + 1, () => Kt("const"));
859
859
  te("var", Je, () => (T(), ["var", S(On)]));
860
- const xt = (...e) => (e = e.map((t) => {
860
+ const Xt = (...e) => (e = e.map((t) => {
861
861
  if (typeof t == "string") return (r) => {
862
862
  r[t] = void 0;
863
863
  };
@@ -871,8 +871,8 @@ const xt = (...e) => (e = e.map((t) => {
871
871
  }), (t) => {
872
872
  for (const r of e) r(t);
873
873
  });
874
- f("let", xt);
875
- f("const", xt);
874
+ f("let", Xt);
875
+ f("const", Xt);
876
876
  f("var", (e) => typeof e == "string" ? (t) => {
877
877
  t[e] = void 0;
878
878
  } : () => {
@@ -1000,20 +1000,20 @@ f("new", (e) => {
1000
1000
  const t = u(e?.[0] === "()" ? e[1] : e), r = e?.[0] === "()" ? e[2] : null, n = r ? r[0] === "," ? /* @__PURE__ */ ((o) => (i) => o.map((s) => s(i)))(r.slice(1).map(u)) : /* @__PURE__ */ ((o) => (i) => [o(i)])(u(r)) : () => [];
1001
1001
  return (o) => new (t(o))(...n(o));
1002
1002
  });
1003
- const Ye = /* @__PURE__ */ Symbol("accessor"), et = 20, Dn = 40, Xt = 41, Qt = 123, qt = 125, Jt = (e) => (t) => {
1003
+ const Ye = /* @__PURE__ */ Symbol("accessor"), et = 20, Dn = 40, xt = 41, Qt = 123, qt = 125, Jt = (e) => (t) => {
1004
1004
  if (t) return;
1005
1005
  T();
1006
1006
  const r = B(v.id);
1007
1007
  if (!r || (T(), m.charCodeAt(h) !== Dn)) return !1;
1008
1008
  C();
1009
- const n = S(0, Xt);
1009
+ const n = S(0, xt);
1010
1010
  return T(), m.charCodeAt(h) !== Qt ? !1 : (C(), [e, r, n, S(0, qt)]);
1011
1011
  };
1012
1012
  O("get", et - 1, Jt("get"));
1013
1013
  O("set", et - 1, Jt("set"));
1014
1014
  O("(", et - 1, (e) => {
1015
1015
  if (!e || typeof e != "string") return;
1016
- const t = S(0, Xt) || null;
1016
+ const t = S(0, xt) || null;
1017
1017
  if (T(), m.charCodeAt(h) === Qt)
1018
1018
  return C(), [":", e, ["=>", ["()", t], S(0, qt) || null]];
1019
1019
  });
@@ -1185,10 +1185,10 @@ const Kn = (e) => (t, r) => {
1185
1185
  const { $formIsInvalid: n, $errors: o } = r ?? $e(t);
1186
1186
  return {
1187
1187
  ...t,
1188
- widgetFlags: xn(t, o, n, e)
1188
+ widgetFlags: Xn(t, o, n, e)
1189
1189
  };
1190
1190
  };
1191
- function xn(e, t, r, n) {
1191
+ function Xn(e, t, r, n) {
1192
1192
  const o = [];
1193
1193
  for (const [s, c] of Object.entries(e.resolvedSources))
1194
1194
  if (W(c)) {
@@ -1235,12 +1235,12 @@ function xn(e, t, r, n) {
1235
1235
  },
1236
1236
  {}
1237
1237
  );
1238
- return Xn(e, i), i;
1238
+ return xn(e, i), i;
1239
1239
  }
1240
1240
  function gt(e) {
1241
1241
  return !!(e.include && ("in" in e.include || "when" in e.include) || e.exclude && ("from" in e.exclude || "when" in e.exclude) || (I(e) || ie(e)) && J(e.disabled) || I(e) && J(e.readonly));
1242
1242
  }
1243
- function Xn(e, t) {
1243
+ function xn(e, t) {
1244
1244
  const r = Object.keys(t).filter((n) => t[n].hidden === !0);
1245
1245
  for (const n of r)
1246
1246
  Yt(n, e, t);
@@ -1248,7 +1248,7 @@ function Xn(e, t) {
1248
1248
  function Yt(e, t, r) {
1249
1249
  const n = t.resolvedSources[e];
1250
1250
  if (n !== void 0) {
1251
- if (X(n) || W(n) && n.path !== void 0) {
1251
+ if (x(n) || W(n) && n.path !== void 0) {
1252
1252
  const o = `${n.path}.`;
1253
1253
  for (const [i, s] of Object.entries(t.repeaterItemScopes))
1254
1254
  s.itemPath.startsWith(o) && yt(i, r);
@@ -1594,7 +1594,7 @@ const So = (e) => {
1594
1594
  ...n,
1595
1595
  form: {
1596
1596
  uid: "",
1597
- type: "flex",
1597
+ type: "grid",
1598
1598
  kind: "layout",
1599
1599
  children: a
1600
1600
  }
@@ -1997,14 +1997,14 @@ function pi(e = "GolemUI Form Store") {
1997
1997
  };
1998
1998
  };
1999
1999
  }
2000
- const xo = ar(
2000
+ const Xo = ar(
2001
2001
  Et((e) => e.formHealth),
2002
2002
  Ne((e, t) => e.status !== t.status ? !1 : e.status === "errored" && t.status === "errored" ? e.message === t.message && e.code === t.code : !0)
2003
- ), hi = (e) => e.pipe(xo);
2003
+ ), hi = (e) => e.pipe(Xo);
2004
2004
  function mi(e, t) {
2005
2005
  return dr(e, t, cr(e, t), void 0);
2006
2006
  }
2007
- function Xo() {
2007
+ function xo() {
2008
2008
  const e = /* @__PURE__ */ new Map();
2009
2009
  return (t, r) => {
2010
2010
  const n = cr(t, r), o = e.get(r);
@@ -2015,7 +2015,7 @@ function Xo() {
2015
2015
  };
2016
2016
  }
2017
2017
  const gi = (e) => (t) => {
2018
- const r = Xo();
2018
+ const r = xo();
2019
2019
  return t.pipe(
2020
2020
  Et((n) => r(n, e)),
2021
2021
  // The reader returns the same object while nothing changed, so reference equality is enough.
@@ -2069,7 +2069,7 @@ function ei(e, t, r, n) {
2069
2069
  if (r === void 0 || !Array.isArray(n))
2070
2070
  return At;
2071
2071
  const o = e.resolvedSources[t];
2072
- if (o === void 0 || !X(o))
2072
+ if (o === void 0 || !x(o))
2073
2073
  return At;
2074
2074
  const i = o.props.template.uid, s = Se(t);
2075
2075
  return n.map((c, d) => {
@@ -2101,7 +2101,7 @@ export {
2101
2101
  fi as FormContext,
2102
2102
  vi as assertNoPropCollisions,
2103
2103
  ce as cloneObject,
2104
- Xo as createWidgetViewModelReader,
2104
+ xo as createWidgetViewModelReader,
2105
2105
  ci as defineForm,
2106
2106
  pi as devToolsMiddleware,
2107
2107
  yi as enableDevMode,
package/index.umd.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("rxjs"),l=require("ts.data.json");require("@standard-schema/spec");function at(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function ft(e){return e.issues===void 0}function q(e){return new l.Decoder(t=>{if(typeof t!="object"||t===null)return l.err([{message:`Expected object literal, got "${typeof t}"`,path:[]}]);const r={};for(const[n,o]of Object.entries(e)){const i=o.decoder.decode(t[n]);if(!i.isOk())return l.err(i.issues.map(s=>({message:s.message,path:[n,...s.path]})));if(r[n]=i.value,o.suffixed){for(const[s,c]of Object.entries(t))if(s.startsWith(n+".")){const d=o.decoder.decode(c);if(!d.isOk())return l.err(d.issues.map(a=>({message:a.message,path:[s,...a.path]})));r[s]=d.value}}}return l.ok(r)})}const tr=e=>typeof e!="function"&&e.kind==="display",te=e=>typeof e!="function"&&e.kind==="action",I=e=>typeof e!="function"&&e.kind==="input",_=e=>typeof e!="function"&&e.kind==="layout",D=e=>typeof e=="function",rr=l.object({in:l.array(l.string())}),Pe=l.object({when:l.string()}),le=l.oneOf([rr,Pe]),nr=l.object({from:l.array(l.string())}),ae=l.oneOf([nr,Pe]),Se=l.oneOf([l.boolean(),Pe]),or=new l.Decoder(e=>{const t=typeof e;return t==="function"?l.ok(e):l.err([{message:`Expected a function, got '${t}'`,path:[]}])}),W=e=>l.oneOf([e,or]),ke=q({load:{suffixed:!0,decoder:W(l.optional(l.string()))},click:{suffixed:!0,decoder:W(l.optional(l.string()))},change:{suffixed:!0,decoder:W(l.optional(l.string()))},filter:{suffixed:!0,decoder:W(l.optional(l.string()))},blur:{suffixed:!0,decoder:W(l.optional(l.string()))}}),ir=l.object({key:l.string(),default:l.optional(l.string()),params:l.optional(l.succeed())}),pt=l.oneOf([l.string(),ir]),De=l.optional(l.string()),sr=q({kind:{decoder:l.literal("display")},uid:{decoder:De},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},props:{decoder:l.optional(l.succeed())}}),cr=q({kind:{decoder:l.literal("action")},uid:{decoder:De},type:{decoder:l.string()},actionType:{decoder:l.optional(l.oneOf([l.literal("button"),l.literal("submit")]))},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},label:{suffixed:!0,decoder:W(l.optional(pt))},disabled:{suffixed:!0,decoder:l.optional(Se)},on:{decoder:l.optional(ke)},props:{decoder:l.optional(l.succeed())}}),dr=new l.Decoder(e=>{const t=typeof e;if(t==="function"){const r=e,n=r({$form:{},errors:void 0,touched:void 0,translate:void 0});return r.uid=r.uid||n.uid,r.type=n.type,r.path=n.path,l.ok(r)}else return l.err([{message:`Expected a function, got '${t}'`,path:[]}])}),ur=q({kind:{decoder:l.literal("input")},uid:{decoder:l.optional(l.string())},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},disabled:{suffixed:!0,decoder:l.optional(Se)},readonly:{suffixed:!0,decoder:l.optional(Se)},on:{decoder:l.optional(ke)},props:{decoder:l.optional(l.succeed())},label:{suffixed:!0,decoder:W(l.optional(pt))},path:{decoder:l.string()},defaultValue:{decoder:l.optional(l.succeed())},validator:{suffixed:!0,decoder:W(l.optional(l.succeed()))}}).map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;t.props={...r,template:We.parse(r.template)}}return t}),lr=l.lazy(()=>{const e=l.discriminatedUnion("kind",{input:ur,layout:We,display:sr,action:cr});return new l.Decoder(t=>typeof t=="function"?dr.decode(t):e.decode(t))}),We=q({kind:{decoder:l.literal("layout")},uid:{decoder:De},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},props:{decoder:l.optional(l.succeed())},on:{decoder:l.optional(ke)},children:{decoder:l.array(lr)}}),P=class P{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!P.sharedCache.has(r)){const n=r().catch(o=>(P.sharedCache.delete(r),Promise.reject(o)));P.sharedCache.set(r,n)}return P.sharedCache.get(r)}async preloadWidgets(t){const r=t??Object.keys(this.widgetLoaders);await Promise.all(r.map(async n=>{const o=await this.loadWidget(n);P.resolvedCache.set(this.widgetLoaders[n],o)}))}getIfLoaded(t){const r=this.widgetLoaders[t];if(r)return P.resolvedCache.get(r)}};P.sharedCache=new Map,P.resolvedCache=new Map;let re=P;async function ar(e){const t=new re;t.setWidgetLoaders(e.widgetLoaders),await t.preloadWidgets()}function fr(e){Ae(e,"#0")}function Ae(e,t){if(D(e)){e.uid||(e.uid=`${t}.f`);return}if(e.uid||(e.uid=t),_(e)&&e.children.forEach((r,n)=>{Ae(r,`${t}.${n}`)}),I(e)&&e.type==="repeater"){const r=e.props?.template;r&&Ae(r,`${t}.t`)}}function pr(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const ht=l.object({states:l.optional(l.record(l.string())),form:l.lazy(()=>We)}).map(e=>(fr(e.form),e)),mt=e=>({formName:"",formDef:ht.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},resolvedSources:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},repeaterItemScopes:{},repeaterRows:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,allControlsValidated:!1,lang:e}),hr={submit:"formSubmit",health:"formHealth",event:"formEvent"},mr=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function gr(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const gt=(e=typeof navigator<"u"&&navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(o=>o(e))}}},C={calculateCurrentStateError:10,calculateWidgetFlagsError:11,calculateWidgetPropsError:12,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,initializeMalformedFormShapeError:23,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},yr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)},V=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},vr=(e,t)=>{if(t==="")return!1;let r=e;for(const n of t.split(".")){if(r===null||typeof r!="object")return!1;if(Array.isArray(r)){const o=parseInt(n,10);if(!(o in r))return!1;r=r[o]}else{if(!(n in r))return!1;r=r[n]}}return!0},Ee=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let o=e;for(let s=0;s<n.length-1;s++){const c=n[s],d=n[s+1];(o[c]==null||typeof o[c]!="object")&&(o[c]=vt(d)?[]:{}),o=o[c]}const i=n[n.length-1];return o[i]=r,e},yt=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split("."),o=Xe(e);let i=o;for(let s=0;s<n.length-1;s++){const c=n[s],d=n[s+1];i[c]==null||typeof i[c]!="object"?i[c]=vt(d)?[]:{}:i[c]=Xe(i[c]),i=i[c]}return i[n[n.length-1]]=r,o},Xe=e=>Array.isArray(e)?e.slice():{...e},$r=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let s=0;s<r.length-1;s++){const c=n[s];if(c==null||typeof c!="object")return e;const d=r[s],a=Array.isArray(c)?c[parseInt(d,10)]:c[d];if(a==null||typeof a!="object")return e;n.push(a)}const o=n[n.length-1],i=r[r.length-1];Array.isArray(o)?o.splice(parseInt(i,10),1):delete o[i];for(let s=n.length-1;s>=1;s--){const c=n[s];if(Array.isArray(c)||!Sr(c))break;const d=n[s-1],a=r[s-1];if(Array.isArray(d))break;delete d[a]}return e};function vt(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Sr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}function B(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>B(r));const t={};for(const r of Object.keys(e))t[r]=B(e[r]);return t}function Fe(e){return e.flatMap(t=>[t,..._(t)?Fe(t.children):[]])}function fe(e){return Object.entries(e.validations).sort(([n],[o])=>n.split(".").length-o.split(".").length).reduce((n,[o,i])=>(i!==null&&(n.$formIsInvalid=!0,Ee(n.$errors,o,[...i])),n),{$formIsInvalid:!1,$errors:{}})}function R(e){if(e!==void 0)return I(e)||D(e)?e.path:void 0}function ye(e){const t=B(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const o=R(e.resolvedSources[r]);o!==void 0&&$r(t,o)}return t}const G=e=>!D(e)&&e.type==="repeater",pe=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10)),we="items";function Ce(e,t){const r={resolvedSources:{},repeaterItemScopes:{},repeaterRows:{}};for(const n of Object.values(e))r.resolvedSources[n.uid]=n,G(n)&&$t(n,n.path,[],t,r);return r}function $t(e,t,r,n,o){const i=V(n,e.path);if(!Array.isArray(i))return;const s=Fe([e.props.template]);i.forEach((c,d)=>{const a=`${e.path}.${d}`,f=[...r,{declaredItemPath:`${t}.${we}`,itemPath:a,index:d}],h={itemPath:a,index:d};for(const y of s){const A=St(y,f);o.resolvedSources[A.uid]=A,o.repeaterItemScopes[A.uid]=h,o.repeaterRows[A.uid]=f;const L=Ar(y,A,f,n,c,d);L&&$t(L.repeater,L.declaredPath,f,n,o)}})}function Ar(e,t,r,n,o,i){if(G(e)&&G(t))return{repeater:t,declaredPath:e.path};if(!D(e))return;const s=e({$form:n,$item:o,$index:i,errors:void 0,touched:void 0,translate:void 0});if(s.type!=="repeater")return;const c={...s,uid:e.uid};return{repeater:St(c,r),declaredPath:s.path}}function St(e,t){const r=t[t.length-1];return At(e,t.map(n=>n.index),n=>Cr(n,r))}function Er(e,t){return At(e,t,r=>wr(r,t))}function At(e,t,r){const n=Re(e.uid,t);if(D(e)){const o=i=>e(i);return o.uid=n,o.type=e.type,e.path!==void 0&&(o.path=r(e.path)),o}return I(e)?{...e,uid:n,path:r(e.path)}:{...e,uid:n}}function Re(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,o)=>`${n}[${o}]`,"");return`${e}${r}`}function wr(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=e.split("."),n=r.map((o,i)=>i>0&&o===we?i:-1).filter(o=>o!==-1);if(n.length!==t.length)throw new Error(`Path contains ${n.length} '${we}' occurrences, but ${t.length} indexes were provided.`);return n.forEach((o,i)=>{r[o]=String(t[i])}),r.join(".")}function Cr(e,t){const r=t.declaredItemPath;if(e!==r&&!e.startsWith(`${r}.`))throw new Error(`Path "${e}" is not inside the repeater row "${r}".`);return`${t.itemPath}${e.slice(r.length)}`}function Ir(e,t){let r=e;for(let n=t.length-1;n>=0;n--)r=Or(r,t[n]);return r}function Or(e,t){const r=t.declaredItemPath.split("."),n=t.itemPath.split(".");return e.replace(jr(t.declaredItemPath),(o,i,s,...c)=>{const d=c.slice(0,r.length-1),a=n.map((f,h)=>h===0?f:d[h-1]+f).join("");return`${i}${s??""}${a}`})}const qe=new Map;function jr(e){let t=qe.get(e);if(t===void 0){const r=e.split(".").map(Pr);t=new RegExp(`(^|[^\\w$.])(\\$form\\??\\.)?${r.join("(\\??\\.)")}(?![\\w$])`,"g"),qe.set(e,t)}return t}function Pr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Qe=["include","exclude","disabled","readonly"];function kr(e,t){if(!Qe.some(o=>Je(e[o])))return e;const n={...e};for(const o of Qe){const i=n[o];Je(i)&&(n[o]={...i,when:Ir(i.when,t)})}return n}function Je(e){return e!==null&&typeof e=="object"&&"when"in e&&typeof e.when=="string"}const Dr=50,Wr=e=>{let t=e.data,r=Ce(e.flatForm,t);for(let n=0;n<Dr;n++){let o=!1;for(const i of Object.values(r.resolvedSources))!I(i)||vr(t,i.path)||(t=yt(t,i.path,B(i.defaultValue)),i.defaultValue!==void 0&&(o=!0));if(!o)break;r=Ce(e.flatForm,t)}return{...e,data:t,...r}},Te=32;let Ie,m,g,v=e=>(m=0,g=e,v.newline=!1,e=S(),g[m]?M():e||""),M=(e="Unexpected token",t=m,r=g.slice(0,t).split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("rxjs"),l=require("ts.data.json");require("@standard-schema/spec");function at(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function ft(e){return e.issues===void 0}function q(e){return new l.Decoder(t=>{if(typeof t!="object"||t===null)return l.err([{message:`Expected object literal, got "${typeof t}"`,path:[]}]);const r={};for(const[n,o]of Object.entries(e)){const i=o.decoder.decode(t[n]);if(!i.isOk())return l.err(i.issues.map(s=>({message:s.message,path:[n,...s.path]})));if(r[n]=i.value,o.suffixed){for(const[s,c]of Object.entries(t))if(s.startsWith(n+".")){const d=o.decoder.decode(c);if(!d.isOk())return l.err(d.issues.map(a=>({message:a.message,path:[s,...a.path]})));r[s]=d.value}}}return l.ok(r)})}const tr=e=>typeof e!="function"&&e.kind==="display",te=e=>typeof e!="function"&&e.kind==="action",I=e=>typeof e!="function"&&e.kind==="input",_=e=>typeof e!="function"&&e.kind==="layout",D=e=>typeof e=="function",rr=l.object({in:l.array(l.string())}),Pe=l.object({when:l.string()}),le=l.oneOf([rr,Pe]),nr=l.object({from:l.array(l.string())}),ae=l.oneOf([nr,Pe]),Se=l.oneOf([l.boolean(),Pe]),or=new l.Decoder(e=>{const t=typeof e;return t==="function"?l.ok(e):l.err([{message:`Expected a function, got '${t}'`,path:[]}])}),W=e=>l.oneOf([e,or]),ke=q({load:{suffixed:!0,decoder:W(l.optional(l.string()))},click:{suffixed:!0,decoder:W(l.optional(l.string()))},change:{suffixed:!0,decoder:W(l.optional(l.string()))},filter:{suffixed:!0,decoder:W(l.optional(l.string()))},blur:{suffixed:!0,decoder:W(l.optional(l.string()))}}),ir=l.object({key:l.string(),default:l.optional(l.string()),params:l.optional(l.succeed())}),pt=l.oneOf([l.string(),ir]),De=l.optional(l.string()),sr=q({kind:{decoder:l.literal("display")},uid:{decoder:De},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},props:{decoder:l.optional(l.succeed())}}),cr=q({kind:{decoder:l.literal("action")},uid:{decoder:De},type:{decoder:l.string()},actionType:{decoder:l.optional(l.oneOf([l.literal("button"),l.literal("submit")]))},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},label:{suffixed:!0,decoder:W(l.optional(pt))},disabled:{suffixed:!0,decoder:l.optional(Se)},on:{decoder:l.optional(ke)},props:{decoder:l.optional(l.succeed())}}),dr=new l.Decoder(e=>{const t=typeof e;if(t==="function"){const r=e,n=r({$form:{},errors:void 0,touched:void 0,translate:void 0});return r.uid=r.uid||n.uid,r.type=n.type,r.path=n.path,l.ok(r)}else return l.err([{message:`Expected a function, got '${t}'`,path:[]}])}),ur=q({kind:{decoder:l.literal("input")},uid:{decoder:l.optional(l.string())},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},disabled:{suffixed:!0,decoder:l.optional(Se)},readonly:{suffixed:!0,decoder:l.optional(Se)},on:{decoder:l.optional(ke)},props:{decoder:l.optional(l.succeed())},label:{suffixed:!0,decoder:W(l.optional(pt))},path:{decoder:l.string()},defaultValue:{decoder:l.optional(l.succeed())},validator:{suffixed:!0,decoder:W(l.optional(l.succeed()))}}).map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;t.props={...r,template:We.parse(r.template)}}return t}),lr=l.lazy(()=>{const e=l.discriminatedUnion("kind",{input:ur,layout:We,display:sr,action:cr});return new l.Decoder(t=>typeof t=="function"?dr.decode(t):e.decode(t))}),We=q({kind:{decoder:l.literal("layout")},uid:{decoder:De},type:{decoder:l.string()},size:{suffixed:!0,decoder:l.optional(l.number())},include:{decoder:l.optional(le)},exclude:{decoder:l.optional(ae)},props:{decoder:l.optional(l.succeed())},on:{decoder:l.optional(ke)},children:{decoder:l.array(lr)}}),P=class P{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!P.sharedCache.has(r)){const n=r().catch(o=>(P.sharedCache.delete(r),Promise.reject(o)));P.sharedCache.set(r,n)}return P.sharedCache.get(r)}async preloadWidgets(t){const r=t??Object.keys(this.widgetLoaders);await Promise.all(r.map(async n=>{const o=await this.loadWidget(n);P.resolvedCache.set(this.widgetLoaders[n],o)}))}getIfLoaded(t){const r=this.widgetLoaders[t];if(r)return P.resolvedCache.get(r)}};P.sharedCache=new Map,P.resolvedCache=new Map;let re=P;async function ar(e){const t=new re;t.setWidgetLoaders(e.widgetLoaders),await t.preloadWidgets()}function fr(e){Ae(e,"#0")}function Ae(e,t){if(D(e)){e.uid||(e.uid=`${t}.f`);return}if(e.uid||(e.uid=t),_(e)&&e.children.forEach((r,n)=>{Ae(r,`${t}.${n}`)}),I(e)&&e.type==="repeater"){const r=e.props?.template;r&&Ae(r,`${t}.t`)}}function pr(e){return{...e,form:{uid:"",type:"grid",kind:"layout",children:e.form}}}const ht=l.object({states:l.optional(l.record(l.string())),form:l.lazy(()=>We)}).map(e=>(fr(e.form),e)),mt=e=>({formName:"",formDef:ht.parse({form:{kind:"layout",type:"grid",children:[]}}),flatForm:{},resolvedSources:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},repeaterItemScopes:{},repeaterRows:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,allControlsValidated:!1,lang:e}),hr={submit:"formSubmit",health:"formHealth",event:"formEvent"},mr=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function gr(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const gt=(e=typeof navigator<"u"&&navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(o=>o(e))}}},C={calculateCurrentStateError:10,calculateWidgetFlagsError:11,calculateWidgetPropsError:12,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,initializeMalformedFormShapeError:23,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},yr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)},V=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},vr=(e,t)=>{if(t==="")return!1;let r=e;for(const n of t.split(".")){if(r===null||typeof r!="object")return!1;if(Array.isArray(r)){const o=parseInt(n,10);if(!(o in r))return!1;r=r[o]}else{if(!(n in r))return!1;r=r[n]}}return!0},Ee=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let o=e;for(let s=0;s<n.length-1;s++){const c=n[s],d=n[s+1];(o[c]==null||typeof o[c]!="object")&&(o[c]=vt(d)?[]:{}),o=o[c]}const i=n[n.length-1];return o[i]=r,e},yt=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split("."),o=xe(e);let i=o;for(let s=0;s<n.length-1;s++){const c=n[s],d=n[s+1];i[c]==null||typeof i[c]!="object"?i[c]=vt(d)?[]:{}:i[c]=xe(i[c]),i=i[c]}return i[n[n.length-1]]=r,o},xe=e=>Array.isArray(e)?e.slice():{...e},$r=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let s=0;s<r.length-1;s++){const c=n[s];if(c==null||typeof c!="object")return e;const d=r[s],a=Array.isArray(c)?c[parseInt(d,10)]:c[d];if(a==null||typeof a!="object")return e;n.push(a)}const o=n[n.length-1],i=r[r.length-1];Array.isArray(o)?o.splice(parseInt(i,10),1):delete o[i];for(let s=n.length-1;s>=1;s--){const c=n[s];if(Array.isArray(c)||!Sr(c))break;const d=n[s-1],a=r[s-1];if(Array.isArray(d))break;delete d[a]}return e};function vt(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Sr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}function B(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>B(r));const t={};for(const r of Object.keys(e))t[r]=B(e[r]);return t}function Fe(e){return e.flatMap(t=>[t,..._(t)?Fe(t.children):[]])}function fe(e){return Object.entries(e.validations).sort(([n],[o])=>n.split(".").length-o.split(".").length).reduce((n,[o,i])=>(i!==null&&(n.$formIsInvalid=!0,Ee(n.$errors,o,[...i])),n),{$formIsInvalid:!1,$errors:{}})}function R(e){if(e!==void 0)return I(e)||D(e)?e.path:void 0}function ye(e){const t=B(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const o=R(e.resolvedSources[r]);o!==void 0&&$r(t,o)}return t}const G=e=>!D(e)&&e.type==="repeater",pe=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10)),we="items";function Ce(e,t){const r={resolvedSources:{},repeaterItemScopes:{},repeaterRows:{}};for(const n of Object.values(e))r.resolvedSources[n.uid]=n,G(n)&&$t(n,n.path,[],t,r);return r}function $t(e,t,r,n,o){const i=V(n,e.path);if(!Array.isArray(i))return;const s=Fe([e.props.template]);i.forEach((c,d)=>{const a=`${e.path}.${d}`,f=[...r,{declaredItemPath:`${t}.${we}`,itemPath:a,index:d}],h={itemPath:a,index:d};for(const y of s){const A=St(y,f);o.resolvedSources[A.uid]=A,o.repeaterItemScopes[A.uid]=h,o.repeaterRows[A.uid]=f;const L=Ar(y,A,f,n,c,d);L&&$t(L.repeater,L.declaredPath,f,n,o)}})}function Ar(e,t,r,n,o,i){if(G(e)&&G(t))return{repeater:t,declaredPath:e.path};if(!D(e))return;const s=e({$form:n,$item:o,$index:i,errors:void 0,touched:void 0,translate:void 0});if(s.type!=="repeater")return;const c={...s,uid:e.uid};return{repeater:St(c,r),declaredPath:s.path}}function St(e,t){const r=t[t.length-1];return At(e,t.map(n=>n.index),n=>Cr(n,r))}function Er(e,t){return At(e,t,r=>wr(r,t))}function At(e,t,r){const n=Re(e.uid,t);if(D(e)){const o=i=>e(i);return o.uid=n,o.type=e.type,e.path!==void 0&&(o.path=r(e.path)),o}return I(e)?{...e,uid:n,path:r(e.path)}:{...e,uid:n}}function Re(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,o)=>`${n}[${o}]`,"");return`${e}${r}`}function wr(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=e.split("."),n=r.map((o,i)=>i>0&&o===we?i:-1).filter(o=>o!==-1);if(n.length!==t.length)throw new Error(`Path contains ${n.length} '${we}' occurrences, but ${t.length} indexes were provided.`);return n.forEach((o,i)=>{r[o]=String(t[i])}),r.join(".")}function Cr(e,t){const r=t.declaredItemPath;if(e!==r&&!e.startsWith(`${r}.`))throw new Error(`Path "${e}" is not inside the repeater row "${r}".`);return`${t.itemPath}${e.slice(r.length)}`}function Ir(e,t){let r=e;for(let n=t.length-1;n>=0;n--)r=Or(r,t[n]);return r}function Or(e,t){const r=t.declaredItemPath.split("."),n=t.itemPath.split(".");return e.replace(jr(t.declaredItemPath),(o,i,s,...c)=>{const d=c.slice(0,r.length-1),a=n.map((f,h)=>h===0?f:d[h-1]+f).join("");return`${i}${s??""}${a}`})}const qe=new Map;function jr(e){let t=qe.get(e);if(t===void 0){const r=e.split(".").map(Pr);t=new RegExp(`(^|[^\\w$.])(\\$form\\??\\.)?${r.join("(\\??\\.)")}(?![\\w$])`,"g"),qe.set(e,t)}return t}function Pr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Qe=["include","exclude","disabled","readonly"];function kr(e,t){if(!Qe.some(o=>Je(e[o])))return e;const n={...e};for(const o of Qe){const i=n[o];Je(i)&&(n[o]={...i,when:Ir(i.when,t)})}return n}function Je(e){return e!==null&&typeof e=="object"&&"when"in e&&typeof e.when=="string"}const Dr=50,Wr=e=>{let t=e.data,r=Ce(e.flatForm,t);for(let n=0;n<Dr;n++){let o=!1;for(const i of Object.values(r.resolvedSources))!I(i)||vr(t,i.path)||(t=yt(t,i.path,B(i.defaultValue)),i.defaultValue!==void 0&&(o=!0));if(!o)break;r=Ce(e.flatForm,t)}return{...e,data:t,...r}},Te=32;let Ie,m,g,v=e=>(m=0,g=e,v.newline=!1,e=S(),g[m]?M():e||""),M=(e="Unexpected token",t=m,r=g.slice(0,t).split(`
2
2
  `),n=r.pop(),o=g.slice(Math.max(0,t-40),t),i="̭",s=(g[t]||" ")+i,c=g.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
3
  ${g[t-41]!==`
4
4
  `,""+o}${s}${c}`)},Et=(e,t=m)=>(Array.isArray(e)&&(e.loc=t),e),H=(e,t=m,r)=>{for(;r=e(g.charCodeAt(m));)m+=r;return g.slice(t,m)},w=(e=1)=>g[m+=e],Oe=e=>m=e,S=(e=0,t)=>{let r,n,o,i,s;for(t&&v.asi&&(v.newline=!1);(r=v.space())&&(s=v.newline,1)&&r!==t&&(o=(n&&r===91&&Ie&&v.asi?.(n,e,S)||null)??((i=j[r])&&i(n,e))??(n&&s&&v.asi?.(n,e,S))??(!n&&H(v.id)));)n=o;return t&&(r==t?(m++,t===125&&v.asi&&(v.newline=!0)):M("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},T=(e,t=m)=>{for(Ie=!1;(e=g.charCodeAt(m))<=Te;)v.asi&&e===10&&(v.newline=Ie=!0),m++;return e},Fr=(e=m)=>{for(;g.charCodeAt(e)<=Te;)e++;return g.charCodeAt(e)};v.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Rr=(e,t=e.length)=>g.substr(m,t)===e&&!v.id(g.charCodeAt(m+t)),j=[],Ze={},O=(e,t=Te,r,n=e.charCodeAt(0),o=e.length,i=j[n],s=e.toUpperCase()!==e,c,d)=>(t=Ze[e]=!i&&Ze[e]||t,j[n]=(a,f,h,y=m)=>(c=h,(h?e==h:(o<2||e.charCodeAt(1)===g.charCodeAt(m+1)&&(o<3||g.substr(m,o)==e))&&(!s||!v.id(g.charCodeAt(m+o)))&&(c=h=e))&&f<t&&(m+=o,(d=r(a))?Et(d,y):(m=y,c=0,!s&&!i&&!a&&M()),d)||i?.(a,f,c))),$=(e,t,r=!1)=>O(e,t,n=>n&&(o=>o&&[e,n,o])(S(t-(r?.5:0)))),N=(e,t,r)=>O(e,t,n=>!n&&(n=S(t-.5))&&[e,n]),Q=(e,t)=>O(e,200,r=>!r&&[,t]),wt=(e,t,r)=>O(e,t,(n,o)=>(o=S(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),o?.[0]===e?n.push(...o.slice(1)):n.push(o||null),n)),Ve=(e,t)=>O(e[0],t,r=>!r&&[e,S(0,e.charCodeAt(1))||null]),Ct=(e,t)=>O(e[0],t,r=>r&&[e,r,S(0,e.charCodeAt(1))||null]),J=(e,t,r,n=e.charCodeAt(0),o=e.length,i=j[n],s)=>j[n]=(c,d,a,f=m)=>!c&&(a?e==a:(o<2||g.substr(m,o)==e)&&(a=e))&&d<t&&!v.id(g.charCodeAt(m+o))&&(!v.prop||v.prop(m+o))&&(Oe(m+o),(s=r())?Et(s,f):Oe(f),s)||i?.(c,d,a);Object.defineProperty(v,"space",{configurable:!0,enumerable:!0,get:()=>T,set:e=>T=e});const je={},p=(e,t,r=je[e])=>je[e]=(...n)=>t(...n)||r?.(...n),u=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):je[e[0]]?.(...e.slice(1))??M(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],ne=46,K=48,oe=57,Tr=69,Vr=101,Nr=43,Lr=45,ee=95,It=110,_r=97,Mr=102,Ur=65,Hr=70,Ot=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),Ne=e=>{let t=Ot(H(r=>r===ne&&g.charCodeAt(m+1)!==ne||r>=K&&r<=oe||r===ee||((r===Tr||r===Vr)&&((r=g.charCodeAt(m+1))>=K&&r<=oe||r===Nr||r===Lr)?2:0)));return g.charCodeAt(m)===It?(w(),[,BigInt(t)]):(e=+t)!=e?M():[,e]},br={2:e=>e===48||e===49||e===ee,8:e=>e>=48&&e<=55||e===ee,16:e=>e>=K&&e<=oe||e>=_r&&e<=Mr||e>=Ur&&e<=Hr||e===ee};v.number=null;j[ne]=e=>!e&&g.charCodeAt(m+1)!==ne&&Ne();for(let e=K;e<=oe;e++)j[e]=t=>t?void 0:Ne();j[K]=e=>{if(e)return;const t=v.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&g[m+1]?.toLowerCase()===r[1]){w(2);const o=Ot(H(br[n]));return g.charCodeAt(m)===It?(w(),[,BigInt("0"+r[1]+o)]):[,parseInt(o,n)]}}return Ne()};const zr=92,Ye=34,et=39,Br={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},jt=e=>(t,r,n="")=>{if(!(t||!v.string?.[String.fromCharCode(e)]))return w(),H(o=>o-e&&(o===zr?(n+=Br[g[m+1]]||g[m+1],2):(n+=g[m],1))),g[m]===String.fromCharCode(e)?w():M("Bad string"),[,n]};j[Ye]=jt(Ye);j[et]=jt(et);v.string={'"':!0};const Gr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>$(e,Gr,!0));const Pt=(e,t,r,n)=>typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o),o)):e[0]==="()"&&e.length===2?Pt(e[1],t):(()=>{throw Error("Invalid assignment target")})(),tt={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in tt)p(e,(t,r)=>(r=u(r),Pt(t,(n,o,i)=>tt[e](n,o,r(i)))));const Kr=30,xr=40,Xr=140;N("!",Xr);$("||",Kr);$("&&",xr);p("!",e=>(e=u(e),t=>!e(t)));p("||",(e,t)=>(e=u(e),t=u(t),r=>e(r)||t(r)));p("&&",(e,t)=>(e=u(e),t=u(t),r=>e(r)&&t(r)));const qr=50,Qr=60,Jr=70,kt=100,Zr=140;$("|",qr);$("&",Jr);$("^",Qr);$(">>",kt);$("<<",kt);N("~",Zr);p("~",e=>(e=u(e),t=>~e(t)));p("|",(e,t)=>(e=u(e),t=u(t),r=>e(r)|t(r)));p("&",(e,t)=>(e=u(e),t=u(t),r=>e(r)&t(r)));p("^",(e,t)=>(e=u(e),t=u(t),r=>e(r)^t(r)));p(">>",(e,t)=>(e=u(e),t=u(t),r=>e(r)>>t(r)));p("<<",(e,t)=>(e=u(e),t=u(t),r=>e(r)<<t(r)));const he=90;$("<",he);$(">",he);$("<=",he);$(">=",he);p(">",(e,t)=>(e=u(e),t=u(t),r=>e(r)>t(r)));p("<",(e,t)=>(e=u(e),t=u(t),r=>e(r)<t(r)));p(">=",(e,t)=>(e=u(e),t=u(t),r=>e(r)>=t(r)));p("<=",(e,t)=>(e=u(e),t=u(t),r=>e(r)<=t(r)));const Dt=80;$("==",Dt);$("!=",Dt);p("==",(e,t)=>(e=u(e),t=u(t),r=>e(r)==t(r)));p("!=",(e,t)=>(e=u(e),t=u(t),r=>e(r)!=t(r)));const Wt=110,Le=120,Ft=140;$("+",Wt);$("-",Wt);$("*",Le);$("/",Le);$("%",Le);N("+",Ft);N("-",Ft);p("+",(e,t)=>t!==void 0?(e=u(e),t=u(t),r=>e(r)+t(r)):(e=u(e),r=>+e(r)));p("-",(e,t)=>t!==void 0?(e=u(e),t=u(t),r=>e(r)-t(r)):(e=u(e),r=>-e(r)));p("*",(e,t)=>(e=u(e),t=u(t),r=>e(r)*t(r)));p("/",(e,t)=>(e=u(e),t=u(t),r=>e(r)/t(r)));p("%",(e,t)=>(e=u(e),t=u(t),r=>e(r)%t(r)));const ie=150;O("++",ie,e=>e?["++",e,null]:["++",S(ie-1)]);O("--",ie,e=>e?["--",e,null]:["--",S(ie-1)]);const _e=(e,t,r,n)=>typeof e=="string"?o=>t(o,e):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n)):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o))):e[0]==="()"&&e.length===2?_e(e[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(e,t)=>_e(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));p("--",(e,t)=>_e(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Yr=5,en=10;wt(",",en);wt(";",Yr,!0);const Rt=(...e)=>(e=e.map(u),t=>{let r;for(const n of e)r=n(t);return r});p(",",Rt);p(";",Rt);const tn=170;Ve("()",tn);const F=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",Me=170;Ct("[]",Me);$(".",Me);Ct("()",Me);const se=e=>{throw Error(e)};p("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=u(r[1]),n=>r(n)):(r=u(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&se("Missing index"),e=u(e),t=u(t),r=>{const n=t(r);return F(n)?void 0:e(r)[n]}));p(".",(e,t)=>(e=u(e),t=t[0]?t:t[1],F(t)?()=>{}:r=>e(r)[t]));p("()",(e,t)=>{if(t===void 0)return e==null?se("Empty ()"):u(e);const r=o=>o?.[0]===","&&o.slice(1).some(i=>i==null||r(i));r(t)&&se("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(u),o=>t.map(i=>i(o))):(t=u(t),o=>[t(o)]):()=>[];return Ue(e,(o,i,s)=>o[i](...n(s)))});const U=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&U(e[1])||e[0]==="{}"),Ue=(e,t,r,n)=>e==null?se("Empty ()"):e[0]==="()"&&e.length==2?Ue(e[1],t):typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="?."?(r=u(e[1]),n=e[2],o=>{const i=r(o);return i==null?void 0:t(i,n,o)}):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o),o)):e[0]==="?.[]"?(r=u(e[1]),n=u(e[2]),o=>{const i=r(o);return i==null?void 0:t(i,n(o),o)}):(e=u(e),o=>t([e(o)],0,o)),b=Ue,rn=32,nn=v.space;v.comment??={"//":`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},jt=e=>(t,r,n="")=>{if(!(t||!v.string?.[String.fromCharCode(e)]))return w(),H(o=>o-e&&(o===zr?(n+=Br[g[m+1]]||g[m+1],2):(n+=g[m],1))),g[m]===String.fromCharCode(e)?w():M("Bad string"),[,n]};j[Ye]=jt(Ye);j[et]=jt(et);v.string={'"':!0};const Gr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>$(e,Gr,!0));const Pt=(e,t,r,n)=>typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o),o)):e[0]==="()"&&e.length===2?Pt(e[1],t):(()=>{throw Error("Invalid assignment target")})(),tt={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in tt)p(e,(t,r)=>(r=u(r),Pt(t,(n,o,i)=>tt[e](n,o,r(i)))));const Kr=30,Xr=40,xr=140;N("!",xr);$("||",Kr);$("&&",Xr);p("!",e=>(e=u(e),t=>!e(t)));p("||",(e,t)=>(e=u(e),t=u(t),r=>e(r)||t(r)));p("&&",(e,t)=>(e=u(e),t=u(t),r=>e(r)&&t(r)));const qr=50,Qr=60,Jr=70,kt=100,Zr=140;$("|",qr);$("&",Jr);$("^",Qr);$(">>",kt);$("<<",kt);N("~",Zr);p("~",e=>(e=u(e),t=>~e(t)));p("|",(e,t)=>(e=u(e),t=u(t),r=>e(r)|t(r)));p("&",(e,t)=>(e=u(e),t=u(t),r=>e(r)&t(r)));p("^",(e,t)=>(e=u(e),t=u(t),r=>e(r)^t(r)));p(">>",(e,t)=>(e=u(e),t=u(t),r=>e(r)>>t(r)));p("<<",(e,t)=>(e=u(e),t=u(t),r=>e(r)<<t(r)));const he=90;$("<",he);$(">",he);$("<=",he);$(">=",he);p(">",(e,t)=>(e=u(e),t=u(t),r=>e(r)>t(r)));p("<",(e,t)=>(e=u(e),t=u(t),r=>e(r)<t(r)));p(">=",(e,t)=>(e=u(e),t=u(t),r=>e(r)>=t(r)));p("<=",(e,t)=>(e=u(e),t=u(t),r=>e(r)<=t(r)));const Dt=80;$("==",Dt);$("!=",Dt);p("==",(e,t)=>(e=u(e),t=u(t),r=>e(r)==t(r)));p("!=",(e,t)=>(e=u(e),t=u(t),r=>e(r)!=t(r)));const Wt=110,Le=120,Ft=140;$("+",Wt);$("-",Wt);$("*",Le);$("/",Le);$("%",Le);N("+",Ft);N("-",Ft);p("+",(e,t)=>t!==void 0?(e=u(e),t=u(t),r=>e(r)+t(r)):(e=u(e),r=>+e(r)));p("-",(e,t)=>t!==void 0?(e=u(e),t=u(t),r=>e(r)-t(r)):(e=u(e),r=>-e(r)));p("*",(e,t)=>(e=u(e),t=u(t),r=>e(r)*t(r)));p("/",(e,t)=>(e=u(e),t=u(t),r=>e(r)/t(r)));p("%",(e,t)=>(e=u(e),t=u(t),r=>e(r)%t(r)));const ie=150;O("++",ie,e=>e?["++",e,null]:["++",S(ie-1)]);O("--",ie,e=>e?["--",e,null]:["--",S(ie-1)]);const _e=(e,t,r,n)=>typeof e=="string"?o=>t(o,e):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n)):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o))):e[0]==="()"&&e.length===2?_e(e[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(e,t)=>_e(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));p("--",(e,t)=>_e(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Yr=5,en=10;wt(",",en);wt(";",Yr,!0);const Rt=(...e)=>(e=e.map(u),t=>{let r;for(const n of e)r=n(t);return r});p(",",Rt);p(";",Rt);const tn=170;Ve("()",tn);const F=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",Me=170;Ct("[]",Me);$(".",Me);Ct("()",Me);const se=e=>{throw Error(e)};p("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=u(r[1]),n=>r(n)):(r=u(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&se("Missing index"),e=u(e),t=u(t),r=>{const n=t(r);return F(n)?void 0:e(r)[n]}));p(".",(e,t)=>(e=u(e),t=t[0]?t:t[1],F(t)?()=>{}:r=>e(r)[t]));p("()",(e,t)=>{if(t===void 0)return e==null?se("Empty ()"):u(e);const r=o=>o?.[0]===","&&o.slice(1).some(i=>i==null||r(i));r(t)&&se("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(u),o=>t.map(i=>i(o))):(t=u(t),o=>[t(o)]):()=>[];return Ue(e,(o,i,s)=>o[i](...n(s)))});const U=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&U(e[1])||e[0]==="{}"),Ue=(e,t,r,n)=>e==null?se("Empty ()"):e[0]==="()"&&e.length==2?Ue(e[1],t):typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=u(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="?."?(r=u(e[1]),n=e[2],o=>{const i=r(o);return i==null?void 0:t(i,n,o)}):e[0]==="[]"&&e.length===3?(r=u(e[1]),n=u(e[2]),o=>t(r(o),n(o),o)):e[0]==="?.[]"?(r=u(e[1]),n=u(e[2]),o=>{const i=r(o);return i==null?void 0:t(i,n(o),o)}):(e=u(e),o=>t([e(o)],0,o)),b=Ue,rn=32,nn=v.space;v.comment??={"//":`
6
6
  `,"/*":"*/"};let ve;v.space=()=>{ve||(ve=Object.entries(v.comment).map(([o,i])=>[o,i,o.charCodeAt(0)]));for(var e;e=nn();){for(var t=0,r;r=ve[t++];)if(e===r[2]&&g.substr(m,r[0].length)===r[0]){var n=m+r[0].length;if(r[1]===`
7
- `)for(;g.charCodeAt(n)>=rn;)n++;else{for(;g[n]&&g.substr(n,r[1].length)!==r[1];)n++;g[n]&&(n+=r[1].length)}Oe(n),e=0;break}if(e)return e}return e};const Tt=80;$("===",Tt);$("!==",Tt);p("===",(e,t)=>(e=u(e),t=u(t),r=>e(r)===t(r)));p("!==",(e,t)=>(e=u(e),t=u(t),r=>e(r)!==t(r)));const on=30;$("??",on);p("??",(e,t)=>(e=u(e),t=u(t),r=>e(r)??t(r)));const sn=130,cn=20;$("**",sn,!0);$("**=",cn,!0);p("**",(e,t)=>(e=u(e),t=u(t),r=>e(r)**t(r)));const dn=e=>{throw Error(e)};p("**=",(e,t)=>(U(e)||dn("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]**=t(o))));const Vt=90;$("in",Vt);$("of",Vt);p("in",(e,t)=>(e=u(e),t=u(t),r=>e(r)in t(r)));const un=20,ln=100,an=e=>{throw Error(e)};$(">>>",ln);$(">>>=",un,!0);p(">>>",(e,t)=>(e=u(e),t=u(t),r=>e(r)>>>t(r)));p(">>>=",(e,t)=>(U(e)||an("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]>>>=t(o))));const He=5,fn=10,pn=20,hn=e=>e[0]?.[0]===","?e[0].slice(1):e,ce=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...o]=e,i=hn(o);if(n==="{}"){const s=[];for(const c of i){if(Array.isArray(c)&&c[0]==="..."){const y={};for(const A in t)s.includes(A)||(y[A]=t[A]);r[c[1]]=y;break}let d,a,f;typeof c=="string"?d=a=c:c[0]==="="?(typeof c[1]=="string"?d=a=c[1]:[,d,a]=c[1],f=c[2]):[,d,a]=c,s.push(d);let h=t[d];h===void 0&&f&&(h=u(f)(r)),ce(a,h,r)}}else if(n==="[]"){let s=0;for(const c of i){if(c===null){s++;continue}if(Array.isArray(c)&&c[0]==="..."){r[c[1]]=t.slice(s);break}let d=c,a;Array.isArray(c)&&c[0]==="="&&([,d,a]=c);let f=t[s++];f===void 0&&a&&(f=u(a)(r)),ce(d,f,r)}}},Nt=e=>{let t=S(fn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};J("let",He+1,()=>Nt("let"));J("const",He+1,()=>Nt("const"));J("var",He,()=>(T(),["var",S(pn)]));const Lt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,o=u(n);return typeof r=="string"?i=>{i[r]=o(i)}:i=>ce(r,o(i),i)}return u(t)}),t=>{for(const r of e)r(t)});p("let",Lt);p("const",Lt);p("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const be=20,me=e=>{throw Error(e)};$("||=",be,!0);$("&&=",be,!0);$("??=",be,!0);p("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=u(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>ce(r,t(n),n)}return U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]=t(o))});p("||=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]||=t(o))));p("&&=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]&&=t(o))));p("??=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]??=t(o))));Q("true",!0);Q("false",!1);Q("null",null);J("undefined",200,()=>[]);Q("NaN",NaN);Q("Infinity",1/0);const $e=20;O("?",$e,(e,t,r)=>e&&(t=S($e-1))&&H(n=>n===58)&&(r=S($e-1),["?",e,t,r]));p("?",(e,t,r)=>(e=u(e),t=u(t),r=u(r),n=>e(n)?t(n):r(n)));const mn=[],gn=20;$("=>",gn,!0);p("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,o=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,o=i[1],r.length--);const s=t?.[0]==="{}";return t=u(s?["{",t[1]]:t),c=>(...d)=>{const a={};r.forEach((h,y)=>a[h]=d[y]),o&&(a[o]=d.slice(n));const f=new Proxy(a,{get:(h,y)=>y in h?h[y]:c?.[y],set:(h,y,A)=>((y in h?h:c)[y]=A,!0),has:(h,y)=>y in h||(c?y in c:!1)});try{const h=t(f);return s?void 0:h}catch(h){if(h===mn)return h[0];throw h}}});const yn=140;N("...",yn);p("...",e=>(e=u(e),t=>Object.entries(e(t))));const rt=170;O("?.",rt,(e,t)=>{if(!e)return;const r=T();return r===40?(w(),["?.()",e,S(0,41)||null]):r===91?(w(),["?.[]",e,S(0,93)]):(t=S(rt),t?["?.",e,t]:void 0)});p("?.",(e,t)=>(e=u(e),F(t)?()=>{}:r=>e(r)?.[t]));p("?.[]",(e,t)=>(e=u(e),t=u(t),r=>{const n=t(r);return F(n)?void 0:e(r)?.[n]}));p("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(u),o=>t.map(i=>i(o))):(t=u(t),o=>[t(o)]):()=>[];if(e[0]==="?."){const o=u(e[1]),i=e[2];return F(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="?.[]"){const o=u(e[1]),i=u(e[2]);return s=>{const c=o(s),d=i(s);return F(d)?void 0:c?.[d]?.(...r(s))}}if(e[0]==="."){const o=u(e[1]),i=e[2];return F(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const o=u(e[1]),i=u(e[2]);return s=>{const c=o(s),d=i(s);return F(d)?void 0:c?.[d]?.(...r(s))}}const n=u(e);return o=>n(o)?.(...r(o))});const x=140;N("typeof",x);N("void",x);N("delete",x);J("new",x,()=>Rr(".target")?(w(7),["new.target"]):["new",S(x)]);p("typeof",e=>(e=u(e),t=>typeof e(t)));p("void",e=>(e=u(e),t=>(e(t),void 0)));p("delete",e=>{if(e[0]==="."){const t=u(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=u(e[1]),r=u(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});p("new",e=>{const t=u(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(o=>i=>o.map(s=>s(i)))(r.slice(1).map(u)):(o=>i=>[o(i)])(u(r)):()=>[];return o=>new(t(o))(...n(o))});const ze=Symbol("accessor"),Be=20,vn=40,_t=41,Mt=123,Ut=125,Ht=e=>t=>{if(t)return;T();const r=H(v.id);if(!r||(T(),g.charCodeAt(m)!==vn))return!1;w();const n=S(0,_t);return T(),g.charCodeAt(m)!==Mt?!1:(w(),[e,r,n,S(0,Ut)])};O("get",Be-1,Ht("get"));O("set",Be-1,Ht("set"));O("(",Be-1,e=>{if(!e||typeof e!="string")return;const t=S(0,_t)||null;if(T(),g.charCodeAt(m)===Mt)return w(),[":",e,["=>",["()",t],S(0,Ut)||null]]});p("get",(e,t)=>(t=t?u(t):()=>{},r=>[[ze,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));p("set",(e,t,r)=>(r=r?u(r):()=>{},n=>[[ze,e,{set:function(o){const i=Object.create(n||{});i.this=this,i[t]=o,r(i)}}]]));const $n=20,bt=200;v.prop=e=>Fr(e)!==58;const Sn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);Ve("[]",bt);Ve("{}",bt);$(":",$n-1,!0);p("{}",(e,t)=>{if(t!==void 0)return;if(!Sn(e))return u(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>u(typeof n=="string"?[":",n,n]:n));return n=>{const o={},i={};for(const s of r.flatMap(c=>c(n)))if(s[0]===ze){const[,c,d]=s;i[c]={...i[c],...d,configurable:!0,enumerable:!0}}else o[s[0]]=s[1];for(const s in i)Object.defineProperty(o,s,i[s]);return o}});p("{",e=>(e=e?u(e):()=>{},t=>e(Object.create(t))));p(":",(e,t)=>(t=u(t),Array.isArray(e)?(e=u(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const An=170,de=96,En=36,wn=123,Cn=92,In={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},nt=()=>{const e=[];for(let t="",r;(r=g.charCodeAt(m))!==de;)r?r===Cn?(w(),t+=In[g[m]]||g[m],w()):r===En&&g.charCodeAt(m+1)===wn?(t&&e.push([,t]),t="",w(2),e.push(S(0,125))):(t+=g[m],w(),r=g.charCodeAt(m),r===de&&t&&e.push([,t])):M("Unterminated template");return w(),e},On=j[de];j[de]=(e,t)=>e&&t<An?v.asi&&v.newline?void 0:(w(),["``",e,...nt()]):e?On?.(e,t):(w(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(nt()));p("`",(...e)=>(e=e.map(u),t=>e.map(r=>r(t)).join("")));p("``",(e,...t)=>{e=u(e);const r=[],n=[];for(const i of t)Array.isArray(i)&&i[0]===void 0?r.push(i[1]):n.push(u(i));const o=Object.assign([...r],{raw:r});return i=>e(i)(o,...n.map(s=>s(i)))});v.string["'"]=!0;v.number={"0x":16,"0b":2,"0o":8};const jn={log:(e,t)=>(t?console.log(t,e):console.log(e),e)},Pn=2e3,Z=new Map;function Ge(e){const t=Z.get(e);if(t!==void 0)return t;const r=u(v(kn(e)));return Z.size>=Pn&&Z.clear(),Z.set(e,r),r}function z(e,t,r,n,o,i){return Ge(e)({$form:t,$meta:r,$errors:n,$formIsInvalid:o,$log:jn.log,$fn:{},...i})===!0}function kn(e){return e.replace(/(\?\.|\.)(\d+)/g,(t,r,n,o)=>r==="."&&Dn(e,o)?t:r==="?."?`?.[${n}]`:`[${n}]`)}function Dn(e,t){let r=t-1,n=!1;for(;r>=0&&e[r]>="0"&&e[r]<="9";)n=!0,r--;if(r<0)return!0;const o=e[r];return n?!/[\w$.\]]/.test(o):!/[\w$)\]]/.test(o)}const Wn=e=>(t,r)=>{let n=t.formDef.states;if(!n||Object.keys(n).length===0||t.formHealth.status==="errored")return t;const{$formIsInvalid:o,$errors:i}=r??fe(t);n=Fn(n);let s=[],c={status:"ok"};try{s=Object.keys(n).map(d=>{const a=n[d];let f;try{f=z(a,t.data,t.meta,i,o,{$fn:e})}catch{f=!1}return f===!0?d:void 0}).filter(d=>d!==void 0)}catch(d){const a=d,f=C.calculateCurrentStateError;c={status:"errored",message:`[${f}] ${a.message}`,code:f}}return{...t,currentStates:s,formHealth:c}};function Fn(e){const t={};function r(n){const o=n.split(":"),i=[];for(let s=0;s<o.length;s++)i.push(o.slice(0,s+1).join(":"));return i}for(const[n,o]of Object.entries(e)){const i=r(n),s=[];for(const c of i)e[c]&&s.push(`(${e[c]})`);t[n]=s.join(" && ")}return t}const X=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e;function ot(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ue(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,n)=>ue(r,t[n]));if(ot(e)&&ot(t)){const r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>n in t&&ue(e[n],t[n]))}return!1}const Rn=e=>(t,r)=>{const{$formIsInvalid:n,$errors:o}=r??fe(t);return{...t,widgetFlags:Tn(t,o,n,e)}};function Tn(e,t,r,n){const o=[];for(const[s,c]of Object.entries(e.resolvedSources))if(D(c)){const d=ct(s,c,e);it(d)&&o.push(d)}else it(c)&&o.push(ct(s,c,e));const i=o.reduce((s,c)=>{s[c.uid]=s[c.uid]||{};const d=e.repeaterItemScopes[c.uid],a=d?{$item:V(e.data,d.itemPath),$index:d.index,$fn:n}:{$fn:n};return c.include&&"in"in c.include?s[c.uid].hidden=!c.include.in.some(f=>e.currentStates.includes(f)):c.include&&"when"in c.include&&(s[c.uid].hidden=!z(c.include.when,e.data,e.meta,t,r,a)),c.exclude&&"from"in c.exclude?s[c.uid].hidden=c.exclude.from.some(f=>e.currentStates.includes(f)):c.exclude&&"when"in c.exclude&&(s[c.uid].hidden=z(c.exclude.when,e.data,e.meta,t,r,a)),(I(c)||te(c))&&X(c.disabled)&&(s[c.uid].disabled=z(c.disabled.when,e.data,e.meta,t,r,a)),I(c)&&X(c.readonly)&&(s[c.uid].readonly=z(c.readonly.when,e.data,e.meta,t,r,a)),s},{});return Vn(e,i),i}function it(e){return!!(e.include&&("in"in e.include||"when"in e.include)||e.exclude&&("from"in e.exclude||"when"in e.exclude)||(I(e)||te(e))&&X(e.disabled)||I(e)&&X(e.readonly))}function Vn(e,t){const r=Object.keys(t).filter(n=>t[n].hidden===!0);for(const n of r)zt(n,e,t)}function zt(e,t,r){const n=t.resolvedSources[e];if(n!==void 0){if(G(n)||D(n)&&n.path!==void 0){const o=`${n.path}.`;for(const[i,s]of Object.entries(t.repeaterItemScopes))s.itemPath.startsWith(o)&&st(i,r)}if(_(n)){const o=pe(e);for(const i of n.children){const s=o.length>0?Re(i.uid,o):i.uid;if(t.resolvedSources[s]===void 0)continue;const c=r[s]?.hidden===!0;st(s,r),c||zt(s,t,r)}}}}function st(e,t){t[e]=t[e]||{},t[e].hidden=!0}function ct(e,t,r){const n=r.repeaterItemScopes[e];let o;D(t)?(o={...t({$form:r.data,$item:n?V(r.data,n.itemPath):void 0,$index:n?.index,errors:void 0,touched:void 0,translate:void 0})},o.uid=e):o=t;const i=r.repeaterRows[e];return i!==void 0&&(o=kr(o,i)),o}const Bt=(e,t)=>(r,n)=>{try{const o=n??fe(r);return{...r,calculatedWidgets:Nn(r,e,t,o)}}catch(o){const i=o,s=i.code??C.calculateWidgetPropsError;return{...r,formHealth:{status:"errored",message:`[${s}] ${i.message}`,code:s}}}};function Nn(e,t,r,{$formIsInvalid:n,$errors:o}){const i=to(e,t,n,o,r),s={};for(const c of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[c]?.hidden)continue;const d=e.calculatedWidgets[c],a=d.source,f=e.repeaterItemScopes[c];if(D(a)){s[c]=Ln(d,c,a,e,t,f);continue}const h=f?{...i,$item:V(i.$form,f.itemPath),$index:f.index}:i;s[c]=_n(d,a,e,h)}return s}function Ln(e,t,r,n,o,i){const s={...r({$form:n.data,errors:r.path?n.validations[r.path]:void 0,touched:r.path?n.touchedControls[r.path]:void 0,translate:o.translate,$item:i?V(n.data,i.itemPath):void 0,$index:i?.index})};s.uid=t,r.path!==void 0&&(s.path=r.path);const c=n.widgetPropOverrides[t];return c!==void 0&&(s.props={...s.props,...c}),e.current&&ue(e.current,s)?e:{source:r,current:s}}function _n(e,t,r,n){const o=new eo(t,e.current);return o.write("uid",t.uid),o.write("type",t.type),o.write("kind",t.kind),tr(t)?Mn(o,n):te(t)?Un(o,n):I(t)?Hn(o,n):_(t)&&bn(o,n),zn(t,o,n,r),(te(t)||I(t))&&Bn(t,o,n),_(t)&&Gn(t,o,r),o.changed?{source:e.source,current:o.current}:e}function Mn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function Un(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Hn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function bn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function zn(e,t,r,n){const o=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...o};for(const s of xt(Object.keys(i)))Kn(t,r,s)}function Bn(e,t,r){const n=e.on??{};for(const o of xt(Object.keys(n)))xn(t,r,o)}function Gn(e,t,r){const n=pe(e.uid),o=no(e.children,n,r.widgetFlags);t.current.children=o;const i=t.previous.children??[];i.length===o.length&&o.every((c,d)=>i[d]&&i[d].uid===o[d].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!ro(n,r))return;const o=xe(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Qn(o,t,e.source.uid,r);break;case"defaultValue":i=o;break;default:i=Kt(o,t)}e.write(r,i)}function Kn(e,t,r){const n=e.source.props,o=xe(n,r,t.sortedStates);let i=Kt(o,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(i=s),e.write(`props.${r}`,i)}function xn(e,t,r){const n=e.source.on,o=xe(n,r,t.sortedStates);e.write(`on.${r}`,Jn(o,t))}function Ke(e,t){return e({$form:t.$form,translate:t.localization.translate,$item:t.$item,$index:t.$index})}function Xn(e,t){return t.localization.translate(e.key,Yn(e.params,t),e.default)}const qn=/\{\{([^}]+)\}\}/g;function Gt(e,t){return e.includes("{{")?e.replace(qn,(r,n)=>{try{const o=Ge(n.trim())({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid,$item:t.$item,$index:t.$index,$fn:t.$fn});return o==null?"":String(o)}catch(o){const i=o instanceof Error?o.message:String(o);throw new Xt(`Failed to evaluate '{{${n.trim()}}}': ${i}`)}}):e}function Kt(e,t){return typeof e=="function"?Ke(e,t):mr(e)?Xn(e,t):typeof e=="string"?Gt(e,t):e}function Qn(e,t,r,n){return typeof e=="function"?Ke(e,t):X(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Gt(e,t):e}function Jn(e,t){return typeof e=="function"?Ke(e,t):e}function xe(e,t,r){if(e){for(const n of r){const o=e[`${t}.${n}`];if(o!==void 0)return o}return e[t]}}function Zn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e.startsWith("$item")||e.startsWith("$index")||e.startsWith("$fn")||e==="$formIsInvalid"}function Yn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const o=String(e[n]);if(Zn(o))try{const i=Ge(o)({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid,$item:t.$item,$index:t.$index,$fn:t.$fn});r[n]=i??o}catch(i){const s=i instanceof Error?i.message:String(i);throw new Xt(`Failed to evaluate i18n param '${o}': ${s}`)}else r[n]=o;return r},{})}class eo{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){const n=V(this.previous,t);if(ue(n,r)){Ee(this.current,t,n);return}Ee(this.current,t,r),this._changed=!0}}function to(e,t,r,n,o){return{sortedStates:[...e.currentStates].sort((i,s)=>s.length-i.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t,$fn:o}}function ro(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function xt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function no(e,t,r){const n=t.map(o=>`[${o}]`).join("");return e.filter(o=>{const i=o.uid+n,s=r[i];return!s||s.hidden!==!0})}class Xt extends Error{constructor(){super(...arguments),this.code=C.resolveStringInterpolationError,this.name="StringInterpolationError"}}const oo=e=>{const t=io(e.resolvedSources),r=Y(e.widgetPropOverrides,s=>s in e.resolvedSources),n=Y(e.touchedControls,s=>t.has(s)),o=Y(e.validations,s=>t.has(s)),i=Y(e.injectedValidations,s=>t.has(s));return r===e.widgetPropOverrides&&n===e.touchedControls&&o===e.validations&&i===e.injectedValidations?e:{...e,widgetPropOverrides:r,touchedControls:n,validations:o,injectedValidations:i}};function io(e){const t=new Set;for(const r of Object.values(e)){const n=R(r);n!==void 0&&t.add(n)}return t}function Y(e,t){const r=Object.keys(e).filter(t);if(r.length===Object.keys(e).length)return e;const n={};for(const o of r)n[o]=e[o];return n}const so=e=>{const t=Object.keys(e.resolvedSources),r={};let n=t.length!==Object.keys(e.calculatedWidgets).length;for(const o of t){const i=e.calculatedWidgets[o];i?r[o]=i:(r[o]={source:e.resolvedSources[o],current:{}},n=!0)}return n?{...e,calculatedWidgets:r}:e},co=({lang:e},t)=>{const r={...mt(e),formName:t.payload.formName};let n=t.payload.formDef,o={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(f){const h=f,y=C.initializeParseError;o={status:"errored",message:`[${y}] ${h.message}`,code:y}}if(o.status==="errored")return{...r,formHealth:o}}let i=n;if(Array.isArray(n.form)){const f=n.form;i={...n,form:{uid:"",type:"flex",kind:"layout",children:f}}}const s=ht.decode(i);if(s.isOk()){o={status:"ok"};let f={};try{f=Fe([s.value.form]).reduce((h,y)=>{const A=y.uid;if(h[A])throw{existingWidget:h[A],newWidget:y};return h[A]=y,h},{})}catch(h){o=ao(h.existingWidget,h.newWidget),f={}}return fo(f,s.value.states),{...r,formDef:s.value,flatForm:f,...Ce(f,{}),formHealth:o}}const c=lo(n);if(c)return{...r,formHealth:c};const d=C.initializeUnknownError,a=s.issues.map(f=>`${f.path.length>0?l.formatIssuePath(f.path):"root"}: ${f.message}`).join("; ");return{...r,formHealth:{status:"errored",message:`[${d}] ${a}`,code:d}}};function qt(e,t){return{status:"errored",code:e,message:`[${e}] ${t}`}}function uo(){return"Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`."}function lo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.form;return t&&typeof t=="object"&&!Array.isArray(t)&&!_(t)?qt(C.initializeMalformedFormShapeError,uo()):null}function ao(e,t){const r=o=>I(o)?` at "${o.path}"`:"",n=`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;return qt(C.initializeUidCollisionError,n)}function fo(e,t){const r=new Set(Object.keys(t??{})),n=new Map;for(const i of Object.values(e)){const s=[],c=i.include;c&&Array.isArray(c.in)&&s.push(...c.in);const d=i.exclude;d&&Array.isArray(d.from)&&s.push(...d.from);for(const a of s){if(r.has(a))continue;const f=n.get(a)??[];f.push(i.uid||"(unknown)"),n.set(a,f)}}if(n.size===0)return;const o=r.size?[...r].join(", "):"(none declared)";for(const[i,s]of n)console.error(`[GolemUI] include/exclude references undefined state "${i}" (on ${s.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${i}" in formConfig.states, or correct the name.`)}function po(e,t){const{path:r,issues:n}=t.payload,o=n?.length?{touched:!0,touchedControls:{...e.touchedControls,[r]:!0}}:{};return{...e,...o,injectedValidations:{...e.injectedValidations,[r]:n}}}const ho=(e,{payload:t})=>{const r="path"in t?go(e,t.path):mo(e,t.uid);if(r===void 0)return e;const n=e.widgetPropOverrides[r]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[r]:{...n,[t.prop]:t.value}}}};function mo(e,t){if(t in e.resolvedSources)return t;console.warn(`Widget with uid "${t}" not found`)}function go(e,t){const r=Object.values(e.calculatedWidgets).find(({source:o,current:i})=>(R(i)??R(o))===t);if(r)return r.source.uid;const n=Object.keys(e.resolvedSources).find(o=>R(e.resolvedSources[o])===t);if(n!==void 0)return n;console.warn(`Input with path "${t}" not found`)}const yo=(e,t)=>({...e,data:{...t.payload.data}}),vo=(e,t)=>({...e,formHealth:t.payload.formHealth}),$o=(e,t)=>({...e,lang:t.payload.lang}),So=(e,t)=>({...e,meta:{...t.payload.meta}}),Ao=(e,t)=>({...e,data:yt(e.data,t.payload.path,t.payload.data)}),Qt=Symbol("filterMap.skip");function Eo(e,t){const r=[];for(let n=0;n<e.length;n++){const o=t(e[n],n,e);o!==Qt&&r.push(o)}return r}function wo(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function Co(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}const Io=(e,t)=>r=>{const n=Eo(Object.values(r.calculatedWidgets),({current:i})=>I(i)?i:Qt),o=r.validations;return{...r,validations:n.reduce((i,s)=>{if(i[s.path]=null,s.validator){const c=e(s.validator,t),d=V(r.data,s.path),a=at(c,d);i[s.path]=ft(a)?null:a.issues.map(f=>f.message)}return Array.isArray(i[s.path])&&Array.isArray(o[s.path])&&Co(i[s.path],o[s.path],(c,d)=>c===d)&&(i[s.path]=o[s.path]),i},{})}},Oo=({validators:e,validateOn:t,localization:r,functions:n})=>{const o=ko(r,n),i=Io(e,r),s=Bt(r,n),c=a=>dt(a,o,i,!1),d=a=>dt(a,o,i,!0);return(a,f)=>{switch(f.type){case"INITIALIZE":return co(a,f);case"SET_DATA":return c(yo(a,f));case"SET_META":return c(So(a,f));case"SET_WIDGET_DATA":return c(Ao(a,f));case"SET_LANGUAGE":return s($o(a,f));case"OVERRIDE_WIDGET_PROP":{const h=ho(a,f);if(h===a)return a;const y=c(h);return Ro(y,f)?i(y):y}case"SET_FORM_HEALTH":return vo(a,f);case"VALIDATE_ALL":return d(i(Wo(a)));case"ATTEMPT_VALIDATION":{if(!Fo(t,f.payload.reason))return a;const h={...a,touched:!0,touchedControls:{...a.touchedControls,[f.payload.path]:!0}};return d(i(h))}case"INJECT_VALIDATION_ISSUES":return po(a,f);default:return yr(f)}}},jo=new Set([C.calculateCurrentStateError,C.calculateWidgetFlagsError,C.calculateWidgetPropsError,C.resolveStringInterpolationError]),Po=e=>e.formHealth.status==="errored"&&!jo.has(e.formHealth.code);function ko(e,t){const r=Wn(t),n=Rn(t),o=Bt(e,t);return function(s){if(Po(s))return s;const c=d=>({...s,formHealth:d});try{let d=s.formHealth.status==="ok"?s:{...s,formHealth:{status:"ok"}};d=Wr(d),d=oo(d);const a=fe(d);return d=r(d,a),d.formHealth.status!=="ok"?c(d.formHealth):(d=n(d,a),d=so(d),d=o(d,a),d.formHealth.status==="ok"?d:c(d.formHealth))}catch(d){const a=C.calculateWidgetFlagsError;return c({status:"errored",code:a,message:`[${a}] ${d.message}`})}}}function dt(e,t,r,n){const o=f=>n?ut(f):f,i=e.resolvedSources,s=e.widgetFlags;let c=t(e);if(!c.allControlsValidated||c.formHealth.status!=="ok")return o(c);const d=Do(c,i,s);if(d.length===0)return o(c);const a={...c.touchedControls};for(const f of d)a[f]=!0;return c={...c,touchedControls:a},ut(t(r(c)))}function Do(e,t,r){const n=[];for(const[o,i]of Object.entries(e.resolvedSources)){const s=R(i);if(s===void 0||e.widgetFlags[o]?.hidden===!0||e.touchedControls[s]===!0)continue;const c=t[o]===void 0,d=r[o]?.hidden===!0;(c||d)&&n.push(s)}return n}function Wo(e){const t={};for(const{source:r,current:n}of Object.values(e.calculatedWidgets)){const o=R(n)??R(r);o!==void 0&&(t[o]=!0)}return{...e,touched:!0,allControlsValidated:!0,touchedControls:t}}function Fo(e,t){return e==="eager"||t===e||Array.isArray(e)&&e.includes(t)}function Ro(e,t){if(!e.touched)return!1;let r;if("path"in t.payload)r=t.payload.path;else{const n=e.calculatedWidgets[t.payload.uid]?.current;n&&I(n)&&(r=n.path)}return r!==void 0&&e.touchedControls[r]===!0}function ut(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(o=>{const i=e.injectedValidations[o];return Array.isArray(i)&&i.length>0});return n!==void 0?{...e,isFormValid:!1}:(n=r.find(o=>{const i=e.validations[o];return Array.isArray(i)&&i.length>0}),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function To(e=[],t,r,n,o={}){const i=new k.BehaviorSubject(mt(n.lang)),s=i.asObservable().pipe(k.distinctUntilChanged()),c=Oo({validators:t,validateOn:r,localization:n,functions:o});function d(y){const A=i.getValue(),L=c(A,y);i.next(L)}let a=d;const f={getState:()=>i.getValue(),dispatch:y=>a(y)};return a=e.map(y=>y(f)).reduceRight((y,A)=>A(y),d),{state$:s,dispatch:a,getState:()=>i.getValue()}}class Vo{constructor(){this.widgetRegistry=new re,this.store={},this.events$=new k.Subject,this.submit$=new k.Subject,this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,o,i,s=gt(),c,d={}){this.localization=s,this.dependencies=c,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=To(r,n,o,s,d)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(this.attemptValidation(t,r),i.length>0)i.forEach(s=>{const c=r.on?.[`${t}.${s}`];c&&this.events$.next({name:c,data:ye(this.store.getState()),detail:n??void 0,callback:d=>{this.store.dispatch(d)}})});else{const s=r.on?.[t];s&&this.events$.next({name:s,data:ye(this.store.getState()),detail:n,callback:c=>{this.store.dispatch(c)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:ye(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function No(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),o=>i=>{o(i),n&&n.send(i,t.getState())}}}const Lo=k.pipe(k.map(e=>e.formHealth),k.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),_o=e=>e.pipe(Lo);function Mo(e,t){return Yt(e,t,Zt(e,t),void 0)}function Jt(){const e=new Map;return(t,r)=>{const n=Zt(t,r),o=e.get(r);if(o&&zo(o.slices,n))return o.viewModel;const i=Yt(t,r,n,o);return e.set(r,{slices:n,viewModel:i}),i}}const Uo=e=>t=>{const r=Jt();return t.pipe(k.map(n=>r(n,e)),k.distinctUntilChanged())},Ho=[],lt=[],bo=[];function Zt(e,t){const r=Bo(e,t);return[e.calculatedWidgets[t],e.lang,r===void 0?void 0:V(e.data,r),r!==void 0&&e.touched?e.validations[r]:null,r!==void 0&&e.touched?e.injectedValidations[r]:null,r!==void 0&&e.touchedControls[r]===!0,e.touched&&!e.isFormValid,e.widgetFlags[t]?.hidden===!0]}function zo(e,t){return e.every((r,n)=>Object.is(r,t[n]))}function Yt(e,t,r,n){const[o,i,s,c,d,a,f,h]=r,y=n===void 0||!Object.is(n.slices[0],o),A=n===void 0||!Object.is(n.slices[2],s),L=n===void 0||!Object.is(n.slices[3],c)||!Object.is(n.slices[4],d),ge=o?.current;return{uid:t,widget:ge,children:y?Go(e,t,ge):n.viewModel.children,rows:y||A?Ko(e,t,ge,s):n.viewModel.rows,lang:i,value:s,errors:L?xo(c,d):n.viewModel.errors,touched:a,formInvalid:f,hidden:h}}function Bo(e,t){return e.resolvedSources[t]?.path}function Go(e,t,r){if(r===void 0||!_(r))return Ho;const n=r.children,o=pe(t);if(o.length===0)return n;const i=o.map(s=>`[${s}]`).join("");return n.map(s=>e.resolvedSources[`${s.uid}${i}`]??s)}function Ko(e,t,r,n){if(r===void 0||!Array.isArray(n))return lt;const o=e.resolvedSources[t];if(o===void 0||!G(o))return lt;const i=o.props.template.uid,s=pe(t);return n.map((c,d)=>{const a=Re(i,[...s,d]);return e.resolvedSources[a]}).filter(c=>c!==void 0)}function xo(e,t){return(e?.length??0)+(t?.length??0)===0?bo:[...e??[],...t??[]]}let er=!1;function Xo(){er=!0}function qo(){return er}function Qo(e,t,r){if(!qo())return;const n=Object.keys(t??{}).filter(o=>o in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}const Jo=()=>crypto.randomUUID().slice(0,8);exports.FormContext=Vo;exports.assertNoPropCollisions=Qo;exports.cloneObject=B;exports.createWidgetViewModelReader=Jt;exports.defineForm=pr;exports.devToolsMiddleware=No;exports.enableDevMode=Xo;exports.errorCodes=C;exports.filterTap=wo;exports.formEventNames=hr;exports.formHealth=_o;exports.getDirectionFromLanguage=gr;exports.identityTranslator=gt;exports.isStandardValidateSuccess=ft;exports.makeRepeaterItemConfig=Er;exports.preloadFormWidgets=ar;exports.shortUUID=Jo;exports.standardValidate=at;exports.widgetViewModel=Mo;exports.widgetViewModel$=Uo;
7
+ `)for(;g.charCodeAt(n)>=rn;)n++;else{for(;g[n]&&g.substr(n,r[1].length)!==r[1];)n++;g[n]&&(n+=r[1].length)}Oe(n),e=0;break}if(e)return e}return e};const Tt=80;$("===",Tt);$("!==",Tt);p("===",(e,t)=>(e=u(e),t=u(t),r=>e(r)===t(r)));p("!==",(e,t)=>(e=u(e),t=u(t),r=>e(r)!==t(r)));const on=30;$("??",on);p("??",(e,t)=>(e=u(e),t=u(t),r=>e(r)??t(r)));const sn=130,cn=20;$("**",sn,!0);$("**=",cn,!0);p("**",(e,t)=>(e=u(e),t=u(t),r=>e(r)**t(r)));const dn=e=>{throw Error(e)};p("**=",(e,t)=>(U(e)||dn("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]**=t(o))));const Vt=90;$("in",Vt);$("of",Vt);p("in",(e,t)=>(e=u(e),t=u(t),r=>e(r)in t(r)));const un=20,ln=100,an=e=>{throw Error(e)};$(">>>",ln);$(">>>=",un,!0);p(">>>",(e,t)=>(e=u(e),t=u(t),r=>e(r)>>>t(r)));p(">>>=",(e,t)=>(U(e)||an("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]>>>=t(o))));const He=5,fn=10,pn=20,hn=e=>e[0]?.[0]===","?e[0].slice(1):e,ce=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...o]=e,i=hn(o);if(n==="{}"){const s=[];for(const c of i){if(Array.isArray(c)&&c[0]==="..."){const y={};for(const A in t)s.includes(A)||(y[A]=t[A]);r[c[1]]=y;break}let d,a,f;typeof c=="string"?d=a=c:c[0]==="="?(typeof c[1]=="string"?d=a=c[1]:[,d,a]=c[1],f=c[2]):[,d,a]=c,s.push(d);let h=t[d];h===void 0&&f&&(h=u(f)(r)),ce(a,h,r)}}else if(n==="[]"){let s=0;for(const c of i){if(c===null){s++;continue}if(Array.isArray(c)&&c[0]==="..."){r[c[1]]=t.slice(s);break}let d=c,a;Array.isArray(c)&&c[0]==="="&&([,d,a]=c);let f=t[s++];f===void 0&&a&&(f=u(a)(r)),ce(d,f,r)}}},Nt=e=>{let t=S(fn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};J("let",He+1,()=>Nt("let"));J("const",He+1,()=>Nt("const"));J("var",He,()=>(T(),["var",S(pn)]));const Lt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,o=u(n);return typeof r=="string"?i=>{i[r]=o(i)}:i=>ce(r,o(i),i)}return u(t)}),t=>{for(const r of e)r(t)});p("let",Lt);p("const",Lt);p("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const be=20,me=e=>{throw Error(e)};$("||=",be,!0);$("&&=",be,!0);$("??=",be,!0);p("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=u(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>ce(r,t(n),n)}return U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]=t(o))});p("||=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]||=t(o))));p("&&=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]&&=t(o))));p("??=",(e,t)=>(U(e)||me("Invalid assignment target"),t=u(t),b(e,(r,n,o)=>r[n]??=t(o))));Q("true",!0);Q("false",!1);Q("null",null);J("undefined",200,()=>[]);Q("NaN",NaN);Q("Infinity",1/0);const $e=20;O("?",$e,(e,t,r)=>e&&(t=S($e-1))&&H(n=>n===58)&&(r=S($e-1),["?",e,t,r]));p("?",(e,t,r)=>(e=u(e),t=u(t),r=u(r),n=>e(n)?t(n):r(n)));const mn=[],gn=20;$("=>",gn,!0);p("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,o=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,o=i[1],r.length--);const s=t?.[0]==="{}";return t=u(s?["{",t[1]]:t),c=>(...d)=>{const a={};r.forEach((h,y)=>a[h]=d[y]),o&&(a[o]=d.slice(n));const f=new Proxy(a,{get:(h,y)=>y in h?h[y]:c?.[y],set:(h,y,A)=>((y in h?h:c)[y]=A,!0),has:(h,y)=>y in h||(c?y in c:!1)});try{const h=t(f);return s?void 0:h}catch(h){if(h===mn)return h[0];throw h}}});const yn=140;N("...",yn);p("...",e=>(e=u(e),t=>Object.entries(e(t))));const rt=170;O("?.",rt,(e,t)=>{if(!e)return;const r=T();return r===40?(w(),["?.()",e,S(0,41)||null]):r===91?(w(),["?.[]",e,S(0,93)]):(t=S(rt),t?["?.",e,t]:void 0)});p("?.",(e,t)=>(e=u(e),F(t)?()=>{}:r=>e(r)?.[t]));p("?.[]",(e,t)=>(e=u(e),t=u(t),r=>{const n=t(r);return F(n)?void 0:e(r)?.[n]}));p("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(u),o=>t.map(i=>i(o))):(t=u(t),o=>[t(o)]):()=>[];if(e[0]==="?."){const o=u(e[1]),i=e[2];return F(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="?.[]"){const o=u(e[1]),i=u(e[2]);return s=>{const c=o(s),d=i(s);return F(d)?void 0:c?.[d]?.(...r(s))}}if(e[0]==="."){const o=u(e[1]),i=e[2];return F(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const o=u(e[1]),i=u(e[2]);return s=>{const c=o(s),d=i(s);return F(d)?void 0:c?.[d]?.(...r(s))}}const n=u(e);return o=>n(o)?.(...r(o))});const X=140;N("typeof",X);N("void",X);N("delete",X);J("new",X,()=>Rr(".target")?(w(7),["new.target"]):["new",S(X)]);p("typeof",e=>(e=u(e),t=>typeof e(t)));p("void",e=>(e=u(e),t=>(e(t),void 0)));p("delete",e=>{if(e[0]==="."){const t=u(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=u(e[1]),r=u(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});p("new",e=>{const t=u(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(o=>i=>o.map(s=>s(i)))(r.slice(1).map(u)):(o=>i=>[o(i)])(u(r)):()=>[];return o=>new(t(o))(...n(o))});const ze=Symbol("accessor"),Be=20,vn=40,_t=41,Mt=123,Ut=125,Ht=e=>t=>{if(t)return;T();const r=H(v.id);if(!r||(T(),g.charCodeAt(m)!==vn))return!1;w();const n=S(0,_t);return T(),g.charCodeAt(m)!==Mt?!1:(w(),[e,r,n,S(0,Ut)])};O("get",Be-1,Ht("get"));O("set",Be-1,Ht("set"));O("(",Be-1,e=>{if(!e||typeof e!="string")return;const t=S(0,_t)||null;if(T(),g.charCodeAt(m)===Mt)return w(),[":",e,["=>",["()",t],S(0,Ut)||null]]});p("get",(e,t)=>(t=t?u(t):()=>{},r=>[[ze,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));p("set",(e,t,r)=>(r=r?u(r):()=>{},n=>[[ze,e,{set:function(o){const i=Object.create(n||{});i.this=this,i[t]=o,r(i)}}]]));const $n=20,bt=200;v.prop=e=>Fr(e)!==58;const Sn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);Ve("[]",bt);Ve("{}",bt);$(":",$n-1,!0);p("{}",(e,t)=>{if(t!==void 0)return;if(!Sn(e))return u(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>u(typeof n=="string"?[":",n,n]:n));return n=>{const o={},i={};for(const s of r.flatMap(c=>c(n)))if(s[0]===ze){const[,c,d]=s;i[c]={...i[c],...d,configurable:!0,enumerable:!0}}else o[s[0]]=s[1];for(const s in i)Object.defineProperty(o,s,i[s]);return o}});p("{",e=>(e=e?u(e):()=>{},t=>e(Object.create(t))));p(":",(e,t)=>(t=u(t),Array.isArray(e)?(e=u(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const An=170,de=96,En=36,wn=123,Cn=92,In={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},nt=()=>{const e=[];for(let t="",r;(r=g.charCodeAt(m))!==de;)r?r===Cn?(w(),t+=In[g[m]]||g[m],w()):r===En&&g.charCodeAt(m+1)===wn?(t&&e.push([,t]),t="",w(2),e.push(S(0,125))):(t+=g[m],w(),r=g.charCodeAt(m),r===de&&t&&e.push([,t])):M("Unterminated template");return w(),e},On=j[de];j[de]=(e,t)=>e&&t<An?v.asi&&v.newline?void 0:(w(),["``",e,...nt()]):e?On?.(e,t):(w(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(nt()));p("`",(...e)=>(e=e.map(u),t=>e.map(r=>r(t)).join("")));p("``",(e,...t)=>{e=u(e);const r=[],n=[];for(const i of t)Array.isArray(i)&&i[0]===void 0?r.push(i[1]):n.push(u(i));const o=Object.assign([...r],{raw:r});return i=>e(i)(o,...n.map(s=>s(i)))});v.string["'"]=!0;v.number={"0x":16,"0b":2,"0o":8};const jn={log:(e,t)=>(t?console.log(t,e):console.log(e),e)},Pn=2e3,Z=new Map;function Ge(e){const t=Z.get(e);if(t!==void 0)return t;const r=u(v(kn(e)));return Z.size>=Pn&&Z.clear(),Z.set(e,r),r}function z(e,t,r,n,o,i){return Ge(e)({$form:t,$meta:r,$errors:n,$formIsInvalid:o,$log:jn.log,$fn:{},...i})===!0}function kn(e){return e.replace(/(\?\.|\.)(\d+)/g,(t,r,n,o)=>r==="."&&Dn(e,o)?t:r==="?."?`?.[${n}]`:`[${n}]`)}function Dn(e,t){let r=t-1,n=!1;for(;r>=0&&e[r]>="0"&&e[r]<="9";)n=!0,r--;if(r<0)return!0;const o=e[r];return n?!/[\w$.\]]/.test(o):!/[\w$)\]]/.test(o)}const Wn=e=>(t,r)=>{let n=t.formDef.states;if(!n||Object.keys(n).length===0||t.formHealth.status==="errored")return t;const{$formIsInvalid:o,$errors:i}=r??fe(t);n=Fn(n);let s=[],c={status:"ok"};try{s=Object.keys(n).map(d=>{const a=n[d];let f;try{f=z(a,t.data,t.meta,i,o,{$fn:e})}catch{f=!1}return f===!0?d:void 0}).filter(d=>d!==void 0)}catch(d){const a=d,f=C.calculateCurrentStateError;c={status:"errored",message:`[${f}] ${a.message}`,code:f}}return{...t,currentStates:s,formHealth:c}};function Fn(e){const t={};function r(n){const o=n.split(":"),i=[];for(let s=0;s<o.length;s++)i.push(o.slice(0,s+1).join(":"));return i}for(const[n,o]of Object.entries(e)){const i=r(n),s=[];for(const c of i)e[c]&&s.push(`(${e[c]})`);t[n]=s.join(" && ")}return t}const x=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e;function ot(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ue(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,n)=>ue(r,t[n]));if(ot(e)&&ot(t)){const r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>n in t&&ue(e[n],t[n]))}return!1}const Rn=e=>(t,r)=>{const{$formIsInvalid:n,$errors:o}=r??fe(t);return{...t,widgetFlags:Tn(t,o,n,e)}};function Tn(e,t,r,n){const o=[];for(const[s,c]of Object.entries(e.resolvedSources))if(D(c)){const d=ct(s,c,e);it(d)&&o.push(d)}else it(c)&&o.push(ct(s,c,e));const i=o.reduce((s,c)=>{s[c.uid]=s[c.uid]||{};const d=e.repeaterItemScopes[c.uid],a=d?{$item:V(e.data,d.itemPath),$index:d.index,$fn:n}:{$fn:n};return c.include&&"in"in c.include?s[c.uid].hidden=!c.include.in.some(f=>e.currentStates.includes(f)):c.include&&"when"in c.include&&(s[c.uid].hidden=!z(c.include.when,e.data,e.meta,t,r,a)),c.exclude&&"from"in c.exclude?s[c.uid].hidden=c.exclude.from.some(f=>e.currentStates.includes(f)):c.exclude&&"when"in c.exclude&&(s[c.uid].hidden=z(c.exclude.when,e.data,e.meta,t,r,a)),(I(c)||te(c))&&x(c.disabled)&&(s[c.uid].disabled=z(c.disabled.when,e.data,e.meta,t,r,a)),I(c)&&x(c.readonly)&&(s[c.uid].readonly=z(c.readonly.when,e.data,e.meta,t,r,a)),s},{});return Vn(e,i),i}function it(e){return!!(e.include&&("in"in e.include||"when"in e.include)||e.exclude&&("from"in e.exclude||"when"in e.exclude)||(I(e)||te(e))&&x(e.disabled)||I(e)&&x(e.readonly))}function Vn(e,t){const r=Object.keys(t).filter(n=>t[n].hidden===!0);for(const n of r)zt(n,e,t)}function zt(e,t,r){const n=t.resolvedSources[e];if(n!==void 0){if(G(n)||D(n)&&n.path!==void 0){const o=`${n.path}.`;for(const[i,s]of Object.entries(t.repeaterItemScopes))s.itemPath.startsWith(o)&&st(i,r)}if(_(n)){const o=pe(e);for(const i of n.children){const s=o.length>0?Re(i.uid,o):i.uid;if(t.resolvedSources[s]===void 0)continue;const c=r[s]?.hidden===!0;st(s,r),c||zt(s,t,r)}}}}function st(e,t){t[e]=t[e]||{},t[e].hidden=!0}function ct(e,t,r){const n=r.repeaterItemScopes[e];let o;D(t)?(o={...t({$form:r.data,$item:n?V(r.data,n.itemPath):void 0,$index:n?.index,errors:void 0,touched:void 0,translate:void 0})},o.uid=e):o=t;const i=r.repeaterRows[e];return i!==void 0&&(o=kr(o,i)),o}const Bt=(e,t)=>(r,n)=>{try{const o=n??fe(r);return{...r,calculatedWidgets:Nn(r,e,t,o)}}catch(o){const i=o,s=i.code??C.calculateWidgetPropsError;return{...r,formHealth:{status:"errored",message:`[${s}] ${i.message}`,code:s}}}};function Nn(e,t,r,{$formIsInvalid:n,$errors:o}){const i=to(e,t,n,o,r),s={};for(const c of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[c]?.hidden)continue;const d=e.calculatedWidgets[c],a=d.source,f=e.repeaterItemScopes[c];if(D(a)){s[c]=Ln(d,c,a,e,t,f);continue}const h=f?{...i,$item:V(i.$form,f.itemPath),$index:f.index}:i;s[c]=_n(d,a,e,h)}return s}function Ln(e,t,r,n,o,i){const s={...r({$form:n.data,errors:r.path?n.validations[r.path]:void 0,touched:r.path?n.touchedControls[r.path]:void 0,translate:o.translate,$item:i?V(n.data,i.itemPath):void 0,$index:i?.index})};s.uid=t,r.path!==void 0&&(s.path=r.path);const c=n.widgetPropOverrides[t];return c!==void 0&&(s.props={...s.props,...c}),e.current&&ue(e.current,s)?e:{source:r,current:s}}function _n(e,t,r,n){const o=new eo(t,e.current);return o.write("uid",t.uid),o.write("type",t.type),o.write("kind",t.kind),tr(t)?Mn(o,n):te(t)?Un(o,n):I(t)?Hn(o,n):_(t)&&bn(o,n),zn(t,o,n,r),(te(t)||I(t))&&Bn(t,o,n),_(t)&&Gn(t,o,r),o.changed?{source:e.source,current:o.current}:e}function Mn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function Un(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Hn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function bn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function zn(e,t,r,n){const o=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...o};for(const s of Xt(Object.keys(i)))Kn(t,r,s)}function Bn(e,t,r){const n=e.on??{};for(const o of Xt(Object.keys(n)))Xn(t,r,o)}function Gn(e,t,r){const n=pe(e.uid),o=no(e.children,n,r.widgetFlags);t.current.children=o;const i=t.previous.children??[];i.length===o.length&&o.every((c,d)=>i[d]&&i[d].uid===o[d].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!ro(n,r))return;const o=Xe(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Qn(o,t,e.source.uid,r);break;case"defaultValue":i=o;break;default:i=Kt(o,t)}e.write(r,i)}function Kn(e,t,r){const n=e.source.props,o=Xe(n,r,t.sortedStates);let i=Kt(o,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(i=s),e.write(`props.${r}`,i)}function Xn(e,t,r){const n=e.source.on,o=Xe(n,r,t.sortedStates);e.write(`on.${r}`,Jn(o,t))}function Ke(e,t){return e({$form:t.$form,translate:t.localization.translate,$item:t.$item,$index:t.$index})}function xn(e,t){return t.localization.translate(e.key,Yn(e.params,t),e.default)}const qn=/\{\{([^}]+)\}\}/g;function Gt(e,t){return e.includes("{{")?e.replace(qn,(r,n)=>{try{const o=Ge(n.trim())({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid,$item:t.$item,$index:t.$index,$fn:t.$fn});return o==null?"":String(o)}catch(o){const i=o instanceof Error?o.message:String(o);throw new xt(`Failed to evaluate '{{${n.trim()}}}': ${i}`)}}):e}function Kt(e,t){return typeof e=="function"?Ke(e,t):mr(e)?xn(e,t):typeof e=="string"?Gt(e,t):e}function Qn(e,t,r,n){return typeof e=="function"?Ke(e,t):x(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Gt(e,t):e}function Jn(e,t){return typeof e=="function"?Ke(e,t):e}function Xe(e,t,r){if(e){for(const n of r){const o=e[`${t}.${n}`];if(o!==void 0)return o}return e[t]}}function Zn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e.startsWith("$item")||e.startsWith("$index")||e.startsWith("$fn")||e==="$formIsInvalid"}function Yn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const o=String(e[n]);if(Zn(o))try{const i=Ge(o)({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid,$item:t.$item,$index:t.$index,$fn:t.$fn});r[n]=i??o}catch(i){const s=i instanceof Error?i.message:String(i);throw new xt(`Failed to evaluate i18n param '${o}': ${s}`)}else r[n]=o;return r},{})}class eo{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){const n=V(this.previous,t);if(ue(n,r)){Ee(this.current,t,n);return}Ee(this.current,t,r),this._changed=!0}}function to(e,t,r,n,o){return{sortedStates:[...e.currentStates].sort((i,s)=>s.length-i.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t,$fn:o}}function ro(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function Xt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function no(e,t,r){const n=t.map(o=>`[${o}]`).join("");return e.filter(o=>{const i=o.uid+n,s=r[i];return!s||s.hidden!==!0})}class xt extends Error{constructor(){super(...arguments),this.code=C.resolveStringInterpolationError,this.name="StringInterpolationError"}}const oo=e=>{const t=io(e.resolvedSources),r=Y(e.widgetPropOverrides,s=>s in e.resolvedSources),n=Y(e.touchedControls,s=>t.has(s)),o=Y(e.validations,s=>t.has(s)),i=Y(e.injectedValidations,s=>t.has(s));return r===e.widgetPropOverrides&&n===e.touchedControls&&o===e.validations&&i===e.injectedValidations?e:{...e,widgetPropOverrides:r,touchedControls:n,validations:o,injectedValidations:i}};function io(e){const t=new Set;for(const r of Object.values(e)){const n=R(r);n!==void 0&&t.add(n)}return t}function Y(e,t){const r=Object.keys(e).filter(t);if(r.length===Object.keys(e).length)return e;const n={};for(const o of r)n[o]=e[o];return n}const so=e=>{const t=Object.keys(e.resolvedSources),r={};let n=t.length!==Object.keys(e.calculatedWidgets).length;for(const o of t){const i=e.calculatedWidgets[o];i?r[o]=i:(r[o]={source:e.resolvedSources[o],current:{}},n=!0)}return n?{...e,calculatedWidgets:r}:e},co=({lang:e},t)=>{const r={...mt(e),formName:t.payload.formName};let n=t.payload.formDef,o={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(f){const h=f,y=C.initializeParseError;o={status:"errored",message:`[${y}] ${h.message}`,code:y}}if(o.status==="errored")return{...r,formHealth:o}}let i=n;if(Array.isArray(n.form)){const f=n.form;i={...n,form:{uid:"",type:"grid",kind:"layout",children:f}}}const s=ht.decode(i);if(s.isOk()){o={status:"ok"};let f={};try{f=Fe([s.value.form]).reduce((h,y)=>{const A=y.uid;if(h[A])throw{existingWidget:h[A],newWidget:y};return h[A]=y,h},{})}catch(h){o=ao(h.existingWidget,h.newWidget),f={}}return fo(f,s.value.states),{...r,formDef:s.value,flatForm:f,...Ce(f,{}),formHealth:o}}const c=lo(n);if(c)return{...r,formHealth:c};const d=C.initializeUnknownError,a=s.issues.map(f=>`${f.path.length>0?l.formatIssuePath(f.path):"root"}: ${f.message}`).join("; ");return{...r,formHealth:{status:"errored",message:`[${d}] ${a}`,code:d}}};function qt(e,t){return{status:"errored",code:e,message:`[${e}] ${t}`}}function uo(){return"Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`."}function lo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.form;return t&&typeof t=="object"&&!Array.isArray(t)&&!_(t)?qt(C.initializeMalformedFormShapeError,uo()):null}function ao(e,t){const r=o=>I(o)?` at "${o.path}"`:"",n=`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;return qt(C.initializeUidCollisionError,n)}function fo(e,t){const r=new Set(Object.keys(t??{})),n=new Map;for(const i of Object.values(e)){const s=[],c=i.include;c&&Array.isArray(c.in)&&s.push(...c.in);const d=i.exclude;d&&Array.isArray(d.from)&&s.push(...d.from);for(const a of s){if(r.has(a))continue;const f=n.get(a)??[];f.push(i.uid||"(unknown)"),n.set(a,f)}}if(n.size===0)return;const o=r.size?[...r].join(", "):"(none declared)";for(const[i,s]of n)console.error(`[GolemUI] include/exclude references undefined state "${i}" (on ${s.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${i}" in formConfig.states, or correct the name.`)}function po(e,t){const{path:r,issues:n}=t.payload,o=n?.length?{touched:!0,touchedControls:{...e.touchedControls,[r]:!0}}:{};return{...e,...o,injectedValidations:{...e.injectedValidations,[r]:n}}}const ho=(e,{payload:t})=>{const r="path"in t?go(e,t.path):mo(e,t.uid);if(r===void 0)return e;const n=e.widgetPropOverrides[r]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[r]:{...n,[t.prop]:t.value}}}};function mo(e,t){if(t in e.resolvedSources)return t;console.warn(`Widget with uid "${t}" not found`)}function go(e,t){const r=Object.values(e.calculatedWidgets).find(({source:o,current:i})=>(R(i)??R(o))===t);if(r)return r.source.uid;const n=Object.keys(e.resolvedSources).find(o=>R(e.resolvedSources[o])===t);if(n!==void 0)return n;console.warn(`Input with path "${t}" not found`)}const yo=(e,t)=>({...e,data:{...t.payload.data}}),vo=(e,t)=>({...e,formHealth:t.payload.formHealth}),$o=(e,t)=>({...e,lang:t.payload.lang}),So=(e,t)=>({...e,meta:{...t.payload.meta}}),Ao=(e,t)=>({...e,data:yt(e.data,t.payload.path,t.payload.data)}),Qt=Symbol("filterMap.skip");function Eo(e,t){const r=[];for(let n=0;n<e.length;n++){const o=t(e[n],n,e);o!==Qt&&r.push(o)}return r}function wo(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function Co(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}const Io=(e,t)=>r=>{const n=Eo(Object.values(r.calculatedWidgets),({current:i})=>I(i)?i:Qt),o=r.validations;return{...r,validations:n.reduce((i,s)=>{if(i[s.path]=null,s.validator){const c=e(s.validator,t),d=V(r.data,s.path),a=at(c,d);i[s.path]=ft(a)?null:a.issues.map(f=>f.message)}return Array.isArray(i[s.path])&&Array.isArray(o[s.path])&&Co(i[s.path],o[s.path],(c,d)=>c===d)&&(i[s.path]=o[s.path]),i},{})}},Oo=({validators:e,validateOn:t,localization:r,functions:n})=>{const o=ko(r,n),i=Io(e,r),s=Bt(r,n),c=a=>dt(a,o,i,!1),d=a=>dt(a,o,i,!0);return(a,f)=>{switch(f.type){case"INITIALIZE":return co(a,f);case"SET_DATA":return c(yo(a,f));case"SET_META":return c(So(a,f));case"SET_WIDGET_DATA":return c(Ao(a,f));case"SET_LANGUAGE":return s($o(a,f));case"OVERRIDE_WIDGET_PROP":{const h=ho(a,f);if(h===a)return a;const y=c(h);return Ro(y,f)?i(y):y}case"SET_FORM_HEALTH":return vo(a,f);case"VALIDATE_ALL":return d(i(Wo(a)));case"ATTEMPT_VALIDATION":{if(!Fo(t,f.payload.reason))return a;const h={...a,touched:!0,touchedControls:{...a.touchedControls,[f.payload.path]:!0}};return d(i(h))}case"INJECT_VALIDATION_ISSUES":return po(a,f);default:return yr(f)}}},jo=new Set([C.calculateCurrentStateError,C.calculateWidgetFlagsError,C.calculateWidgetPropsError,C.resolveStringInterpolationError]),Po=e=>e.formHealth.status==="errored"&&!jo.has(e.formHealth.code);function ko(e,t){const r=Wn(t),n=Rn(t),o=Bt(e,t);return function(s){if(Po(s))return s;const c=d=>({...s,formHealth:d});try{let d=s.formHealth.status==="ok"?s:{...s,formHealth:{status:"ok"}};d=Wr(d),d=oo(d);const a=fe(d);return d=r(d,a),d.formHealth.status!=="ok"?c(d.formHealth):(d=n(d,a),d=so(d),d=o(d,a),d.formHealth.status==="ok"?d:c(d.formHealth))}catch(d){const a=C.calculateWidgetFlagsError;return c({status:"errored",code:a,message:`[${a}] ${d.message}`})}}}function dt(e,t,r,n){const o=f=>n?ut(f):f,i=e.resolvedSources,s=e.widgetFlags;let c=t(e);if(!c.allControlsValidated||c.formHealth.status!=="ok")return o(c);const d=Do(c,i,s);if(d.length===0)return o(c);const a={...c.touchedControls};for(const f of d)a[f]=!0;return c={...c,touchedControls:a},ut(t(r(c)))}function Do(e,t,r){const n=[];for(const[o,i]of Object.entries(e.resolvedSources)){const s=R(i);if(s===void 0||e.widgetFlags[o]?.hidden===!0||e.touchedControls[s]===!0)continue;const c=t[o]===void 0,d=r[o]?.hidden===!0;(c||d)&&n.push(s)}return n}function Wo(e){const t={};for(const{source:r,current:n}of Object.values(e.calculatedWidgets)){const o=R(n)??R(r);o!==void 0&&(t[o]=!0)}return{...e,touched:!0,allControlsValidated:!0,touchedControls:t}}function Fo(e,t){return e==="eager"||t===e||Array.isArray(e)&&e.includes(t)}function Ro(e,t){if(!e.touched)return!1;let r;if("path"in t.payload)r=t.payload.path;else{const n=e.calculatedWidgets[t.payload.uid]?.current;n&&I(n)&&(r=n.path)}return r!==void 0&&e.touchedControls[r]===!0}function ut(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(o=>{const i=e.injectedValidations[o];return Array.isArray(i)&&i.length>0});return n!==void 0?{...e,isFormValid:!1}:(n=r.find(o=>{const i=e.validations[o];return Array.isArray(i)&&i.length>0}),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function To(e=[],t,r,n,o={}){const i=new k.BehaviorSubject(mt(n.lang)),s=i.asObservable().pipe(k.distinctUntilChanged()),c=Oo({validators:t,validateOn:r,localization:n,functions:o});function d(y){const A=i.getValue(),L=c(A,y);i.next(L)}let a=d;const f={getState:()=>i.getValue(),dispatch:y=>a(y)};return a=e.map(y=>y(f)).reduceRight((y,A)=>A(y),d),{state$:s,dispatch:a,getState:()=>i.getValue()}}class Vo{constructor(){this.widgetRegistry=new re,this.store={},this.events$=new k.Subject,this.submit$=new k.Subject,this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,o,i,s=gt(),c,d={}){this.localization=s,this.dependencies=c,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=To(r,n,o,s,d)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(this.attemptValidation(t,r),i.length>0)i.forEach(s=>{const c=r.on?.[`${t}.${s}`];c&&this.events$.next({name:c,data:ye(this.store.getState()),detail:n??void 0,callback:d=>{this.store.dispatch(d)}})});else{const s=r.on?.[t];s&&this.events$.next({name:s,data:ye(this.store.getState()),detail:n,callback:c=>{this.store.dispatch(c)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:ye(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function No(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),o=>i=>{o(i),n&&n.send(i,t.getState())}}}const Lo=k.pipe(k.map(e=>e.formHealth),k.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),_o=e=>e.pipe(Lo);function Mo(e,t){return Yt(e,t,Zt(e,t),void 0)}function Jt(){const e=new Map;return(t,r)=>{const n=Zt(t,r),o=e.get(r);if(o&&zo(o.slices,n))return o.viewModel;const i=Yt(t,r,n,o);return e.set(r,{slices:n,viewModel:i}),i}}const Uo=e=>t=>{const r=Jt();return t.pipe(k.map(n=>r(n,e)),k.distinctUntilChanged())},Ho=[],lt=[],bo=[];function Zt(e,t){const r=Bo(e,t);return[e.calculatedWidgets[t],e.lang,r===void 0?void 0:V(e.data,r),r!==void 0&&e.touched?e.validations[r]:null,r!==void 0&&e.touched?e.injectedValidations[r]:null,r!==void 0&&e.touchedControls[r]===!0,e.touched&&!e.isFormValid,e.widgetFlags[t]?.hidden===!0]}function zo(e,t){return e.every((r,n)=>Object.is(r,t[n]))}function Yt(e,t,r,n){const[o,i,s,c,d,a,f,h]=r,y=n===void 0||!Object.is(n.slices[0],o),A=n===void 0||!Object.is(n.slices[2],s),L=n===void 0||!Object.is(n.slices[3],c)||!Object.is(n.slices[4],d),ge=o?.current;return{uid:t,widget:ge,children:y?Go(e,t,ge):n.viewModel.children,rows:y||A?Ko(e,t,ge,s):n.viewModel.rows,lang:i,value:s,errors:L?Xo(c,d):n.viewModel.errors,touched:a,formInvalid:f,hidden:h}}function Bo(e,t){return e.resolvedSources[t]?.path}function Go(e,t,r){if(r===void 0||!_(r))return Ho;const n=r.children,o=pe(t);if(o.length===0)return n;const i=o.map(s=>`[${s}]`).join("");return n.map(s=>e.resolvedSources[`${s.uid}${i}`]??s)}function Ko(e,t,r,n){if(r===void 0||!Array.isArray(n))return lt;const o=e.resolvedSources[t];if(o===void 0||!G(o))return lt;const i=o.props.template.uid,s=pe(t);return n.map((c,d)=>{const a=Re(i,[...s,d]);return e.resolvedSources[a]}).filter(c=>c!==void 0)}function Xo(e,t){return(e?.length??0)+(t?.length??0)===0?bo:[...e??[],...t??[]]}let er=!1;function xo(){er=!0}function qo(){return er}function Qo(e,t,r){if(!qo())return;const n=Object.keys(t??{}).filter(o=>o in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}const Jo=()=>crypto.randomUUID().slice(0,8);exports.FormContext=Vo;exports.assertNoPropCollisions=Qo;exports.cloneObject=B;exports.createWidgetViewModelReader=Jt;exports.defineForm=pr;exports.devToolsMiddleware=No;exports.enableDevMode=xo;exports.errorCodes=C;exports.filterTap=wo;exports.formEventNames=hr;exports.formHealth=_o;exports.getDirectionFromLanguage=gr;exports.identityTranslator=gt;exports.isStandardValidateSuccess=ft;exports.makeRepeaterItemConfig=Er;exports.preloadFormWidgets=ar;exports.shortUUID=Jo;exports.standardValidate=at;exports.widgetViewModel=Mo;exports.widgetViewModel$=Uo;
@@ -4,7 +4,7 @@ import { DotPath, FunctionWidgetParams, ReactiveExpression, Uid, UiState, Widget
4
4
  import { AllSuffixable, SomeSuffixable } from './utils/suffixable';
5
5
  /**
6
6
  * The widget type identifier used to resolve the corresponding UI component from the registry.
7
- * Examples: 'textinput', 'textarea', 'password', 'flex', 'grid', 'heading', 'markdown', 'alert'
7
+ * Examples: 'textinput', 'textarea', 'password', 'grid', 'tabs', 'markdown', 'alert'
8
8
  */
9
9
  export type WidgetType = string;
10
10
  type ReactiveWidgetPropertyValue<T, FormType extends Record<string, any> = any> = ReactiveExpression | WidgetPropertyFunction<T, FormType> | T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/core",
3
- "version": "1.6.0-rc.1",
3
+ "version": "2.0.0-rc.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"