@dynamicforms/vue-forms 0.13.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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 Y, unref as h, isRef as Vt, reactive as Ut, watch as $t, ref as Wt, defineComponent as qt, resolveComponent as ut, openBlock as zt, createBlock as Ht, h as k } from "vue";
2
+ import { isEqual as R, isEmpty as _, 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, ct = 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 (ct.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" ? ct.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 ht(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 || ht(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 = ht(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 dt(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 Z(n) {
295
+ if (S) {
296
+ const s = n(H);
297
+ return dt(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 dt(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) : Z(() => 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 G(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 tt {
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 tt {
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 tt {
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 = Y(() => 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" : G(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, nt = It();
463
+ let rt = !1;
464
+ const $ = () => !rt && o.run === v && s.validationEpoch === p && !nt?.rolledBack, at = new AbortController(), B = () => {
465
+ $() || (rt = !0, o.abandon === B && (o.abandon = void 0), at.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, at.signal) || [], q = (E) => Z(() => {
469
+ const D = E?.map((A) => this.claim(A)) ?? [];
470
+ for (let A = s.errors.length - 1; A >= 0; A--) {
471
+ const ot = s.errors[A];
472
+ if (ot.source === this.source) {
473
+ const lt = D.findIndex((Mt) => Mt.sameAs(ot));
474
+ lt >= 0 ? D.splice(lt, 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, nt?.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 (G(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
663
  }
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
- }
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 gt(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 et(n, t) {
696
+ const e = gt(t, n);
697
+ if (e) return e;
698
+ let s = t.parent;
699
+ for (; s; ) {
700
+ const i = gt(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 = et(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 Ft 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 _t 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 ft = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), mt = /* @__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
+ mt.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) || mt.has(s) || (this[s] = i);
1045
+ }), _(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 = pt.get(this);
1124
+ return t || (t = Y(() => this.composeBusy()), pt.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));
1174
1252
  }
1175
- set actions(t) {
1176
- this._actions = t;
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;
1263
+ }
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
@@ -1270,8 +1371,8 @@ class V {
1270
1371
  u(() => {
1271
1372
  const s = e === void 0 ? t.value : e, i = this.errors.length > 0;
1272
1373
  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);
1374
+ const r = this.enabled && this.value !== s;
1375
+ this.value = s, this.originalValue = this.value, this.validate(!r && i);
1275
1376
  });
1276
1377
  }
1277
1378
  /** Resets a member. It is what lets a container reach the reset of a child whose class it does not know. */
@@ -1291,8 +1392,8 @@ class V {
1291
1392
  * from repeating while nothing it read has moved.
1292
1393
  */
1293
1394
  get validRead() {
1294
- let t = ht.get(this);
1295
- return t || (t = X(() => this.composeValid()), ht.set(this, t)), t.value;
1395
+ let t = ft.get(this);
1396
+ return t || (t = Y(() => this.composeValid()), ft.set(this, t)), t.value;
1296
1397
  }
1297
1398
  /** What validRead computes. A leaf answers over its own errors; a container adds its members. */
1298
1399
  composeValid() {
@@ -1303,21 +1404,27 @@ class V {
1303
1404
  return this.#t.visibility;
1304
1405
  }
1305
1406
  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);
1407
+ const e = this.#t.visibility;
1408
+ t !== e && u((s) => {
1409
+ const i = this.boundActions?.trigger(Pt, this, t, e);
1410
+ if (!(i instanceof P)) {
1411
+ if (!I.isDefined(i ?? t))
1412
+ throw new Error("visibility must be a DisplayMode constant");
1413
+ s.touch(this), this.#t.visibility = I.fromAny(i ?? t), this.boundActions?.trigger(jt, this, this.#t.visibility, e);
1414
+ }
1311
1415
  });
1312
1416
  }
1313
1417
  get enabled() {
1314
1418
  return this.#t.enabled;
1315
1419
  }
1316
1420
  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);
1421
+ const e = this.#t.enabled;
1422
+ t !== e && u((s) => {
1423
+ const i = this.boundActions?.trigger(Rt, this, t, e);
1424
+ if (!(i instanceof P)) {
1425
+ if (!Qt(i ?? t)) throw new Error("Enabled value must be boolean");
1426
+ s.touch(this), this.#t.enabled = i ?? t, this.#t.enabled !== e && this.bumpValueVersion(), this.boundActions?.trigger(Ft, this, this.#t.enabled, e);
1427
+ }
1321
1428
  });
1322
1429
  }
1323
1430
  /**
@@ -1330,18 +1437,26 @@ class V {
1330
1437
  get composesValue() {
1331
1438
  return !1;
1332
1439
  }
1440
+ /**
1441
+ * Whether `child` composes its value from members of its own. It is what lets a container tell a nested
1442
+ * container from a leaf without knowing the classes below it, the way `resetChild` reaches a reset it does not
1443
+ * know the shape of.
1444
+ */
1445
+ childComposesValue(t) {
1446
+ return t.composesValue;
1447
+ }
1333
1448
  /**
1334
1449
  * Announces what this element's value became over the transaction. The pair carried is (value now, value at the
1335
1450
  * last announcement), so a value that went A -> B -> A within the transaction says nothing, and the events an
1336
1451
  * operation states rather than an element's state - an item added, an item removed - are emitted first, in the
1337
1452
  * order the operations happened.
1338
1453
  */
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));
1454
+ [xt](t, e, s, i) {
1455
+ if (i?.forEach((l) => this.boundActions?.trigger(l.actionClass, this, l.item, l.index)), !e) return;
1456
+ const r = this.boundActions;
1457
+ if (this.composesValue && !(r?.willTrigger(Ct) || r?.hasEager)) return;
1458
+ const a = this.value, o = this.#e.announcedValue;
1459
+ !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
1460
  }
1346
1461
  /**
1347
1462
  * Forms the verdict this element ends the transaction with and announces a transition of it. The container is
@@ -1350,16 +1465,16 @@ class V {
1350
1465
  * asynchronous validator, an error pushed in by hand - is what makes the container re-form its own. The
1351
1466
  * transaction settles the deepest element first, so a container is reached only once its members have decided.
1352
1467
  */
1353
- [xt](t) {
1468
+ [At](t) {
1354
1469
  const e = this.#e.valid, s = this.countedValid;
1355
1470
  if (s === e) return;
1356
1471
  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);
1472
+ const i = this.container;
1473
+ i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(_t, this, s, e);
1359
1474
  }
1360
1475
  validate(t = !1) {
1361
1476
  u((e) => {
1362
- t && this._actions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1477
+ t && this.boundActions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
1363
1478
  });
1364
1479
  }
1365
1480
  get valid() {
@@ -1369,7 +1484,7 @@ class V {
1369
1484
  return this.value;
1370
1485
  }
1371
1486
  get isChanged() {
1372
- return !Q(this.value, this.originalValue);
1487
+ return !R(this.value, this.originalValue);
1373
1488
  }
1374
1489
  /**
1375
1490
  * Brings a fresh element into the state a binding of `source` is in: it records what it was declared as, takes
@@ -1381,10 +1496,12 @@ class V {
1381
1496
  */
1382
1497
  boundFrom(t, e, s, i) {
1383
1498
  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));
1499
+ const r = { ...t.extra, ...i && this.extendedOf(i) };
1500
+ _(r) || this.setExtendedValues(r);
1501
+ const a = this.declaration;
1502
+ a.noteBinding(this);
1503
+ const o = a._actions;
1504
+ o && (this._actions = o, o.bindTo(this), o.triggerEager(this, e, s));
1388
1505
  }
1389
1506
  /**
1390
1507
  * Registers the actions a constructor received in its parameters: registration without the eager trigger,
@@ -1398,7 +1515,7 @@ class V {
1398
1515
  }
1399
1516
  registerAction(t) {
1400
1517
  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);
1518
+ e.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t), this.registered(e, t);
1402
1519
  }), this;
1403
1520
  }
1404
1521
  /**
@@ -1409,7 +1526,7 @@ class V {
1409
1526
  */
1410
1527
  registerActionBefore(t, e) {
1411
1528
  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);
1529
+ s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t, e), this.registered(s, t);
1413
1530
  }), this;
1414
1531
  }
1415
1532
  /**
@@ -1421,10 +1538,13 @@ class V {
1421
1538
  unregisterAction(t) {
1422
1539
  let e = !1;
1423
1540
  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)));
1541
+ const i = this.boundActions;
1542
+ if (!i || (e = i.unregister(t), !e)) return;
1543
+ s.touch(this), t instanceof f && this.#t.validationEpoch++;
1544
+ const r = this.boundElements;
1545
+ s.whenRolledBack(() => {
1546
+ i.register(t), r.forEach((a) => t.boundToBinding(a));
1547
+ }), r.forEach((a) => t.unregisterFrom(a));
1428
1548
  }), e;
1429
1549
  }
1430
1550
  /**
@@ -1432,12 +1552,16 @@ class V {
1432
1552
  * registration is not one of the state slots the snapshot covers, so it hands its own undo in.
1433
1553
  */
1434
1554
  registered(t, e) {
1435
- e.boundToBinding(this), t.whenRolledBack(() => {
1436
- this._actions?.unregister(e) && e.unregisterFrom(this);
1555
+ const s = this.boundElements;
1556
+ s.forEach((i) => {
1557
+ e.boundToBinding(i), e.eager && this.actions.triggerEagerFor(e.classIdentifier, i, i.value, i.originalValue);
1558
+ }), t.whenRolledBack(() => {
1559
+ this.boundActions?.unregister(e) && s.forEach((i) => e.unregisterFrom(i));
1437
1560
  });
1438
1561
  }
1439
1562
  triggerAction(t, ...e) {
1440
- return this._actions ? this._actions.trigger(t, this, ...e) : null;
1563
+ const s = this.boundActions;
1564
+ return s ? s.trigger(t, this, ...e) : null;
1441
1565
  }
1442
1566
  /**
1443
1567
  * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
@@ -1450,19 +1574,23 @@ class V {
1450
1574
  clearValidators() {
1451
1575
  u((t) => {
1452
1576
  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();
1577
+ const e = this.boundActions;
1578
+ if (e) {
1579
+ const s = this.boundElements;
1580
+ e.validators.forEach((i) => {
1581
+ e.unregister(i), t.whenRolledBack(() => {
1582
+ e.register(i), s.forEach((r) => i.boundToBinding(r));
1583
+ }), s.forEach((r) => i.unregisterFrom(r));
1584
+ });
1585
+ }
1586
+ this.errors = [], this.validate();
1459
1587
  });
1460
1588
  }
1461
1589
  }
1462
- function de(n, t) {
1590
+ function me(n, t) {
1463
1591
  return n ? !t : t;
1464
1592
  }
1465
- class v {
1593
+ class w {
1466
1594
  operand1;
1467
1595
  operator;
1468
1596
  operand2;
@@ -1482,9 +1610,8 @@ class v {
1482
1610
  `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
1611
  );
1484
1612
  }
1485
- /** @throws TypeError where an operand the statement reads is undefined or a function. */
1486
1613
  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;
1614
+ w.validateOperand(t, 1), e !== c.NOT && w.validateOperand(s, 2), this.operand1 = t, this.operator = e, this.operand2 = s;
1488
1615
  }
1489
1616
  /**
1490
1617
  * The value an operand contributes. A field operand names a field of the record the statement is evaluated in:
@@ -1493,25 +1620,25 @@ class v {
1493
1620
  * hold the field yet contributes undefined, which is what a half-built row answers with.
1494
1621
  */
1495
1622
  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;
1623
+ if (t instanceof w) return t.evaluate(e);
1624
+ if (t instanceof y) {
1625
+ const s = e ? et(t, e) : t;
1499
1626
  return s ? h(s.value) : void 0;
1500
1627
  }
1501
1628
  return t;
1502
1629
  }
1503
1630
  get operand1Value() {
1504
- return v.valueOf(this.operand1);
1631
+ return w.valueOf(this.operand1);
1505
1632
  }
1506
1633
  get operand2Value() {
1507
- return v.valueOf(this.operand2);
1634
+ return w.valueOf(this.operand2);
1508
1635
  }
1509
1636
  /**
1510
1637
  * The result of the statement, over the record `scope` belongs to where one is given and over the fields the
1511
1638
  * statement was built from where it is not.
1512
1639
  */
1513
1640
  evaluate(t) {
1514
- const e = v.valueOf(this.operand1, t), s = v.valueOf(this.operand2, t);
1641
+ const e = w.valueOf(this.operand1, t), s = w.valueOf(this.operand2, t);
1515
1642
  switch (this.operator) {
1516
1643
  // logical operators
1517
1644
  // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
@@ -1527,7 +1654,7 @@ class v {
1527
1654
  case c.NOR:
1528
1655
  return !(e || s);
1529
1656
  case c.XOR:
1530
- return de(!!e, !!s);
1657
+ return me(!!e, !!s);
1531
1658
  case c.NOT:
1532
1659
  return !e;
1533
1660
  // comparison operators
@@ -1562,54 +1689,54 @@ class v {
1562
1689
  collectFields() {
1563
1690
  const t = /* @__PURE__ */ new Set();
1564
1691
  function e(s) {
1565
- s instanceof V ? t.add(s) : s instanceof v && s.collectFields().forEach((a) => t.add(a));
1692
+ s instanceof y ? t.add(s) : s instanceof w && s.collectFields().forEach((r) => t.add(r));
1566
1693
  }
1567
1694
  return e(this.operand1), e(this.operand2), t;
1568
1695
  }
1569
1696
  }
1570
- const ge = /* @__PURE__ */ Symbol("ExecuteAction");
1571
- class jt extends p {
1697
+ const be = /* @__PURE__ */ Symbol("ExecuteAction");
1698
+ class Nt extends m {
1572
1699
  constructor(t) {
1573
1700
  super(t);
1574
1701
  }
1575
1702
  static get classIdentifier() {
1576
- return ge;
1703
+ return be;
1577
1704
  }
1578
1705
  execute(t, e, s) {
1579
1706
  return super.execute(t, e, s);
1580
1707
  }
1581
1708
  }
1582
- const fe = /* @__PURE__ */ Symbol("ListItemAddedAction");
1583
- class K extends p {
1709
+ const ve = /* @__PURE__ */ Symbol("ListItemAddedAction");
1710
+ class J extends m {
1584
1711
  constructor(t) {
1585
1712
  super(t);
1586
1713
  }
1587
1714
  static get classIdentifier() {
1588
- return fe;
1715
+ return ve;
1589
1716
  }
1590
1717
  execute(t, e, s, i) {
1591
1718
  return super.execute(t, e, s, i);
1592
1719
  }
1593
1720
  }
1594
- const pe = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1595
- class Nt extends p {
1721
+ const we = /* @__PURE__ */ Symbol("ListItemRemovedAction");
1722
+ class Bt extends m {
1596
1723
  constructor(t) {
1597
1724
  super(t);
1598
1725
  }
1599
1726
  static get classIdentifier() {
1600
- return pe;
1727
+ return we;
1601
1728
  }
1602
1729
  execute(t, e, s, i) {
1603
1730
  return super.execute(t, e, s, i);
1604
1731
  }
1605
1732
  }
1606
- const me = Object.freeze({});
1607
- function kt() {
1733
+ const Ve = Object.freeze({});
1734
+ function Dt() {
1608
1735
  return {
1609
1736
  originalValue: void 0,
1610
1737
  announcedValue: void 0,
1611
1738
  errors: [],
1612
- visibility: _.FULL,
1739
+ visibility: I.FULL,
1613
1740
  enabled: !0,
1614
1741
  valueVersion: 0,
1615
1742
  validatingCount: 0,
@@ -1618,29 +1745,32 @@ function kt() {
1618
1745
  fieldName: void 0,
1619
1746
  validationEpoch: 0,
1620
1747
  declaration: void 0,
1621
- extra: me,
1748
+ extra: Ve,
1622
1749
  valid: !0,
1623
1750
  invalidChildren: 0
1624
1751
  };
1625
1752
  }
1626
- function ve() {
1627
- return { ...kt(), value: void 0, touched: !1 };
1753
+ function ye() {
1754
+ return { ...Dt(), value: void 0, touched: !1 };
1628
1755
  }
1629
- function Bt() {
1756
+ function Lt() {
1630
1757
  return {
1631
- ...kt(),
1758
+ ...Dt(),
1632
1759
  announcedValue: null,
1633
1760
  cachedValue: null,
1634
1761
  cachedValueVersion: -1
1635
1762
  };
1636
1763
  }
1637
- function be() {
1638
- return { ...Bt(), fieldNames: [] };
1764
+ function Ee() {
1765
+ return { ...Lt(), fieldNames: [] };
1639
1766
  }
1640
- function we() {
1641
- return { ...Bt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
1767
+ function Ce() {
1768
+ return { ...Lt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
1642
1769
  }
1643
- class M extends V {
1770
+ class st extends y {
1771
+ get [Symbol.toStringTag]() {
1772
+ return "Field";
1773
+ }
1644
1774
  get state() {
1645
1775
  return super.state;
1646
1776
  }
@@ -1655,7 +1785,7 @@ class M extends V {
1655
1785
  this.state.value = t;
1656
1786
  }
1657
1787
  constructor(t) {
1658
- super(ve()), this.init(t);
1788
+ super(ye()), this.init(t);
1659
1789
  }
1660
1790
  /**
1661
1791
  * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
@@ -1669,10 +1799,10 @@ class M extends V {
1669
1799
  init(t) {
1670
1800
  u(() => {
1671
1801
  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);
1802
+ const { value: e, validators: s, actions: i, ...r } = t;
1803
+ this.registerInitialActions([...s || [], ...i || []]), this.assignParams(r), this._value = e !== void 0 ? e : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
1674
1804
  }
1675
- this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1805
+ this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
1676
1806
  });
1677
1807
  }
1678
1808
  get value() {
@@ -1681,9 +1811,17 @@ class M extends V {
1681
1811
  set value(t) {
1682
1812
  const e = this._value;
1683
1813
  !this.enabled || e === t || u((s) => {
1684
- s.touch(this), this._value = t, this.bumpValueVersion(), this._actions?.triggerEager(this, t, e), this.propagateValueChanged();
1814
+ s.touch(this), this._value = t, this.bumpValueVersion(), this.boundActions?.triggerEager(this, t, e), this.propagateValueChanged();
1685
1815
  });
1686
1816
  }
1817
+ /**
1818
+ * The container that holds this field. A `List` holds rows and a row is a `Group`, so a field is never a `List`'s
1819
+ * child and the link is a `Group` wherever there is one: `field.parent?.fields.other` is the sibling lookup, and
1820
+ * it is typed here.
1821
+ */
1822
+ get parent() {
1823
+ return super.parent;
1824
+ }
1687
1825
  get touched() {
1688
1826
  return this.state.touched;
1689
1827
  }
@@ -1701,24 +1839,23 @@ class M extends V {
1701
1839
  return i.boundFrom(this, i.value, i.originalValue, e), i;
1702
1840
  }
1703
1841
  }
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) {
1842
+ const bt = /* @__PURE__ */ new WeakMap();
1843
+ function K(n, t) {
1710
1844
  return n?.label == null && n?.icon == null ? t : n;
1711
1845
  }
1712
- class ye extends M {
1846
+ class Se extends st {
1847
+ get [Symbol.toStringTag]() {
1848
+ return "Action";
1849
+ }
1713
1850
  init(t) {
1714
1851
  u(() => {
1715
1852
  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);
1853
+ const { value: e, originalValue: s, validators: i, actions: r, ...a } = t;
1854
+ this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a);
1855
+ const o = K(e, this._value), l = Object.freeze({ label: s?.label, icon: s?.icon });
1856
+ this._value = K(o, { ...l }), this.originalValue = K(l, o);
1720
1857
  }
1721
- this.raw.announcedValue = this._value, this._actions?.triggerEager(this, this.value, this.originalValue), this.validate();
1858
+ this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
1722
1859
  });
1723
1860
  }
1724
1861
  /**
@@ -1752,8 +1889,8 @@ class ye extends M {
1752
1889
  }
1753
1890
  /** the counter behind `busy`, allocated for this action the first time it is asked for */
1754
1891
  get busyRuns() {
1755
- let t = ft.get(this);
1756
- return t || (t = Wt(0), ft.set(this, t)), t;
1892
+ let t = bt.get(this);
1893
+ return t || (t = Wt(0), bt.set(this, t)), t;
1757
1894
  }
1758
1895
  /** true from the moment execute() is called until the handler it ran has settled, however it settles */
1759
1896
  get busy() {
@@ -1773,20 +1910,20 @@ class ye extends M {
1773
1910
  const e = this.busyRuns;
1774
1911
  e.value++;
1775
1912
  try {
1776
- return await this.triggerAction(jt, t);
1913
+ return await this.triggerAction(Nt, t);
1777
1914
  } finally {
1778
1915
  e.value--;
1779
1916
  }
1780
1917
  }
1781
1918
  }
1782
- const Ce = /* @__PURE__ */ qt({
1919
+ const xe = /* @__PURE__ */ qt({
1783
1920
  __name: "messages-widget",
1784
1921
  props: {
1785
1922
  message: {},
1786
1923
  classes: {}
1787
1924
  },
1788
1925
  setup(n) {
1789
- const t = n, e = at("vue-markdown"), s = /* @__PURE__ */ new Set([
1926
+ const t = n, e = ut("vue-markdown"), s = /* @__PURE__ */ new Set([
1790
1927
  "div",
1791
1928
  "span",
1792
1929
  "p",
@@ -1843,23 +1980,23 @@ const Ce = /* @__PURE__ */ qt({
1843
1980
  "dt",
1844
1981
  "dd"
1845
1982
  ]), 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) {
1983
+ if (typeof t.message == "string") return k("span", { class: t.classes }, t.message);
1984
+ const r = [];
1985
+ return t.message.forEach((a) => {
1986
+ switch (a.componentName) {
1850
1987
  case "template":
1851
- a.push(F("div", { class: [t.classes, r.extraClasses] }, r.componentBody));
1988
+ r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBody));
1852
1989
  break;
1853
1990
  case "vue-markdown":
1854
1991
  if (typeof e == "string")
1855
1992
  console.warn(
1856
1993
  "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));
1994
+ ), r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBindings.source));
1858
1995
  else {
1859
- const o = r.componentBindings;
1860
- a.push(
1861
- F(e, {
1862
- class: [t.classes, r.extraClasses, "df-messages-widget-markdown"],
1996
+ const o = a.componentBindings;
1997
+ r.push(
1998
+ k(e, {
1999
+ class: [t.classes, a.extraClasses, "df-messages-widget-markdown"],
1863
2000
  source: o.source,
1864
2001
  options: o.options,
1865
2002
  plugins: o.plugins
@@ -1868,23 +2005,23 @@ const Ce = /* @__PURE__ */ qt({
1868
2005
  }
1869
2006
  break;
1870
2007
  default:
1871
- a.push(
1872
- F(
1873
- s.has(r.componentName.toLowerCase()) ? r.componentName : at(r.componentName),
2008
+ r.push(
2009
+ k(
2010
+ s.has(a.componentName.toLowerCase()) ? a.componentName : ut(a.componentName),
1874
2011
  {
1875
- class: [t.classes, r.extraClasses],
1876
- ...r.componentBindings,
1877
- ...r.componentBody ? { innerHTML: r.componentBody } : {}
2012
+ class: [t.classes, a.extraClasses],
2013
+ ...a.componentBindings,
2014
+ ...a.componentBody ? { innerHTML: a.componentBody } : {}
1878
2015
  }
1879
2016
  )
1880
2017
  );
1881
2018
  break;
1882
2019
  }
1883
- }), a;
2020
+ }), r;
1884
2021
  };
1885
- return (a, r) => (zt(), Ht(i));
2022
+ return (r, a) => (zt(), Ht(i));
1886
2023
  }
1887
- }), pt = /* @__PURE__ */ new WeakMap(), Ee = (n) => ({
2024
+ }), vt = /* @__PURE__ */ new WeakMap(), Ae = (n) => ({
1888
2025
  get(t, e, s) {
1889
2026
  return n(), Reflect.get(t, e, s);
1890
2027
  },
@@ -1907,7 +2044,10 @@ const Ce = /* @__PURE__ */ qt({
1907
2044
  throw new TypeError(`fields.${String(e)} cannot be deleted: use removeField() to take a member out`);
1908
2045
  }
1909
2046
  });
1910
- class d extends V {
2047
+ class d extends y {
2048
+ get [Symbol.toStringTag]() {
2049
+ return "Group";
2050
+ }
1911
2051
  get state() {
1912
2052
  return super.state;
1913
2053
  }
@@ -1916,15 +2056,15 @@ class d extends V {
1916
2056
  }
1917
2057
  _fields;
1918
2058
  constructor(t, e) {
1919
- if (super(be()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
2059
+ if (super(Ee()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
1920
2060
  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);
2061
+ if (Object.entries(t).forEach(([i, r]) => this.addField(i, r)), e) {
2062
+ const { value: i, validators: r, actions: a, ...o } = e;
2063
+ this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1924
2064
  }
1925
2065
  this.completeRecords();
1926
2066
  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();
2067
+ this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this.boundActions?.triggerEager(this, s, this.originalValue), this.validate();
1928
2068
  });
1929
2069
  }
1930
2070
  /**
@@ -1992,15 +2132,15 @@ class d extends V {
1992
2132
  }
1993
2133
  static isValidFields(t) {
1994
2134
  function e(s) {
1995
- return s instanceof V;
2135
+ return s instanceof y;
1996
2136
  }
1997
2137
  return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
1998
2138
  }
1999
2139
  static createFromFormData(t) {
2000
- if (t instanceof V)
2140
+ if (t instanceof y)
2001
2141
  throw new Error("data is already a Form structure, should be a simple object");
2002
2142
  return new d(
2003
- t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new M({ value: s })]))
2143
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new st({ value: s })]))
2004
2144
  );
2005
2145
  }
2006
2146
  field(t) {
@@ -2015,11 +2155,11 @@ class d extends V {
2015
2155
  * re-renders when a field is added or removed; what a member itself holds is tracked by that member.
2016
2156
  */
2017
2157
  get fields() {
2018
- let t = pt.get(this);
2158
+ let t = vt.get(this);
2019
2159
  return t || (t = new Proxy(
2020
2160
  this._fields,
2021
- Ee(() => this.state.fieldNames.length)
2022
- ), pt.set(this, t)), t;
2161
+ Ae(() => this.state.fieldNames.length)
2162
+ ), vt.set(this, t)), t;
2023
2163
  }
2024
2164
  get members() {
2025
2165
  return this.raw.fieldNames.map((t) => this._fields[t]);
@@ -2028,11 +2168,11 @@ class d extends V {
2028
2168
  const t = this.valueVersion;
2029
2169
  if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
2030
2170
  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);
2171
+ Object.entries(this._fields).forEach(([i, r]) => {
2172
+ const a = r.value;
2173
+ (r.enabled || this.childComposesValue(r) && !_(a)) && (e[i] = a);
2034
2174
  });
2035
- const s = R(e) ? null : Object.freeze({ ...e });
2175
+ const s = _(e) ? null : Object.freeze({ ...e });
2036
2176
  return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
2037
2177
  }
2038
2178
  /**
@@ -2060,12 +2200,12 @@ class d extends V {
2060
2200
  resetTo(t, e) {
2061
2201
  const s = t;
2062
2202
  u((i) => {
2063
- i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([r, o]) => {
2203
+ i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([a, o]) => {
2064
2204
  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);
2205
+ e === null ? l = null : e !== void 0 && Object.hasOwn(e, a) && (l = e[a]), this.resetChild(o, s.field(a) ?? o, l);
2066
2206
  });
2067
- const a = this.value;
2068
- this.raw.announcedValue = a, this.originalValue = d.baseline(a), super.validate(!0);
2207
+ const r = this.value;
2208
+ this.raw.announcedValue = r, this.originalValue = d.baseline(r), super.validate(!0);
2069
2209
  });
2070
2210
  }
2071
2211
  get touched() {
@@ -2119,19 +2259,32 @@ class d extends V {
2119
2259
  t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
2120
2260
  });
2121
2261
  }
2262
+ /**
2263
+ * States that `res` was built from the members handed to it. A subclass whose constructor takes something other
2264
+ * than `(fields, params)` - one that composes its own members and passes them to super - never sees them, and
2265
+ * would answer with a binding carrying the declaration's data instead of the record's. That is a difference no
2266
+ * reader would find, so it is refused here rather than returned.
2267
+ */
2268
+ static assertTookFields(t, e, s) {
2269
+ const i = Object.entries(e), r = t.raw.fieldNames;
2270
+ if (!(i.length === r.length && i.every(([a, o]) => t._fields[a] === o)))
2271
+ throw new TypeError(
2272
+ `${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.`
2273
+ );
2274
+ }
2122
2275
  bind(t, e) {
2123
2276
  const s = /* @__PURE__ */ Object.create(null);
2124
- Object.entries(this._fields).forEach(([a, r]) => {
2125
- s[a] = r.bind();
2277
+ Object.entries(this._fields).forEach(([a, o]) => {
2278
+ s[a] = o.bind();
2126
2279
  });
2127
- const i = new d(s, {
2280
+ const i = this.constructor, r = new i(s, {
2128
2281
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2129
2282
  value: t !== void 0 ? t : this.value,
2130
2283
  ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2131
2284
  enabled: e?.enabled ?? this.enabled,
2132
2285
  visibility: e?.visibility ?? this.visibility
2133
2286
  });
2134
- return i.boundFrom(this, i.raw.announcedValue, i.originalValue, e), i;
2287
+ return d.assertTookFields(r, s, this.constructor.name), r.boundFrom(this, r.raw.announcedValue, r.originalValue, e), r;
2135
2288
  }
2136
2289
  /**
2137
2290
  * A record need not name every member: a key it leaves out is taken from the declaration, the same way a member
@@ -2141,7 +2294,10 @@ class d extends V {
2141
2294
  return super.rebind(t);
2142
2295
  }
2143
2296
  }
2144
- class A extends V {
2297
+ class F extends y {
2298
+ get [Symbol.toStringTag]() {
2299
+ return "List";
2300
+ }
2145
2301
  get state() {
2146
2302
  return super.state;
2147
2303
  }
@@ -2150,12 +2306,12 @@ class A extends V {
2150
2306
  }
2151
2307
  _itemTemplate;
2152
2308
  constructor(t, e) {
2153
- super(we()), this._itemTemplate = t, u(() => {
2309
+ super(Ce()), this._itemTemplate = t, u(() => {
2154
2310
  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);
2311
+ const { value: s, validators: i, actions: r, ...a } = e;
2312
+ this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a), s !== void 0 ? this.setValueInternal(s) : this.originalValue !== void 0 && this.setValueInternal(this.originalValue);
2157
2313
  }
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();
2314
+ this.originalValue === void 0 && (this.originalValue = F.baseline(this.value)), this.raw.announcedValue = this.value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
2159
2315
  });
2160
2316
  }
2161
2317
  /** 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 +2344,32 @@ class A extends V {
2188
2344
  /** True where `next` is a different set of rows than `previous`: another count, or another row at a position. */
2189
2345
  static rowsDiffer(t, e) {
2190
2346
  const s = t ?? [], i = e ?? [];
2191
- return s.length !== i.length || s.some((a, r) => a !== i[r]);
2347
+ return s.length !== i.length || s.some((r, a) => r !== i[a]);
2192
2348
  }
2193
2349
  setValueInternal(t) {
2350
+ if (t != null && !Array.isArray(t))
2351
+ throw new TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
2194
2352
  u((e) => {
2195
2353
  e.touch(this);
2196
2354
  const s = this.raw.rows;
2197
2355
  if (t == null)
2198
2356
  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));
2357
+ else {
2358
+ const i = this.state.rows ?? [], r = new Array(t.length);
2359
+ for (let a = 0; a < t.length; a++) {
2360
+ const o = t[a], l = i[a];
2361
+ 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
2362
  }
2205
- for (let r = t.length; r < i.length; r++) this.releaseChild(i[r]);
2206
- this.state.rows = a;
2363
+ for (let a = t.length; a < i.length; a++) this.releaseChild(i[a]);
2364
+ this.state.rows = r;
2207
2365
  }
2208
- A.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
2366
+ F.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
2209
2367
  });
2210
2368
  }
2211
2369
  get value() {
2212
2370
  const t = this.valueVersion;
2213
2371
  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);
2372
+ const e = this.state.rows?.map((i) => i.value), s = _(e) ? null : Object.freeze(e);
2215
2373
  return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
2216
2374
  }
2217
2375
  set value(t) {
@@ -2227,7 +2385,7 @@ class A extends V {
2227
2385
  u((s) => {
2228
2386
  s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
2229
2387
  const i = this.value;
2230
- this.raw.announcedValue = i, this.originalValue = A.baseline(i), super.validate(!0);
2388
+ this.raw.announcedValue = i, this.originalValue = F.baseline(i), super.validate(!0);
2231
2389
  });
2232
2390
  }
2233
2391
  get touched() {
@@ -2241,14 +2399,18 @@ class A extends V {
2241
2399
  });
2242
2400
  }
2243
2401
  bind(t, e) {
2244
- const s = new A(this._itemTemplate?.bind(), {
2402
+ const s = this._itemTemplate?.bind(), i = this.constructor, r = new i(s, {
2245
2403
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2246
2404
  value: [...(t !== void 0 ? t : this.value) ?? []],
2247
2405
  ...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
2248
2406
  enabled: e?.enabled ?? this.enabled,
2249
2407
  visibility: e?.visibility ?? this.visibility
2250
2408
  });
2251
- return s.boundFrom(this, s.value, s.originalValue, e), s;
2409
+ if (r._itemTemplate !== s)
2410
+ throw new TypeError(
2411
+ `${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.`
2412
+ );
2413
+ return r.boundFrom(this, r.value, r.originalValue, e), r;
2252
2414
  }
2253
2415
  /**
2254
2416
  * Records that a row changed its value, so that the transaction in progress works out at commit what this
@@ -2331,18 +2493,18 @@ class A extends V {
2331
2493
  if (this.state.rows == null || t < 0 || this.state.rows.length <= t) return;
2332
2494
  s.touch(this);
2333
2495
  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));
2496
+ i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), e = i, s.recordStructural(this, { actionClass: Bt, item: e, index: t }), this.propagateValueChanged(!0));
2335
2497
  }), e;
2336
2498
  }
2337
2499
  insert(t, e) {
2338
2500
  let s = 0;
2339
2501
  return u((i) => {
2340
2502
  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 });
2503
+ const a = this.createPaddingItem(), o = this.state.rows.push(a) - 1;
2504
+ this.bumpValueVersion(), i.recordStructural(this, { actionClass: J, item: a, index: o });
2343
2505
  }
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);
2506
+ const r = this.processSetValueItem(t);
2507
+ this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass: J, item: r, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2346
2508
  }), s;
2347
2509
  }
2348
2510
  /** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
@@ -2356,14 +2518,14 @@ class A extends V {
2356
2518
  });
2357
2519
  }
2358
2520
  }
2359
- class xe extends g {
2521
+ class Ie extends f {
2360
2522
  constructor(t, e, s) {
2361
- const i = (a, r, o) => {
2362
- this.comparisonState(o).oldValue = r;
2523
+ const i = (r, a, o) => {
2524
+ this.comparisonState(o).oldValue = a;
2363
2525
  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 }),
2526
+ return l ? (this.listenOn(l), this.isValidComparison(h(r), h(l.value)) ? null : [
2527
+ new g(
2528
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, otherField: l }),
2367
2529
  "",
2368
2530
  "compare-to"
2369
2531
  )
@@ -2395,7 +2557,7 @@ class xe extends g {
2395
2557
  /** The field `field` is compared against, within the record `field` belongs to. */
2396
2558
  resolve(t) {
2397
2559
  const e = this.otherField;
2398
- return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? se(e, t) : G(e, x(t));
2560
+ return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) : et(e, V(t));
2399
2561
  }
2400
2562
  /**
2401
2563
  * Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
@@ -2404,11 +2566,11 @@ class xe extends g {
2404
2566
  */
2405
2567
  listenOn(t) {
2406
2568
  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);
2569
+ new T((e, s, i, r) => {
2570
+ s(e, i, r);
2571
+ const a = V(e);
2410
2572
  this.declarations.forEach(
2411
- (o) => Tt(o, r).forEach((l) => {
2573
+ (o) => kt(o, a).forEach((l) => {
2412
2574
  this.registrations.has(l) && this.execute(l, () => null, l.value, this.comparisonState(l).oldValue);
2413
2575
  })
2414
2576
  );
@@ -2428,59 +2590,59 @@ class xe extends g {
2428
2590
  super.unregisterFrom(t), this.registrations.delete(t);
2429
2591
  }
2430
2592
  }
2431
- class Se extends g {
2593
+ class Te extends f {
2432
2594
  constructor(t, e) {
2433
- const s = e || m("Must be one of [**{allowedAsText}**]"), i = () => {
2595
+ const s = e || b("Must be one of [**{allowedAsText}**]"), i = () => {
2434
2596
  const o = h(t);
2435
2597
  return typeof o == "function" ? o() : o;
2436
- }, a = (o) => {
2598
+ }, r = (o) => {
2437
2599
  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(
2600
+ return l.length <= 60 ? l : Xt(l, { length: 40, separator: ", ", omission: `... (${o.length} items total)` });
2601
+ }, a = (o, l, v) => {
2602
+ const p = i();
2603
+ return p.includes(h(o)) ? null : [
2604
+ new g(
2443
2605
  this.replacePlaceholders(s, {
2444
2606
  newValue: o,
2445
2607
  oldValue: l,
2446
- field: w,
2447
- allowedValues: b,
2448
- allowedAsText: a(b)
2608
+ field: v,
2609
+ allowedValues: p,
2610
+ allowedAsText: r(p)
2449
2611
  }),
2450
2612
  "",
2451
2613
  "in-allowed-values"
2452
2614
  )
2453
2615
  ];
2454
2616
  };
2455
- super(r);
2617
+ super(a);
2456
2618
  }
2457
2619
  }
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;
2620
+ function Oe(n) {
2621
+ 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
2622
  }
2461
- function mt(n) {
2462
- return typeof n == "object" && n !== null && !wt(n) && !(n instanceof String) && !("componentName" in n);
2623
+ function wt(n) {
2624
+ return typeof n == "object" && n !== null && !Vt(n) && !(n instanceof String) && !("componentName" in n);
2463
2625
  }
2464
- class Ae extends g {
2626
+ class ke extends f {
2465
2627
  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 }),
2628
+ 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) => {
2629
+ const p = h(o);
2630
+ return Oe(i && C(p) ? p.trim() : p) === 0 ? [
2631
+ new g(
2632
+ this.replacePlaceholders(r, { newValue: o, oldValue: l, field: v }),
2471
2633
  "",
2472
2634
  "required"
2473
2635
  )
2474
2636
  ] : null;
2475
2637
  };
2476
- super(r);
2638
+ super(a);
2477
2639
  }
2478
2640
  }
2479
- class Te extends g {
2641
+ class Re extends f {
2480
2642
  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 }),
2643
+ const s = e || b("Value must be larger or equal to **{minValue}**"), i = (r, a, o) => r < t || r === void 0 ? [
2644
+ new g(
2645
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minValue: t }),
2484
2646
  "",
2485
2647
  "min"
2486
2648
  )
@@ -2488,11 +2650,11 @@ class Te extends g {
2488
2650
  super(i);
2489
2651
  }
2490
2652
  }
2491
- class _e extends g {
2653
+ class Fe extends f {
2492
2654
  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 }),
2655
+ const s = e || b("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > t || r === void 0 ? [
2656
+ new g(
2657
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxValue: t }),
2496
2658
  "",
2497
2659
  "max"
2498
2660
  )
@@ -2500,26 +2662,26 @@ class _e extends g {
2500
2662
  super(i);
2501
2663
  }
2502
2664
  }
2503
- class Oe extends g {
2665
+ class _e extends f {
2504
2666
  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 }),
2667
+ const i = s || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, l) => a < t || a > e || a === void 0 ? [
2668
+ new g(
2669
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minValue: t, maxValue: e }),
2508
2670
  "",
2509
2671
  "range"
2510
2672
  )
2511
2673
  ] : null;
2512
- super(a);
2674
+ super(r);
2513
2675
  }
2514
2676
  }
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;
2677
+ function it(n) {
2678
+ 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
2679
  }
2518
- class Fe extends g {
2680
+ class Pe extends f {
2519
2681
  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 }),
2682
+ const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => it(r) < t ? [
2683
+ new g(
2684
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: t }),
2523
2685
  "",
2524
2686
  "min-length"
2525
2687
  )
@@ -2527,11 +2689,11 @@ class Fe extends g {
2527
2689
  super(i);
2528
2690
  }
2529
2691
  }
2530
- class Re extends g {
2692
+ class je extends f {
2531
2693
  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 }),
2694
+ const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => it(r) > t ? [
2695
+ new g(
2696
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: t }),
2535
2697
  "",
2536
2698
  "max-length"
2537
2699
  )
@@ -2539,26 +2701,26 @@ class Re extends g {
2539
2701
  super(i);
2540
2702
  }
2541
2703
  }
2542
- class Pe extends g {
2704
+ class Ne extends f {
2543
2705
  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 }),
2706
+ const i = s || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, l) => {
2707
+ const v = it(a);
2708
+ return v < t || v > e ? [
2709
+ new g(
2710
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minLength: t, maxLength: e }),
2549
2711
  "",
2550
2712
  "range-length"
2551
2713
  )
2552
2714
  ] : null;
2553
2715
  };
2554
- super(a);
2716
+ super(r);
2555
2717
  }
2556
2718
  }
2557
- class je extends g {
2719
+ class Be extends f {
2558
2720
  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 }),
2721
+ const s = e || b('Value must match pattern "**{pattern}**"'), i = (r, a, o) => t.test(String(h(r))) ? null : [
2722
+ new g(
2723
+ this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, pattern: t }),
2562
2724
  "",
2563
2725
  "pattern"
2564
2726
  )
@@ -2566,100 +2728,98 @@ class je extends g {
2566
2728
  super(i);
2567
2729
  }
2568
2730
  }
2569
- const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2731
+ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2570
2732
  __proto__: null,
2571
- CompareTo: xe,
2572
- InAllowedValues: Se,
2573
- LengthInRange: Pe,
2574
- MaxLength: Re,
2575
- MaxValue: _e,
2576
- MinLength: Fe,
2577
- MinValue: Te,
2578
- Pattern: je,
2579
- Required: Ae,
2580
- Validator: g,
2581
- ValueInRange: Oe
2582
- }, Symbol.toStringTag, { value: "Module" })), Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2733
+ CompareTo: Ie,
2734
+ InAllowedValues: Te,
2735
+ LengthInRange: Ne,
2736
+ MaxLength: je,
2737
+ MaxValue: Fe,
2738
+ MinLength: Pe,
2739
+ MinValue: Re,
2740
+ Pattern: Be,
2741
+ Required: ke,
2742
+ Validator: f,
2743
+ ValueInRange: _e
2744
+ }, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2583
2745
  __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,
2746
+ AbortEventHandlingException: P,
2747
+ Action: Se,
2748
+ ActionsMap: M,
2749
+ ConditionalEnabledAction: ue,
2750
+ ConditionalStatementAction: U,
2751
+ ConditionalValueAction: ce,
2752
+ ConditionalVisibilityAction: le,
2753
+ DisplayMode: I,
2754
+ EnabledChangedAction: Ft,
2755
+ EnabledChangingAction: Rt,
2756
+ ExecuteAction: Nt,
2757
+ Field: st,
2758
+ FieldActionBase: m,
2759
+ FieldBase: y,
2599
2760
  Group: d,
2600
- List: A,
2601
- ListItemAddedAction: K,
2602
- ListItemRemovedAction: Nt,
2603
- MdString: P,
2604
- MessagesWidget: Ce,
2761
+ List: F,
2762
+ ListItemAddedAction: J,
2763
+ ListItemRemovedAction: Bt,
2764
+ MdString: j,
2765
+ MessagesWidget: xe,
2605
2766
  Operator: c,
2606
- RenderableValue: Zt,
2607
- Statement: v,
2608
- ValidChangedAction: Ft,
2609
- ValidationError: Z,
2610
- ValidationErrorRenderContent: f,
2611
- ValidationErrorText: Jt,
2612
- Validator: g,
2613
- Validators: Ne,
2614
- ValueChangedAction: S,
2615
- VisibilityChangedAction: Pt,
2616
- VisibilityChangingAction: Rt,
2617
- buildErrorMessage: m,
2618
- isCallableFunction: B,
2619
- isSimpleComponentDef: J,
2620
- transaction: Y
2767
+ RenderableValue: se,
2768
+ Statement: w,
2769
+ ValidChangedAction: _t,
2770
+ ValidationError: tt,
2771
+ ValidationErrorRenderContent: g,
2772
+ ValidationErrorText: ee,
2773
+ Validators: De,
2774
+ ValueChangedAction: T,
2775
+ VisibilityChangedAction: jt,
2776
+ VisibilityChangingAction: Pt,
2777
+ buildErrorMessage: b,
2778
+ defaultDisplayMode: Kt,
2779
+ isCallableFunction: L,
2780
+ isSimpleComponentDef: G,
2781
+ transaction: Z
2621
2782
  }, Symbol.toStringTag, { value: "Module" }));
2622
2783
  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,
2784
+ P as AbortEventHandlingException,
2785
+ Se as Action,
2786
+ M as ActionsMap,
2787
+ ue as ConditionalEnabledAction,
2788
+ U as ConditionalStatementAction,
2789
+ ce as ConditionalValueAction,
2790
+ le as ConditionalVisibilityAction,
2791
+ I as DisplayMode,
2792
+ Ft as EnabledChangedAction,
2793
+ Rt as EnabledChangingAction,
2794
+ Nt as ExecuteAction,
2795
+ st as Field,
2796
+ m as FieldActionBase,
2797
+ y as FieldBase,
2638
2798
  d as Group,
2639
- A as List,
2640
- K as ListItemAddedAction,
2641
- Nt as ListItemRemovedAction,
2642
- P as MdString,
2643
- Ce as MessagesWidget,
2799
+ F as List,
2800
+ J as ListItemAddedAction,
2801
+ Bt as ListItemRemovedAction,
2802
+ j as MdString,
2803
+ xe as MessagesWidget,
2644
2804
  c as Operator,
2645
- Zt as RenderableValue,
2646
- v as Statement,
2647
- Ft as ValidChangedAction,
2648
- Z as ValidationError,
2649
- f as ValidationErrorRenderContent,
2650
- Jt as ValidationErrorText,
2651
- g as Validator,
2652
- Ne as Validators,
2653
- S as ValueChangedAction,
2654
- Pt as VisibilityChangedAction,
2655
- Rt as VisibilityChangingAction,
2656
- m as buildErrorMessage,
2657
- Le as default,
2658
- De as forms,
2659
- Kt as getConfig,
2660
- B as isCallableFunction,
2661
- J as isSimpleComponentDef,
2662
- Yt as setConfig,
2663
- Y as transaction
2805
+ se as RenderableValue,
2806
+ w as Statement,
2807
+ _t as ValidChangedAction,
2808
+ tt as ValidationError,
2809
+ g as ValidationErrorRenderContent,
2810
+ ee as ValidationErrorText,
2811
+ De as Validators,
2812
+ T as ValueChangedAction,
2813
+ jt as VisibilityChangedAction,
2814
+ Pt as VisibilityChangingAction,
2815
+ b as buildErrorMessage,
2816
+ $e as default,
2817
+ Kt as defaultDisplayMode,
2818
+ Ue as forms,
2819
+ Gt as getConfig,
2820
+ L as isCallableFunction,
2821
+ G as isSimpleComponentDef,
2822
+ te as setConfig,
2823
+ Z as transaction
2664
2824
  };
2665
2825
  //# sourceMappingURL=dynamicforms-vue-forms.js.map