@dynamicforms/vue-forms 0.12.0 → 0.13.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.
@@ -1,97 +1,55 @@
1
- var Gt = Object.defineProperty, Yt = Object.defineProperties;
2
- var Jt = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
4
- var ft = Object.prototype.hasOwnProperty, pt = Object.prototype.propertyIsEnumerable;
5
- var mt = (n) => {
6
- throw TypeError(n);
7
- };
8
- var K = (n, e, t) => e in n ? Gt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e) => {
9
- for (var t in e || (e = {}))
10
- ft.call(e, t) && K(n, t, e[t]);
11
- if (W)
12
- for (var t of W(e))
13
- pt.call(e, t) && K(n, t, e[t]);
14
- return n;
15
- }, C = (n, e) => Yt(n, Jt(e));
16
- var k = (n, e) => {
17
- var t = {};
18
- for (var s in n)
19
- ft.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
20
- if (n != null && W)
21
- for (var s of W(n))
22
- e.indexOf(s) < 0 && pt.call(n, s) && (t[s] = n[s]);
23
- return t;
24
- };
25
- var d = (n, e, t) => K(n, typeof e != "symbol" ? e + "" : e, t), bt = (n, e, t) => e.has(n) || mt("Cannot " + t);
26
- var l = (n, e, t) => (bt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), Z = (n, e, t) => e.has(n) ? mt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), tt = (n, e, t, s) => (bt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
27
- var vt = (n, e, t) => new Promise((s, i) => {
28
- var r = (u) => {
29
- try {
30
- o(t.next(u));
31
- } catch (c) {
32
- i(c);
33
- }
34
- }, a = (u) => {
35
- try {
36
- o(t.throw(u));
37
- } catch (c) {
38
- i(c);
39
- }
40
- }, o = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(r, a);
41
- o((t = t.apply(n, e)).next());
42
- });
43
- import { isEqual as nt, isEmpty as L, isBoolean as Kt, isString as j, truncate as Zt, isArray as At, isObject as _t } from "lodash-es";
44
- import { unref as b, computed as Tt, isRef as te, reactive as ee, ref as se, defineComponent as ie, resolveComponent as Vt, openBlock as ne, createBlock as re, h as R } from "vue";
45
- var P = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(P || {});
46
- const wt = 10, yt = new Set(
47
- Object.values(P).filter((n) => typeof n == "number")
1
+ import { isEqual as Q, isEmpty as R, isBoolean as Lt, isString as C, truncate as Mt, isArray as vt, isObject as bt } from "lodash-es";
2
+ import { unref as h, computed as X, isRef as wt, reactive as Ut, watch as $t, ref as Wt, defineComponent as qt, resolveComponent as at, openBlock as zt, createBlock as Ht, h as F } from "vue";
3
+ var T = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(T || {});
4
+ const ot = 10, lt = new Set(
5
+ Object.values(T).filter((n) => typeof n == "number")
48
6
  );
49
7
  ((n) => {
50
- function e(i) {
51
- return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : wt;
52
- }
53
- n.fromString = e;
54
8
  function t(i) {
55
- const r = typeof i == "number" ? i : n.fromString(i);
56
- return yt.has(r) ? r : wt;
9
+ return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : ot;
10
+ }
11
+ n.fromString = t;
12
+ function e(i) {
13
+ const a = typeof i == "number" ? i : n.fromString(i);
14
+ return lt.has(a) ? a : ot;
57
15
  }
58
- n.fromAny = t;
16
+ n.fromAny = e;
59
17
  function s(i) {
60
- const r = typeof i == "number" ? i : n.fromString(i);
61
- return yt.has(r);
18
+ const a = typeof i == "number" ? i : n.fromString(i);
19
+ return lt.has(a);
62
20
  }
63
21
  n.isDefined = s;
64
- })(P || (P = {}));
65
- Object.freeze(P);
66
- const N = P;
67
- class y {
68
- constructor(e) {
69
- d(this, "executorFn");
70
- /**
71
- * What this action remembers about one of the elements it serves. An action instance is shared - a `List` row
72
- * carries the instances the item template carries - so anything an action holds about the element it last ran
73
- * over belongs to that element rather than to the action: a verdict, a sequence number, a listener it installed.
74
- * The keys are weak, so what an action remembers about a row is released with the row.
75
- */
76
- d(this, "states", /* @__PURE__ */ new WeakMap());
77
- this.executorFn = e;
78
- }
22
+ })(T || (T = {}));
23
+ Object.freeze(T);
24
+ const _ = T;
25
+ class p {
79
26
  static get classIdentifier() {
80
27
  throw new Error("classIdentifier must be declared");
81
28
  }
82
29
  get classIdentifier() {
83
30
  return this.constructor.classIdentifier;
84
31
  }
32
+ executorFn;
33
+ /**
34
+ * What this action remembers about one of the elements it serves. An action instance is shared - a `List` row
35
+ * carries the instances the item template carries - so anything an action holds about the element it last ran
36
+ * over belongs to that element rather than to the action: a verdict, a sequence number, a listener it installed.
37
+ * The keys are weak, so what an action remembers about a row is released with the row.
38
+ */
39
+ states = /* @__PURE__ */ new WeakMap();
40
+ constructor(t) {
41
+ this.executorFn = t;
42
+ }
85
43
  /**
86
44
  * This action's state for `key`, created by `init` the first time it is asked for. The key is the element the
87
45
  * action is running over, or the record that element belongs to where what is remembered is a fact about the
88
46
  * whole record.
89
47
  */
90
- state(e, t) {
91
- return this.states.has(e) || this.states.set(e, t()), this.states.get(e);
48
+ state(t, e) {
49
+ return this.states.has(t) || this.states.set(t, e()), this.states.get(t);
92
50
  }
93
- execute(e, t, ...s) {
94
- return this.executorFn(e, t, ...s);
51
+ execute(t, e, ...s) {
52
+ return this.executorFn(t, e, ...s);
95
53
  }
96
54
  get eager() {
97
55
  return !1;
@@ -102,7 +60,7 @@ class y {
102
60
  * copy as it does.
103
61
  */
104
62
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
105
- boundToBinding(e) {
63
+ boundToBinding(t) {
106
64
  }
107
65
  /**
108
66
  * Announces that `binding` no longer holds this action, and takes back what running it left there. It names one
@@ -111,89 +69,95 @@ class y {
111
69
  * registration and what this took back both back.
112
70
  */
113
71
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
114
- unregisterFrom(e) {
72
+ unregisterFrom(t) {
115
73
  }
116
74
  }
117
- class Ot extends Error {
75
+ class Vt extends Error {
118
76
  }
119
- const Ft = /* @__PURE__ */ Symbol("ValueChangedAction");
120
- class O extends y {
121
- constructor(e) {
122
- super(e);
77
+ const yt = /* @__PURE__ */ Symbol("ValueChangedAction");
78
+ class S extends p {
79
+ constructor(t) {
80
+ super(t);
123
81
  }
124
82
  static get classIdentifier() {
125
- return Ft;
126
- }
127
- execute(e, t, s, i) {
128
- return super.execute(e, t, s, i);
129
- }
130
- }
131
- const $ = /* @__PURE__ */ Symbol("Transaction.capture"), jt = /* @__PURE__ */ Symbol("Transaction.restore"), Pt = /* @__PURE__ */ Symbol("Transaction.announceValue"), Nt = /* @__PURE__ */ Symbol("Transaction.settleValidity");
132
- function Et(n) {
133
- let e = 0, t = n.parent;
134
- for (; t; )
135
- e++, t = t.parent;
136
- return e;
137
- }
138
- class ae {
139
- constructor() {
140
- d(this, "participants", /* @__PURE__ */ new Map());
141
- /** what a rollback has to put back beyond the state slots, newest last */
142
- d(this, "undo", []);
143
- /** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */
144
- d(this, "unwound", !1);
145
- /** the depth the announcement in progress is working at, -1 while none is */
146
- d(this, "passDepth", -1);
147
- /** set while a pass is running and an element it has already passed the depth of gets enrolled */
148
- d(this, "restartPass", !1);
83
+ return yt;
84
+ }
85
+ execute(t, e, s, i) {
86
+ return super.execute(t, e, s, i);
149
87
  }
88
+ }
89
+ const O = /* @__PURE__ */ Symbol("Transaction.capture"), Ct = /* @__PURE__ */ Symbol("Transaction.restore"), Et = /* @__PURE__ */ Symbol("Transaction.announceValue"), xt = /* @__PURE__ */ Symbol("Transaction.settleValidity");
90
+ function ut(n) {
91
+ let t = 0, e = n.parent;
92
+ for (; e; )
93
+ t++, e = e.parent;
94
+ return t;
95
+ }
96
+ class Qt {
97
+ participants = /* @__PURE__ */ new Map();
98
+ /** what a rollback has to put back beyond the state slots, newest last */
99
+ undo = [];
100
+ /** what the commit has to do once the change stands, in the order it was handed in */
101
+ settled = [];
102
+ /** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */
103
+ unwound = !1;
104
+ /** the depth the announcement in progress is working at, -1 while none is */
105
+ passDepth = -1;
106
+ /** set while a pass is running and an element it has already passed the depth of gets enrolled */
107
+ restartPass = !1;
150
108
  /** true for a transaction that was rolled back rather than committed */
151
109
  get rolledBack() {
152
110
  return this.unwound;
153
111
  }
154
- participant(e) {
155
- let t = this.participants.get(e);
156
- return t || (t = { element: e, valueDirty: !1, forceValue: !1, validityDirty: !1 }, this.participants.set(e, t)), t;
112
+ participant(t) {
113
+ let e = this.participants.get(t);
114
+ return e || (e = { element: t, valueDirty: !1, forceValue: !1, validityDirty: !1 }, this.participants.set(t, e)), e;
157
115
  }
158
116
  /**
159
117
  * Records the state of an element the first time the transaction modifies it. The whole of the mutable state
160
118
  * goes into the snapshot rather than the part being written: a rollback that restored some of it would leave
161
119
  * the element in a state the form never held.
162
120
  */
163
- touch(e) {
164
- const t = this.participant(e);
165
- t.snapshot || (t.snapshot = e[$]());
121
+ touch(t) {
122
+ const e = this.participant(t);
123
+ e.snapshot || (e.snapshot = t[O]());
166
124
  }
167
125
  /** Enrols an element as one whose value the commit has to announce. `force` skips the comparison. */
168
- markValueChanged(e, t) {
169
- const s = this.participant(e);
170
- s.valueDirty = !0, t && (s.forceValue = !0), this.noteDepth(e);
126
+ markValueChanged(t, e) {
127
+ const s = this.participant(t);
128
+ s.valueDirty = !0, e && (s.forceValue = !0), this.noteDepth(t);
171
129
  }
172
130
  /** Enrols an element as one whose verdict the commit has to re-form. */
173
- markValidityDirty(e) {
174
- this.participant(e).validityDirty = !0, this.noteDepth(e);
131
+ markValidityDirty(t) {
132
+ this.participant(t).validityDirty = !0, this.noteDepth(t);
175
133
  }
176
134
  /**
177
135
  * Queues an event that states an operation rather than a state. Added and removed items have no net over a
178
136
  * transaction, so they are neither compared nor coalesced: the commit emits them in the order they happened.
179
137
  */
180
- recordStructural(e, t) {
181
- var i;
182
- const s = this.participant(e);
183
- ((i = s.structural) != null ? i : s.structural = []).push(t), this.noteDepth(e);
138
+ recordStructural(t, e) {
139
+ const s = this.participant(t);
140
+ (s.structural ??= []).push(e), this.noteDepth(t);
184
141
  }
185
142
  /** True where the commit still owes this element a value announcement. */
186
- willAnnounceValue(e) {
187
- var t, s;
188
- return (s = (t = this.participants.get(e)) == null ? void 0 : t.valueDirty) != null ? s : !1;
143
+ willAnnounceValue(t) {
144
+ return this.participants.get(t)?.valueDirty ?? !1;
189
145
  }
190
146
  /**
191
147
  * Registers what a rollback has to put back beyond the element's state slots. The snapshot covers the slots,
192
148
  * which is everything an ordinary write touches; an operation that replaces something else the element carries
193
149
  * hands its own undo in here rather than making every snapshot carry the thing.
194
150
  */
195
- whenRolledBack(e) {
196
- this.undo.push(e);
151
+ whenRolledBack(t) {
152
+ this.undo.push(t);
153
+ }
154
+ /**
155
+ * Registers work that runs once the transaction has committed, and not at all where it is rolled back. It is
156
+ * how an operation defers a step that cannot be taken back - cancelling work in flight, for one - until the
157
+ * change it belongs to actually stands.
158
+ */
159
+ whenCommitted(t) {
160
+ this.settled.push(t);
197
161
  }
198
162
  /**
199
163
  * Notes that an element at or below the depth the pass in progress is working at has been enrolled. The pass
@@ -202,8 +166,8 @@ class ae {
202
166
  * whose composed value carries that write. The depth is only measured while a pass is running - outside one
203
167
  * there is nothing the answer would change.
204
168
  */
205
- noteDepth(e) {
206
- this.passDepth < 0 || Et(e) >= this.passDepth && (this.restartPass = !0);
169
+ noteDepth(t) {
170
+ this.passDepth < 0 || ut(t) >= this.passDepth && (this.restartPass = !0);
207
171
  }
208
172
  /**
209
173
  * Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's
@@ -211,11 +175,11 @@ class ae {
211
175
  * that called a server during the transaction already did.
212
176
  */
213
177
  rollback() {
214
- this.unwound = !0, [...this.participants.values()].reverse().forEach((t) => {
215
- t.snapshot && t.element[jt](t.snapshot);
178
+ this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
179
+ e.snapshot && e.element[Ct](e.snapshot);
216
180
  }), this.participants.clear();
217
- for (let t = this.undo.length - 1; t >= 0; t--) this.undo[t]();
218
- this.undo.length = 0;
181
+ for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
182
+ this.undo.length = 0, this.settled.length = 0;
219
183
  }
220
184
  /**
221
185
  * Announces what the transaction did. Values first and verdicts after, because a container's validators run
@@ -228,6 +192,8 @@ class ae {
228
192
  commit() {
229
193
  for (; !(!this.announceValues() && !this.settleValidity()); )
230
194
  ;
195
+ for (let t = 0; t < this.settled.length; t++) this.settled[t]();
196
+ this.settled.length = 0;
231
197
  }
232
198
  /**
233
199
  * The dirty participants a pass has to visit, one bucket per nesting depth; ties keep the order they were
@@ -235,14 +201,13 @@ class ae {
235
201
  * comparison sort: a whole-list assignment enrols one participant per field, and ordering those by comparison
236
202
  * would cost more than the announcement it orders.
237
203
  */
238
- buckets(e) {
239
- const t = [];
204
+ buckets(t) {
205
+ const e = [];
240
206
  return this.participants.forEach((s) => {
241
- var r;
242
- if (!e(s)) return;
243
- const i = Et(s.element);
244
- ((r = t[i]) != null ? r : t[i] = []).push(s);
245
- }), t;
207
+ if (!t(s)) return;
208
+ const i = ut(s.element);
209
+ (e[i] ??= []).push(s);
210
+ }), e;
246
211
  }
247
212
  /**
248
213
  * Runs one pass over the dirty participants, deepest bucket first; the caller repeats it until it answers
@@ -250,18 +215,18 @@ class ae {
250
215
  * the depth being drained: that element is not in the bucket being walked, and going on would reach the
251
216
  * containers above it first. The caller's next pass takes fresh buckets and finds it at its own depth.
252
217
  */
253
- pass(e, t) {
254
- const s = this.buckets(e);
218
+ pass(t, e) {
219
+ const s = this.buckets(t);
255
220
  if (!s.length) return !1;
256
221
  for (let i = s.length - 1; i >= 0; i--) {
257
- const r = s[i];
258
- if (r) {
222
+ const a = s[i];
223
+ if (a) {
259
224
  this.passDepth = i, this.restartPass = !1;
260
225
  try {
261
- for (let a = 0; a < r.length; a++) {
226
+ for (let r = 0; r < a.length; r++) {
262
227
  if (this.restartPass) return !0;
263
- const o = r[a];
264
- e(o) && t(o);
228
+ const o = a[r];
229
+ t(o) && e(o);
265
230
  }
266
231
  } finally {
267
232
  this.passDepth = -1;
@@ -273,34 +238,32 @@ class ae {
273
238
  }
274
239
  announceValues() {
275
240
  return this.pass(
276
- (e) => e.valueDirty || e.structural !== void 0,
277
- (e) => {
278
- const { structural: t } = e, s = e.valueDirty, i = e.forceValue;
279
- e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, e.element[Pt](this, s, i, t);
241
+ (t) => t.valueDirty || t.structural !== void 0,
242
+ (t) => {
243
+ const { structural: e } = t, s = t.valueDirty, i = t.forceValue;
244
+ t.structural = void 0, t.valueDirty = !1, t.forceValue = !1, t.element[Et](this, s, i, e);
280
245
  }
281
246
  );
282
247
  }
283
248
  settleValidity() {
284
249
  return this.pass(
285
- (e) => e.validityDirty,
286
- (e) => {
287
- e.validityDirty = !1, e.element[Nt](this);
250
+ (t) => t.validityDirty,
251
+ (t) => {
252
+ t.validityDirty = !1, t.element[xt](this);
288
253
  }
289
254
  );
290
255
  }
291
256
  }
292
- let _, et;
293
- function kt() {
294
- return _;
257
+ let E, q;
258
+ function St() {
259
+ return E;
295
260
  }
296
- class Rt {
261
+ class It {
297
262
  }
298
- class oe {
299
- constructor() {
300
- d(this, "open", !0);
301
- }
263
+ class Xt {
264
+ open = !0;
302
265
  rollback() {
303
- throw this.open ? new Rt() : new TypeError(
266
+ throw this.open ? new It() : new TypeError(
304
267
  "this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it."
305
268
  );
306
269
  }
@@ -308,60 +271,68 @@ class oe {
308
271
  this.open = !1;
309
272
  }
310
273
  }
311
- function Ct(n) {
274
+ function ct(n) {
312
275
  if (n != null && typeof n.then == "function")
313
276
  throw new TypeError(
314
277
  "a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part."
315
278
  );
316
279
  }
317
- function q(n) {
318
- if (_) {
319
- const s = n(et);
320
- return Ct(s), s;
280
+ function Y(n) {
281
+ if (E) {
282
+ const s = n(q);
283
+ return ct(s), s;
321
284
  }
322
- const e = new ae(), t = new oe();
323
- _ = e, et = t;
285
+ const t = new Qt(), e = new Xt();
286
+ E = t, q = e;
324
287
  try {
325
- const s = n(t);
326
- return Ct(s), e.commit(), s;
288
+ const s = n(e);
289
+ return ct(s), t.commit(), s;
327
290
  } catch (s) {
328
- if (e.rollback(), s instanceof Rt) return;
291
+ if (t.rollback(), s instanceof It) return;
329
292
  throw s;
330
293
  } finally {
331
- _ = void 0, et = void 0, t.close();
294
+ E = void 0, q = void 0, e.close();
332
295
  }
333
296
  }
334
- function g(n) {
335
- return _ ? n(_) : q(() => n(_));
297
+ function u(n) {
298
+ return E ? n(E) : Y(() => n(E));
336
299
  }
337
- const Dt = { useMarkdownInValidators: !0 };
338
- function le() {
339
- return Dt;
300
+ const At = { useMarkdownInValidators: !0 };
301
+ function Kt() {
302
+ return At;
340
303
  }
341
- function ue(n) {
342
- Object.assign(Dt, n);
304
+ function Yt(n) {
305
+ Object.assign(At, n);
343
306
  }
344
- const Ye = {
345
- install(n, e) {
346
- e && ue(e);
307
+ const De = {
308
+ install(n, t) {
309
+ t && Yt(t);
347
310
  }
348
311
  };
349
- class B extends String {
350
- constructor(t, s, i) {
351
- super(t);
352
- d(this, "plugins");
353
- d(this, "options");
354
- this.plugins = i, this.options = s;
312
+ class P extends String {
313
+ plugins;
314
+ options;
315
+ constructor(t, e, s) {
316
+ super(t), this.plugins = s, this.options = e;
355
317
  }
356
318
  }
357
- function at(n) {
358
- const e = b(n);
359
- return typeof e == "object" && "componentName" in e;
319
+ function J(n) {
320
+ const t = h(n);
321
+ return typeof t == "object" && "componentName" in t;
360
322
  }
361
- function z(n) {
362
- return typeof b(n) == "function";
323
+ function B(n) {
324
+ return typeof h(n) == "function";
363
325
  }
364
- class ot {
326
+ class Z {
327
+ /**
328
+ * Machine-readable identifier of what failed, in kebab-case. Every validator this library ships states one, so
329
+ * code that reacts to a particular failure does not have to match the message text, which is translated and
330
+ * configurable. It is optional: an error built by hand carries whatever its author gives it, or nothing.
331
+ */
332
+ constructor(t) {
333
+ this.code = t;
334
+ }
335
+ code;
365
336
  get componentName() {
366
337
  return "Comment";
367
338
  }
@@ -375,13 +346,12 @@ class ot {
375
346
  return "";
376
347
  }
377
348
  }
378
- class ce extends ot {
379
- constructor(t, s = "") {
380
- super();
381
- d(this, "text");
382
- d(this, "classes");
383
- this.text = t, this.classes = s;
349
+ class Jt extends Z {
350
+ constructor(t, e = "", s) {
351
+ super(s), this.text = t, this.classes = e;
384
352
  }
353
+ text;
354
+ classes;
385
355
  get componentName() {
386
356
  return "template";
387
357
  }
@@ -392,24 +362,23 @@ class ce extends ot {
392
362
  return this.classes;
393
363
  }
394
364
  }
395
- class V extends ot {
396
- constructor(t, s = "") {
397
- super();
398
- d(this, "classes");
399
- d(this, "text");
400
- d(this, "textType");
401
- this.classes = s, this.text = t, this.textType = Tt(() => this.getTextType);
365
+ class f extends Z {
366
+ constructor(t, e = "", s) {
367
+ super(s), this.classes = e, this.text = t, this.textType = X(() => this.getTextType);
402
368
  }
369
+ classes;
370
+ text;
371
+ textType;
403
372
  get resolvedText() {
404
- const t = b(this.text);
405
- return z(t) ? t() : t;
373
+ const t = h(this.text);
374
+ return B(t) ? t() : t;
406
375
  }
407
376
  get getTextType() {
408
377
  const t = this.resolvedText;
409
- return t ? t instanceof B ? "md" : at(t) ? "component" : "string" : "string";
378
+ return t ? t instanceof P ? "md" : J(t) ? "component" : "string" : "string";
410
379
  }
411
380
  get componentName() {
412
- switch (b(this.textType)) {
381
+ switch (h(this.textType)) {
413
382
  case "string":
414
383
  return "template";
415
384
  case "md":
@@ -421,7 +390,7 @@ class V extends ot {
421
390
  }
422
391
  }
423
392
  get componentBindings() {
424
- switch (b(this.textType)) {
393
+ switch (h(this.textType)) {
425
394
  case "string":
426
395
  return {};
427
396
  case "md": {
@@ -435,7 +404,7 @@ class V extends ot {
435
404
  }
436
405
  }
437
406
  get componentBody() {
438
- switch (b(this.textType)) {
407
+ switch (h(this.textType)) {
439
408
  case "string":
440
409
  return this.resolvedText;
441
410
  case "component":
@@ -448,43 +417,50 @@ class V extends ot {
448
417
  return this.classes;
449
418
  }
450
419
  }
451
- class he extends V {
420
+ class Zt extends f {
452
421
  }
453
- function E(n) {
454
- return le().useMarkdownInValidators ? new B(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
422
+ function m(n) {
423
+ return Kt().useMarkdownInValidators ? new P(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
455
424
  `);
456
425
  }
457
- const de = /* @__PURE__ */ Symbol("Validator"), ge = () => E("Validation could not be completed");
458
- class v extends O {
426
+ const Gt = /* @__PURE__ */ Symbol("Validator"), te = () => m("Validation could not be completed");
427
+ class g extends S {
428
+ source;
459
429
  /**
460
430
  * Creates a new validator
461
431
  * @param validationFn Function that validates the field value and returns errors or null
462
432
  */
463
433
  constructor(t) {
464
- super((i, r, a, o) => {
465
- const u = this.bindingState(i), c = ++u.run, x = i.validationEpoch, G = kt(), ct = () => u.run === c && i.validationEpoch === x && !(G != null && G.rolledBack), Y = t(a, o, i) || [], J = (S) => q(() => {
466
- var ht;
467
- const U = (ht = S == null ? void 0 : S.map((F) => this.claim(F))) != null ? ht : [];
468
- for (let F = i.errors.length - 1; F >= 0; F--) {
469
- const dt = i.errors[F];
470
- if (dt.source === this.source) {
471
- const gt = U.findIndex((Xt) => nt(Xt, dt));
472
- gt >= 0 ? U.splice(gt, 1) : i.errors.splice(F, 1);
434
+ const e = (s, i, a, r) => {
435
+ const o = this.bindingState(s), l = o.abandon, w = ++o.run, b = s.validationEpoch, et = St();
436
+ let st = !1;
437
+ const U = () => !st && o.run === w && s.validationEpoch === b && !et?.rolledBack, it = new AbortController(), N = () => {
438
+ U() || (st = !0, o.abandon === N && (o.abandon = void 0), it.abort());
439
+ };
440
+ l?.();
441
+ const $ = t(a, r, s, it.signal) || [], W = (y) => Y(() => {
442
+ const k = y?.map((I) => this.claim(I)) ?? [];
443
+ for (let I = s.errors.length - 1; I >= 0; I--) {
444
+ const nt = s.errors[I];
445
+ if (nt.source === this.source) {
446
+ const rt = k.findIndex((Dt) => Q(Dt, nt));
447
+ rt >= 0 ? k.splice(rt, 1) : s.errors.splice(I, 1);
473
448
  }
474
449
  }
475
- U.length > 0 && i.errors.push(...U), i.validate();
450
+ k.length > 0 && s.errors.push(...k), s.validate();
476
451
  });
477
- return Y instanceof Promise ? (i.beginValidating(), Y.then(
478
- (S) => {
479
- ct() && J(S);
452
+ return $ instanceof Promise ? (o.abandon = N, et?.whenRolledBack(N), s.beginValidating(), $.then(
453
+ (y) => {
454
+ U() && W(y);
480
455
  },
481
- (S) => {
482
- ct() && (J([new V(ge())]), console.error("Validation failed", S));
456
+ (y) => {
457
+ U() && (W([new f(te(), "", "validation-failed")]), console.error("Validation failed", y));
483
458
  }
484
- ).finally(() => i.endValidating()).catch((S) => console.error("Validation failed", S))) : J(Y), r(i, a, o);
485
- });
486
- d(this, "source");
487
- this.source = Symbol(this.constructor.name);
459
+ ).finally(() => {
460
+ o.abandon === N && (o.abandon = void 0), s.endValidating();
461
+ }).catch((y) => console.error("Validation failed", y))) : W($), i(s, a, r);
462
+ };
463
+ super(e), this.source = Symbol(this.constructor.name);
488
464
  }
489
465
  /**
490
466
  * Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no
@@ -494,16 +470,16 @@ class v extends O {
494
470
  * including the non-enumerable ones, so it renders exactly like the instance it was made from.
495
471
  */
496
472
  claim(t) {
497
- const s = t.source;
498
- if (s === this.source) return t;
499
- const i = { value: this.source, enumerable: !1, configurable: !1 };
500
- if (s === void 0)
501
- return Object.defineProperty(t, "source", i), t;
502
- const r = Object.getOwnPropertyDescriptors(t);
503
- return Object.create(Object.getPrototypeOf(t), C(p({}, r), { source: i }));
473
+ const e = t.source;
474
+ if (e === this.source) return t;
475
+ const s = { value: this.source, enumerable: !1, configurable: !1 };
476
+ if (e === void 0)
477
+ return Object.defineProperty(t, "source", s), t;
478
+ const i = Object.getOwnPropertyDescriptors(t);
479
+ return Object.create(Object.getPrototypeOf(t), { ...i, source: s });
504
480
  }
505
481
  static get classIdentifier() {
506
- return de;
482
+ return Gt;
507
483
  }
508
484
  get eager() {
509
485
  return !0;
@@ -512,14 +488,28 @@ class v extends O {
512
488
  * Takes this validator off `field`: the errors it put there are withdrawn and the verdict is re-formed over what
513
489
  * the validators the field still holds have to say. Withdrawing them is what keeps a field from staying invalid
514
490
  * on an error no validator is left to take back.
491
+ *
492
+ * A run in flight over the field is cancelled once the removal stands, and not before: a transaction that
493
+ * unwinds puts the validator and its epoch back, and the run it never cancelled goes on to reach the verdict the
494
+ * field is then owed. Cancelling it as the removal is made would leave the field reporting itself valid over a
495
+ * value nothing checked, on the strength of a transaction that never happened.
515
496
  */
516
497
  unregisterFrom(t) {
517
- q(() => {
498
+ u((e) => {
499
+ e.whenCommitted(() => this.abandonRun(t));
518
500
  for (let s = t.errors.length - 1; s >= 0; s--)
519
501
  t.errors[s].source === this.source && t.errors.splice(s, 1);
520
502
  t.validate();
521
503
  });
522
504
  }
505
+ /**
506
+ * Cancels the asynchronous run in flight over `field`, where there is one. It is called once the field has
507
+ * stopped holding this validator: the field's validation epoch has moved on by then, so the run's verdict is
508
+ * already dropped and the signal it handed its check aborts with it.
509
+ */
510
+ abandonRun(t) {
511
+ this.bindingState(t).abandon?.();
512
+ }
523
513
  /**
524
514
  * What this validator remembers about one of the fields it validates. One instance may be registered on several
525
515
  * fields - every row of a list carries the instances the item template carries - so each field has a record of
@@ -536,186 +526,180 @@ class v extends O {
536
526
  newBindingState() {
537
527
  return { run: 0 };
538
528
  }
539
- replacePlaceholdersFunction(t, s) {
529
+ replacePlaceholdersFunction(t, e) {
540
530
  return () => {
541
- let i = b(t);
542
- for (; z(i); )
543
- i = b(this.replacePlaceholders(i(), s));
544
- return i;
531
+ let s = h(t);
532
+ for (; B(s); )
533
+ s = h(this.replacePlaceholders(s(), e));
534
+ return s;
545
535
  };
546
536
  }
547
- replacePlaceholders(t, s) {
548
- if (z(t)) return this.replacePlaceholdersFunction(t, s);
549
- if (at(t)) return t;
550
- if (te(t))
551
- return this.replacePlaceholdersFunction(() => b(t), s);
552
- let i = b(t);
553
- return Object.keys(s).forEach((r) => {
554
- i = i.replaceAll(`{${r}}`, s[r]);
555
- }), t instanceof B ? new B(i.toString(), t.options, t.plugins) : i;
556
- }
557
- }
558
- class H {
559
- constructor() {
560
- /** every action registered here, in registration order across all identifiers */
561
- d(this, "registeredActions", []);
562
- /** the actions of one identifier, in registration order */
563
- d(this, "chains", /* @__PURE__ */ new Map());
564
- /** the eager actions of one identifier, in registration order; a subsequence of the chain under that identifier */
565
- d(this, "eagerChains", /* @__PURE__ */ new Map());
566
- }
537
+ replacePlaceholders(t, e) {
538
+ if (B(t)) return this.replacePlaceholdersFunction(t, e);
539
+ if (J(t)) return t;
540
+ if (wt(t))
541
+ return this.replacePlaceholdersFunction(() => h(t), e);
542
+ let s = h(t);
543
+ return Object.keys(e).forEach((i) => {
544
+ s = s.replaceAll(`{${i}}`, e[i]);
545
+ }), t instanceof P ? new P(s.toString(), t.options, t.plugins) : s;
546
+ }
547
+ }
548
+ class D {
549
+ /** every action registered here, in registration order across all identifiers */
550
+ registeredActions = [];
551
+ /** the actions of one identifier, in registration order */
552
+ chains = /* @__PURE__ */ new Map();
553
+ /** the eager actions of one identifier, in registration order; a subsequence of the chain under that identifier */
554
+ eagerChains = /* @__PURE__ */ new Map();
567
555
  /**
568
556
  * Registers `action`. It becomes the outermost handler of its identifier, or - where `before` is given and is
569
557
  * registered here under the same identifier - takes that action's place in the order, so `before` wraps it and
570
558
  * reaches it through `supr`. That is what lets an action be added to a chain someone else built and still sit
571
559
  * inside a handler already there.
572
560
  */
573
- register(e, t) {
574
- if (!(e instanceof y)) throw new Error("Invalid action type");
575
- const s = e.classIdentifier;
576
- if (t && (t.classIdentifier !== s || !this.registeredActions.includes(t)))
561
+ register(t, e) {
562
+ if (!(t instanceof p)) throw new Error("Invalid action type");
563
+ const s = t.classIdentifier;
564
+ if (e && (e.classIdentifier !== s || !this.registeredActions.includes(e)))
577
565
  throw new Error("Action to register before is not registered under the same identifier");
578
- this.registeredActions.push(e), this.insert(this.chains, s, e, t), e.eager && this.insert(this.eagerChains, s, e, t);
566
+ this.registeredActions.push(t), this.insert(this.chains, s, t, e), t.eager && this.insert(this.eagerChains, s, t, e);
579
567
  }
580
568
  /**
581
569
  * Drops `action` from this map and answers whether it was in it. The lists it stood in are replaced rather than
582
570
  * written, so a run already walking one finishes on the list it started with and the removal takes effect from
583
571
  * the next trigger.
584
572
  */
585
- unregister(e) {
586
- const t = this.registeredActions.indexOf(e);
587
- if (t < 0) return !1;
588
- this.registeredActions.splice(t, 1);
589
- const s = e.classIdentifier;
590
- return this.remove(this.chains, s, e), this.remove(this.eagerChains, s, e), !0;
573
+ unregister(t) {
574
+ const e = this.registeredActions.indexOf(t);
575
+ if (e < 0) return !1;
576
+ this.registeredActions.splice(e, 1);
577
+ const s = t.classIdentifier;
578
+ return this.remove(this.chains, s, t), this.remove(this.eagerChains, s, t), !0;
591
579
  }
592
580
  /** True where something is registered under `identifier`. */
593
- willTrigger(e) {
594
- return this.chains.has(e);
581
+ willTrigger(t) {
582
+ return this.chains.has(t);
595
583
  }
596
584
  /** True where any eager action is registered, whatever identifier it stands under. */
597
585
  get hasEager() {
598
586
  return this.eagerChains.size > 0;
599
587
  }
600
588
  /** Runs the actions registered under `ActionClass` and answers with what the outermost of them returned. */
601
- trigger(e, t, ...s) {
602
- return this.run(this.chains.get(e.classIdentifier), t, s);
589
+ trigger(t, e, ...s) {
590
+ return this.run(this.chains.get(t.classIdentifier), e, s);
603
591
  }
604
592
  /** Runs the eager actions of every identifier, each group on its own. */
605
- triggerEager(e, ...t) {
606
- this.eagerChains.forEach((s) => this.run(s, e, t));
593
+ triggerEager(t, ...e) {
594
+ this.eagerChains.forEach((s) => this.run(s, t, e));
607
595
  }
608
596
  /** Runs the eager actions registered under `identifier` and nothing else. */
609
- triggerEagerFor(e, t, ...s) {
610
- return this.run(this.eagerChains.get(e), t, s);
597
+ triggerEagerFor(t, e, ...s) {
598
+ return this.run(this.eagerChains.get(t), e, s);
611
599
  }
612
600
  /** the validators registered in this map, in registration order */
613
601
  get validators() {
614
- return this.registeredActions.filter((e) => e instanceof v);
602
+ return this.registeredActions.filter((t) => t instanceof g);
615
603
  }
616
604
  clone() {
617
- const e = new H();
618
- return this.registeredActions.forEach((t) => e.register(t)), e;
605
+ const t = new D();
606
+ return this.registeredActions.forEach((e) => t.register(e)), t;
619
607
  }
620
608
  /**
621
609
  * Tells every action in this map that it serves `owner`. A copied map holds the instances the original holds, so
622
610
  * the element that took the copy on is announced to them here, the way registering an action announces the
623
611
  * element it was registered on.
624
612
  */
625
- bindTo(e) {
626
- this.registeredActions.forEach((t) => t.boundToBinding(e));
613
+ bindTo(t) {
614
+ this.registeredActions.forEach((e) => e.boundToBinding(t));
627
615
  }
628
616
  /**
629
617
  * Walks `chain` from the end backwards, handing each action a `supr` that continues at the one before it. The
630
618
  * closures exist for the length of the run and only as deep as the run actually goes, so a chain nobody walks to
631
619
  * the bottom costs nothing for the part left unreached.
632
620
  */
633
- step(e, t, s, i) {
634
- if (t < 0) return null;
635
- const r = (a, ...o) => this.step(e, t - 1, a, o);
636
- return e[t].execute(s, r, ...i);
621
+ step(t, e, s, i) {
622
+ if (e < 0) return null;
623
+ const a = (r, ...o) => this.step(t, e - 1, r, o);
624
+ return t[e].execute(s, a, ...i);
637
625
  }
638
626
  /** Walks a chain, answering null where there is none. An abort ends the run and is not an error to the caller. */
639
- run(e, t, s) {
640
- if (!e) return null;
627
+ run(t, e, s) {
628
+ if (!t) return null;
641
629
  try {
642
- return this.step(e, e.length - 1, t, s);
630
+ return this.step(t, t.length - 1, e, s);
643
631
  } catch (i) {
644
- if (!(i instanceof Ot)) throw i;
632
+ if (!(i instanceof Vt)) throw i;
645
633
  }
646
634
  return null;
647
635
  }
648
- insert(e, t, s, i) {
649
- var o;
650
- const r = (o = e.get(t)) != null ? o : [], a = i ? r.indexOf(i) : -1;
651
- a < 0 ? r.push(s) : r.splice(a, 0, s), e.set(t, r);
636
+ insert(t, e, s, i) {
637
+ const a = t.get(e) ?? [], r = i ? a.indexOf(i) : -1;
638
+ r < 0 ? a.push(s) : a.splice(r, 0, s), t.set(e, a);
652
639
  }
653
- remove(e, t, s) {
654
- const i = e.get(t);
655
- if (!(i != null && i.includes(s))) return;
656
- const r = i.filter((a) => a !== s);
657
- r.length ? e.set(t, r) : e.delete(t);
640
+ remove(t, e, s) {
641
+ const i = t.get(e);
642
+ if (!i?.includes(s)) return;
643
+ const a = i.filter((r) => r !== s);
644
+ a.length ? t.set(e, a) : t.delete(e);
658
645
  }
659
646
  }
660
- function T(n) {
647
+ function x(n) {
648
+ let t = n;
649
+ for (; t.fieldName !== void 0 && t.parent; ) t = t.parent;
650
+ return t;
651
+ }
652
+ function ee(n) {
653
+ const t = [];
661
654
  let e = n;
662
- for (; e.fieldName !== void 0 && e.parent; ) e = e.parent;
663
- return e;
655
+ for (; e.fieldName !== void 0 && e.parent; )
656
+ t.unshift(e.fieldName), e = e.parent;
657
+ return t;
664
658
  }
665
- function fe(n) {
666
- const e = [];
667
- let t = n;
668
- for (; t.fieldName !== void 0 && t.parent; )
669
- e.unshift(t.fieldName), t = t.parent;
670
- return e;
671
- }
672
- function lt(n, e) {
673
- var s, i;
674
- let t = e;
675
- for (const r of fe(n))
676
- if (t = (i = (s = t.field) == null ? void 0 : s.call(t, r)) != null ? i : void 0, !t) break;
677
- return (t == null ? void 0 : t.declaration) === n ? t : T(n) === T(e.declaration) ? void 0 : n;
678
- }
679
- function Lt(n, e) {
680
- const t = lt(n, e);
681
- if (!t) return [];
682
- if (t !== n) return [t];
683
- const s = e.bindingsOf(n);
659
+ function G(n, t) {
660
+ let e = t;
661
+ for (const s of ee(n))
662
+ if (e = e.field?.(s) ?? void 0, !e) break;
663
+ return e?.declaration === n ? e : x(n) === x(t.declaration) ? void 0 : n;
664
+ }
665
+ function Tt(n, t) {
666
+ const e = G(n, t);
667
+ if (!e) return [];
668
+ if (e !== n) return [e];
669
+ const s = t.bindingsOf(n);
684
670
  return s.length > 0 ? s : [n];
685
671
  }
686
- function pe(n, e) {
687
- var s;
688
- let t = e.parent;
689
- for (; t; ) {
690
- const i = (s = t.field) == null ? void 0 : s.call(t, n);
691
- if (i) return i;
692
- t = t.parent;
693
- }
694
- }
695
- const me = /* @__PURE__ */ Symbol("ConditionalStatementAction");
696
- class Q extends O {
697
- constructor(t, s) {
698
- super((r, a, o, u) => (this.applyIn(T(r)) || r.markRecordIncomplete(), a(r, o, u)));
699
- d(this, "statement");
700
- d(this, "conditionalExecutor");
701
- /**
702
- * What the elements this action was registered on were declared as. It holds declarations rather than the
703
- * elements themselves, so one entry stands for every row of a list, and the element a result is applied to is
704
- * the one that declaration names within the record the change happened in.
705
- */
706
- d(this, "declarations", /* @__PURE__ */ new Set());
707
- /**
708
- * The elements this action was registered on. Registration reaches one element at a time - the rows of a list
709
- * take the action on one by one, as they are built from the item template that carries it - so this is what
710
- * says which of the elements a declaration stands for the action actually drives.
711
- */
712
- d(this, "registrations", /* @__PURE__ */ new WeakSet());
713
- this.statement = t, this.conditionalExecutor = s;
714
- const i = new O((r, a, ...o) => (this.applyFrom(r), a(r, ...o)));
715
- t.collectFields().forEach((r) => r.registerAction(i));
672
+ function se(n, t) {
673
+ let e = t.parent;
674
+ for (; e; ) {
675
+ const s = e.field?.(n);
676
+ if (s) return s;
677
+ e = e.parent;
678
+ }
679
+ }
680
+ const ie = /* @__PURE__ */ Symbol("ConditionalStatementAction");
681
+ class L extends S {
682
+ statement;
683
+ conditionalExecutor;
684
+ /**
685
+ * What the elements this action was registered on were declared as. It holds declarations rather than the
686
+ * elements themselves, so one entry stands for every row of a list, and the element a result is applied to is
687
+ * the one that declaration names within the record the change happened in.
688
+ */
689
+ declarations = /* @__PURE__ */ new Set();
690
+ /**
691
+ * The elements this action was registered on. Registration reaches one element at a time - the rows of a list
692
+ * take the action on one by one, as they are built from the item template that carries it - so this is what
693
+ * says which of the elements a declaration stands for the action actually drives.
694
+ */
695
+ registrations = /* @__PURE__ */ new WeakSet();
696
+ constructor(t, e) {
697
+ super((i, a, r, o) => (this.applyIn(x(i)) || i.markRecordIncomplete(), a(i, r, o))), this.statement = t, this.conditionalExecutor = e;
698
+ const s = new S((i, a, ...r) => (this.applyFrom(i), a(i, ...r)));
699
+ t.collectFields().forEach((i) => i.registerAction(s));
716
700
  }
717
701
  static get classIdentifier() {
718
- return me;
702
+ return ie;
719
703
  }
720
704
  get eager() {
721
705
  return !0;
@@ -731,12 +715,12 @@ class Q extends O {
731
715
  * those the ones that took the action on. A row of a list that never took it on is not one this action drives.
732
716
  */
733
717
  targetsIn(t) {
734
- const s = [];
718
+ const e = [];
735
719
  return this.declarations.forEach(
736
- (i) => Lt(i, t).forEach((r) => {
737
- this.registrations.has(r) && s.push(r);
720
+ (s) => Tt(s, t).forEach((i) => {
721
+ this.registrations.has(i) && e.push(i);
738
722
  })
739
- ), s;
723
+ ), e;
740
724
  }
741
725
  /**
742
726
  * Re-evaluates the statement over one record and applies the result where it changed. The result is recorded
@@ -745,12 +729,12 @@ class Q extends O {
745
729
  * this action to drive, which is how a caller learns that the record is not assembled yet.
746
730
  */
747
731
  applyIn(t) {
748
- const s = this.targetsIn(t);
749
- if (s.length === 0) return !1;
750
- const i = this.state(t, () => ({ lastResult: void 0 })), r = this.statement.evaluate(t);
751
- if (r === i.lastResult) return !0;
752
- const a = i.lastResult;
753
- return i.lastResult = r, s.forEach((o) => this.conditionalExecutor(o, r, a)), !0;
732
+ const e = this.targetsIn(t);
733
+ if (e.length === 0) return !1;
734
+ const s = this.state(t, () => ({ lastResult: void 0 })), i = this.statement.evaluate(t);
735
+ if (i === s.lastResult) return !0;
736
+ const a = s.lastResult;
737
+ return s.lastResult = i, e.forEach((r) => this.conditionalExecutor(r, i, a)), !0;
754
738
  }
755
739
  /**
756
740
  * Re-evaluates the records a change of `source` speaks for. A field of the record the targets live in speaks for
@@ -759,148 +743,134 @@ class Q extends O {
759
743
  * where the change reaches none.
760
744
  */
761
745
  applyFrom(t) {
762
- const s = /* @__PURE__ */ new Set();
763
- this.targetsIn(T(t)).forEach((i) => s.add(T(i))), s.forEach((i) => this.applyIn(i));
746
+ const e = /* @__PURE__ */ new Set();
747
+ this.targetsIn(x(t)).forEach((s) => e.add(x(s))), e.forEach((s) => this.applyIn(s));
764
748
  }
765
749
  }
766
- class be extends Q {
767
- constructor(e) {
768
- super(e, (t, s) => {
769
- t.visibility = s ? N.FULL : N.SUPPRESS;
750
+ class ne extends L {
751
+ constructor(t) {
752
+ super(t, (e, s) => {
753
+ e.visibility = s ? _.FULL : _.SUPPRESS;
770
754
  });
771
755
  }
772
756
  }
773
- class ve extends Q {
774
- constructor(e) {
775
- super(e, (t, s) => {
776
- t.enabled = s;
757
+ class re extends L {
758
+ constructor(t) {
759
+ super(t, (e, s) => {
760
+ e.enabled = s;
777
761
  });
778
762
  }
779
763
  }
780
- class Ve extends Q {
781
- constructor(e, t) {
782
- super(e, (s, i) => {
783
- i && (s.value = t);
764
+ class ae extends L {
765
+ constructor(t, e) {
766
+ super(t, (s, i) => {
767
+ i && (s.value = e);
784
768
  });
785
769
  }
786
770
  }
787
- var M = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(M || {});
771
+ var j = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(j || {});
788
772
  ((n) => {
789
- function e(r) {
790
- const a = r.toLowerCase();
791
- if (a === "not") return 0;
792
- if (a === "or") return 1;
793
- if (a === "and") return 2;
794
- if (a === "xor") return 3;
795
- if (a === "nand") return 4;
796
- if (a === "nor") return 5;
797
- if (a === "equals") return -1;
798
- if (["not_equals", "not-equals", "not equals"].includes(a)) return -2;
799
- if (a === "gt") return -3;
800
- if (a === "lt") return -4;
801
- if (a === "ge") return -5;
802
- if (a === "le") return -6;
803
- if (a === "in") return -7;
804
- if (["not_in", "not-in", "not in"].includes(a)) return -8;
805
- if (a === "includes") return -9;
806
- if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
807
- throw new Error(`Unrecognised operator ${a}`);
808
- }
809
- n.fromString = e;
810
- function t(r) {
811
- const a = typeof r == "number" ? r : n.fromString(r);
812
- if (Object.values(n).includes(a)) return a;
773
+ function t(a) {
774
+ const r = a.toLowerCase();
775
+ if (r === "not") return 0;
776
+ if (r === "or") return 1;
777
+ if (r === "and") return 2;
778
+ if (r === "xor") return 3;
779
+ if (r === "nand") return 4;
780
+ if (r === "nor") return 5;
781
+ if (r === "equals") return -1;
782
+ if (["not_equals", "not-equals", "not equals"].includes(r)) return -2;
783
+ if (r === "gt") return -3;
784
+ if (r === "lt") return -4;
785
+ if (r === "ge") return -5;
786
+ if (r === "le") return -6;
787
+ if (r === "in") return -7;
788
+ if (["not_in", "not-in", "not in"].includes(r)) return -8;
789
+ if (r === "includes") return -9;
790
+ if (["not_includes", "not-includes", "not includes"].includes(r)) return -10;
813
791
  throw new Error(`Unrecognised operator ${r}`);
814
792
  }
815
- n.fromAny = t;
816
- function s(r) {
817
- const a = typeof r == "number" ? r : n.fromString(r);
818
- return Object.values(n).includes(a);
793
+ n.fromString = t;
794
+ function e(a) {
795
+ const r = typeof a == "number" ? a : n.fromString(a);
796
+ if (Object.values(n).includes(r)) return r;
797
+ throw new Error(`Unrecognised operator ${a}`);
798
+ }
799
+ n.fromAny = e;
800
+ function s(a) {
801
+ const r = typeof a == "number" ? a : n.fromString(a);
802
+ return Object.values(n).includes(r);
819
803
  }
820
804
  n.isDefined = s;
821
- function i(r) {
822
- return r >= 0;
805
+ function i(a) {
806
+ return a >= 0;
823
807
  }
824
808
  n.isLogicOperator = i;
825
- })(M || (M = {}));
826
- Object.freeze(M);
827
- const m = M, we = /* @__PURE__ */ Symbol("EnabledChangingAction");
828
- class Bt extends y {
829
- constructor(e) {
830
- super(e);
809
+ })(j || (j = {}));
810
+ Object.freeze(j);
811
+ const c = j, oe = /* @__PURE__ */ Symbol("EnabledChangingAction");
812
+ class _t extends p {
813
+ constructor(t) {
814
+ super(t);
831
815
  }
832
816
  static get classIdentifier() {
833
- return we;
817
+ return oe;
834
818
  }
835
- execute(e, t, s, i) {
836
- return super.execute(e, t, s, i);
819
+ execute(t, e, s, i) {
820
+ return super.execute(t, e, s, i);
837
821
  }
838
822
  }
839
- const ye = /* @__PURE__ */ Symbol("EnabledChangedAction");
840
- class Mt extends y {
841
- constructor(e) {
842
- super(e);
823
+ const le = /* @__PURE__ */ Symbol("EnabledChangedAction");
824
+ class Ot extends p {
825
+ constructor(t) {
826
+ super(t);
843
827
  }
844
828
  static get classIdentifier() {
845
- return ye;
829
+ return le;
846
830
  }
847
- execute(e, t, s, i) {
848
- return super.execute(e, t, s, i);
831
+ execute(t, e, s, i) {
832
+ return super.execute(t, e, s, i);
849
833
  }
850
834
  }
851
- const Ee = /* @__PURE__ */ Symbol("ValidChangedAction");
852
- class Ut extends y {
853
- constructor(e) {
854
- super(e);
835
+ const ue = /* @__PURE__ */ Symbol("ValidChangedAction");
836
+ class Ft extends p {
837
+ constructor(t) {
838
+ super(t);
855
839
  }
856
840
  static get classIdentifier() {
857
- return Ee;
841
+ return ue;
858
842
  }
859
- execute(e, t, s, i) {
860
- return super.execute(e, t, s, i);
843
+ execute(t, e, s, i) {
844
+ return super.execute(t, e, s, i);
861
845
  }
862
846
  }
863
- const Ce = /* @__PURE__ */ Symbol("VisibilityChangingAction");
864
- class Wt extends y {
865
- constructor(e) {
866
- super(e);
847
+ const ce = /* @__PURE__ */ Symbol("VisibilityChangingAction");
848
+ class Rt extends p {
849
+ constructor(t) {
850
+ super(t);
867
851
  }
868
852
  static get classIdentifier() {
869
- return Ce;
853
+ return ce;
870
854
  }
871
- execute(e, t, s, i) {
872
- return super.execute(e, t, s, i);
855
+ execute(t, e, s, i) {
856
+ return super.execute(t, e, s, i);
873
857
  }
874
858
  }
875
- const xe = /* @__PURE__ */ Symbol("VisibilityChangedAction");
876
- class $t extends y {
877
- constructor(e) {
878
- super(e);
859
+ const he = /* @__PURE__ */ Symbol("VisibilityChangedAction");
860
+ class Pt extends p {
861
+ constructor(t) {
862
+ super(t);
879
863
  }
880
864
  static get classIdentifier() {
881
- return xe;
882
- }
883
- execute(e, t, s, i) {
884
- return super.execute(e, t, s, i);
885
- }
886
- }
887
- const xt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new Set(["validators", "actions"]);
888
- let st = 0;
889
- var h, f;
890
- class A {
891
- constructor(e) {
892
- /**
893
- * The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read
894
- * through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.
895
- * `#raw` is the same object without the proxy, for the bookkeeping nothing renders from.
896
- *
897
- * They are private class fields, so no reflection over the element reaches the state or the parent link it
898
- * carries, and a subclass reads its own slot type through the accessors below.
899
- */
900
- Z(this, h);
901
- Z(this, f);
902
- tt(this, f, e), tt(this, h, ee(e));
865
+ return he;
866
+ }
867
+ execute(t, e, s, i) {
868
+ return super.execute(t, e, s, i);
903
869
  }
870
+ }
871
+ const ht = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new Set(["validators", "actions"]);
872
+ let z = 0;
873
+ class V {
904
874
  /**
905
875
  * Vue's getTargetType answers INVALID for an object that carries __v_skip, so reactive() hands an element back
906
876
  * unwrapped and no element is ever behind a proxy of its own. isReactive() reads the second flag, and it stays
@@ -918,13 +888,26 @@ class A {
918
888
  get __v_isReactive() {
919
889
  return !0;
920
890
  }
891
+ /**
892
+ * The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read
893
+ * through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.
894
+ * `#raw` is the same object without the proxy, for the bookkeeping nothing renders from.
895
+ *
896
+ * They are private class fields, so no reflection over the element reaches the state or the parent link it
897
+ * carries, and a subclass reads its own slot type through the accessors below.
898
+ */
899
+ #t;
900
+ #e;
901
+ constructor(t) {
902
+ this.#e = t, this.#t = Ut(t);
903
+ }
921
904
  /** the tracked view of this element's state; a subclass narrows the return type to its own slots */
922
905
  get state() {
923
- return l(this, h);
906
+ return this.#t;
924
907
  }
925
908
  /** the untracked view of this element's state; a subclass narrows the return type to its own slots */
926
909
  get raw() {
927
- return l(this, f);
910
+ return this.#e;
928
911
  }
929
912
  /**
930
913
  * Exchanges the data this element holds for `data`, in place. The element is the same instance afterwards - its
@@ -942,19 +925,19 @@ class A {
942
925
  * The data is measured against the element's `declaration`, so a key a record leaves out is taken from the
943
926
  * declaration rather than left as the previous record had it.
944
927
  */
945
- rebind(e) {
946
- return g((t) => {
947
- t.touch(this);
948
- const s = t.willAnnounceValue(this), i = l(this, f).announcedValue;
949
- this.resetTo(this.declaration, e), l(this, f).announcedValue = s ? i : this.value;
928
+ rebind(t) {
929
+ return u((e) => {
930
+ e.touch(this);
931
+ const s = e.willAnnounceValue(this), i = this.#e.announcedValue;
932
+ this.resetTo(this.declaration, t), this.#e.announcedValue = s ? i : this.value;
950
933
  }), this;
951
934
  }
952
935
  /** contains original field value as was provided at creation */
953
936
  get originalValue() {
954
- return l(this, h).originalValue;
937
+ return this.#t.originalValue;
955
938
  }
956
- set originalValue(e) {
957
- this.touchState(), l(this, h).originalValue = e;
939
+ set originalValue(t) {
940
+ this.touchState(), this.#t.originalValue = t;
958
941
  }
959
942
  /**
960
943
  * The extended properties this element carries: what a consumer attached to it beyond the members the class
@@ -969,14 +952,14 @@ class A {
969
952
  * and one written in place would leave a rollback with nothing to put back.
970
953
  */
971
954
  get extra() {
972
- return l(this, h).extra;
955
+ return this.#t.extra;
973
956
  }
974
957
  /**
975
958
  * Writes extended properties. The values given are merged over the ones the element carries, so a write of one
976
959
  * property leaves the others standing, and the merged set replaces the object the element held.
977
960
  */
978
- setExtendedValues(e) {
979
- this.touchState(), l(this, h).extra = Object.freeze(p(p({}, l(this, f).extra), e));
961
+ setExtendedValues(t) {
962
+ this.touchState(), this.#t.extra = Object.freeze({ ...this.#e.extra, ...t });
980
963
  }
981
964
  /**
982
965
  * The extended properties a parameter object carries: every key the element does not answer for itself. A key
@@ -988,22 +971,22 @@ class A {
988
971
  * defined on the instance after the base constructor returns, and the parameters are applied inside it. A
989
972
  * subclass that wants a parameter of its own name assigned to it declares that member as an accessor.
990
973
  */
991
- extendedOf(e) {
992
- const t = /* @__PURE__ */ Object.create(null);
993
- return Object.entries(e).forEach(([s, i]) => {
994
- St.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (t[s] = i);
995
- }), t;
974
+ extendedOf(t) {
975
+ const e = /* @__PURE__ */ Object.create(null);
976
+ return Object.entries(t).forEach(([s, i]) => {
977
+ gt.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (e[s] = i);
978
+ }), e;
996
979
  }
997
980
  /**
998
981
  * Applies a parameter object: the members the element answers for are assigned to the element and the rest
999
982
  * become its extended properties. Assigning a getter-only member throws a TypeError, which is what a caller
1000
983
  * naming `valid` or `parent` past the type system gets.
1001
984
  */
1002
- assignParams(e) {
1003
- const t = this.extendedOf(e);
1004
- Object.entries(e).forEach(([s, i]) => {
1005
- Object.hasOwn(t, s) || St.has(s) || (this[s] = i);
1006
- }), L(t) || this.setExtendedValues(t);
985
+ assignParams(t) {
986
+ const e = this.extendedOf(t);
987
+ Object.entries(t).forEach(([s, i]) => {
988
+ Object.hasOwn(e, s) || gt.has(s) || (this[s] = i);
989
+ }), R(e) || this.setExtendedValues(e);
1007
990
  }
1008
991
  /**
1009
992
  * Takes this element into the record of the open transaction, where one is open. A write of a single slot that
@@ -1011,8 +994,7 @@ class A {
1011
994
  * atomic, and inside a transaction it has to be part of what a rollback puts back.
1012
995
  */
1013
996
  touchState() {
1014
- var e;
1015
- (e = kt()) == null || e.touch(this);
997
+ St()?.touch(this);
1016
998
  }
1017
999
  /**
1018
1000
  * Records the whole of this element's mutable state, so that a rolled-back transaction can put it back exactly
@@ -1022,31 +1004,92 @@ class A {
1022
1004
  * What is not in the snapshot is the action map, which no write touches: an operation that replaces it hands
1023
1005
  * the transaction its own undo instead, so this stays the one shape every element captures.
1024
1006
  */
1025
- [$]() {
1026
- return C(p({}, l(this, f)), { errors: [...l(this, f).errors] });
1007
+ [O]() {
1008
+ return { ...this.#e, errors: [...this.#e.errors] };
1027
1009
  }
1028
1010
  /**
1029
1011
  * Puts a captured state back. It writes through the tracked view, so an effect that ran on the state the
1030
1012
  * transaction produced runs again on the state it is being returned to, and only for the slots that differ.
1031
1013
  *
1032
- * validatingCount is the one slot the element keeps: it counts runs that are in flight, and a rollback cannot
1033
- * un-start one. Put back, the count would no longer match the endValidating calls still to come.
1014
+ * The two validation counters are the slots the element keeps: they count runs that are in flight, and a
1015
+ * rollback cannot un-start one. Put back, the counts would no longer match the endValidating calls still to come.
1034
1016
  */
1035
- [jt](e) {
1036
- const t = l(this, f).validatingCount;
1037
- Object.assign(l(this, h), e), l(this, h).validatingCount = t;
1017
+ [Ct](t) {
1018
+ const e = this.#e.validatingCount, s = this.#e.validatingChildren;
1019
+ Object.assign(this.#t, t), this.#t.validatingCount = e, this.#t.validatingChildren = s;
1038
1020
  }
1039
- /** true while at least one asynchronous validator is still running for this field */
1021
+ /**
1022
+ * True while an asynchronous validation is in flight on this element or on anything below it, so a form answers
1023
+ * for the whole tree it holds. The answer is a pair of counters rather than a walk: the element's own runs, and
1024
+ * how many of its children answer the same question with true. A child that starts running while it was idle,
1025
+ * or stops while it was the last one running, moves its container's tally, and a tally that changes the
1026
+ * container's own answer moves the one above it - the transition costs the nesting depth and the read costs
1027
+ * nothing.
1028
+ */
1040
1029
  get validating() {
1041
- return l(this, h).validatingCount > 0;
1030
+ return this.#t.validatingCount > 0 || this.#t.validatingChildren > 0;
1042
1031
  }
1043
1032
  /** announces the start of one asynchronous validation run; validators pair it with endValidating */
1044
1033
  beginValidating() {
1045
- l(this, h).validatingCount++;
1034
+ const t = !this.validating;
1035
+ this.#t.validatingCount++, t && this.parent?.childValidatingChanged(!0);
1046
1036
  }
1047
1037
  /** announces the end of one asynchronous validation run */
1048
1038
  endValidating() {
1049
- l(this, h).validatingCount = Math.max(0, l(this, h).validatingCount - 1);
1039
+ this.#e.validatingCount !== 0 && (this.#t.validatingCount--, this.validating || this.parent?.childValidatingChanged(!1));
1040
+ }
1041
+ /**
1042
+ * Records that a child started or stopped answering `validating` with true, and carries the transition further
1043
+ * up where it changes this element's own answer.
1044
+ */
1045
+ childValidatingChanged(t) {
1046
+ const e = this.validating;
1047
+ this.#t.validatingChildren += t ? 1 : -1, this.validating !== e && this.parent?.childValidatingChanged(t);
1048
+ }
1049
+ /**
1050
+ * True while an `Action.execute()` at or below this element has yet to settle. An `Action` answers for its own
1051
+ * runs; a container answers for the actions below it; anything else answers false, because an element that is
1052
+ * not an action has nothing to execute.
1053
+ *
1054
+ * It states one thing and `validating` states the other, so a form that gates a submit button on the tree being
1055
+ * idle reads both.
1056
+ */
1057
+ get busy() {
1058
+ return !1;
1059
+ }
1060
+ /**
1061
+ * The composed answer a container gives `busy`, memoised by Vue. An `Action` counts its executions in a counter
1062
+ * of its own, which no container is told about, so the answer is composed over the members instead of tallied;
1063
+ * the computed keeps the walk from repeating while nothing it read has moved, and a member that is itself a
1064
+ * container answers from its own computed.
1065
+ */
1066
+ get busyRead() {
1067
+ let t = dt.get(this);
1068
+ return t || (t = X(() => this.composeBusy()), dt.set(this, t)), t.value;
1069
+ }
1070
+ /** What busyRead computes. A container answers over its members; anything else executes nothing. */
1071
+ composeBusy() {
1072
+ return !1;
1073
+ }
1074
+ /**
1075
+ * Resolves once nothing at or below this element is running - no asynchronous validation, no `Action.execute()`
1076
+ * that has yet to settle. It is what a submit path awaits instead of polling `validating` and `busy`, and it
1077
+ * resolves at once where nothing is running to begin with.
1078
+ *
1079
+ * It answers for the moment it resolves and makes no promise about the one after: work started later leaves the
1080
+ * element running again, so a caller that has to act on a settled tree reads what it needs immediately after
1081
+ * awaiting rather than at its leisure.
1082
+ */
1083
+ settled() {
1084
+ return !this.validating && !this.busy ? Promise.resolve() : new Promise((t) => {
1085
+ const e = $t(
1086
+ () => this.validating || this.busy,
1087
+ (s) => {
1088
+ s || (e(), t());
1089
+ },
1090
+ { flush: "sync" }
1091
+ );
1092
+ });
1050
1093
  }
1051
1094
  /**
1052
1095
  * List of errors. The array handed out is the one the element holds, and a validator writes into it in place,
@@ -1054,10 +1097,10 @@ class A {
1054
1097
  * except the errors would leave a state the form never held.
1055
1098
  */
1056
1099
  get errors() {
1057
- return this.touchState(), l(this, h).errors;
1100
+ return this.touchState(), this.#t.errors;
1058
1101
  }
1059
- set errors(e) {
1060
- this.touchState(), l(this, h).errors = e;
1102
+ set errors(t) {
1103
+ this.touchState(), this.#t.errors = t;
1061
1104
  }
1062
1105
  /**
1063
1106
  * The container that holds this element: the Group it is a member of, or the List whose row it is, and
@@ -1066,11 +1109,11 @@ class A {
1066
1109
  * releases it.
1067
1110
  */
1068
1111
  get parent() {
1069
- return l(this, h).parent;
1112
+ return this.#t.parent;
1070
1113
  }
1071
1114
  /** when member of a Group, fieldName specifies the name of this field. Written by the group, read-only after */
1072
1115
  get fieldName() {
1073
- return l(this, h).fieldName;
1116
+ return this.#t.fieldName;
1074
1117
  }
1075
1118
  /**
1076
1119
  * The element this one was declared as: itself for an element built from parameters, and the element it was
@@ -1079,8 +1122,7 @@ class A {
1079
1122
  * answer with the same element, and an action registered on the template can tell the two apart.
1080
1123
  */
1081
1124
  get declaration() {
1082
- var e;
1083
- return (e = l(this, f).declaration) != null ? e : this;
1125
+ return this.#e.declaration ?? this;
1084
1126
  }
1085
1127
  /** The elements this one holds: a Group's members, a List's rows, none for a leaf. */
1086
1128
  get members() {
@@ -1092,9 +1134,9 @@ class A {
1092
1134
  * field that every row of a list reacts to - and it costs the subtree, so it is the path taken only when the
1093
1135
  * cheaper one, resolving within a single record, does not apply.
1094
1136
  */
1095
- bindingsOf(e) {
1096
- const t = e.declaration, s = [], i = (r) => {
1097
- r.declaration === t && s.push(r), r.members.forEach(i);
1137
+ bindingsOf(t) {
1138
+ const e = t.declaration, s = [], i = (a) => {
1139
+ a.declaration === e && s.push(a), a.members.forEach(i);
1098
1140
  };
1099
1141
  return i(this), s;
1100
1142
  }
@@ -1106,33 +1148,32 @@ class A {
1106
1148
  * nothing says so again, so the next container above answers for it.
1107
1149
  */
1108
1150
  markRecordIncomplete() {
1109
- this._recordPending || (this._recordPending = !0, st++);
1151
+ this._recordPending || (this._recordPending = !0, z++);
1110
1152
  }
1111
1153
  /**
1112
1154
  * Runs the eager passes outstanding in `element`'s subtree, now that the record it belongs to is assembled. A
1113
1155
  * container calls it where it has just made a record complete: a Group that has written its members, and a
1114
1156
  * List that has taken a row, which is what gives the row's fields the form above it.
1115
1157
  */
1116
- completeRecords(e = this) {
1117
- st !== 0 && g(() => {
1118
- const t = (s) => {
1119
- s._recordPending && (s._recordPending = !1, st--, s.rerunEagerActions()), s.members.forEach(t);
1158
+ completeRecords(t = this) {
1159
+ z !== 0 && u(() => {
1160
+ const e = (s) => {
1161
+ s._recordPending && (s._recordPending = !1, z--, s.rerunEagerActions()), s.members.forEach(e);
1120
1162
  };
1121
- t(e);
1163
+ e(t);
1122
1164
  });
1123
1165
  }
1124
1166
  /** Runs this element's eager actions over the value it holds and re-forms the verdict they reach. */
1125
1167
  rerunEagerActions() {
1126
- g((e) => {
1127
- var t;
1128
- (t = this._actions) == null || t.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1168
+ u((t) => {
1169
+ this._actions?.triggerEager(this, this.value, this.value), t.markValidityDirty(this);
1129
1170
  });
1130
1171
  }
1131
1172
  get actions() {
1132
- return this._actions || (this._actions = new H()), this._actions;
1173
+ return this._actions || (this._actions = new D()), this._actions;
1133
1174
  }
1134
- set actions(e) {
1135
- this._actions = e;
1175
+ set actions(t) {
1176
+ this._actions = t;
1136
1177
  }
1137
1178
  /**
1138
1179
  * Counts the writes that have changed the value of this element or of anything below it. A container reads it
@@ -1140,7 +1181,7 @@ class A {
1140
1181
  * cached value still re-runs when a descendant is written.
1141
1182
  */
1142
1183
  get valueVersion() {
1143
- return l(this, h).valueVersion;
1184
+ return this.#t.valueVersion;
1144
1185
  }
1145
1186
  /**
1146
1187
  * Marks the value of this element and of every ancestor as superseded. It walks the parent chain, so it costs
@@ -1149,11 +1190,11 @@ class A {
1149
1190
  * rollback puts the versions back and no reader is left holding a cache the tree no longer supports.
1150
1191
  */
1151
1192
  bumpValueVersion() {
1152
- g((e) => {
1153
- e.touch(this), l(this, h).valueVersion++;
1154
- let t = this.parent;
1155
- for (; t; )
1156
- e.touch(t), l(t, h).valueVersion++, t = t.parent;
1193
+ u((t) => {
1194
+ t.touch(this), this.#t.valueVersion++;
1195
+ let e = this.parent;
1196
+ for (; e; )
1197
+ t.touch(e), e.#t.valueVersion++, e = e.parent;
1157
1198
  });
1158
1199
  }
1159
1200
  /**
@@ -1164,10 +1205,9 @@ class A {
1164
1205
  * `force` states that the caller already knows this element's value changed - one item more or fewer is a
1165
1206
  * different list whatever the items compare as - so the commit announces it without composing a comparison.
1166
1207
  */
1167
- propagateValueChanged(e = !1) {
1168
- g((t) => {
1169
- var s;
1170
- t.markValueChanged(this, e), t.markValidityDirty(this), (s = this.parent) == null || s.notifyValueChanged();
1208
+ propagateValueChanged(t = !1) {
1209
+ u((e) => {
1210
+ e.markValueChanged(this, t), e.markValidityDirty(this), this.parent?.notifyValueChanged();
1171
1211
  });
1172
1212
  }
1173
1213
  /**
@@ -1184,7 +1224,7 @@ class A {
1184
1224
  * without a validate() call, which is the documented cost of pushing errors by hand.
1185
1225
  */
1186
1226
  get countedValid() {
1187
- return l(this, f).errors.length === 0 && l(this, f).invalidChildren === 0;
1227
+ return this.#e.errors.length === 0 && this.#e.invalidChildren === 0;
1188
1228
  }
1189
1229
  /**
1190
1230
  * Makes this element the container of `child`: it installs the back-reference, records the name a Group holds
@@ -1193,16 +1233,18 @@ class A {
1193
1233
  * released that way can be handed on. The child's state is unreachable from outside FieldBase, so a container
1194
1234
  * writes the two slots through here rather than on the child.
1195
1235
  */
1196
- takeChild(e, t) {
1197
- g((s) => {
1198
- if (e.parent) throw new TypeError("This element already belongs to a container - pass a bind() of it");
1199
- s.touch(e), l(e, h).fieldName = t, l(e, h).parent = this, this.adoptChild(e);
1236
+ takeChild(t, e) {
1237
+ u((s) => {
1238
+ if (t.parent) throw new TypeError("This element already belongs to a container - pass a bind() of it");
1239
+ s.touch(t), t.#t.fieldName = e, t.#t.parent = this, this.adoptChild(t);
1200
1240
  });
1201
1241
  }
1202
1242
  /** Takes a child into this element's invalid tally; a container calls it once the child's parent link exists. */
1203
- adoptChild(e) {
1204
- g((t) => {
1205
- t.touch(this), l(e, f).valid || l(this, f).invalidChildren++, t.markValidityDirty(this);
1243
+ adoptChild(t) {
1244
+ u((e) => {
1245
+ e.touch(this), t.#e.valid || this.#e.invalidChildren++, t.validating && this.childValidatingChanged(!0), e.whenRolledBack(() => {
1246
+ t.validating && this.childValidatingChanged(!1);
1247
+ }), e.markValidityDirty(this);
1206
1248
  });
1207
1249
  }
1208
1250
  /**
@@ -1210,9 +1252,11 @@ class A {
1210
1252
  * to a container that no longer holds it: it would go on moving that container's tally, and the link is what
1211
1253
  * stands in the way of the element being taken by another container.
1212
1254
  */
1213
- releaseChild(e) {
1214
- g((t) => {
1215
- t.touch(this), t.touch(e), l(e, f).valid || l(this, f).invalidChildren--, l(e, h).parent = void 0, t.markValidityDirty(this);
1255
+ releaseChild(t) {
1256
+ u((e) => {
1257
+ e.touch(this), e.touch(t), t.#e.valid || this.#e.invalidChildren--, t.validating && this.childValidatingChanged(!1), e.whenRolledBack(() => {
1258
+ t.validating && this.childValidatingChanged(!0);
1259
+ }), t.#t.parent = void 0, t.#t.fieldName = void 0, e.markValidityDirty(this);
1216
1260
  });
1217
1261
  }
1218
1262
  /**
@@ -1222,24 +1266,24 @@ class A {
1222
1266
  * an element at a position it already holds calls it, so the element is indistinguishable from one built for
1223
1267
  * that position.
1224
1268
  */
1225
- resetTo(e, t) {
1226
- g(() => {
1227
- const s = t === void 0 ? e.value : t, i = this.errors.length > 0;
1269
+ resetTo(t, e) {
1270
+ u(() => {
1271
+ const s = e === void 0 ? t.value : e, i = this.errors.length > 0;
1228
1272
  i && (this.errors = []), this.touched = !1;
1229
- const r = this.enabled && this.value !== s;
1230
- this.value = s, this.originalValue = this.value, this.validate(!r && i);
1273
+ const a = this.enabled && this.value !== s;
1274
+ this.value = s, this.originalValue = this.value, this.validate(!a && i);
1231
1275
  });
1232
1276
  }
1233
1277
  /** Resets a member. It is what lets a container reach the reset of a child whose class it does not know. */
1234
- resetChild(e, t, s) {
1235
- e.resetTo(t, s);
1278
+ resetChild(t, e, s) {
1279
+ t.resetTo(e, s);
1236
1280
  }
1237
1281
  /**
1238
1282
  * Records a child's new verdict in this element's tally. The child reports it as it settles, and the commit
1239
1283
  * settles the deepest element first, so the tally a container reads when its own turn comes is finished.
1240
1284
  */
1241
- childValidityChanged(e) {
1242
- l(this, f).invalidChildren += e ? -1 : 1;
1285
+ childValidityChanged(t) {
1286
+ this.#e.invalidChildren += t ? -1 : 1;
1243
1287
  }
1244
1288
  /**
1245
1289
  * The composed verdict a container answers `valid` with, memoised by Vue. The walk over the members is what
@@ -1247,35 +1291,33 @@ class A {
1247
1291
  * from repeating while nothing it read has moved.
1248
1292
  */
1249
1293
  get validRead() {
1250
- let e = xt.get(this);
1251
- return e || (e = Tt(() => this.composeValid()), xt.set(this, e)), e.value;
1294
+ let t = ht.get(this);
1295
+ return t || (t = X(() => this.composeValid()), ht.set(this, t)), t.value;
1252
1296
  }
1253
1297
  /** What validRead computes. A leaf answers over its own errors; a container adds its members. */
1254
1298
  composeValid() {
1255
- return l(this, h).errors.length === 0;
1299
+ return this.#t.errors.length === 0;
1256
1300
  }
1257
1301
  // default property handlers
1258
1302
  get visibility() {
1259
- return l(this, h).visibility;
1303
+ return this.#t.visibility;
1260
1304
  }
1261
- set visibility(e) {
1262
- g((t) => {
1263
- var r, a;
1264
- const s = l(this, h).visibility, i = (r = this._actions) == null ? void 0 : r.trigger(Wt, this, e, s);
1265
- if (!N.isDefined(i != null ? i : e))
1305
+ set visibility(t) {
1306
+ u((e) => {
1307
+ const s = this.#t.visibility, i = this._actions?.trigger(Rt, this, t, s);
1308
+ if (!_.isDefined(i ?? t))
1266
1309
  throw new Error("visibility must be a DisplayMode constant");
1267
- t.touch(this), l(this, h).visibility = N.fromAny(i != null ? i : e), (a = this._actions) == null || a.trigger($t, this, l(this, h).visibility, s);
1310
+ e.touch(this), this.#t.visibility = _.fromAny(i ?? t), this._actions?.trigger(Pt, this, this.#t.visibility, s);
1268
1311
  });
1269
1312
  }
1270
1313
  get enabled() {
1271
- return l(this, h).enabled;
1272
- }
1273
- set enabled(e) {
1274
- g((t) => {
1275
- var r, a;
1276
- const s = l(this, h).enabled, i = (r = this._actions) == null ? void 0 : r.trigger(Bt, this, e, s);
1277
- if (!Kt(i != null ? i : e)) throw new Error("Enabled value must be boolean");
1278
- t.touch(this), l(this, h).enabled = i != null ? i : e, l(this, h).enabled !== s && this.bumpValueVersion(), (a = this._actions) == null || a.trigger(Mt, this, l(this, h).enabled, s);
1314
+ return this.#t.enabled;
1315
+ }
1316
+ set enabled(t) {
1317
+ u((e) => {
1318
+ const s = this.#t.enabled, i = this._actions?.trigger(_t, this, t, s);
1319
+ if (!Lt(i ?? t)) throw new Error("Enabled value must be boolean");
1320
+ e.touch(this), this.#t.enabled = i ?? t, this.#t.enabled !== s && this.bumpValueVersion(), this._actions?.trigger(Ot, this, this.#t.enabled, s);
1279
1321
  });
1280
1322
  }
1281
1323
  /**
@@ -1294,15 +1336,12 @@ class A {
1294
1336
  * operation states rather than an element's state - an item added, an item removed - are emitted first, in the
1295
1337
  * order the operations happened.
1296
1338
  */
1297
- [Pt](e, t, s, i) {
1298
- if (i == null || i.forEach((u) => {
1299
- var c;
1300
- return (c = this._actions) == null ? void 0 : c.trigger(u.actionClass, this, u.item, u.index);
1301
- }), !t) return;
1302
- const r = this._actions;
1303
- if (this.composesValue && !(r != null && r.willTrigger(Ft) || r != null && r.hasEager)) return;
1304
- const a = this.value, o = l(this, f).announcedValue;
1305
- !s && (this.composesValue ? nt(a, o) : a === o) || (e.touch(this), l(this, f).announcedValue = a, this.composesValue && (r == null || r.triggerEager(this, a, o)), r == null || r.trigger(O, this, a, o));
1339
+ [Et](t, e, s, i) {
1340
+ if (i?.forEach((l) => this._actions?.trigger(l.actionClass, this, l.item, l.index)), !e) return;
1341
+ const a = this._actions;
1342
+ if (this.composesValue && !(a?.willTrigger(yt) || a?.hasEager)) return;
1343
+ const r = this.value, o = this.#e.announcedValue;
1344
+ !s && (this.composesValue ? Q(r, o) : r === o) || (t.touch(this), this.#e.announcedValue = r, this.composesValue && a?.triggerEager(this, r, o), a?.trigger(S, this, r, o));
1306
1345
  }
1307
1346
  /**
1308
1347
  * Forms the verdict this element ends the transaction with and announces a transition of it. The container is
@@ -1311,28 +1350,26 @@ class A {
1311
1350
  * asynchronous validator, an error pushed in by hand - is what makes the container re-form its own. The
1312
1351
  * transaction settles the deepest element first, so a container is reached only once its members have decided.
1313
1352
  */
1314
- [Nt](e) {
1315
- var r;
1316
- const t = l(this, f).valid, s = this.countedValid;
1317
- if (s === t) return;
1318
- e.touch(this), l(this, f).valid = s;
1353
+ [xt](t) {
1354
+ const e = this.#e.valid, s = this.countedValid;
1355
+ if (s === e) return;
1356
+ t.touch(this), this.#e.valid = s;
1319
1357
  const i = this.parent;
1320
- i && (e.touch(i), i.childValidityChanged(s), e.markValidityDirty(i)), (r = this._actions) == null || r.trigger(Ut, this, s, t);
1358
+ i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this._actions?.trigger(Ft, this, s, e);
1321
1359
  }
1322
- validate(e = !1) {
1323
- g((t) => {
1324
- var s;
1325
- e && ((s = this._actions) == null || s.triggerEager(this, this.value, this.value)), t.markValidityDirty(this);
1360
+ validate(t = !1) {
1361
+ u((e) => {
1362
+ t && this._actions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1326
1363
  });
1327
1364
  }
1328
1365
  get valid() {
1329
- return l(this, h).errors.length === 0;
1366
+ return this.#t.errors.length === 0;
1330
1367
  }
1331
1368
  get fullValue() {
1332
1369
  return this.value;
1333
1370
  }
1334
1371
  get isChanged() {
1335
- return !nt(this.value, this.originalValue);
1372
+ return !Q(this.value, this.originalValue);
1336
1373
  }
1337
1374
  /**
1338
1375
  * Brings a fresh element into the state a binding of `source` is in: it records what it was declared as, takes
@@ -1342,26 +1379,26 @@ class A {
1342
1379
  * actions are the very instances `source` holds - what a binding takes on is data, not behaviour - and each is
1343
1380
  * told about this element as it is taken on, so an action serving several bindings knows all of them.
1344
1381
  */
1345
- boundFrom(e, t, s, i) {
1346
- l(this, f).declaration = e.declaration;
1347
- const r = p(p({}, e.extra), i && this.extendedOf(i));
1348
- L(r) || this.setExtendedValues(r);
1349
- const a = e._actions;
1350
- a && (this._actions = a.clone(), this._actions.bindTo(this), this._actions.triggerEager(this, t, s));
1382
+ boundFrom(t, e, s, i) {
1383
+ this.#e.declaration = t.declaration;
1384
+ const a = { ...t.extra, ...i && this.extendedOf(i) };
1385
+ R(a) || this.setExtendedValues(a);
1386
+ const r = t._actions;
1387
+ r && (this._actions = r.clone(), this._actions.bindTo(this), this._actions.triggerEager(this, e, s));
1351
1388
  }
1352
1389
  /**
1353
1390
  * Registers the actions a constructor received in its parameters: registration without the eager trigger,
1354
1391
  * because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an
1355
1392
  * eager action registered here would otherwise also run once per registration, over a half-built field.
1356
1393
  */
1357
- registerInitialActions(e) {
1358
- e.forEach((t) => {
1359
- this.actions.register(t), t.boundToBinding(this);
1394
+ registerInitialActions(t) {
1395
+ t.forEach((e) => {
1396
+ this.actions.register(e), e.boundToBinding(this);
1360
1397
  });
1361
1398
  }
1362
- registerAction(e) {
1363
- return g((t) => {
1364
- t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), this.registered(t, e), e.eager && this.actions.triggerEagerFor(e.classIdentifier, this, this.value, this.originalValue);
1399
+ registerAction(t) {
1400
+ return u((e) => {
1401
+ e.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t), this.registered(e, t), t.eager && this.actions.triggerEagerFor(t.classIdentifier, this, this.value, this.originalValue);
1365
1402
  }), this;
1366
1403
  }
1367
1404
  /**
@@ -1370,9 +1407,9 @@ class A {
1370
1407
  * handler already registered, which registration order alone cannot arrange. `before` has to be registered on
1371
1408
  * this element under the same identifier.
1372
1409
  */
1373
- registerActionBefore(e, t) {
1374
- return g((s) => {
1375
- s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e, t), this.registered(s, e), e.eager && this.actions.triggerEagerFor(e.classIdentifier, this, this.value, this.originalValue);
1410
+ registerActionBefore(t, e) {
1411
+ return u((s) => {
1412
+ s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t, e), this.registered(s, t), t.eager && this.actions.triggerEagerFor(t.classIdentifier, this, this.value, this.originalValue);
1376
1413
  }), this;
1377
1414
  }
1378
1415
  /**
@@ -1381,27 +1418,26 @@ class A {
1381
1418
  * withdraws the errors it put on this element as it goes, so the verdict the element reports is the one the
1382
1419
  * validators it still holds reach.
1383
1420
  */
1384
- unregisterAction(e) {
1385
- let t = !1;
1386
- return g((s) => {
1421
+ unregisterAction(t) {
1422
+ let e = !1;
1423
+ return u((s) => {
1387
1424
  const i = this._actions;
1388
- i && (t = i.unregister(e), t && (s.touch(this), e instanceof v && l(this, h).validationEpoch++, s.whenRolledBack(() => {
1389
- i.register(e), e.boundToBinding(this);
1390
- }), e.unregisterFrom(this)));
1391
- }), t;
1425
+ i && (e = i.unregister(t), e && (s.touch(this), t instanceof g && this.#t.validationEpoch++, s.whenRolledBack(() => {
1426
+ i.register(t), t.boundToBinding(this);
1427
+ }), t.unregisterFrom(this)));
1428
+ }), e;
1392
1429
  }
1393
1430
  /**
1394
1431
  * Records that `action` is now registered on this element, and that a rollback has to take that back. The
1395
1432
  * registration is not one of the state slots the snapshot covers, so it hands its own undo in.
1396
1433
  */
1397
- registered(e, t) {
1398
- t.boundToBinding(this), e.whenRolledBack(() => {
1399
- var s;
1400
- (s = this._actions) != null && s.unregister(t) && t.unregisterFrom(this);
1434
+ registered(t, e) {
1435
+ e.boundToBinding(this), t.whenRolledBack(() => {
1436
+ this._actions?.unregister(e) && e.unregisterFrom(this);
1401
1437
  });
1402
1438
  }
1403
- triggerAction(e, ...t) {
1404
- return this._actions ? this._actions.trigger(e, this, ...t) : null;
1439
+ triggerAction(t, ...e) {
1440
+ return this._actions ? this._actions.trigger(t, this, ...e) : null;
1405
1441
  }
1406
1442
  /**
1407
1443
  * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
@@ -1409,30 +1445,46 @@ class A {
1409
1445
  * cannot push an error onto a field that no longer has the validator that produced it.
1410
1446
  */
1411
1447
  get validationEpoch() {
1412
- return l(this, h).validationEpoch;
1448
+ return this.#t.validationEpoch;
1413
1449
  }
1414
1450
  clearValidators() {
1415
- g((e) => {
1416
- e.touch(this), l(this, h).validationEpoch++;
1417
- const t = this._actions;
1418
- t && t.validators.forEach((s) => {
1419
- t.unregister(s), e.whenRolledBack(() => {
1420
- t.register(s), s.boundToBinding(this);
1451
+ u((t) => {
1452
+ t.touch(this), this.#t.validationEpoch++;
1453
+ const e = this._actions;
1454
+ e && e.validators.forEach((s) => {
1455
+ e.unregister(s), t.whenRolledBack(() => {
1456
+ e.register(s), s.boundToBinding(this);
1421
1457
  }), s.unregisterFrom(this);
1422
1458
  }), this.errors = [], this.validate();
1423
1459
  });
1424
1460
  }
1425
1461
  }
1426
- h = new WeakMap(), f = new WeakMap();
1427
- function Se(n, e) {
1428
- return n ? !e : e;
1462
+ function de(n, t) {
1463
+ return n ? !t : t;
1429
1464
  }
1430
- class I {
1431
- constructor(e, t, s) {
1432
- d(this, "operand1");
1433
- d(this, "operator");
1434
- d(this, "operand2");
1435
- this.operand1 = e, this.operator = t, this.operand2 = s;
1465
+ class v {
1466
+ operand1;
1467
+ operator;
1468
+ operand2;
1469
+ /**
1470
+ * An operand is a nested `Statement`, a `FieldBase` whose value is compared, or a literal. `undefined` and a
1471
+ * function are neither: they are what a misspelled field name and a field accessor handed over uncalled answer
1472
+ * with, and a statement built from one compares nothing and never fires. The position names which of the two
1473
+ * operands is at fault, so the error points at the place the name was written.
1474
+ */
1475
+ static validateOperand(t, e) {
1476
+ if (t === void 0)
1477
+ throw new TypeError(
1478
+ `Statement operand ${e} is undefined: an operand is a field, a nested statement or a literal, and a name resolving to nothing is none of them. Compare against null to test for an unset value.`
1479
+ );
1480
+ if (typeof t == "function")
1481
+ throw new TypeError(
1482
+ `Statement operand ${e} is a function: an operand is a field, a nested statement or a literal, and a function is none of them. An accessor states the field it answers with: group.field('name').`
1483
+ );
1484
+ }
1485
+ /** @throws TypeError where an operand the statement reads is undefined or a function. */
1486
+ constructor(t, e, s) {
1487
+ v.validateOperand(t, 1), e !== c.NOT && v.validateOperand(s, 2), this.operand1 = t, this.operator = e, this.operand2 = s;
1436
1488
  }
1437
1489
  /**
1438
1490
  * The value an operand contributes. A field operand names a field of the record the statement is evaluated in:
@@ -1440,66 +1492,65 @@ class I {
1440
1492
  * record of the statement's own - a form field above the list - is read where it stands. A record that does not
1441
1493
  * hold the field yet contributes undefined, which is what a half-built row answers with.
1442
1494
  */
1443
- static valueOf(e, t) {
1444
- if (e instanceof I) return e.evaluate(t);
1445
- if (e instanceof A) {
1446
- const s = t ? lt(e, t) : e;
1447
- return s ? b(s.value) : void 0;
1495
+ static valueOf(t, e) {
1496
+ if (t instanceof v) return t.evaluate(e);
1497
+ if (t instanceof V) {
1498
+ const s = e ? G(t, e) : t;
1499
+ return s ? h(s.value) : void 0;
1448
1500
  }
1449
- return e;
1501
+ return t;
1450
1502
  }
1451
1503
  get operand1Value() {
1452
- return I.valueOf(this.operand1);
1504
+ return v.valueOf(this.operand1);
1453
1505
  }
1454
1506
  get operand2Value() {
1455
- return I.valueOf(this.operand2);
1507
+ return v.valueOf(this.operand2);
1456
1508
  }
1457
1509
  /**
1458
1510
  * The result of the statement, over the record `scope` belongs to where one is given and over the fields the
1459
1511
  * statement was built from where it is not.
1460
1512
  */
1461
- evaluate(e) {
1462
- var i, r;
1463
- const t = I.valueOf(this.operand1, e), s = I.valueOf(this.operand2, e);
1513
+ evaluate(t) {
1514
+ const e = v.valueOf(this.operand1, t), s = v.valueOf(this.operand2, t);
1464
1515
  switch (this.operator) {
1465
1516
  // logical operators
1466
1517
  // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
1467
1518
  // coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the
1468
1519
  // signature promises a boolean, and consumers comparing results with !== would see a change where the
1469
1520
  // logical value stayed the same.
1470
- case m.AND:
1471
- return !!(t && s);
1472
- case m.OR:
1473
- return !!(t || s);
1474
- case m.NAND:
1475
- return !(t && s);
1476
- case m.NOR:
1477
- return !(t || s);
1478
- case m.XOR:
1479
- return Se(!!t, !!s);
1480
- case m.NOT:
1481
- return !t;
1521
+ case c.AND:
1522
+ return !!(e && s);
1523
+ case c.OR:
1524
+ return !!(e || s);
1525
+ case c.NAND:
1526
+ return !(e && s);
1527
+ case c.NOR:
1528
+ return !(e || s);
1529
+ case c.XOR:
1530
+ return de(!!e, !!s);
1531
+ case c.NOT:
1532
+ return !e;
1482
1533
  // comparison operators
1483
- case m.EQUALS:
1484
- return t == s;
1485
- case m.NOT_EQUALS:
1486
- return t != s;
1487
- case m.LT:
1488
- return t < s;
1489
- case m.LE:
1490
- return t <= s;
1491
- case m.GE:
1492
- return t >= s;
1493
- case m.GT:
1494
- return t > s;
1495
- case m.IN:
1496
- return !!((i = s == null ? void 0 : s.includes) != null && i.call(s, t));
1497
- case m.NOT_IN:
1498
- return !((r = s == null ? void 0 : s.includes) != null && r.call(s, t));
1499
- case m.INCLUDES:
1500
- return j(t) && j(s) && t.indexOf(s) >= 0;
1501
- case m.NOT_INCLUDES:
1502
- return !(j(t) && j(s) && t.indexOf(s) >= 0);
1534
+ case c.EQUALS:
1535
+ return e == s;
1536
+ case c.NOT_EQUALS:
1537
+ return e != s;
1538
+ case c.LT:
1539
+ return e < s;
1540
+ case c.LE:
1541
+ return e <= s;
1542
+ case c.GE:
1543
+ return e >= s;
1544
+ case c.GT:
1545
+ return e > s;
1546
+ case c.IN:
1547
+ return !!s?.includes?.(e);
1548
+ case c.NOT_IN:
1549
+ return !s?.includes?.(e);
1550
+ case c.INCLUDES:
1551
+ return C(e) && C(s) && e.indexOf(s) >= 0;
1552
+ case c.NOT_INCLUDES:
1553
+ return !(C(e) && C(s) && e.indexOf(s) >= 0);
1503
1554
  default:
1504
1555
  throw new Error(`Operator not implemented ${this.operator}`);
1505
1556
  }
@@ -1509,82 +1560,87 @@ class I {
1509
1560
  * @returns A set of all fields used in this statement
1510
1561
  */
1511
1562
  collectFields() {
1512
- const e = /* @__PURE__ */ new Set();
1513
- function t(s) {
1514
- s instanceof A ? e.add(s) : s instanceof I && s.collectFields().forEach((r) => e.add(r));
1563
+ const t = /* @__PURE__ */ new Set();
1564
+ function e(s) {
1565
+ s instanceof V ? t.add(s) : s instanceof v && s.collectFields().forEach((a) => t.add(a));
1515
1566
  }
1516
- return t(this.operand1), t(this.operand2), e;
1567
+ return e(this.operand1), e(this.operand2), t;
1517
1568
  }
1518
1569
  }
1519
- const Ie = /* @__PURE__ */ Symbol("ExecuteAction");
1520
- class qt extends y {
1521
- constructor(e) {
1522
- super(e);
1570
+ const ge = /* @__PURE__ */ Symbol("ExecuteAction");
1571
+ class jt extends p {
1572
+ constructor(t) {
1573
+ super(t);
1523
1574
  }
1524
1575
  static get classIdentifier() {
1525
- return Ie;
1576
+ return ge;
1526
1577
  }
1527
- execute(e, t, s) {
1528
- return super.execute(e, t, s);
1578
+ execute(t, e, s) {
1579
+ return super.execute(t, e, s);
1529
1580
  }
1530
1581
  }
1531
- const Ae = /* @__PURE__ */ Symbol("ListItemAddedAction");
1532
- class rt extends y {
1533
- constructor(e) {
1534
- super(e);
1582
+ const fe = /* @__PURE__ */ Symbol("ListItemAddedAction");
1583
+ class K extends p {
1584
+ constructor(t) {
1585
+ super(t);
1535
1586
  }
1536
1587
  static get classIdentifier() {
1537
- return Ae;
1588
+ return fe;
1538
1589
  }
1539
- execute(e, t, s, i) {
1540
- return super.execute(e, t, s, i);
1590
+ execute(t, e, s, i) {
1591
+ return super.execute(t, e, s, i);
1541
1592
  }
1542
1593
  }
1543
- const _e = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1544
- class zt extends y {
1545
- constructor(e) {
1546
- super(e);
1594
+ const pe = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1595
+ class Nt extends p {
1596
+ constructor(t) {
1597
+ super(t);
1547
1598
  }
1548
1599
  static get classIdentifier() {
1549
- return _e;
1600
+ return pe;
1550
1601
  }
1551
- execute(e, t, s, i) {
1552
- return super.execute(e, t, s, i);
1602
+ execute(t, e, s, i) {
1603
+ return super.execute(t, e, s, i);
1553
1604
  }
1554
1605
  }
1555
- const Te = Object.freeze({});
1556
- function Ht() {
1606
+ const me = Object.freeze({});
1607
+ function kt() {
1557
1608
  return {
1558
1609
  originalValue: void 0,
1559
1610
  announcedValue: void 0,
1560
1611
  errors: [],
1561
- visibility: N.FULL,
1612
+ visibility: _.FULL,
1562
1613
  enabled: !0,
1563
1614
  valueVersion: 0,
1564
1615
  validatingCount: 0,
1616
+ validatingChildren: 0,
1565
1617
  parent: void 0,
1566
1618
  fieldName: void 0,
1567
1619
  validationEpoch: 0,
1568
1620
  declaration: void 0,
1569
- extra: Te,
1621
+ extra: me,
1570
1622
  valid: !0,
1571
1623
  invalidChildren: 0
1572
1624
  };
1573
1625
  }
1574
- function Oe() {
1575
- return C(p({}, Ht()), { value: void 0, touched: !1 });
1626
+ function ve() {
1627
+ return { ...kt(), value: void 0, touched: !1 };
1576
1628
  }
1577
- function Qt() {
1578
- return C(p({}, Ht()), {
1629
+ function Bt() {
1630
+ return {
1631
+ ...kt(),
1579
1632
  announcedValue: null,
1580
1633
  cachedValue: null,
1581
1634
  cachedValueVersion: -1
1582
- });
1635
+ };
1636
+ }
1637
+ function be() {
1638
+ return { ...Bt(), fieldNames: [] };
1583
1639
  }
1584
- function Fe() {
1585
- return C(p({}, Qt()), { rows: null });
1640
+ function we() {
1641
+ return { ...Bt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
1586
1642
  }
1587
- class X extends A {
1643
+ class M extends V {
1588
1644
  get state() {
1589
1645
  return super.state;
1590
1646
  }
@@ -1595,11 +1651,11 @@ class X extends A {
1595
1651
  get _value() {
1596
1652
  return this.state.value;
1597
1653
  }
1598
- set _value(e) {
1599
- this.state.value = e;
1654
+ set _value(t) {
1655
+ this.state.value = t;
1600
1656
  }
1601
- constructor(e) {
1602
- super(Oe()), this.init(e);
1657
+ constructor(t) {
1658
+ super(ve()), this.init(t);
1603
1659
  }
1604
1660
  /**
1605
1661
  * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
@@ -1610,63 +1666,59 @@ class X extends A {
1610
1666
  * subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
1611
1667
  * the moment the initializer runs.
1612
1668
  */
1613
- init(e) {
1614
- g(() => {
1615
- var s;
1616
- if (e) {
1617
- const t = e, { value: i, validators: r, actions: a } = t, o = k(t, ["value", "validators", "actions"]);
1618
- this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), this._value = i !== void 0 ? i : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
1669
+ init(t) {
1670
+ u(() => {
1671
+ if (t) {
1672
+ const { value: e, validators: s, actions: i, ...a } = t;
1673
+ this.registerInitialActions([...s || [], ...i || []]), this.assignParams(a), this._value = e !== void 0 ? e : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
1619
1674
  }
1620
- this.raw.announcedValue = this._value, (s = this._actions) == null || s.triggerEager(this, this.value, this.originalValue), this.validate();
1675
+ this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1621
1676
  });
1622
1677
  }
1623
1678
  get value() {
1624
1679
  return this._value;
1625
1680
  }
1626
- set value(e) {
1627
- const t = this._value;
1628
- !this.enabled || t === e || g((s) => {
1629
- var i;
1630
- s.touch(this), this._value = e, this.bumpValueVersion(), (i = this._actions) == null || i.triggerEager(this, e, t), this.propagateValueChanged();
1681
+ set value(t) {
1682
+ const e = this._value;
1683
+ !this.enabled || e === t || u((s) => {
1684
+ s.touch(this), this._value = t, this.bumpValueVersion(), this._actions?.triggerEager(this, t, e), this.propagateValueChanged();
1631
1685
  });
1632
1686
  }
1633
1687
  get touched() {
1634
1688
  return this.state.touched;
1635
1689
  }
1636
- set touched(e) {
1637
- this.touchState(), this.state.touched = e;
1690
+ set touched(t) {
1691
+ this.touchState(), this.state.touched = t;
1638
1692
  }
1639
- bind(e, t) {
1640
- var r, a;
1641
- const s = this.constructor, i = new s(C(p({
1693
+ bind(t, e) {
1694
+ const s = this.constructor, i = new s({
1642
1695
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
1643
- value: e !== void 0 ? e : this.value
1644
- }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
1645
- enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
1646
- visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
1647
- }));
1648
- return i.boundFrom(this, i.value, i.originalValue, t), i;
1696
+ value: t !== void 0 ? t : this.value,
1697
+ ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
1698
+ enabled: e?.enabled ?? this.enabled,
1699
+ visibility: e?.visibility ?? this.visibility
1700
+ });
1701
+ return i.boundFrom(this, i.value, i.originalValue, e), i;
1649
1702
  }
1650
1703
  }
1651
- const je = new X({ value: "EmptyField" }).registerAction(
1652
- new O(() => {
1704
+ const Ve = new M({ value: "EmptyField" }).registerAction(
1705
+ new S(() => {
1653
1706
  console.warn("Working with EmptyField! This should not happen");
1654
1707
  })
1655
- ), It = /* @__PURE__ */ new WeakMap();
1656
- function it(n, e) {
1657
- return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? e : n;
1658
- }
1659
- class Pe extends X {
1660
- init(e) {
1661
- g(() => {
1662
- var s;
1663
- if (this._value = { label: void 0, icon: void 0 }, e) {
1664
- const t = e, { value: i, originalValue: r, validators: a, actions: o } = t, u = k(t, ["value", "originalValue", "validators", "actions"]);
1665
- this.registerInitialActions([...a || [], ...o || []]), this.assignParams(u);
1666
- const c = it(i, this._value), x = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
1667
- this._value = it(c, p({}, x)), this.originalValue = it(x, c);
1708
+ ), ft = /* @__PURE__ */ new WeakMap();
1709
+ function H(n, t) {
1710
+ return n?.label == null && n?.icon == null ? t : n;
1711
+ }
1712
+ class ye extends M {
1713
+ init(t) {
1714
+ u(() => {
1715
+ if (this._value = { label: void 0, icon: void 0 }, t) {
1716
+ const { value: e, originalValue: s, validators: i, actions: a, ...r } = t;
1717
+ this.registerInitialActions([...i || [], ...a || []]), this.assignParams(r);
1718
+ const o = H(e, this._value), l = Object.freeze({ label: s?.label, icon: s?.icon });
1719
+ this._value = H(o, { ...l }), this.originalValue = H(l, o);
1668
1720
  }
1669
- this.raw.announcedValue = this._value, (s = this._actions) == null || s.triggerEager(this, this.value, this.originalValue), this.validate();
1721
+ this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1670
1722
  });
1671
1723
  }
1672
1724
  /**
@@ -1675,15 +1727,15 @@ class Pe extends X {
1675
1727
  * JSON, but lodash isEqual compares own-key sets, so writing one would leave the action permanently changed
1676
1728
  * against a baseline that never carried the key.
1677
1729
  */
1678
- valueWith(e, t) {
1679
- const s = p({}, this.value);
1680
- return t === void 0 ? delete s[e] : s[e] = t, s;
1730
+ valueWith(t, e) {
1731
+ const s = { ...this.value };
1732
+ return e === void 0 ? delete s[t] : s[t] = e, s;
1681
1733
  }
1682
1734
  get icon() {
1683
1735
  return this.value.icon;
1684
1736
  }
1685
- set icon(e) {
1686
- this.value.icon !== e && (this.value = this.valueWith("icon", e));
1737
+ set icon(t) {
1738
+ this.value.icon !== t && (this.value = this.valueWith("icon", t));
1687
1739
  }
1688
1740
  get label() {
1689
1741
  return this.value.label;
@@ -1695,13 +1747,13 @@ class Pe extends X {
1695
1747
  * identity and every copy is a new object, so without the comparison here a write of the value already held
1696
1748
  * would announce a change and invalidate the value cache of every container above.
1697
1749
  */
1698
- set label(e) {
1699
- this.value.label !== e && (this.value = this.valueWith("label", e));
1750
+ set label(t) {
1751
+ this.value.label !== t && (this.value = this.valueWith("label", t));
1700
1752
  }
1701
1753
  /** the counter behind `busy`, allocated for this action the first time it is asked for */
1702
1754
  get busyRuns() {
1703
- let e = It.get(this);
1704
- return e || (e = se(0), It.set(this, e)), e;
1755
+ let t = ft.get(this);
1756
+ return t || (t = Wt(0), ft.set(this, t)), t;
1705
1757
  }
1706
1758
  /** true from the moment execute() is called until the handler it ran has settled, however it settles */
1707
1759
  get busy() {
@@ -1717,26 +1769,24 @@ class Pe extends X {
1717
1769
  * out of this call: a caller that does not await the answer and does not attach a catch handler leaves that
1718
1770
  * rejection unhandled.
1719
1771
  */
1720
- execute(e) {
1721
- return vt(this, null, function* () {
1722
- const t = this.busyRuns;
1723
- t.value++;
1724
- try {
1725
- return yield this.triggerAction(qt, e);
1726
- } finally {
1727
- t.value--;
1728
- }
1729
- });
1772
+ async execute(t) {
1773
+ const e = this.busyRuns;
1774
+ e.value++;
1775
+ try {
1776
+ return await this.triggerAction(jt, t);
1777
+ } finally {
1778
+ e.value--;
1779
+ }
1730
1780
  }
1731
1781
  }
1732
- const Ne = /* @__PURE__ */ ie({
1782
+ const Ce = /* @__PURE__ */ qt({
1733
1783
  __name: "messages-widget",
1734
1784
  props: {
1735
1785
  message: {},
1736
1786
  classes: {}
1737
1787
  },
1738
1788
  setup(n) {
1739
- const e = n, t = Vt("vue-markdown"), s = /* @__PURE__ */ new Set([
1789
+ const t = n, e = at("vue-markdown"), s = /* @__PURE__ */ new Set([
1740
1790
  "div",
1741
1791
  "span",
1742
1792
  "p",
@@ -1793,23 +1843,23 @@ const Ne = /* @__PURE__ */ ie({
1793
1843
  "dt",
1794
1844
  "dd"
1795
1845
  ]), i = () => {
1796
- if (typeof e.message == "string") return R("span", { class: e.classes }, e.message);
1797
- const r = [];
1798
- return e.message.forEach((a) => {
1799
- switch (a.componentName) {
1846
+ if (typeof t.message == "string") return F("span", { class: t.classes }, t.message);
1847
+ const a = [];
1848
+ return t.message.forEach((r) => {
1849
+ switch (r.componentName) {
1800
1850
  case "template":
1801
- r.push(R("div", { class: [e.classes, a.extraClasses] }, a.componentBody));
1851
+ a.push(F("div", { class: [t.classes, r.extraClasses] }, r.componentBody));
1802
1852
  break;
1803
1853
  case "vue-markdown":
1804
- if (typeof t == "string")
1854
+ if (typeof e == "string")
1805
1855
  console.warn(
1806
1856
  "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
1807
- ), r.push(R("div", { class: [e.classes, a.extraClasses] }, a.componentBindings.source));
1857
+ ), a.push(F("div", { class: [t.classes, r.extraClasses] }, r.componentBindings.source));
1808
1858
  else {
1809
- const o = a.componentBindings;
1810
- r.push(
1811
- R(t, {
1812
- class: [e.classes, a.extraClasses, "df-messages-widget-markdown"],
1859
+ const o = r.componentBindings;
1860
+ a.push(
1861
+ F(e, {
1862
+ class: [t.classes, r.extraClasses, "df-messages-widget-markdown"],
1813
1863
  source: o.source,
1814
1864
  options: o.options,
1815
1865
  plugins: o.plugins
@@ -1818,88 +1868,172 @@ const Ne = /* @__PURE__ */ ie({
1818
1868
  }
1819
1869
  break;
1820
1870
  default:
1821
- r.push(
1822
- R(
1823
- s.has(a.componentName.toLowerCase()) ? a.componentName : Vt(a.componentName),
1824
- p(p({
1825
- class: [e.classes, a.extraClasses]
1826
- }, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
1871
+ a.push(
1872
+ F(
1873
+ s.has(r.componentName.toLowerCase()) ? r.componentName : at(r.componentName),
1874
+ {
1875
+ class: [t.classes, r.extraClasses],
1876
+ ...r.componentBindings,
1877
+ ...r.componentBody ? { innerHTML: r.componentBody } : {}
1878
+ }
1827
1879
  )
1828
1880
  );
1829
1881
  break;
1830
1882
  }
1831
- }), r;
1883
+ }), a;
1832
1884
  };
1833
- return (r, a) => (ne(), re(i));
1885
+ return (a, r) => (zt(), Ht(i));
1834
1886
  }
1835
- });
1836
- class w extends A {
1837
- constructor(t, s) {
1838
- super(Qt());
1839
- d(this, "_fields");
1840
- if (!w.isValidFields(t)) throw new Error("Invalid fields object provided");
1841
- this._fields = /* @__PURE__ */ Object.create(null), g(() => {
1842
- var a;
1843
- if (Object.entries(t).forEach(([o, u]) => this.addField(o, u)), s) {
1844
- const r = s, { value: o, validators: u, actions: c } = r, x = k(r, ["value", "validators", "actions"]);
1845
- this.registerInitialActions([...u || [], ...c || []]), this.assignParams(x), o !== void 0 ? this.assignMembers(o) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1846
- }
1847
- this.completeRecords();
1848
- const i = this.value;
1849
- this.originalValue === void 0 && (this.originalValue = w.baseline(i)), this.raw.announcedValue = i, (a = this._actions) == null || a.triggerEager(this, i, this.originalValue), this.validate();
1850
- });
1887
+ }), pt = /* @__PURE__ */ new WeakMap(), Ee = (n) => ({
1888
+ get(t, e, s) {
1889
+ return n(), Reflect.get(t, e, s);
1890
+ },
1891
+ has(t, e) {
1892
+ return n(), Reflect.has(t, e);
1893
+ },
1894
+ ownKeys(t) {
1895
+ return n(), Reflect.ownKeys(t);
1896
+ },
1897
+ getOwnPropertyDescriptor(t, e) {
1898
+ return n(), Reflect.getOwnPropertyDescriptor(t, e);
1899
+ },
1900
+ set(t, e) {
1901
+ throw new TypeError(`fields.${String(e)} cannot be assigned: use addField() to give the group a member`);
1902
+ },
1903
+ defineProperty(t, e) {
1904
+ throw new TypeError(`fields.${String(e)} cannot be redefined: use addField() to give the group a member`);
1905
+ },
1906
+ deleteProperty(t, e) {
1907
+ throw new TypeError(`fields.${String(e)} cannot be deleted: use removeField() to take a member out`);
1851
1908
  }
1909
+ });
1910
+ class d extends V {
1852
1911
  get state() {
1853
1912
  return super.state;
1854
1913
  }
1855
1914
  get raw() {
1856
1915
  return super.raw;
1857
1916
  }
1917
+ _fields;
1918
+ constructor(t, e) {
1919
+ if (super(be()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
1920
+ this._fields = /* @__PURE__ */ Object.create(null), u(() => {
1921
+ if (Object.entries(t).forEach(([i, a]) => this.addField(i, a)), e) {
1922
+ const { value: i, validators: a, actions: r, ...o } = e;
1923
+ this.registerInitialActions([...a || [], ...r || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1924
+ }
1925
+ this.completeRecords();
1926
+ const s = this.value;
1927
+ this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this._actions?.triggerEager(this, s, this.originalValue), this.validate();
1928
+ });
1929
+ }
1930
+ /**
1931
+ * The name array is copied as well: a rollback puts back the set of members the group held, not the array it
1932
+ * went on to hold.
1933
+ */
1934
+ [O]() {
1935
+ const t = super[O]();
1936
+ return t.fieldNames = [...this.raw.fieldNames], t;
1937
+ }
1858
1938
  /**
1859
1939
  * The copy of a built value that serves as a baseline. The value getter hands out one object per version, and
1860
1940
  * a baseline holding that same object would report every value as its own original.
1861
1941
  */
1862
1942
  static baseline(t) {
1863
- return t == null ? t : p({}, t);
1943
+ return t == null ? t : { ...t };
1944
+ }
1945
+ /**
1946
+ * Takes `field` into this group under `fieldName`. The group ends up holding it exactly as it holds a field the
1947
+ * constructor was given: the field carries the back-reference and the name, its verdict counts towards the
1948
+ * group's, and a rule of the field's that names another member of the form reaches it here.
1949
+ *
1950
+ * The change is announced through the ordinary path, so a group whose value the new field adds to says so once
1951
+ * the transaction closes, and its verdict is re-formed over the members it now holds. The baseline behind
1952
+ * `isChanged` is not rewritten: a group that gains a field holds something its original value does not carry,
1953
+ * and reports itself changed until `originalValue` is written.
1954
+ *
1955
+ * @throws Error where this group already holds a field under `fieldName`.
1956
+ * @throws TypeError where `field` already belongs to a container - pass a `bind()` of it instead.
1957
+ */
1958
+ addField(t, e) {
1959
+ return u((s) => {
1960
+ if (Object.hasOwn(this._fields, t))
1961
+ throw new Error(`Field ${t} is already in this form`);
1962
+ this.takeChild(e, t), s.touch(this), d.setEntry(this._fields, t, e), s.whenRolledBack(() => d.dropEntry(this._fields, t)), this.state.fieldNames.push(t), this.completeRecords(e), this.bumpValueVersion(), this.notifyValueChanged();
1963
+ }), this;
1964
+ }
1965
+ /**
1966
+ * Takes the field held under `fieldName` out of this group and hands it back, answering undefined where the
1967
+ * group holds no field of that name. The field is released whole: the back-reference and the name are gone, its
1968
+ * verdict and its runs in flight no longer count towards the group's, and it is free to be taken by another
1969
+ * container. What it holds - its value, its errors, the change history behind `isChanged` - is its own to report.
1970
+ *
1971
+ * The change is announced through the ordinary path, so the group's value and verdict settle over the members it
1972
+ * has left. The baseline behind `isChanged` is not rewritten, the same way it is not on `addField`.
1973
+ */
1974
+ removeField(t) {
1975
+ let e;
1976
+ return u((s) => {
1977
+ if (!Object.hasOwn(this._fields, t)) return;
1978
+ const i = this._fields[t];
1979
+ s.touch(this), this.releaseChild(i), d.dropEntry(this._fields, t), s.whenRolledBack(() => d.setEntry(this._fields, t, i)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), e = i;
1980
+ }), e;
1864
1981
  }
1865
- addField(t, s) {
1866
- if (Object.hasOwn(this._fields, t))
1867
- throw new Error(`Field ${t} is already in this form`);
1868
- this.takeChild(s, t), Object.defineProperty(this._fields, t, { get: () => s, configurable: !1, enumerable: !0 });
1982
+ /**
1983
+ * Writes one entry of the member map. The map is typed by the fields interface, which names the members a group
1984
+ * of that type holds and no others, so both here and in dropEntry it is reached as the plain record it is.
1985
+ */
1986
+ static setEntry(t, e, s) {
1987
+ t[e] = s;
1988
+ }
1989
+ /** Drops one entry out of the member map. */
1990
+ static dropEntry(t, e) {
1991
+ delete t[e];
1869
1992
  }
1870
1993
  static isValidFields(t) {
1871
- function s(i) {
1872
- return i instanceof A;
1994
+ function e(s) {
1995
+ return s instanceof V;
1873
1996
  }
1874
- return typeof t == "object" && t !== null && Object.entries(t).every(([, i]) => s(i));
1997
+ return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
1875
1998
  }
1876
1999
  static createFromFormData(t) {
1877
- if (t instanceof A)
2000
+ if (t instanceof V)
1878
2001
  throw new Error("data is already a Form structure, should be a simple object");
1879
- return new w(
1880
- t == null ? {} : Object.fromEntries(Object.entries(t).map(([s, i]) => [s, new X({ value: i })]))
2002
+ return new d(
2003
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new M({ value: s })]))
1881
2004
  );
1882
2005
  }
1883
2006
  field(t) {
1884
- var s;
1885
- return (s = this._fields[t]) != null ? s : null;
2007
+ return this._fields[t] ?? null;
1886
2008
  }
2009
+ /**
2010
+ * The typed map of this group's members. What it hands out is a view over the map the group holds: reading it
2011
+ * reaches the members themselves, and every write to it is refused - addField() and removeField() are what
2012
+ * change the set. The view is built the first time something asks for it.
2013
+ *
2014
+ * Reading through it is a tracked read of the set of members, so a template rendering off `group.fields`
2015
+ * re-renders when a field is added or removed; what a member itself holds is tracked by that member.
2016
+ */
1887
2017
  get fields() {
1888
- return this._fields;
2018
+ let t = pt.get(this);
2019
+ return t || (t = new Proxy(
2020
+ this._fields,
2021
+ Ee(() => this.state.fieldNames.length)
2022
+ ), pt.set(this, t)), t;
1889
2023
  }
1890
2024
  get members() {
1891
- return Object.values(this._fields);
2025
+ return this.raw.fieldNames.map((t) => this._fields[t]);
1892
2026
  }
1893
2027
  get value() {
1894
2028
  const t = this.valueVersion;
1895
2029
  if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
1896
- const s = /* @__PURE__ */ Object.create(null);
1897
- Object.entries(this._fields).forEach(([r, a]) => {
1898
- const o = a.value;
1899
- (a.enabled || a instanceof w && !L(o)) && (s[r] = o);
2030
+ const e = /* @__PURE__ */ Object.create(null);
2031
+ Object.entries(this._fields).forEach(([i, a]) => {
2032
+ const r = a.value;
2033
+ (a.enabled || a instanceof d && !R(r)) && (e[i] = r);
1900
2034
  });
1901
- const i = L(s) ? null : Object.freeze(p({}, s));
1902
- return this.raw.cachedValue = i, this.raw.cachedValueVersion = t, i;
2035
+ const s = R(e) ? null : Object.freeze({ ...e });
2036
+ return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
1903
2037
  }
1904
2038
  /**
1905
2039
  * Writes the members that the given value carries. The members are written one by one and the group says
@@ -1907,15 +2041,15 @@ class w extends A {
1907
2041
  * once, over the finished set, and announces each at most once.
1908
2042
  */
1909
2043
  assignMembers(t) {
1910
- g(() => {
1911
- Object.entries(this._fields).forEach(([s, i]) => {
1912
- (t == null || Object.hasOwn(t, s)) && (i.value = t == null ? null : t[s]);
2044
+ u(() => {
2045
+ Object.entries(this._fields).forEach(([e, s]) => {
2046
+ (t == null || Object.hasOwn(t, e)) && (s.value = t == null ? null : t[e]);
1913
2047
  });
1914
2048
  });
1915
2049
  }
1916
2050
  set value(t) {
1917
- g((s) => {
1918
- this.assignMembers(t), s.markValidityDirty(this);
2051
+ u((e) => {
2052
+ this.assignMembers(t), e.markValidityDirty(this);
1919
2053
  });
1920
2054
  }
1921
2055
  /**
@@ -1923,33 +2057,32 @@ class w extends A {
1923
2057
  * value carries, while a member the value leaves out has to end up holding what the template gives it. `source`
1924
2058
  * supplies that per member, so a group reset from the template it was bound from matches a fresh binding of it.
1925
2059
  */
1926
- resetTo(t, s) {
1927
- const i = t;
1928
- g((r) => {
1929
- r.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([o, u]) => {
1930
- var x;
1931
- let c;
1932
- s === null ? c = null : s !== void 0 && Object.hasOwn(s, o) && (c = s[o]), this.resetChild(u, (x = i.field(o)) != null ? x : u, c);
2060
+ resetTo(t, e) {
2061
+ const s = t;
2062
+ u((i) => {
2063
+ i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([r, o]) => {
2064
+ let l;
2065
+ e === null ? l = null : e !== void 0 && Object.hasOwn(e, r) && (l = e[r]), this.resetChild(o, s.field(r) ?? o, l);
1933
2066
  });
1934
2067
  const a = this.value;
1935
- this.raw.announcedValue = a, this.originalValue = w.baseline(a), super.validate(!0);
2068
+ this.raw.announcedValue = a, this.originalValue = d.baseline(a), super.validate(!0);
1936
2069
  });
1937
2070
  }
1938
2071
  get touched() {
1939
2072
  return Object.values(this._fields).some((t) => t.touched);
1940
2073
  }
1941
2074
  set touched(t) {
1942
- g(() => {
1943
- Object.values(this._fields).forEach((s) => {
1944
- s.touched = t;
2075
+ u(() => {
2076
+ Object.values(this._fields).forEach((e) => {
2077
+ e.touched = t;
1945
2078
  });
1946
2079
  });
1947
2080
  }
1948
2081
  get fullValue() {
1949
2082
  const t = /* @__PURE__ */ Object.create(null);
1950
- return Object.entries(this._fields).forEach(([s, i]) => {
1951
- t[s] = i.fullValue;
1952
- }), p({}, t);
2083
+ return Object.entries(this._fields).forEach(([e, s]) => {
2084
+ t[e] = s.fullValue;
2085
+ }), { ...t };
1953
2086
  }
1954
2087
  /**
1955
2088
  * Records that a member changed its value, so that the transaction in progress works out at commit what this
@@ -1973,27 +2106,32 @@ class w extends A {
1973
2106
  return this.validRead;
1974
2107
  }
1975
2108
  composeValid() {
1976
- return this.state.errors.length === 0 && Object.values(this._fields).every((t) => t.valid);
2109
+ return this.state.errors.length === 0 && this.state.fieldNames.every((t) => this._fields[t].valid);
2110
+ }
2111
+ get busy() {
2112
+ return this.busyRead;
2113
+ }
2114
+ composeBusy() {
2115
+ return this.state.fieldNames.some((t) => this._fields[t].busy);
1977
2116
  }
1978
2117
  validate(t = !1) {
1979
- g(() => {
1980
- t && Object.values(this._fields).forEach((s) => s.validate(!0)), super.validate(t);
2118
+ u(() => {
2119
+ t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
1981
2120
  });
1982
2121
  }
1983
- bind(t, s) {
1984
- var a, o;
1985
- const i = /* @__PURE__ */ Object.create(null);
1986
- Object.entries(this._fields).forEach(([u, c]) => {
1987
- i[u] = c.bind();
2122
+ bind(t, e) {
2123
+ const s = /* @__PURE__ */ Object.create(null);
2124
+ Object.entries(this._fields).forEach(([a, r]) => {
2125
+ s[a] = r.bind();
1988
2126
  });
1989
- const r = new w(i, C(p({
2127
+ const i = new d(s, {
1990
2128
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
1991
- value: t !== void 0 ? t : this.value
1992
- }, s && "originalValue" in s ? { originalValue: s.originalValue } : {}), {
1993
- enabled: (a = s == null ? void 0 : s.enabled) != null ? a : this.enabled,
1994
- visibility: (o = s == null ? void 0 : s.visibility) != null ? o : this.visibility
1995
- }));
1996
- return r.boundFrom(this, r.raw.announcedValue, r.originalValue, s), r;
2129
+ value: t !== void 0 ? t : this.value,
2130
+ ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2131
+ enabled: e?.enabled ?? this.enabled,
2132
+ visibility: e?.visibility ?? this.visibility
2133
+ });
2134
+ return i.boundFrom(this, i.raw.announcedValue, i.originalValue, e), i;
1997
2135
  }
1998
2136
  /**
1999
2137
  * A record need not name every member: a key it leaves out is taken from the declaration, the same way a member
@@ -2003,28 +2141,26 @@ class w extends A {
2003
2141
  return super.rebind(t);
2004
2142
  }
2005
2143
  }
2006
- class D extends A {
2007
- constructor(t, s) {
2008
- super(Fe());
2009
- d(this, "_itemTemplate");
2010
- this._itemTemplate = t, g(() => {
2011
- var r;
2012
- if (s) {
2013
- const i = s, { value: a, validators: o, actions: u } = i, c = k(i, ["value", "validators", "actions"]);
2014
- this.registerInitialActions([...o || [], ...u || []]), this.assignParams(c), a != null && this.setValueInternal(a);
2015
- }
2016
- this.originalValue === void 0 && (this.originalValue = D.baseline(this.value)), this.raw.announcedValue = this.value, (r = this._actions) == null || r.triggerEager(this, this.value, this.originalValue), this.validate();
2017
- });
2018
- }
2144
+ class A extends V {
2019
2145
  get state() {
2020
2146
  return super.state;
2021
2147
  }
2022
2148
  get raw() {
2023
2149
  return super.raw;
2024
2150
  }
2151
+ _itemTemplate;
2152
+ constructor(t, e) {
2153
+ super(we()), this._itemTemplate = t, u(() => {
2154
+ if (e) {
2155
+ const { value: s, validators: i, actions: a, ...r } = e;
2156
+ this.registerInitialActions([...i || [], ...a || []]), this.assignParams(r), s != null && this.setValueInternal(s);
2157
+ }
2158
+ this.originalValue === void 0 && (this.originalValue = A.baseline(this.value)), this.raw.announcedValue = this.value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
2159
+ });
2160
+ }
2025
2161
  /** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */
2026
- [$]() {
2027
- const t = super[$]();
2162
+ [O]() {
2163
+ const t = super[O]();
2028
2164
  return t.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, t;
2029
2165
  }
2030
2166
  /**
@@ -2035,8 +2171,8 @@ class D extends A {
2035
2171
  return t == null ? t : [...t];
2036
2172
  }
2037
2173
  processSetValueItem(t) {
2038
- let s;
2039
- return t instanceof w ? s = t : this._itemTemplate ? s = this._itemTemplate.bind(t) : s = w.createFromFormData(t), this.takeChild(s), this.completeRecords(s), s;
2174
+ let e;
2175
+ return t instanceof d ? e = t : this._itemTemplate ? e = this._itemTemplate.bind(t) : e = d.createFromFormData(t), this.takeChild(e), this.completeRecords(e), e;
2040
2176
  }
2041
2177
  /**
2042
2178
  * Builds the item that fills a gap left by an insert beyond the end of the list: the item template bound to its
@@ -2045,32 +2181,41 @@ class D extends A {
2045
2181
  createPaddingItem() {
2046
2182
  return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.bind() : null);
2047
2183
  }
2184
+ /** Records that the set of rows changed, so `items` rebuilds the frozen array it hands out at the next read. */
2185
+ rowsChanged() {
2186
+ this.state.rowsVersion++;
2187
+ }
2188
+ /** True where `next` is a different set of rows than `previous`: another count, or another row at a position. */
2189
+ static rowsDiffer(t, e) {
2190
+ const s = t ?? [], i = e ?? [];
2191
+ return s.length !== i.length || s.some((a, r) => a !== i[r]);
2192
+ }
2048
2193
  setValueInternal(t) {
2049
- g((s) => {
2050
- var i;
2051
- if (s.touch(this), t == null)
2194
+ u((e) => {
2195
+ e.touch(this);
2196
+ const s = this.raw.rows;
2197
+ if (t == null)
2052
2198
  this.releaseRows(), this.state.rows = null;
2053
2199
  else if (Array.isArray(t)) {
2054
- const r = (i = this.state.rows) != null ? i : [], a = new Array(t.length);
2055
- for (let o = 0; o < t.length; o++) {
2056
- const u = t[o], c = r[o];
2057
- c && this._itemTemplate && !(u instanceof w) ? (this.resetChild(c, this._itemTemplate, u), a[o] = c) : (c && this.releaseChild(c), a[o] = this.processSetValueItem(u));
2200
+ const i = this.state.rows ?? [], a = new Array(t.length);
2201
+ for (let r = 0; r < t.length; r++) {
2202
+ const o = t[r], l = i[r];
2203
+ l && this._itemTemplate && !(o instanceof d) ? (this.resetChild(l, this._itemTemplate, o), a[r] = l) : (l && this.releaseChild(l), a[r] = this.processSetValueItem(o));
2058
2204
  }
2059
- for (let o = t.length; o < r.length; o++) this.releaseChild(r[o]);
2205
+ for (let r = t.length; r < i.length; r++) this.releaseChild(i[r]);
2060
2206
  this.state.rows = a;
2061
2207
  }
2062
- this.bumpValueVersion();
2208
+ A.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
2063
2209
  });
2064
2210
  }
2065
2211
  get value() {
2066
- var r;
2067
2212
  const t = this.valueVersion;
2068
2213
  if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
2069
- const s = (r = this.state.rows) == null ? void 0 : r.map((a) => a.value), i = L(s) ? null : Object.freeze(s);
2070
- return this.raw.cachedValue = i, this.raw.cachedValueVersion = t, i;
2214
+ const e = this.state.rows?.map((i) => i.value), s = R(e) ? null : Object.freeze(e);
2215
+ return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
2071
2216
  }
2072
2217
  set value(t) {
2073
- g(() => {
2218
+ u(() => {
2074
2219
  this.setValueInternal(t), this.propagateValueChanged(!0);
2075
2220
  });
2076
2221
  }
@@ -2078,35 +2223,32 @@ class D extends A {
2078
2223
  * The rows are taken from `source` where the caller supplied no value of its own, so a list nested in a row that
2079
2224
  * a whole-list assignment reuses ends up holding what the template gives it rather than what it held before.
2080
2225
  */
2081
- resetTo(t, s) {
2082
- g((i) => {
2083
- i.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(s === void 0 ? t.value : s);
2084
- const r = this.value;
2085
- this.raw.announcedValue = r, this.originalValue = D.baseline(r), super.validate(!0);
2226
+ resetTo(t, e) {
2227
+ u((s) => {
2228
+ s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
2229
+ const i = this.value;
2230
+ this.raw.announcedValue = i, this.originalValue = A.baseline(i), super.validate(!0);
2086
2231
  });
2087
2232
  }
2088
2233
  get touched() {
2089
- var t;
2090
- return ((t = this.state.rows) == null ? void 0 : t.some((s) => s.touched)) || !1;
2234
+ return this.state.rows?.some((t) => t.touched) || !1;
2091
2235
  }
2092
2236
  set touched(t) {
2093
- g(() => {
2094
- var s;
2095
- (s = this.state.rows) == null || s.forEach((i) => {
2096
- i.touched = t;
2237
+ u(() => {
2238
+ this.state.rows?.forEach((e) => {
2239
+ e.touched = t;
2097
2240
  });
2098
2241
  });
2099
2242
  }
2100
- bind(t, s) {
2101
- var r, a, o, u;
2102
- const i = new D((r = this._itemTemplate) == null ? void 0 : r.bind(), C(p({
2243
+ bind(t, e) {
2244
+ const s = new A(this._itemTemplate?.bind(), {
2103
2245
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2104
- value: [...(a = t !== void 0 ? t : this.value) != null ? a : []]
2105
- }, s && "originalValue" in s ? { originalValue: s.originalValue } : {}), {
2106
- enabled: (o = s == null ? void 0 : s.enabled) != null ? o : this.enabled,
2107
- visibility: (u = s == null ? void 0 : s.visibility) != null ? u : this.visibility
2108
- }));
2109
- return i.boundFrom(this, i.value, i.originalValue, s), i;
2246
+ value: [...(t !== void 0 ? t : this.value) ?? []],
2247
+ ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2248
+ enabled: e?.enabled ?? this.enabled,
2249
+ visibility: e?.visibility ?? this.visibility
2250
+ });
2251
+ return s.boundFrom(this, s.value, s.originalValue, e), s;
2110
2252
  }
2111
2253
  /**
2112
2254
  * Records that a row changed its value, so that the transaction in progress works out at commit what this
@@ -2130,103 +2272,130 @@ class D extends A {
2130
2272
  return this.validRead;
2131
2273
  }
2132
2274
  composeValid() {
2133
- var t, s;
2134
- return this.state.errors.length === 0 && ((s = (t = this.state.rows) == null ? void 0 : t.every((i) => i.valid)) != null ? s : !0);
2275
+ return this.state.errors.length === 0 && (this.state.rows?.every((t) => t.valid) ?? !0);
2276
+ }
2277
+ get busy() {
2278
+ return this.busyRead;
2279
+ }
2280
+ composeBusy() {
2281
+ return this.state.rows?.some((t) => t.busy) ?? !1;
2135
2282
  }
2136
2283
  validate(t = !1) {
2137
- g(() => {
2138
- var s;
2139
- t && ((s = this.state.rows) == null || s.forEach((i) => i.validate(!0))), super.validate(t);
2284
+ u(() => {
2285
+ t && this.state.rows?.forEach((e) => e.validate(!0)), super.validate(t);
2140
2286
  });
2141
2287
  }
2142
2288
  get members() {
2143
- var t;
2144
- return (t = this.raw.rows) != null ? t : [];
2289
+ return this.raw.rows ?? [];
2290
+ }
2291
+ /**
2292
+ * How many rows this list holds. The read is tracked, so a template rendering off it re-renders as rows come and
2293
+ * go.
2294
+ */
2295
+ /**
2296
+ * Every row of this list, each one built from all of its fields. Where `value` states what the list serializes -
2297
+ * rows composed of the fields that are enabled, and null where the list is empty - this states what the list
2298
+ * holds: the disabled fields are in it too, and an empty list reads back as an empty array rather than as null.
2299
+ */
2300
+ get fullValue() {
2301
+ return (this.state.rows ?? []).map((t) => t.fullValue);
2302
+ }
2303
+ get length() {
2304
+ return this.state.rows?.length ?? 0;
2305
+ }
2306
+ /**
2307
+ * The rows this list holds, oldest position first. The array is a frozen copy: it states what the list held at
2308
+ * the read and nothing writes back through it - `push`, `insert`, `remove` and `clear` are what change the set -
2309
+ * so a caller may hold on to it. The rows in it are the live elements, so reading one reports what it holds now.
2310
+ *
2311
+ * The copy is built once per change of the set and handed to every reader until the next one: a write inside a
2312
+ * row changes what the list serializes without changing which rows it holds, and the array a reader took stays
2313
+ * the same one across such a write.
2314
+ */
2315
+ get items() {
2316
+ const t = this.state.rowsVersion;
2317
+ return this.raw.cachedItemsVersion !== t && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = t), this.raw.cachedItems;
2145
2318
  }
2146
2319
  get(t) {
2147
2320
  return this.state.rows != null ? this.state.rows[t] : void 0;
2148
2321
  }
2149
2322
  push(t) {
2150
- var s, i;
2151
- return this.insert(t, (i = (s = this.state.rows) == null ? void 0 : s.length) != null ? i : 0) + 1;
2323
+ return this.insert(t, this.state.rows?.length ?? 0) + 1;
2152
2324
  }
2153
2325
  pop() {
2154
- var t, s;
2155
- return this.remove(((s = (t = this.state.rows) == null ? void 0 : t.length) != null ? s : 0) - 1);
2326
+ return this.remove((this.state.rows?.length ?? 0) - 1);
2156
2327
  }
2157
2328
  remove(t) {
2158
- let s;
2159
- return g((i) => {
2160
- var a;
2329
+ let e;
2330
+ return u((s) => {
2161
2331
  if (this.state.rows == null || t < 0 || this.state.rows.length <= t) return;
2162
- i.touch(this);
2163
- const r = (a = this.state.rows.splice(t, 1)) == null ? void 0 : a[0];
2164
- r && (this.releaseChild(r), this.bumpValueVersion(), s = r, i.recordStructural(this, { actionClass: zt, item: s, index: t }), this.propagateValueChanged(!0));
2165
- }), s;
2166
- }
2167
- insert(t, s) {
2168
- let i = 0;
2169
- return g((r) => {
2170
- for (r.touch(this), this.state.rows == null && (this.state.rows = []), i = s < 0 ? Math.max(this.state.rows.length + s, 0) : s; this.state.rows.length < i; ) {
2171
- const o = this.createPaddingItem(), u = this.state.rows.push(o) - 1;
2172
- this.bumpValueVersion(), r.recordStructural(this, { actionClass: rt, item: o, index: u });
2332
+ s.touch(this);
2333
+ const i = this.state.rows.splice(t, 1)?.[0];
2334
+ i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), e = i, s.recordStructural(this, { actionClass: Nt, item: e, index: t }), this.propagateValueChanged(!0));
2335
+ }), e;
2336
+ }
2337
+ insert(t, e) {
2338
+ let s = 0;
2339
+ return u((i) => {
2340
+ for (i.touch(this), this.state.rows == null && (this.state.rows = []), s = e < 0 ? Math.max(this.state.rows.length + e, 0) : e; this.state.rows.length < s; ) {
2341
+ const r = this.createPaddingItem(), o = this.state.rows.push(r) - 1;
2342
+ this.bumpValueVersion(), i.recordStructural(this, { actionClass: K, item: r, index: o });
2173
2343
  }
2174
2344
  const a = this.processSetValueItem(t);
2175
- this.state.rows.splice(i, 0, a), r.recordStructural(this, { actionClass: rt, item: a, index: i }), this.bumpValueVersion(), this.propagateValueChanged(!0);
2176
- }), i;
2345
+ this.state.rows.splice(s, 0, a), i.recordStructural(this, { actionClass: K, item: a, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2346
+ }), s;
2177
2347
  }
2178
2348
  /** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
2179
2349
  releaseRows() {
2180
- var t;
2181
- (t = this.state.rows) == null || t.forEach((s) => this.releaseChild(s));
2350
+ this.state.rows?.forEach((t) => this.releaseChild(t));
2182
2351
  }
2183
2352
  clear() {
2184
- g((t) => {
2185
- var i, r;
2186
- const s = ((r = (i = this.state.rows) == null ? void 0 : i.length) != null ? r : 0) > 0;
2187
- t.touch(this), this.releaseRows(), this.state.rows = null, this.bumpValueVersion(), this.propagateValueChanged(s);
2353
+ u((t) => {
2354
+ const e = (this.state.rows?.length ?? 0) > 0;
2355
+ t.touch(this), this.releaseRows(), this.state.rows = null, e && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(e);
2188
2356
  });
2189
2357
  }
2190
2358
  }
2191
- class ke extends v {
2192
- constructor(t, s, i) {
2193
- super((a, o, u) => {
2194
- this.comparisonState(u).oldValue = o;
2195
- const c = this.resolve(u);
2196
- return c ? (this.listenOn(c), this.isValidComparison(b(a), b(c.value)) ? null : [
2197
- new V(
2198
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, otherField: c })
2359
+ class xe extends g {
2360
+ constructor(t, e, s) {
2361
+ const i = (a, r, o) => {
2362
+ this.comparisonState(o).oldValue = r;
2363
+ const l = this.resolve(o);
2364
+ return l ? (this.listenOn(l), this.isValidComparison(h(a), h(l.value)) ? null : [
2365
+ new f(
2366
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, otherField: l }),
2367
+ "",
2368
+ "compare-to"
2199
2369
  )
2200
- ]) : (u.markRecordIncomplete(), null);
2201
- });
2202
- d(this, "isValidComparison");
2203
- d(this, "otherField");
2204
- /**
2205
- * The fields this validator is registered on. Registration reaches one element at a time - the rows of a list
2206
- * take the validator on one by one, as they are built from the item template that carries it - so this is what
2207
- * says which of the fields a declaration stands for actually carry the rule, and a field that never took it on
2208
- * is left alone by a change of the compared field.
2209
- */
2210
- d(this, "registrations", /* @__PURE__ */ new WeakSet());
2211
- /**
2212
- * The fields this validator has installed its listener on. A binding of such a field carries the listener too -
2213
- * a binding takes on the actions of the field it was bound from - so the field it was bound from is what is
2214
- * asked about as well, and a list of a thousand rows installs one listener rather than a thousand.
2215
- */
2216
- d(this, "listening", /* @__PURE__ */ new WeakSet());
2217
- /**
2218
- * What the fields this validator was registered on were declared as. One entry stands for every binding of such a
2219
- * field, so a change of a compared field finds the fields of the record that change happened in without a list
2220
- * of a thousand rows being held here.
2221
- */
2222
- d(this, "declarations", /* @__PURE__ */ new Set());
2223
- this.isValidComparison = s, this.otherField = t;
2370
+ ]) : (o.markRecordIncomplete(), null);
2371
+ };
2372
+ super(i), this.isValidComparison = e, this.otherField = t;
2224
2373
  }
2374
+ isValidComparison;
2375
+ otherField;
2376
+ /**
2377
+ * The fields this validator is registered on. Registration reaches one element at a time - the rows of a list
2378
+ * take the validator on one by one, as they are built from the item template that carries it - so this is what
2379
+ * says which of the fields a declaration stands for actually carry the rule, and a field that never took it on
2380
+ * is left alone by a change of the compared field.
2381
+ */
2382
+ registrations = /* @__PURE__ */ new WeakSet();
2383
+ /**
2384
+ * The fields this validator has installed its listener on. A binding of such a field carries the listener too -
2385
+ * a binding takes on the actions of the field it was bound from - so the field it was bound from is what is
2386
+ * asked about as well, and a list of a thousand rows installs one listener rather than a thousand.
2387
+ */
2388
+ listening = /* @__PURE__ */ new WeakSet();
2389
+ /**
2390
+ * What the fields this validator was registered on were declared as. One entry stands for every binding of such a
2391
+ * field, so a change of a compared field finds the fields of the record that change happened in without a list
2392
+ * of a thousand rows being held here.
2393
+ */
2394
+ declarations = /* @__PURE__ */ new Set();
2225
2395
  /** The field `field` is compared against, within the record `field` belongs to. */
2226
2396
  resolve(t) {
2227
- var i;
2228
- const s = this.otherField;
2229
- return typeof s == "function" ? (i = s(t)) != null ? i : void 0 : typeof s == "string" ? pe(s, t) : lt(s, T(t));
2397
+ const e = this.otherField;
2398
+ return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? se(e, t) : G(e, x(t));
2230
2399
  }
2231
2400
  /**
2232
2401
  * Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
@@ -2235,12 +2404,12 @@ class ke extends v {
2235
2404
  */
2236
2405
  listenOn(t) {
2237
2406
  this.listening.has(t) || this.listening.has(t.declaration) || (this.listening.add(t), t.registerAction(
2238
- new O((s, i, r, a) => {
2239
- i(s, r, a);
2240
- const o = T(s);
2407
+ new S((e, s, i, a) => {
2408
+ s(e, i, a);
2409
+ const r = x(e);
2241
2410
  this.declarations.forEach(
2242
- (u) => Lt(u, o).forEach((c) => {
2243
- this.registrations.has(c) && this.execute(c, () => null, c.value, this.comparisonState(c).oldValue);
2411
+ (o) => Tt(o, r).forEach((l) => {
2412
+ this.registrations.has(l) && this.execute(l, () => null, l.value, this.comparisonState(l).oldValue);
2244
2413
  })
2245
2414
  );
2246
2415
  })
@@ -2253,196 +2422,244 @@ class ke extends v {
2253
2422
  return this.bindingState(t);
2254
2423
  }
2255
2424
  newBindingState() {
2256
- return C(p({}, super.newBindingState()), { oldValue: void 0 });
2425
+ return { ...super.newBindingState(), oldValue: void 0 };
2257
2426
  }
2258
2427
  unregisterFrom(t) {
2259
- this.registrations.delete(t);
2260
- }
2261
- }
2262
- class Re extends v {
2263
- constructor(e, t) {
2264
- const s = t || E("Must be one of [**{allowedAsText}**]");
2265
- let i = e.join(", ");
2266
- i.length > 60 && (i = Zt(i, {
2267
- length: 40,
2268
- separator: ", ",
2269
- omission: `... (${e.length} items total)`
2270
- }));
2271
- const r = (a, o, u) => e.includes(b(a)) ? null : [
2272
- new V(
2273
- this.replacePlaceholders(s, { newValue: a, oldValue: o, field: u, allowedValues: e, allowedAsText: i })
2274
- )
2275
- ];
2428
+ super.unregisterFrom(t), this.registrations.delete(t);
2429
+ }
2430
+ }
2431
+ class Se extends g {
2432
+ constructor(t, e) {
2433
+ const s = e || m("Must be one of [**{allowedAsText}**]"), i = () => {
2434
+ const o = h(t);
2435
+ return typeof o == "function" ? o() : o;
2436
+ }, a = (o) => {
2437
+ const l = o.join(", ");
2438
+ return l.length <= 60 ? l : Mt(l, { length: 40, separator: ", ", omission: `... (${o.length} items total)` });
2439
+ }, r = (o, l, w) => {
2440
+ const b = i();
2441
+ return b.includes(h(o)) ? null : [
2442
+ new f(
2443
+ this.replacePlaceholders(s, {
2444
+ newValue: o,
2445
+ oldValue: l,
2446
+ field: w,
2447
+ allowedValues: b,
2448
+ allowedAsText: a(b)
2449
+ }),
2450
+ "",
2451
+ "in-allowed-values"
2452
+ )
2453
+ ];
2454
+ };
2276
2455
  super(r);
2277
2456
  }
2278
2457
  }
2279
- function De(n) {
2280
- return n == null ? 0 : At(n) || j(n) ? n.length : _t(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2458
+ function Ie(n) {
2459
+ return n == null ? 0 : vt(n) || C(n) ? n.length : bt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2460
+ }
2461
+ function mt(n) {
2462
+ return typeof n == "object" && n !== null && !wt(n) && !(n instanceof String) && !("componentName" in n);
2281
2463
  }
2282
- class Le extends v {
2283
- constructor(e) {
2284
- const t = e || E("Please enter a value"), s = (i, r, a) => De(b(i)) === 0 ? [new V(this.replacePlaceholders(t, { newValue: i, oldValue: r, field: a }))] : null;
2285
- super(s);
2464
+ class Ae extends g {
2465
+ constructor(t, e) {
2466
+ const s = mt(t) ? void 0 : t, i = (mt(t) ? t : e)?.trim ?? !0, a = s || m("Please enter a value"), r = (o, l, w) => {
2467
+ const b = h(o);
2468
+ return Ie(i && C(b) ? b.trim() : b) === 0 ? [
2469
+ new f(
2470
+ this.replacePlaceholders(a, { newValue: o, oldValue: l, field: w }),
2471
+ "",
2472
+ "required"
2473
+ )
2474
+ ] : null;
2475
+ };
2476
+ super(r);
2286
2477
  }
2287
2478
  }
2288
- class Be extends v {
2289
- constructor(e, t) {
2290
- const s = t || E("Value must be larger or equal to **{minValue}**"), i = (r, a, o) => r < e || r === void 0 ? [
2291
- new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minValue: e }))
2479
+ class Te extends g {
2480
+ constructor(t, e) {
2481
+ const s = e || m("Value must be larger or equal to **{minValue}**"), i = (a, r, o) => a < t || a === void 0 ? [
2482
+ new f(
2483
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, minValue: t }),
2484
+ "",
2485
+ "min"
2486
+ )
2292
2487
  ] : null;
2293
2488
  super(i);
2294
2489
  }
2295
2490
  }
2296
- class Me extends v {
2297
- constructor(e, t) {
2298
- const s = t || E("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > e || r === void 0 ? [
2299
- new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxValue: e }))
2491
+ class _e extends g {
2492
+ constructor(t, e) {
2493
+ const s = e || m("Value must be less than or equal to **{maxValue}**"), i = (a, r, o) => a > t || a === void 0 ? [
2494
+ new f(
2495
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, maxValue: t }),
2496
+ "",
2497
+ "max"
2498
+ )
2300
2499
  ] : null;
2301
2500
  super(i);
2302
2501
  }
2303
2502
  }
2304
- class Ue extends v {
2305
- constructor(e, t, s) {
2306
- const i = s || E("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, u) => a < e || a > t || a === void 0 ? [
2307
- new V(
2308
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, minValue: e, maxValue: t })
2503
+ class Oe extends g {
2504
+ constructor(t, e, s) {
2505
+ const i = s || m("Value must be between **{minValue}** and **{maxValue}**"), a = (r, o, l) => r < t || r > e || r === void 0 ? [
2506
+ new f(
2507
+ this.replacePlaceholders(i, { newValue: r, oldValue: o, field: l, minValue: t, maxValue: e }),
2508
+ "",
2509
+ "range"
2309
2510
  )
2310
2511
  ] : null;
2311
- super(r);
2512
+ super(a);
2312
2513
  }
2313
2514
  }
2314
- function ut(n) {
2315
- return n == null ? 0 : At(n) || j(n) ? n.length : _t(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2515
+ function tt(n) {
2516
+ return n == null ? 0 : vt(n) || C(n) ? n.length : bt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2316
2517
  }
2317
- class We extends v {
2318
- constructor(e, t) {
2319
- const s = t || E("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => ut(r) < e ? [
2320
- new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: e }))
2518
+ class Fe extends g {
2519
+ constructor(t, e) {
2520
+ const s = e || m("Length must be larger or equal to **{minLength}**"), i = (a, r, o) => tt(a) < t ? [
2521
+ new f(
2522
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, minLength: t }),
2523
+ "",
2524
+ "min-length"
2525
+ )
2321
2526
  ] : null;
2322
2527
  super(i);
2323
2528
  }
2324
2529
  }
2325
- class $e extends v {
2326
- constructor(e, t) {
2327
- const s = t || E("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => ut(r) > e ? [
2328
- new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: e }))
2530
+ class Re extends g {
2531
+ constructor(t, e) {
2532
+ const s = e || m("Length must be less than or equal to **{maxLength}**"), i = (a, r, o) => tt(a) > t ? [
2533
+ new f(
2534
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, maxLength: t }),
2535
+ "",
2536
+ "max-length"
2537
+ )
2329
2538
  ] : null;
2330
2539
  super(i);
2331
2540
  }
2332
2541
  }
2333
- class qe extends v {
2334
- constructor(e, t, s) {
2335
- const i = s || E("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, u) => {
2336
- const c = ut(a);
2337
- return c < e || c > t ? [
2338
- new V(
2339
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, minLength: e, maxLength: t })
2542
+ class Pe extends g {
2543
+ constructor(t, e, s) {
2544
+ const i = s || m("Length must be between **{minLength}** and **{maxLength}**"), a = (r, o, l) => {
2545
+ const w = tt(r);
2546
+ return w < t || w > e ? [
2547
+ new f(
2548
+ this.replacePlaceholders(i, { newValue: r, oldValue: o, field: l, minLength: t, maxLength: e }),
2549
+ "",
2550
+ "range-length"
2340
2551
  )
2341
2552
  ] : null;
2342
2553
  };
2343
- super(r);
2554
+ super(a);
2344
2555
  }
2345
2556
  }
2346
- class ze extends v {
2347
- constructor(e, t) {
2348
- const s = t || E('Value must match pattern "**{pattern}**"'), i = (r, a, o) => e.test(String(b(r))) ? null : [
2349
- new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, pattern: e }))
2557
+ class je extends g {
2558
+ constructor(t, e) {
2559
+ const s = e || m('Value must match pattern "**{pattern}**"'), i = (a, r, o) => t.test(String(h(a))) ? null : [
2560
+ new f(
2561
+ this.replacePlaceholders(s, { newValue: a, oldValue: r, field: o, pattern: t }),
2562
+ "",
2563
+ "pattern"
2564
+ )
2350
2565
  ];
2351
2566
  super(i);
2352
2567
  }
2353
2568
  }
2354
- const He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2569
+ const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2355
2570
  __proto__: null,
2356
- CompareTo: ke,
2357
- InAllowedValues: Re,
2358
- LengthInRange: qe,
2359
- MaxLength: $e,
2360
- MaxValue: Me,
2361
- MinLength: We,
2362
- MinValue: Be,
2363
- Pattern: ze,
2364
- Required: Le,
2365
- Validator: v,
2366
- ValueInRange: Ue
2367
- }, Symbol.toStringTag, { value: "Module" })), Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2571
+ CompareTo: xe,
2572
+ InAllowedValues: Se,
2573
+ LengthInRange: Pe,
2574
+ MaxLength: Re,
2575
+ MaxValue: _e,
2576
+ MinLength: Fe,
2577
+ MinValue: Te,
2578
+ Pattern: je,
2579
+ Required: Ae,
2580
+ Validator: g,
2581
+ ValueInRange: Oe
2582
+ }, Symbol.toStringTag, { value: "Module" })), Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2368
2583
  __proto__: null,
2369
- AbortEventHandlingException: Ot,
2370
- Action: Pe,
2371
- ActionsMap: H,
2372
- ConditionalEnabledAction: ve,
2373
- ConditionalStatementAction: Q,
2374
- ConditionalValueAction: Ve,
2375
- ConditionalVisibilityAction: be,
2376
- DisplayMode: N,
2377
- EmptyField: je,
2378
- EnabledChangedAction: Mt,
2379
- EnabledChangingAction: Bt,
2380
- ExecuteAction: qt,
2381
- Field: X,
2382
- FieldActionBase: y,
2383
- FieldBase: A,
2384
- Group: w,
2385
- List: D,
2386
- ListItemAddedAction: rt,
2387
- ListItemRemovedAction: zt,
2388
- MdString: B,
2389
- MessagesWidget: Ne,
2390
- Operator: m,
2391
- RenderableValue: he,
2392
- Statement: I,
2393
- ValidChangedAction: Ut,
2394
- ValidationError: ot,
2395
- ValidationErrorRenderContent: V,
2396
- ValidationErrorText: ce,
2397
- Validator: v,
2398
- Validators: He,
2399
- ValueChangedAction: O,
2400
- VisibilityChangedAction: $t,
2401
- VisibilityChangingAction: Wt,
2402
- buildErrorMessage: E,
2403
- isCallableFunction: z,
2404
- isSimpleComponentDef: at,
2405
- transaction: q
2584
+ AbortEventHandlingException: Vt,
2585
+ Action: ye,
2586
+ ActionsMap: D,
2587
+ ConditionalEnabledAction: re,
2588
+ ConditionalStatementAction: L,
2589
+ ConditionalValueAction: ae,
2590
+ ConditionalVisibilityAction: ne,
2591
+ DisplayMode: _,
2592
+ EmptyField: Ve,
2593
+ EnabledChangedAction: Ot,
2594
+ EnabledChangingAction: _t,
2595
+ ExecuteAction: jt,
2596
+ Field: M,
2597
+ FieldActionBase: p,
2598
+ FieldBase: V,
2599
+ Group: d,
2600
+ List: A,
2601
+ ListItemAddedAction: K,
2602
+ ListItemRemovedAction: Nt,
2603
+ MdString: P,
2604
+ MessagesWidget: Ce,
2605
+ Operator: c,
2606
+ RenderableValue: Zt,
2607
+ Statement: v,
2608
+ ValidChangedAction: Ft,
2609
+ ValidationError: Z,
2610
+ ValidationErrorRenderContent: f,
2611
+ ValidationErrorText: Jt,
2612
+ Validator: g,
2613
+ Validators: Ne,
2614
+ ValueChangedAction: S,
2615
+ VisibilityChangedAction: Pt,
2616
+ VisibilityChangingAction: Rt,
2617
+ buildErrorMessage: m,
2618
+ isCallableFunction: B,
2619
+ isSimpleComponentDef: J,
2620
+ transaction: Y
2406
2621
  }, Symbol.toStringTag, { value: "Module" }));
2407
2622
  export {
2408
- Ot as AbortEventHandlingException,
2409
- Pe as Action,
2410
- H as ActionsMap,
2411
- ve as ConditionalEnabledAction,
2412
- Q as ConditionalStatementAction,
2413
- Ve as ConditionalValueAction,
2414
- be as ConditionalVisibilityAction,
2415
- N as DisplayMode,
2416
- je as EmptyField,
2417
- Mt as EnabledChangedAction,
2418
- Bt as EnabledChangingAction,
2419
- qt as ExecuteAction,
2420
- X as Field,
2421
- y as FieldActionBase,
2422
- A as FieldBase,
2423
- w as Group,
2424
- D as List,
2425
- rt as ListItemAddedAction,
2426
- zt as ListItemRemovedAction,
2427
- B as MdString,
2428
- Ne as MessagesWidget,
2429
- m as Operator,
2430
- he as RenderableValue,
2431
- I as Statement,
2432
- Ut as ValidChangedAction,
2433
- ot as ValidationError,
2434
- V as ValidationErrorRenderContent,
2435
- ce as ValidationErrorText,
2436
- v as Validator,
2437
- He as Validators,
2438
- O as ValueChangedAction,
2439
- $t as VisibilityChangedAction,
2440
- Wt as VisibilityChangingAction,
2441
- E as buildErrorMessage,
2442
- Je as default,
2443
- Ye as forms,
2444
- z as isCallableFunction,
2445
- at as isSimpleComponentDef,
2446
- q as transaction
2623
+ Vt as AbortEventHandlingException,
2624
+ ye as Action,
2625
+ D as ActionsMap,
2626
+ re as ConditionalEnabledAction,
2627
+ L as ConditionalStatementAction,
2628
+ ae as ConditionalValueAction,
2629
+ ne as ConditionalVisibilityAction,
2630
+ _ as DisplayMode,
2631
+ Ve as EmptyField,
2632
+ Ot as EnabledChangedAction,
2633
+ _t as EnabledChangingAction,
2634
+ jt as ExecuteAction,
2635
+ M as Field,
2636
+ p as FieldActionBase,
2637
+ V as FieldBase,
2638
+ d as Group,
2639
+ A as List,
2640
+ K as ListItemAddedAction,
2641
+ Nt as ListItemRemovedAction,
2642
+ P as MdString,
2643
+ Ce as MessagesWidget,
2644
+ c as Operator,
2645
+ Zt as RenderableValue,
2646
+ v as Statement,
2647
+ Ft as ValidChangedAction,
2648
+ Z as ValidationError,
2649
+ f as ValidationErrorRenderContent,
2650
+ Jt as ValidationErrorText,
2651
+ g as Validator,
2652
+ Ne as Validators,
2653
+ S as ValueChangedAction,
2654
+ Pt as VisibilityChangedAction,
2655
+ Rt as VisibilityChangingAction,
2656
+ m as buildErrorMessage,
2657
+ Le as default,
2658
+ De as forms,
2659
+ Kt as getConfig,
2660
+ B as isCallableFunction,
2661
+ J as isSimpleComponentDef,
2662
+ Yt as setConfig,
2663
+ Y as transaction
2447
2664
  };
2448
2665
  //# sourceMappingURL=dynamicforms-vue-forms.js.map