@dynamicforms/vue-forms 3.0.0-alpha.1 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,39 @@
1
- import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-_vVZW3p9.js";
2
- import { computed as l, reactive as ee, ref as u, shallowRef as te, toRaw as d, unref as f, watch as p } from "vue";
3
- import { isArray as ne, isEmpty as re, isEqual as m, isEqualWith as ie, isObject as ae, isPlainObject as oe, isString as h, truncate as se } from "lodash-es";
1
+ import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-2GP2P-ie.js";
2
+ import { computed as l, reactive as u, ref as d, shallowRef as f, toRaw as p, unref as m, watch as ee } from "vue";
3
+ import { isArray as te, isEmpty as ne, isEqual as h, isEqualWith as re, isObject as ie, isPlainObject as ae, isString as g, truncate as oe } from "lodash-es";
4
4
  //#region \0rolldown/runtime.js
5
- var ce = Object.defineProperty, le = (e, t) => {
5
+ var se = Object.defineProperty, ce = (e, t) => {
6
6
  let n = {};
7
- for (var r in e) ce(n, r, {
7
+ for (var r in e) se(n, r, {
8
8
  get: e[r],
9
9
  enumerable: !0
10
10
  });
11
- return t || ce(n, Symbol.toStringTag, { value: "Module" }), n;
12
- }, g = Object.freeze([
11
+ return t || se(n, Symbol.toStringTag, { value: "Module" }), n;
12
+ }, _ = Object.freeze([
13
13
  "editable",
14
14
  "readonly",
15
15
  "disabled",
16
16
  "disabled-null"
17
- ]), ue = "editable";
18
- function de(e) {
19
- return g.includes(e);
17
+ ]), le = "editable";
18
+ function ue(e) {
19
+ return _.includes(e);
20
20
  }
21
21
  //#endregion
22
22
  //#region src/visibility.ts
23
- var _ = Object.freeze([
23
+ var de = Object.freeze([
24
24
  "full",
25
25
  "invisible",
26
26
  "hidden",
27
27
  "suppress"
28
28
  ]), fe = "full";
29
29
  function pe(e) {
30
- return _.includes(e);
30
+ return de.includes(e);
31
31
  }
32
32
  //#endregion
33
33
  //#region src/plugins/devtools/api.ts
34
34
  var me = !0, he = !0, ge, _e = !1;
35
35
  function ve(t) {
36
- _e ? import("./chunks/plugin-uXEQYne6.js").then((e) => e.installFor(t)) : (_e = !0, import("./chunks/plugin-uXEQYne6.js").then((t) => {
36
+ _e ? import("./chunks/plugin-Ds_2fb9G.js").then((e) => e.installFor(t)) : (_e = !0, import("./chunks/plugin-Ds_2fb9G.js").then((t) => {
37
37
  t.install(), e().forEach(({ element: e }) => t.installFor(e));
38
38
  }));
39
39
  }
@@ -52,7 +52,7 @@ var ye = {
52
52
  }
53
53
  };
54
54
  function be() {
55
- process.env.NODE_ENV !== "production" && me && !ge && (ge = Pe(ye));
55
+ process.env.NODE_ENV !== "production" && me && !ge && typeof window < "u" && (ge = Pe(ye));
56
56
  }
57
57
  function xe(e, t) {
58
58
  process.env.NODE_ENV !== "production" && r(e, t);
@@ -79,10 +79,17 @@ function Ne() {
79
79
  Te = v.filter((e) => e.onSetValue), Ee = v.filter((e) => e.onSetOriginalValue), De = v.filter((e) => e.onElementCreated), Oe = v.filter((e) => e.onElementAdopted), ke = v.filter((e) => e.onCommit);
80
80
  }
81
81
  function Pe(e) {
82
- return v.push(e), Ne(), e.setup?.(Me), () => {
83
- let t = v.indexOf(e);
82
+ v.push(e), Ne();
83
+ let t = () => {
84
+ let t = v.lastIndexOf(e);
84
85
  t < 0 || (v.splice(t, 1), Ne());
85
86
  };
87
+ try {
88
+ e.setup?.(Me);
89
+ } catch (e) {
90
+ throw t(), e;
91
+ }
92
+ return t;
86
93
  }
87
94
  function Fe(e, t) {
88
95
  let n = t;
@@ -188,8 +195,17 @@ var Je = class {
188
195
  }
189
196
  commit() {
190
197
  for (; !(!this.announceFlags() && !this.announceValues() && !this.settleValidity()););
191
- for (let e = 0; e < this.settled.length; e++) this.settled[e]();
192
- this.settled.length = 0, Ve();
198
+ }
199
+ settle() {
200
+ let e = !1, t, n = (n) => {
201
+ try {
202
+ n();
203
+ } catch (n) {
204
+ e || (t = n), e = !0;
205
+ }
206
+ };
207
+ for (let e = 0; e < this.settled.length; e++) n(this.settled[e]);
208
+ if (this.settled.length = 0, n(Ve), e) throw t;
193
209
  }
194
210
  buckets(e) {
195
211
  let t = [];
@@ -260,23 +276,24 @@ function C(e) {
260
276
  }
261
277
  let t = new Je(), n = new Ze();
262
278
  x = t, Ye = n;
279
+ let r;
263
280
  try {
264
- let r = e(n);
265
- if (Qe(r), n.rollbackRequested) throw new Xe();
266
- return t.commit(), r;
281
+ if (r = e(n), Qe(r), n.rollbackRequested) throw new Xe();
282
+ t.commit();
267
283
  } catch (e) {
268
284
  if (t.rollback(), e instanceof Xe) return;
269
285
  throw e;
270
286
  } finally {
271
287
  x = void 0, Ye = void 0, n.close();
272
288
  }
289
+ return t.settle(), r;
273
290
  }
274
291
  function w(e) {
275
292
  return x ? e(x) : C(() => e(x));
276
293
  }
277
294
  //#endregion
278
295
  //#region src/actions/field-action-base.ts
279
- var $e = Symbol("FieldActionBase.outermost"), T = class {
296
+ var $e = Symbol("FieldActionBase.outermost"), et = Symbol("FieldActionBase.releaseIfAbandoned"), T = class {
280
297
  static get classIdentifier() {
281
298
  throw Error("classIdentifier must be declared");
282
299
  }
@@ -305,8 +322,8 @@ var $e = Symbol("FieldActionBase.outermost"), T = class {
305
322
  boundToBinding(e) {}
306
323
  unregisterFrom(e) {}
307
324
  resetBinding(e) {}
308
- }, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"), et = Symbol("FieldBase.changedSinceErrors"), tt = Object.freeze({});
309
- function nt() {
325
+ }, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"), tt = Symbol("FieldBase.changedSinceErrors"), nt = Object.freeze({});
326
+ function rt() {
310
327
  return {
311
328
  originalValue: void 0,
312
329
  announcedValue: void 0,
@@ -316,80 +333,79 @@ function nt() {
316
333
  validatedValue: void 0,
317
334
  errors: [],
318
335
  visibility: fe,
319
- access: ue,
336
+ access: le,
320
337
  valueVersion: 0,
321
338
  validatingCount: 0,
322
339
  validatingChildren: 0,
323
340
  parent: void 0,
324
341
  fieldName: void 0,
325
- validationEpoch: 0,
326
342
  declaration: void 0,
327
- extra: tt,
343
+ extra: nt,
328
344
  valid: !0,
329
345
  invalidChildren: 0,
330
346
  errorsBaseline: D
331
347
  };
332
348
  }
333
- function rt() {
349
+ function it() {
334
350
  return {
335
- ...nt(),
351
+ ...rt(),
336
352
  value: void 0,
337
353
  touched: !1
338
354
  };
339
355
  }
340
- function it() {
356
+ function at() {
341
357
  return {
342
- ...nt(),
358
+ ...rt(),
343
359
  announcedValue: null,
344
360
  cachedValue: null,
345
361
  cachedValueVersion: -1
346
362
  };
347
363
  }
348
- function at() {
364
+ function ot() {
349
365
  return {
350
- ...it(),
366
+ ...at(),
351
367
  fieldNames: []
352
368
  };
353
369
  }
354
- function ot() {
370
+ function st() {
355
371
  return {
356
- ...it(),
372
+ ...at(),
357
373
  rows: null,
358
374
  rowsVersion: 0,
359
375
  cachedItems: null,
360
376
  cachedItemsVersion: -1
361
377
  };
362
378
  }
363
- var st = Symbol("Action.executeHandlers"), ct = Symbol("List.reorderRows"), lt = Symbol("FieldBase.beginValidating"), ut = Symbol("FieldBase.validationEpoch"), dt = Symbol("FieldBase.errorPoliciesChanged"), ft = Symbol("FieldBase.removeErrorsOnSubmit"), pt = Object.freeze([
379
+ var ct = Symbol("Action.executeHandlers"), lt = Symbol("List.reorderRows"), ut = Symbol("FieldBase.beginValidating"), dt = Symbol("FieldBase.errorPoliciesChanged"), ft = Symbol("FieldBase.removeErrorsOnSubmit"), O = Object.freeze([
364
380
  "change",
365
381
  "edit",
366
382
  "submit",
367
383
  "never"
368
- ]), mt = Symbol("ErrorPolicy"), ht = Object.freeze({
384
+ ]), pt = Symbol("ErrorPolicy"), mt = Object.freeze({
369
385
  validEffect: !0,
370
386
  removeOn: "never"
371
- }), O = Object.freeze({ server: Object.freeze({
387
+ }), k = Object.freeze({ server: Object.freeze({
372
388
  validEffect: !0,
373
389
  removeOn: "edit"
374
- }) }), gt = te(0), _t = 0;
375
- function vt() {
376
- return _t > 0;
390
+ }) }), A = f(0), ht = 0;
391
+ function gt() {
392
+ return ht > 0;
377
393
  }
378
- function yt() {
379
- gt.value;
394
+ function _t() {
395
+ A.value;
380
396
  }
381
- var k = (e) => typeof e == "string" ? `'${e}'` : String(e);
382
- function bt(e) {
383
- if (typeof e != "object" || !e) throw TypeError(`${k(e)} is not an object of rules keyed by origin`);
397
+ var j = (e) => typeof e == "string" ? `'${e}'` : String(e);
398
+ function vt(e) {
399
+ if (typeof e != "object" || !e) throw TypeError(`${j(e)} is not an object of rules keyed by origin`);
384
400
  Object.entries(e).forEach(([e, t]) => {
385
401
  if (e === "validator") throw TypeError("'validator' has no rule: a validator replaces its own errors and they always count");
386
- if (typeof t != "object" || !t) throw TypeError(`The rule for ${k(e)} is not an object of validEffect and removeOn`);
387
- if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${k(e)} is ${k(t.validEffect)}, not a boolean`);
388
- if (!pt.includes(t.removeOn)) throw TypeError(`removeOn for ${k(e)} is ${k(t.removeOn)}, not one of ` + pt.map(k).join(", "));
389
- if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${k(e)} combines validEffect: true with removeOn: 'submit': an error that makes the target invalid refuses the submit that would remove it`);
402
+ if (typeof t != "object" || !t) throw TypeError(`The rule for ${j(e)} is not an object of validEffect and removeOn`);
403
+ if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${j(e)} is ${j(t.validEffect)}, not a boolean`);
404
+ if (!O.includes(t.removeOn)) throw TypeError(`removeOn for ${j(e)} is ${j(t.removeOn)}, not one of ` + O.map(j).join(", "));
405
+ if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${j(e)} combines validEffect: true with removeOn: 'submit': an error that makes the target invalid refuses the submit that would remove it`);
390
406
  });
391
407
  }
392
- function xt(e) {
408
+ function yt(e) {
393
409
  let t = Object.create(null);
394
410
  return Object.entries(e).forEach(([e, n]) => {
395
411
  t[e] = Object.freeze({
@@ -398,62 +414,62 @@ function xt(e) {
398
414
  });
399
415
  }), Object.freeze(t);
400
416
  }
401
- function St(e) {
402
- bt(e);
403
- let t = O;
404
- return O = Object.freeze({
405
- ...O,
406
- ...xt(e)
407
- }), gt.value++, () => {
408
- O = t, gt.value++;
417
+ function bt(e) {
418
+ vt(e);
419
+ let t = k;
420
+ return k = Object.freeze({
421
+ ...k,
422
+ ...yt(e)
423
+ }), A.value++, () => {
424
+ k = t, A.value++;
409
425
  };
410
426
  }
411
- function Ct(e) {
412
- return O[e] ?? ht;
427
+ function xt(e) {
428
+ return k[e] ?? mt;
413
429
  }
414
- var A = class extends T {
430
+ var M = class extends T {
415
431
  policies;
416
432
  constructor(e) {
417
- bt(e), super((e, t, ...n) => t(e, ...n)), this.policies = xt(e);
433
+ vt(e), super((e, t, ...n) => t(e, ...n)), this.policies = yt(e);
418
434
  }
419
435
  static get classIdentifier() {
420
- return mt;
436
+ return pt;
421
437
  }
422
438
  boundToBinding(e) {
423
- _t++, this.rulesChanged(e);
439
+ ht++, this.rulesChanged(e);
424
440
  }
425
441
  unregisterFrom(e) {
426
- _t--, this.rulesChanged(e);
442
+ ht--, this.rulesChanged(e);
427
443
  }
428
444
  rulesChanged(e) {
429
- gt.value++, w(() => e[dt]());
445
+ A.value++, w(() => e[dt]());
430
446
  }
431
447
  };
432
- function wt(e, t) {
448
+ function St(e, t) {
433
449
  return e.policies[t];
434
450
  }
435
- function Tt(e, t) {
436
- if (!(e instanceof A)) return;
451
+ function Ct(e, t) {
452
+ if (!(e instanceof M)) return;
437
453
  let n = Object.keys(e.policies);
438
454
  t.forEach((t) => {
439
- if (t === e || !(t instanceof A)) return;
440
- let r = n.find((e) => wt(t, e) !== void 0);
441
- if (r !== void 0) throw TypeError(`An ErrorPolicy for ${k(r)} is already registered on this element`);
455
+ if (t === e || !(t instanceof M)) return;
456
+ let r = n.find((e) => St(t, e) !== void 0);
457
+ if (r !== void 0) throw TypeError(`An ErrorPolicy for ${j(r)} is already registered on this element`);
442
458
  });
443
459
  }
444
460
  //#endregion
445
461
  //#region src/actions/value-changed-action.ts
446
- var Et = Symbol("ValueChangedAction"), j = class extends T {
462
+ var wt = Symbol("ValueChangedAction"), N = class extends T {
447
463
  constructor(e) {
448
464
  super(e);
449
465
  }
450
466
  static get classIdentifier() {
451
- return Et;
467
+ return wt;
452
468
  }
453
469
  execute(e, t, n, r) {
454
470
  return super.execute(e, t, n, r);
455
471
  }
456
- }, Dt = class {
472
+ }, Tt = class {
457
473
  code;
458
474
  params;
459
475
  detail;
@@ -465,21 +481,21 @@ var Et = Symbol("ValueChangedAction"), j = class extends T {
465
481
  return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
466
482
  }
467
483
  sameAs(e) {
468
- return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin && m(this.params, e.params);
484
+ return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin && h(this.params, e.params);
469
485
  }
470
- }, Ot = Symbol("Validator");
471
- function kt(e, t) {
486
+ }, Et = Symbol("Validator");
487
+ function Dt(e, t) {
472
488
  return e.replace(/\{(\w+)\}/g, (e, n) => Object.hasOwn(t, n) ? String(t[n]) : e);
473
489
  }
474
- var M = class extends j {
490
+ var P = class extends N {
475
491
  source;
476
492
  constructor(e) {
477
493
  super((t, n, r, i) => {
478
- let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = t[ut], l = S(), ee = !1, u = () => !ee && a.run === s && t[ut] === c && !l?.rolledBack, te = new AbortController(), d = () => {
479
- u() || (ee = !0, a.abandon === d && (a.abandon = void 0), te.abort());
494
+ let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = S(), l = !1, u = () => !l && a.run === s && !c?.rolledBack, d = new AbortController(), f = () => {
495
+ u() || (l = !0, a.abandon === f && (a.abandon = void 0), d.abort());
480
496
  };
481
497
  o?.();
482
- let f = t[He]() ? [] : e(r, i, t, te.signal) || [], p = (e) => C(() => {
498
+ let p = t[He]() ? [] : e(r, i, t, d.signal) || [], m = (e) => C(() => {
483
499
  let n = e?.map((e) => this.claim(e)) ?? [];
484
500
  for (let e = t.errors.length - 1; e >= 0; e--) {
485
501
  let r = t.errors[e];
@@ -490,17 +506,17 @@ var M = class extends j {
490
506
  }
491
507
  n.length > 0 && t.errors.push(...n), t.validate();
492
508
  });
493
- if (f instanceof Promise) {
494
- a.abandon = d, l?.whenRolledBack(d);
495
- let e = t[lt]();
496
- f.then((e) => {
497
- u() && p(e);
509
+ if (p instanceof Promise) {
510
+ a.abandon = f, c?.whenRolledBack(f);
511
+ let e = t[ut]();
512
+ p.then((e) => {
513
+ u() && m(e);
498
514
  }, (e) => {
499
- u() && (p([new Dt("validation_failed", {}, "Validation could not be completed")]), console.error("Validation failed", e));
515
+ u() && (m([new Tt("validation_failed", {}, "Validation could not be completed")]), console.error("Validation failed", e));
500
516
  }).finally(() => {
501
- a.abandon === d && (a.abandon = void 0), e();
517
+ a.abandon === f && (a.abandon = void 0), e();
502
518
  }).catch((e) => console.error("Validation failed", e));
503
- } else p(f);
519
+ } else m(p);
504
520
  return n(t, r, i);
505
521
  }), this.source = Symbol(this.constructor.name);
506
522
  }
@@ -520,20 +536,24 @@ var M = class extends j {
520
536
  });
521
537
  }
522
538
  static get classIdentifier() {
523
- return Ot;
539
+ return Et;
524
540
  }
525
541
  get eager() {
526
542
  return !0;
527
543
  }
528
544
  unregisterFrom(e) {
529
545
  w((t) => {
530
- t.whenCommitted(() => this.abandonRun(e));
546
+ let n = this.bindingState(e), r = n.run;
547
+ t.whenCommitted(() => {
548
+ n.run === r && this.abandonRun(e);
549
+ });
531
550
  for (let t = e.errors.length - 1; t >= 0; t--) e.errors[t].source === this.source && e.errors.splice(t, 1);
532
551
  e.validate();
533
552
  });
534
553
  }
535
554
  abandonRun(e) {
536
- this.bindingState(e).abandon?.();
555
+ let t = this.bindingState(e);
556
+ t.run++, t.abandon?.();
537
557
  }
538
558
  bindingState(e) {
539
559
  return this.state(e, () => this.newBindingState());
@@ -542,21 +562,34 @@ var M = class extends j {
542
562
  return { run: 0 };
543
563
  }
544
564
  errorFor(e, t, n, r) {
545
- return new Dt(e?.code ?? t, r, kt(e?.detail ?? n, r));
565
+ return new Tt(e?.code ?? t, r, Dt(e?.detail ?? n, r));
546
566
  }
547
- }, At = class e {
567
+ }, Ot = class e {
548
568
  actions = [];
549
- register(e, t) {
550
- if (!(e instanceof T)) throw Error("Invalid action type");
551
- e.classIdentifier, Tt(e, this.actions);
552
- let n = t ? this.actions.indexOf(t) : -1;
553
- if (t && (t.classIdentifier !== e.classIdentifier || n < 0)) throw Error("Action to register before is not registered under the same identifier");
554
- if (n >= 0) {
555
- this.actions.splice(n, 0, e);
569
+ get registrations() {
570
+ return this.actions;
571
+ }
572
+ restore(e) {
573
+ this.actions = e;
574
+ }
575
+ register(t, n) {
576
+ if (!(t instanceof T)) throw Error("Invalid action type");
577
+ t.classIdentifier, Ct(t, this.actions);
578
+ let r = n ? this.actions.indexOf(n) : -1;
579
+ if (n && (n.classIdentifier !== t.classIdentifier || r < 0)) throw Error("Action to register before is not registered under the same identifier");
580
+ if (r >= 0) {
581
+ this.actions = e.inserted(this.actions, r, t);
556
582
  return;
557
583
  }
558
- let r = e[$e] ? -1 : this.actions.findIndex((t) => t[$e] && t.classIdentifier === e.classIdentifier);
559
- r < 0 ? this.actions.push(e) : this.actions.splice(r, 0, e);
584
+ let i = t[$e] ? -1 : this.actions.findIndex((e) => e[$e] && e.classIdentifier === t.classIdentifier);
585
+ this.actions = e.inserted(this.actions, i < 0 ? this.actions.length : i, t);
586
+ }
587
+ static inserted(e, t, n) {
588
+ return [
589
+ ...e.slice(0, t),
590
+ n,
591
+ ...e.slice(t)
592
+ ];
560
593
  }
561
594
  unregister(e) {
562
595
  return this.actions.includes(e) ? (this.actions = this.actions.filter((t) => t !== e), !0) : !1;
@@ -571,11 +604,11 @@ var M = class extends j {
571
604
  return this.run(e.classIdentifier, !1, t, n);
572
605
  }
573
606
  triggerEager(e, ...t) {
574
- let n = this.runEager((e) => !(e instanceof M), e, t) ? [e.contribution, ...t.slice(1)] : t;
575
- this.runEager((e) => e instanceof M, e, n);
607
+ let n = this.runEager((e) => !(e instanceof P), e, t) ? [e.contribution, ...t.slice(1)] : t;
608
+ this.runEager((e) => e instanceof P, e, n);
576
609
  }
577
610
  triggerEagerRules(e, ...t) {
578
- this.runEager((e) => !(e instanceof M), e, t);
611
+ this.runEager((e) => !(e instanceof P), e, t);
579
612
  }
580
613
  runEager(t, n, r) {
581
614
  let i = !1, a = this.actions;
@@ -602,7 +635,7 @@ var M = class extends j {
602
635
  return this.actions.filter((t) => t.classIdentifier === e);
603
636
  }
604
637
  get validators() {
605
- return this.actions.filter((e) => e instanceof M);
638
+ return this.actions.filter((e) => e instanceof P);
606
639
  }
607
640
  bindTo(e) {
608
641
  this.actions.forEach((t) => t.boundToBinding(e));
@@ -641,40 +674,40 @@ var M = class extends j {
641
674
  };
642
675
  //#endregion
643
676
  //#region src/resolve.ts
644
- function N(e) {
677
+ function F(e) {
645
678
  let t = e;
646
679
  for (; t.fieldName !== void 0 && t.parent;) t = t.parent;
647
680
  return t;
648
681
  }
649
- function jt(e, t) {
682
+ function kt(e, t) {
650
683
  let n = e;
651
- for (let e of Mt(t)) if (n = n.field?.(e) ?? void 0, !n) return;
684
+ for (let e of At(t)) if (n = n.field?.(e) ?? void 0, !n) return;
652
685
  return n?.declaration === t ? n : void 0;
653
686
  }
654
- function Mt(e) {
687
+ function At(e) {
655
688
  let t = [], n = e;
656
689
  for (; n.fieldName !== void 0 && n.parent;) t.unshift(n.fieldName), n = n.parent;
657
690
  return t;
658
691
  }
659
- function Nt(e, t) {
660
- let n = jt(t, e);
692
+ function jt(e, t) {
693
+ let n = kt(t, e);
661
694
  if (n) return n;
662
695
  let r = t.parent;
663
696
  for (; r;) {
664
- let t = jt(N(r), e);
697
+ let t = kt(F(r), e);
665
698
  if (t) return t;
666
699
  r = r.parent;
667
700
  }
668
- return N(e) === N(t.declaration) ? void 0 : e;
701
+ return F(e) === F(t.declaration) ? void 0 : e;
669
702
  }
670
- function Pt(e, t) {
671
- let n = Nt(e, t);
703
+ function Mt(e, t) {
704
+ let n = jt(e, t);
672
705
  if (!n) return [];
673
706
  if (n !== e) return [n];
674
707
  let r = t.bindingsOf(e);
675
708
  return r.length > 0 ? r : [e];
676
709
  }
677
- function Ft(e, t) {
710
+ function Nt(e, t) {
678
711
  let n = t.parent;
679
712
  for (; n;) {
680
713
  let t = n.field?.(e);
@@ -683,41 +716,68 @@ function Ft(e, t) {
683
716
  }
684
717
  }
685
718
  //#endregion
686
- //#region src/actions/conditional/conditional-statement-action.ts
687
- var It = Symbol("ConditionalStatementAction"), P = class extends j {
719
+ //#region src/weak-elements.ts
720
+ var Pt = class {
721
+ refs = /* @__PURE__ */ new Set();
722
+ byElement = /* @__PURE__ */ new WeakMap();
723
+ add(e) {
724
+ if (this.byElement.has(e)) return;
725
+ let t = new WeakRef(e);
726
+ this.byElement.set(e, t), this.refs.add(t);
727
+ }
728
+ has(e) {
729
+ return this.byElement.has(e);
730
+ }
731
+ delete(e) {
732
+ let t = this.byElement.get(e);
733
+ return t ? (this.byElement.delete(e), this.refs.delete(t), !0) : !1;
734
+ }
735
+ get alive() {
736
+ let e = [];
737
+ return this.refs.forEach((t) => {
738
+ let n = t.deref();
739
+ n ? e.push(n) : this.refs.delete(t);
740
+ }), e;
741
+ }
742
+ }, Ft = Symbol("ConditionalStatementAction"), I = class extends N {
688
743
  statement;
689
744
  conditionalExecutor;
690
- declarations = /* @__PURE__ */ new Set();
745
+ declarations = new Pt();
691
746
  registrations = /* @__PURE__ */ new WeakSet();
692
747
  constructor(e, t) {
693
- super((e, t, n, r) => (this.applyIn(N(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t, this.relay = new j((e, t, ...n) => (this.applyFrom(e), t(e, ...n))), this.relay[$e] = !0, this.listen();
748
+ super((e, t, n, r) => (this.applyIn(F(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t, this.relay = new N((e, t, ...n) => (this.applyFrom(e), t(e, ...n))), this.relay[$e] = !0, this.relay[et] = () => {
749
+ this.bound && this.declarations.alive.length === 0 && this.stopListening();
750
+ }, this.listen();
694
751
  }
695
752
  relay;
696
- registered = 0;
697
753
  listening = !1;
754
+ bound = !1;
698
755
  listen() {
699
756
  this.listening || (this.listening = !0, this.statement.collectFields().forEach((e) => e.registerAction(this.relay)));
700
757
  }
758
+ stopListening() {
759
+ this.listening && (S()?.whenRolledBack(() => {
760
+ this.listening = !0;
761
+ }), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
762
+ }
701
763
  static get classIdentifier() {
702
- return It;
764
+ return Ft;
703
765
  }
704
766
  get eager() {
705
767
  return !0;
706
768
  }
707
769
  boundToBinding(e) {
708
- this.declarations.add(e.declaration), this.registrations.has(e) || this.registered++, this.registrations.add(e), this.listen();
770
+ this.declarations.add(e.declaration), this.registrations.add(e), this.bound = !0, this.listen();
709
771
  }
710
772
  resetBinding(e) {
711
773
  this.forgetState(e);
712
774
  }
713
775
  unregisterFrom(e) {
714
- this.registrations.delete(e) && this.registered--, this.registered === 0 && this.listening && (S()?.whenRolledBack(() => {
715
- this.listening = !0;
716
- }), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
776
+ this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
717
777
  }
718
778
  targetsIn(e) {
719
779
  let t = [];
720
- return this.declarations.forEach((n) => Pt(n, e).forEach((e) => {
780
+ return this.declarations.alive.forEach((n) => Mt(n, e).forEach((e) => {
721
781
  this.registrations.has(e) && t.push(e);
722
782
  })), t;
723
783
  }
@@ -734,29 +794,29 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
734
794
  }
735
795
  applyFrom(e) {
736
796
  let t = /* @__PURE__ */ new Set();
737
- this.targetsIn(N(e)).forEach((e) => t.add(N(e))), t.forEach((e) => this.applyIn(e));
797
+ this.targetsIn(F(e)).forEach((e) => t.add(F(e))), t.forEach((e) => this.applyIn(e));
738
798
  }
739
- }, Lt = class extends P {
799
+ }, It = class extends I {
740
800
  constructor(e, t = "full", n = "suppress") {
741
801
  super(e, (e, r) => {
742
802
  e.visibility = r ? t : n;
743
803
  });
744
804
  }
745
- }, Rt = class extends P {
805
+ }, Lt = class extends I {
746
806
  constructor(e, t = "editable", n = "disabled") {
747
807
  super(e, (e, r) => {
748
808
  e.access = r ? t : n;
749
809
  });
750
810
  }
751
- }, zt = class extends P {
811
+ }, Rt = class extends I {
752
812
  constructor(e, t) {
753
813
  super(e, (e, n) => {
754
814
  n && (e.value = t);
755
815
  });
756
816
  }
757
- }, F = /* @__PURE__ */ function(e) {
817
+ }, L = /* @__PURE__ */ function(e) {
758
818
  return e[e.NOT = 0] = "NOT", e[e.OR = 1] = "OR", e[e.AND = 2] = "AND", e[e.XOR = 3] = "XOR", e[e.NAND = 4] = "NAND", e[e.NOR = 5] = "NOR", e[e.EQUALS = -1] = "EQUALS", e[e.NOT_EQUALS = -2] = "NOT_EQUALS", e[e.GT = -3] = "GT", e[e.LT = -4] = "LT", e[e.GE = -5] = "GE", e[e.LE = -6] = "LE", e[e.IN = -7] = "IN", e[e.NOT_IN = -8] = "NOT_IN", e[e.INCLUDES = -9] = "INCLUDES", e[e.NOT_INCLUDES = -10] = "NOT_INCLUDES", e;
759
- }(F || {});
819
+ }(L || {});
760
820
  (function(e) {
761
821
  function t(e) {
762
822
  let t = e.toLowerCase();
@@ -792,15 +852,15 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
792
852
  }
793
853
  e.fromString = t;
794
854
  function n(e) {
795
- let t = typeof e == "number" ? e : F.fromString(e);
796
- if (Object.values(F).includes(t)) return t;
855
+ let t = typeof e == "number" ? e : L.fromString(e);
856
+ if (Object.values(L).includes(t)) return t;
797
857
  throw Error(`Unrecognised operator ${e}`);
798
858
  }
799
859
  e.fromAny = n;
800
860
  function r(e) {
801
- if (typeof e == "number") return Object.values(F).includes(e);
861
+ if (typeof e == "number") return Object.values(L).includes(e);
802
862
  try {
803
- return Object.values(F).includes(F.fromString(e));
863
+ return Object.values(L).includes(L.fromString(e));
804
864
  } catch {
805
865
  return !1;
806
866
  }
@@ -810,89 +870,97 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
810
870
  return e >= 0;
811
871
  }
812
872
  e.isLogicOperator = i;
813
- })(F ||= {}), Object.freeze(F);
814
- var I = F, Bt = Symbol("AccessChangingAction"), Vt = class extends T {
873
+ })(L ||= {}), Object.freeze(L);
874
+ var R = L, zt = Symbol("AccessChangingAction"), Bt = class extends T {
815
875
  constructor(e) {
816
876
  super(e);
817
877
  }
818
878
  static get classIdentifier() {
819
- return Bt;
879
+ return zt;
820
880
  }
821
881
  execute(e, t, n, r) {
822
882
  return super.execute(e, t, n, r);
823
883
  }
824
- }, Ht = Symbol("AccessChangedAction"), Ut = class extends T {
884
+ }, Vt = Symbol("AccessChangedAction"), Ht = class extends T {
825
885
  constructor(e) {
826
886
  super(e);
827
887
  }
828
888
  static get classIdentifier() {
829
- return Ht;
889
+ return Vt;
830
890
  }
831
891
  execute(e, t, n, r) {
832
892
  return super.execute(e, t, n, r);
833
893
  }
834
- }, Wt = Symbol("ContributionChangedAction"), Gt = class extends T {
894
+ }, Ut = Symbol("ContributionChangedAction"), Wt = class extends T {
835
895
  constructor(e) {
836
896
  super(e);
837
897
  }
838
898
  static get classIdentifier() {
839
- return Wt;
899
+ return Ut;
840
900
  }
841
901
  execute(e, t, n, r) {
842
902
  return super.execute(e, t, n, r);
843
903
  }
844
- }, Kt = Symbol("EnabledChangingAction"), qt = class extends T {
904
+ }, Gt = Symbol("EnabledChangingAction"), Kt = class extends T {
845
905
  constructor(e) {
846
906
  super(e);
847
907
  }
848
908
  static get classIdentifier() {
849
- return Kt;
909
+ return Gt;
850
910
  }
851
911
  execute(e, t, n, r) {
852
912
  return super.execute(e, t, n, r);
853
913
  }
854
- }, Jt = Symbol("EnabledChangedAction"), Yt = class extends T {
914
+ }, qt = Symbol("EnabledChangedAction"), Jt = class extends T {
855
915
  constructor(e) {
856
916
  super(e);
857
917
  }
858
918
  static get classIdentifier() {
859
- return Jt;
919
+ return qt;
860
920
  }
861
921
  execute(e, t, n, r) {
862
922
  return super.execute(e, t, n, r);
863
923
  }
864
- }, Xt = Symbol("ValidChangedAction"), Zt = class extends T {
924
+ }, Yt = Symbol("ValidChangedAction"), Xt = class extends T {
865
925
  constructor(e) {
866
926
  super(e);
867
927
  }
868
928
  static get classIdentifier() {
869
- return Xt;
929
+ return Yt;
870
930
  }
871
931
  execute(e, t, n, r) {
872
932
  return super.execute(e, t, n, r);
873
933
  }
874
- }, Qt = Symbol("VisibilityChangingAction"), $t = class extends T {
934
+ }, Zt = Symbol("VisibilityChangingAction"), Qt = class extends T {
875
935
  constructor(e) {
876
936
  super(e);
877
937
  }
878
938
  static get classIdentifier() {
879
- return Qt;
939
+ return Zt;
880
940
  }
881
941
  execute(e, t, n, r) {
882
942
  return super.execute(e, t, n, r);
883
943
  }
884
- }, en = Symbol("VisibilityChangedAction"), tn = class extends T {
944
+ }, $t = Symbol("VisibilityChangedAction"), en = class extends T {
885
945
  constructor(e) {
886
946
  super(e);
887
947
  }
888
948
  static get classIdentifier() {
889
- return en;
949
+ return $t;
890
950
  }
891
951
  execute(e, t, n, r) {
892
952
  return super.execute(e, t, n, r);
893
953
  }
894
- }, nn = /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ new Set(["validators", "actions"]);
895
- function an(e, t) {
954
+ }, tn = /* @__PURE__ */ new WeakMap(), nn = 6e4, rn = /* @__PURE__ */ new WeakMap();
955
+ function an(e) {
956
+ let t = [];
957
+ return e.refs.forEach((n) => {
958
+ let r = n.deref();
959
+ r ? t.push(r) : e.refs.delete(n);
960
+ }), e.sweptAt = Date.now(), t;
961
+ }
962
+ var on = /* @__PURE__ */ new Set(["validators", "actions"]);
963
+ function sn(e, t) {
896
964
  for (let n = Object.getPrototypeOf(e); n && n !== Object.prototype;) {
897
965
  let e = Object.getOwnPropertyDescriptor(n, t);
898
966
  if (e) return e.get !== void 0 || e.set !== void 0;
@@ -900,11 +968,11 @@ function an(e, t) {
900
968
  }
901
969
  return !1;
902
970
  }
903
- var L = (e) => typeof e == "string" ? `'${e}'` : String(e), on = (e) => e.map(L).join(", "), R = (e) => e.origin !== "validator", sn = (e) => e === "disabled" ? "omit" : e === "disabled-null" ? "null" : "value";
904
- function cn(e) {
905
- if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${on(g)}`);
971
+ var z = (e) => typeof e == "string" ? `'${e}'` : String(e), cn = (e) => e.map(z).join(", "), B = (e) => e.origin !== "validator", V = (e) => e === "disabled" ? "omit" : e === "disabled-null" ? "null" : "value";
972
+ function ln(e) {
973
+ if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${cn(_)}`);
906
974
  }
907
- var ln = 0, z = null, B = class {
975
+ var un = 0, H = null, U = class {
908
976
  get __v_skip() {
909
977
  return !0;
910
978
  }
@@ -917,7 +985,7 @@ var ln = 0, z = null, B = class {
917
985
  #e;
918
986
  #t;
919
987
  constructor(e) {
920
- this.#t = e, this.#e = ee(e), ze(this);
988
+ this.#t = e, this.#e = u(e), ze(this);
921
989
  }
922
990
  get state() {
923
991
  return this.#e;
@@ -930,7 +998,7 @@ var ln = 0, z = null, B = class {
930
998
  t.touch(this);
931
999
  let n = t.willAnnounceValue(this), { announcedValue: r, announcedContribution: i, validatedValue: a } = this.#t;
932
1000
  this.asReset(() => {
933
- this.resetTo(this.declaration, e), z?.push(this);
1001
+ this.resetTo(this.declaration, e), H?.push(this);
934
1002
  }), n ? Object.assign(this.#t, {
935
1003
  announcedValue: r,
936
1004
  announcedContribution: i,
@@ -956,15 +1024,15 @@ var ln = 0, z = null, B = class {
956
1024
  extendedOf(e) {
957
1025
  let t = Object.create(null);
958
1026
  return Object.entries(e).forEach(([e, n]) => {
959
- rn.has(e) || an(this, e) || (t[e] = n);
1027
+ on.has(e) || sn(this, e) || (t[e] = n);
960
1028
  }), t;
961
1029
  }
962
1030
  assignParams(e) {
963
- cn(e);
1031
+ ln(e);
964
1032
  let t = this.extendedOf(e);
965
1033
  Object.entries(e).forEach(([e, n]) => {
966
- Object.hasOwn(t, e) || rn.has(e) || (this[e] = n);
967
- }), re(t) || this.setExtendedValues(t);
1034
+ Object.hasOwn(t, e) || on.has(e) || (this[e] = n);
1035
+ }), ne(t) || this.setExtendedValues(t);
968
1036
  }
969
1037
  touchState() {
970
1038
  S()?.touch(this);
@@ -982,7 +1050,7 @@ var ln = 0, z = null, B = class {
982
1050
  get validating() {
983
1051
  return this.#e.validatingCount > 0 || this.#e.validatingChildren > 0;
984
1052
  }
985
- [lt]() {
1053
+ [ut]() {
986
1054
  let e = !this.validating;
987
1055
  this.#e.validatingCount++, e && this.container?.childValidatingChanged(!0);
988
1056
  let t = !1;
@@ -999,7 +1067,7 @@ var ln = 0, z = null, B = class {
999
1067
  }
1000
1068
  settled() {
1001
1069
  return this.pending ? new Promise((e) => {
1002
- let t = p(() => this.pending, (n) => {
1070
+ let t = ee(() => this.pending, (n) => {
1003
1071
  n || (t(), e());
1004
1072
  }, { flush: "sync" });
1005
1073
  }) : Promise.resolve();
@@ -1012,19 +1080,19 @@ var ln = 0, z = null, B = class {
1012
1080
  }
1013
1081
  noteErrorsBaseline() {
1014
1082
  let e = this.#t;
1015
- e.errorsBaseline !== D || !e.errors.some(R) || (e.errorsBaseline = d(this.value));
1083
+ e.errorsBaseline !== D || !e.errors.some(B) || (e.errorsBaseline = p(this.value));
1016
1084
  }
1017
1085
  ruleOf(e) {
1018
1086
  for (let t of this.selfAndAbove()) {
1019
1087
  let n = t.boundActions;
1020
- if (!n?.willTrigger(A.classIdentifier)) continue;
1021
- let r = n.ofClass(A.classIdentifier);
1088
+ if (!n?.willTrigger(M.classIdentifier)) continue;
1089
+ let r = n.ofClass(M.classIdentifier);
1022
1090
  for (let t = r.length - 1; t >= 0; t--) {
1023
- let n = wt(r[t], e);
1091
+ let n = St(r[t], e);
1024
1092
  if (n) return n;
1025
1093
  }
1026
1094
  }
1027
- return Ct(e);
1095
+ return xt(e);
1028
1096
  }
1029
1097
  selfAndAbove() {
1030
1098
  let e = [this];
@@ -1032,30 +1100,30 @@ var ln = 0, z = null, B = class {
1032
1100
  return e;
1033
1101
  }
1034
1102
  ownErrorsValid(e) {
1035
- return e.length === 0 || !e.some((e) => !R(e) || (yt(), this.ruleOf(e.origin).validEffect));
1103
+ return e.length === 0 || !e.some((e) => !B(e) || (_t(), this.ruleOf(e.origin).validEffect));
1036
1104
  }
1037
1105
  removeErrors(e) {
1038
1106
  let t = this.#e.errors, n = !1;
1039
- for (let r = t.length - 1; r >= 0; r--) R(t[r]) && e(this.ruleOf(t[r].origin)) && (t.splice(r, 1), n = !0);
1040
- return this.#t.errors.some(R) || (this.#t.errorsBaseline = D), n;
1107
+ for (let r = t.length - 1; r >= 0; r--) B(t[r]) && e(this.ruleOf(t[r].origin)) && (t.splice(r, 1), n = !0);
1108
+ return this.#t.errors.some(B) || (this.#t.errorsBaseline = D), n;
1041
1109
  }
1042
1110
  editConcluded() {
1043
- let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) => R(t) && e.ruleOf(t.origin).removeOn === "edit"));
1111
+ let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) => B(t) && e.ruleOf(t.origin).removeOn === "edit"));
1044
1112
  e.length !== 0 && w((t) => {
1045
1113
  for (let n of e) {
1046
1114
  let e = n.#t, r = e.errorsBaseline;
1047
1115
  if (t.touch(n), r === D) {
1048
- e.errorsBaseline = d(n.value);
1116
+ e.errorsBaseline = p(n.value);
1049
1117
  continue;
1050
1118
  }
1051
- r !== et && m(n.value, r) || (n.removeErrors((e) => e.removeOn === "edit"), t.markValidityDirty(n));
1119
+ r !== tt && h(n.value, r) || (n.removeErrors((e) => e.removeOn === "edit"), t.markValidityDirty(n));
1052
1120
  }
1053
1121
  });
1054
1122
  }
1055
1123
  [ft]() {
1056
1124
  w((e) => {
1057
1125
  let t = (n) => {
1058
- n.#t.errors.some(R) && (e.touch(n), n.removeErrors((e) => e.removeOn === "submit") && e.markValidityDirty(n)), n.members.forEach(t);
1126
+ n.#t.errors.some(B) && (e.touch(n), n.removeErrors((e) => e.removeOn === "submit") && e.markValidityDirty(n)), n.members.forEach(t);
1059
1127
  };
1060
1128
  t(this);
1061
1129
  });
@@ -1063,7 +1131,7 @@ var ln = 0, z = null, B = class {
1063
1131
  [dt]() {
1064
1132
  w((e) => {
1065
1133
  let t = (n) => {
1066
- n.#t.errors.some(R) && e.markValidityDirty(n), n.members.forEach(t);
1134
+ n.#t.errors.some(B) && e.markValidityDirty(n), n.members.forEach(t);
1067
1135
  };
1068
1136
  t(this);
1069
1137
  });
@@ -1090,12 +1158,12 @@ var ln = 0, z = null, B = class {
1090
1158
  return r(this), n;
1091
1159
  }
1092
1160
  markRecordIncomplete() {
1093
- this._recordPending || (this._recordPending = !0, ln++);
1161
+ this._recordPending || (this._recordPending = !0, un++);
1094
1162
  }
1095
1163
  completeRecords(e = this) {
1096
- ln !== 0 && w(() => {
1164
+ un !== 0 && w(() => {
1097
1165
  let t = (e) => {
1098
- e._recordPending && (e._recordPending = !1, ln--, e.rerunEagerActions()), e.members.forEach(t);
1166
+ e._recordPending && (e._recordPending = !1, un--, e.rerunEagerActions()), e.members.forEach(t);
1099
1167
  };
1100
1168
  t(e);
1101
1169
  });
@@ -1109,20 +1177,20 @@ var ln = 0, z = null, B = class {
1109
1177
  return this._actions;
1110
1178
  }
1111
1179
  noteBinding(e) {
1112
- let t = nn.get(this);
1113
- t || (t = /* @__PURE__ */ new Set(), nn.set(this, t)), t.add(new WeakRef(e));
1180
+ let t = tn.get(this);
1181
+ t ? Date.now() - t.sweptAt >= nn && an(t) : (t = {
1182
+ refs: /* @__PURE__ */ new Set(),
1183
+ sweptAt: Date.now()
1184
+ }, tn.set(this, t)), t.refs.add(new WeakRef(e));
1114
1185
  }
1115
1186
  get boundElements() {
1116
- let e = this.declaration, t = nn.get(e), n = [e];
1117
- return t && t.forEach((e) => {
1118
- let r = e.deref();
1119
- r ? n.push(r) : t.delete(e);
1120
- }), n;
1187
+ let e = this.declaration, t = tn.get(e);
1188
+ return t ? [e, ...an(t)] : [e];
1121
1189
  }
1122
1190
  get actions() {
1123
1191
  let e = this.declaration;
1124
1192
  if (!e._actions) {
1125
- let t = new At();
1193
+ let t = new Ot();
1126
1194
  e.boundElements.forEach((e) => {
1127
1195
  e._actions = t;
1128
1196
  });
@@ -1146,7 +1214,7 @@ var ln = 0, z = null, B = class {
1146
1214
  }
1147
1215
  errorsAfterChange(e) {
1148
1216
  let t = this.#t;
1149
- t.errors.some(R) && (e.touch(this), this.removeErrors((e) => e.removeOn === "change"), t.errorsBaseline === D && t.errors.some(R) && (t.errorsBaseline = et));
1217
+ t.errors.some(B) && (e.touch(this), this.removeErrors((e) => e.removeOn === "change"), t.errorsBaseline === D && t.errors.some(B) && (t.errorsBaseline = tt));
1150
1218
  }
1151
1219
  constructed(e) {}
1152
1220
  refreshPreviousValue() {
@@ -1158,9 +1226,11 @@ var ln = 0, z = null, B = class {
1158
1226
  takeChild(e, t) {
1159
1227
  w((n) => {
1160
1228
  if (e.parent) throw TypeError("This element already belongs to a container - pass a bind() of it");
1229
+ if (e === this) throw TypeError("A container cannot hold itself or a container above it");
1230
+ for (let t = this.parent; t; t = t.parent) if (t === e) throw TypeError("A container cannot hold itself or a container above it");
1161
1231
  n.touch(e), e.#e.fieldName = t;
1162
1232
  let r = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
1163
- e.#e.parent = this, r && e.revalidateWhereChanged(r), vt() && e[dt](), this.adoptChild(e), Be(n, e);
1233
+ e.#e.parent = this, r && e.revalidateWhereChanged(r), gt() && e[dt](), this.adoptChild(e), Be(n, e);
1164
1234
  });
1165
1235
  }
1166
1236
  adoptChild(e) {
@@ -1176,7 +1246,7 @@ var ln = 0, z = null, B = class {
1176
1246
  let n = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
1177
1247
  e.validating && this.childValidatingChanged(!1), t.whenRolledBack(() => {
1178
1248
  e.validating && this.childValidatingChanged(!0);
1179
- }), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), vt() && e[dt](), t.markValidityDirty(this);
1249
+ }), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), gt() && e[dt](), t.markValidityDirty(this);
1180
1250
  });
1181
1251
  }
1182
1252
  resetTo(e, t) {
@@ -1188,19 +1258,19 @@ var ln = 0, z = null, B = class {
1188
1258
  });
1189
1259
  }
1190
1260
  resetChild(e, t, n) {
1191
- e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n), z?.push(e);
1261
+ e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n), H?.push(e);
1192
1262
  }
1193
1263
  asReset(e) {
1194
- if (z) {
1264
+ if (H) {
1195
1265
  e();
1196
1266
  return;
1197
1267
  }
1198
1268
  let t = [];
1199
- z = t;
1269
+ H = t;
1200
1270
  try {
1201
1271
  e();
1202
1272
  } finally {
1203
- z = null;
1273
+ H = null;
1204
1274
  }
1205
1275
  t.forEach((e) => e.boundActions?.triggerEagerRules(e, e.contribution, e.contribution)), t.forEach((e) => e.recordBaseline());
1206
1276
  }
@@ -1219,10 +1289,10 @@ var ln = 0, z = null, B = class {
1219
1289
  set visibility(e) {
1220
1290
  let t = this.#e.visibility;
1221
1291
  e !== t && w((n) => {
1222
- let r = this.boundActions?.trigger($t, this, e, t);
1292
+ let r = this.boundActions?.trigger(Qt, this, e, t);
1223
1293
  if (r instanceof E) return;
1224
1294
  let i = r ?? e;
1225
- if (!pe(i)) throw Error(`${L(i)} is not a visibility: ${on(_)}`);
1295
+ if (!pe(i)) throw Error(`${z(i)} is not a visibility: ${cn(de)}`);
1226
1296
  i !== t && (n.touch(this), this.#t.announcedVisibility === void 0 && (this.#t.announcedVisibility = t), this.#e.visibility = i, n.markFlagsDirty(this));
1227
1297
  });
1228
1298
  }
@@ -1232,21 +1302,21 @@ var ln = 0, z = null, B = class {
1232
1302
  set access(e) {
1233
1303
  let t = this.#e.access;
1234
1304
  e !== t && w((n) => {
1235
- let r = this.boundActions?.trigger(Vt, this, e, t);
1305
+ let r = this.boundActions?.trigger(Bt, this, e, t);
1236
1306
  if (r instanceof E) return;
1237
1307
  let i = r ?? e;
1238
- if (!de(i)) throw Error(`${L(i)} is not an access: ${on(g)}`);
1308
+ if (!ue(i)) throw Error(`${z(i)} is not an access: ${cn(_)}`);
1239
1309
  if (i === t) return;
1240
1310
  let a = this.enabled, o = i === "editable";
1241
1311
  if (o !== a) {
1242
- let e = this.boundActions?.trigger(qt, this, o, a);
1312
+ let e = this.boundActions?.trigger(Kt, this, o, a);
1243
1313
  if (e instanceof E) return;
1244
- if (e != null && typeof e != "boolean") throw Error(`${L(e)} is not what an EnabledChangingAction answers with: a boolean`);
1314
+ if (e != null && typeof e != "boolean") throw Error(`${z(e)} is not what an EnabledChangingAction answers with: a boolean`);
1245
1315
  if (e === a) return;
1246
1316
  }
1247
1317
  n.touch(this);
1248
1318
  let s = this.contribution, c = this.countsInContainer, l = this.effectiveAccessBelow();
1249
- this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue && sn(t) !== sn(i) && this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.#t.announcedAccess === void 0 && (this.#t.announcedAccess = t), n.markFlagsDirty(this);
1319
+ this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue && V(t) !== V(i) && this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.#t.announcedAccess === void 0 && (this.#t.announcedAccess = t), n.markFlagsDirty(this);
1250
1320
  });
1251
1321
  }
1252
1322
  get effectiveAccess() {
@@ -1278,7 +1348,7 @@ var ln = 0, z = null, B = class {
1278
1348
  }
1279
1349
  revalidateWhereChanged(e) {
1280
1350
  e.forEach((e, t) => {
1281
- sn(t.effectiveAccess) !== sn(e) && t.rerunEagerActions();
1351
+ V(t.effectiveAccess) !== V(e) && t.rerunEagerActions();
1282
1352
  });
1283
1353
  }
1284
1354
  serializesAs(e) {
@@ -1320,23 +1390,23 @@ var ln = 0, z = null, B = class {
1320
1390
  }
1321
1391
  [We](e, t, n, r) {
1322
1392
  if (r?.forEach((e) => this.boundActions?.trigger(e.actionClass, this, e.item, e.index)), !t) return;
1323
- let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? m(e, t) : e === t;
1393
+ let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? h(e, t) : e === t;
1324
1394
  if (a && i?.hasEager) {
1325
1395
  let t = this.contribution, r = this.#t.validatedValue;
1326
- (n || !m(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
1396
+ (n || !h(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
1327
1397
  }
1328
- if (!a || i?.willTrigger(Et)) {
1398
+ if (!a || i?.willTrigger(wt)) {
1329
1399
  let t = this.holding, r = this.#t.announcedValue;
1330
- (n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(j, this, t, r));
1400
+ (n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(N, this, t, r));
1331
1401
  }
1332
- if (i?.willTrigger(Wt)) {
1402
+ if (i?.willTrigger(Ut)) {
1333
1403
  let t = this.contribution, n = this.#t.announcedContribution;
1334
- o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(Gt, this, t, n));
1404
+ o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(Wt, this, t, n));
1335
1405
  }
1336
1406
  }
1337
1407
  recordAnnounced() {
1338
1408
  let e = this.boundActions;
1339
- (!this.composesValue || e?.willTrigger(Et)) && (this.#t.announcedValue = this.holding), e?.willTrigger(Wt) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution), this.#t.errorsBaseline = D;
1409
+ (!this.composesValue || e?.willTrigger(wt)) && (this.#t.announcedValue = this.holding), e?.willTrigger(Ut) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution), this.#t.errorsBaseline = D;
1340
1410
  }
1341
1411
  [Ke]() {
1342
1412
  let e = this.#t, t = e.announcedAccess;
@@ -1344,20 +1414,20 @@ var ln = 0, z = null, B = class {
1344
1414
  e.announcedAccess = void 0;
1345
1415
  let n = e.access;
1346
1416
  if (n !== t) {
1347
- this.boundActions?.trigger(Ut, this, n, t);
1417
+ this.boundActions?.trigger(Ht, this, n, t);
1348
1418
  let e = n === "editable", r = t === "editable";
1349
- e !== r && this.boundActions?.trigger(Yt, this, e, r);
1419
+ e !== r && this.boundActions?.trigger(Jt, this, e, r);
1350
1420
  }
1351
1421
  }
1352
1422
  let n = e.announcedVisibility;
1353
- n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(tn, this, e.visibility, n));
1423
+ n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(en, this, e.visibility, n));
1354
1424
  }
1355
1425
  [Ge](e) {
1356
1426
  let t = this.#t.valid, n = this.countedValid;
1357
1427
  if (n === t) return;
1358
1428
  e.touch(this), this.#t.valid = n;
1359
1429
  let r = this.container;
1360
- r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Zt, this, n, t);
1430
+ r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Xt, this, n, t);
1361
1431
  }
1362
1432
  validate(e = !1) {
1363
1433
  w((t) => {
@@ -1371,15 +1441,15 @@ var ln = 0, z = null, B = class {
1371
1441
  return this.value;
1372
1442
  }
1373
1443
  get isChanged() {
1374
- return !m(this.value, this.originalValue);
1444
+ return !h(this.value, this.originalValue);
1375
1445
  }
1376
1446
  boundFrom(e, t, n, r) {
1377
- r && cn(r), this.#t.declaration = e.declaration;
1447
+ r && ln(r), this.#t.declaration = e.declaration;
1378
1448
  let i = {
1379
1449
  ...e.extra,
1380
1450
  ...r && this.extendedOf(r)
1381
1451
  };
1382
- re(i) || this.setExtendedValues(i);
1452
+ ne(i) || this.setExtendedValues(i);
1383
1453
  let a = this.declaration;
1384
1454
  a.noteBinding(this);
1385
1455
  let o = a._actions;
@@ -1392,52 +1462,55 @@ var ln = 0, z = null, B = class {
1392
1462
  }
1393
1463
  registerAction(e) {
1394
1464
  return w((t) => {
1395
- t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), this.registered(t, e);
1465
+ t.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(t, e);
1396
1466
  }), this;
1397
1467
  }
1398
1468
  registerActionBefore(e, t) {
1399
1469
  return w((n) => {
1400
- n.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e, t), this.registered(n, e);
1470
+ n.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(n, e, t);
1401
1471
  }), this;
1402
1472
  }
1403
1473
  unregisterAction(e) {
1404
1474
  let t = !1;
1405
1475
  return w((n) => {
1406
1476
  let r = this.boundActions;
1407
- if (!r || (t = r.unregister(e), !t)) return;
1408
- n.touch(this), e instanceof M && this.#e.validationEpoch++;
1409
- let i = this.boundElements;
1477
+ if (!r) return;
1478
+ let i = r.registrations;
1479
+ if (t = r.unregister(e), !t) return;
1480
+ let a = this.boundElements;
1410
1481
  n.whenRolledBack(() => {
1411
- r.register(e), i.forEach((t) => e.boundToBinding(t));
1412
- }), i.forEach((t) => e.unregisterFrom(t));
1482
+ r.restore(i), a.forEach((t) => e.boundToBinding(t));
1483
+ }), a.forEach((t) => e.unregisterFrom(t));
1413
1484
  }), t;
1414
1485
  }
1415
- registered(e, t) {
1416
- let n = this.boundElements;
1417
- n.forEach((e) => {
1418
- t.boundToBinding(e), t.eager && (e.#t.validatedValue = e.contribution, this.actions.triggerEagerFor(t.classIdentifier, e, e.contribution, e.originalValue));
1419
- }), e.whenRolledBack(() => {
1420
- this.boundActions?.unregister(t) && n.forEach((e) => t.unregisterFrom(e));
1486
+ register(e, t, n) {
1487
+ let r = this.actions;
1488
+ this.releaseAbandoned(r);
1489
+ let i = r.registrations, a = this.boundElements;
1490
+ e.whenRolledBack(() => {
1491
+ let e = r.registrations.includes(t) && !i.includes(t);
1492
+ r.restore(i), e && a.forEach((e) => t.unregisterFrom(e));
1493
+ }), r.register(t, n), a.forEach((e) => {
1494
+ t.boundToBinding(e), t.eager && (e.#t.validatedValue = e.contribution, r.triggerEagerFor(t.classIdentifier, e, e.contribution, e.originalValue));
1421
1495
  });
1422
1496
  }
1497
+ releaseAbandoned(e) {
1498
+ let t = Date.now(), n = rn.get(e);
1499
+ n !== void 0 && t - n < nn || (rn.set(e, t), n !== void 0 && e.registrations.forEach((e) => e[et]?.()));
1500
+ }
1423
1501
  triggerAction(e, ...t) {
1424
1502
  let n = this.boundActions;
1425
1503
  return n ? n.trigger(e, this, ...t) : null;
1426
1504
  }
1427
- get [ut]() {
1428
- return this.#e.validationEpoch;
1429
- }
1430
1505
  clearValidators() {
1431
1506
  w((e) => {
1432
- e.touch(this), this.#e.validationEpoch++;
1507
+ e.touch(this);
1433
1508
  let t = this.boundActions;
1434
1509
  if (t) {
1435
- let n = this.boundElements;
1436
- t.validators.forEach((r) => {
1437
- t.unregister(r), e.whenRolledBack(() => {
1438
- t.register(r), n.forEach((e) => r.boundToBinding(e));
1439
- }), n.forEach((e) => r.unregisterFrom(e));
1440
- });
1510
+ let n = t.registrations, r = t.validators, i = this.boundElements;
1511
+ r.forEach((e) => t.unregister(e)), e.whenRolledBack(() => {
1512
+ t.restore(n), r.forEach((e) => i.forEach((t) => e.boundToBinding(t)));
1513
+ }), r.forEach((e) => i.forEach((t) => e.unregisterFrom(t)));
1441
1514
  }
1442
1515
  this.errors = [], this.validate();
1443
1516
  });
@@ -1445,10 +1518,10 @@ var ln = 0, z = null, B = class {
1445
1518
  };
1446
1519
  //#endregion
1447
1520
  //#region src/actions/conditional/statement.ts
1448
- function un(e, t) {
1521
+ function dn(e, t) {
1449
1522
  return e ? !t : t;
1450
1523
  }
1451
- var dn = class e {
1524
+ var fn = class e {
1452
1525
  operand1;
1453
1526
  operator;
1454
1527
  operand2;
@@ -1457,13 +1530,13 @@ var dn = class e {
1457
1530
  if (typeof e == "function") throw TypeError(`Statement operand ${t} 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').`);
1458
1531
  }
1459
1532
  constructor(t, n, r) {
1460
- e.validateOperand(t, 1), n !== I.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
1533
+ e.validateOperand(t, 1), n !== R.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
1461
1534
  }
1462
1535
  static valueOf(t, n) {
1463
1536
  if (t instanceof e) return t.evaluate(n);
1464
- if (t instanceof B) {
1465
- let e = n ? Nt(t, n) : t;
1466
- return e ? f(e.value) : void 0;
1537
+ if (t instanceof U) {
1538
+ let e = n ? jt(t, n) : t;
1539
+ return e ? m(e.value) : void 0;
1467
1540
  }
1468
1541
  return t;
1469
1542
  }
@@ -1476,38 +1549,38 @@ var dn = class e {
1476
1549
  evaluate(t) {
1477
1550
  let n = e.valueOf(this.operand1, t), r = e.valueOf(this.operand2, t);
1478
1551
  switch (this.operator) {
1479
- case I.AND: return !!(n && r);
1480
- case I.OR: return !!(n || r);
1481
- case I.NAND: return !(n && r);
1482
- case I.NOR: return !(n || r);
1483
- case I.XOR: return un(!!n, !!r);
1484
- case I.NOT: return !n;
1485
- case I.EQUALS: return n == r;
1486
- case I.NOT_EQUALS: return n != r;
1487
- case I.LT: return n < r;
1488
- case I.LE: return n <= r;
1489
- case I.GE: return n >= r;
1490
- case I.GT: return n > r;
1491
- case I.IN: return !!r?.includes?.(n);
1492
- case I.NOT_IN: return !r?.includes?.(n);
1493
- case I.INCLUDES: return h(n) && h(r) && n.indexOf(r) >= 0;
1494
- case I.NOT_INCLUDES: return !(h(n) && h(r) && n.indexOf(r) >= 0);
1552
+ case R.AND: return !!(n && r);
1553
+ case R.OR: return !!(n || r);
1554
+ case R.NAND: return !(n && r);
1555
+ case R.NOR: return !(n || r);
1556
+ case R.XOR: return dn(!!n, !!r);
1557
+ case R.NOT: return !n;
1558
+ case R.EQUALS: return n == r;
1559
+ case R.NOT_EQUALS: return n != r;
1560
+ case R.LT: return n < r;
1561
+ case R.LE: return n <= r;
1562
+ case R.GE: return n >= r;
1563
+ case R.GT: return n > r;
1564
+ case R.IN: return !!r?.includes?.(n);
1565
+ case R.NOT_IN: return !r?.includes?.(n);
1566
+ case R.INCLUDES: return g(n) && g(r) && n.indexOf(r) >= 0;
1567
+ case R.NOT_INCLUDES: return !(g(n) && g(r) && n.indexOf(r) >= 0);
1495
1568
  default: throw Error(`Operator not implemented ${this.operator}`);
1496
1569
  }
1497
1570
  }
1498
1571
  collectFields() {
1499
1572
  let t = /* @__PURE__ */ new Set();
1500
1573
  function n(n) {
1501
- n instanceof B ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
1574
+ n instanceof U ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
1502
1575
  }
1503
1576
  return n(this.operand1), n(this.operand2), t;
1504
1577
  }
1505
- }, fn = Symbol("ExecuteAction"), V = class extends T {
1578
+ }, pn = Symbol("ExecuteAction"), W = class extends T {
1506
1579
  constructor(e) {
1507
1580
  super(e);
1508
1581
  }
1509
1582
  static get classIdentifier() {
1510
- return fn;
1583
+ return pn;
1511
1584
  }
1512
1585
  execute(e, t, n) {
1513
1586
  return super.execute(e, t, n);
@@ -1515,39 +1588,39 @@ var dn = class e {
1515
1588
  canExecute(e) {
1516
1589
  return !0;
1517
1590
  }
1518
- }, H = class extends V {
1591
+ }, mn = class extends W {
1519
1592
  targetFor(e) {
1520
1593
  let t = this.target;
1521
1594
  return typeof t == "function" ? t(e) ?? void 0 : t;
1522
1595
  }
1523
1596
  };
1524
- function pn(e) {
1597
+ function hn(e) {
1525
1598
  return e.validating ? new Promise((t) => {
1526
- let n = p(() => e.validating, (e) => {
1599
+ let n = ee(() => e.validating, (e) => {
1527
1600
  e || (n(), t());
1528
1601
  }, { flush: "sync" });
1529
1602
  }) : Promise.resolve();
1530
1603
  }
1531
- var U = class extends E {}, mn = class extends U {
1604
+ var gn = class extends E {}, _n = class extends gn {
1532
1605
  constructor(e) {
1533
1606
  super("the submit handler failed", { cause: e });
1534
1607
  }
1535
- }, W = class extends U {
1608
+ }, vn = class extends gn {
1536
1609
  reason;
1537
1610
  constructor(e) {
1538
1611
  super(e === "invalid" ? "the submitted element is invalid" : "a submit of this action is already running"), this.reason = e;
1539
1612
  }
1540
- }, hn = class extends H {
1613
+ }, yn = class extends mn {
1541
1614
  target;
1542
1615
  constructor(e, t, n = {}) {
1543
1616
  super(async (e, r, i) => {
1544
1617
  let a = this.state(e, () => ({ running: !1 }));
1545
- if (a.running) throw new W("running");
1618
+ if (a.running) throw new vn("running");
1546
1619
  a.running = !0;
1547
1620
  try {
1548
1621
  let a = this.targetFor(e);
1549
1622
  if (!a) throw Error("SubmitAction: the target callback returned no element");
1550
- if (await pn(a), !a.valid) throw new W("invalid");
1623
+ if (await hn(a), !a.valid) throw new vn("invalid");
1551
1624
  a[ft]();
1552
1625
  let o = a.value, s, c = n.lock !== !1 && a.access === "editable";
1553
1626
  c && (a.access = "readonly");
@@ -1556,7 +1629,7 @@ var U = class extends E {}, mn = class extends U {
1556
1629
  try {
1557
1630
  s = await t(o, a);
1558
1631
  } catch (e) {
1559
- throw new mn(e);
1632
+ throw new _n(e);
1560
1633
  }
1561
1634
  s !== void 0 && n.rebind !== !1 && a.rebind(s);
1562
1635
  } finally {
@@ -1576,7 +1649,7 @@ var U = class extends E {}, mn = class extends U {
1576
1649
  let t = this.targetFor(e);
1577
1650
  return t !== void 0 && t.valid && !t.pending;
1578
1651
  }
1579
- }, gn = class extends H {
1652
+ }, bn = class extends mn {
1580
1653
  target;
1581
1654
  constructor(e) {
1582
1655
  super((e, t, n) => {
@@ -1588,27 +1661,27 @@ var U = class extends E {}, mn = class extends U {
1588
1661
  canExecute(e) {
1589
1662
  return this.targetFor(e) !== void 0;
1590
1663
  }
1591
- }, _n = Symbol("ListItemAddedAction"), G = class extends T {
1664
+ }, xn = Symbol("ListItemAddedAction"), G = class extends T {
1592
1665
  constructor(e) {
1593
1666
  super(e);
1594
1667
  }
1595
1668
  static get classIdentifier() {
1596
- return _n;
1669
+ return xn;
1597
1670
  }
1598
1671
  execute(e, t, n, r) {
1599
1672
  return super.execute(e, t, n, r);
1600
1673
  }
1601
- }, vn = Symbol("ListItemRemovedAction"), K = class extends T {
1674
+ }, Sn = Symbol("ListItemRemovedAction"), K = class extends T {
1602
1675
  constructor(e) {
1603
1676
  super(e);
1604
1677
  }
1605
1678
  static get classIdentifier() {
1606
- return vn;
1679
+ return Sn;
1607
1680
  }
1608
1681
  execute(e, t, n, r) {
1609
1682
  return super.execute(e, t, n, r);
1610
1683
  }
1611
- }, q = class extends B {
1684
+ }, q = class extends U {
1612
1685
  get [Symbol.toStringTag]() {
1613
1686
  return "Field";
1614
1687
  }
@@ -1625,7 +1698,7 @@ var U = class extends E {}, mn = class extends U {
1625
1698
  this.state.value = Fe(this, e);
1626
1699
  }
1627
1700
  constructor(e) {
1628
- super(rt()), this.init(e);
1701
+ super(it()), this.init(e);
1629
1702
  }
1630
1703
  init(e) {
1631
1704
  w(() => {
@@ -1649,7 +1722,7 @@ var U = class extends E {}, mn = class extends U {
1649
1722
  w((r) => {
1650
1723
  r.touch(this);
1651
1724
  let i = this.raw;
1652
- d(i.announcedValue) === d(i.value) && (i.announcedValue = n()), e(), r.whenRolledBack(t), this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, i.announcedValue), this.propagateValueChanged(!0);
1725
+ p(i.announcedValue) === p(i.value) && (i.announcedValue = n()), e(), r.whenRolledBack(t), this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, i.announcedValue), this.propagateValueChanged(!0);
1653
1726
  });
1654
1727
  }
1655
1728
  get touched() {
@@ -1667,11 +1740,11 @@ var U = class extends E {}, mn = class extends U {
1667
1740
  }));
1668
1741
  return r.boundFrom(this, r.contribution, r.originalValue, t), r;
1669
1742
  }
1670
- }, yn = /* @__PURE__ */ new WeakMap();
1671
- function bn(e) {
1743
+ }, Cn = /* @__PURE__ */ new WeakMap();
1744
+ function wn(e) {
1672
1745
  if (e != null) return Object.values(e).some((e) => e != null) ? e : void 0;
1673
1746
  }
1674
- var xn = class extends q {
1747
+ var Tn = class extends q {
1675
1748
  get [Symbol.toStringTag]() {
1676
1749
  return "Action";
1677
1750
  }
@@ -1683,7 +1756,7 @@ var xn = class extends q {
1683
1756
  }, e) {
1684
1757
  let { value: t, originalValue: n, validators: r, actions: i, ...a } = e;
1685
1758
  this.registerInitialActions([...r || [], ...i || []]), this.assignParams(a);
1686
- let o = bn(t), s = bn(n);
1759
+ let o = wn(t), s = wn(n);
1687
1760
  o ? this._value = o : s && (this._value = { ...s }), s && (this.originalValue = Object.freeze({ ...s }));
1688
1761
  }
1689
1762
  this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
@@ -1718,14 +1791,14 @@ var xn = class extends q {
1718
1791
  return !0;
1719
1792
  }
1720
1793
  get executable() {
1721
- return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[st]().every((e) => e.canExecute(this));
1794
+ return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[ct]().every((e) => e.canExecute(this));
1722
1795
  }
1723
- [st]() {
1724
- return this.boundActions?.ofClass(V.classIdentifier) ?? [];
1796
+ [ct]() {
1797
+ return this.boundActions?.ofClass(W.classIdentifier) ?? [];
1725
1798
  }
1726
1799
  get busyRuns() {
1727
- let e = yn.get(this);
1728
- return e || (e = u(0), yn.set(this, e)), e;
1800
+ let e = Cn.get(this);
1801
+ return e || (e = d(0), Cn.set(this, e)), e;
1729
1802
  }
1730
1803
  get busy() {
1731
1804
  return this.busyRuns.value > 0;
@@ -1734,12 +1807,12 @@ var xn = class extends q {
1734
1807
  let t = this.busyRuns;
1735
1808
  t.value++;
1736
1809
  try {
1737
- return await this.triggerAction(V, e);
1810
+ return await this.triggerAction(W, e);
1738
1811
  } finally {
1739
1812
  t.value--;
1740
1813
  }
1741
1814
  }
1742
- }, Sn = /* @__PURE__ */ new WeakMap(), Cn = /* @__PURE__ */ new WeakMap(), J = class e extends B {
1815
+ }, En = /* @__PURE__ */ new WeakMap(), Dn = /* @__PURE__ */ new WeakMap(), J = class e extends U {
1743
1816
  get [Symbol.toStringTag]() {
1744
1817
  return "Container";
1745
1818
  }
@@ -1778,8 +1851,8 @@ var xn = class extends q {
1778
1851
  return t.length > 0 && t.every((e) => this.childSerializesAs(e, "fullValue") === "omit") ? "omit" : super.serializesAs(e);
1779
1852
  }
1780
1853
  command(e) {
1781
- let t = e === "confirm" ? hn : gn, n = e === "confirm" ? "defaultConfirm" : "defaultReject", r = this.actionsBelow().filter((e) => e.action.visibility === "full"), i = [
1782
- r.filter(({ action: e }) => e[st]().some((n) => n instanceof t && n.targetFor(e) === this)),
1854
+ let t = e === "confirm" ? yn : bn, n = e === "confirm" ? "defaultConfirm" : "defaultReject", r = this.actionsBelow().filter((e) => e.action.visibility === "full"), i = [
1855
+ r.filter(({ action: e }) => e[ct]().some((n) => n instanceof t && n.targetFor(e) === this)),
1783
1856
  r.filter(({ action: e, depth: t }) => t === 0 && e[n]),
1784
1857
  r.filter(({ action: e, depth: t }) => t > 0 && e[n])
1785
1858
  ];
@@ -1794,7 +1867,7 @@ var xn = class extends q {
1794
1867
  }
1795
1868
  }
1796
1869
  actionsBelow(t = 0) {
1797
- return this.children.flatMap((n) => n instanceof xn ? [{
1870
+ return this.children.flatMap((n) => n instanceof Tn ? [{
1798
1871
  action: n,
1799
1872
  depth: t
1800
1873
  }] : n instanceof e ? n.actionsBelow(t + 1) : []);
@@ -1809,12 +1882,12 @@ var xn = class extends q {
1809
1882
  return this.fullValue;
1810
1883
  }
1811
1884
  get validRead() {
1812
- let e = Sn.get(this);
1813
- return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), Sn.set(this, e)), e.value;
1885
+ let e = En.get(this);
1886
+ return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), En.set(this, e)), e.value;
1814
1887
  }
1815
1888
  get busyRead() {
1816
- let e = Cn.get(this);
1817
- return e || (e = l(() => this.children.some((e) => e.busy)), Cn.set(this, e)), e.value;
1889
+ let e = Dn.get(this);
1890
+ return e || (e = l(() => this.children.some((e) => e.busy)), Dn.set(this, e)), e.value;
1818
1891
  }
1819
1892
  childValidatingChanged(e) {
1820
1893
  let t = this.validating;
@@ -1823,7 +1896,11 @@ var xn = class extends q {
1823
1896
  childValidityChanged(e) {
1824
1897
  this.raw.invalidChildren += e ? -1 : 1;
1825
1898
  }
1826
- }, wn = Object.freeze([]), Tn = class e extends J {
1899
+ }, On = Object.freeze([]);
1900
+ function kn(e, t) {
1901
+ if (!Number.isInteger(e)) throw RangeError(`List.${t}(): the index must be an integer, got ${e}`);
1902
+ }
1903
+ var An = class e extends J {
1827
1904
  get [Symbol.toStringTag]() {
1828
1905
  return "List";
1829
1906
  }
@@ -1835,7 +1912,7 @@ var xn = class extends q {
1835
1912
  }
1836
1913
  _itemTemplate;
1837
1914
  constructor(t, n) {
1838
- super(ot()), this._itemTemplate = t, t && Re(t), w(() => {
1915
+ super(st()), this._itemTemplate = t, t && Re(t), w(() => {
1839
1916
  if (n) {
1840
1917
  let { value: e, validators: t, actions: r, ...i } = n;
1841
1918
  this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
@@ -1852,13 +1929,13 @@ var xn = class extends q {
1852
1929
  }
1853
1930
  processSetValueItem(t) {
1854
1931
  let n;
1855
- return n = t instanceof B ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
1932
+ return n = t instanceof U ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
1856
1933
  }
1857
1934
  static elementFor(t) {
1858
- return oe(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
1935
+ return ae(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
1859
1936
  }
1860
1937
  createPaddingItem(t) {
1861
- return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || oe(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
1938
+ return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ae(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
1862
1939
  }
1863
1940
  rowsChanged() {
1864
1941
  this.state.rowsVersion++;
@@ -1894,7 +1971,7 @@ var xn = class extends q {
1894
1971
  let n = Array(t.length);
1895
1972
  for (let r = 0; r < t.length; r++) {
1896
1973
  let i = t[r], s = e[r], c = this._itemTemplate;
1897
- s && c && !(i instanceof B) && s.declaration === c.declaration ? (this.resetChild(s, c, i), n[r] = s) : (s && (this.releaseChild(s), a(s, r)), n[r] = this.processSetValueItem(i), o(n[r], r));
1974
+ s && c && !(i instanceof U) && s.declaration === c.declaration ? (this.resetChild(s, c, i), n[r] = s) : (s && (this.releaseChild(s), a(s, r)), n[r] = this.processSetValueItem(i), o(n[r], r));
1898
1975
  }
1899
1976
  for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
1900
1977
  this.raw.rows = n;
@@ -1914,7 +1991,7 @@ var xn = class extends q {
1914
1991
  case "null": t.push(null);
1915
1992
  }
1916
1993
  });
1917
- let n = t.length ? Object.freeze(t) : wn;
1994
+ let n = t.length ? Object.freeze(t) : On;
1918
1995
  return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
1919
1996
  }
1920
1997
  set value(e) {
@@ -1969,6 +2046,7 @@ var xn = class extends q {
1969
2046
  return this.remove((this.raw.rows?.length ?? 0) - 1);
1970
2047
  }
1971
2048
  remove(e) {
2049
+ kn(e, "remove");
1972
2050
  let t;
1973
2051
  return w((n) => {
1974
2052
  let r = this.raw.rows;
@@ -1983,6 +2061,7 @@ var xn = class extends q {
1983
2061
  }), t;
1984
2062
  }
1985
2063
  insert(e, t) {
2064
+ kn(t, "insert");
1986
2065
  let n = 0;
1987
2066
  return w((r) => {
1988
2067
  r.touch(this);
@@ -2006,7 +2085,7 @@ var xn = class extends q {
2006
2085
  releaseRows() {
2007
2086
  this.raw.rows?.forEach((e) => this.releaseChild(e));
2008
2087
  }
2009
- [ct](e) {
2088
+ [lt](e) {
2010
2089
  w((t) => {
2011
2090
  t.touch(this), this.raw.rows = [...e], this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2012
2091
  });
@@ -2026,13 +2105,16 @@ var xn = class extends q {
2026
2105
  rebind(e) {
2027
2106
  return super.rebind(e);
2028
2107
  }
2029
- };
2108
+ }, jn = /* @__PURE__ */ new WeakSet();
2109
+ function Mn(e) {
2110
+ if (e === "$" || e === "then" || e.startsWith("__v_")) throw TypeError(`A view cannot hold a member named ${e}: $ is the element the view stands for, and then and __v_* are read by the language and by Vue`);
2111
+ }
2030
2112
  //#endregion
2031
2113
  //#region src/group.ts
2032
- function En(e) {
2033
- return oe(e) ? Y.createFromFormData(e) : Array.isArray(e) ? new Tn(void 0, { value: e }) : new q({ value: e });
2114
+ function Nn(e) {
2115
+ return ae(e) ? Y.createFromFormData(e) : Array.isArray(e) ? new An(void 0, { value: e }) : new q({ value: e });
2034
2116
  }
2035
- var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE__ */ new WeakMap(), An = (e) => ({
2117
+ var Pn = /* @__PURE__ */ new WeakSet(), Fn = Object.freeze({}), In = /* @__PURE__ */ new WeakMap(), Ln = (e) => ({
2036
2118
  get(t, n, r) {
2037
2119
  return e(), Reflect.get(t, n, r);
2038
2120
  },
@@ -2066,17 +2148,17 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2066
2148
  }
2067
2149
  _fields;
2068
2150
  constructor(t, n) {
2069
- if (super(at()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
2151
+ if (super(ot()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
2070
2152
  this._fields = Object.create(null), w(() => {
2071
2153
  let r = !1, i = !1;
2072
- Dn.add(this);
2154
+ Pn.add(this);
2073
2155
  try {
2074
2156
  if (Object.entries(t).forEach(([e, t]) => this.addField(e, t)), n) {
2075
2157
  let { value: e, validators: t, actions: a, ...o } = n;
2076
2158
  this.registerInitialActions([...t || [], ...a || []]), this.assignParams(o), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e), r = e !== void 0 || this.originalValue !== void 0, i = n.originalValue !== void 0 && e !== void 0;
2077
2159
  }
2078
2160
  } finally {
2079
- Dn.delete(this);
2161
+ Pn.delete(this);
2080
2162
  }
2081
2163
  this.completeRecords(), this.constructed(n);
2082
2164
  let a = this.value;
@@ -2100,7 +2182,7 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2100
2182
  addField(t, n) {
2101
2183
  return w((r) => {
2102
2184
  if (Object.hasOwn(this._fields, t)) throw Error(`Field ${t} is already in this form`);
2103
- this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Dn.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
2185
+ jn.has(this) && Mn(t), this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Pn.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
2104
2186
  }), this;
2105
2187
  }
2106
2188
  removeField(t) {
@@ -2108,7 +2190,9 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2108
2190
  return w((r) => {
2109
2191
  if (!Object.hasOwn(this._fields, t)) return;
2110
2192
  let i = this._fields[t];
2111
- r.touch(this), this.releaseChild(i), e.dropEntry(this._fields, t), r.whenRolledBack(() => e.setEntry(this._fields, t, i)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
2193
+ r.touch(this), this.releaseChild(i);
2194
+ let a = Object.entries(this._fields);
2195
+ e.dropEntry(this._fields, t), r.whenRolledBack(() => e.restoreEntries(this._fields, a)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
2112
2196
  }), n;
2113
2197
  }
2114
2198
  static setEntry(e, t, n) {
@@ -2117,22 +2201,25 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2117
2201
  static dropEntry(e, t) {
2118
2202
  delete e[t];
2119
2203
  }
2204
+ static restoreEntries(t, n) {
2205
+ Object.keys(t).forEach((n) => e.dropEntry(t, n)), n.forEach(([n, r]) => e.setEntry(t, n, r));
2206
+ }
2120
2207
  static isValidFields(e) {
2121
2208
  function t(e) {
2122
- return e instanceof B;
2209
+ return e instanceof U;
2123
2210
  }
2124
2211
  return typeof e == "object" && !!e && Object.entries(e).every(([, e]) => t(e));
2125
2212
  }
2126
2213
  static createFromFormData(t) {
2127
- if (t instanceof B) throw Error("data is already a Form structure, should be a simple object");
2128
- return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, En(t)])));
2214
+ if (t instanceof U) throw Error("data is already a Form structure, should be a simple object");
2215
+ return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, Nn(t)])));
2129
2216
  }
2130
2217
  field(e) {
2131
2218
  return this._fields[e] ?? null;
2132
2219
  }
2133
2220
  get fields() {
2134
- let e = kn.get(this);
2135
- return e || (e = new Proxy(this._fields, An(() => this.state.fieldNames.length)), kn.set(this, e)), e;
2221
+ let e = In.get(this);
2222
+ return e || (e = new Proxy(this._fields, Ln(() => this.state.fieldNames.length)), In.set(this, e)), e;
2136
2223
  }
2137
2224
  get members() {
2138
2225
  return this.raw.fieldNames.map((e) => this._fields[e]);
@@ -2152,7 +2239,7 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2152
2239
  case "null": t[e] = null;
2153
2240
  }
2154
2241
  });
2155
- let n = re(t) ? On : Object.freeze({ ...t });
2242
+ let n = ne(t) ? Fn : Object.freeze({ ...t });
2156
2243
  return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
2157
2244
  }
2158
2245
  assignMembers(e) {
@@ -2215,47 +2302,56 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
2215
2302
  };
2216
2303
  //#endregion
2217
2304
  //#region src/is-equal.ts
2218
- function jn(e, t) {
2219
- let n = e instanceof B ? e.value : e, r = t instanceof B ? t.value : t;
2220
- return n === e && r === t ? void 0 : m(n, r);
2305
+ function Rn(e, t) {
2306
+ let n = e instanceof U ? e.value : e, r = t instanceof U ? t.value : t;
2307
+ return n === e && r === t ? void 0 : h(n, r);
2221
2308
  }
2222
- function Mn(e, t) {
2223
- return e instanceof B && t instanceof B ? m(e.value, t.value) : ie(e, t, jn);
2309
+ function zn(e, t) {
2310
+ return e instanceof U && t instanceof U ? h(e.value, t.value) : re(e, t, Rn);
2224
2311
  }
2225
2312
  //#endregion
2226
2313
  //#region src/validators/validator-compare-to.ts
2227
- var Nn = class extends M {
2314
+ var Bn = class extends P {
2228
2315
  isValidComparison;
2229
2316
  otherField;
2230
2317
  registrations = /* @__PURE__ */ new WeakSet();
2231
- listening = /* @__PURE__ */ new WeakSet();
2232
- declarations = /* @__PURE__ */ new Set();
2318
+ listening = new Pt();
2319
+ declarations = new Pt();
2320
+ relay;
2233
2321
  constructor(e, t, n) {
2234
2322
  super((e, t, r) => {
2235
2323
  this.comparisonState(r).oldValue = t;
2236
2324
  let i = this.resolve(r);
2237
2325
  if (!i) return r.markRecordIncomplete(), null;
2238
2326
  this.listenOn(i);
2239
- let a = f(i.value);
2240
- return this.isValidComparison(f(e), a) ? null : [this.errorFor(n, "compare_to", "Value does not match the comparison with {otherValue}", {
2327
+ let a = m(i.value);
2328
+ return this.isValidComparison(m(e), a) ? null : [this.errorFor(n, "compare_to", "Value does not match the comparison with {otherValue}", {
2241
2329
  newValue: e,
2242
2330
  oldValue: t,
2243
2331
  otherValue: a
2244
2332
  })];
2245
- }), this.isValidComparison = t, this.otherField = e;
2333
+ }), this.isValidComparison = t, this.otherField = e, this.relay = new N((e, t, n, r) => {
2334
+ t(e, n, r);
2335
+ let i = F(e);
2336
+ this.declarations.alive.forEach((e) => Mt(e, i).forEach((e) => {
2337
+ this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
2338
+ }));
2339
+ }), this.relay[et] = () => {
2340
+ this.declarations.alive.length === 0 && this.stopListening();
2341
+ };
2246
2342
  }
2247
2343
  resolve(e) {
2248
2344
  let t = this.otherField;
2249
- return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Ft(t, e) : Nt(t, N(e));
2345
+ return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Nt(t, e) : jt(t, F(e));
2250
2346
  }
2251
2347
  listenOn(e) {
2252
- this.listening.has(e) || this.listening.has(e.declaration) || (this.listening.add(e), e.registerAction(new j((e, t, n, r) => {
2253
- t(e, n, r);
2254
- let i = N(e);
2255
- this.declarations.forEach((e) => Pt(e, i).forEach((e) => {
2256
- this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
2257
- }));
2258
- })));
2348
+ this.listening.has(e.declaration) || (this.listening.add(e.declaration), e.registerAction(this.relay));
2349
+ }
2350
+ stopListening() {
2351
+ let e = this.listening.alive;
2352
+ e.length !== 0 && (S()?.whenRolledBack(() => e.forEach((e) => this.listening.add(e))), e.forEach((e) => {
2353
+ this.listening.delete(e), e.unregisterAction(this.relay);
2354
+ }));
2259
2355
  }
2260
2356
  boundToBinding(e) {
2261
2357
  this.declarations.add(e.declaration), this.registrations.add(e);
@@ -2270,25 +2366,25 @@ var Nn = class extends M {
2270
2366
  };
2271
2367
  }
2272
2368
  unregisterFrom(e) {
2273
- super.unregisterFrom(e), this.registrations.delete(e);
2369
+ super.unregisterFrom(e), this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
2274
2370
  }
2275
2371
  };
2276
2372
  //#endregion
2277
2373
  //#region src/validators/value-checks.ts
2278
2374
  function X(e) {
2279
2375
  if (e == null) return 0;
2280
- if (ne(e) || h(e)) return e.length;
2376
+ if (te(e) || g(e)) return e.length;
2281
2377
  if (e instanceof Map || e instanceof Set) return e.size;
2282
- if (ae(e)) {
2378
+ if (ie(e)) {
2283
2379
  let t = Object.getPrototypeOf(e);
2284
2380
  if (t === Object.prototype || t === null) return Object.keys(e).length;
2285
2381
  }
2286
2382
  return String(e).length;
2287
2383
  }
2288
2384
  function Z(e) {
2289
- return X(e) === 0 && (e == null || h(e) || ne(e) || ae(e));
2385
+ return X(e) === 0 && (e == null || g(e) || te(e) || ie(e));
2290
2386
  }
2291
- function Pn(e, t) {
2387
+ function Vn(e, t) {
2292
2388
  if (e instanceof Date && t instanceof Date) {
2293
2389
  let n = e.getTime() - t.getTime();
2294
2390
  return Number.isNaN(n) ? void 0 : n;
@@ -2298,23 +2394,23 @@ function Pn(e, t) {
2298
2394
  }
2299
2395
  //#endregion
2300
2396
  //#region src/validators/validator-in-allowed-values.ts
2301
- var Fn = class extends M {
2397
+ var Hn = class extends P {
2302
2398
  constructor(e, t) {
2303
2399
  let n = () => {
2304
- let t = f(e);
2400
+ let t = m(e);
2305
2401
  return typeof t == "function" ? t() : t;
2306
2402
  }, r = (e) => {
2307
2403
  let t = e.join(", ");
2308
- return t.length <= 60 ? t : se(t, {
2404
+ return t.length <= 60 ? t : oe(t, {
2309
2405
  length: 40,
2310
2406
  separator: ", ",
2311
2407
  omission: `... (${e.length} items total)`
2312
2408
  });
2313
2409
  };
2314
2410
  super((e, i) => {
2315
- if (Z(f(e))) return null;
2411
+ if (Z(m(e))) return null;
2316
2412
  let a = n();
2317
- return a.includes(f(e)) ? null : [this.errorFor(t, "in_allowed_values", "Must be one of [{allowedAsText}]", {
2413
+ return a.includes(m(e)) ? null : [this.errorFor(t, "in_allowed_values", "Must be one of [{allowedAsText}]", {
2318
2414
  newValue: e,
2319
2415
  oldValue: i,
2320
2416
  allowedValues: a,
@@ -2322,22 +2418,22 @@ var Fn = class extends M {
2322
2418
  })];
2323
2419
  });
2324
2420
  }
2325
- }, In = class extends M {
2421
+ }, Un = class extends P {
2326
2422
  constructor(e) {
2327
2423
  let t = e?.trim ?? !0;
2328
2424
  super((n, r) => {
2329
- let i = f(n);
2330
- return X(t && h(i) ? i.trim() : i) === 0 ? [this.errorFor(e, "required", "Please enter a value", {
2425
+ let i = m(n);
2426
+ return X(t && g(i) ? i.trim() : i) === 0 ? [this.errorFor(e, "required", "Please enter a value", {
2331
2427
  newValue: n,
2332
2428
  oldValue: r
2333
2429
  })] : null;
2334
2430
  });
2335
2431
  }
2336
- }, Ln = class extends M {
2432
+ }, Wn = class extends P {
2337
2433
  constructor(e, t) {
2338
2434
  super((n, r) => {
2339
2435
  if (Z(n)) return null;
2340
- let i = Pn(n, e);
2436
+ let i = Vn(n, e);
2341
2437
  return i === void 0 || i < 0 ? [this.errorFor(t, "min_value", "Value must be larger or equal to {minValue}", {
2342
2438
  newValue: n,
2343
2439
  oldValue: r,
@@ -2345,11 +2441,11 @@ var Fn = class extends M {
2345
2441
  })] : null;
2346
2442
  });
2347
2443
  }
2348
- }, Rn = class extends M {
2444
+ }, Gn = class extends P {
2349
2445
  constructor(e, t) {
2350
2446
  super((n, r) => {
2351
2447
  if (Z(n)) return null;
2352
- let i = Pn(n, e);
2448
+ let i = Vn(n, e);
2353
2449
  return i === void 0 || i > 0 ? [this.errorFor(t, "max_value", "Value must be less than or equal to {maxValue}", {
2354
2450
  newValue: n,
2355
2451
  oldValue: r,
@@ -2357,11 +2453,11 @@ var Fn = class extends M {
2357
2453
  })] : null;
2358
2454
  });
2359
2455
  }
2360
- }, zn = class extends M {
2456
+ }, Kn = class extends P {
2361
2457
  constructor(e, t, n) {
2362
2458
  super((r, i) => {
2363
2459
  if (Z(r)) return null;
2364
- let a = Pn(r, e), o = Pn(r, t);
2460
+ let a = Vn(r, e), o = Vn(r, t);
2365
2461
  return a === void 0 || o === void 0 || a < 0 || o > 0 ? [this.errorFor(n, "value_in_range", "Value must be between {minValue} and {maxValue}", {
2366
2462
  newValue: r,
2367
2463
  oldValue: i,
@@ -2370,7 +2466,7 @@ var Fn = class extends M {
2370
2466
  })] : null;
2371
2467
  });
2372
2468
  }
2373
- }, Bn = class extends M {
2469
+ }, qn = class extends P {
2374
2470
  constructor(e, t) {
2375
2471
  super((n, r) => Z(n) ? null : X(n) < e ? [this.errorFor(t, "min_length", "Length must be larger or equal to {minLength}", {
2376
2472
  newValue: n,
@@ -2378,7 +2474,7 @@ var Fn = class extends M {
2378
2474
  minLength: e
2379
2475
  })] : null);
2380
2476
  }
2381
- }, Vn = class extends M {
2477
+ }, Jn = class extends P {
2382
2478
  constructor(e, t) {
2383
2479
  super((n, r) => Z(n) ? null : X(n) > e ? [this.errorFor(t, "max_length", "Length must be less than or equal to {maxLength}", {
2384
2480
  newValue: n,
@@ -2386,7 +2482,7 @@ var Fn = class extends M {
2386
2482
  maxLength: e
2387
2483
  })] : null);
2388
2484
  }
2389
- }, Hn = class extends M {
2485
+ }, Yn = class extends P {
2390
2486
  constructor(e, t, n) {
2391
2487
  super((r, i) => {
2392
2488
  if (Z(r)) return null;
@@ -2399,11 +2495,11 @@ var Fn = class extends M {
2399
2495
  })] : null;
2400
2496
  });
2401
2497
  }
2402
- }, Un = class extends M {
2498
+ }, Xn = class extends P {
2403
2499
  constructor(e, t) {
2404
2500
  let n = /[gy]/.test(e.flags) ? new RegExp(e.source, e.flags.replace(/[gy]/g, "")) : e;
2405
2501
  super((r, i) => {
2406
- let a = f(r);
2502
+ let a = m(r);
2407
2503
  return Z(a) || n.test(String(a)) ? null : [this.errorFor(t, "pattern", "Value must match pattern \"{pattern}\"", {
2408
2504
  newValue: r,
2409
2505
  oldValue: i,
@@ -2411,20 +2507,20 @@ var Fn = class extends M {
2411
2507
  })];
2412
2508
  });
2413
2509
  }
2414
- }, Wn = /* @__PURE__ */ le({
2415
- CompareTo: () => Nn,
2416
- InAllowedValues: () => Fn,
2417
- LengthInRange: () => Hn,
2418
- MaxLength: () => Vn,
2419
- MaxValue: () => Rn,
2420
- MinLength: () => Bn,
2421
- MinValue: () => Ln,
2422
- Pattern: () => Un,
2423
- Required: () => In,
2424
- Validator: () => M,
2425
- ValueInRange: () => zn,
2510
+ }, Zn = /* @__PURE__ */ ce({
2511
+ CompareTo: () => Bn,
2512
+ InAllowedValues: () => Hn,
2513
+ LengthInRange: () => Yn,
2514
+ MaxLength: () => Jn,
2515
+ MaxValue: () => Gn,
2516
+ MinLength: () => qn,
2517
+ MinValue: () => Wn,
2518
+ Pattern: () => Xn,
2519
+ Required: () => Un,
2520
+ Validator: () => P,
2521
+ ValueInRange: () => Kn,
2426
2522
  isEmptyValue: () => Z
2427
- }), Gn = /* @__PURE__ */ new WeakMap(), Kn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new Set([
2523
+ }), Qn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new Set([
2428
2524
  "push",
2429
2525
  "pop",
2430
2526
  "shift",
@@ -2435,19 +2531,23 @@ var Fn = class extends M {
2435
2531
  "fill",
2436
2532
  "copyWithin"
2437
2533
  ]);
2438
- function Jn(e) {
2534
+ function tr(e) {
2439
2535
  return typeof e == "string" && /^(0|[1-9]\d*)$/.test(e);
2440
2536
  }
2537
+ function nr(e) {
2538
+ let t = Math.trunc(Number(e));
2539
+ return Number.isNaN(t) ? 0 : t;
2540
+ }
2441
2541
  function Q(e) {
2442
- return typeof e == "object" && !!e && Kn.get(e) || e;
2542
+ return typeof e == "object" && !!e && $n.get(e) || e;
2443
2543
  }
2444
2544
  function $(e) {
2445
- return e instanceof J ? tr(e) : e.value;
2545
+ return e instanceof J ? cr(e) : e.value;
2446
2546
  }
2447
- function Yn(e, t) {
2448
- e.value = Q(t) instanceof B ? Q(t).value : t;
2547
+ function rr(e, t) {
2548
+ e.value = Q(t) instanceof U ? Q(t).value : t;
2449
2549
  }
2450
- function Xn(e) {
2550
+ function ir(e) {
2451
2551
  return e === "__v_skip" ? {
2452
2552
  answered: !0,
2453
2553
  value: !0
@@ -2456,11 +2556,11 @@ function Xn(e) {
2456
2556
  value: void 0
2457
2557
  } : { answered: !1 };
2458
2558
  }
2459
- function Zn(e) {
2559
+ function ar(e) {
2460
2560
  let t = (t) => typeof t == "string" && t !== "$" ? e.field(t) ?? void 0 : void 0, n = () => Object.keys(e.fields);
2461
2561
  return {
2462
2562
  get(n, r) {
2463
- let i = Xn(r);
2563
+ let i = ir(r);
2464
2564
  if (i.answered) return i.value;
2465
2565
  if (r === "$") return e;
2466
2566
  if (r === Symbol.toStringTag) return "View";
@@ -2471,7 +2571,7 @@ function Zn(e) {
2471
2571
  if (n === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
2472
2572
  let i = t(n);
2473
2573
  if (!i) throw TypeError(`${String(n)} is not a member of this group - use $.addField() to add one`);
2474
- return Yn(i, r), !0;
2574
+ return rr(i, r), !0;
2475
2575
  },
2476
2576
  has(e, t) {
2477
2577
  return t === "$" || typeof t == "string" && n().includes(t);
@@ -2495,9 +2595,9 @@ function Zn(e) {
2495
2595
  }
2496
2596
  };
2497
2597
  }
2498
- function Qn(e) {
2598
+ function or(e) {
2499
2599
  let t = () => e.items, n = (t) => Math.min(t, e.length), r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (t) => C(() => {
2500
- e[ct](t);
2600
+ e[lt](t);
2501
2601
  }), a = {
2502
2602
  push: (...n) => (C(() => n.forEach((t) => e.push(Q(t)))), t().length),
2503
2603
  pop: () => {
@@ -2516,16 +2616,16 @@ function Qn(e) {
2516
2616
  let t = n(0);
2517
2617
  r.forEach((n, r) => e.insert(Q(n), t + r));
2518
2618
  }), t().length),
2519
- splice: (i, a, ...o) => {
2520
- let s = [];
2619
+ splice: (...i) => {
2620
+ let [a, o, ...s] = i, c = [];
2521
2621
  return C(() => {
2522
- let c = t(), l = r(Math.trunc(i) || 0, c.length), ee = a === void 0 ? c.length - l : Math.max(0, Math.min(a, c.length - l));
2523
- c.slice(l, l + ee).forEach((t) => {
2524
- s.push($(t)), e.remove(e.items.indexOf(t));
2622
+ let l = t(), u = r(nr(a), l.length), d = 0;
2623
+ i.length === 1 ? d = l.length - u : i.length > 1 && (d = Math.max(0, Math.min(nr(o), l.length - u))), l.slice(u, u + d).forEach((t) => {
2624
+ c.push($(t)), e.remove(e.items.indexOf(t));
2525
2625
  });
2526
- let u = n(l);
2527
- o.forEach((t, n) => e.insert(Q(t), u + n));
2528
- }), s;
2626
+ let f = n(u);
2627
+ s.forEach((t, n) => e.insert(Q(t), f + n));
2628
+ }), c;
2529
2629
  },
2530
2630
  sort: (e) => {
2531
2631
  let n = t().map((e) => ({
@@ -2548,31 +2648,33 @@ function Qn(e) {
2548
2648
  }, o;
2549
2649
  return o = new Proxy([], {
2550
2650
  get(n, r, i) {
2551
- let o = Xn(r);
2651
+ let o = ir(r);
2552
2652
  if (o.answered) return o.value;
2553
2653
  if (r === "$") return e;
2554
2654
  if (r === "length") return t().length;
2555
- if (Jn(r)) {
2655
+ if (tr(r)) {
2556
2656
  let e = t()[Number(r)];
2557
2657
  return e ? $(e) : void 0;
2558
2658
  }
2559
- return typeof r == "string" && qn.has(r) ? a[r] : Reflect.get(n, r, i);
2659
+ return typeof r == "string" && er.has(r) ? a[r] : Reflect.get(n, r, i);
2560
2660
  },
2561
2661
  set(r, i, a) {
2562
2662
  if (i === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
2563
2663
  if (i === "length") {
2564
- let n = Number(a), r = t();
2664
+ let n = Number(a);
2665
+ if (!Number.isInteger(n) || n < 0 || n > 2 ** 32 - 1) throw RangeError("Invalid array length");
2666
+ let r = t();
2565
2667
  if (n > r.length) throw TypeError("a list view grows by push(), not by its length");
2566
2668
  return C(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
2567
2669
  }
2568
- if (Jn(i)) {
2670
+ if (tr(i)) {
2569
2671
  let r = Number(i), o = t();
2570
- return r < o.length ? Yn(o[r], a) : e.insert(Q(a), n(o.length) + (r - o.length)), !0;
2672
+ return r < o.length ? rr(o[r], a) : e.insert(Q(a), n(o.length) + (r - o.length)), !0;
2571
2673
  }
2572
2674
  throw TypeError(`${String(i)} cannot be set on a list view`);
2573
2675
  },
2574
2676
  has(e, n) {
2575
- return n === "$" || n === "length" ? !0 : Jn(n) ? Number(n) < t().length : Reflect.has(e, n);
2677
+ return n === "$" || n === "length" ? !0 : tr(n) ? Number(n) < t().length : Reflect.has(e, n);
2576
2678
  },
2577
2679
  ownKeys() {
2578
2680
  return [...t().map((e, t) => String(t)), "length"];
@@ -2584,7 +2686,7 @@ function Qn(e) {
2584
2686
  enumerable: !1,
2585
2687
  configurable: !1
2586
2688
  };
2587
- if (!(!Jn(n) || Number(n) >= t().length)) return {
2689
+ if (!(!tr(n) || Number(n) >= t().length)) return {
2588
2690
  value: $(t()[Number(n)]),
2589
2691
  writable: !0,
2590
2692
  enumerable: !0,
@@ -2599,10 +2701,10 @@ function Qn(e) {
2599
2701
  }
2600
2702
  }), o;
2601
2703
  }
2602
- function $n(e) {
2704
+ function sr(e) {
2603
2705
  return {
2604
2706
  get(t, n) {
2605
- let r = Xn(n);
2707
+ let r = ir(n);
2606
2708
  if (r.answered) return r.value;
2607
2709
  if (n === "$") return e;
2608
2710
  },
@@ -2617,74 +2719,69 @@ function $n(e) {
2617
2719
  }
2618
2720
  };
2619
2721
  }
2620
- function er(e) {
2621
- Object.keys(e.fields).forEach((e) => {
2622
- if (e === "$" || e === "then" || e.startsWith("__v_")) throw TypeError(`A view cannot hold a member named ${e}: $ is the element the view stands for, and then and __v_* are read by the language and by Vue`);
2623
- });
2624
- }
2625
- function tr(e) {
2626
- if (Kn.has(e)) return e;
2627
- let t = Gn.get(e);
2722
+ function cr(e) {
2723
+ if ($n.has(e)) return e;
2724
+ let t = Qn.get(e);
2628
2725
  if (t) return t;
2629
2726
  let n;
2630
- return e instanceof Y ? (er(e), n = new Proxy({}, Zn(e))) : n = e instanceof Tn ? Qn(e) : new Proxy({}, $n(e)), Gn.set(e, n), Kn.set(n, e), n;
2727
+ return e instanceof Y ? (Object.keys(e.fields).forEach(Mn), jn.add(e), n = new Proxy({}, ar(e))) : n = e instanceof An ? or(e) : new Proxy({}, sr(e)), Qn.set(e, n), $n.set(n, e), n;
2631
2728
  }
2632
2729
  //#endregion
2633
2730
  //#region src/index.ts
2634
- var nr = /* @__PURE__ */ le({
2731
+ var lr = /* @__PURE__ */ ce({
2635
2732
  AbortEventHandlingException: () => E,
2636
- AccessChangedAction: () => Ut,
2637
- AccessChangingAction: () => Vt,
2638
- Action: () => xn,
2639
- ActionsMap: () => At,
2640
- CommandException: () => U,
2641
- ConditionalAccessAction: () => Rt,
2642
- ConditionalStatementAction: () => P,
2643
- ConditionalValueAction: () => zt,
2644
- ConditionalVisibilityAction: () => Lt,
2733
+ AccessChangedAction: () => Ht,
2734
+ AccessChangingAction: () => Bt,
2735
+ Action: () => Tn,
2736
+ ActionsMap: () => Ot,
2737
+ CommandException: () => gn,
2738
+ ConditionalAccessAction: () => Lt,
2739
+ ConditionalStatementAction: () => I,
2740
+ ConditionalValueAction: () => Rt,
2741
+ ConditionalVisibilityAction: () => It,
2645
2742
  Container: () => J,
2646
- ContributionChangedAction: () => Gt,
2647
- EnabledChangedAction: () => Yt,
2648
- EnabledChangingAction: () => qt,
2649
- ErrorPolicy: () => A,
2650
- ExecuteAction: () => V,
2743
+ ContributionChangedAction: () => Wt,
2744
+ EnabledChangedAction: () => Jt,
2745
+ EnabledChangingAction: () => Kt,
2746
+ ErrorPolicy: () => M,
2747
+ ExecuteAction: () => W,
2651
2748
  Field: () => q,
2652
2749
  FieldActionBase: () => T,
2653
- FieldBase: () => B,
2750
+ FieldBase: () => U,
2654
2751
  Group: () => Y,
2655
- List: () => Tn,
2752
+ List: () => An,
2656
2753
  ListItemAddedAction: () => G,
2657
2754
  ListItemRemovedAction: () => K,
2658
- Operator: () => I,
2659
- RejectAction: () => gn,
2660
- Statement: () => dn,
2661
- SubmitAction: () => hn,
2662
- SubmitFailedException: () => mn,
2663
- SubmitRefusedException: () => W,
2664
- TargetedExecuteAction: () => H,
2665
- ValidChangedAction: () => Zt,
2666
- ValidationError: () => Dt,
2667
- Validators: () => Wn,
2668
- ValueChangedAction: () => j,
2669
- VisibilityChangedAction: () => tn,
2670
- VisibilityChangingAction: () => $t,
2671
- accessValues: () => g,
2755
+ Operator: () => R,
2756
+ RejectAction: () => bn,
2757
+ Statement: () => fn,
2758
+ SubmitAction: () => yn,
2759
+ SubmitFailedException: () => _n,
2760
+ SubmitRefusedException: () => vn,
2761
+ TargetedExecuteAction: () => mn,
2762
+ ValidChangedAction: () => Xt,
2763
+ ValidationError: () => Tt,
2764
+ Validators: () => Zn,
2765
+ ValueChangedAction: () => N,
2766
+ VisibilityChangedAction: () => en,
2767
+ VisibilityChangingAction: () => Qt,
2768
+ accessValues: () => _,
2672
2769
  configureDevtools: () => Ce,
2673
- defaultAccess: () => ue,
2770
+ defaultAccess: () => le,
2674
2771
  defaultVisibility: () => fe,
2675
2772
  describeState: () => xe,
2676
- errorRemovals: () => pt,
2773
+ errorRemovals: () => O,
2677
2774
  hideState: () => Se,
2678
2775
  installPlugin: () => Pe,
2679
- isAccess: () => de,
2680
- isEqual: () => Mn,
2776
+ isAccess: () => ue,
2777
+ isEqual: () => zn,
2681
2778
  isVisibility: () => pe,
2682
- setDefaultErrorPolicies: () => St,
2779
+ setDefaultErrorPolicies: () => bt,
2683
2780
  transaction: () => C,
2684
- view: () => tr,
2685
- visibilityValues: () => _
2781
+ view: () => cr,
2782
+ visibilityValues: () => de
2686
2783
  });
2687
2784
  //#endregion
2688
- export { E as AbortEventHandlingException, Ut as AccessChangedAction, Vt as AccessChangingAction, xn as Action, At as ActionsMap, U as CommandException, Rt as ConditionalAccessAction, P as ConditionalStatementAction, zt as ConditionalValueAction, Lt as ConditionalVisibilityAction, J as Container, Gt as ContributionChangedAction, Yt as EnabledChangedAction, qt as EnabledChangingAction, A as ErrorPolicy, V as ExecuteAction, q as Field, T as FieldActionBase, B as FieldBase, Y as Group, Tn as List, G as ListItemAddedAction, K as ListItemRemovedAction, I as Operator, gn as RejectAction, dn as Statement, hn as SubmitAction, mn as SubmitFailedException, W as SubmitRefusedException, H as TargetedExecuteAction, Zt as ValidChangedAction, Dt as ValidationError, Wn as Validators, j as ValueChangedAction, tn as VisibilityChangedAction, $t as VisibilityChangingAction, g as accessValues, Ce as configureDevtools, nr as default, ue as defaultAccess, fe as defaultVisibility, xe as describeState, pt as errorRemovals, Se as hideState, Pe as installPlugin, de as isAccess, Mn as isEqual, pe as isVisibility, St as setDefaultErrorPolicies, C as transaction, tr as view, _ as visibilityValues };
2785
+ export { E as AbortEventHandlingException, Ht as AccessChangedAction, Bt as AccessChangingAction, Tn as Action, Ot as ActionsMap, gn as CommandException, Lt as ConditionalAccessAction, I as ConditionalStatementAction, Rt as ConditionalValueAction, It as ConditionalVisibilityAction, J as Container, Wt as ContributionChangedAction, Jt as EnabledChangedAction, Kt as EnabledChangingAction, M as ErrorPolicy, W as ExecuteAction, q as Field, T as FieldActionBase, U as FieldBase, Y as Group, An as List, G as ListItemAddedAction, K as ListItemRemovedAction, R as Operator, bn as RejectAction, fn as Statement, yn as SubmitAction, _n as SubmitFailedException, vn as SubmitRefusedException, mn as TargetedExecuteAction, Xt as ValidChangedAction, Tt as ValidationError, Zn as Validators, N as ValueChangedAction, en as VisibilityChangedAction, Qt as VisibilityChangingAction, _ as accessValues, Ce as configureDevtools, lr as default, le as defaultAccess, fe as defaultVisibility, xe as describeState, O as errorRemovals, Se as hideState, Pe as installPlugin, ue as isAccess, zn as isEqual, pe as isVisibility, bt as setDefaultErrorPolicies, C as transaction, cr as view, de as visibilityValues };
2689
2786
 
2690
2787
  //# sourceMappingURL=dynamicforms-vue-forms.js.map