@dynamicforms/vue-forms 0.13.0 → 0.16.1

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,28 +1,42 @@
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")
1
+ import { computed as K, unref as h, isRef as Vt, reactive as Ut, watch as $t, ref as Wt, defineComponent as qt, resolveComponent as lt, openBlock as zt, createBlock as Ht, h as k } from "vue";
2
+ import { isEqual as R, isEmpty as F, isBoolean as Qt, isString as C, truncate as Xt, isArray as yt, isObject as Et } from "lodash-es";
3
+ var x = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(x || {});
4
+ const Kt = 10, ut = new Set(
5
+ Object.values(x).filter((n) => typeof n == "number")
6
+ ), Yt = new Set(
7
+ Object.values(x).filter((n) => typeof n == "string")
6
8
  );
9
+ function z(n) {
10
+ const t = typeof n == "string" ? `'${n}'` : String(n);
11
+ return new Error(`${t} is not a DisplayMode constant`);
12
+ }
7
13
  ((n) => {
8
14
  function t(i) {
9
- return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : ot;
15
+ const r = typeof i == "string" ? i.toUpperCase() : "";
16
+ if (r === "SUPPRESS") return 1;
17
+ if (r === "HIDDEN") return 5;
18
+ if (r === "INVISIBLE") return 8;
19
+ if (r === "FULL") return 10;
20
+ throw z(i);
10
21
  }
11
22
  n.fromString = t;
12
23
  function e(i) {
13
- const a = typeof i == "number" ? i : n.fromString(i);
14
- return lt.has(a) ? a : ot;
24
+ if (typeof i == "number") {
25
+ if (ut.has(i)) return i;
26
+ throw z(i);
27
+ }
28
+ if (typeof i != "string") throw z(i);
29
+ return n.fromString(i);
15
30
  }
16
31
  n.fromAny = e;
17
32
  function s(i) {
18
- const a = typeof i == "number" ? i : n.fromString(i);
19
- return lt.has(a);
33
+ return typeof i == "number" ? ut.has(i) : typeof i == "string" ? Yt.has(i.toUpperCase()) : !1;
20
34
  }
21
35
  n.isDefined = s;
22
- })(T || (T = {}));
23
- Object.freeze(T);
24
- const _ = T;
25
- class p {
36
+ })(x || (x = {}));
37
+ Object.freeze(x);
38
+ const I = x;
39
+ class m {
26
40
  static get classIdentifier() {
27
41
  throw new Error("classIdentifier must be declared");
28
42
  }
@@ -72,28 +86,28 @@ class p {
72
86
  unregisterFrom(t) {
73
87
  }
74
88
  }
75
- class Vt extends Error {
89
+ class P extends Error {
76
90
  }
77
- const yt = /* @__PURE__ */ Symbol("ValueChangedAction");
78
- class S extends p {
91
+ const Ct = /* @__PURE__ */ Symbol("ValueChangedAction");
92
+ class T extends m {
79
93
  constructor(t) {
80
94
  super(t);
81
95
  }
82
96
  static get classIdentifier() {
83
- return yt;
97
+ return Ct;
84
98
  }
85
99
  execute(t, e, s, i) {
86
100
  return super.execute(t, e, s, i);
87
101
  }
88
102
  }
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) {
103
+ const O = /* @__PURE__ */ Symbol("Transaction.capture"), St = /* @__PURE__ */ Symbol("Transaction.restore"), xt = /* @__PURE__ */ Symbol("Transaction.announceValue"), At = /* @__PURE__ */ Symbol("Transaction.settleValidity");
104
+ function ct(n) {
91
105
  let t = 0, e = n.parent;
92
106
  for (; e; )
93
107
  t++, e = e.parent;
94
108
  return t;
95
109
  }
96
- class Qt {
110
+ class Jt {
97
111
  participants = /* @__PURE__ */ new Map();
98
112
  /** what a rollback has to put back beyond the state slots, newest last */
99
113
  undo = [];
@@ -167,7 +181,7 @@ class Qt {
167
181
  * there is nothing the answer would change.
168
182
  */
169
183
  noteDepth(t) {
170
- this.passDepth < 0 || ut(t) >= this.passDepth && (this.restartPass = !0);
184
+ this.passDepth < 0 || ct(t) >= this.passDepth && (this.restartPass = !0);
171
185
  }
172
186
  /**
173
187
  * Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's
@@ -176,7 +190,7 @@ class Qt {
176
190
  */
177
191
  rollback() {
178
192
  this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
179
- e.snapshot && e.element[Ct](e.snapshot);
193
+ e.snapshot && e.element[St](e.snapshot);
180
194
  }), this.participants.clear();
181
195
  for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
182
196
  this.undo.length = 0, this.settled.length = 0;
@@ -205,7 +219,7 @@ class Qt {
205
219
  const e = [];
206
220
  return this.participants.forEach((s) => {
207
221
  if (!t(s)) return;
208
- const i = ut(s.element);
222
+ const i = ct(s.element);
209
223
  (e[i] ??= []).push(s);
210
224
  }), e;
211
225
  }
@@ -219,13 +233,13 @@ class Qt {
219
233
  const s = this.buckets(t);
220
234
  if (!s.length) return !1;
221
235
  for (let i = s.length - 1; i >= 0; i--) {
222
- const a = s[i];
223
- if (a) {
236
+ const r = s[i];
237
+ if (r) {
224
238
  this.passDepth = i, this.restartPass = !1;
225
239
  try {
226
- for (let r = 0; r < a.length; r++) {
240
+ for (let a = 0; a < r.length; a++) {
227
241
  if (this.restartPass) return !0;
228
- const o = a[r];
242
+ const o = r[a];
229
243
  t(o) && e(o);
230
244
  }
231
245
  } finally {
@@ -241,7 +255,7 @@ class Qt {
241
255
  (t) => t.valueDirty || t.structural !== void 0,
242
256
  (t) => {
243
257
  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);
258
+ t.structural = void 0, t.valueDirty = !1, t.forceValue = !1, t.element[xt](this, s, i, e);
245
259
  }
246
260
  );
247
261
  }
@@ -249,21 +263,21 @@ class Qt {
249
263
  return this.pass(
250
264
  (t) => t.validityDirty,
251
265
  (t) => {
252
- t.validityDirty = !1, t.element[xt](this);
266
+ t.validityDirty = !1, t.element[At](this);
253
267
  }
254
268
  );
255
269
  }
256
270
  }
257
- let E, q;
258
- function St() {
259
- return E;
271
+ let S, H;
272
+ function It() {
273
+ return S;
260
274
  }
261
- class It {
275
+ class Tt {
262
276
  }
263
- class Xt {
277
+ class Zt {
264
278
  open = !0;
265
279
  rollback() {
266
- throw this.open ? new It() : new TypeError(
280
+ throw this.open ? new Tt() : new TypeError(
267
281
  "this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it."
268
282
  );
269
283
  }
@@ -271,59 +285,59 @@ class Xt {
271
285
  this.open = !1;
272
286
  }
273
287
  }
274
- function ct(n) {
288
+ function ht(n) {
275
289
  if (n != null && typeof n.then == "function")
276
290
  throw new TypeError(
277
291
  "a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part."
278
292
  );
279
293
  }
280
- function Y(n) {
281
- if (E) {
282
- const s = n(q);
283
- return ct(s), s;
294
+ function J(n) {
295
+ if (S) {
296
+ const s = n(H);
297
+ return ht(s), s;
284
298
  }
285
- const t = new Qt(), e = new Xt();
286
- E = t, q = e;
299
+ const t = new Jt(), e = new Zt();
300
+ S = t, H = e;
287
301
  try {
288
302
  const s = n(e);
289
- return ct(s), t.commit(), s;
303
+ return ht(s), t.commit(), s;
290
304
  } catch (s) {
291
- if (t.rollback(), s instanceof It) return;
305
+ if (t.rollback(), s instanceof Tt) return;
292
306
  throw s;
293
307
  } finally {
294
- E = void 0, q = void 0, e.close();
308
+ S = void 0, H = void 0, e.close();
295
309
  }
296
310
  }
297
311
  function u(n) {
298
- return E ? n(E) : Y(() => n(E));
312
+ return S ? n(S) : J(() => n(S));
299
313
  }
300
- const At = { useMarkdownInValidators: !0 };
301
- function Kt() {
302
- return At;
314
+ const Ot = { useMarkdownInValidators: !0 };
315
+ function Gt() {
316
+ return Ot;
303
317
  }
304
- function Yt(n) {
305
- Object.assign(At, n);
318
+ function te(n) {
319
+ Object.assign(Ot, n);
306
320
  }
307
- const De = {
321
+ const Ue = {
308
322
  install(n, t) {
309
- t && Yt(t);
323
+ t && te(t);
310
324
  }
311
325
  };
312
- class P extends String {
326
+ class j extends String {
313
327
  plugins;
314
328
  options;
315
329
  constructor(t, e, s) {
316
330
  super(t), this.plugins = s, this.options = e;
317
331
  }
318
332
  }
319
- function J(n) {
333
+ function Z(n) {
320
334
  const t = h(n);
321
- return typeof t == "object" && "componentName" in t;
335
+ return typeof t == "object" && t !== null && "componentName" in t;
322
336
  }
323
- function B(n) {
337
+ function L(n) {
324
338
  return typeof h(n) == "function";
325
339
  }
326
- class Z {
340
+ class G {
327
341
  /**
328
342
  * Machine-readable identifier of what failed, in kebab-case. Every validator this library ships states one, so
329
343
  * code that reacts to a particular failure does not have to match the message text, which is translated and
@@ -333,6 +347,19 @@ class Z {
333
347
  this.code = t;
334
348
  }
335
349
  code;
350
+ /**
351
+ * True where `other` is an error of this class that renders exactly as this one does and reports the same code.
352
+ * Two runs of one validator over an unchanged value produce two instances of one message, and this is what lets
353
+ * the validator hand the field back the instance it already holds rather than a fresh one: an equal error is not
354
+ * a new error, and nothing re-renders over a verdict that did not move.
355
+ *
356
+ * The comparison is over what renders - the component, its bindings, its body and the classes - because that is
357
+ * what a reader of `field.errors` sees. A structural comparison of the errors themselves answers nothing useful:
358
+ * `ValidationErrorRenderContent` holds a Vue `computed`, and two of those are never structurally equal.
359
+ */
360
+ sameAs(t) {
361
+ return Object.getPrototypeOf(this) === Object.getPrototypeOf(t) && this.code === t.code && this.componentName === t.componentName && R(this.componentBody, t.componentBody) && R(this.componentBindings, t.componentBindings) && R(this.extraClasses, t.extraClasses);
362
+ }
336
363
  get componentName() {
337
364
  return "Comment";
338
365
  }
@@ -346,7 +373,7 @@ class Z {
346
373
  return "";
347
374
  }
348
375
  }
349
- class Jt extends Z {
376
+ class ee extends G {
350
377
  constructor(t, e = "", s) {
351
378
  super(s), this.text = t, this.classes = e;
352
379
  }
@@ -362,20 +389,20 @@ class Jt extends Z {
362
389
  return this.classes;
363
390
  }
364
391
  }
365
- class f extends Z {
392
+ class g extends G {
366
393
  constructor(t, e = "", s) {
367
- super(s), this.classes = e, this.text = t, this.textType = X(() => this.getTextType);
394
+ super(s), this.classes = e, this.text = t, this.textType = K(() => this.getTextType);
368
395
  }
369
396
  classes;
370
397
  text;
371
398
  textType;
372
399
  get resolvedText() {
373
400
  const t = h(this.text);
374
- return B(t) ? t() : t;
401
+ return L(t) ? t() : t;
375
402
  }
376
403
  get getTextType() {
377
404
  const t = this.resolvedText;
378
- return t ? t instanceof P ? "md" : J(t) ? "component" : "string" : "string";
405
+ return t ? t instanceof j ? "md" : Z(t) ? "component" : "string" : "string";
379
406
  }
380
407
  get componentName() {
381
408
  switch (h(this.textType)) {
@@ -417,48 +444,48 @@ class f extends Z {
417
444
  return this.classes;
418
445
  }
419
446
  }
420
- class Zt extends f {
447
+ class se extends g {
421
448
  }
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, `
449
+ function b(n) {
450
+ return Gt().useMarkdownInValidators ? new j(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, `
424
451
  `);
425
452
  }
426
- const Gt = /* @__PURE__ */ Symbol("Validator"), te = () => m("Validation could not be completed");
427
- class g extends S {
453
+ const ie = /* @__PURE__ */ Symbol("Validator"), ne = () => b("Validation could not be completed");
454
+ class f extends T {
428
455
  source;
429
456
  /**
430
457
  * Creates a new validator
431
458
  * @param validationFn Function that validates the field value and returns errors or null
432
459
  */
433
460
  constructor(t) {
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());
461
+ const e = (s, i, r, a) => {
462
+ const o = this.bindingState(s), l = o.abandon, v = ++o.run, p = s.validationEpoch, it = It();
463
+ let nt = !1;
464
+ const $ = () => !nt && o.run === v && s.validationEpoch === p && !it?.rolledBack, rt = new AbortController(), B = () => {
465
+ $() || (nt = !0, o.abandon === B && (o.abandon = void 0), rt.abort());
439
466
  };
440
467
  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);
468
+ const W = t(r, a, s, rt.signal) || [], q = (E) => J(() => {
469
+ const D = E?.map((A) => this.claim(A)) ?? [];
470
+ for (let A = s.errors.length - 1; A >= 0; A--) {
471
+ const at = s.errors[A];
472
+ if (at.source === this.source) {
473
+ const ot = D.findIndex((Mt) => Mt.sameAs(at));
474
+ ot >= 0 ? D.splice(ot, 1) : s.errors.splice(A, 1);
448
475
  }
449
476
  }
450
- k.length > 0 && s.errors.push(...k), s.validate();
477
+ D.length > 0 && s.errors.push(...D), s.validate();
451
478
  });
452
- return $ instanceof Promise ? (o.abandon = N, et?.whenRolledBack(N), s.beginValidating(), $.then(
453
- (y) => {
454
- U() && W(y);
479
+ return W instanceof Promise ? (o.abandon = B, it?.whenRolledBack(B), s.beginValidating(), W.then(
480
+ (E) => {
481
+ $() && q(E);
455
482
  },
456
- (y) => {
457
- U() && (W([new f(te(), "", "validation-failed")]), console.error("Validation failed", y));
483
+ (E) => {
484
+ $() && (q([new g(ne(), "", "validation-failed")]), console.error("Validation failed", E));
458
485
  }
459
486
  ).finally(() => {
460
- o.abandon === N && (o.abandon = void 0), s.endValidating();
461
- }).catch((y) => console.error("Validation failed", y))) : W($), i(s, a, r);
487
+ o.abandon === B && (o.abandon = void 0), s.endValidating();
488
+ }).catch((E) => console.error("Validation failed", E))) : q(W), i(s, r, a);
462
489
  };
463
490
  super(e), this.source = Symbol(this.constructor.name);
464
491
  }
@@ -479,7 +506,7 @@ class g extends S {
479
506
  return Object.create(Object.getPrototypeOf(t), { ...i, source: s });
480
507
  }
481
508
  static get classIdentifier() {
482
- return Gt;
509
+ return ie;
483
510
  }
484
511
  get eager() {
485
512
  return !0;
@@ -529,29 +556,29 @@ class g extends S {
529
556
  replacePlaceholdersFunction(t, e) {
530
557
  return () => {
531
558
  let s = h(t);
532
- for (; B(s); )
559
+ for (; L(s); )
533
560
  s = h(this.replacePlaceholders(s(), e));
534
561
  return s;
535
562
  };
536
563
  }
537
564
  replacePlaceholders(t, e) {
538
- if (B(t)) return this.replacePlaceholdersFunction(t, e);
539
- if (J(t)) return t;
540
- if (wt(t))
565
+ if (L(t)) return this.replacePlaceholdersFunction(t, e);
566
+ if (Z(t)) return t;
567
+ if (Vt(t))
541
568
  return this.replacePlaceholdersFunction(() => h(t), e);
542
569
  let s = h(t);
543
570
  return Object.keys(e).forEach((i) => {
544
571
  s = s.replaceAll(`{${i}}`, e[i]);
545
- }), t instanceof P ? new P(s.toString(), t.options, t.plugins) : s;
572
+ }), t instanceof j ? new j(s.toString(), t.options, t.plugins) : s;
546
573
  }
547
574
  }
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();
575
+ class M {
576
+ /**
577
+ * Every action registered here, in registration order. It is replaced rather than written when an action is
578
+ * dropped, so a run already walking it finishes on the array it started with and the removal takes effect from
579
+ * the next trigger.
580
+ */
581
+ actions = [];
555
582
  /**
556
583
  * Registers `action`. It becomes the outermost handler of its identifier, or - where `before` is given and is
557
584
  * registered here under the same identifier - takes that action's place in the order, so `before` wraps it and
@@ -559,117 +586,131 @@ class D {
559
586
  * inside a handler already there.
560
587
  */
561
588
  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)))
589
+ if (!(t instanceof m)) throw new Error("Invalid action type");
590
+ const s = e ? this.actions.indexOf(e) : -1;
591
+ if (e && (e.classIdentifier !== t.classIdentifier || s < 0))
565
592
  throw new Error("Action to register before is not registered under the same identifier");
566
- this.registeredActions.push(t), this.insert(this.chains, s, t, e), t.eager && this.insert(this.eagerChains, s, t, e);
593
+ s < 0 ? this.actions.push(t) : this.actions.splice(s, 0, t);
567
594
  }
568
- /**
569
- * Drops `action` from this map and answers whether it was in it. The lists it stood in are replaced rather than
570
- * written, so a run already walking one finishes on the list it started with and the removal takes effect from
571
- * the next trigger.
572
- */
595
+ /** Drops `action` and answers whether it was registered here. */
573
596
  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;
597
+ return this.actions.includes(t) ? (this.actions = this.actions.filter((e) => e !== t), !0) : !1;
579
598
  }
580
599
  /** True where something is registered under `identifier`. */
581
600
  willTrigger(t) {
582
- return this.chains.has(t);
601
+ return this.actions.some((e) => e.classIdentifier === t);
583
602
  }
584
603
  /** True where any eager action is registered, whatever identifier it stands under. */
585
604
  get hasEager() {
586
- return this.eagerChains.size > 0;
605
+ return this.actions.some((t) => t.eager);
587
606
  }
588
607
  /** Runs the actions registered under `ActionClass` and answers with what the outermost of them returned. */
589
608
  trigger(t, e, ...s) {
590
- return this.run(this.chains.get(t.classIdentifier), e, s);
609
+ return this.run(t.classIdentifier, !1, e, s);
591
610
  }
592
- /** Runs the eager actions of every identifier, each group on its own. */
611
+ /**
612
+ * Runs the eager actions of every identifier, each group on its own. A group is entered at its outermost eager
613
+ * action, which is the last one registered under that identifier.
614
+ */
593
615
  triggerEager(t, ...e) {
594
- this.eagerChains.forEach((s) => this.run(s, t, e));
616
+ const s = this.actions;
617
+ for (let i = s.length - 1; i >= 0; i--) {
618
+ const r = s[i];
619
+ if (r.eager && M.outermostEager(s, i))
620
+ try {
621
+ this.walk(s, i, r.classIdentifier, !0, t, e);
622
+ } catch (a) {
623
+ if (!(a instanceof P)) throw a;
624
+ }
625
+ }
595
626
  }
596
627
  /** Runs the eager actions registered under `identifier` and nothing else. */
597
628
  triggerEagerFor(t, e, ...s) {
598
- return this.run(this.eagerChains.get(t), e, s);
629
+ return this.run(t, !0, e, s);
599
630
  }
600
- /** the validators registered in this map, in registration order */
631
+ /** the validators registered here, in registration order */
601
632
  get validators() {
602
- return this.registeredActions.filter((t) => t instanceof g);
603
- }
604
- clone() {
605
- const t = new D();
606
- return this.registeredActions.forEach((e) => t.register(e)), t;
633
+ return this.actions.filter((t) => t instanceof f);
607
634
  }
608
635
  /**
609
- * Tells every action in this map that it serves `owner`. A copied map holds the instances the original holds, so
610
- * the element that took the copy on is announced to them here, the way registering an action announces the
611
- * element it was registered on.
636
+ * Tells every action here that it serves `owner`. A binding reads the map its declaration holds, so this is what
637
+ * announces the new element to the actions already in it - the way registering an action announces the elements
638
+ * it comes to serve.
612
639
  */
613
640
  bindTo(t) {
614
- this.registeredActions.forEach((e) => e.boundToBinding(t));
641
+ this.actions.forEach((e) => e.boundToBinding(t));
642
+ }
643
+ /** True where no eager action of `identifier` stands after `index`, which makes `index` the group's entry. */
644
+ static outermostEager(t, e) {
645
+ const s = t[e].classIdentifier;
646
+ for (let i = t.length - 1; i > e; i--)
647
+ if (t[i].eager && t[i].classIdentifier === s) return !1;
648
+ return !0;
615
649
  }
616
650
  /**
617
- * Walks `chain` from the end backwards, handing each action a `supr` that continues at the one before it. The
618
- * closures exist for the length of the run and only as deep as the run actually goes, so a chain nobody walks to
619
- * the bottom costs nothing for the part left unreached.
651
+ * Enters a group at its outermost action. An abort ends the run and is answered with rather than raised: the
652
+ * exception is what the caller receives, so a run a handler ended is told apart from one that reached no handler
653
+ * and from one whose handler answered null.
620
654
  */
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);
625
- }
626
- /** Walks a chain, answering null where there is none. An abort ends the run and is not an error to the caller. */
627
- run(t, e, s) {
628
- if (!t) return null;
655
+ run(t, e, s, i) {
656
+ const r = this.actions;
629
657
  try {
630
- return this.step(t, t.length - 1, e, s);
631
- } catch (i) {
632
- if (!(i instanceof Vt)) throw i;
658
+ return this.walk(r, r.length - 1, t, e, s, i);
659
+ } catch (a) {
660
+ if (a instanceof P) return a;
661
+ throw a;
633
662
  }
634
- return null;
635
- }
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);
639
663
  }
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);
664
+ /**
665
+ * Walks from `index` backwards to the first action of `identifier`, handing it a `supr` that continues at the one
666
+ * before it. The actions registered under other identifiers are passed over, so the array needs no grouping of
667
+ * its own; the closures exist for the length of the run and only as deep as the run actually goes.
668
+ */
669
+ walk(t, e, s, i, r, a) {
670
+ let o = e;
671
+ for (; o >= 0 && (t[o].classIdentifier !== s || i && !t[o].eager); ) o--;
672
+ if (o < 0) return null;
673
+ const l = (v, ...p) => this.walk(t, o - 1, s, i, v, p);
674
+ return t[o].execute(r, l, ...a);
645
675
  }
646
676
  }
647
- function x(n) {
677
+ function V(n) {
648
678
  let t = n;
649
679
  for (; t.fieldName !== void 0 && t.parent; ) t = t.parent;
650
680
  return t;
651
681
  }
652
- function ee(n) {
682
+ function dt(n, t) {
683
+ let e = n;
684
+ for (const s of re(t))
685
+ if (e = e.field?.(s) ?? void 0, !e) return;
686
+ return e?.declaration === t ? e : void 0;
687
+ }
688
+ function re(n) {
653
689
  const t = [];
654
690
  let e = n;
655
691
  for (; e.fieldName !== void 0 && e.parent; )
656
692
  t.unshift(e.fieldName), e = e.parent;
657
693
  return t;
658
694
  }
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;
695
+ function tt(n, t) {
696
+ const e = dt(t, n);
697
+ if (e) return e;
698
+ let s = t.parent;
699
+ for (; s; ) {
700
+ const i = dt(V(s), n);
701
+ if (i) return i;
702
+ s = s.parent;
703
+ }
704
+ return V(n) === V(t.declaration) ? void 0 : n;
664
705
  }
665
- function Tt(n, t) {
666
- const e = G(n, t);
706
+ function kt(n, t) {
707
+ const e = tt(n, t);
667
708
  if (!e) return [];
668
709
  if (e !== n) return [e];
669
710
  const s = t.bindingsOf(n);
670
711
  return s.length > 0 ? s : [n];
671
712
  }
672
- function se(n, t) {
713
+ function ae(n, t) {
673
714
  let e = t.parent;
674
715
  for (; e; ) {
675
716
  const s = e.field?.(n);
@@ -677,8 +718,8 @@ function se(n, t) {
677
718
  e = e.parent;
678
719
  }
679
720
  }
680
- const ie = /* @__PURE__ */ Symbol("ConditionalStatementAction");
681
- class L extends S {
721
+ const oe = /* @__PURE__ */ Symbol("ConditionalStatementAction");
722
+ class U extends T {
682
723
  statement;
683
724
  conditionalExecutor;
684
725
  /**
@@ -694,12 +735,12 @@ class L extends S {
694
735
  */
695
736
  registrations = /* @__PURE__ */ new WeakSet();
696
737
  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)));
738
+ super((i, r, a, o) => (this.applyIn(V(i)) || i.markRecordIncomplete(), r(i, a, o))), this.statement = t, this.conditionalExecutor = e;
739
+ const s = new T((i, r, ...a) => (this.applyFrom(i), r(i, ...a)));
699
740
  t.collectFields().forEach((i) => i.registerAction(s));
700
741
  }
701
742
  static get classIdentifier() {
702
- return ie;
743
+ return oe;
703
744
  }
704
745
  get eager() {
705
746
  return !0;
@@ -717,7 +758,7 @@ class L extends S {
717
758
  targetsIn(t) {
718
759
  const e = [];
719
760
  return this.declarations.forEach(
720
- (s) => Tt(s, t).forEach((i) => {
761
+ (s) => kt(s, t).forEach((i) => {
721
762
  this.registrations.has(i) && e.push(i);
722
763
  })
723
764
  ), e;
@@ -733,8 +774,8 @@ class L extends S {
733
774
  if (e.length === 0) return !1;
734
775
  const s = this.state(t, () => ({ lastResult: void 0 })), i = this.statement.evaluate(t);
735
776
  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;
777
+ const r = s.lastResult;
778
+ return s.lastResult = i, e.forEach((a) => this.conditionalExecutor(a, i, r)), !0;
738
779
  }
739
780
  /**
740
781
  * Re-evaluates the records a change of `source` speaks for. A field of the record the targets live in speaks for
@@ -744,133 +785,133 @@ class L extends S {
744
785
  */
745
786
  applyFrom(t) {
746
787
  const e = /* @__PURE__ */ new Set();
747
- this.targetsIn(x(t)).forEach((s) => e.add(x(s))), e.forEach((s) => this.applyIn(s));
788
+ this.targetsIn(V(t)).forEach((s) => e.add(V(s))), e.forEach((s) => this.applyIn(s));
748
789
  }
749
790
  }
750
- class ne extends L {
791
+ class le extends U {
751
792
  constructor(t) {
752
793
  super(t, (e, s) => {
753
- e.visibility = s ? _.FULL : _.SUPPRESS;
794
+ e.visibility = s ? I.FULL : I.SUPPRESS;
754
795
  });
755
796
  }
756
797
  }
757
- class re extends L {
798
+ class ue extends U {
758
799
  constructor(t) {
759
800
  super(t, (e, s) => {
760
801
  e.enabled = s;
761
802
  });
762
803
  }
763
804
  }
764
- class ae extends L {
805
+ class ce extends U {
765
806
  constructor(t, e) {
766
807
  super(t, (s, i) => {
767
808
  i && (s.value = e);
768
809
  });
769
810
  }
770
811
  }
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 || {});
812
+ var N = /* @__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))(N || {});
772
813
  ((n) => {
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;
791
- throw new Error(`Unrecognised operator ${r}`);
814
+ function t(r) {
815
+ const a = r.toLowerCase();
816
+ if (a === "not") return 0;
817
+ if (a === "or") return 1;
818
+ if (a === "and") return 2;
819
+ if (a === "xor") return 3;
820
+ if (a === "nand") return 4;
821
+ if (a === "nor") return 5;
822
+ if (a === "equals") return -1;
823
+ if (["not_equals", "not-equals", "not equals"].includes(a)) return -2;
824
+ if (a === "gt") return -3;
825
+ if (a === "lt") return -4;
826
+ if (a === "ge") return -5;
827
+ if (a === "le") return -6;
828
+ if (a === "in") return -7;
829
+ if (["not_in", "not-in", "not in"].includes(a)) return -8;
830
+ if (a === "includes") return -9;
831
+ if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
832
+ throw new Error(`Unrecognised operator ${a}`);
792
833
  }
793
834
  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}`);
835
+ function e(r) {
836
+ const a = typeof r == "number" ? r : n.fromString(r);
837
+ if (Object.values(n).includes(a)) return a;
838
+ throw new Error(`Unrecognised operator ${r}`);
798
839
  }
799
840
  n.fromAny = e;
800
- function s(a) {
801
- const r = typeof a == "number" ? a : n.fromString(a);
802
- return Object.values(n).includes(r);
841
+ function s(r) {
842
+ const a = typeof r == "number" ? r : n.fromString(r);
843
+ return Object.values(n).includes(a);
803
844
  }
804
845
  n.isDefined = s;
805
- function i(a) {
806
- return a >= 0;
846
+ function i(r) {
847
+ return r >= 0;
807
848
  }
808
849
  n.isLogicOperator = i;
809
- })(j || (j = {}));
810
- Object.freeze(j);
811
- const c = j, oe = /* @__PURE__ */ Symbol("EnabledChangingAction");
812
- class _t extends p {
850
+ })(N || (N = {}));
851
+ Object.freeze(N);
852
+ const c = N, he = /* @__PURE__ */ Symbol("EnabledChangingAction");
853
+ class Rt extends m {
813
854
  constructor(t) {
814
855
  super(t);
815
856
  }
816
857
  static get classIdentifier() {
817
- return oe;
858
+ return he;
818
859
  }
819
860
  execute(t, e, s, i) {
820
861
  return super.execute(t, e, s, i);
821
862
  }
822
863
  }
823
- const le = /* @__PURE__ */ Symbol("EnabledChangedAction");
824
- class Ot extends p {
864
+ const de = /* @__PURE__ */ Symbol("EnabledChangedAction");
865
+ class _t extends m {
825
866
  constructor(t) {
826
867
  super(t);
827
868
  }
828
869
  static get classIdentifier() {
829
- return le;
870
+ return de;
830
871
  }
831
872
  execute(t, e, s, i) {
832
873
  return super.execute(t, e, s, i);
833
874
  }
834
875
  }
835
- const ue = /* @__PURE__ */ Symbol("ValidChangedAction");
836
- class Ft extends p {
876
+ const ge = /* @__PURE__ */ Symbol("ValidChangedAction");
877
+ class Ft extends m {
837
878
  constructor(t) {
838
879
  super(t);
839
880
  }
840
881
  static get classIdentifier() {
841
- return ue;
882
+ return ge;
842
883
  }
843
884
  execute(t, e, s, i) {
844
885
  return super.execute(t, e, s, i);
845
886
  }
846
887
  }
847
- const ce = /* @__PURE__ */ Symbol("VisibilityChangingAction");
848
- class Rt extends p {
888
+ const fe = /* @__PURE__ */ Symbol("VisibilityChangingAction");
889
+ class Pt extends m {
849
890
  constructor(t) {
850
891
  super(t);
851
892
  }
852
893
  static get classIdentifier() {
853
- return ce;
894
+ return fe;
854
895
  }
855
896
  execute(t, e, s, i) {
856
897
  return super.execute(t, e, s, i);
857
898
  }
858
899
  }
859
- const he = /* @__PURE__ */ Symbol("VisibilityChangedAction");
860
- class Pt extends p {
900
+ const pe = /* @__PURE__ */ Symbol("VisibilityChangedAction");
901
+ class jt extends m {
861
902
  constructor(t) {
862
903
  super(t);
863
904
  }
864
905
  static get classIdentifier() {
865
- return he;
906
+ return pe;
866
907
  }
867
908
  execute(t, e, s, i) {
868
909
  return super.execute(t, e, s, i);
869
910
  }
870
911
  }
871
- const ht = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new Set(["validators", "actions"]);
872
- let z = 0;
873
- class V {
912
+ const gt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new Set(["validators", "actions"]);
913
+ let X = 0;
914
+ class y {
874
915
  /**
875
916
  * Vue's getTargetType answers INVALID for an object that carries __v_skip, so reactive() hands an element back
876
917
  * unwrapped and no element is ever behind a proxy of its own. isReactive() reads the second flag, and it stays
@@ -888,6 +929,21 @@ class V {
888
929
  get __v_isReactive() {
889
930
  return !0;
890
931
  }
932
+ /**
933
+ * Names the element's class, which is what a structural comparison of two elements answers on. An element keeps
934
+ * its state in private class fields, so a walk over own keys reaches none of it; lodash reads this tag through
935
+ * Object.prototype.toString before it compares anything, and a tag it does not know ends the comparison there.
936
+ * Two elements are therefore equal only where they are the same element. What they hold is compared as
937
+ * isEqual(a.value, b.value).
938
+ *
939
+ * It is an accessor on the prototype, so an element carries nothing for it, and `Object.prototype.toString`
940
+ * answers `[object Field]` rather than `[object Object]`. Each class states its own name as a literal: a
941
+ * minifier renames the class itself, so reading the constructor's name would report whatever the build called
942
+ * it.
943
+ */
944
+ get [Symbol.toStringTag]() {
945
+ return "FormElement";
946
+ }
891
947
  /**
892
948
  * The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read
893
949
  * through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.
@@ -974,7 +1030,7 @@ class V {
974
1030
  extendedOf(t) {
975
1031
  const e = /* @__PURE__ */ Object.create(null);
976
1032
  return Object.entries(t).forEach(([s, i]) => {
977
- gt.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (e[s] = i);
1033
+ pt.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (e[s] = i);
978
1034
  }), e;
979
1035
  }
980
1036
  /**
@@ -985,8 +1041,8 @@ class V {
985
1041
  assignParams(t) {
986
1042
  const e = this.extendedOf(t);
987
1043
  Object.entries(t).forEach(([s, i]) => {
988
- Object.hasOwn(e, s) || gt.has(s) || (this[s] = i);
989
- }), R(e) || this.setExtendedValues(e);
1044
+ Object.hasOwn(e, s) || pt.has(s) || (this[s] = i);
1045
+ }), F(e) || this.setExtendedValues(e);
990
1046
  }
991
1047
  /**
992
1048
  * Takes this element into the record of the open transaction, where one is open. A write of a single slot that
@@ -994,7 +1050,7 @@ class V {
994
1050
  * atomic, and inside a transaction it has to be part of what a rollback puts back.
995
1051
  */
996
1052
  touchState() {
997
- St()?.touch(this);
1053
+ It()?.touch(this);
998
1054
  }
999
1055
  /**
1000
1056
  * Records the whole of this element's mutable state, so that a rolled-back transaction can put it back exactly
@@ -1014,7 +1070,7 @@ class V {
1014
1070
  * The two validation counters are the slots the element keeps: they count runs that are in flight, and a
1015
1071
  * rollback cannot un-start one. Put back, the counts would no longer match the endValidating calls still to come.
1016
1072
  */
1017
- [Ct](t) {
1073
+ [St](t) {
1018
1074
  const e = this.#e.validatingCount, s = this.#e.validatingChildren;
1019
1075
  Object.assign(this.#t, t), this.#t.validatingCount = e, this.#t.validatingChildren = s;
1020
1076
  }
@@ -1032,11 +1088,11 @@ class V {
1032
1088
  /** announces the start of one asynchronous validation run; validators pair it with endValidating */
1033
1089
  beginValidating() {
1034
1090
  const t = !this.validating;
1035
- this.#t.validatingCount++, t && this.parent?.childValidatingChanged(!0);
1091
+ this.#t.validatingCount++, t && this.container?.childValidatingChanged(!0);
1036
1092
  }
1037
1093
  /** announces the end of one asynchronous validation run */
1038
1094
  endValidating() {
1039
- this.#e.validatingCount !== 0 && (this.#t.validatingCount--, this.validating || this.parent?.childValidatingChanged(!1));
1095
+ this.#e.validatingCount !== 0 && (this.#t.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
1040
1096
  }
1041
1097
  /**
1042
1098
  * Records that a child started or stopped answering `validating` with true, and carries the transition further
@@ -1044,7 +1100,7 @@ class V {
1044
1100
  */
1045
1101
  childValidatingChanged(t) {
1046
1102
  const e = this.validating;
1047
- this.#t.validatingChildren += t ? 1 : -1, this.validating !== e && this.parent?.childValidatingChanged(t);
1103
+ this.#t.validatingChildren += t ? 1 : -1, this.validating !== e && this.container?.childValidatingChanged(t);
1048
1104
  }
1049
1105
  /**
1050
1106
  * True while an `Action.execute()` at or below this element has yet to settle. An `Action` answers for its own
@@ -1064,8 +1120,8 @@ class V {
1064
1120
  * container answers from its own computed.
1065
1121
  */
1066
1122
  get busyRead() {
1067
- let t = dt.get(this);
1068
- return t || (t = X(() => this.composeBusy()), dt.set(this, t)), t.value;
1123
+ let t = ft.get(this);
1124
+ return t || (t = K(() => this.composeBusy()), ft.set(this, t)), t.value;
1069
1125
  }
1070
1126
  /** What busyRead computes. A container answers over its members; anything else executes nothing. */
1071
1127
  composeBusy() {
@@ -1107,10 +1163,21 @@ class V {
1107
1163
  * undefined while no container holds it. The container writes it; everyone else reads it. The read is tracked,
1108
1164
  * so an effect rendering off the link - `v-if="field.parent"` - re-runs when a container takes the element or
1109
1165
  * releases it.
1166
+ *
1167
+ * A `List` holds rows and a row is a `Group`, so only a container can be a `List`'s child: `Field` narrows the
1168
+ * type to `Group | undefined`, and the sibling lookup `field.parent?.fields.other` is typed on a field.
1110
1169
  */
1111
1170
  get parent() {
1112
1171
  return this.#t.parent;
1113
1172
  }
1173
+ /**
1174
+ * The same link at the type the internals reach through. The protected members a container is told things
1175
+ * through - childValidatingChanged, childValidityChanged - are declared here, and a union of two subclasses is
1176
+ * not an instance of this class, which is what a protected access needs.
1177
+ */
1178
+ get container() {
1179
+ return this.#t.parent;
1180
+ }
1114
1181
  /** when member of a Group, fieldName specifies the name of this field. Written by the group, read-only after */
1115
1182
  get fieldName() {
1116
1183
  return this.#t.fieldName;
@@ -1135,8 +1202,8 @@ class V {
1135
1202
  * cheaper one, resolving within a single record, does not apply.
1136
1203
  */
1137
1204
  bindingsOf(t) {
1138
- const e = t.declaration, s = [], i = (a) => {
1139
- a.declaration === e && s.push(a), a.members.forEach(i);
1205
+ const e = t.declaration, s = [], i = (r) => {
1206
+ r.declaration === e && s.push(r), r.members.forEach(i);
1140
1207
  };
1141
1208
  return i(this), s;
1142
1209
  }
@@ -1148,7 +1215,7 @@ class V {
1148
1215
  * nothing says so again, so the next container above answers for it.
1149
1216
  */
1150
1217
  markRecordIncomplete() {
1151
- this._recordPending || (this._recordPending = !0, z++);
1218
+ this._recordPending || (this._recordPending = !0, X++);
1152
1219
  }
1153
1220
  /**
1154
1221
  * Runs the eager passes outstanding in `element`'s subtree, now that the record it belongs to is assembled. A
@@ -1156,9 +1223,9 @@ class V {
1156
1223
  * List that has taken a row, which is what gives the row's fields the form above it.
1157
1224
  */
1158
1225
  completeRecords(t = this) {
1159
- z !== 0 && u(() => {
1226
+ X !== 0 && u(() => {
1160
1227
  const e = (s) => {
1161
- s._recordPending && (s._recordPending = !1, z--, s.rerunEagerActions()), s.members.forEach(e);
1228
+ s._recordPending && (s._recordPending = !1, X--, s.rerunEagerActions()), s.members.forEach(e);
1162
1229
  };
1163
1230
  e(t);
1164
1231
  });
@@ -1166,14 +1233,48 @@ class V {
1166
1233
  /** Runs this element's eager actions over the value it holds and re-forms the verdict they reach. */
1167
1234
  rerunEagerActions() {
1168
1235
  u((t) => {
1169
- this._actions?.triggerEager(this, this.value, this.value), t.markValidityDirty(this);
1236
+ this.boundActions?.triggerEager(this, this.value, this.value), t.markValidityDirty(this);
1170
1237
  });
1171
1238
  }
1172
- get actions() {
1173
- return this._actions || (this._actions = new D()), this._actions;
1239
+ /**
1240
+ * The actions this element answers to, absent where nothing is registered. A binding holds the very map its
1241
+ * declaration holds rather than a copy of it, so the slot is read directly: what a trigger costs is one property
1242
+ * read, and a rule registered on a `List`'s item template reaches every row through the map they share - the
1243
+ * rows built before the registration as much as the ones built after.
1244
+ */
1245
+ get boundActions() {
1246
+ return this._actions;
1247
+ }
1248
+ /** Records that `binding` was made from this element, so a later registration can reach it. */
1249
+ noteBinding(t) {
1250
+ let e = Q.get(this);
1251
+ e || (e = /* @__PURE__ */ new Set(), Q.set(this, e)), e.add(new WeakRef(t));
1252
+ }
1253
+ /**
1254
+ * The bindings made from this element that are still alive, and this element itself. The dead references are
1255
+ * dropped as they are found, which is what keeps the set from growing over the life of a long-lived declaration.
1256
+ */
1257
+ get boundElements() {
1258
+ const t = this.declaration, e = Q.get(t), s = [t];
1259
+ return e && e.forEach((i) => {
1260
+ const r = i.deref();
1261
+ r ? s.push(r) : e.delete(i);
1262
+ }), s;
1174
1263
  }
1175
- set actions(t) {
1176
- this._actions = t;
1264
+ /**
1265
+ * The map registrations go into: the declaration's, since that is where behaviour lives. The map is made on the
1266
+ * first registration and handed to every binding already made from the declaration, so all of them go on reading
1267
+ * one map through a slot of their own.
1268
+ */
1269
+ get actions() {
1270
+ const t = this.declaration;
1271
+ if (!t._actions) {
1272
+ const e = new M();
1273
+ t.boundElements.forEach((s) => {
1274
+ s._actions = e;
1275
+ });
1276
+ }
1277
+ return t._actions;
1177
1278
  }
1178
1279
  /**
1179
1280
  * Counts the writes that have changed the value of this element or of anything below it. A container reads it
@@ -1210,6 +1311,27 @@ class V {
1210
1311
  e.markValueChanged(this, t), e.markValidityDirty(this), this.parent?.notifyValueChanged();
1211
1312
  });
1212
1313
  }
1314
+ /**
1315
+ * The last step of a construction: it runs inside the transaction the construction is, with the parameters
1316
+ * applied and the value in place, before the element records what it was built as.
1317
+ *
1318
+ * A subclass overrides it to complete what the element was built with. What it writes here is part of the
1319
+ * construction rather than a change of it: the element announces no ValueChangedAction, and what the hook
1320
+ * leaves is what its eager actions and its validators run over, once. An element whose parameters named no
1321
+ * `originalValue` is baselined on the value the hook left and so starts unchanged; one that named a baseline is
1322
+ * measured against it, as any element is. A `Field` writes
1323
+ * `_value`, which reaches the slot on an element built `enabled: false` as well - the value setter, which a
1324
+ * disabled field refuses, states a change, and this is not one.
1325
+ *
1326
+ * A container completes itself through its members, and a member carries a construction of its own: the write
1327
+ * reaches it as any later one would, so the member announces it and reports itself changed. A member that is to
1328
+ * start unchanged is baselined here as well - `this.fields.x.originalValue = this.fields.x.value`.
1329
+ *
1330
+ * `params` is the parameter object the constructor received, where it received one.
1331
+ */
1332
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1333
+ constructed(t) {
1334
+ }
1213
1335
  /**
1214
1336
  * Re-reads the value that the next ValueChangedAction will report as the one it replaces. A leaf records what
1215
1337
  * it announced at every announcement, so its copy is always current and there is nothing to re-read; a
@@ -1270,8 +1392,8 @@ class V {
1270
1392
  u(() => {
1271
1393
  const s = e === void 0 ? t.value : e, i = this.errors.length > 0;
1272
1394
  i && (this.errors = []), this.touched = !1;
1273
- const a = this.enabled && this.value !== s;
1274
- this.value = s, this.originalValue = this.value, this.validate(!a && i);
1395
+ const r = this.enabled && this.value !== s;
1396
+ this.value = s, this.originalValue = this.value, this.validate(!r && i);
1275
1397
  });
1276
1398
  }
1277
1399
  /** Resets a member. It is what lets a container reach the reset of a child whose class it does not know. */
@@ -1291,8 +1413,8 @@ class V {
1291
1413
  * from repeating while nothing it read has moved.
1292
1414
  */
1293
1415
  get validRead() {
1294
- let t = ht.get(this);
1295
- return t || (t = X(() => this.composeValid()), ht.set(this, t)), t.value;
1416
+ let t = gt.get(this);
1417
+ return t || (t = K(() => this.composeValid()), gt.set(this, t)), t.value;
1296
1418
  }
1297
1419
  /** What validRead computes. A leaf answers over its own errors; a container adds its members. */
1298
1420
  composeValid() {
@@ -1303,21 +1425,27 @@ class V {
1303
1425
  return this.#t.visibility;
1304
1426
  }
1305
1427
  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))
1309
- throw new Error("visibility must be a DisplayMode constant");
1310
- e.touch(this), this.#t.visibility = _.fromAny(i ?? t), this._actions?.trigger(Pt, this, this.#t.visibility, s);
1428
+ const e = this.#t.visibility;
1429
+ t !== e && u((s) => {
1430
+ const i = this.boundActions?.trigger(Pt, this, t, e);
1431
+ if (!(i instanceof P)) {
1432
+ if (!I.isDefined(i ?? t))
1433
+ throw new Error("visibility must be a DisplayMode constant");
1434
+ s.touch(this), this.#t.visibility = I.fromAny(i ?? t), this.boundActions?.trigger(jt, this, this.#t.visibility, e);
1435
+ }
1311
1436
  });
1312
1437
  }
1313
1438
  get enabled() {
1314
1439
  return this.#t.enabled;
1315
1440
  }
1316
1441
  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);
1442
+ const e = this.#t.enabled;
1443
+ t !== e && u((s) => {
1444
+ const i = this.boundActions?.trigger(Rt, this, t, e);
1445
+ if (!(i instanceof P)) {
1446
+ if (!Qt(i ?? t)) throw new Error("Enabled value must be boolean");
1447
+ s.touch(this), this.#t.enabled = i ?? t, this.#t.enabled !== e && this.bumpValueVersion(), this.boundActions?.trigger(_t, this, this.#t.enabled, e);
1448
+ }
1321
1449
  });
1322
1450
  }
1323
1451
  /**
@@ -1330,18 +1458,26 @@ class V {
1330
1458
  get composesValue() {
1331
1459
  return !1;
1332
1460
  }
1461
+ /**
1462
+ * Whether `child` composes its value from members of its own. It is what lets a container tell a nested
1463
+ * container from a leaf without knowing the classes below it, the way `resetChild` reaches a reset it does not
1464
+ * know the shape of.
1465
+ */
1466
+ childComposesValue(t) {
1467
+ return t.composesValue;
1468
+ }
1333
1469
  /**
1334
1470
  * Announces what this element's value became over the transaction. The pair carried is (value now, value at the
1335
1471
  * last announcement), so a value that went A -> B -> A within the transaction says nothing, and the events an
1336
1472
  * operation states rather than an element's state - an item added, an item removed - are emitted first, in the
1337
1473
  * order the operations happened.
1338
1474
  */
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));
1475
+ [xt](t, e, s, i) {
1476
+ if (i?.forEach((l) => this.boundActions?.trigger(l.actionClass, this, l.item, l.index)), !e) return;
1477
+ const r = this.boundActions;
1478
+ if (this.composesValue && !(r?.willTrigger(Ct) || r?.hasEager)) return;
1479
+ const a = this.value, o = this.#e.announcedValue;
1480
+ !s && (this.composesValue ? R(a, o) : a === o) || (t.touch(this), this.#e.announcedValue = a, this.composesValue && r?.triggerEager(this, a, o), r?.trigger(T, this, a, o));
1345
1481
  }
1346
1482
  /**
1347
1483
  * Forms the verdict this element ends the transaction with and announces a transition of it. The container is
@@ -1350,16 +1486,16 @@ class V {
1350
1486
  * asynchronous validator, an error pushed in by hand - is what makes the container re-form its own. The
1351
1487
  * transaction settles the deepest element first, so a container is reached only once its members have decided.
1352
1488
  */
1353
- [xt](t) {
1489
+ [At](t) {
1354
1490
  const e = this.#e.valid, s = this.countedValid;
1355
1491
  if (s === e) return;
1356
1492
  t.touch(this), this.#e.valid = s;
1357
- const i = this.parent;
1358
- i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this._actions?.trigger(Ft, this, s, e);
1493
+ const i = this.container;
1494
+ i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(Ft, this, s, e);
1359
1495
  }
1360
1496
  validate(t = !1) {
1361
1497
  u((e) => {
1362
- t && this._actions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1498
+ t && this.boundActions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1363
1499
  });
1364
1500
  }
1365
1501
  get valid() {
@@ -1369,7 +1505,7 @@ class V {
1369
1505
  return this.value;
1370
1506
  }
1371
1507
  get isChanged() {
1372
- return !Q(this.value, this.originalValue);
1508
+ return !R(this.value, this.originalValue);
1373
1509
  }
1374
1510
  /**
1375
1511
  * Brings a fresh element into the state a binding of `source` is in: it records what it was declared as, takes
@@ -1381,10 +1517,12 @@ class V {
1381
1517
  */
1382
1518
  boundFrom(t, e, s, i) {
1383
1519
  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));
1520
+ const r = { ...t.extra, ...i && this.extendedOf(i) };
1521
+ F(r) || this.setExtendedValues(r);
1522
+ const a = this.declaration;
1523
+ a.noteBinding(this);
1524
+ const o = a._actions;
1525
+ o && (this._actions = o, o.bindTo(this), o.triggerEager(this, e, s));
1388
1526
  }
1389
1527
  /**
1390
1528
  * Registers the actions a constructor received in its parameters: registration without the eager trigger,
@@ -1398,7 +1536,7 @@ class V {
1398
1536
  }
1399
1537
  registerAction(t) {
1400
1538
  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);
1539
+ e.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t), this.registered(e, t);
1402
1540
  }), this;
1403
1541
  }
1404
1542
  /**
@@ -1409,7 +1547,7 @@ class V {
1409
1547
  */
1410
1548
  registerActionBefore(t, e) {
1411
1549
  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);
1550
+ s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t, e), this.registered(s, t);
1413
1551
  }), this;
1414
1552
  }
1415
1553
  /**
@@ -1421,10 +1559,13 @@ class V {
1421
1559
  unregisterAction(t) {
1422
1560
  let e = !1;
1423
1561
  return u((s) => {
1424
- const i = this._actions;
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)));
1562
+ const i = this.boundActions;
1563
+ if (!i || (e = i.unregister(t), !e)) return;
1564
+ s.touch(this), t instanceof f && this.#t.validationEpoch++;
1565
+ const r = this.boundElements;
1566
+ s.whenRolledBack(() => {
1567
+ i.register(t), r.forEach((a) => t.boundToBinding(a));
1568
+ }), r.forEach((a) => t.unregisterFrom(a));
1428
1569
  }), e;
1429
1570
  }
1430
1571
  /**
@@ -1432,12 +1573,16 @@ class V {
1432
1573
  * registration is not one of the state slots the snapshot covers, so it hands its own undo in.
1433
1574
  */
1434
1575
  registered(t, e) {
1435
- e.boundToBinding(this), t.whenRolledBack(() => {
1436
- this._actions?.unregister(e) && e.unregisterFrom(this);
1576
+ const s = this.boundElements;
1577
+ s.forEach((i) => {
1578
+ e.boundToBinding(i), e.eager && this.actions.triggerEagerFor(e.classIdentifier, i, i.value, i.originalValue);
1579
+ }), t.whenRolledBack(() => {
1580
+ this.boundActions?.unregister(e) && s.forEach((i) => e.unregisterFrom(i));
1437
1581
  });
1438
1582
  }
1439
1583
  triggerAction(t, ...e) {
1440
- return this._actions ? this._actions.trigger(t, this, ...e) : null;
1584
+ const s = this.boundActions;
1585
+ return s ? s.trigger(t, this, ...e) : null;
1441
1586
  }
1442
1587
  /**
1443
1588
  * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
@@ -1450,19 +1595,23 @@ class V {
1450
1595
  clearValidators() {
1451
1596
  u((t) => {
1452
1597
  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);
1457
- }), s.unregisterFrom(this);
1458
- }), this.errors = [], this.validate();
1598
+ const e = this.boundActions;
1599
+ if (e) {
1600
+ const s = this.boundElements;
1601
+ e.validators.forEach((i) => {
1602
+ e.unregister(i), t.whenRolledBack(() => {
1603
+ e.register(i), s.forEach((r) => i.boundToBinding(r));
1604
+ }), s.forEach((r) => i.unregisterFrom(r));
1605
+ });
1606
+ }
1607
+ this.errors = [], this.validate();
1459
1608
  });
1460
1609
  }
1461
1610
  }
1462
- function de(n, t) {
1611
+ function me(n, t) {
1463
1612
  return n ? !t : t;
1464
1613
  }
1465
- class v {
1614
+ class w {
1466
1615
  operand1;
1467
1616
  operator;
1468
1617
  operand2;
@@ -1482,9 +1631,8 @@ class v {
1482
1631
  `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
1632
  );
1484
1633
  }
1485
- /** @throws TypeError where an operand the statement reads is undefined or a function. */
1486
1634
  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;
1635
+ w.validateOperand(t, 1), e !== c.NOT && w.validateOperand(s, 2), this.operand1 = t, this.operator = e, this.operand2 = s;
1488
1636
  }
1489
1637
  /**
1490
1638
  * The value an operand contributes. A field operand names a field of the record the statement is evaluated in:
@@ -1493,25 +1641,25 @@ class v {
1493
1641
  * hold the field yet contributes undefined, which is what a half-built row answers with.
1494
1642
  */
1495
1643
  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;
1644
+ if (t instanceof w) return t.evaluate(e);
1645
+ if (t instanceof y) {
1646
+ const s = e ? tt(t, e) : t;
1499
1647
  return s ? h(s.value) : void 0;
1500
1648
  }
1501
1649
  return t;
1502
1650
  }
1503
1651
  get operand1Value() {
1504
- return v.valueOf(this.operand1);
1652
+ return w.valueOf(this.operand1);
1505
1653
  }
1506
1654
  get operand2Value() {
1507
- return v.valueOf(this.operand2);
1655
+ return w.valueOf(this.operand2);
1508
1656
  }
1509
1657
  /**
1510
1658
  * The result of the statement, over the record `scope` belongs to where one is given and over the fields the
1511
1659
  * statement was built from where it is not.
1512
1660
  */
1513
1661
  evaluate(t) {
1514
- const e = v.valueOf(this.operand1, t), s = v.valueOf(this.operand2, t);
1662
+ const e = w.valueOf(this.operand1, t), s = w.valueOf(this.operand2, t);
1515
1663
  switch (this.operator) {
1516
1664
  // logical operators
1517
1665
  // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
@@ -1527,7 +1675,7 @@ class v {
1527
1675
  case c.NOR:
1528
1676
  return !(e || s);
1529
1677
  case c.XOR:
1530
- return de(!!e, !!s);
1678
+ return me(!!e, !!s);
1531
1679
  case c.NOT:
1532
1680
  return !e;
1533
1681
  // comparison operators
@@ -1562,54 +1710,54 @@ class v {
1562
1710
  collectFields() {
1563
1711
  const t = /* @__PURE__ */ new Set();
1564
1712
  function e(s) {
1565
- s instanceof V ? t.add(s) : s instanceof v && s.collectFields().forEach((a) => t.add(a));
1713
+ s instanceof y ? t.add(s) : s instanceof w && s.collectFields().forEach((r) => t.add(r));
1566
1714
  }
1567
1715
  return e(this.operand1), e(this.operand2), t;
1568
1716
  }
1569
1717
  }
1570
- const ge = /* @__PURE__ */ Symbol("ExecuteAction");
1571
- class jt extends p {
1718
+ const be = /* @__PURE__ */ Symbol("ExecuteAction");
1719
+ class Nt extends m {
1572
1720
  constructor(t) {
1573
1721
  super(t);
1574
1722
  }
1575
1723
  static get classIdentifier() {
1576
- return ge;
1724
+ return be;
1577
1725
  }
1578
1726
  execute(t, e, s) {
1579
1727
  return super.execute(t, e, s);
1580
1728
  }
1581
1729
  }
1582
- const fe = /* @__PURE__ */ Symbol("ListItemAddedAction");
1583
- class K extends p {
1730
+ const ve = /* @__PURE__ */ Symbol("ListItemAddedAction");
1731
+ class Y extends m {
1584
1732
  constructor(t) {
1585
1733
  super(t);
1586
1734
  }
1587
1735
  static get classIdentifier() {
1588
- return fe;
1736
+ return ve;
1589
1737
  }
1590
1738
  execute(t, e, s, i) {
1591
1739
  return super.execute(t, e, s, i);
1592
1740
  }
1593
1741
  }
1594
- const pe = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1595
- class Nt extends p {
1742
+ const we = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1743
+ class Bt extends m {
1596
1744
  constructor(t) {
1597
1745
  super(t);
1598
1746
  }
1599
1747
  static get classIdentifier() {
1600
- return pe;
1748
+ return we;
1601
1749
  }
1602
1750
  execute(t, e, s, i) {
1603
1751
  return super.execute(t, e, s, i);
1604
1752
  }
1605
1753
  }
1606
- const me = Object.freeze({});
1607
- function kt() {
1754
+ const Ve = Object.freeze({});
1755
+ function Dt() {
1608
1756
  return {
1609
1757
  originalValue: void 0,
1610
1758
  announcedValue: void 0,
1611
1759
  errors: [],
1612
- visibility: _.FULL,
1760
+ visibility: I.FULL,
1613
1761
  enabled: !0,
1614
1762
  valueVersion: 0,
1615
1763
  validatingCount: 0,
@@ -1618,29 +1766,32 @@ function kt() {
1618
1766
  fieldName: void 0,
1619
1767
  validationEpoch: 0,
1620
1768
  declaration: void 0,
1621
- extra: me,
1769
+ extra: Ve,
1622
1770
  valid: !0,
1623
1771
  invalidChildren: 0
1624
1772
  };
1625
1773
  }
1626
- function ve() {
1627
- return { ...kt(), value: void 0, touched: !1 };
1774
+ function ye() {
1775
+ return { ...Dt(), value: void 0, touched: !1 };
1628
1776
  }
1629
- function Bt() {
1777
+ function Lt() {
1630
1778
  return {
1631
- ...kt(),
1779
+ ...Dt(),
1632
1780
  announcedValue: null,
1633
1781
  cachedValue: null,
1634
1782
  cachedValueVersion: -1
1635
1783
  };
1636
1784
  }
1637
- function be() {
1638
- return { ...Bt(), fieldNames: [] };
1785
+ function Ee() {
1786
+ return { ...Lt(), fieldNames: [] };
1639
1787
  }
1640
- function we() {
1641
- return { ...Bt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
1788
+ function Ce() {
1789
+ return { ...Lt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
1642
1790
  }
1643
- class M extends V {
1791
+ class et extends y {
1792
+ get [Symbol.toStringTag]() {
1793
+ return "Field";
1794
+ }
1644
1795
  get state() {
1645
1796
  return super.state;
1646
1797
  }
@@ -1655,7 +1806,7 @@ class M extends V {
1655
1806
  this.state.value = t;
1656
1807
  }
1657
1808
  constructor(t) {
1658
- super(ve()), this.init(t);
1809
+ super(ye()), this.init(t);
1659
1810
  }
1660
1811
  /**
1661
1812
  * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
@@ -1669,10 +1820,10 @@ class M extends V {
1669
1820
  init(t) {
1670
1821
  u(() => {
1671
1822
  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);
1823
+ const { value: e, validators: s, actions: i, ...r } = t;
1824
+ this.registerInitialActions([...s || [], ...i || []]), this.assignParams(r), this._value = e !== void 0 ? e : this.originalValue;
1674
1825
  }
1675
- this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1826
+ this.constructed(t), this.originalValue === void 0 && (this.originalValue = this._value), this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
1676
1827
  });
1677
1828
  }
1678
1829
  get value() {
@@ -1681,9 +1832,17 @@ class M extends V {
1681
1832
  set value(t) {
1682
1833
  const e = this._value;
1683
1834
  !this.enabled || e === t || u((s) => {
1684
- s.touch(this), this._value = t, this.bumpValueVersion(), this._actions?.triggerEager(this, t, e), this.propagateValueChanged();
1835
+ s.touch(this), this._value = t, this.bumpValueVersion(), this.boundActions?.triggerEager(this, t, e), this.propagateValueChanged();
1685
1836
  });
1686
1837
  }
1838
+ /**
1839
+ * The container that holds this field. A `List` holds rows and a row is a `Group`, so a field is never a `List`'s
1840
+ * child and the link is a `Group` wherever there is one: `field.parent?.fields.other` is the sibling lookup, and
1841
+ * it is typed here.
1842
+ */
1843
+ get parent() {
1844
+ return super.parent;
1845
+ }
1687
1846
  get touched() {
1688
1847
  return this.state.touched;
1689
1848
  }
@@ -1701,24 +1860,24 @@ class M extends V {
1701
1860
  return i.boundFrom(this, i.value, i.originalValue, e), i;
1702
1861
  }
1703
1862
  }
1704
- const Ve = new M({ value: "EmptyField" }).registerAction(
1705
- new S(() => {
1706
- console.warn("Working with EmptyField! This should not happen");
1707
- })
1708
- ), ft = /* @__PURE__ */ new WeakMap();
1709
- function H(n, t) {
1710
- return n?.label == null && n?.icon == null ? t : n;
1863
+ const mt = /* @__PURE__ */ new WeakMap();
1864
+ function bt(n) {
1865
+ if (n != null)
1866
+ return Object.values(n).some((t) => t != null) ? n : void 0;
1711
1867
  }
1712
- class ye extends M {
1868
+ class Se extends et {
1869
+ get [Symbol.toStringTag]() {
1870
+ return "Action";
1871
+ }
1713
1872
  init(t) {
1714
1873
  u(() => {
1715
1874
  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);
1875
+ const { value: e, originalValue: s, validators: i, actions: r, ...a } = t;
1876
+ this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a);
1877
+ const o = bt(e), l = bt(s);
1878
+ o ? this._value = o : l && (this._value = { ...l }), l && (this.originalValue = Object.freeze({ ...l }));
1720
1879
  }
1721
- this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1880
+ this.constructed(t), this.originalValue === void 0 && (this.originalValue = this._value), this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
1722
1881
  });
1723
1882
  }
1724
1883
  /**
@@ -1752,8 +1911,8 @@ class ye extends M {
1752
1911
  }
1753
1912
  /** the counter behind `busy`, allocated for this action the first time it is asked for */
1754
1913
  get busyRuns() {
1755
- let t = ft.get(this);
1756
- return t || (t = Wt(0), ft.set(this, t)), t;
1914
+ let t = mt.get(this);
1915
+ return t || (t = Wt(0), mt.set(this, t)), t;
1757
1916
  }
1758
1917
  /** true from the moment execute() is called until the handler it ran has settled, however it settles */
1759
1918
  get busy() {
@@ -1773,20 +1932,20 @@ class ye extends M {
1773
1932
  const e = this.busyRuns;
1774
1933
  e.value++;
1775
1934
  try {
1776
- return await this.triggerAction(jt, t);
1935
+ return await this.triggerAction(Nt, t);
1777
1936
  } finally {
1778
1937
  e.value--;
1779
1938
  }
1780
1939
  }
1781
1940
  }
1782
- const Ce = /* @__PURE__ */ qt({
1941
+ const xe = /* @__PURE__ */ qt({
1783
1942
  __name: "messages-widget",
1784
1943
  props: {
1785
1944
  message: {},
1786
1945
  classes: {}
1787
1946
  },
1788
1947
  setup(n) {
1789
- const t = n, e = at("vue-markdown"), s = /* @__PURE__ */ new Set([
1948
+ const t = n, e = lt("vue-markdown"), s = /* @__PURE__ */ new Set([
1790
1949
  "div",
1791
1950
  "span",
1792
1951
  "p",
@@ -1843,23 +2002,23 @@ const Ce = /* @__PURE__ */ qt({
1843
2002
  "dt",
1844
2003
  "dd"
1845
2004
  ]), i = () => {
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) {
2005
+ if (typeof t.message == "string") return k("span", { class: t.classes }, t.message);
2006
+ const r = [];
2007
+ return t.message.forEach((a) => {
2008
+ switch (a.componentName) {
1850
2009
  case "template":
1851
- a.push(F("div", { class: [t.classes, r.extraClasses] }, r.componentBody));
2010
+ r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBody));
1852
2011
  break;
1853
2012
  case "vue-markdown":
1854
2013
  if (typeof e == "string")
1855
2014
  console.warn(
1856
2015
  "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
1857
- ), a.push(F("div", { class: [t.classes, r.extraClasses] }, r.componentBindings.source));
2016
+ ), r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBindings.source));
1858
2017
  else {
1859
- const o = r.componentBindings;
1860
- a.push(
1861
- F(e, {
1862
- class: [t.classes, r.extraClasses, "df-messages-widget-markdown"],
2018
+ const o = a.componentBindings;
2019
+ r.push(
2020
+ k(e, {
2021
+ class: [t.classes, a.extraClasses, "df-messages-widget-markdown"],
1863
2022
  source: o.source,
1864
2023
  options: o.options,
1865
2024
  plugins: o.plugins
@@ -1868,23 +2027,23 @@ const Ce = /* @__PURE__ */ qt({
1868
2027
  }
1869
2028
  break;
1870
2029
  default:
1871
- a.push(
1872
- F(
1873
- s.has(r.componentName.toLowerCase()) ? r.componentName : at(r.componentName),
2030
+ r.push(
2031
+ k(
2032
+ s.has(a.componentName.toLowerCase()) ? a.componentName : lt(a.componentName),
1874
2033
  {
1875
- class: [t.classes, r.extraClasses],
1876
- ...r.componentBindings,
1877
- ...r.componentBody ? { innerHTML: r.componentBody } : {}
2034
+ class: [t.classes, a.extraClasses],
2035
+ ...a.componentBindings,
2036
+ ...a.componentBody ? { innerHTML: a.componentBody } : {}
1878
2037
  }
1879
2038
  )
1880
2039
  );
1881
2040
  break;
1882
2041
  }
1883
- }), a;
2042
+ }), r;
1884
2043
  };
1885
- return (a, r) => (zt(), Ht(i));
2044
+ return (r, a) => (zt(), Ht(i));
1886
2045
  }
1887
- }), pt = /* @__PURE__ */ new WeakMap(), Ee = (n) => ({
2046
+ }), vt = /* @__PURE__ */ new WeakMap(), Ae = (n) => ({
1888
2047
  get(t, e, s) {
1889
2048
  return n(), Reflect.get(t, e, s);
1890
2049
  },
@@ -1907,7 +2066,10 @@ const Ce = /* @__PURE__ */ qt({
1907
2066
  throw new TypeError(`fields.${String(e)} cannot be deleted: use removeField() to take a member out`);
1908
2067
  }
1909
2068
  });
1910
- class d extends V {
2069
+ class d extends y {
2070
+ get [Symbol.toStringTag]() {
2071
+ return "Group";
2072
+ }
1911
2073
  get state() {
1912
2074
  return super.state;
1913
2075
  }
@@ -1916,15 +2078,15 @@ class d extends V {
1916
2078
  }
1917
2079
  _fields;
1918
2080
  constructor(t, e) {
1919
- if (super(be()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
2081
+ if (super(Ee()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
1920
2082
  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);
2083
+ if (Object.entries(t).forEach(([i, r]) => this.addField(i, r)), e) {
2084
+ const { value: i, validators: r, actions: a, ...o } = e;
2085
+ this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1924
2086
  }
1925
- this.completeRecords();
2087
+ this.completeRecords(), this.constructed(e);
1926
2088
  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();
2089
+ this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this.boundActions?.triggerEager(this, s, this.originalValue), this.validate();
1928
2090
  });
1929
2091
  }
1930
2092
  /**
@@ -1992,15 +2154,15 @@ class d extends V {
1992
2154
  }
1993
2155
  static isValidFields(t) {
1994
2156
  function e(s) {
1995
- return s instanceof V;
2157
+ return s instanceof y;
1996
2158
  }
1997
2159
  return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
1998
2160
  }
1999
2161
  static createFromFormData(t) {
2000
- if (t instanceof V)
2162
+ if (t instanceof y)
2001
2163
  throw new Error("data is already a Form structure, should be a simple object");
2002
2164
  return new d(
2003
- t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new M({ value: s })]))
2165
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new et({ value: s })]))
2004
2166
  );
2005
2167
  }
2006
2168
  field(t) {
@@ -2015,11 +2177,11 @@ class d extends V {
2015
2177
  * re-renders when a field is added or removed; what a member itself holds is tracked by that member.
2016
2178
  */
2017
2179
  get fields() {
2018
- let t = pt.get(this);
2180
+ let t = vt.get(this);
2019
2181
  return t || (t = new Proxy(
2020
2182
  this._fields,
2021
- Ee(() => this.state.fieldNames.length)
2022
- ), pt.set(this, t)), t;
2183
+ Ae(() => this.state.fieldNames.length)
2184
+ ), vt.set(this, t)), t;
2023
2185
  }
2024
2186
  get members() {
2025
2187
  return this.raw.fieldNames.map((t) => this._fields[t]);
@@ -2028,11 +2190,11 @@ class d extends V {
2028
2190
  const t = this.valueVersion;
2029
2191
  if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
2030
2192
  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);
2193
+ Object.entries(this._fields).forEach(([i, r]) => {
2194
+ const a = r.value;
2195
+ (r.enabled || this.childComposesValue(r) && !F(a)) && (e[i] = a);
2034
2196
  });
2035
- const s = R(e) ? null : Object.freeze({ ...e });
2197
+ const s = F(e) ? null : Object.freeze({ ...e });
2036
2198
  return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
2037
2199
  }
2038
2200
  /**
@@ -2060,12 +2222,12 @@ class d extends V {
2060
2222
  resetTo(t, e) {
2061
2223
  const s = t;
2062
2224
  u((i) => {
2063
- i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([r, o]) => {
2225
+ i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([a, o]) => {
2064
2226
  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);
2227
+ e === null ? l = null : e !== void 0 && Object.hasOwn(e, a) && (l = e[a]), this.resetChild(o, s.field(a) ?? o, l);
2066
2228
  });
2067
- const a = this.value;
2068
- this.raw.announcedValue = a, this.originalValue = d.baseline(a), super.validate(!0);
2229
+ const r = this.value;
2230
+ this.raw.announcedValue = r, this.originalValue = d.baseline(r), super.validate(!0);
2069
2231
  });
2070
2232
  }
2071
2233
  get touched() {
@@ -2119,19 +2281,32 @@ class d extends V {
2119
2281
  t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
2120
2282
  });
2121
2283
  }
2284
+ /**
2285
+ * States that `res` was built from the members handed to it. A subclass whose constructor takes something other
2286
+ * than `(fields, params)` - one that composes its own members and passes them to super - never sees them, and
2287
+ * would answer with a binding carrying the declaration's data instead of the record's. That is a difference no
2288
+ * reader would find, so it is refused here rather than returned.
2289
+ */
2290
+ static assertTookFields(t, e, s) {
2291
+ const i = Object.entries(e), r = t.raw.fieldNames;
2292
+ if (!(i.length === r.length && i.every(([a, o]) => t._fields[a] === o)))
2293
+ throw new TypeError(
2294
+ `${s}.bind() built an element that did not take the members it was given, so the binding would carry the declaration's data. A subclass whose constructor does not take (fields, params) has to override bind() and construct itself.`
2295
+ );
2296
+ }
2122
2297
  bind(t, e) {
2123
2298
  const s = /* @__PURE__ */ Object.create(null);
2124
- Object.entries(this._fields).forEach(([a, r]) => {
2125
- s[a] = r.bind();
2299
+ Object.entries(this._fields).forEach(([a, o]) => {
2300
+ s[a] = o.bind();
2126
2301
  });
2127
- const i = new d(s, {
2302
+ const i = this.constructor, r = new i(s, {
2128
2303
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2129
2304
  value: t !== void 0 ? t : this.value,
2130
2305
  ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2131
2306
  enabled: e?.enabled ?? this.enabled,
2132
2307
  visibility: e?.visibility ?? this.visibility
2133
2308
  });
2134
- return i.boundFrom(this, i.raw.announcedValue, i.originalValue, e), i;
2309
+ return d.assertTookFields(r, s, this.constructor.name), r.boundFrom(this, r.raw.announcedValue, r.originalValue, e), r;
2135
2310
  }
2136
2311
  /**
2137
2312
  * A record need not name every member: a key it leaves out is taken from the declaration, the same way a member
@@ -2141,7 +2316,10 @@ class d extends V {
2141
2316
  return super.rebind(t);
2142
2317
  }
2143
2318
  }
2144
- class A extends V {
2319
+ class _ extends y {
2320
+ get [Symbol.toStringTag]() {
2321
+ return "List";
2322
+ }
2145
2323
  get state() {
2146
2324
  return super.state;
2147
2325
  }
@@ -2150,12 +2328,12 @@ class A extends V {
2150
2328
  }
2151
2329
  _itemTemplate;
2152
2330
  constructor(t, e) {
2153
- super(we()), this._itemTemplate = t, u(() => {
2331
+ super(Ce()), this._itemTemplate = t, u(() => {
2154
2332
  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);
2333
+ const { value: s, validators: i, actions: r, ...a } = e;
2334
+ this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a), s !== void 0 ? this.setValueInternal(s) : this.originalValue !== void 0 && this.setValueInternal(this.originalValue);
2157
2335
  }
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();
2336
+ this.constructed(e), this.originalValue === void 0 && (this.originalValue = _.baseline(this.value)), this.raw.announcedValue = this.value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
2159
2337
  });
2160
2338
  }
2161
2339
  /** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */
@@ -2188,30 +2366,32 @@ class A extends V {
2188
2366
  /** True where `next` is a different set of rows than `previous`: another count, or another row at a position. */
2189
2367
  static rowsDiffer(t, e) {
2190
2368
  const s = t ?? [], i = e ?? [];
2191
- return s.length !== i.length || s.some((a, r) => a !== i[r]);
2369
+ return s.length !== i.length || s.some((r, a) => r !== i[a]);
2192
2370
  }
2193
2371
  setValueInternal(t) {
2372
+ if (t != null && !Array.isArray(t))
2373
+ throw new TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
2194
2374
  u((e) => {
2195
2375
  e.touch(this);
2196
2376
  const s = this.raw.rows;
2197
2377
  if (t == null)
2198
2378
  this.releaseRows(), this.state.rows = null;
2199
- else if (Array.isArray(t)) {
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));
2379
+ else {
2380
+ const i = this.state.rows ?? [], r = new Array(t.length);
2381
+ for (let a = 0; a < t.length; a++) {
2382
+ const o = t[a], l = i[a];
2383
+ l && this._itemTemplate && !(o instanceof d) ? (this.resetChild(l, this._itemTemplate, o), r[a] = l) : (l && this.releaseChild(l), r[a] = this.processSetValueItem(o));
2204
2384
  }
2205
- for (let r = t.length; r < i.length; r++) this.releaseChild(i[r]);
2206
- this.state.rows = a;
2385
+ for (let a = t.length; a < i.length; a++) this.releaseChild(i[a]);
2386
+ this.state.rows = r;
2207
2387
  }
2208
- A.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
2388
+ _.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
2209
2389
  });
2210
2390
  }
2211
2391
  get value() {
2212
2392
  const t = this.valueVersion;
2213
2393
  if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
2214
- const e = this.state.rows?.map((i) => i.value), s = R(e) ? null : Object.freeze(e);
2394
+ const e = this.state.rows?.map((i) => i.value), s = F(e) ? null : Object.freeze(e);
2215
2395
  return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
2216
2396
  }
2217
2397
  set value(t) {
@@ -2227,7 +2407,7 @@ class A extends V {
2227
2407
  u((s) => {
2228
2408
  s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
2229
2409
  const i = this.value;
2230
- this.raw.announcedValue = i, this.originalValue = A.baseline(i), super.validate(!0);
2410
+ this.raw.announcedValue = i, this.originalValue = _.baseline(i), super.validate(!0);
2231
2411
  });
2232
2412
  }
2233
2413
  get touched() {
@@ -2241,14 +2421,18 @@ class A extends V {
2241
2421
  });
2242
2422
  }
2243
2423
  bind(t, e) {
2244
- const s = new A(this._itemTemplate?.bind(), {
2424
+ const s = this._itemTemplate?.bind(), i = this.constructor, r = new i(s, {
2245
2425
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2246
2426
  value: [...(t !== void 0 ? t : this.value) ?? []],
2247
2427
  ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2248
2428
  enabled: e?.enabled ?? this.enabled,
2249
2429
  visibility: e?.visibility ?? this.visibility
2250
2430
  });
2251
- return s.boundFrom(this, s.value, s.originalValue, e), s;
2431
+ if (r._itemTemplate !== s)
2432
+ throw new TypeError(
2433
+ `${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`
2434
+ );
2435
+ return r.boundFrom(this, r.value, r.originalValue, e), r;
2252
2436
  }
2253
2437
  /**
2254
2438
  * Records that a row changed its value, so that the transaction in progress works out at commit what this
@@ -2331,18 +2515,18 @@ class A extends V {
2331
2515
  if (this.state.rows == null || t < 0 || this.state.rows.length <= t) return;
2332
2516
  s.touch(this);
2333
2517
  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));
2518
+ i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), e = i, s.recordStructural(this, { actionClass: Bt, item: e, index: t }), this.propagateValueChanged(!0));
2335
2519
  }), e;
2336
2520
  }
2337
2521
  insert(t, e) {
2338
2522
  let s = 0;
2339
2523
  return u((i) => {
2340
2524
  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 });
2525
+ const a = this.createPaddingItem(), o = this.state.rows.push(a) - 1;
2526
+ this.bumpValueVersion(), i.recordStructural(this, { actionClass: Y, item: a, index: o });
2343
2527
  }
2344
- const a = this.processSetValueItem(t);
2345
- this.state.rows.splice(s, 0, a), i.recordStructural(this, { actionClass: K, item: a, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2528
+ const r = this.processSetValueItem(t);
2529
+ this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass: Y, item: r, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2346
2530
  }), s;
2347
2531
  }
2348
2532
  /** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
@@ -2356,14 +2540,14 @@ class A extends V {
2356
2540
  });
2357
2541
  }
2358
2542
  }
2359
- class xe extends g {
2543
+ class Ie extends f {
2360
2544
  constructor(t, e, s) {
2361
- const i = (a, r, o) => {
2362
- this.comparisonState(o).oldValue = r;
2545
+ const i = (r, a, o) => {
2546
+ this.comparisonState(o).oldValue = a;
2363
2547
  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 }),
2548
+ return l ? (this.listenOn(l), this.isValidComparison(h(r), h(l.value)) ? null : [
2549
+ new g(
2550
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, otherField: l }),
2367
2551
  "",
2368
2552
  "compare-to"
2369
2553
  )
@@ -2395,7 +2579,7 @@ class xe extends g {
2395
2579
  /** The field `field` is compared against, within the record `field` belongs to. */
2396
2580
  resolve(t) {
2397
2581
  const e = this.otherField;
2398
- return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? se(e, t) : G(e, x(t));
2582
+ return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) : tt(e, V(t));
2399
2583
  }
2400
2584
  /**
2401
2585
  * Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
@@ -2404,11 +2588,11 @@ class xe extends g {
2404
2588
  */
2405
2589
  listenOn(t) {
2406
2590
  this.listening.has(t) || this.listening.has(t.declaration) || (this.listening.add(t), t.registerAction(
2407
- new S((e, s, i, a) => {
2408
- s(e, i, a);
2409
- const r = x(e);
2591
+ new T((e, s, i, r) => {
2592
+ s(e, i, r);
2593
+ const a = V(e);
2410
2594
  this.declarations.forEach(
2411
- (o) => Tt(o, r).forEach((l) => {
2595
+ (o) => kt(o, a).forEach((l) => {
2412
2596
  this.registrations.has(l) && this.execute(l, () => null, l.value, this.comparisonState(l).oldValue);
2413
2597
  })
2414
2598
  );
@@ -2428,59 +2612,59 @@ class xe extends g {
2428
2612
  super.unregisterFrom(t), this.registrations.delete(t);
2429
2613
  }
2430
2614
  }
2431
- class Se extends g {
2615
+ class Te extends f {
2432
2616
  constructor(t, e) {
2433
- const s = e || m("Must be one of [**{allowedAsText}**]"), i = () => {
2617
+ const s = e || b("Must be one of [**{allowedAsText}**]"), i = () => {
2434
2618
  const o = h(t);
2435
2619
  return typeof o == "function" ? o() : o;
2436
- }, a = (o) => {
2620
+ }, r = (o) => {
2437
2621
  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(
2622
+ return l.length <= 60 ? l : Xt(l, { length: 40, separator: ", ", omission: `... (${o.length} items total)` });
2623
+ }, a = (o, l, v) => {
2624
+ const p = i();
2625
+ return p.includes(h(o)) ? null : [
2626
+ new g(
2443
2627
  this.replacePlaceholders(s, {
2444
2628
  newValue: o,
2445
2629
  oldValue: l,
2446
- field: w,
2447
- allowedValues: b,
2448
- allowedAsText: a(b)
2630
+ field: v,
2631
+ allowedValues: p,
2632
+ allowedAsText: r(p)
2449
2633
  }),
2450
2634
  "",
2451
2635
  "in-allowed-values"
2452
2636
  )
2453
2637
  ];
2454
2638
  };
2455
- super(r);
2639
+ super(a);
2456
2640
  }
2457
2641
  }
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;
2642
+ function Oe(n) {
2643
+ return n == null ? 0 : yt(n) || C(n) ? n.length : Et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2460
2644
  }
2461
- function mt(n) {
2462
- return typeof n == "object" && n !== null && !wt(n) && !(n instanceof String) && !("componentName" in n);
2645
+ function wt(n) {
2646
+ return typeof n == "object" && n !== null && !Vt(n) && !(n instanceof String) && !("componentName" in n);
2463
2647
  }
2464
- class Ae extends g {
2648
+ class ke extends f {
2465
2649
  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 }),
2650
+ const s = wt(t) ? void 0 : t, i = (wt(t) ? t : e)?.trim ?? !0, r = s || b("Please enter a value"), a = (o, l, v) => {
2651
+ const p = h(o);
2652
+ return Oe(i && C(p) ? p.trim() : p) === 0 ? [
2653
+ new g(
2654
+ this.replacePlaceholders(r, { newValue: o, oldValue: l, field: v }),
2471
2655
  "",
2472
2656
  "required"
2473
2657
  )
2474
2658
  ] : null;
2475
2659
  };
2476
- super(r);
2660
+ super(a);
2477
2661
  }
2478
2662
  }
2479
- class Te extends g {
2663
+ class Re extends f {
2480
2664
  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 }),
2665
+ const s = e || b("Value must be larger or equal to **{minValue}**"), i = (r, a, o) => r < t || r === void 0 ? [
2666
+ new g(
2667
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minValue: t }),
2484
2668
  "",
2485
2669
  "min"
2486
2670
  )
@@ -2488,11 +2672,11 @@ class Te extends g {
2488
2672
  super(i);
2489
2673
  }
2490
2674
  }
2491
- class _e extends g {
2675
+ class _e extends f {
2492
2676
  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 }),
2677
+ const s = e || b("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > t || r === void 0 ? [
2678
+ new g(
2679
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxValue: t }),
2496
2680
  "",
2497
2681
  "max"
2498
2682
  )
@@ -2500,26 +2684,26 @@ class _e extends g {
2500
2684
  super(i);
2501
2685
  }
2502
2686
  }
2503
- class Oe extends g {
2687
+ class Fe extends f {
2504
2688
  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 }),
2689
+ const i = s || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, l) => a < t || a > e || a === void 0 ? [
2690
+ new g(
2691
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minValue: t, maxValue: e }),
2508
2692
  "",
2509
2693
  "range"
2510
2694
  )
2511
2695
  ] : null;
2512
- super(a);
2696
+ super(r);
2513
2697
  }
2514
2698
  }
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;
2699
+ function st(n) {
2700
+ return n == null ? 0 : yt(n) || C(n) ? n.length : Et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2517
2701
  }
2518
- class Fe extends g {
2702
+ class Pe extends f {
2519
2703
  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 }),
2704
+ const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => st(r) < t ? [
2705
+ new g(
2706
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: t }),
2523
2707
  "",
2524
2708
  "min-length"
2525
2709
  )
@@ -2527,11 +2711,11 @@ class Fe extends g {
2527
2711
  super(i);
2528
2712
  }
2529
2713
  }
2530
- class Re extends g {
2714
+ class je extends f {
2531
2715
  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 }),
2716
+ const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => st(r) > t ? [
2717
+ new g(
2718
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: t }),
2535
2719
  "",
2536
2720
  "max-length"
2537
2721
  )
@@ -2539,26 +2723,26 @@ class Re extends g {
2539
2723
  super(i);
2540
2724
  }
2541
2725
  }
2542
- class Pe extends g {
2726
+ class Ne extends f {
2543
2727
  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 }),
2728
+ const i = s || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, l) => {
2729
+ const v = st(a);
2730
+ return v < t || v > e ? [
2731
+ new g(
2732
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minLength: t, maxLength: e }),
2549
2733
  "",
2550
2734
  "range-length"
2551
2735
  )
2552
2736
  ] : null;
2553
2737
  };
2554
- super(a);
2738
+ super(r);
2555
2739
  }
2556
2740
  }
2557
- class je extends g {
2741
+ class Be extends f {
2558
2742
  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 }),
2743
+ const s = e || b('Value must match pattern "**{pattern}**"'), i = (r, a, o) => t.test(String(h(r))) ? null : [
2744
+ new g(
2745
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, pattern: t }),
2562
2746
  "",
2563
2747
  "pattern"
2564
2748
  )
@@ -2566,100 +2750,98 @@ class je extends g {
2566
2750
  super(i);
2567
2751
  }
2568
2752
  }
2569
- const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2753
+ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2570
2754
  __proto__: null,
2571
- CompareTo: xe,
2572
- InAllowedValues: Se,
2573
- LengthInRange: Pe,
2574
- MaxLength: Re,
2755
+ CompareTo: Ie,
2756
+ InAllowedValues: Te,
2757
+ LengthInRange: Ne,
2758
+ MaxLength: je,
2575
2759
  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({
2760
+ MinLength: Pe,
2761
+ MinValue: Re,
2762
+ Pattern: Be,
2763
+ Required: ke,
2764
+ Validator: f,
2765
+ ValueInRange: Fe
2766
+ }, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2583
2767
  __proto__: null,
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,
2768
+ AbortEventHandlingException: P,
2769
+ Action: Se,
2770
+ ActionsMap: M,
2771
+ ConditionalEnabledAction: ue,
2772
+ ConditionalStatementAction: U,
2773
+ ConditionalValueAction: ce,
2774
+ ConditionalVisibilityAction: le,
2775
+ DisplayMode: I,
2776
+ EnabledChangedAction: _t,
2777
+ EnabledChangingAction: Rt,
2778
+ ExecuteAction: Nt,
2779
+ Field: et,
2780
+ FieldActionBase: m,
2781
+ FieldBase: y,
2599
2782
  Group: d,
2600
- List: A,
2601
- ListItemAddedAction: K,
2602
- ListItemRemovedAction: Nt,
2603
- MdString: P,
2604
- MessagesWidget: Ce,
2783
+ List: _,
2784
+ ListItemAddedAction: Y,
2785
+ ListItemRemovedAction: Bt,
2786
+ MdString: j,
2787
+ MessagesWidget: xe,
2605
2788
  Operator: c,
2606
- RenderableValue: Zt,
2607
- Statement: v,
2789
+ RenderableValue: se,
2790
+ Statement: w,
2608
2791
  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
2792
+ ValidationError: G,
2793
+ ValidationErrorRenderContent: g,
2794
+ ValidationErrorText: ee,
2795
+ Validators: De,
2796
+ ValueChangedAction: T,
2797
+ VisibilityChangedAction: jt,
2798
+ VisibilityChangingAction: Pt,
2799
+ buildErrorMessage: b,
2800
+ defaultDisplayMode: Kt,
2801
+ isCallableFunction: L,
2802
+ isSimpleComponentDef: Z,
2803
+ transaction: J
2621
2804
  }, Symbol.toStringTag, { value: "Module" }));
2622
2805
  export {
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,
2806
+ P as AbortEventHandlingException,
2807
+ Se as Action,
2808
+ M as ActionsMap,
2809
+ ue as ConditionalEnabledAction,
2810
+ U as ConditionalStatementAction,
2811
+ ce as ConditionalValueAction,
2812
+ le as ConditionalVisibilityAction,
2813
+ I as DisplayMode,
2814
+ _t as EnabledChangedAction,
2815
+ Rt as EnabledChangingAction,
2816
+ Nt as ExecuteAction,
2817
+ et as Field,
2818
+ m as FieldActionBase,
2819
+ y as FieldBase,
2638
2820
  d as Group,
2639
- A as List,
2640
- K as ListItemAddedAction,
2641
- Nt as ListItemRemovedAction,
2642
- P as MdString,
2643
- Ce as MessagesWidget,
2821
+ _ as List,
2822
+ Y as ListItemAddedAction,
2823
+ Bt as ListItemRemovedAction,
2824
+ j as MdString,
2825
+ xe as MessagesWidget,
2644
2826
  c as Operator,
2645
- Zt as RenderableValue,
2646
- v as Statement,
2827
+ se as RenderableValue,
2828
+ w as Statement,
2647
2829
  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
2830
+ G as ValidationError,
2831
+ g as ValidationErrorRenderContent,
2832
+ ee as ValidationErrorText,
2833
+ De as Validators,
2834
+ T as ValueChangedAction,
2835
+ jt as VisibilityChangedAction,
2836
+ Pt as VisibilityChangingAction,
2837
+ b as buildErrorMessage,
2838
+ $e as default,
2839
+ Kt as defaultDisplayMode,
2840
+ Ue as forms,
2841
+ Gt as getConfig,
2842
+ L as isCallableFunction,
2843
+ Z as isSimpleComponentDef,
2844
+ te as setConfig,
2845
+ J as transaction
2664
2846
  };
2665
2847
  //# sourceMappingURL=dynamicforms-vue-forms.js.map