@dynamicforms/vue-forms 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,69 +1,69 @@
1
1
  var Gt = Object.defineProperty, Yt = Object.defineProperties;
2
2
  var Jt = Object.getOwnPropertyDescriptors;
3
- var q = Object.getOwnPropertySymbols;
4
- var mt = Object.prototype.hasOwnProperty, bt = Object.prototype.propertyIsEnumerable;
5
- var vt = (n) => {
3
+ var W = Object.getOwnPropertySymbols;
4
+ var ft = Object.prototype.hasOwnProperty, pt = Object.prototype.propertyIsEnumerable;
5
+ var mt = (n) => {
6
6
  throw TypeError(n);
7
7
  };
8
8
  var K = (n, e, t) => e in n ? Gt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e) => {
9
9
  for (var t in e || (e = {}))
10
- mt.call(e, t) && K(n, t, e[t]);
11
- if (q)
12
- for (var t of q(e))
13
- bt.call(e, t) && K(n, t, e[t]);
10
+ ft.call(e, t) && K(n, t, e[t]);
11
+ if (W)
12
+ for (var t of W(e))
13
+ pt.call(e, t) && K(n, t, e[t]);
14
14
  return n;
15
- }, x = (n, e) => Yt(n, Jt(e));
15
+ }, C = (n, e) => Yt(n, Jt(e));
16
16
  var k = (n, e) => {
17
17
  var t = {};
18
18
  for (var s in n)
19
- mt.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
20
- if (n != null && q)
21
- for (var s of q(n))
22
- e.indexOf(s) < 0 && bt.call(n, s) && (t[s] = n[s]);
19
+ ft.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
20
+ if (n != null && W)
21
+ for (var s of W(n))
22
+ e.indexOf(s) < 0 && pt.call(n, s) && (t[s] = n[s]);
23
23
  return t;
24
24
  };
25
- var d = (n, e, t) => K(n, typeof e != "symbol" ? e + "" : e, t), Vt = (n, e, t) => e.has(n) || vt("Cannot " + t);
26
- var l = (n, e, t) => (Vt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), Z = (n, e, t) => e.has(n) ? vt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), tt = (n, e, t, s) => (Vt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
27
- var wt = (n, e, t) => new Promise((s, i) => {
28
- var r = (c) => {
25
+ var d = (n, e, t) => K(n, typeof e != "symbol" ? e + "" : e, t), bt = (n, e, t) => e.has(n) || mt("Cannot " + t);
26
+ var l = (n, e, t) => (bt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), Z = (n, e, t) => e.has(n) ? mt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), tt = (n, e, t, s) => (bt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
27
+ var vt = (n, e, t) => new Promise((s, i) => {
28
+ var r = (u) => {
29
29
  try {
30
- o(t.next(c));
31
- } catch (u) {
32
- i(u);
30
+ o(t.next(u));
31
+ } catch (c) {
32
+ i(c);
33
33
  }
34
- }, a = (c) => {
34
+ }, a = (u) => {
35
35
  try {
36
- o(t.throw(c));
37
- } catch (u) {
38
- i(u);
36
+ o(t.throw(u));
37
+ } catch (c) {
38
+ i(c);
39
39
  }
40
- }, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(r, a);
40
+ }, o = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(r, a);
41
41
  o((t = t.apply(n, e)).next());
42
42
  });
43
- import { isEqual as nt, isEmpty as L, isBoolean as Kt, isString as P, truncate as Zt, isArray as Tt, isObject as Ot } from "lodash-es";
44
- import { unref as b, computed as jt, isRef as te, reactive as ee, ref as se, defineComponent as ie, resolveComponent as yt, openBlock as ne, createBlock as re, h as R } from "vue";
45
- var F = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(F || {});
46
- const Et = 10, xt = new Set(
47
- Object.values(F).filter((n) => typeof n == "number")
43
+ import { isEqual as nt, isEmpty as L, isBoolean as Kt, isString as j, truncate as Zt, isArray as At, isObject as _t } from "lodash-es";
44
+ import { unref as b, computed as Tt, isRef as te, reactive as ee, ref as se, defineComponent as ie, resolveComponent as Vt, openBlock as ne, createBlock as re, h as R } from "vue";
45
+ var P = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(P || {});
46
+ const wt = 10, yt = new Set(
47
+ Object.values(P).filter((n) => typeof n == "number")
48
48
  );
49
49
  ((n) => {
50
50
  function e(i) {
51
- return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : Et;
51
+ return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : wt;
52
52
  }
53
53
  n.fromString = e;
54
54
  function t(i) {
55
55
  const r = typeof i == "number" ? i : n.fromString(i);
56
- return xt.has(r) ? r : Et;
56
+ return yt.has(r) ? r : wt;
57
57
  }
58
58
  n.fromAny = t;
59
59
  function s(i) {
60
60
  const r = typeof i == "number" ? i : n.fromString(i);
61
- return xt.has(r);
61
+ return yt.has(r);
62
62
  }
63
63
  n.isDefined = s;
64
- })(F || (F = {}));
65
- Object.freeze(F);
66
- const N = F;
64
+ })(P || (P = {}));
65
+ Object.freeze(P);
66
+ const N = P;
67
67
  class y {
68
68
  constructor(e) {
69
69
  d(this, "executorFn");
@@ -105,29 +105,31 @@ class y {
105
105
  boundToBinding(e) {
106
106
  }
107
107
  /**
108
- * Announces that `binding` no longer holds this action. It names one element rather than the action as a whole,
109
- * because the instance goes on serving every other element it was registered on.
108
+ * Announces that `binding` no longer holds this action, and takes back what running it left there. It names one
109
+ * element rather than the action as a whole, because the instance goes on serving every other element it was
110
+ * registered on. It runs inside the operation that drops the registration, so an operation that unwinds puts the
111
+ * registration and what this took back both back.
110
112
  */
111
113
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
114
  unregisterFrom(e) {
113
115
  }
114
116
  }
115
- class rt extends Error {
117
+ class Ot extends Error {
116
118
  }
117
- const B = /* @__PURE__ */ Symbol("ValueChangedAction");
119
+ const Ft = /* @__PURE__ */ Symbol("ValueChangedAction");
118
120
  class O extends y {
119
121
  constructor(e) {
120
122
  super(e);
121
123
  }
122
124
  static get classIdentifier() {
123
- return B;
125
+ return Ft;
124
126
  }
125
127
  execute(e, t, s, i) {
126
128
  return super.execute(e, t, s, i);
127
129
  }
128
130
  }
129
- const z = /* @__PURE__ */ Symbol("Transaction.capture"), Pt = /* @__PURE__ */ Symbol("Transaction.restore"), Ft = /* @__PURE__ */ Symbol("Transaction.announceValue"), Nt = /* @__PURE__ */ Symbol("Transaction.settleValidity");
130
- function Ct(n) {
131
+ const $ = /* @__PURE__ */ Symbol("Transaction.capture"), jt = /* @__PURE__ */ Symbol("Transaction.restore"), Pt = /* @__PURE__ */ Symbol("Transaction.announceValue"), Nt = /* @__PURE__ */ Symbol("Transaction.settleValidity");
132
+ function Et(n) {
131
133
  let e = 0, t = n.parent;
132
134
  for (; t; )
133
135
  e++, t = t.parent;
@@ -136,8 +138,6 @@ function Ct(n) {
136
138
  class ae {
137
139
  constructor() {
138
140
  d(this, "participants", /* @__PURE__ */ new Map());
139
- /** work that stands only where the transaction commits; a rollback simply never does it */
140
- d(this, "deferred", []);
141
141
  /** what a rollback has to put back beyond the state slots, newest last */
142
142
  d(this, "undo", []);
143
143
  /** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */
@@ -162,7 +162,7 @@ class ae {
162
162
  */
163
163
  touch(e) {
164
164
  const t = this.participant(e);
165
- t.snapshot || (t.snapshot = e[z]());
165
+ t.snapshot || (t.snapshot = e[$]());
166
166
  }
167
167
  /** Enrols an element as one whose value the commit has to announce. `force` skips the comparison. */
168
168
  markValueChanged(e, t) {
@@ -187,14 +187,6 @@ class ae {
187
187
  var t, s;
188
188
  return (s = (t = this.participants.get(e)) == null ? void 0 : t.valueDirty) != null ? s : !1;
189
189
  }
190
- /**
191
- * Registers work the commit does once everything has been announced. It is for what a rollback could not take
192
- * back: releasing a listener, dropping a registration. Held until the commit, it is simply never done where the
193
- * transaction unwinds instead.
194
- */
195
- whenCommitted(e) {
196
- this.deferred.push(e);
197
- }
198
190
  /**
199
191
  * Registers what a rollback has to put back beyond the element's state slots. The snapshot covers the slots,
200
192
  * which is everything an ordinary write touches; an operation that replaces something else the element carries
@@ -211,7 +203,7 @@ class ae {
211
203
  * there is nothing the answer would change.
212
204
  */
213
205
  noteDepth(e) {
214
- this.passDepth < 0 || Ct(e) >= this.passDepth && (this.restartPass = !0);
206
+ this.passDepth < 0 || Et(e) >= this.passDepth && (this.restartPass = !0);
215
207
  }
216
208
  /**
217
209
  * Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's
@@ -220,10 +212,10 @@ class ae {
220
212
  */
221
213
  rollback() {
222
214
  this.unwound = !0, [...this.participants.values()].reverse().forEach((t) => {
223
- t.snapshot && t.element[Pt](t.snapshot);
215
+ t.snapshot && t.element[jt](t.snapshot);
224
216
  }), this.participants.clear();
225
217
  for (let t = this.undo.length - 1; t >= 0; t--) this.undo[t]();
226
- this.undo.length = 0, this.deferred.length = 0;
218
+ this.undo.length = 0;
227
219
  }
228
220
  /**
229
221
  * Announces what the transaction did. Values first and verdicts after, because a container's validators run
@@ -236,7 +228,6 @@ class ae {
236
228
  commit() {
237
229
  for (; !(!this.announceValues() && !this.settleValidity()); )
238
230
  ;
239
- this.deferred.splice(0).forEach((t) => t());
240
231
  }
241
232
  /**
242
233
  * The dirty participants a pass has to visit, one bucket per nesting depth; ties keep the order they were
@@ -249,7 +240,7 @@ class ae {
249
240
  return this.participants.forEach((s) => {
250
241
  var r;
251
242
  if (!e(s)) return;
252
- const i = Ct(s.element);
243
+ const i = Et(s.element);
253
244
  ((r = t[i]) != null ? r : t[i] = []).push(s);
254
245
  }), t;
255
246
  }
@@ -285,7 +276,7 @@ class ae {
285
276
  (e) => e.valueDirty || e.structural !== void 0,
286
277
  (e) => {
287
278
  const { structural: t } = e, s = e.valueDirty, i = e.forceValue;
288
- e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, e.element[Ft](this, s, i, t);
279
+ e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, e.element[Pt](this, s, i, t);
289
280
  }
290
281
  );
291
282
  }
@@ -317,22 +308,22 @@ class oe {
317
308
  this.open = !1;
318
309
  }
319
310
  }
320
- function St(n) {
311
+ function Ct(n) {
321
312
  if (n != null && typeof n.then == "function")
322
313
  throw new TypeError(
323
314
  "a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part."
324
315
  );
325
316
  }
326
- function ot(n) {
317
+ function q(n) {
327
318
  if (_) {
328
319
  const s = n(et);
329
- return St(s), s;
320
+ return Ct(s), s;
330
321
  }
331
322
  const e = new ae(), t = new oe();
332
323
  _ = e, et = t;
333
324
  try {
334
325
  const s = n(t);
335
- return St(s), e.commit(), s;
326
+ return Ct(s), e.commit(), s;
336
327
  } catch (s) {
337
328
  if (e.rollback(), s instanceof Rt) return;
338
329
  throw s;
@@ -341,21 +332,21 @@ function ot(n) {
341
332
  }
342
333
  }
343
334
  function g(n) {
344
- return _ ? n(_) : ot(() => n(_));
335
+ return _ ? n(_) : q(() => n(_));
345
336
  }
346
337
  const Dt = { useMarkdownInValidators: !0 };
347
338
  function le() {
348
339
  return Dt;
349
340
  }
350
- function ce(n) {
341
+ function ue(n) {
351
342
  Object.assign(Dt, n);
352
343
  }
353
344
  const Ye = {
354
345
  install(n, e) {
355
- e && ce(e);
346
+ e && ue(e);
356
347
  }
357
348
  };
358
- class U extends String {
349
+ class B extends String {
359
350
  constructor(t, s, i) {
360
351
  super(t);
361
352
  d(this, "plugins");
@@ -363,14 +354,14 @@ class U extends String {
363
354
  this.plugins = i, this.options = s;
364
355
  }
365
356
  }
366
- function lt(n) {
357
+ function at(n) {
367
358
  const e = b(n);
368
359
  return typeof e == "object" && "componentName" in e;
369
360
  }
370
- function H(n) {
361
+ function z(n) {
371
362
  return typeof b(n) == "function";
372
363
  }
373
- class ct {
364
+ class ot {
374
365
  get componentName() {
375
366
  return "Comment";
376
367
  }
@@ -384,7 +375,7 @@ class ct {
384
375
  return "";
385
376
  }
386
377
  }
387
- class ue extends ct {
378
+ class ce extends ot {
388
379
  constructor(t, s = "") {
389
380
  super();
390
381
  d(this, "text");
@@ -401,21 +392,21 @@ class ue extends ct {
401
392
  return this.classes;
402
393
  }
403
394
  }
404
- class V extends ct {
395
+ class V extends ot {
405
396
  constructor(t, s = "") {
406
397
  super();
407
398
  d(this, "classes");
408
399
  d(this, "text");
409
400
  d(this, "textType");
410
- this.classes = s, this.text = t, this.textType = jt(() => this.getTextType);
401
+ this.classes = s, this.text = t, this.textType = Tt(() => this.getTextType);
411
402
  }
412
403
  get resolvedText() {
413
404
  const t = b(this.text);
414
- return H(t) ? t() : t;
405
+ return z(t) ? t() : t;
415
406
  }
416
407
  get getTextType() {
417
408
  const t = this.resolvedText;
418
- return t ? t instanceof U ? "md" : lt(t) ? "component" : "string" : "string";
409
+ return t ? t instanceof B ? "md" : at(t) ? "component" : "string" : "string";
419
410
  }
420
411
  get componentName() {
421
412
  switch (b(this.textType)) {
@@ -460,7 +451,7 @@ class V extends ct {
460
451
  class he extends V {
461
452
  }
462
453
  function E(n) {
463
- return le().useMarkdownInValidators ? new U(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
454
+ return le().useMarkdownInValidators ? new B(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
464
455
  `);
465
456
  }
466
457
  const de = /* @__PURE__ */ Symbol("Validator"), ge = () => E("Validation could not be completed");
@@ -471,24 +462,24 @@ class v extends O {
471
462
  */
472
463
  constructor(t) {
473
464
  super((i, r, a, o) => {
474
- const c = this.bindingState(i), u = ++c.run, C = i.validationEpoch, G = kt(), dt = () => c.run === u && i.validationEpoch === C && !(G != null && G.rolledBack), Y = t(a, o, i) || [], J = (S) => ot(() => {
475
- var gt;
476
- const $ = (gt = S == null ? void 0 : S.map((j) => this.claim(j))) != null ? gt : [];
477
- for (let j = i.errors.length - 1; j >= 0; j--) {
478
- const ft = i.errors[j];
479
- if (ft.source === this.source) {
480
- const pt = $.findIndex((Xt) => nt(Xt, ft));
481
- pt >= 0 ? $.splice(pt, 1) : i.errors.splice(j, 1);
465
+ const u = this.bindingState(i), c = ++u.run, x = i.validationEpoch, G = kt(), ct = () => u.run === c && i.validationEpoch === x && !(G != null && G.rolledBack), Y = t(a, o, i) || [], J = (S) => q(() => {
466
+ var ht;
467
+ const U = (ht = S == null ? void 0 : S.map((F) => this.claim(F))) != null ? ht : [];
468
+ for (let F = i.errors.length - 1; F >= 0; F--) {
469
+ const dt = i.errors[F];
470
+ if (dt.source === this.source) {
471
+ const gt = U.findIndex((Xt) => nt(Xt, dt));
472
+ gt >= 0 ? U.splice(gt, 1) : i.errors.splice(F, 1);
482
473
  }
483
474
  }
484
- $.length > 0 && i.errors.push(...$), i.validate();
475
+ U.length > 0 && i.errors.push(...U), i.validate();
485
476
  });
486
477
  return Y instanceof Promise ? (i.beginValidating(), Y.then(
487
478
  (S) => {
488
- dt() && J(S);
479
+ ct() && J(S);
489
480
  },
490
481
  (S) => {
491
- dt() && (J([new V(ge())]), console.error("Validation failed", S));
482
+ ct() && (J([new V(ge())]), console.error("Validation failed", S));
492
483
  }
493
484
  ).finally(() => i.endValidating()).catch((S) => console.error("Validation failed", S))) : J(Y), r(i, a, o);
494
485
  });
@@ -509,7 +500,7 @@ class v extends O {
509
500
  if (s === void 0)
510
501
  return Object.defineProperty(t, "source", i), t;
511
502
  const r = Object.getOwnPropertyDescriptors(t);
512
- return Object.create(Object.getPrototypeOf(t), x(p({}, r), { source: i }));
503
+ return Object.create(Object.getPrototypeOf(t), C(p({}, r), { source: i }));
513
504
  }
514
505
  static get classIdentifier() {
515
506
  return de;
@@ -517,6 +508,18 @@ class v extends O {
517
508
  get eager() {
518
509
  return !0;
519
510
  }
511
+ /**
512
+ * Takes this validator off `field`: the errors it put there are withdrawn and the verdict is re-formed over what
513
+ * the validators the field still holds have to say. Withdrawing them is what keeps a field from staying invalid
514
+ * on an error no validator is left to take back.
515
+ */
516
+ unregisterFrom(t) {
517
+ q(() => {
518
+ for (let s = t.errors.length - 1; s >= 0; s--)
519
+ t.errors[s].source === this.source && t.errors.splice(s, 1);
520
+ t.validate();
521
+ });
522
+ }
520
523
  /**
521
524
  * What this validator remembers about one of the fields it validates. One instance may be registered on several
522
525
  * fields - every row of a list carries the instances the item template carries - so each field has a record of
@@ -536,100 +539,122 @@ class v extends O {
536
539
  replacePlaceholdersFunction(t, s) {
537
540
  return () => {
538
541
  let i = b(t);
539
- for (; H(i); )
542
+ for (; z(i); )
540
543
  i = b(this.replacePlaceholders(i(), s));
541
544
  return i;
542
545
  };
543
546
  }
544
547
  replacePlaceholders(t, s) {
545
- if (H(t)) return this.replacePlaceholdersFunction(t, s);
546
- if (lt(t)) return t;
548
+ if (z(t)) return this.replacePlaceholdersFunction(t, s);
549
+ if (at(t)) return t;
547
550
  if (te(t))
548
551
  return this.replacePlaceholdersFunction(() => b(t), s);
549
552
  let i = b(t);
550
553
  return Object.keys(s).forEach((r) => {
551
554
  i = i.replaceAll(`{${r}}`, s[r]);
552
- }), t instanceof U ? new U(i.toString(), t.options, t.plugins) : i;
555
+ }), t instanceof B ? new B(i.toString(), t.options, t.plugins) : i;
553
556
  }
554
557
  }
555
- class M extends Map {
558
+ class H {
556
559
  constructor() {
557
- super(...arguments);
558
- d(this, "eagerActions", /* @__PURE__ */ new Set());
560
+ /** every action registered here, in registration order across all identifiers */
559
561
  d(this, "registeredActions", []);
560
- }
561
- register(t) {
562
- if (!(t instanceof y)) throw new Error("Invalid action type");
563
- this.registeredActions.push(t);
564
- const s = t.classIdentifier, i = this.get(s) || (() => null);
565
- function r(a, ...o) {
566
- return t.execute(a, i, ...o);
567
- }
568
- this.set(s, r), t.eager && this.eagerActions.add(t.classIdentifier);
562
+ /** the actions of one identifier, in registration order */
563
+ d(this, "chains", /* @__PURE__ */ new Map());
564
+ /** the eager actions of one identifier, in registration order; a subsequence of the chain under that identifier */
565
+ d(this, "eagerChains", /* @__PURE__ */ new Map());
569
566
  }
570
567
  /**
571
- * True when triggering this action would run something: a handler registered under the identifier, or - on the
572
- * value change identifier, which trigger() answers with an eager pass as well - any eager action at all. A
573
- * caller that has to build the parameters before it can trigger asks this first and skips building them when
574
- * there is nothing to receive them.
568
+ * Registers `action`. It becomes the outermost handler of its identifier, or - where `before` is given and is
569
+ * registered here under the same identifier - takes that action's place in the order, so `before` wraps it and
570
+ * reaches it through `supr`. That is what lets an action be added to a chain someone else built and still sit
571
+ * inside a handler already there.
575
572
  */
576
- willTrigger(t) {
577
- return this.has(t) ? !0 : t === B && this.eagerActions.size > 0;
578
- }
579
- trigger(t, s, ...i) {
580
- const r = t.classIdentifier;
581
- return r === B && this.triggerEager(s, ...i), this.triggerChain(r, s, ...i);
573
+ register(e, t) {
574
+ if (!(e instanceof y)) throw new Error("Invalid action type");
575
+ const s = e.classIdentifier;
576
+ if (t && (t.classIdentifier !== s || !this.registeredActions.includes(t)))
577
+ throw new Error("Action to register before is not registered under the same identifier");
578
+ this.registeredActions.push(e), this.insert(this.chains, s, e, t), e.eager && this.insert(this.eagerChains, s, e, t);
582
579
  }
583
580
  /**
584
- * Runs the chain registered under one identifier and nothing else. A caller that has already run the eager
585
- * pass - a transaction runs it at the write, so that the validators have decided before it commits - reaches
586
- * the handlers through here, so the eager actions are not run a second time at the announcement.
581
+ * Drops `action` from this map and answers whether it was in it. The lists it stood in are replaced rather than
582
+ * written, so a run already walking one finishes on the list it started with and the removal takes effect from
583
+ * the next trigger.
587
584
  */
588
- triggerChain(t, s, ...i) {
589
- const r = this.get(t);
590
- try {
591
- if (r) return r(s, ...i);
592
- } catch (a) {
593
- if (!(a instanceof rt)) throw a;
594
- }
595
- return null;
585
+ unregister(e) {
586
+ const t = this.registeredActions.indexOf(e);
587
+ if (t < 0) return !1;
588
+ this.registeredActions.splice(t, 1);
589
+ const s = e.classIdentifier;
590
+ return this.remove(this.chains, s, e), this.remove(this.eagerChains, s, e), !0;
596
591
  }
597
- triggerEager(t, ...s) {
598
- for (const i of this.eagerActions) {
599
- const r = this.get(i);
600
- try {
601
- r && r(t, ...s);
602
- } catch (a) {
603
- if (!(a instanceof rt)) throw a;
604
- }
605
- }
592
+ /** True where something is registered under `identifier`. */
593
+ willTrigger(e) {
594
+ return this.chains.has(e);
595
+ }
596
+ /** True where any eager action is registered, whatever identifier it stands under. */
597
+ get hasEager() {
598
+ return this.eagerChains.size > 0;
599
+ }
600
+ /** Runs the actions registered under `ActionClass` and answers with what the outermost of them returned. */
601
+ trigger(e, t, ...s) {
602
+ return this.run(this.chains.get(e.classIdentifier), t, s);
603
+ }
604
+ /** Runs the eager actions of every identifier, each group on its own. */
605
+ triggerEager(e, ...t) {
606
+ this.eagerChains.forEach((s) => this.run(s, e, t));
607
+ }
608
+ /** Runs the eager actions registered under `identifier` and nothing else. */
609
+ triggerEagerFor(e, t, ...s) {
610
+ return this.run(this.eagerChains.get(e), t, s);
606
611
  }
607
612
  /** the validators registered in this map, in registration order */
608
613
  get validators() {
609
- return this.registeredActions.filter((t) => t instanceof v);
614
+ return this.registeredActions.filter((e) => e instanceof v);
610
615
  }
611
616
  clone() {
612
- const t = new M();
613
- return this.registeredActions.forEach((s) => t.register(s)), t;
617
+ const e = new H();
618
+ return this.registeredActions.forEach((t) => e.register(t)), e;
614
619
  }
615
620
  /**
616
621
  * Tells every action in this map that it serves `owner`. A copied map holds the instances the original holds, so
617
622
  * the element that took the copy on is announced to them here, the way registering an action announces the
618
623
  * element it was registered on.
619
624
  */
620
- bindTo(t) {
621
- this.registeredActions.forEach((s) => s.boundToBinding(t));
625
+ bindTo(e) {
626
+ this.registeredActions.forEach((t) => t.boundToBinding(e));
622
627
  }
623
628
  /**
624
- * A copy of this map carrying everything but the validators. It only leaves them out: releasing what a
625
- * validator installed elsewhere is the caller's to do, and only once the transaction that dropped them has
626
- * committed, because a rollback puts this map back with its validators in it.
629
+ * Walks `chain` from the end backwards, handing each action a `supr` that continues at the one before it. The
630
+ * closures exist for the length of the run and only as deep as the run actually goes, so a chain nobody walks to
631
+ * the bottom costs nothing for the part left unreached.
627
632
  */
628
- cloneWithoutValidators() {
629
- const t = new M();
630
- return this.registeredActions.forEach((s) => {
631
- s instanceof v || t.register(s);
632
- }), t;
633
+ step(e, t, s, i) {
634
+ if (t < 0) return null;
635
+ const r = (a, ...o) => this.step(e, t - 1, a, o);
636
+ return e[t].execute(s, r, ...i);
637
+ }
638
+ /** Walks a chain, answering null where there is none. An abort ends the run and is not an error to the caller. */
639
+ run(e, t, s) {
640
+ if (!e) return null;
641
+ try {
642
+ return this.step(e, e.length - 1, t, s);
643
+ } catch (i) {
644
+ if (!(i instanceof Ot)) throw i;
645
+ }
646
+ return null;
647
+ }
648
+ insert(e, t, s, i) {
649
+ var o;
650
+ const r = (o = e.get(t)) != null ? o : [], a = i ? r.indexOf(i) : -1;
651
+ a < 0 ? r.push(s) : r.splice(a, 0, s), e.set(t, r);
652
+ }
653
+ remove(e, t, s) {
654
+ const i = e.get(t);
655
+ if (!(i != null && i.includes(s))) return;
656
+ const r = i.filter((a) => a !== s);
657
+ r.length ? e.set(t, r) : e.delete(t);
633
658
  }
634
659
  }
635
660
  function T(n) {
@@ -644,7 +669,7 @@ function fe(n) {
644
669
  e.unshift(t.fieldName), t = t.parent;
645
670
  return e;
646
671
  }
647
- function ut(n, e) {
672
+ function lt(n, e) {
648
673
  var s, i;
649
674
  let t = e;
650
675
  for (const r of fe(n))
@@ -652,7 +677,7 @@ function ut(n, e) {
652
677
  return (t == null ? void 0 : t.declaration) === n ? t : T(n) === T(e.declaration) ? void 0 : n;
653
678
  }
654
679
  function Lt(n, e) {
655
- const t = ut(n, e);
680
+ const t = lt(n, e);
656
681
  if (!t) return [];
657
682
  if (t !== n) return [t];
658
683
  const s = e.bindingsOf(n);
@@ -670,7 +695,7 @@ function pe(n, e) {
670
695
  const me = /* @__PURE__ */ Symbol("ConditionalStatementAction");
671
696
  class Q extends O {
672
697
  constructor(t, s) {
673
- super((r, a, o, c) => (this.applyIn(T(r)) || r.markRecordIncomplete(), a(r, o, c)));
698
+ super((r, a, o, u) => (this.applyIn(T(r)) || r.markRecordIncomplete(), a(r, o, u)));
674
699
  d(this, "statement");
675
700
  d(this, "conditionalExecutor");
676
701
  /**
@@ -698,6 +723,9 @@ class Q extends O {
698
723
  boundToBinding(t) {
699
724
  this.declarations.add(t.declaration), this.registrations.add(t);
700
725
  }
726
+ unregisterFrom(t) {
727
+ this.registrations.delete(t);
728
+ }
701
729
  /**
702
730
  * The elements of `scope` this action controls: what each declaration it serves names within that record, and of
703
731
  * those the ones that took the action on. A row of a list that never took it on is not one this action drives.
@@ -756,7 +784,7 @@ class Ve extends Q {
756
784
  });
757
785
  }
758
786
  }
759
- var W = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(W || {});
787
+ var M = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(M || {});
760
788
  ((n) => {
761
789
  function e(r) {
762
790
  const a = r.toLowerCase();
@@ -794,9 +822,9 @@ var W = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
794
822
  return r >= 0;
795
823
  }
796
824
  n.isLogicOperator = i;
797
- })(W || (W = {}));
798
- Object.freeze(W);
799
- const m = W, we = /* @__PURE__ */ Symbol("EnabledChangingAction");
825
+ })(M || (M = {}));
826
+ Object.freeze(M);
827
+ const m = M, we = /* @__PURE__ */ Symbol("EnabledChangingAction");
800
828
  class Bt extends y {
801
829
  constructor(e) {
802
830
  super(e);
@@ -809,7 +837,7 @@ class Bt extends y {
809
837
  }
810
838
  }
811
839
  const ye = /* @__PURE__ */ Symbol("EnabledChangedAction");
812
- class Ut extends y {
840
+ class Mt extends y {
813
841
  constructor(e) {
814
842
  super(e);
815
843
  }
@@ -821,7 +849,7 @@ class Ut extends y {
821
849
  }
822
850
  }
823
851
  const Ee = /* @__PURE__ */ Symbol("ValidChangedAction");
824
- class Mt extends y {
852
+ class Ut extends y {
825
853
  constructor(e) {
826
854
  super(e);
827
855
  }
@@ -832,31 +860,31 @@ class Mt extends y {
832
860
  return super.execute(e, t, s, i);
833
861
  }
834
862
  }
835
- const xe = /* @__PURE__ */ Symbol("VisibilityChangingAction");
863
+ const Ce = /* @__PURE__ */ Symbol("VisibilityChangingAction");
836
864
  class Wt extends y {
837
865
  constructor(e) {
838
866
  super(e);
839
867
  }
840
868
  static get classIdentifier() {
841
- return xe;
869
+ return Ce;
842
870
  }
843
871
  execute(e, t, s, i) {
844
872
  return super.execute(e, t, s, i);
845
873
  }
846
874
  }
847
- const Ce = /* @__PURE__ */ Symbol("VisibilityChangedAction");
875
+ const xe = /* @__PURE__ */ Symbol("VisibilityChangedAction");
848
876
  class $t extends y {
849
877
  constructor(e) {
850
878
  super(e);
851
879
  }
852
880
  static get classIdentifier() {
853
- return Ce;
881
+ return xe;
854
882
  }
855
883
  execute(e, t, s, i) {
856
884
  return super.execute(e, t, s, i);
857
885
  }
858
886
  }
859
- const It = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new Set(["validators", "actions"]);
887
+ const xt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new Set(["validators", "actions"]);
860
888
  let st = 0;
861
889
  var h, f;
862
890
  class A {
@@ -963,7 +991,7 @@ class A {
963
991
  extendedOf(e) {
964
992
  const t = /* @__PURE__ */ Object.create(null);
965
993
  return Object.entries(e).forEach(([s, i]) => {
966
- At.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (t[s] = i);
994
+ St.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (t[s] = i);
967
995
  }), t;
968
996
  }
969
997
  /**
@@ -974,7 +1002,7 @@ class A {
974
1002
  assignParams(e) {
975
1003
  const t = this.extendedOf(e);
976
1004
  Object.entries(e).forEach(([s, i]) => {
977
- Object.hasOwn(t, s) || At.has(s) || (this[s] = i);
1005
+ Object.hasOwn(t, s) || St.has(s) || (this[s] = i);
978
1006
  }), L(t) || this.setExtendedValues(t);
979
1007
  }
980
1008
  /**
@@ -994,8 +1022,8 @@ class A {
994
1022
  * What is not in the snapshot is the action map, which no write touches: an operation that replaces it hands
995
1023
  * the transaction its own undo instead, so this stays the one shape every element captures.
996
1024
  */
997
- [z]() {
998
- return x(p({}, l(this, f)), { errors: [...l(this, f).errors] });
1025
+ [$]() {
1026
+ return C(p({}, l(this, f)), { errors: [...l(this, f).errors] });
999
1027
  }
1000
1028
  /**
1001
1029
  * Puts a captured state back. It writes through the tracked view, so an effect that ran on the state the
@@ -1004,7 +1032,7 @@ class A {
1004
1032
  * validatingCount is the one slot the element keeps: it counts runs that are in flight, and a rollback cannot
1005
1033
  * un-start one. Put back, the count would no longer match the endValidating calls still to come.
1006
1034
  */
1007
- [Pt](e) {
1035
+ [jt](e) {
1008
1036
  const t = l(this, f).validatingCount;
1009
1037
  Object.assign(l(this, h), e), l(this, h).validatingCount = t;
1010
1038
  }
@@ -1101,7 +1129,7 @@ class A {
1101
1129
  });
1102
1130
  }
1103
1131
  get actions() {
1104
- return this._actions || (this._actions = new M()), this._actions;
1132
+ return this._actions || (this._actions = new H()), this._actions;
1105
1133
  }
1106
1134
  set actions(e) {
1107
1135
  this._actions = e;
@@ -1219,8 +1247,8 @@ class A {
1219
1247
  * from repeating while nothing it read has moved.
1220
1248
  */
1221
1249
  get validRead() {
1222
- let e = It.get(this);
1223
- return e || (e = jt(() => this.composeValid()), It.set(this, e)), e.value;
1250
+ let e = xt.get(this);
1251
+ return e || (e = Tt(() => this.composeValid()), xt.set(this, e)), e.value;
1224
1252
  }
1225
1253
  /** What validRead computes. A leaf answers over its own errors; a container adds its members. */
1226
1254
  composeValid() {
@@ -1247,7 +1275,7 @@ class A {
1247
1275
  var r, a;
1248
1276
  const s = l(this, h).enabled, i = (r = this._actions) == null ? void 0 : r.trigger(Bt, this, e, s);
1249
1277
  if (!Kt(i != null ? i : e)) throw new Error("Enabled value must be boolean");
1250
- t.touch(this), l(this, h).enabled = i != null ? i : e, l(this, h).enabled !== s && this.bumpValueVersion(), (a = this._actions) == null || a.trigger(Ut, this, l(this, h).enabled, s);
1278
+ t.touch(this), l(this, h).enabled = i != null ? i : e, l(this, h).enabled !== s && this.bumpValueVersion(), (a = this._actions) == null || a.trigger(Mt, this, l(this, h).enabled, s);
1251
1279
  });
1252
1280
  }
1253
1281
  /**
@@ -1266,15 +1294,15 @@ class A {
1266
1294
  * operation states rather than an element's state - an item added, an item removed - are emitted first, in the
1267
1295
  * order the operations happened.
1268
1296
  */
1269
- [Ft](e, t, s, i) {
1270
- if (i == null || i.forEach((c) => {
1271
- var u;
1272
- return (u = this._actions) == null ? void 0 : u.trigger(c.actionClass, this, c.item, c.index);
1297
+ [Pt](e, t, s, i) {
1298
+ if (i == null || i.forEach((u) => {
1299
+ var c;
1300
+ return (c = this._actions) == null ? void 0 : c.trigger(u.actionClass, this, u.item, u.index);
1273
1301
  }), !t) return;
1274
1302
  const r = this._actions;
1275
- if (this.composesValue && !(r != null && r.willTrigger(B))) return;
1303
+ if (this.composesValue && !(r != null && r.willTrigger(Ft) || r != null && r.hasEager)) return;
1276
1304
  const a = this.value, o = l(this, f).announcedValue;
1277
- !s && (this.composesValue ? nt(a, o) : a === o) || (e.touch(this), l(this, f).announcedValue = a, this.composesValue ? r == null || r.trigger(O, this, a, o) : r == null || r.triggerChain(B, this, a, o));
1305
+ !s && (this.composesValue ? nt(a, o) : a === o) || (e.touch(this), l(this, f).announcedValue = a, this.composesValue && (r == null || r.triggerEager(this, a, o)), r == null || r.trigger(O, this, a, o));
1278
1306
  }
1279
1307
  /**
1280
1308
  * Forms the verdict this element ends the transaction with and announces a transition of it. The container is
@@ -1289,7 +1317,7 @@ class A {
1289
1317
  if (s === t) return;
1290
1318
  e.touch(this), l(this, f).valid = s;
1291
1319
  const i = this.parent;
1292
- i && (e.touch(i), i.childValidityChanged(s), e.markValidityDirty(i)), (r = this._actions) == null || r.trigger(Mt, this, s, t);
1320
+ i && (e.touch(i), i.childValidityChanged(s), e.markValidityDirty(i)), (r = this._actions) == null || r.trigger(Ut, this, s, t);
1293
1321
  }
1294
1322
  validate(e = !1) {
1295
1323
  g((t) => {
@@ -1333,9 +1361,45 @@ class A {
1333
1361
  }
1334
1362
  registerAction(e) {
1335
1363
  return g((t) => {
1336
- t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), e.boundToBinding(this), e.eager && this.actions.trigger(Object.getPrototypeOf(e).constructor, this, this.value, this.originalValue);
1364
+ t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), this.registered(t, e), e.eager && this.actions.triggerEagerFor(e.classIdentifier, this, this.value, this.originalValue);
1365
+ }), this;
1366
+ }
1367
+ /**
1368
+ * Registers `action` so that `before` wraps it: `before` reaches it through the `supr` it is handed, instead of
1369
+ * ending the run there. It is how an action is added to a chain someone else built and still sits inside a
1370
+ * handler already registered, which registration order alone cannot arrange. `before` has to be registered on
1371
+ * this element under the same identifier.
1372
+ */
1373
+ registerActionBefore(e, t) {
1374
+ return g((s) => {
1375
+ s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e, t), this.registered(s, e), e.eager && this.actions.triggerEagerFor(e.classIdentifier, this, this.value, this.originalValue);
1337
1376
  }), this;
1338
1377
  }
1378
+ /**
1379
+ * Drops `action` from this element and answers whether it held it. The instance goes on serving every other
1380
+ * element it was registered on: what is dropped is this element's registration, not the action. A validator
1381
+ * withdraws the errors it put on this element as it goes, so the verdict the element reports is the one the
1382
+ * validators it still holds reach.
1383
+ */
1384
+ unregisterAction(e) {
1385
+ let t = !1;
1386
+ return g((s) => {
1387
+ const i = this._actions;
1388
+ i && (t = i.unregister(e), t && (s.touch(this), e instanceof v && l(this, h).validationEpoch++, s.whenRolledBack(() => {
1389
+ i.register(e), e.boundToBinding(this);
1390
+ }), e.unregisterFrom(this)));
1391
+ }), t;
1392
+ }
1393
+ /**
1394
+ * Records that `action` is now registered on this element, and that a rollback has to take that back. The
1395
+ * registration is not one of the state slots the snapshot covers, so it hands its own undo in.
1396
+ */
1397
+ registered(e, t) {
1398
+ t.boundToBinding(this), e.whenRolledBack(() => {
1399
+ var s;
1400
+ (s = this._actions) != null && s.unregister(t) && t.unregisterFrom(this);
1401
+ });
1402
+ }
1339
1403
  triggerAction(e, ...t) {
1340
1404
  return this._actions ? this._actions.trigger(e, this, ...t) : null;
1341
1405
  }
@@ -1349,13 +1413,13 @@ class A {
1349
1413
  }
1350
1414
  clearValidators() {
1351
1415
  g((e) => {
1352
- if (e.touch(this), l(this, h).validationEpoch++, this._actions) {
1353
- const t = this._actions, s = t.validators;
1354
- e.whenRolledBack(() => {
1355
- this._actions = t;
1356
- }), this.actions = t.cloneWithoutValidators(), e.whenCommitted(() => s.forEach((i) => i.unregisterFrom(this)));
1357
- }
1358
- this.errors = [], this.validate();
1416
+ e.touch(this), l(this, h).validationEpoch++;
1417
+ const t = this._actions;
1418
+ t && t.validators.forEach((s) => {
1419
+ t.unregister(s), e.whenRolledBack(() => {
1420
+ t.register(s), s.boundToBinding(this);
1421
+ }), s.unregisterFrom(this);
1422
+ }), this.errors = [], this.validate();
1359
1423
  });
1360
1424
  }
1361
1425
  }
@@ -1379,7 +1443,7 @@ class I {
1379
1443
  static valueOf(e, t) {
1380
1444
  if (e instanceof I) return e.evaluate(t);
1381
1445
  if (e instanceof A) {
1382
- const s = t ? ut(e, t) : e;
1446
+ const s = t ? lt(e, t) : e;
1383
1447
  return s ? b(s.value) : void 0;
1384
1448
  }
1385
1449
  return e;
@@ -1433,9 +1497,9 @@ class I {
1433
1497
  case m.NOT_IN:
1434
1498
  return !((r = s == null ? void 0 : s.includes) != null && r.call(s, t));
1435
1499
  case m.INCLUDES:
1436
- return P(t) && P(s) && t.indexOf(s) >= 0;
1500
+ return j(t) && j(s) && t.indexOf(s) >= 0;
1437
1501
  case m.NOT_INCLUDES:
1438
- return !(P(t) && P(s) && t.indexOf(s) >= 0);
1502
+ return !(j(t) && j(s) && t.indexOf(s) >= 0);
1439
1503
  default:
1440
1504
  throw new Error(`Operator not implemented ${this.operator}`);
1441
1505
  }
@@ -1465,7 +1529,7 @@ class qt extends y {
1465
1529
  }
1466
1530
  }
1467
1531
  const Ae = /* @__PURE__ */ Symbol("ListItemAddedAction");
1468
- class at extends y {
1532
+ class rt extends y {
1469
1533
  constructor(e) {
1470
1534
  super(e);
1471
1535
  }
@@ -1508,17 +1572,17 @@ function Ht() {
1508
1572
  };
1509
1573
  }
1510
1574
  function Oe() {
1511
- return x(p({}, Ht()), { value: void 0, touched: !1 });
1575
+ return C(p({}, Ht()), { value: void 0, touched: !1 });
1512
1576
  }
1513
1577
  function Qt() {
1514
- return x(p({}, Ht()), {
1578
+ return C(p({}, Ht()), {
1515
1579
  announcedValue: null,
1516
1580
  cachedValue: null,
1517
1581
  cachedValueVersion: -1
1518
1582
  });
1519
1583
  }
1520
- function je() {
1521
- return x(p({}, Qt()), { rows: null });
1584
+ function Fe() {
1585
+ return C(p({}, Qt()), { rows: null });
1522
1586
  }
1523
1587
  class X extends A {
1524
1588
  get state() {
@@ -1574,7 +1638,7 @@ class X extends A {
1574
1638
  }
1575
1639
  bind(e, t) {
1576
1640
  var r, a;
1577
- const s = this.constructor, i = new s(x(p({
1641
+ const s = this.constructor, i = new s(C(p({
1578
1642
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
1579
1643
  value: e !== void 0 ? e : this.value
1580
1644
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
@@ -1584,23 +1648,23 @@ class X extends A {
1584
1648
  return i.boundFrom(this, i.value, i.originalValue, t), i;
1585
1649
  }
1586
1650
  }
1587
- const Pe = new X({ value: "EmptyField" }).registerAction(
1651
+ const je = new X({ value: "EmptyField" }).registerAction(
1588
1652
  new O(() => {
1589
1653
  console.warn("Working with EmptyField! This should not happen");
1590
1654
  })
1591
- ), _t = /* @__PURE__ */ new WeakMap();
1655
+ ), It = /* @__PURE__ */ new WeakMap();
1592
1656
  function it(n, e) {
1593
1657
  return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? e : n;
1594
1658
  }
1595
- class Fe extends X {
1659
+ class Pe extends X {
1596
1660
  init(e) {
1597
1661
  g(() => {
1598
1662
  var s;
1599
1663
  if (this._value = { label: void 0, icon: void 0 }, e) {
1600
- const t = e, { value: i, originalValue: r, validators: a, actions: o } = t, c = k(t, ["value", "originalValue", "validators", "actions"]);
1601
- this.registerInitialActions([...a || [], ...o || []]), this.assignParams(c);
1602
- const u = it(i, this._value), C = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
1603
- this._value = it(u, p({}, C)), this.originalValue = it(C, u);
1664
+ const t = e, { value: i, originalValue: r, validators: a, actions: o } = t, u = k(t, ["value", "originalValue", "validators", "actions"]);
1665
+ this.registerInitialActions([...a || [], ...o || []]), this.assignParams(u);
1666
+ const c = it(i, this._value), x = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
1667
+ this._value = it(c, p({}, x)), this.originalValue = it(x, c);
1604
1668
  }
1605
1669
  this.raw.announcedValue = this._value, (s = this._actions) == null || s.triggerEager(this, this.value, this.originalValue), this.validate();
1606
1670
  });
@@ -1636,8 +1700,8 @@ class Fe extends X {
1636
1700
  }
1637
1701
  /** the counter behind `busy`, allocated for this action the first time it is asked for */
1638
1702
  get busyRuns() {
1639
- let e = _t.get(this);
1640
- return e || (e = se(0), _t.set(this, e)), e;
1703
+ let e = It.get(this);
1704
+ return e || (e = se(0), It.set(this, e)), e;
1641
1705
  }
1642
1706
  /** true from the moment execute() is called until the handler it ran has settled, however it settles */
1643
1707
  get busy() {
@@ -1654,7 +1718,7 @@ class Fe extends X {
1654
1718
  * rejection unhandled.
1655
1719
  */
1656
1720
  execute(e) {
1657
- return wt(this, null, function* () {
1721
+ return vt(this, null, function* () {
1658
1722
  const t = this.busyRuns;
1659
1723
  t.value++;
1660
1724
  try {
@@ -1672,7 +1736,7 @@ const Ne = /* @__PURE__ */ ie({
1672
1736
  classes: {}
1673
1737
  },
1674
1738
  setup(n) {
1675
- const e = n, t = yt("vue-markdown"), s = /* @__PURE__ */ new Set([
1739
+ const e = n, t = Vt("vue-markdown"), s = /* @__PURE__ */ new Set([
1676
1740
  "div",
1677
1741
  "span",
1678
1742
  "p",
@@ -1756,7 +1820,7 @@ const Ne = /* @__PURE__ */ ie({
1756
1820
  default:
1757
1821
  r.push(
1758
1822
  R(
1759
- s.has(a.componentName.toLowerCase()) ? a.componentName : yt(a.componentName),
1823
+ s.has(a.componentName.toLowerCase()) ? a.componentName : Vt(a.componentName),
1760
1824
  p(p({
1761
1825
  class: [e.classes, a.extraClasses]
1762
1826
  }, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
@@ -1776,9 +1840,9 @@ class w extends A {
1776
1840
  if (!w.isValidFields(t)) throw new Error("Invalid fields object provided");
1777
1841
  this._fields = /* @__PURE__ */ Object.create(null), g(() => {
1778
1842
  var a;
1779
- if (Object.entries(t).forEach(([o, c]) => this.addField(o, c)), s) {
1780
- const r = s, { value: o, validators: c, actions: u } = r, C = k(r, ["value", "validators", "actions"]);
1781
- this.registerInitialActions([...c || [], ...u || []]), this.assignParams(C), o !== void 0 ? this.assignMembers(o) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1843
+ if (Object.entries(t).forEach(([o, u]) => this.addField(o, u)), s) {
1844
+ const r = s, { value: o, validators: u, actions: c } = r, x = k(r, ["value", "validators", "actions"]);
1845
+ this.registerInitialActions([...u || [], ...c || []]), this.assignParams(x), o !== void 0 ? this.assignMembers(o) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
1782
1846
  }
1783
1847
  this.completeRecords();
1784
1848
  const i = this.value;
@@ -1862,10 +1926,10 @@ class w extends A {
1862
1926
  resetTo(t, s) {
1863
1927
  const i = t;
1864
1928
  g((r) => {
1865
- r.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([o, c]) => {
1866
- var C;
1867
- let u;
1868
- s === null ? u = null : s !== void 0 && Object.hasOwn(s, o) && (u = s[o]), this.resetChild(c, (C = i.field(o)) != null ? C : c, u);
1929
+ r.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([o, u]) => {
1930
+ var x;
1931
+ let c;
1932
+ s === null ? c = null : s !== void 0 && Object.hasOwn(s, o) && (c = s[o]), this.resetChild(u, (x = i.field(o)) != null ? x : u, c);
1869
1933
  });
1870
1934
  const a = this.value;
1871
1935
  this.raw.announcedValue = a, this.originalValue = w.baseline(a), super.validate(!0);
@@ -1919,10 +1983,10 @@ class w extends A {
1919
1983
  bind(t, s) {
1920
1984
  var a, o;
1921
1985
  const i = /* @__PURE__ */ Object.create(null);
1922
- Object.entries(this._fields).forEach(([c, u]) => {
1923
- i[c] = u.bind();
1986
+ Object.entries(this._fields).forEach(([u, c]) => {
1987
+ i[u] = c.bind();
1924
1988
  });
1925
- const r = new w(i, x(p({
1989
+ const r = new w(i, C(p({
1926
1990
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
1927
1991
  value: t !== void 0 ? t : this.value
1928
1992
  }, s && "originalValue" in s ? { originalValue: s.originalValue } : {}), {
@@ -1941,13 +2005,13 @@ class w extends A {
1941
2005
  }
1942
2006
  class D extends A {
1943
2007
  constructor(t, s) {
1944
- super(je());
2008
+ super(Fe());
1945
2009
  d(this, "_itemTemplate");
1946
2010
  this._itemTemplate = t, g(() => {
1947
2011
  var r;
1948
2012
  if (s) {
1949
- const i = s, { value: a, validators: o, actions: c } = i, u = k(i, ["value", "validators", "actions"]);
1950
- this.registerInitialActions([...o || [], ...c || []]), this.assignParams(u), a != null && this.setValueInternal(a);
2013
+ const i = s, { value: a, validators: o, actions: u } = i, c = k(i, ["value", "validators", "actions"]);
2014
+ this.registerInitialActions([...o || [], ...u || []]), this.assignParams(c), a != null && this.setValueInternal(a);
1951
2015
  }
1952
2016
  this.originalValue === void 0 && (this.originalValue = D.baseline(this.value)), this.raw.announcedValue = this.value, (r = this._actions) == null || r.triggerEager(this, this.value, this.originalValue), this.validate();
1953
2017
  });
@@ -1959,8 +2023,8 @@ class D extends A {
1959
2023
  return super.raw;
1960
2024
  }
1961
2025
  /** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */
1962
- [z]() {
1963
- const t = super[z]();
2026
+ [$]() {
2027
+ const t = super[$]();
1964
2028
  return t.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, t;
1965
2029
  }
1966
2030
  /**
@@ -1989,8 +2053,8 @@ class D extends A {
1989
2053
  else if (Array.isArray(t)) {
1990
2054
  const r = (i = this.state.rows) != null ? i : [], a = new Array(t.length);
1991
2055
  for (let o = 0; o < t.length; o++) {
1992
- const c = t[o], u = r[o];
1993
- u && this._itemTemplate && !(c instanceof w) ? (this.resetChild(u, this._itemTemplate, c), a[o] = u) : (u && this.releaseChild(u), a[o] = this.processSetValueItem(c));
2056
+ const u = t[o], c = r[o];
2057
+ c && this._itemTemplate && !(u instanceof w) ? (this.resetChild(c, this._itemTemplate, u), a[o] = c) : (c && this.releaseChild(c), a[o] = this.processSetValueItem(u));
1994
2058
  }
1995
2059
  for (let o = t.length; o < r.length; o++) this.releaseChild(r[o]);
1996
2060
  this.state.rows = a;
@@ -2034,13 +2098,13 @@ class D extends A {
2034
2098
  });
2035
2099
  }
2036
2100
  bind(t, s) {
2037
- var r, a, o, c;
2038
- const i = new D((r = this._itemTemplate) == null ? void 0 : r.bind(), x(p({
2101
+ var r, a, o, u;
2102
+ const i = new D((r = this._itemTemplate) == null ? void 0 : r.bind(), C(p({
2039
2103
  // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
2040
2104
  value: [...(a = t !== void 0 ? t : this.value) != null ? a : []]
2041
2105
  }, s && "originalValue" in s ? { originalValue: s.originalValue } : {}), {
2042
2106
  enabled: (o = s == null ? void 0 : s.enabled) != null ? o : this.enabled,
2043
- visibility: (c = s == null ? void 0 : s.visibility) != null ? c : this.visibility
2107
+ visibility: (u = s == null ? void 0 : s.visibility) != null ? u : this.visibility
2044
2108
  }));
2045
2109
  return i.boundFrom(this, i.value, i.originalValue, s), i;
2046
2110
  }
@@ -2104,11 +2168,11 @@ class D extends A {
2104
2168
  let i = 0;
2105
2169
  return g((r) => {
2106
2170
  for (r.touch(this), this.state.rows == null && (this.state.rows = []), i = s < 0 ? Math.max(this.state.rows.length + s, 0) : s; this.state.rows.length < i; ) {
2107
- const o = this.createPaddingItem(), c = this.state.rows.push(o) - 1;
2108
- this.bumpValueVersion(), r.recordStructural(this, { actionClass: at, item: o, index: c });
2171
+ const o = this.createPaddingItem(), u = this.state.rows.push(o) - 1;
2172
+ this.bumpValueVersion(), r.recordStructural(this, { actionClass: rt, item: o, index: u });
2109
2173
  }
2110
2174
  const a = this.processSetValueItem(t);
2111
- this.state.rows.splice(i, 0, a), r.recordStructural(this, { actionClass: at, item: a, index: i }), this.bumpValueVersion(), this.propagateValueChanged(!0);
2175
+ this.state.rows.splice(i, 0, a), r.recordStructural(this, { actionClass: rt, item: a, index: i }), this.bumpValueVersion(), this.propagateValueChanged(!0);
2112
2176
  }), i;
2113
2177
  }
2114
2178
  /** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
@@ -2126,14 +2190,14 @@ class D extends A {
2126
2190
  }
2127
2191
  class ke extends v {
2128
2192
  constructor(t, s, i) {
2129
- super((a, o, c) => {
2130
- this.comparisonState(c).oldValue = o;
2131
- const u = this.resolve(c);
2132
- return u ? (this.listenOn(u), this.isValidComparison(b(a), b(u.value)) ? null : [
2193
+ super((a, o, u) => {
2194
+ this.comparisonState(u).oldValue = o;
2195
+ const c = this.resolve(u);
2196
+ return c ? (this.listenOn(c), this.isValidComparison(b(a), b(c.value)) ? null : [
2133
2197
  new V(
2134
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: c, otherField: u })
2198
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, otherField: c })
2135
2199
  )
2136
- ]) : (c.markRecordIncomplete(), null);
2200
+ ]) : (u.markRecordIncomplete(), null);
2137
2201
  });
2138
2202
  d(this, "isValidComparison");
2139
2203
  d(this, "otherField");
@@ -2162,7 +2226,7 @@ class ke extends v {
2162
2226
  resolve(t) {
2163
2227
  var i;
2164
2228
  const s = this.otherField;
2165
- return typeof s == "function" ? (i = s(t)) != null ? i : void 0 : typeof s == "string" ? pe(s, t) : ut(s, T(t));
2229
+ return typeof s == "function" ? (i = s(t)) != null ? i : void 0 : typeof s == "string" ? pe(s, t) : lt(s, T(t));
2166
2230
  }
2167
2231
  /**
2168
2232
  * Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
@@ -2175,8 +2239,8 @@ class ke extends v {
2175
2239
  i(s, r, a);
2176
2240
  const o = T(s);
2177
2241
  this.declarations.forEach(
2178
- (c) => Lt(c, o).forEach((u) => {
2179
- this.registrations.has(u) && this.execute(u, () => null, u.value, this.comparisonState(u).oldValue);
2242
+ (u) => Lt(u, o).forEach((c) => {
2243
+ this.registrations.has(c) && this.execute(c, () => null, c.value, this.comparisonState(c).oldValue);
2180
2244
  })
2181
2245
  );
2182
2246
  })
@@ -2189,7 +2253,7 @@ class ke extends v {
2189
2253
  return this.bindingState(t);
2190
2254
  }
2191
2255
  newBindingState() {
2192
- return x(p({}, super.newBindingState()), { oldValue: void 0 });
2256
+ return C(p({}, super.newBindingState()), { oldValue: void 0 });
2193
2257
  }
2194
2258
  unregisterFrom(t) {
2195
2259
  this.registrations.delete(t);
@@ -2204,16 +2268,16 @@ class Re extends v {
2204
2268
  separator: ", ",
2205
2269
  omission: `... (${e.length} items total)`
2206
2270
  }));
2207
- const r = (a, o, c) => e.includes(b(a)) ? null : [
2271
+ const r = (a, o, u) => e.includes(b(a)) ? null : [
2208
2272
  new V(
2209
- this.replacePlaceholders(s, { newValue: a, oldValue: o, field: c, allowedValues: e, allowedAsText: i })
2273
+ this.replacePlaceholders(s, { newValue: a, oldValue: o, field: u, allowedValues: e, allowedAsText: i })
2210
2274
  )
2211
2275
  ];
2212
2276
  super(r);
2213
2277
  }
2214
2278
  }
2215
2279
  function De(n) {
2216
- return n == null ? 0 : Tt(n) || P(n) ? n.length : Ot(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2280
+ return n == null ? 0 : At(n) || j(n) ? n.length : _t(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2217
2281
  }
2218
2282
  class Le extends v {
2219
2283
  constructor(e) {
@@ -2229,7 +2293,7 @@ class Be extends v {
2229
2293
  super(i);
2230
2294
  }
2231
2295
  }
2232
- class Ue extends v {
2296
+ class Me extends v {
2233
2297
  constructor(e, t) {
2234
2298
  const s = t || E("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > e || r === void 0 ? [
2235
2299
  new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxValue: e }))
@@ -2237,22 +2301,22 @@ class Ue extends v {
2237
2301
  super(i);
2238
2302
  }
2239
2303
  }
2240
- class Me extends v {
2304
+ class Ue extends v {
2241
2305
  constructor(e, t, s) {
2242
- const i = s || E("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, c) => a < e || a > t || a === void 0 ? [
2306
+ const i = s || E("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, u) => a < e || a > t || a === void 0 ? [
2243
2307
  new V(
2244
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: c, minValue: e, maxValue: t })
2308
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, minValue: e, maxValue: t })
2245
2309
  )
2246
2310
  ] : null;
2247
2311
  super(r);
2248
2312
  }
2249
2313
  }
2250
- function ht(n) {
2251
- return n == null ? 0 : Tt(n) || P(n) ? n.length : Ot(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2314
+ function ut(n) {
2315
+ return n == null ? 0 : At(n) || j(n) ? n.length : _t(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
2252
2316
  }
2253
2317
  class We extends v {
2254
2318
  constructor(e, t) {
2255
- const s = t || E("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => ht(r) < e ? [
2319
+ const s = t || E("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => ut(r) < e ? [
2256
2320
  new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: e }))
2257
2321
  ] : null;
2258
2322
  super(i);
@@ -2260,7 +2324,7 @@ class We extends v {
2260
2324
  }
2261
2325
  class $e extends v {
2262
2326
  constructor(e, t) {
2263
- const s = t || E("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => ht(r) > e ? [
2327
+ const s = t || E("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => ut(r) > e ? [
2264
2328
  new V(this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: e }))
2265
2329
  ] : null;
2266
2330
  super(i);
@@ -2268,11 +2332,11 @@ class $e extends v {
2268
2332
  }
2269
2333
  class qe extends v {
2270
2334
  constructor(e, t, s) {
2271
- const i = s || E("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, c) => {
2272
- const u = ht(a);
2273
- return u < e || u > t ? [
2335
+ const i = s || E("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, u) => {
2336
+ const c = ut(a);
2337
+ return c < e || c > t ? [
2274
2338
  new V(
2275
- this.replacePlaceholders(i, { newValue: a, oldValue: o, field: c, minLength: e, maxLength: t })
2339
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: u, minLength: e, maxLength: t })
2276
2340
  )
2277
2341
  ] : null;
2278
2342
  };
@@ -2293,25 +2357,25 @@ const He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2357
  InAllowedValues: Re,
2294
2358
  LengthInRange: qe,
2295
2359
  MaxLength: $e,
2296
- MaxValue: Ue,
2360
+ MaxValue: Me,
2297
2361
  MinLength: We,
2298
2362
  MinValue: Be,
2299
2363
  Pattern: ze,
2300
2364
  Required: Le,
2301
2365
  Validator: v,
2302
- ValueInRange: Me
2366
+ ValueInRange: Ue
2303
2367
  }, Symbol.toStringTag, { value: "Module" })), Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2304
2368
  __proto__: null,
2305
- AbortEventHandlingException: rt,
2306
- Action: Fe,
2307
- ActionsMap: M,
2369
+ AbortEventHandlingException: Ot,
2370
+ Action: Pe,
2371
+ ActionsMap: H,
2308
2372
  ConditionalEnabledAction: ve,
2309
2373
  ConditionalStatementAction: Q,
2310
2374
  ConditionalValueAction: Ve,
2311
2375
  ConditionalVisibilityAction: be,
2312
2376
  DisplayMode: N,
2313
- EmptyField: Pe,
2314
- EnabledChangedAction: Ut,
2377
+ EmptyField: je,
2378
+ EnabledChangedAction: Mt,
2315
2379
  EnabledChangingAction: Bt,
2316
2380
  ExecuteAction: qt,
2317
2381
  Field: X,
@@ -2319,38 +2383,38 @@ const He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2319
2383
  FieldBase: A,
2320
2384
  Group: w,
2321
2385
  List: D,
2322
- ListItemAddedAction: at,
2386
+ ListItemAddedAction: rt,
2323
2387
  ListItemRemovedAction: zt,
2324
- MdString: U,
2388
+ MdString: B,
2325
2389
  MessagesWidget: Ne,
2326
2390
  Operator: m,
2327
2391
  RenderableValue: he,
2328
2392
  Statement: I,
2329
- ValidChangedAction: Mt,
2330
- ValidationError: ct,
2393
+ ValidChangedAction: Ut,
2394
+ ValidationError: ot,
2331
2395
  ValidationErrorRenderContent: V,
2332
- ValidationErrorText: ue,
2396
+ ValidationErrorText: ce,
2333
2397
  Validator: v,
2334
2398
  Validators: He,
2335
2399
  ValueChangedAction: O,
2336
2400
  VisibilityChangedAction: $t,
2337
2401
  VisibilityChangingAction: Wt,
2338
2402
  buildErrorMessage: E,
2339
- isCallableFunction: H,
2340
- isSimpleComponentDef: lt,
2341
- transaction: ot
2403
+ isCallableFunction: z,
2404
+ isSimpleComponentDef: at,
2405
+ transaction: q
2342
2406
  }, Symbol.toStringTag, { value: "Module" }));
2343
2407
  export {
2344
- rt as AbortEventHandlingException,
2345
- Fe as Action,
2346
- M as ActionsMap,
2408
+ Ot as AbortEventHandlingException,
2409
+ Pe as Action,
2410
+ H as ActionsMap,
2347
2411
  ve as ConditionalEnabledAction,
2348
2412
  Q as ConditionalStatementAction,
2349
2413
  Ve as ConditionalValueAction,
2350
2414
  be as ConditionalVisibilityAction,
2351
2415
  N as DisplayMode,
2352
- Pe as EmptyField,
2353
- Ut as EnabledChangedAction,
2416
+ je as EmptyField,
2417
+ Mt as EnabledChangedAction,
2354
2418
  Bt as EnabledChangingAction,
2355
2419
  qt as ExecuteAction,
2356
2420
  X as Field,
@@ -2358,17 +2422,17 @@ export {
2358
2422
  A as FieldBase,
2359
2423
  w as Group,
2360
2424
  D as List,
2361
- at as ListItemAddedAction,
2425
+ rt as ListItemAddedAction,
2362
2426
  zt as ListItemRemovedAction,
2363
- U as MdString,
2427
+ B as MdString,
2364
2428
  Ne as MessagesWidget,
2365
2429
  m as Operator,
2366
2430
  he as RenderableValue,
2367
2431
  I as Statement,
2368
- Mt as ValidChangedAction,
2369
- ct as ValidationError,
2432
+ Ut as ValidChangedAction,
2433
+ ot as ValidationError,
2370
2434
  V as ValidationErrorRenderContent,
2371
- ue as ValidationErrorText,
2435
+ ce as ValidationErrorText,
2372
2436
  v as Validator,
2373
2437
  He as Validators,
2374
2438
  O as ValueChangedAction,
@@ -2377,8 +2441,8 @@ export {
2377
2441
  E as buildErrorMessage,
2378
2442
  Je as default,
2379
2443
  Ye as forms,
2380
- H as isCallableFunction,
2381
- lt as isSimpleComponentDef,
2382
- ot as transaction
2444
+ z as isCallableFunction,
2445
+ at as isSimpleComponentDef,
2446
+ q as transaction
2383
2447
  };
2384
2448
  //# sourceMappingURL=dynamicforms-vue-forms.js.map