haori 0.57.1 → 0.59.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.
package/dist/haori.es.js CHANGED
@@ -31,11 +31,11 @@ const me = class me {
31
31
  me.devMode = !1;
32
32
  let q = me;
33
33
  const Be = "embedded";
34
- function Qe(b) {
34
+ function _e(b) {
35
35
  return b === "embedded" || b === "demo";
36
36
  }
37
- function bt(b) {
38
- return b === null ? null : Qe(b) ? b : Be;
37
+ function At(b) {
38
+ return b === null ? null : _e(b) ? b : Be;
39
39
  }
40
40
  const ee = class ee {
41
41
  /**
@@ -73,7 +73,7 @@ const ee = class ee {
73
73
  * @return 戻り値はありません。
74
74
  */
75
75
  static setRuntime(e) {
76
- ee._runtime = Qe(e) ? e : Be;
76
+ ee._runtime = _e(e) ? e : Be;
77
77
  }
78
78
  /**
79
79
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -87,7 +87,7 @@ const ee = class ee {
87
87
  if (e instanceof HTMLScriptElement) {
88
88
  const r = e.getAttribute("data-prefix") || ee._prefix;
89
89
  ee._prefix = r.endsWith("-") ? r : r + "-";
90
- const i = bt(
90
+ const i = At(
91
91
  e.getAttribute("data-runtime")
92
92
  );
93
93
  i !== null && (ee._runtime = i), ee._strictBind = e.hasAttribute(
@@ -422,11 +422,11 @@ const Et = /^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/, Ke = "new:
422
422
  };
423
423
  M.enhancers = /* @__PURE__ */ new Map(), M.instances = /* @__PURE__ */ new WeakMap(), M.warnedUnknownNames = /* @__PURE__ */ new Set(), M.warnedMissingGlobals = /* @__PURE__ */ new Set(), M.visited = /* @__PURE__ */ new WeakSet(), M.mutationCapture = null;
424
424
  let te = M;
425
- const _e = "yyyy/MM/dd HH:mm", At = "en-US", ze = 1e4;
425
+ const et = "yyyy/MM/dd HH:mm", vt = "en-US", ze = 1e4;
426
426
  function le(b) {
427
427
  return String(b).padStart(2, "0");
428
428
  }
429
- function et(b, e, t, r, i, n) {
429
+ function tt(b, e, t, r, i, n) {
430
430
  return {
431
431
  yyyy: String(b).padStart(4, "0"),
432
432
  yy: le(b % 100),
@@ -440,7 +440,7 @@ function et(b, e, t, r, i, n) {
440
440
  ss: le(n)
441
441
  };
442
442
  }
443
- function tt(b, e) {
443
+ function rt(b, e) {
444
444
  let t;
445
445
  try {
446
446
  t = new Intl.DateTimeFormat("en-US", {
@@ -460,9 +460,9 @@ function tt(b, e) {
460
460
  for (const u of t)
461
461
  u.type !== "literal" && (r[u.type] = u.value);
462
462
  const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), c = Number(r.second);
463
- return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : et(i, n, s, a, o, c);
463
+ return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : tt(i, n, s, a, o, c);
464
464
  }
465
- function Pe(b, e = _e, t) {
465
+ function Pe(b, e = et, t) {
466
466
  if (b == null || b === "")
467
467
  return "";
468
468
  const r = b instanceof Date ? b : new Date(b);
@@ -470,10 +470,10 @@ function Pe(b, e = _e, t) {
470
470
  return "";
471
471
  let i;
472
472
  if (typeof t == "string" && t.trim() !== "") {
473
- if (i = tt(r, t.trim()), i === null)
473
+ if (i = rt(r, t.trim()), i === null)
474
474
  return "";
475
475
  } else
476
- i = et(
476
+ i = tt(
477
477
  r.getFullYear(),
478
478
  r.getMonth() + 1,
479
479
  r.getDate(),
@@ -487,15 +487,15 @@ function Pe(b, e = _e, t) {
487
487
  (s, a) => a !== void 0 ? a === "" ? "'" : a : n[s]
488
488
  );
489
489
  }
490
- const vt = "yyyy-MM-dd";
491
- function rt(b = _e, e) {
490
+ const wt = "yyyy-MM-dd";
491
+ function it(b = et, e) {
492
492
  return Pe(/* @__PURE__ */ new Date(), b, e);
493
493
  }
494
- function it(b = 0, e = vt, t) {
494
+ function nt(b = 0, e = wt, t) {
495
495
  const r = Number.isFinite(b) ? Math.trunc(b) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
496
496
  let n, s, a;
497
497
  if (i !== "") {
498
- const c = tt(/* @__PURE__ */ new Date(), i);
498
+ const c = rt(/* @__PURE__ */ new Date(), i);
499
499
  if (c === null)
500
500
  return "";
501
501
  n = Number(c.yyyy), s = Number(c.MM), a = Number(c.dd);
@@ -506,7 +506,7 @@ function it(b = 0, e = vt, t) {
506
506
  const o = new Date(Date.UTC(n, s - 1, a + r));
507
507
  return Pe(o, e, "UTC");
508
508
  }
509
- function nt(b, e) {
509
+ function st(b, e) {
510
510
  if (b == null)
511
511
  return "";
512
512
  let t;
@@ -525,9 +525,9 @@ function nt(b, e) {
525
525
  const i = Math.max(0, Math.trunc(e));
526
526
  r.minimumFractionDigits = i, r.maximumFractionDigits = i;
527
527
  }
528
- return new Intl.NumberFormat(At, r).format(t);
528
+ return new Intl.NumberFormat(vt, r).format(t);
529
529
  }
530
- function st(b, e, t) {
530
+ function at(b, e, t) {
531
531
  let r, i, n;
532
532
  if (e === void 0 ? (r = 0, i = b, n = 1) : (r = b, i = e, n = t === void 0 ? 1 : t), !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(n) || n === 0)
533
533
  return [];
@@ -541,7 +541,7 @@ function st(b, e, t) {
541
541
  s.push(a);
542
542
  return s;
543
543
  }
544
- function at(b, e, t = {}) {
544
+ function ot(b, e, t = {}) {
545
545
  const r = Math.trunc(Number(b));
546
546
  if (!Number.isFinite(r) || r <= 0)
547
547
  return [];
@@ -578,15 +578,15 @@ function at(b, e, t = {}) {
578
578
  }
579
579
  return c;
580
580
  }
581
- const wt = /^(\d{4})-(\d{1,2})$/, St = 1200;
582
- function Ne(b, e) {
581
+ const St = /^(\d{4})-(\d{1,2})$/, Rt = 1200;
582
+ function ke(b, e) {
583
583
  const t = Number(b);
584
584
  return Number.isFinite(t) ? Math.trunc(t) : e;
585
585
  }
586
586
  function Le(b, e) {
587
587
  if (typeof b != "string")
588
588
  return "";
589
- const t = wt.exec(b.trim());
589
+ const t = St.exec(b.trim());
590
590
  if (!t)
591
591
  return "";
592
592
  const r = Number(t[1]), i = Number(t[2]);
@@ -595,45 +595,45 @@ function Le(b, e) {
595
595
  const n = Number.isFinite(e) ? Math.trunc(e) : 0, s = r * 12 + (i - 1) + n, a = Math.floor(s / 12), o = s - a * 12 + 1;
596
596
  return `${String(a).padStart(4, "0")}-${le(o)}`;
597
597
  }
598
- function Rt(b) {
598
+ function Tt(b) {
599
599
  if (typeof b == "string" && b.trim() !== "")
600
600
  return Le(b, 0);
601
601
  const e = /* @__PURE__ */ new Date();
602
602
  return `${String(e.getFullYear()).padStart(4, "0")}-${le(e.getMonth() + 1)}`;
603
603
  }
604
- function ot(b, e) {
604
+ function lt(b, e) {
605
605
  const t = Math.trunc(Number(b));
606
606
  if (!Number.isFinite(t) || t < 0)
607
607
  return [];
608
- const r = Rt(e);
608
+ const r = Tt(e);
609
609
  if (r === "")
610
610
  return [];
611
- const i = Math.min(t, St), n = [];
611
+ const i = Math.min(t, Rt), n = [];
612
612
  for (let s = 0; s <= i; s += 1) {
613
613
  const a = Le(r, -s);
614
614
  n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
615
615
  }
616
616
  return n;
617
617
  }
618
- function lt(b, e) {
618
+ function ct(b, e) {
619
619
  const t = { start: 0, end: 0, total: 0, empty: !0 };
620
620
  if (!b || typeof b != "object")
621
621
  return t;
622
- const r = b, i = Ne(r.totalElements ?? r.totalCount, 0);
622
+ const r = b, i = ke(r.totalElements ?? r.totalCount, 0);
623
623
  if (i <= 0)
624
624
  return t;
625
- const n = Math.max(0, Ne(r.number, 0)), s = Math.max(0, Ne(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
625
+ const n = Math.max(0, ke(r.number, 0)), s = Math.max(0, ke(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
626
626
  let c;
627
627
  if (e !== void 0 && Number.isFinite(e))
628
628
  c = Math.max(0, Math.trunc(e));
629
629
  else {
630
- const d = Ne(r.numberOfElements, NaN);
630
+ const d = ke(r.numberOfElements, NaN);
631
631
  c = Number.isFinite(d) ? d : Math.min(s, i - a);
632
632
  }
633
633
  const u = Math.min(a + c, i);
634
634
  return { start: o, end: Math.max(u, o), total: i, empty: !1 };
635
635
  }
636
- function ct(b, e, t) {
636
+ function ut(b, e, t) {
637
637
  if (!Array.isArray(b) || b.length === 0)
638
638
  return null;
639
639
  const r = String(t), i = b.find(
@@ -641,7 +641,7 @@ function ct(b, e, t) {
641
641
  );
642
642
  return i === void 0 ? null : i;
643
643
  }
644
- function ut(b, e) {
644
+ function dt(b, e) {
645
645
  if (!Array.isArray(b))
646
646
  return 0;
647
647
  let t = 0;
@@ -654,25 +654,25 @@ function ut(b, e) {
654
654
  }
655
655
  return t;
656
656
  }
657
- function dt(b, e) {
657
+ function ft(b, e) {
658
658
  return e == null || b == null ? String(b) : String(b[e]);
659
659
  }
660
- function ft(b, e) {
660
+ function ht(b, e) {
661
661
  if (!Array.isArray(b))
662
662
  return [];
663
663
  const t = /* @__PURE__ */ new Set(), r = [];
664
664
  for (const i of b) {
665
- const n = dt(i, e);
665
+ const n = ft(i, e);
666
666
  t.has(n) || (t.add(n), r.push(i));
667
667
  }
668
668
  return r;
669
669
  }
670
- function ht(b, e) {
670
+ function pt(b, e) {
671
671
  if (!Array.isArray(b))
672
672
  return [];
673
673
  const t = /* @__PURE__ */ new Map(), r = [];
674
674
  for (const i of b) {
675
- const n = dt(i, e), s = t.get(n);
675
+ const n = ft(i, e), s = t.get(n);
676
676
  if (s === void 0) {
677
677
  const a = i == null ? i : i[e];
678
678
  t.set(n, r.length), r.push({ key: a, items: [i] });
@@ -681,20 +681,20 @@ function ht(b, e) {
681
681
  }
682
682
  return r;
683
683
  }
684
- const Tt = Object.freeze({
684
+ const Dt = Object.freeze({
685
685
  date: Pe,
686
- now: rt,
687
- today: it,
688
- number: nt,
689
- pages: at,
690
- range: st,
686
+ now: it,
687
+ today: nt,
688
+ number: st,
689
+ pages: ot,
690
+ range: at,
691
691
  monthAdd: Le,
692
- monthRange: ot,
693
- pageSummary: lt,
694
- findBy: ct,
695
- sum: ut,
696
- distinct: ft,
697
- groupBy: ht
692
+ monthRange: lt,
693
+ pageSummary: ct,
694
+ findBy: ut,
695
+ sum: dt,
696
+ distinct: ht,
697
+ groupBy: pt
698
698
  });
699
699
  class qe {
700
700
  constructor() {
@@ -827,7 +827,7 @@ const je = class je {
827
827
  }
828
828
  };
829
829
  je.ASYNC_QUEUE = new qe();
830
- let K = je;
830
+ let z = je;
831
831
  const R = class R {
832
832
  /**
833
833
  * ストレージを、参照が例外になる環境でも安全に読み出します。
@@ -1283,7 +1283,7 @@ let ${e.join(", ")};`;
1283
1283
  * @return 戻り値はありません。
1284
1284
  */
1285
1285
  static scheduleUnresolvedIdentifierReport() {
1286
- this.unresolvedReportScheduled || (this.unresolvedReportScheduled = !0, K.waitForIdle().then(() => {
1286
+ this.unresolvedReportScheduled || (this.unresolvedReportScheduled = !0, z.waitForIdle().then(() => {
1287
1287
  this.unresolvedReportScheduled = !1, this.reportUnresolvedIdentifiers();
1288
1288
  }));
1289
1289
  }
@@ -1351,7 +1351,7 @@ let ${e.join(", ")};`;
1351
1351
  this.pendingScopeMissingIdentifiers.delete(t);
1352
1352
  return;
1353
1353
  }
1354
- this.pendingScopeMissingIdentifiers.set(t, new Set(e)), !this.scopeMissingReportScheduled && (this.scopeMissingReportScheduled = !0, K.waitForIdle().then(() => {
1354
+ this.pendingScopeMissingIdentifiers.set(t, new Set(e)), !this.scopeMissingReportScheduled && (this.scopeMissingReportScheduled = !0, z.waitForIdle().then(() => {
1355
1355
  this.scopeMissingReportScheduled = !1, this.reportScopeMissingIdentifiers();
1356
1356
  }));
1357
1357
  }
@@ -1528,35 +1528,35 @@ ${t}`;
1528
1528
  if (g.compileFailed || g.evaluator === null)
1529
1529
  return { value: null, unresolvedReference: !1 };
1530
1530
  try {
1531
- const y = [], E = this.wrapBoundValues(a);
1532
- g.bindKeys.forEach((D) => {
1533
- y.push(E[D]);
1531
+ const y = [], A = this.wrapBoundValues(a);
1532
+ g.bindKeys.forEach((T) => {
1533
+ y.push(A[T]);
1534
1534
  });
1535
- const A = this.withBlockedPropertyAccess(
1535
+ const E = this.withBlockedPropertyAccess(
1536
1536
  () => g.evaluator(...y)
1537
1537
  );
1538
- return A === void 0 && this.warnBlockedIdentifiers(e), {
1539
- value: A,
1538
+ return E === void 0 && this.warnBlockedIdentifiers(e), {
1539
+ value: E,
1540
1540
  // `undefined` になる参照は「値が無い」状態であり、未解決参照として扱う。
1541
1541
  // 暗黙のオプショナルチェーンにより、`null` / `undefined` を経由した
1542
1542
  // メンバーアクセスもここへ集約される。
1543
- unresolvedReference: A === void 0
1543
+ unresolvedReference: E === void 0
1544
1544
  };
1545
1545
  } catch (y) {
1546
1546
  if (o && y instanceof ReferenceError) {
1547
- const E = this.extractMissingIdentifier(y);
1548
- if (E !== null && this.canRecoverMissingIdentifier(E, a)) {
1549
- a[E] = void 0;
1547
+ const A = this.extractMissingIdentifier(y);
1548
+ if (A !== null && this.canRecoverMissingIdentifier(A, a)) {
1549
+ a[A] = void 0;
1550
1550
  continue;
1551
1551
  }
1552
1552
  }
1553
1553
  if (this.warnBlockedIdentifiers(e), y instanceof ReferenceError && u.length > 0) {
1554
- const E = this.evaluateAsCondition(
1554
+ const A = this.evaluateAsCondition(
1555
1555
  e,
1556
1556
  a,
1557
1557
  u
1558
1558
  );
1559
- return E !== void 0 ? { value: E, unresolvedReference: !1 } : (this.recordUnresolvedIdentifiers(
1559
+ return A !== void 0 ? { value: A, unresolvedReference: !1 } : (this.recordUnresolvedIdentifiers(
1560
1560
  this.extractUninitializedIdentifiers(y, u),
1561
1561
  e
1562
1562
  ), { value: void 0, unresolvedReference: !0 });
@@ -1581,12 +1581,12 @@ ${t}`;
1581
1581
  */
1582
1582
  static prepareEvaluator(e, t, r = []) {
1583
1583
  const i = Object.keys(t).filter(
1584
- (A) => !this.FORBIDDEN_BINDING_NAMES.has(A)
1584
+ (E) => !this.FORBIDDEN_BINDING_NAMES.has(E)
1585
1585
  ), n = [], s = [];
1586
- i.forEach((A) => {
1587
- this.isUsableBindingKey(A) ? n.push(A) : s.push(A);
1586
+ i.forEach((E) => {
1587
+ this.isUsableBindingKey(E) ? n.push(E) : s.push(E);
1588
1588
  }), n.sort(), this.reportUnusableBindingKeys(s);
1589
- const a = new Set(n), o = r.filter((A) => !a.has(A)), c = `${e}:${n.join(",")}:${o.join(
1589
+ const a = new Set(n), o = r.filter((E) => !a.has(E)), c = `${e}:${n.join(",")}:${o.join(
1590
1590
  ","
1591
1591
  )}`;
1592
1592
  let u = this.EXPRESSION_CACHE.get(c) || null;
@@ -1598,22 +1598,22 @@ ${t}`;
1598
1598
  };
1599
1599
  const d = this.buildAssignments(n), g = this.buildShadowDeclarations(o), y = this.toGuardedMemberExpression(
1600
1600
  this.toOptionalChainExpression(e)
1601
- ), E = d ? `"use strict";
1601
+ ), A = d ? `"use strict";
1602
1602
  ${d};
1603
1603
  return (${y});${g}` : `"use strict";
1604
1604
  return (${y});${g}`;
1605
1605
  try {
1606
- return u = new Function(...n, E), this.EXPRESSION_CACHE.set(c, u), this.compileFailedExpressions.delete(e), {
1606
+ return u = new Function(...n, A), this.EXPRESSION_CACHE.set(c, u), this.compileFailedExpressions.delete(e), {
1607
1607
  bindKeys: n,
1608
1608
  evaluator: u,
1609
1609
  compileFailed: !1
1610
1610
  };
1611
- } catch (A) {
1611
+ } catch (E) {
1612
1612
  return o.length > 0 ? (m.warn(
1613
1613
  "[Haori]",
1614
1614
  "Failed to shadow undeclared identifier(s): " + o.join(", ") + ". Falling back to evaluation without shadowing.",
1615
1615
  e
1616
- ), this.prepareEvaluator(e, t, [])) : (m.error("[Haori]", "Failed to compile expression:", e, A), this.compileFailedExpressions.add(e), {
1616
+ ), this.prepareEvaluator(e, t, [])) : (m.error("[Haori]", "Failed to compile expression:", e, E), this.compileFailedExpressions.add(e), {
1617
1617
  bindKeys: n,
1618
1618
  evaluator: null,
1619
1619
  compileFailed: !0
@@ -2316,7 +2316,7 @@ return (${y});${g}`;
2316
2316
  }
2317
2317
  };
2318
2318
  R.MAX_IDENTIFIER_RECOVERY_COUNT = 8, R.BUILTIN_NAMESPACE = "haori", R.BUILTIN_HELPERS = {
2319
- ...Tt
2319
+ ...Dt
2320
2320
  }, R.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, R.BUILTIN_DATA_PROPERTY = "data", R.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, R.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, R.usableBindingKeyCache = /* @__PURE__ */ new Map(), R.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), R.compileFailedExpressions = /* @__PURE__ */ new Set(), R.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), R.forbiddenBindingValueCacheResetScheduled = !1, R.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), R.loggedForbiddenKeyResetScheduled = !1, R.FORBIDDEN_NAMES = [
2321
2321
  // グローバルオブジェクト
2322
2322
  "window",
@@ -2931,7 +2931,7 @@ const ce = class ce {
2931
2931
  return Promise.resolve();
2932
2932
  if (this.parent) {
2933
2933
  const e = this.parent, t = e.skipMutationNodes;
2934
- return e.holdSkipMutationNode(this.target), K.enqueue(() => {
2934
+ return e.holdSkipMutationNode(this.target), z.enqueue(() => {
2935
2935
  e.skipMutationNodes = !0, this.target.parentNode === e.getTarget() && e.getTarget().removeChild(this.target), this.mounted = !1;
2936
2936
  }).finally(() => {
2937
2937
  e.skipMutationNodes = t, e.releaseSkipMutationNode(this.target);
@@ -2939,7 +2939,7 @@ const ce = class ce {
2939
2939
  } else {
2940
2940
  const e = this.target.parentNode;
2941
2941
  if (e)
2942
- return K.enqueue(() => {
2942
+ return z.enqueue(() => {
2943
2943
  this.target.parentNode === e && e.removeChild(this.target), this.mounted = !1;
2944
2944
  });
2945
2945
  this.mounted = !1;
@@ -2956,7 +2956,7 @@ const ce = class ce {
2956
2956
  return Promise.resolve();
2957
2957
  if (this.parent) {
2958
2958
  const e = this.parent, t = e.skipMutationNodes;
2959
- return e.holdSkipMutationNode(this.target), K.enqueue(() => {
2959
+ return e.holdSkipMutationNode(this.target), z.enqueue(() => {
2960
2960
  e.skipMutationNodes = !0, this.target.parentNode !== e.getTarget() && e.getTarget().appendChild(this.target), this.mounted = !0;
2961
2961
  }).finally(() => {
2962
2962
  e.skipMutationNodes = t, e.releaseSkipMutationNode(this.target);
@@ -3635,7 +3635,7 @@ const w = class w extends I {
3635
3635
  return Promise.resolve();
3636
3636
  const i = this.getTarget();
3637
3637
  if (i instanceof HTMLInputElement && i.type === "file")
3638
- return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : K.enqueue(() => {
3638
+ return e === null || e === "" ? (this.value = null, i.value === "" ? Promise.resolve() : z.enqueue(() => {
3639
3639
  i.value = "";
3640
3640
  })) : (m.warn(
3641
3641
  "[Haori]",
@@ -3724,7 +3724,7 @@ const w = class w extends I {
3724
3724
  */
3725
3725
  enqueueValueWrite(e) {
3726
3726
  this.skipChangeValue = !0;
3727
- const t = K.enqueue(e).finally(() => {
3727
+ const t = z.enqueue(e).finally(() => {
3728
3728
  this.skipChangeValue = !1;
3729
3729
  });
3730
3730
  return this.pendingValueWrite = t, t;
@@ -4460,7 +4460,7 @@ const w = class w extends I {
4460
4460
  const i = this.getTarget(), n = i.hasAttribute(e), s = t !== e && i.hasAttribute(t);
4461
4461
  if (!n && !s)
4462
4462
  return Promise.resolve();
4463
- const a = K.enqueue(() => {
4463
+ const a = z.enqueue(() => {
4464
4464
  n && i.removeAttribute(e), s && i.removeAttribute(t);
4465
4465
  }).finally(() => {
4466
4466
  this.releaseSelfWritingAttributes(r);
@@ -4495,7 +4495,7 @@ const w = class w extends I {
4495
4495
  if (n) {
4496
4496
  const ye = this.attributeMap.get(e);
4497
4497
  if (ye && (ye.isEvaluate || ye.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
4498
- const Te = K.enqueue(() => {
4498
+ const Te = z.enqueue(() => {
4499
4499
  }).finally(() => {
4500
4500
  this.releaseSelfWritingAttributes(s);
4501
4501
  });
@@ -4508,13 +4508,13 @@ const w = class w extends I {
4508
4508
  element: c,
4509
4509
  rawName: e,
4510
4510
  template: r
4511
- }), d = o.isEvaluate || o.isRawEvaluate, g = e === t && w.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E = ue.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, D = t === "value" && w.resolveDeclaredValueType(c) === "boolean", N = A === !1 && !D, B = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || N : g ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : y ? u.hasUnresolvedReference || A === null || A === void 0 || N : d && E === "");
4511
+ }), d = o.isEvaluate || o.isRawEvaluate, g = e === t && w.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), A = ue.joinEvaluateResults(u.results), E = u.results.length === 1 ? u.results[0] : A, T = t === "value" && w.resolveDeclaredValueType(c) === "boolean", N = E === !1 && !T, B = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || E === null || E === void 0 || N : g ? u.hasUnresolvedReference || E === null || E === void 0 || E === !1 : y ? u.hasUnresolvedReference || E === null || E === void 0 || N : d && A === "");
4512
4512
  if (B && u.hasUnresolvedReference && w.warnUnresolvedAttribute(
4513
4513
  e,
4514
4514
  t,
4515
4515
  r,
4516
4516
  c
4517
- ), q.isEnabled() && A === !1 && y) {
4517
+ ), q.isEnabled() && E === !1 && y) {
4518
4518
  const ye = o.getSingleExpression(), Te = ye === null ? null : ie.diagnoseStrictComparison(
4519
4519
  ye,
4520
4520
  this.getBindingData()
@@ -4526,17 +4526,17 @@ const w = class w extends I {
4526
4526
  c
4527
4527
  );
4528
4528
  }
4529
- const F = o.isForceEvaluation() ? r : y ? A : E, j = i && o.isEvaluate && t === "value" && w.isValuePropertyTarget(c), J = c.getRootNode(), _ = j && w.isUserEditableValue(c) && (c === J.activeElement || this.hasPendingUserEdit()), P = B || F === null || F === !1 && !D ? null : String(F), se = e !== t && c.getAttribute(e) !== r, G = P === null ? c.hasAttribute(t) : c.getAttribute(t) !== P, T = P === null ? "" : P, L = j && !_ && c.value !== T, Y = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), Q = t === "selected" && c instanceof HTMLOptionElement, de = J.activeElement, oe = de !== null && (Y && c === de || Q && c.closest("select") === de) || (Y || Q) && this.hasPendingCheckableUserEdit(Q), W = P !== null, z = Y && o.isEvaluate && !oe && c.checked !== W, X = Q && o.isEvaluate && !oe && c.selected !== W;
4530
- if (!se && !G && !L && !z && !X)
4529
+ const F = o.isForceEvaluation() ? r : y ? E : A, j = i && o.isEvaluate && t === "value" && w.isValuePropertyTarget(c), Z = c.getRootNode(), _ = j && w.isUserEditableValue(c) && (c === Z.activeElement || this.hasPendingUserEdit()), P = B || F === null || F === !1 && !T ? null : String(F), se = e !== t && c.getAttribute(e) !== r, Y = P === null ? c.hasAttribute(t) : c.getAttribute(t) !== P, D = P === null ? "" : P, L = j && !_ && c.value !== D, X = t === "checked" && c instanceof HTMLInputElement && (c.type === "checkbox" || c.type === "radio"), Q = t === "selected" && c instanceof HTMLOptionElement, de = Z.activeElement, oe = de !== null && (X && c === de || Q && c.closest("select") === de) || (X || Q) && this.hasPendingCheckableUserEdit(Q), W = P !== null, G = X && o.isEvaluate && !oe && c.checked !== W, J = Q && o.isEvaluate && !oe && c.selected !== W;
4530
+ if (!se && !Y && !L && !G && !J)
4531
4531
  return j && !_ && (this.value = this.normalizeValueForElement(
4532
4532
  c,
4533
- T
4534
- ), this.clearUnappliedValueWrite()), (Y || Q) && !oe && this.syncCheckableValueFromDom(Q), Promise.resolve();
4535
- const Re = K.enqueue(() => {
4536
- se && c.setAttribute(e, r), P === null ? c.removeAttribute(t) : G && (c.setAttribute(t, P), t === `${l.prefix}bind` && this.recordSelfWrittenBind(P)), t === "style" && this.captureAndHideDisplay(), j && !_ && (this.value = this.normalizeValueForElement(
4533
+ D
4534
+ ), this.clearUnappliedValueWrite()), (X || Q) && !oe && this.syncCheckableValueFromDom(Q), Promise.resolve();
4535
+ const Re = z.enqueue(() => {
4536
+ se && c.setAttribute(e, r), P === null ? c.removeAttribute(t) : Y && (c.setAttribute(t, P), t === `${l.prefix}bind` && this.recordSelfWrittenBind(P)), t === "style" && this.captureAndHideDisplay(), j && !_ && (this.value = this.normalizeValueForElement(
4537
4537
  c,
4538
- T
4539
- ), L && (c.value = T), this.recordValueWriteResult(c.value === T)), z && (c.checked = W), X && (c.selected = W), (z || X) && this.syncCheckableValueFromDom(X);
4538
+ D
4539
+ ), L && (c.value = D), this.recordValueWriteResult(c.value === D)), G && (c.checked = W), J && (c.selected = W), (G || J) && this.syncCheckableValueFromDom(J);
4540
4540
  }).finally(() => {
4541
4541
  this.releaseSelfWritingAttributes(s);
4542
4542
  });
@@ -4559,7 +4559,7 @@ const w = class w extends I {
4559
4559
  const t = this.getTarget();
4560
4560
  if (!t.hasAttribute(e))
4561
4561
  return Promise.resolve();
4562
- const r = K.enqueue(() => {
4562
+ const r = z.enqueue(() => {
4563
4563
  t.removeAttribute(e);
4564
4564
  }).finally(() => {
4565
4565
  this.releaseSelfWritingAttributes([e]);
@@ -4695,7 +4695,7 @@ const w = class w extends I {
4695
4695
  }
4696
4696
  e.setParent(this), e.setMounted(this.mounted);
4697
4697
  const d = this.skipMutationNodes;
4698
- return this.skipMutationNodes = !0, this.holdSkipMutationNode(e.getTarget()), K.enqueue(() => {
4698
+ return this.skipMutationNodes = !0, this.holdSkipMutationNode(e.getTarget()), z.enqueue(() => {
4699
4699
  this.target.insertBefore(e.getTarget(), u);
4700
4700
  }).finally(() => {
4701
4701
  this.skipMutationNodes = d, this.releaseSkipMutationNode(e.getTarget());
@@ -5036,7 +5036,7 @@ class ne extends I {
5036
5036
  evaluate() {
5037
5037
  return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
5038
5038
  new Error("Parent fragment is required for raw evaluation")
5039
- ) : K.enqueue(() => {
5039
+ ) : z.enqueue(() => {
5040
5040
  this.skipMutation = !0;
5041
5041
  let e = this.text;
5042
5042
  this.contents.isRawEvaluate ? e = this.contents.evaluate(this.parent.getBindingData(), {
@@ -5093,7 +5093,7 @@ class We extends I {
5093
5093
  * @return 更新のPromise
5094
5094
  */
5095
5095
  setContent(e) {
5096
- return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, K.enqueue(() => {
5096
+ return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, z.enqueue(() => {
5097
5097
  this.skipMutation = !0, this.target.textContent = this.text;
5098
5098
  }).finally(() => {
5099
5099
  this.skipMutation = !1;
@@ -5351,7 +5351,7 @@ const ve = class ve {
5351
5351
  * @return すべてのレンダリングが完了したら解決される Promise
5352
5352
  */
5353
5353
  static waitForRenders() {
5354
- return K.waitForIdle();
5354
+ return z.waitForIdle();
5355
5355
  }
5356
5356
  /**
5357
5357
  * 通知ダイアログを表示します。
@@ -5360,7 +5360,7 @@ const ve = class ve {
5360
5360
  * @returns 通知が閉じられると解決されるPromise
5361
5361
  */
5362
5362
  static dialog(e) {
5363
- return K.enqueue(() => {
5363
+ return z.enqueue(() => {
5364
5364
  window.alert(e);
5365
5365
  }, !0);
5366
5366
  }
@@ -5388,7 +5388,7 @@ const ve = class ve {
5388
5388
  * @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
5389
5389
  */
5390
5390
  static confirm(e) {
5391
- return K.enqueue(() => window.confirm(e), !0);
5391
+ return z.enqueue(() => window.confirm(e), !0);
5392
5392
  }
5393
5393
  /**
5394
5394
  * ダイアログを開きます。
@@ -5396,7 +5396,7 @@ const ve = class ve {
5396
5396
  * @param element 開くダイアログのHTML要素
5397
5397
  */
5398
5398
  static openDialog(e) {
5399
- return K.enqueue(() => {
5399
+ return z.enqueue(() => {
5400
5400
  e instanceof HTMLDialogElement ? (ve.clearMessagesSync(e), e.showModal()) : m.error("[Haori]", "Element is not a dialog: ", e);
5401
5401
  }, !0);
5402
5402
  }
@@ -5406,7 +5406,7 @@ const ve = class ve {
5406
5406
  * @param element 閉じるダイアログのHTML要素
5407
5407
  */
5408
5408
  static closeDialog(e) {
5409
- return K.enqueue(() => {
5409
+ return z.enqueue(() => {
5410
5410
  e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
5411
5411
  }, !0);
5412
5412
  }
@@ -5427,7 +5427,7 @@ const ve = class ve {
5427
5427
  * @param level メッセージのレベル(省略可能)
5428
5428
  */
5429
5429
  static addMessage(e, t, r) {
5430
- return K.enqueue(() => {
5430
+ return z.enqueue(() => {
5431
5431
  const i = e instanceof HTMLFormElement ? e : e.parentElement ?? e;
5432
5432
  i.setAttribute("data-message", t), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
5433
5433
  }, !0);
@@ -5435,11 +5435,14 @@ const ve = class ve {
5435
5435
  /**
5436
5436
  * 対象のエレメントおよびその子要素のメッセージをクリアします。
5437
5437
  *
5438
+ * フォーム以外の要素を渡した場合は、{@link addMessage} がその要素について
5439
+ * 付ける親要素の表示も消します。
5440
+ *
5438
5441
  * @param parent メッセージをクリアする親要素
5439
5442
  */
5440
5443
  static clearMessages(e) {
5441
- return K.enqueue(() => {
5442
- ve.clearMessagesSync(e);
5444
+ return z.enqueue(() => {
5445
+ !(e instanceof HTMLFormElement) && e.parentElement && (e.parentElement.removeAttribute("data-message"), e.parentElement.removeAttribute("data-message-level")), ve.clearMessagesSync(e);
5443
5446
  }, !0);
5444
5447
  }
5445
5448
  /**
@@ -5479,7 +5482,7 @@ const ve = class ve {
5479
5482
  * @returns 整形済みの現在日時文字列
5480
5483
  */
5481
5484
  static now(e, t) {
5482
- return rt(e, t);
5485
+ return it(e, t);
5483
5486
  }
5484
5487
  /**
5485
5488
  * 現在日付に日数を加減した日付を指定フォーマットの文字列へ整形します。
@@ -5493,7 +5496,7 @@ const ve = class ve {
5493
5496
  * @returns 整形済みの日付文字列。timeZone が不正な場合は空文字
5494
5497
  */
5495
5498
  static today(e, t, r) {
5496
- return it(e, t, r);
5499
+ return nt(e, t, r);
5497
5500
  }
5498
5501
  /**
5499
5502
  * 数値を桁区切り・小数桁付きの文字列へ整形します。
@@ -5505,7 +5508,7 @@ const ve = class ve {
5505
5508
  * @returns 整形済み文字列。整形できない場合は空文字
5506
5509
  */
5507
5510
  static number(e, t) {
5508
- return nt(e, t);
5511
+ return st(e, t);
5509
5512
  }
5510
5513
  /**
5511
5514
  * 整数の配列を生成します(終端は排他)。
@@ -5518,7 +5521,7 @@ const ve = class ve {
5518
5521
  * @returns 整数配列
5519
5522
  */
5520
5523
  static range(e, t, r) {
5521
- return st(e, t, r);
5524
+ return at(e, t, r);
5522
5525
  }
5523
5526
  /**
5524
5527
  * 番号ページネーション用の表示要素列を生成します。
@@ -5531,7 +5534,7 @@ const ve = class ve {
5531
5534
  * @returns 表示要素の配列
5532
5535
  */
5533
5536
  static pages(e, t, r) {
5534
- return at(e, t, r);
5537
+ return ot(e, t, r);
5535
5538
  }
5536
5539
  /**
5537
5540
  * `YYYY-MM` 形式の年月文字列に月数を加算します。
@@ -5555,7 +5558,7 @@ const ve = class ve {
5555
5558
  * @returns 年月情報の降順配列。不正な入力は空配列
5556
5559
  */
5557
5560
  static monthRange(e, t) {
5558
- return ot(e, t);
5561
+ return lt(e, t);
5559
5562
  }
5560
5563
  /**
5561
5564
  * ページレスポンスから表示用サマリーを作ります。
@@ -5567,7 +5570,7 @@ const ve = class ve {
5567
5570
  * @returns 表示サマリー
5568
5571
  */
5569
5572
  static pageSummary(e, t) {
5570
- return lt(e, t);
5573
+ return ct(e, t);
5571
5574
  }
5572
5575
  /**
5573
5576
  * 配列から `item[key]` が指定値に一致する最初の要素を返します。
@@ -5581,7 +5584,7 @@ const ve = class ve {
5581
5584
  * @returns 一致した最初の要素。無ければ null
5582
5585
  */
5583
5586
  static findBy(e, t, r) {
5584
- return ct(e, t, r);
5587
+ return ut(e, t, r);
5585
5588
  }
5586
5589
  /**
5587
5590
  * 配列の数値合計を返します。
@@ -5594,7 +5597,7 @@ const ve = class ve {
5594
5597
  * @returns 数値の合計。対象が無ければ 0
5595
5598
  */
5596
5599
  static sum(e, t) {
5597
- return ut(e, t);
5600
+ return dt(e, t);
5598
5601
  }
5599
5602
  /**
5600
5603
  * 配列から重複を取り除いた新しい配列を返します。
@@ -5607,7 +5610,7 @@ const ve = class ve {
5607
5610
  * @returns 重複排除後の新しい配列。非配列は空配列
5608
5611
  */
5609
5612
  static distinct(e, t) {
5610
- return ft(e, t);
5613
+ return ht(e, t);
5611
5614
  }
5612
5615
  /**
5613
5616
  * 配列を `item[key]` ごとのグループへ分けて返します。
@@ -5620,7 +5623,7 @@ const ve = class ve {
5620
5623
  * @returns グループ情報の配列。非配列は空配列
5621
5624
  */
5622
5625
  static groupBy(e, t) {
5623
- return ht(e, t);
5626
+ return pt(e, t);
5624
5627
  }
5625
5628
  };
5626
5629
  ve.enhancers = {
@@ -5645,10 +5648,10 @@ ve.enhancers = {
5645
5648
  }
5646
5649
  };
5647
5650
  let Se = ve;
5648
- const Dt = "入力内容を確認してください", Ft = ["addErrorMessage", "clearMessages"], Ye = "data-haori-group-name";
5651
+ const Ft = "入力内容を確認してください", It = ["addErrorMessage", "clearMessages"], Ye = "data-haori-group-name";
5649
5652
  function Xe() {
5650
5653
  const e = globalThis.window?.Haori;
5651
- return Ft.every(
5654
+ return It.every(
5652
5655
  (r) => typeof e?.[r] == "function"
5653
5656
  ) ? e : Se;
5654
5657
  }
@@ -6236,8 +6239,8 @@ const h = class h {
6236
6239
  const u = h.resolveCollectedValue(e), d = h.isFileInput(e) && Array.isArray(u) ? u : [u];
6237
6240
  Array.isArray(t[String(n)]) ? t[String(n)].push(...d) : t[String(n)] = d;
6238
6241
  } else if (h.isGroupedCheckable(e)) {
6239
- const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, g = u instanceof HTMLInputElement ? u.value : e.getValue(), y = d ? g : null, E = String(n);
6240
- y === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = y : Array.isArray(t[E]) ? t[E].push(y) : t[E] = [t[E], y];
6242
+ const u = e.getTarget(), d = u instanceof HTMLInputElement ? u.checked : !0, g = u instanceof HTMLInputElement ? u.value : e.getValue(), y = d ? g : null, A = String(n);
6243
+ y === null ? A in t || (t[A] = null) : t[A] === null || t[A] === void 0 ? t[A] = y : Array.isArray(t[A]) ? t[A].push(y) : t[A] = [t[A], y];
6241
6244
  } else
6242
6245
  t[String(n)] = h.resolveCollectedValue(e);
6243
6246
  s && m.warn(
@@ -6263,13 +6266,13 @@ const h = class h {
6263
6266
  const u = [], d = [];
6264
6267
  let g = !1;
6265
6268
  for (const y of e.getChildElementFragments()) {
6266
- const E = {}, A = i === null ? null : /* @__PURE__ */ new Set();
6269
+ const A = {}, E = i === null ? null : /* @__PURE__ */ new Set();
6267
6270
  h.getPartValues(
6268
6271
  y,
6269
- E,
6272
+ A,
6270
6273
  r,
6271
- A
6272
- ), A !== null && h.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (g = !0, u.push(E), d.push(y.getListKey())) : r !== null && (u.push({}), d.push(y.getListKey()));
6274
+ E
6275
+ ), E !== null && h.registerCollectedExcludedKeys(A, E), Object.keys(A).length > 0 ? (g = !0, u.push(A), d.push(y.getListKey())) : r !== null && (u.push({}), d.push(y.getListKey()));
6273
6276
  }
6274
6277
  if (r === null) {
6275
6278
  const y = e.getAttribute(`${l.prefix}each-key`);
@@ -6560,8 +6563,8 @@ const h = class h {
6560
6563
  g.hasAttribute(`${l.prefix}form-detach`) && (d = !0), (g.hasAttribute(n) || g.hasAttribute(s)) && (u = g), g = g.parentElement;
6561
6564
  if (d)
6562
6565
  return;
6563
- const y = u ?? c, E = y.getAttribute(n) || y.getAttribute(s) || y.getAttribute(`${l.prefix}form-name`) || y.getAttribute("name");
6564
- E && t.add(E);
6566
+ const y = u ?? c, A = y.getAttribute(n) || y.getAttribute(s) || y.getAttribute(`${l.prefix}form-name`) || y.getAttribute("name");
6567
+ A && t.add(A);
6565
6568
  }), t;
6566
6569
  }
6567
6570
  /**
@@ -6624,7 +6627,7 @@ const h = class h {
6624
6627
  */
6625
6628
  static resolveValidityMessage(e) {
6626
6629
  const t = e.getAttribute(`${l.prefix}validity-message`);
6627
- return typeof t == "string" && t.trim() !== "" ? t : Dt;
6630
+ return typeof t == "string" && t.trim() !== "" ? t : Ft;
6628
6631
  }
6629
6632
  /**
6630
6633
  * 条件属性の値から式を取り出します。
@@ -7375,14 +7378,14 @@ const h = class h {
7375
7378
  return Promise.resolve();
7376
7379
  const c = h.resolveFieldName(e), u = e.getAttribute(`${l.prefix}form-object`), d = e.getAttribute(`${l.prefix}form-list`), g = e.hasAttribute(`${l.prefix}form-list`);
7377
7380
  if (c) {
7378
- const y = t[String(c)], E = n && h.hasResolvedDeclarativeState(e), A = n && typeof y > "u" && !h.isDeclarativeStateBound(e);
7379
- let D = y;
7380
- if (E ? D = void 0 : A && (D = null), h.isFileInput(e))
7381
- return (D === null || D === "") && o.push(
7381
+ const y = t[String(c)], A = n && h.hasResolvedDeclarativeState(e), E = n && typeof y > "u" && !h.isDeclarativeStateBound(e);
7382
+ let T = y;
7383
+ if (A ? T = void 0 : E && (T = null), h.isFileInput(e))
7384
+ return (T === null || T === "") && o.push(
7382
7385
  h.applyFragmentValue(e, null, i, a)
7383
7386
  ), Promise.all(o).then(() => {
7384
7387
  });
7385
- if (g && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
7388
+ if (g && Array.isArray(T) && // チェックボックスグループと複数選択 select は配列そのものを状態として
7386
7389
  // 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
7387
7390
  // `data-form-list` を併記していても従来どおりそちらへ渡す。
7388
7391
  !h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
@@ -7390,34 +7393,34 @@ const h = class h {
7390
7393
  s.set(N, B + 1), o.push(
7391
7394
  h.applyFragmentValue(
7392
7395
  e,
7393
- D[B] ?? null,
7396
+ T[B] ?? null,
7394
7397
  i,
7395
7398
  a
7396
7399
  )
7397
7400
  );
7398
- } else typeof D > "u" || (Array.isArray(D) && h.isGroupedCheckable(e) || Array.isArray(D) && h.isMultipleSelect(e) || typeof D == "string" || typeof D == "number" || typeof D == "boolean" || D === null ? o.push(
7401
+ } else typeof T > "u" || (Array.isArray(T) && h.isGroupedCheckable(e) || Array.isArray(T) && h.isMultipleSelect(e) || typeof T == "string" || typeof T == "number" || typeof T == "boolean" || T === null ? o.push(
7399
7402
  h.applyFragmentValue(
7400
7403
  e,
7401
- D,
7404
+ T,
7402
7405
  i,
7403
7406
  a
7404
7407
  )
7405
7408
  ) : o.push(
7406
- h.applyFragmentValue(e, String(D), i, a)
7409
+ h.applyFragmentValue(e, String(T), i, a)
7407
7410
  ));
7408
7411
  } else if (u) {
7409
7412
  const y = t[String(u)];
7410
7413
  if (y && typeof y == "object") {
7411
- const E = /* @__PURE__ */ new Map();
7412
- for (const A of e.getChildElementFragments())
7414
+ const A = /* @__PURE__ */ new Map();
7415
+ for (const E of e.getChildElementFragments())
7413
7416
  o.push(
7414
7417
  h.setPartValues(
7415
- A,
7418
+ E,
7416
7419
  y,
7417
7420
  r,
7418
7421
  i,
7419
7422
  n,
7420
- E,
7423
+ A,
7421
7424
  a
7422
7425
  )
7423
7426
  );
@@ -7425,13 +7428,13 @@ const h = class h {
7425
7428
  } else if (d) {
7426
7429
  const y = t[String(d)];
7427
7430
  if (Array.isArray(y)) {
7428
- const E = e.getChildElementFragments(), A = e.getAttribute(`${l.prefix}each-key`), D = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
7429
- E,
7431
+ const A = e.getChildElementFragments(), E = e.getAttribute(`${l.prefix}each-key`), T = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
7432
+ A,
7430
7433
  y,
7431
- A == null ? null : String(A)
7434
+ E == null ? null : String(E)
7432
7435
  ) : null;
7433
- for (let N = 0; N < E.length; N++) {
7434
- const B = E[N], F = D ? D[N] : y.length > N ? y[N] : null;
7436
+ for (let N = 0; N < A.length; N++) {
7437
+ const B = A[N], F = T ? T[N] : y.length > N ? y[N] : null;
7435
7438
  o.push(
7436
7439
  // 行ごとに values が切り替わるので出現位置も行単位で数える。
7437
7440
  h.setPartValues(
@@ -7484,7 +7487,7 @@ const h = class h {
7484
7487
  h.markResetSubtree(e, t), $.clearUserEditMarks(e, t), h.clearValues(e), await Promise.all([
7485
7488
  h.clearMessages(e),
7486
7489
  h.clearEachClones(e)
7487
- ]), await K.enqueue(() => {
7490
+ ]), await z.enqueue(() => {
7488
7491
  const n = h.collectEditsAfter(
7489
7492
  e,
7490
7493
  t
@@ -8055,7 +8058,7 @@ class H {
8055
8058
  H.dispatch(e, "pollstop", { reason: t, count: r, elapsedMs: i });
8056
8059
  }
8057
8060
  }
8058
- const It = {
8061
+ const Nt = {
8059
8062
  401: "unauthorized-redirect",
8060
8063
  403: "forbidden-redirect"
8061
8064
  };
@@ -8069,7 +8072,7 @@ function kt(b, e) {
8069
8072
  }
8070
8073
  });
8071
8074
  }
8072
- function Nt(b, e) {
8075
+ function xt(b, e) {
8073
8076
  const t = b.getAttribute(e);
8074
8077
  if (t === null || t === "")
8075
8078
  return null;
@@ -8078,7 +8081,7 @@ function Nt(b, e) {
8078
8081
  const r = I.get(b), i = r instanceof S ? r.getBindingData() : {}, n = kt(t, i);
8079
8082
  return n === "" ? null : n;
8080
8083
  }
8081
- function xt(b, e, t) {
8084
+ function Mt(b, e, t) {
8082
8085
  const r = b.getAttribute(`${e}-return-param`);
8083
8086
  if (r === null || r === "")
8084
8087
  return t;
@@ -8091,17 +8094,17 @@ function xt(b, e, t) {
8091
8094
  const i = window.location.pathname + window.location.search + window.location.hash, s = `${encodeURIComponent(r)}=${encodeURIComponent(i)}`, a = t.indexOf("#"), o = a >= 0 ? t.slice(a) : "", c = a >= 0 ? t.slice(0, a) : t, u = c.includes("?") ? "&" : "?";
8092
8095
  return `${c}${u}${s}${o}`;
8093
8096
  }
8094
- function pt(b) {
8095
- const e = It[b];
8097
+ function gt(b) {
8098
+ const e = Nt[b];
8096
8099
  if (e === void 0 || typeof document > "u")
8097
8100
  return !1;
8098
8101
  const t = `${l.prefix}${e}`, r = [];
8099
8102
  document.body && r.push(document.body), document.documentElement && r.push(document.documentElement);
8100
8103
  for (const i of r) {
8101
- const n = Nt(i, t);
8104
+ const n = xt(i, t);
8102
8105
  if (n === null)
8103
8106
  continue;
8104
- const s = xt(i, t, n);
8107
+ const s = Mt(i, t, n);
8105
8108
  try {
8106
8109
  if (new URL(s, window.location.href).href === window.location.href)
8107
8110
  return !1;
@@ -8111,7 +8114,7 @@ function pt(b) {
8111
8114
  }
8112
8115
  return !1;
8113
8116
  }
8114
- class Z {
8117
+ class K {
8115
8118
  /**
8116
8119
  * セレクタ属性の値を評価済みの文字列として読み取ります。
8117
8120
  *
@@ -8148,6 +8151,45 @@ class Z {
8148
8151
  ), [];
8149
8152
  }
8150
8153
  }
8154
+ /**
8155
+ * セレクタに一致する要素を、カンマ区切りの各セレクタを書いた順に照会します。
8156
+ *
8157
+ * 仕様「`data-{event}-click`」の「カンマ区切りの各セレクタを書いた順に押します」。
8158
+ * 1 つのセレクタに一致した複数の要素はその中で文書順に並べ、複数のセレクタに
8159
+ * 一致した要素は最初に一致した位置にだけ置きます。
8160
+ *
8161
+ * @param selector CSS セレクタ(カンマ区切りのセレクタリストを含む)
8162
+ * @param attributeName ログ出力に用いる属性名
8163
+ * @returns 一致した要素の配列。セレクタが不正な場合は空配列
8164
+ */
8165
+ static queryAllInListOrder(e, t) {
8166
+ if (K.queryAll(e, t).length === 0)
8167
+ return [];
8168
+ const r = /* @__PURE__ */ new Set();
8169
+ return K.splitList(e).forEach((i) => {
8170
+ K.queryAll(i, t).forEach(
8171
+ (n) => r.add(n)
8172
+ );
8173
+ }), Array.from(r);
8174
+ }
8175
+ /**
8176
+ * セレクタリストを、最上位のカンマで各セレクタに分けます。
8177
+ *
8178
+ * 括弧(`:is(a, b)` など)・属性セレクタの角括弧・引用符の中のカンマと、
8179
+ * バックスラッシュでエスケープしたカンマでは分けません。
8180
+ *
8181
+ * @param selector セレクタリスト
8182
+ * @returns 各セレクタ
8183
+ */
8184
+ static splitList(e) {
8185
+ const t = [];
8186
+ let r = 0, i = null, n = 0;
8187
+ for (let s = 0; s < e.length; s++) {
8188
+ const a = e[s];
8189
+ a === "\\" ? s++ : i !== null ? a === i && (i = null) : a === '"' || a === "'" ? i = a : a === "(" || a === "[" ? r++ : a === ")" || a === "]" ? r-- : a === "," && r === 0 && (t.push(e.slice(n, s)), n = s + 1);
8190
+ }
8191
+ return t.push(e.slice(n)), t;
8192
+ }
8151
8193
  /**
8152
8194
  * セレクタに一致する最初の要素を照会します。
8153
8195
  *
@@ -8594,7 +8636,7 @@ const x = class x {
8594
8636
  };
8595
8637
  x.SIGNATURES = /* @__PURE__ */ new WeakMap(), x.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), x.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), x.WARNED_KINDS = /* @__PURE__ */ new Set();
8596
8638
  let Fe = x;
8597
- class gt {
8639
+ class mt {
8598
8640
  /**
8599
8641
  * URLのクエリパラメータを取得します。
8600
8642
  *
@@ -8640,7 +8682,7 @@ class gt {
8640
8682
  }
8641
8683
  }
8642
8684
  }
8643
- const Mt = [
8685
+ const $t = [
8644
8686
  "addErrorMessage",
8645
8687
  "clearMessages",
8646
8688
  "closeDialog",
@@ -8648,12 +8690,12 @@ const Mt = [
8648
8690
  "dialog",
8649
8691
  "openDialog",
8650
8692
  "toast"
8651
- ], $t = "__haoriHistoryState__", Oe = "data-haori-click-lock", Je = "ファイルを保存できませんでした", Ct = 100;
8693
+ ], Ct = "__haoriHistoryState__", Oe = "data-haori-click-lock", Je = "ファイルを保存できませんでした", Pt = 100;
8652
8694
  let De = null;
8653
- const Pt = ["info", "warning", "error", "success"], Lt = /^(\d{3})-(click|click-await|close|toast|toast-level|no-message)$/;
8695
+ const Lt = ["info", "warning", "error", "success"], Ze = /^(\d{3})-(click|click-await|close|toast|toast-level|no-message|bind)$/;
8654
8696
  function fe() {
8655
8697
  const e = globalThis.window?.Haori;
8656
- return Mt.every(
8698
+ return $t.every(
8657
8699
  (r) => typeof e?.[r] == "function"
8658
8700
  ) ? e : Se;
8659
8701
  }
@@ -8678,7 +8720,7 @@ function be(b) {
8678
8720
  }
8679
8721
  return String(b);
8680
8722
  }
8681
- function mt(b, e) {
8723
+ function yt(b, e) {
8682
8724
  const t = new URL(b, window.location.href), r = new URLSearchParams(t.search);
8683
8725
  return Bt(r, e), t.search = r.toString(), t.toString();
8684
8726
  }
@@ -8699,12 +8741,12 @@ function Ht(b) {
8699
8741
  return { payload: {}, dropped: !0 };
8700
8742
  }
8701
8743
  return e.includes("=") ? {
8702
- payload: Ze(new URLSearchParams(e)),
8744
+ payload: Qe(new URLSearchParams(e)),
8703
8745
  dropped: !1
8704
8746
  } : { payload: {}, dropped: !0 };
8705
8747
  }
8706
8748
  if (b instanceof URLSearchParams)
8707
- return { payload: Ze(b), dropped: !1 };
8749
+ return { payload: Qe(b), dropped: !1 };
8708
8750
  if (typeof FormData < "u" && b instanceof FormData) {
8709
8751
  const e = {};
8710
8752
  let t = !1;
@@ -8713,19 +8755,19 @@ function Ht(b) {
8713
8755
  t = !0;
8714
8756
  continue;
8715
8757
  }
8716
- yt(e, r, i);
8758
+ bt(e, r, i);
8717
8759
  }
8718
8760
  return { payload: e, dropped: t };
8719
8761
  }
8720
8762
  return { payload: {}, dropped: !0 };
8721
8763
  }
8722
- function Ze(b) {
8764
+ function Qe(b) {
8723
8765
  const e = {};
8724
8766
  for (const [t, r] of b.entries())
8725
- yt(e, t, r);
8767
+ bt(e, t, r);
8726
8768
  return e;
8727
8769
  }
8728
- function yt(b, e, t) {
8770
+ function bt(b, e, t) {
8729
8771
  const r = b[e];
8730
8772
  r === void 0 ? b[e] = t : Array.isArray(r) ? r.push(t) : b[e] = [r, t];
8731
8773
  }
@@ -8767,7 +8809,7 @@ function Vt(b, e) {
8767
8809
  t.body
8768
8810
  );
8769
8811
  let s = b;
8770
- Object.keys(i).length > 0 && (s = mt(s, i)), n && m.warn(
8812
+ Object.keys(i).length > 0 && (s = yt(s, i)), n && m.warn(
8771
8813
  "Haori",
8772
8814
  `The ${r} body cannot be converted into a query string and is dropped by the demo runtime normalization. Send the values with ${l.prefix}{event}-data / ${l.prefix}{event}-form, or use the embedded runtime.`
8773
8815
  ), delete t.body, t.method = "GET";
@@ -8903,9 +8945,9 @@ const p = class p {
8903
8945
  * @returns 対象のフラグメント(見つからない場合は空)
8904
8946
  */
8905
8947
  static resolveSelectorTargets(e, t, r) {
8906
- const i = Z.read(e, t), n = [];
8948
+ const i = K.read(e, t), n = [];
8907
8949
  if (i)
8908
- Z.queryAll(i, t).forEach((a) => {
8950
+ (r === "click" || r === "error-click" ? K.queryAllInListOrder(i, t) : K.queryAll(i, t)).forEach((a) => {
8909
8951
  const o = I.get(a);
8910
8952
  o && n.push(o);
8911
8953
  }), n.length === 0 && m.error("Haori", `Element not found: ${i} (${t})`);
@@ -8939,6 +8981,43 @@ const p = class p {
8939
8981
  p.readLateAttribute(e, t, r, i)
8940
8982
  );
8941
8983
  }
8984
+ /**
8985
+ * 非イベントの `data-fetch` と `data-poll-*` で、応答本文の表示を止める宣言
8986
+ * (`-error-status` / `-error-no-message` / `-error-{ステータス}-no-message`)を
8987
+ * 読み取ります。
8988
+ *
8989
+ * 仕様「失敗時のアクション」の「対象の手続き」。ほかの失敗時のアクションは
8990
+ * 読みません。
8991
+ *
8992
+ * @param fragment 対象フラグメント
8993
+ * @param options 読み取った宣言の記録先のオプション
8994
+ * @param event 属性名の接頭辞にするイベント名(非イベントは `fetch`)
8995
+ * @returns 戻り値はありません。
8996
+ */
8997
+ static readNoMessageDeclarations(e, t, r) {
8998
+ const i = p.attrName(r, "error-status");
8999
+ e.hasAttribute(i) && (t.errorStatuses = p.parseErrorStatuses(
9000
+ e.getRawAttribute(i),
9001
+ i
9002
+ )), t.errorNoMessage = e.hasAttribute(
9003
+ p.attrName(r, "error-no-message")
9004
+ );
9005
+ const n = p.attrName(r, "error-"), s = /* @__PURE__ */ new Map();
9006
+ for (const a of e.getAttributeNames()) {
9007
+ const o = a.startsWith(n) ? Ze.exec(a.slice(n.length)) : null;
9008
+ o && o[2] === "no-message" && s.set(Number(o[1]), {
9009
+ key: `error-${o[1]}`,
9010
+ clickFragments: null,
9011
+ clickAwait: !1,
9012
+ closeFragments: null,
9013
+ toastMessage: null,
9014
+ toastLevel: null,
9015
+ noMessage: !0,
9016
+ bind: !1
9017
+ });
9018
+ }
9019
+ t.errorStatusActions = s;
9020
+ }
8942
9021
  /**
8943
9022
  * ステータスごとの失敗時のアクション(`data-{event}-error-{ステータス}-*`)を
8944
9023
  * 読み取ります。
@@ -8957,7 +9036,7 @@ const p = class p {
8957
9036
  for (const a of e.getAttributeNames()) {
8958
9037
  if (!a.startsWith(i))
8959
9038
  continue;
8960
- const o = Lt.exec(
9039
+ const o = Ze.exec(
8961
9040
  a.slice(i.length)
8962
9041
  );
8963
9042
  o && n.add(o[1]);
@@ -8991,7 +9070,8 @@ const p = class p {
8991
9070
  `${o}-toast-level`,
8992
9071
  c("toast-level")
8993
9072
  ),
8994
- noMessage: e.hasAttribute(c("no-message"))
9073
+ noMessage: e.hasAttribute(c("no-message")),
9074
+ bind: e.hasAttribute(c("bind"))
8995
9075
  });
8996
9076
  }), s;
8997
9077
  }
@@ -9002,7 +9082,7 @@ const p = class p {
9002
9082
  * @returns レベル。4 つの値のどれとも一致しない場合は null(`info` で表示する)
9003
9083
  */
9004
9084
  static toToastLevel(e) {
9005
- return Pt.includes(e) ? e : null;
9085
+ return Lt.includes(e) ? e : null;
9006
9086
  }
9007
9087
  /**
9008
9088
  * `data-{event}-error-status` の値を、ステータスの一覧へ変換します。
@@ -9321,8 +9401,8 @@ const p = class p {
9321
9401
  targetFragment: e
9322
9402
  }, i = t ? p.attrName(t, "if") : p.attrName(null, "if", !0);
9323
9403
  if (e.hasAttribute(i)) {
9324
- const T = e.getRawAttribute(i);
9325
- typeof T == "string" && T.trim() !== "" ? (r.conditionExpression = k.unwrapConditionExpression(T), r.conditionAttributeName = i) : m.warn(
9404
+ const D = e.getRawAttribute(i);
9405
+ typeof D == "string" && D.trim() !== "" ? (r.conditionExpression = k.unwrapConditionExpression(D), r.conditionAttributeName = i) : m.warn(
9326
9406
  "Haori",
9327
9407
  `${i} に条件式が指定されていません。`
9328
9408
  );
@@ -9333,17 +9413,17 @@ const p = class p {
9333
9413
  e.getAttribute(p.attrName(t, "confirm"))
9334
9414
  )
9335
9415
  )), e.hasAttribute(p.attrName(t, "data")) && (r.dataAttrName = p.attrName(t, "data")), e.hasAttribute(p.attrName(t, "form"))) {
9336
- const L = Z.read(
9416
+ const L = K.read(
9337
9417
  e,
9338
9418
  p.attrName(t, "form")
9339
9419
  );
9340
9420
  if (L) {
9341
- const Y = Z.query(
9421
+ const X = K.query(
9342
9422
  L,
9343
9423
  p.attrName(t, "form")
9344
9424
  );
9345
- Y !== null ? r.formFragment = k.getFormFragment(
9346
- I.get(Y)
9425
+ X !== null ? r.formFragment = k.getFormFragment(
9426
+ I.get(X)
9347
9427
  ) : m.error(
9348
9428
  "Haori",
9349
9429
  `Form element not found: ${L} (${p.attrName(t, "form")})`
@@ -9364,16 +9444,16 @@ const p = class p {
9364
9444
  ${L}
9365
9445
  `
9366
9446
  );
9367
- } catch (Y) {
9368
- m.error("Haori", `Invalid before script: ${Y}`);
9447
+ } catch (X) {
9448
+ m.error("Haori", `Invalid before script: ${X}`);
9369
9449
  }
9370
9450
  }
9371
- const T = p.attrName(t, "run");
9372
- if (e.hasAttribute(T)) {
9373
- const L = String(e.getAttribute(T) ?? "");
9374
- let Y = null;
9451
+ const D = p.attrName(t, "run");
9452
+ if (e.hasAttribute(D)) {
9453
+ const L = String(e.getAttribute(D) ?? "");
9454
+ let X = null;
9375
9455
  try {
9376
- Y = new Function(
9456
+ X = new Function(
9377
9457
  "event",
9378
9458
  `"use strict"; return (
9379
9459
  ${L}
@@ -9381,25 +9461,25 @@ ${L}
9381
9461
  );
9382
9462
  } catch {
9383
9463
  try {
9384
- Y = new Function("event", `"use strict";
9464
+ X = new Function("event", `"use strict";
9385
9465
  ${L}
9386
9466
  `);
9387
9467
  } catch (Q) {
9388
9468
  m.error("Haori", `Invalid run script: ${Q}`);
9389
9469
  }
9390
9470
  }
9391
- Y && (r.runScript = Y);
9471
+ X && (r.runScript = X);
9392
9472
  }
9393
9473
  }
9394
9474
  const n = p.attrName(t, "fetch"), s = e.hasAttribute(n);
9395
9475
  if (s) {
9396
- const T = e.getAttributeEvaluation(n);
9397
- T && (r.fetchHasUnresolvedReference = T.hasUnresolvedReference, r.fetchUrl = T.hasUnresolvedReference ? null : T.value);
9476
+ const D = e.getAttributeEvaluation(n);
9477
+ D && (r.fetchHasUnresolvedReference = D.hasUnresolvedReference, r.fetchUrl = D.hasUnresolvedReference ? null : D.value);
9398
9478
  }
9399
9479
  const a = {}, o = t ? p.attrName(t, "fetch-method") : p.attrName(null, "method", !0);
9400
9480
  if (e.hasAttribute(o)) {
9401
- const T = e.getAttributeEvaluation(o);
9402
- T?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = p.normalizeAttributeText(T?.value) ?? void 0;
9481
+ const D = e.getAttributeEvaluation(o);
9482
+ D?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = p.normalizeAttributeText(D?.value) ?? void 0;
9403
9483
  }
9404
9484
  const c = t ? p.attrName(t, "fetch-headers") : p.attrName(null, "headers", !0), u = p.readFetchHeaders(
9405
9485
  e,
@@ -9409,9 +9489,9 @@ ${L}
9409
9489
  const d = t ? p.attrName(t, "fetch-content-type") : p.attrName(null, "content-type", !0);
9410
9490
  let g = null;
9411
9491
  if (e.hasAttribute(d)) {
9412
- const T = e.getAttributeEvaluation(d);
9413
- T?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), g = p.normalizeAttributeText(
9414
- T?.value
9492
+ const D = e.getAttributeEvaluation(d);
9493
+ D?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), g = p.normalizeAttributeText(
9494
+ D?.value
9415
9495
  );
9416
9496
  }
9417
9497
  if (g !== null)
@@ -9420,10 +9500,10 @@ ${L}
9420
9500
  g
9421
9501
  );
9422
9502
  else if (a.method && !p.hasDeclaredContentType(a.headers)) {
9423
- const T = a.method.toUpperCase();
9503
+ const D = a.method.toUpperCase();
9424
9504
  a.headers = p.withContentType(
9425
9505
  a.headers,
9426
- T === "GET" || T === "HEAD" || T === "OPTIONS" ? "application/x-www-form-urlencoded" : "application/json"
9506
+ D === "GET" || D === "HEAD" || D === "OPTIONS" ? "application/x-www-form-urlencoded" : "application/json"
9427
9507
  );
9428
9508
  }
9429
9509
  Object.keys(a).length > 0 && (r.fetchOptions = a);
@@ -9435,64 +9515,64 @@ ${L}
9435
9515
  );
9436
9516
  else if (e.hasAttribute(y)) {
9437
9517
  r.download = !0;
9438
- const T = e.getAttributeEvaluation(y);
9439
- r.downloadFileName = T?.hasUnresolvedReference ? null : p.normalizeAttributeText(T?.value);
9518
+ const D = e.getAttributeEvaluation(y);
9519
+ r.downloadFileName = D?.hasUnresolvedReference ? null : p.normalizeAttributeText(D?.value);
9440
9520
  }
9441
- const E = t ? p.attrName(t, "fetch-download-folder") : p.attrName(null, "download-folder", !0);
9442
- e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 : m.warn(
9521
+ const A = t ? p.attrName(t, "fetch-download-folder") : p.attrName(null, "download-folder", !0);
9522
+ e.hasAttribute(A) && (r.download ? r.downloadFolder = !0 : m.warn(
9443
9523
  "Haori",
9444
- `${E} は ${y} と併せて指定してください(書き出す応答が無いため、この宣言は無視します)。`
9524
+ `${A} は ${y} と併せて指定してください(書き出す応答が無いため、この宣言は無視します)。`
9445
9525
  ));
9446
- const A = t ? p.attrName(t, "bind") : p.attrName(null, "bind", !0);
9447
- if (e.hasAttribute(A)) {
9448
- const T = Z.read(e, A);
9449
- if (T) {
9450
- const L = Z.queryAll(T, A);
9451
- L.length > 0 ? (r.bindFragments = [], L.forEach((Y) => {
9452
- const Q = I.get(Y);
9526
+ const E = t ? p.attrName(t, "bind") : p.attrName(null, "bind", !0);
9527
+ if (e.hasAttribute(E)) {
9528
+ const D = K.read(e, E);
9529
+ if (D) {
9530
+ const L = K.queryAll(D, E);
9531
+ L.length > 0 ? (r.bindFragments = [], L.forEach((X) => {
9532
+ const Q = I.get(X);
9453
9533
  Q && r.bindFragments.push(Q);
9454
9534
  })) : m.error(
9455
9535
  "Haori",
9456
- `Bind element not found: ${T} (${A})`
9536
+ `Bind element not found: ${D} (${E})`
9457
9537
  );
9458
9538
  }
9459
9539
  }
9460
- const D = p.attrName(t, "bind-arg"), N = p.attrName(null, "arg", !0), B = p.attrName(null, "bind-arg", !0);
9461
- t ? e.hasAttribute(D) && (r.bindArg = e.getRawAttribute(D)) : e.hasAttribute(N) ? r.bindArg = e.getRawAttribute(
9540
+ const T = p.attrName(t, "bind-arg"), N = p.attrName(null, "arg", !0), B = p.attrName(null, "bind-arg", !0);
9541
+ t ? e.hasAttribute(T) && (r.bindArg = e.getRawAttribute(T)) : e.hasAttribute(N) ? r.bindArg = e.getRawAttribute(
9462
9542
  N
9463
9543
  ) : e.hasAttribute(B) && (r.bindArg = e.getRawAttribute(B));
9464
9544
  const F = t ? p.attrName(t, "bind-params") : p.attrName(null, "bind-params", !0);
9465
9545
  if (e.hasAttribute(F)) {
9466
- const T = e.getRawAttribute(F);
9467
- r.bindParams = T.split("&").map((L) => L.trim());
9546
+ const D = e.getRawAttribute(F);
9547
+ r.bindParams = D.split("&").map((L) => L.trim());
9468
9548
  }
9469
9549
  const j = t ? p.attrName(t, "bind-append") : p.attrName(null, "bind-append", !0);
9470
9550
  if (e.hasAttribute(j)) {
9471
- const T = e.getRawAttribute(j);
9472
- r.bindAppendParams = T.split("&").map((L) => L.trim()).filter(Boolean);
9551
+ const D = e.getRawAttribute(j);
9552
+ r.bindAppendParams = D.split("&").map((L) => L.trim()).filter(Boolean);
9473
9553
  }
9474
- const J = t ? p.attrName(t, "bind-merge") : p.attrName(null, "bind-merge", !0);
9475
- e.hasAttribute(J) && (r.bindMerge = !0);
9554
+ const Z = t ? p.attrName(t, "bind-merge") : p.attrName(null, "bind-merge", !0);
9555
+ e.hasAttribute(Z) && (r.bindMerge = !0);
9476
9556
  const _ = t ? p.attrName(t, "bind-transform") : p.attrName(null, "bind-transform", !0);
9477
9557
  e.hasAttribute(_) && (r.bindTransform = e.getRawAttribute(_));
9478
9558
  const P = t ? p.attrName(t, "copy-params") : null;
9479
9559
  if (P && e.hasAttribute(P)) {
9480
- const T = e.getRawAttribute(P);
9481
- r.copyParams = T.split("&").map((L) => L.trim()).filter(Boolean);
9560
+ const D = e.getRawAttribute(P);
9561
+ r.copyParams = D.split("&").map((L) => L.trim()).filter(Boolean);
9482
9562
  }
9483
9563
  if (t) {
9484
9564
  if (e.hasAttribute(p.attrName(t, "adjust"))) {
9485
- const W = Z.read(
9565
+ const W = K.read(
9486
9566
  e,
9487
9567
  p.attrName(t, "adjust")
9488
9568
  );
9489
9569
  if (W) {
9490
- const z = Z.queryAll(
9570
+ const G = K.queryAll(
9491
9571
  W,
9492
9572
  p.attrName(t, "adjust")
9493
9573
  );
9494
- z.length > 0 ? (r.adjustFragments = [], z.forEach((X) => {
9495
- const Re = I.get(X);
9574
+ G.length > 0 ? (r.adjustFragments = [], G.forEach((J) => {
9575
+ const Re = I.get(J);
9496
9576
  Re && r.adjustFragments.push(Re);
9497
9577
  })) : m.error(
9498
9578
  "Haori",
@@ -9500,10 +9580,10 @@ ${L}
9500
9580
  );
9501
9581
  }
9502
9582
  if (e.hasAttribute(p.attrName(t, "adjust-value"))) {
9503
- const z = e.getRawAttribute(
9583
+ const G = e.getRawAttribute(
9504
9584
  p.attrName(t, "adjust-value")
9505
- ), X = Number(z);
9506
- isNaN(X) || (r.adjustValue = X);
9585
+ ), J = Number(G);
9586
+ isNaN(J) || (r.adjustValue = J);
9507
9587
  }
9508
9588
  }
9509
9589
  if (e.hasAttribute(p.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(p.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(p.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(p.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
@@ -9518,8 +9598,8 @@ ${L}
9518
9598
  ${W}
9519
9599
  `
9520
9600
  );
9521
- } catch (z) {
9522
- m.error("Haori", `Invalid after script: ${z}`);
9601
+ } catch (G) {
9602
+ m.error("Haori", `Invalid after script: ${G}`);
9523
9603
  }
9524
9604
  }
9525
9605
  if (e.hasAttribute(p.attrName(t, "dialog")) && (r.dialogMessage = p.unescapeNewlines(
@@ -9552,26 +9632,28 @@ ${W}
9552
9632
  "error-toast-level",
9553
9633
  p.attrName(t, "error-toast-level")
9554
9634
  ));
9555
- const z = p.attrName(t, "error-status");
9556
- e.hasAttribute(z) && (r.errorStatuses = p.parseErrorStatuses(
9557
- e.getRawAttribute(z),
9558
- z
9635
+ const G = p.attrName(t, "error-status");
9636
+ e.hasAttribute(G) && (r.errorStatuses = p.parseErrorStatuses(
9637
+ e.getRawAttribute(G),
9638
+ G
9559
9639
  )), r.errorNoMessage = e.hasAttribute(
9560
9640
  p.attrName(t, "error-no-message")
9641
+ ), r.errorBind = e.hasAttribute(
9642
+ p.attrName(t, "error-bind")
9561
9643
  );
9562
9644
  }
9563
- const T = p.attrName(t, "redirect"), L = p.attrName(t, "redirect-replace"), Y = e.hasAttribute(T), Q = e.hasAttribute(L);
9564
- if (Y && (r.redirectUrl = p.readLateAttribute(
9645
+ const D = p.attrName(t, "redirect"), L = p.attrName(t, "redirect-replace"), X = e.hasAttribute(D), Q = e.hasAttribute(L);
9646
+ if (X && (r.redirectUrl = p.readLateAttribute(
9565
9647
  e,
9566
9648
  r,
9567
9649
  "redirect",
9568
- T
9650
+ D
9569
9651
  )), Q && (r.redirectReplaceUrl = p.readLateAttribute(
9570
9652
  e,
9571
9653
  r,
9572
9654
  "redirect-replace",
9573
9655
  L
9574
- )), Y || Q) {
9656
+ )), X || Q) {
9575
9657
  const W = p.attrName(
9576
9658
  t,
9577
9659
  "redirect-return-param"
@@ -9594,17 +9676,17 @@ ${W}
9594
9676
  "history",
9595
9677
  p.attrName(t, "history")
9596
9678
  )), e.hasAttribute(p.attrName(t, "history-data")) && (r.historyDataAttrName = p.attrName(t, "history-data")), e.hasAttribute(p.attrName(t, "history-form"))) {
9597
- const W = Z.read(
9679
+ const W = K.read(
9598
9680
  e,
9599
9681
  p.attrName(t, "history-form")
9600
9682
  );
9601
9683
  if (W) {
9602
- const z = Z.query(
9684
+ const G = K.query(
9603
9685
  W,
9604
9686
  p.attrName(t, "history-form")
9605
9687
  );
9606
- z !== null ? r.historyFormFragment = k.getFormFragment(
9607
- I.get(z)
9688
+ G !== null ? r.historyFormFragment = k.getFormFragment(
9689
+ I.get(G)
9608
9690
  ) : m.error(
9609
9691
  "Haori",
9610
9692
  `Form element not found: ${W} (${p.attrName(t, "history-form")})`
@@ -9625,44 +9707,44 @@ ${W}
9625
9707
  ].forEach((W) => {
9626
9708
  if (W.startsWith("error-") && t === "poll")
9627
9709
  return;
9628
- const z = p.attrName(t, W);
9629
- if (!e.hasAttribute(z))
9710
+ const G = p.attrName(t, W);
9711
+ if (!e.hasAttribute(G))
9630
9712
  return;
9631
- const X = p.resolveSelectorTargets(
9713
+ const J = p.resolveSelectorTargets(
9632
9714
  e,
9633
- z,
9715
+ G,
9634
9716
  W
9635
9717
  );
9636
- if (X.length > 0)
9718
+ if (J.length > 0)
9637
9719
  switch (W) {
9638
9720
  case "reset-before":
9639
- r.resetBeforeFragments = X;
9721
+ r.resetBeforeFragments = J;
9640
9722
  break;
9641
9723
  case "reset":
9642
- r.resetFragments = X;
9724
+ r.resetFragments = J;
9643
9725
  break;
9644
9726
  case "refetch":
9645
- r.refetchFragments = X;
9727
+ r.refetchFragments = J;
9646
9728
  break;
9647
9729
  case "click":
9648
- r.clickFragments = X, r.clickAwait = e.hasAttribute(`${z}-await`);
9730
+ r.clickFragments = J, r.clickAwait = e.hasAttribute(`${G}-await`);
9649
9731
  break;
9650
9732
  case "copy":
9651
- r.copyFragments = X;
9733
+ r.copyFragments = J;
9652
9734
  break;
9653
9735
  case "open":
9654
- r.openFragments = X;
9736
+ r.openFragments = J;
9655
9737
  break;
9656
9738
  case "close":
9657
- r.closeFragments = X;
9739
+ r.closeFragments = J;
9658
9740
  break;
9659
9741
  case "error-click":
9660
- r.errorClickFragments = X, r.errorClickAwait = e.hasAttribute(
9661
- `${z}-await`
9742
+ r.errorClickFragments = J, r.errorClickAwait = e.hasAttribute(
9743
+ `${G}-await`
9662
9744
  );
9663
9745
  break;
9664
9746
  case "error-close":
9665
- r.errorCloseFragments = X;
9747
+ r.errorCloseFragments = J;
9666
9748
  break;
9667
9749
  }
9668
9750
  }), t !== "poll" && (r.errorStatusActions = p.readErrorStatusActions(
@@ -9672,12 +9754,12 @@ ${W}
9672
9754
  ));
9673
9755
  const oe = p.attrName(t, "copy-source");
9674
9756
  if (e.hasAttribute(oe)) {
9675
- const W = Z.read(e, oe);
9757
+ const W = K.read(e, oe);
9676
9758
  if (W) {
9677
- const z = Z.query(W, oe);
9678
- if (z !== null) {
9679
- const X = I.get(z);
9680
- X ? r.copySourceFragment = X : m.error(
9759
+ const G = K.query(W, oe);
9760
+ if (G !== null) {
9761
+ const J = I.get(G);
9762
+ J ? r.copySourceFragment = J : m.error(
9681
9763
  "Haori",
9682
9764
  `Element is not managed by Haori: ${W} (${oe})`
9683
9765
  );
@@ -9691,51 +9773,52 @@ ${W}
9691
9773
  }
9692
9774
  }
9693
9775
  if (!t && (e.hasAttribute(p.attrName(null, "data", !0)) && (r.dataAttrName = p.attrName(null, "data", !0)), e.hasAttribute(p.attrName(null, "form", !0)))) {
9694
- const T = Z.read(
9776
+ const D = K.read(
9695
9777
  e,
9696
9778
  p.attrName(null, "form", !0)
9697
9779
  );
9698
- if (T) {
9699
- const L = Z.query(
9700
- T,
9780
+ if (D) {
9781
+ const L = K.query(
9782
+ D,
9701
9783
  p.attrName(null, "form", !0)
9702
9784
  );
9703
9785
  L !== null ? r.formFragment = k.getFormFragment(
9704
9786
  I.get(L)
9705
9787
  ) : m.error(
9706
9788
  "Haori",
9707
- `Form element not found: ${T} (${p.attrName(null, "fetch-form", !0)})`
9789
+ `Form element not found: ${D} (${p.attrName(null, "fetch-form", !0)})`
9708
9790
  );
9709
9791
  } else
9710
9792
  r.formFragment = k.getFormFragment(e);
9711
9793
  }
9794
+ (!t || t === "poll") && p.readNoMessageDeclarations(e, r, t ?? "fetch");
9712
9795
  const se = t ? p.attrName(t, "fetch-state") : p.attrName(null, "state", !0);
9713
9796
  if (e.hasAttribute(se)) {
9714
- const T = Z.read(e, se), L = [];
9715
- T ? (Z.queryAll(T, se).forEach((Q) => {
9797
+ const D = K.read(e, se), L = [];
9798
+ D ? (K.queryAll(D, se).forEach((Q) => {
9716
9799
  const de = I.get(Q);
9717
9800
  de && L.push(de);
9718
9801
  }), L.length === 0 && m.error(
9719
9802
  "Haori",
9720
- `Element not found: ${T} (${se})`
9803
+ `Element not found: ${D} (${se})`
9721
9804
  )) : L.push(e), L.length > 0 && (r.fetchStateFragments = L);
9722
9805
  }
9723
- const G = t ? p.attrName(t, "store-clear") : p.attrName(null, "store-clear", !0);
9724
- if (e.hasAttribute(G)) {
9725
- const T = e.getRawAttribute(G), L = T === null ? "" : T.trim();
9806
+ const Y = t ? p.attrName(t, "store-clear") : p.attrName(null, "store-clear", !0);
9807
+ if (e.hasAttribute(Y)) {
9808
+ const D = e.getRawAttribute(Y), L = D === null ? "" : D.trim();
9726
9809
  if (L === "")
9727
9810
  m.error(
9728
9811
  "Haori",
9729
- `ストレージキーが指定されていません (${G})`
9812
+ `ストレージキーが指定されていません (${Y})`
9730
9813
  );
9731
9814
  else {
9732
9815
  r.storeClearKey = L;
9733
- const Y = e.getRawAttribute(
9734
- `${G}-type`
9735
- ), Q = Y === null ? "session" : Y.trim();
9816
+ const X = e.getRawAttribute(
9817
+ `${Y}-type`
9818
+ ), Q = X === null ? "session" : X.trim();
9736
9819
  Q === "local" || Q === "session" ? r.storeClearKind = Q : (m.warn(
9737
9820
  "Haori",
9738
- `${G}-type は session または local を指定してください(session として扱います): ${Q}`
9821
+ `${Y}-type は session または local を指定してください(session として扱います): ${Q}`
9739
9822
  ), r.storeClearKind = "session");
9740
9823
  }
9741
9824
  }
@@ -9890,12 +9973,12 @@ ${W}
9890
9973
  }
9891
9974
  const c = Object.keys(i).length > 0;
9892
9975
  if (n) {
9893
- const g = (s?.method || "GET").toUpperCase(), E = !a && o && r.transportMode === "query-get" && Ut(s) && !He(g) ? r.baseUrl ?? n : n, A = Vt(
9894
- E,
9976
+ const g = (s?.method || "GET").toUpperCase(), A = !a && o && r.transportMode === "query-get" && Ut(s) && !He(g) ? r.baseUrl ?? n : n, E = Vt(
9977
+ A,
9895
9978
  s
9896
9979
  );
9897
- n = A.url;
9898
- const D = { ...A.options }, N = A.normalized ? A.requestedMethod : r.requestedMethod, B = A.effectiveMethod, F = r.transportMode === "query-get" || A.normalized, j = A.queryString ?? r.queryString;
9980
+ n = E.url;
9981
+ const T = { ...E.options }, N = E.normalized ? E.requestedMethod : r.requestedMethod, B = E.effectiveMethod, F = r.transportMode === "query-get" || E.normalized, j = E.queryString ?? r.queryString;
9899
9982
  if (F && m.info("Haori demo fetch normalization", {
9900
9983
  runtime: l.runtime,
9901
9984
  requestedMethod: N,
@@ -9905,7 +9988,7 @@ ${W}
9905
9988
  payload: c ? i : void 0,
9906
9989
  queryString: j
9907
9990
  }), this.options.targetFragment && n) {
9908
- const J = performance.now(), _ = {
9991
+ const Z = performance.now(), _ = {
9909
9992
  runtime: l.runtime,
9910
9993
  requestedMethod: N,
9911
9994
  effectiveMethod: B,
@@ -9915,13 +9998,13 @@ ${W}
9915
9998
  return H.fetchStart(
9916
9999
  this.options.targetFragment.getTarget(),
9917
10000
  n,
9918
- D,
10001
+ T,
9919
10002
  c ? i : void 0,
9920
10003
  _
9921
- ), await this.injectFetchState("loading"), await p.invokeFetch(n, D).then((P) => this.handleFetchResult(
10004
+ ), await this.injectFetchState("loading"), await p.invokeFetch(n, T).then((P) => this.handleFetchResult(
9922
10005
  P,
9923
10006
  n || void 0,
9924
- J
10007
+ Z
9925
10008
  )).catch(async (P) => {
9926
10009
  throw n && H.fetchError(
9927
10010
  this.options.targetFragment.getTarget(),
@@ -9934,35 +10017,35 @@ ${W}
9934
10017
  ), await this.runErrorActions(null), P;
9935
10018
  });
9936
10019
  }
9937
- return await fetch(n, D).then((J) => this.handleFetchResult(J, n || void 0));
10020
+ return await fetch(n, T).then((Z) => this.handleFetchResult(Z, n || void 0));
9938
10021
  }
9939
10022
  if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && c) {
9940
- const g = this.options.formFragment, y = g.getTarget(), E = /* @__PURE__ */ new Set();
9941
- e && e.appliedDisabledAttribute && this.options.targetFragment && E.add(this.options.targetFragment);
9942
- const A = g.getRawBindingData(), D = Ue(i), N = g.getAttribute(`${l.prefix}form-arg`);
10023
+ const g = this.options.formFragment, y = g.getTarget(), A = /* @__PURE__ */ new Set();
10024
+ e && e.appliedDisabledAttribute && this.options.targetFragment && A.add(this.options.targetFragment);
10025
+ const E = g.getRawBindingData(), T = Ue(i), N = g.getAttribute(`${l.prefix}form-arg`);
9943
10026
  let B;
9944
10027
  if (N) {
9945
- B = { ...A ?? {} };
10028
+ B = { ...E ?? {} };
9946
10029
  const F = String(N), j = k.resolveAncestorArgOwner(g, F);
9947
10030
  B[F] = k.mergeCollectedValues(
9948
10031
  (j ? j.value : B[F]) ?? null,
9949
- D
10032
+ T
9950
10033
  );
9951
10034
  } else
9952
10035
  B = k.mergeCollectedValues(
9953
- A,
9954
- D,
10036
+ E,
10037
+ T,
9955
10038
  k.ancestorBaseResolver(g)
9956
10039
  );
9957
10040
  await $.setBindingData(y, B, {
9958
- skipFragments: E,
10041
+ skipFragments: A,
9959
10042
  kind: "nonSupply",
9960
10043
  sequence: this.operationSequence,
9961
10044
  editedPaths: k.collectEditedPaths(
9962
10045
  g,
9963
10046
  this.operationSequence,
9964
10047
  N ? String(N) : "",
9965
- D
10048
+ T
9966
10049
  )
9967
10050
  });
9968
10051
  }
@@ -10132,7 +10215,7 @@ ${W}
10132
10215
  break;
10133
10216
  await t(s), this.downloadReceivedBytes += s.byteLength, this.dropTotalBytesIfExceeded();
10134
10217
  const a = Date.now();
10135
- a - r >= Ct && (r = a, await this.injectFetchState("loading"));
10218
+ a - r >= Pt && (r = a, await this.injectFetchState("loading"));
10136
10219
  }
10137
10220
  } catch (n) {
10138
10221
  return m.error("Haori", `応答をファイルとして読み取れませんでした: ${n}`), !1;
@@ -10287,11 +10370,13 @@ ${W}
10287
10370
  * 表示先は失敗した応答の振り分けと同じ(フォーム、無ければ対象要素、
10288
10371
  * それも無ければ `document.body`)です。
10289
10372
  *
10373
+ * @param display 表示するか。`-error-no-message` で止めた場合は false で、
10374
+ * 前回の表示を消すだけにする
10290
10375
  * @returns 表示の完了 Promise
10291
10376
  */
10292
- async showDownloadFailure() {
10293
- const e = this.options.formFragment ?? (this.options.targetFragment ? k.getFormFragment(this.options.targetFragment) || this.options.targetFragment : null), t = e ? e.getTarget() : document.body, r = fe();
10294
- await r.clearMessages(t), await r.addErrorMessage(t, Je);
10377
+ async showDownloadFailure(e) {
10378
+ const t = this.options.formFragment ?? (this.options.targetFragment ? k.getFormFragment(this.options.targetFragment) || this.options.targetFragment : null), r = t ? t.getTarget() : document.body, i = fe();
10379
+ await i.clearMessages(r), e && await i.addErrorMessage(r, Je);
10295
10380
  }
10296
10381
  /**
10297
10382
  * 保存するファイル名を決めます。
@@ -10376,7 +10461,7 @@ ${W}
10376
10461
  async handleFetchResult(e, t, r) {
10377
10462
  const i = fe();
10378
10463
  if (!e.ok) {
10379
- if (pt(e.status))
10464
+ if (gt(e.status))
10380
10465
  return !1;
10381
10466
  this.options.targetFragment && t && H.fetchError(
10382
10467
  this.options.targetFragment.getTarget(),
@@ -10385,15 +10470,17 @@ ${W}
10385
10470
  e.status,
10386
10471
  r
10387
10472
  );
10388
- const E = await this.handleFetchError(
10389
- e,
10390
- this.selectErrorActions(e.status)?.noMessage !== !0
10473
+ const A = this.selectErrorActions(e.status), E = A?.bind === !0, T = await this.handleFetchError(
10474
+ E ? e.clone() : e,
10475
+ A?.noMessage !== !0 && !E
10391
10476
  );
10392
- return await this.injectFetchState(
10477
+ return E && await this.bindResult(e).catch((N) => {
10478
+ m.error("Haori", "Failed to bind the error response:", N);
10479
+ }), await this.injectFetchState(
10393
10480
  "error",
10394
10481
  e.status,
10395
10482
  e.statusText || null,
10396
- E
10483
+ T
10397
10484
  ), await this.runErrorActions(e.status), !1;
10398
10485
  }
10399
10486
  if (this.options.targetFragment && t && r && H.fetchEnd(
@@ -10402,45 +10489,47 @@ ${W}
10402
10489
  e.status,
10403
10490
  r
10404
10491
  ), this.options.afterCallback) {
10405
- const E = this.options.afterCallback(e);
10406
- if (E != null) {
10407
- if (E === !1 || typeof E == "object" && E.stop)
10492
+ const A = this.options.afterCallback(e);
10493
+ if (A != null) {
10494
+ if (A === !1 || typeof A == "object" && A.stop)
10408
10495
  return !1;
10409
- typeof E == "object" && "response" in E && (e = "response" in E ? E.response : e);
10496
+ typeof A == "object" && "response" in A && (e = "response" in A ? A.response : e);
10410
10497
  }
10411
10498
  }
10412
10499
  if (this.options.download) {
10413
- const E = await this.saveResponseAsFile(e, t);
10414
- if (E === "cancelled")
10500
+ const A = await this.saveResponseAsFile(e, t);
10501
+ if (A === "cancelled")
10415
10502
  return await this.injectFetchState("success", e.status, null), !1;
10416
- if (E === "failed")
10417
- return await this.showDownloadFailure(), await this.injectFetchState(
10503
+ if (A === "failed") {
10504
+ const E = this.selectErrorActions(null);
10505
+ return await this.showDownloadFailure(E?.noMessage !== !0), await this.injectFetchState(
10418
10506
  "error",
10419
10507
  e.status,
10420
10508
  Je
10421
- ), !1;
10509
+ ), await this.runErrorActions(null), !1;
10510
+ }
10422
10511
  }
10423
10512
  const n = [];
10424
10513
  n.push(this.bindResult(e)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), await this.injectFetchState("success", e.status, null), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
10425
10514
  this.options.resetFragments.map(
10426
- (E) => k.reset(E, this.operationSequence)
10515
+ (A) => k.reset(A, this.operationSequence)
10427
10516
  )
10428
10517
  ), await this.copy();
10429
10518
  const s = [];
10430
- this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((E) => {
10431
- s.push(new p(E, null).run());
10519
+ this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((A) => {
10520
+ s.push(new p(A, null).run());
10432
10521
  });
10433
10522
  const a = await this.clickTargets(
10434
10523
  this.options.clickFragments,
10435
10524
  this.options.clickAwait === !0,
10436
10525
  "click-await"
10437
10526
  );
10438
- if (!a && this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((E) => {
10439
- const A = E.getTarget();
10440
- A instanceof HTMLElement ? s.push(i.openDialog(A)) : m.error("Haori", "Element is not an HTML element: ", A);
10441
- }), !a && this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((E) => {
10442
- const A = E.getTarget();
10443
- A instanceof HTMLElement ? s.push(i.closeDialog(A)) : m.error("Haori", "Element is not an HTML element: ", A);
10527
+ if (!a && this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((A) => {
10528
+ const E = A.getTarget();
10529
+ E instanceof HTMLElement ? s.push(i.openDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
10530
+ }), !a && this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((A) => {
10531
+ const E = A.getTarget();
10532
+ E instanceof HTMLElement ? s.push(i.closeDialog(E)) : m.error("Haori", "Element is not an HTML element: ", E);
10444
10533
  }), await Promise.all(s), a)
10445
10534
  return !1;
10446
10535
  const o = p.unescapeNewlines(
@@ -10453,17 +10542,17 @@ ${W}
10453
10542
  this.resolveLateAttribute("toast", this.options.toastMessage)
10454
10543
  );
10455
10544
  if (c) {
10456
- const E = p.toToastLevel(
10545
+ const A = p.toToastLevel(
10457
10546
  this.resolveLateAttribute("toast-level", this.options.toastLevel)
10458
10547
  );
10459
- await i.toast(c, E ?? "info");
10548
+ await i.toast(c, A ?? "info");
10460
10549
  }
10461
10550
  this.clearStore(), this.pushHistory();
10462
10551
  const u = this.resolveLateAttribute(
10463
10552
  "scroll",
10464
10553
  this.options.scrollTarget
10465
10554
  );
10466
- u && Z.query(
10555
+ u && K.query(
10467
10556
  u,
10468
10557
  p.attrName(this.eventType, "scroll"),
10469
10558
  document
@@ -10481,22 +10570,22 @@ ${W}
10481
10570
  );
10482
10571
  const y = g || d;
10483
10572
  if (y) {
10484
- let E = y;
10485
- const A = this.resolveLateAttribute(
10573
+ let A = y;
10574
+ const E = this.resolveLateAttribute(
10486
10575
  "redirect-return-param",
10487
10576
  this.options.redirectReturnParam
10488
10577
  );
10489
- if (A) {
10490
- const N = new URLSearchParams(window.location.search).get(A);
10578
+ if (E) {
10579
+ const N = new URLSearchParams(window.location.search).get(E);
10491
10580
  if (N !== null) {
10492
10581
  const B = N.trim();
10493
- gt.isSafeLocalPath(B) ? E = B : m.warn(
10582
+ mt.isSafeLocalPath(B) ? A = B : m.warn(
10494
10583
  "Haori",
10495
10584
  `戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${N}`
10496
10585
  );
10497
10586
  }
10498
10587
  }
10499
- g ? window.location.replace(E) : window.location.href = E;
10588
+ g ? window.location.replace(A) : window.location.href = A;
10500
10589
  }
10501
10590
  return !0;
10502
10591
  }
@@ -10599,7 +10688,8 @@ ${W}
10599
10688
  closeFragments: this.options.errorCloseFragments ?? null,
10600
10689
  toastMessage: this.options.errorToastMessage ?? null,
10601
10690
  toastLevel: this.options.errorToastLevel ?? null,
10602
- noMessage: this.options.errorNoMessage === !0
10691
+ noMessage: this.options.errorNoMessage === !0,
10692
+ bind: this.options.errorBind === !0
10603
10693
  } : null);
10604
10694
  }
10605
10695
  /**
@@ -10659,7 +10749,7 @@ ${W}
10659
10749
  g != null && (Array.isArray(g) ? (o.searchParams.delete(d), g.forEach((y) => o.searchParams.append(d, String(y)))) : typeof g == "object" ? o.searchParams.set(d, JSON.stringify(g)) : o.searchParams.set(d, String(g)));
10660
10750
  };
10661
10751
  n && c(r), s && c(i), history.pushState(
10662
- { [$t]: !0 },
10752
+ { [Ct]: !0 },
10663
10753
  "",
10664
10754
  o.toString()
10665
10755
  ), $.refreshUrlParams();
@@ -10705,9 +10795,9 @@ ${W}
10705
10795
  const u = await e.json(), d = [];
10706
10796
  if (Array.isArray(u)) {
10707
10797
  const g = /* @__PURE__ */ new Map(), y = [];
10708
- for (const E of u)
10709
- if (E && typeof E == "object" && !Array.isArray(E)) {
10710
- const A = E.key, D = E.message, N = typeof A == "string" && A.length > 0 ? A : null, B = typeof D == "string" ? D : D != null ? String(D) : "";
10798
+ for (const A of u)
10799
+ if (A && typeof A == "object" && !Array.isArray(A)) {
10800
+ const E = A.key, T = A.message, N = typeof E == "string" && E.length > 0 ? E : null, B = typeof T == "string" ? T : T != null ? String(T) : "";
10711
10801
  if (B.length === 0)
10712
10802
  continue;
10713
10803
  if (N !== null) {
@@ -10715,12 +10805,12 @@ ${W}
10715
10805
  F.push(B), g.set(N, F);
10716
10806
  } else
10717
10807
  y.push(B);
10718
- } else typeof E == "string" && E.length > 0 && y.push(E);
10719
- for (const [E, A] of g)
10720
- d.push({ key: E, message: A.join(`
10808
+ } else typeof A == "string" && A.length > 0 && y.push(A);
10809
+ for (const [A, E] of g)
10810
+ d.push({ key: A, message: E.join(`
10721
10811
  `) });
10722
- for (const E of y)
10723
- d.push({ message: E });
10812
+ for (const A of y)
10813
+ d.push({ message: A });
10724
10814
  } else if (u && typeof u == "object") {
10725
10815
  if (typeof u.message == "string" && d.push({ message: u.message }), Array.isArray(u.messages))
10726
10816
  for (const g of u.messages)
@@ -10946,17 +11036,17 @@ ${W}
10946
11036
  attributeName: s,
10947
11037
  syncWhenUnchanged: "reflect",
10948
11038
  apply: (y) => {
10949
- const E = this.resolveCurrentRowItem(o, y), A = { ...E };
11039
+ const A = this.resolveCurrentRowItem(o, y), E = { ...A };
10950
11040
  if (i && typeof i == "object" && !Array.isArray(i)) {
10951
- const D = E[g], N = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
10952
- A[g] = this.mergeAppendBindingData(
11041
+ const T = A[g], N = T !== null && typeof T == "object" && !Array.isArray(T) ? T : {};
11042
+ E[g] = this.mergeAppendBindingData(
10953
11043
  o,
10954
11044
  i,
10955
11045
  N
10956
11046
  );
10957
11047
  } else
10958
- A[g] = i;
10959
- return this.reconcileRowUserEdits(o, A);
11048
+ E[g] = i;
11049
+ return this.reconcileRowUserEdits(o, E);
10960
11050
  }
10961
11051
  });
10962
11052
  return;
@@ -11015,12 +11105,12 @@ ${W}
11015
11105
  attributeName: s,
11016
11106
  syncWhenUnchanged: "reflect",
11017
11107
  apply: (g) => {
11018
- const y = this.options.bindMerge ? this.resolveCurrentRowItem(o, g) : g, E = this.mergeAppendBindingData(
11108
+ const y = this.options.bindMerge ? this.resolveCurrentRowItem(o, g) : g, A = this.mergeAppendBindingData(
11019
11109
  o,
11020
11110
  i,
11021
11111
  y
11022
- ), A = this.options.bindMerge ? { ...y, ...E } : E;
11023
- return this.reconcileRowUserEdits(o, A);
11112
+ ), E = this.options.bindMerge ? { ...y, ...A } : A;
11113
+ return this.reconcileRowUserEdits(o, E);
11024
11114
  }
11025
11115
  });
11026
11116
  return;
@@ -11339,21 +11429,21 @@ ${W}
11339
11429
  );
11340
11430
  }
11341
11431
  if (c === "GET" || c === "HEAD" || c === "OPTIONS")
11342
- Object.keys(t).length > 0 && (i = mt(i, t));
11432
+ Object.keys(t).length > 0 && (i = yt(i, t));
11343
11433
  else if (Object.keys(t).length > 0) {
11344
11434
  const d = s.get("Content-Type") || "";
11345
11435
  if (/multipart\/form-data/i.test(d)) {
11346
11436
  s.delete("Content-Type");
11347
11437
  const g = new FormData();
11348
- for (const [y, E] of Object.entries(t))
11349
- E == null ? g.append(y, "") : E instanceof Blob ? g.append(y, E) : Array.isArray(E) ? E.forEach((A) => {
11350
- A instanceof Blob ? g.append(y, A) : g.append(y, be(A));
11351
- }) : g.append(y, be(E));
11438
+ for (const [y, A] of Object.entries(t))
11439
+ A == null ? g.append(y, "") : A instanceof Blob ? g.append(y, A) : Array.isArray(A) ? A.forEach((E) => {
11440
+ E instanceof Blob ? g.append(y, E) : g.append(y, be(E));
11441
+ }) : g.append(y, be(A));
11352
11442
  n.body = g;
11353
11443
  } else if (/application\/x-www-form-urlencoded/i.test(d)) {
11354
11444
  const g = new URLSearchParams();
11355
- for (const [y, E] of Object.entries(t))
11356
- E !== void 0 && (Array.isArray(E) ? E.forEach((A) => g.append(y, be(A))) : g.append(y, be(E)));
11445
+ for (const [y, A] of Object.entries(t))
11446
+ A !== void 0 && (Array.isArray(A) ? A.forEach((E) => g.append(y, be(E))) : g.append(y, be(A)));
11357
11447
  n.body = g;
11358
11448
  } else
11359
11449
  s.set("Content-Type", "application/json"), n.body = JSON.stringify(t);
@@ -11471,9 +11561,9 @@ ${W}
11471
11561
  const t = this.options.targetFragment;
11472
11562
  if (!t)
11473
11563
  return m.error("Haori", "Target fragment is not specified for row operation."), null;
11474
- const r = p.attrName(this.eventType, e), i = Z.read(t, r);
11564
+ const r = p.attrName(this.eventType, e), i = K.read(t, r);
11475
11565
  if (i !== null && i.trim() !== "") {
11476
- const s = Z.query(i, r, document);
11566
+ const s = K.query(i, r, document);
11477
11567
  if (s === null)
11478
11568
  return m.error(
11479
11569
  "Haori",
@@ -11515,7 +11605,7 @@ ${W}
11515
11605
  `Row container has no ${l.prefix}each expression.`
11516
11606
  ), null;
11517
11607
  const i = e.getRawAttribute(`${l.prefix}each-array`), n = i !== null, s = n ? `${l.prefix}each-array` : `${l.prefix}each`, a = n ? i : r, o = a.trim().split(".");
11518
- if (!(o.length > 0 && o.every((A) => /^[A-Za-z_$][\w$]*$/.test(A))))
11608
+ if (!(o.length > 0 && o.every((E) => /^[A-Za-z_$][\w$]*$/.test(E))))
11519
11609
  return t || m.error(
11520
11610
  "Haori",
11521
11611
  `Row operations require a plain identifier path for ${s} (got: ${a}).` + (n ? "" : ` Declare ${l.prefix}each-array to specify the array to write back to.`)
@@ -11533,9 +11623,9 @@ ${W}
11533
11623
  d = u.owner, g = u.ownerData, y = [...u.path, ...o.slice(1)];
11534
11624
  else {
11535
11625
  for (d = e, g = null; d; ) {
11536
- const A = d.getRawBindingData();
11537
- if (A && o[0] in A && !p.isRowScopeKey(d, o[0])) {
11538
- g = A;
11626
+ const E = d.getRawBindingData();
11627
+ if (E && o[0] in E && !p.isRowScopeKey(d, o[0])) {
11628
+ g = E;
11539
11629
  break;
11540
11630
  }
11541
11631
  d = d.getParent();
@@ -11547,8 +11637,8 @@ ${W}
11547
11637
  "Haori",
11548
11638
  `Binding data owner not found for ${s}="${a}".`
11549
11639
  ), null;
11550
- const E = p.readPathValue(g, y);
11551
- return Array.isArray(E) ? { owner: d, ownerData: g, array: E, path: y, mapped: n } : (t || m.error(
11640
+ const A = p.readPathValue(g, y);
11641
+ return Array.isArray(A) ? { owner: d, ownerData: g, array: A, path: y, mapped: n } : (t || m.error(
11552
11642
  "Haori",
11553
11643
  `${s}="${a}" does not resolve to an array.`
11554
11644
  ), null);
@@ -11976,19 +12066,19 @@ ${W}
11976
12066
  return Promise.resolve();
11977
12067
  const g = /* @__PURE__ */ new Map();
11978
12068
  return a.forEach((y) => {
11979
- const E = y.getListKey();
11980
- E !== null && !g.has(String(E)) && g.set(String(E), y);
11981
- }), d.forEach((y, E) => {
11982
- if (p.isSameRowItem(i.array[E], y))
12069
+ const A = y.getListKey();
12070
+ A !== null && !g.has(String(A)) && g.set(String(A), y);
12071
+ }), d.forEach((y, A) => {
12072
+ if (p.isSameRowItem(i.array[A], y))
11983
12073
  return;
11984
- const A = g.get(
12074
+ const E = g.get(
11985
12075
  $.createListKey(
11986
12076
  y,
11987
12077
  null,
11988
- E
12078
+ A
11989
12079
  )
11990
12080
  );
11991
- A && $.clearUserEditMarks(A);
12081
+ E && $.clearUserEditMarks(E);
11992
12082
  }), $.setBindingData(
11993
12083
  i.owner.getTarget(),
11994
12084
  p.withPathValue(i.ownerData, i.path, d),
@@ -12068,7 +12158,7 @@ class Kt {
12068
12158
  throw m.error("[Haori]", "Failed to fetch import source:", e, n), new Error(`Failed to fetch: ${e}`);
12069
12159
  }
12070
12160
  if (!r.ok) {
12071
- pt(r.status);
12161
+ gt(r.status);
12072
12162
  const n = `${r.status} ${r.statusText}`;
12073
12163
  throw m.error("[Haori]", "Import HTTP error:", e, n), new Error(`Failed to load ${e}: ${n}`);
12074
12164
  }
@@ -12255,24 +12345,24 @@ const f = class f {
12255
12345
  * @returns 実行完了の Promise
12256
12346
  */
12257
12347
  static executeManagedFetch(e, t = !1) {
12258
- const r = e.getTarget(), i = f.initialValueRestore;
12259
- if (!t && i !== null && e.hasAttribute(`${l.prefix}fetch-form`))
12260
- return i.then(() => f.executeManagedFetch(e, !0)).catch((o) => {
12261
- m.error("Haori", `初期表示の取得に失敗しました: ${o}`);
12348
+ const r = e.getTarget();
12349
+ if (!t && f.initialValueRestores.size > 0 && e.hasAttribute(`${l.prefix}fetch-form`))
12350
+ return Promise.all(f.initialValueRestores).then(() => f.executeManagedFetch(e, !0)).catch((a) => {
12351
+ m.error("Haori", `初期表示の取得に失敗しました: ${a}`);
12262
12352
  }), Promise.resolve();
12263
- const n = f.getReactiveFetchState(r), s = ae.resolveAutoFetchSignature(e);
12264
- if (n.running)
12265
- return (s.hasUnresolvedReference || s.signature !== n.lastSignature) && (n.rerunRequested = !0), Promise.resolve();
12266
- if (s.hasUnresolvedReference || s.signature === null)
12267
- return n.lastSignature = null, Promise.resolve();
12268
- if (n.lastSignature === s.signature)
12353
+ const i = f.getReactiveFetchState(r), n = ae.resolveAutoFetchSignature(e);
12354
+ if (i.running)
12355
+ return (n.hasUnresolvedReference || n.signature !== i.lastSignature) && (i.rerunRequested = !0), Promise.resolve();
12356
+ if (n.hasUnresolvedReference || n.signature === null)
12357
+ return i.lastSignature = null, Promise.resolve();
12358
+ if (i.lastSignature === n.signature)
12269
12359
  return Promise.resolve();
12270
- n.lastSignature = s.signature, n.running = !0;
12271
- const a = new ae(e, null);
12272
- return a.markReentrantBind(), a.runWithResult().then(() => {
12360
+ i.lastSignature = n.signature, i.running = !0;
12361
+ const s = new ae(e, null);
12362
+ return s.markReentrantBind(), s.runWithResult().then(() => {
12273
12363
  }).finally(() => {
12274
- if (n.running = !1, n.rerunRequested)
12275
- return n.rerunRequested = !1, f.executeManagedFetch(e);
12364
+ if (i.running = !1, i.rerunRequested)
12365
+ return i.rerunRequested = !1, f.executeManagedFetch(e);
12276
12366
  });
12277
12367
  }
12278
12368
  /**
@@ -12295,7 +12385,7 @@ const f = class f {
12295
12385
  const s = performance.now();
12296
12386
  return t.setAttribute(`${l.prefix}importing`, ""), H.importStart(t, n), Kt.load(n).then((a) => {
12297
12387
  const o = new TextEncoder().encode(a).length;
12298
- return K.enqueue(() => {
12388
+ return z.enqueue(() => {
12299
12389
  t.innerHTML = a;
12300
12390
  }).then(() => {
12301
12391
  t.removeAttribute(`${l.prefix}importing`), H.importEnd(t, n, o, s), f.adoptImportedChildren(e);
@@ -12359,9 +12449,9 @@ const f = class f {
12359
12449
  return Promise.resolve();
12360
12450
  const i = f.initializeElementFragment(r, !1).then(
12361
12451
  () => k.restoreInitialValues(e)
12362
- ), n = f.initialValueRestore;
12363
- return f.initialValueRestore = i, i.then(() => {
12364
- f.initialValueRestore = n, t && te.applySubtree(e);
12452
+ );
12453
+ return f.initialValueRestores.add(i), i.then(() => {
12454
+ f.initialValueRestores.delete(i), t && te.applySubtree(e);
12365
12455
  });
12366
12456
  }
12367
12457
  /**
@@ -12572,21 +12662,21 @@ const f = class f {
12572
12662
  return r !== null && k.applyCustomValidity(s), Promise.all(o).then(() => {
12573
12663
  });
12574
12664
  case `${l.prefix}url-param`: {
12575
- const g = s.getAttribute(`${l.prefix}url-arg`), y = gt.readParams();
12665
+ const g = s.getAttribute(`${l.prefix}url-arg`), y = mt.readParams();
12576
12666
  g === null && s.hasAttribute(`${l.prefix}store`) && m.warn(
12577
12667
  "Haori",
12578
12668
  `${l.prefix}url-param を ${l.prefix}url-arg なしで ${l.prefix}store と併用すると復元した値が消えます(${l.prefix}url-arg を指定してください)。`
12579
12669
  );
12580
- const E = {
12670
+ const A = {
12581
12671
  reentrant: !0,
12582
12672
  kind: "nonSupply",
12583
12673
  sequence: S.nextSequence()
12584
12674
  };
12585
12675
  if (g === null)
12586
- o.push(f.setBindingData(e, y, E));
12676
+ o.push(f.setBindingData(e, y, A));
12587
12677
  else {
12588
- const A = s.getRawBindingData() || {};
12589
- A[String(g)] = y, o.push(f.setBindingData(e, A, E));
12678
+ const E = s.getRawBindingData() || {};
12679
+ E[String(g)] = y, o.push(f.setBindingData(e, E, A));
12590
12680
  }
12591
12681
  break;
12592
12682
  }
@@ -12637,19 +12727,19 @@ const f = class f {
12637
12727
  d && i.markSupplyApplied(c);
12638
12728
  const g = S.currentSequence(), y = i.getRawBindingData();
12639
12729
  d && (r.clearUserEdits ?? !0) && f.clearUserEditMarks(i, c);
12640
- const E = a ? f.resolveByPathAuthority(i, y, t, u) : t;
12641
- i.setBindingData(E), a && (H.bindChange(e, y, E, "manual"), Fe.mirror(i));
12642
- const A = () => {
12730
+ const A = a ? f.resolveByPathAuthority(i, y, t, u) : t;
12731
+ i.setBindingData(A), a && (H.bindChange(e, y, A, "manual"), Fe.mirror(i));
12732
+ const E = () => {
12643
12733
  i.markBindingWorkStart();
12644
- const D = i.getRawBindingData() ?? E;
12734
+ const T = i.getRawBindingData() ?? A;
12645
12735
  let N = a ? i.setAttribute(
12646
12736
  `${l.prefix}bind`,
12647
- JSON.stringify(f.withoutReservedBindingKeys(D))
12737
+ JSON.stringify(f.withoutReservedBindingKeys(T))
12648
12738
  ) : Promise.resolve();
12649
12739
  return e.tagName === "FORM" && (N = N.then(() => {
12650
12740
  if (i.wasResetAfter(g))
12651
12741
  return;
12652
- const B = i.getRawBindingData() ?? E;
12742
+ const B = i.getRawBindingData() ?? A;
12653
12743
  return k.syncValues(
12654
12744
  i,
12655
12745
  k.resolveSyncValues(i, B),
@@ -12669,7 +12759,7 @@ const f = class f {
12669
12759
  }
12670
12760
  );
12671
12761
  };
12672
- return s ? A() : i.enqueueBindingWork(A);
12762
+ return s ? E() : i.enqueueBindingWork(E);
12673
12763
  }
12674
12764
  /**
12675
12765
  * 宣言データとして外へ出すデータから予約キーを取り除きます。
@@ -12728,36 +12818,36 @@ const f = class f {
12728
12818
  if (f.isPlainRecord(t) && f.isPlainRecord(r)) {
12729
12819
  const u = t, d = r, g = {};
12730
12820
  let y = Object.keys(u).some(
12731
- (A) => !Object.prototype.hasOwnProperty.call(d, A)
12821
+ (E) => !Object.prototype.hasOwnProperty.call(d, E)
12732
12822
  );
12733
- const E = /* @__PURE__ */ new Set([
12823
+ const A = /* @__PURE__ */ new Set([
12734
12824
  ...Object.keys(u),
12735
12825
  ...Object.keys(d)
12736
12826
  ]);
12737
- for (const A of E) {
12738
- const D = n === "" ? A : `${n}.${A}`, N = f.mergePathAuthority(
12827
+ for (const E of A) {
12828
+ const T = n === "" ? E : `${n}.${E}`, N = f.mergePathAuthority(
12739
12829
  e,
12740
- Object.prototype.hasOwnProperty.call(u, A) ? u[A] : f.ABSENT_PATH,
12741
- Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH,
12830
+ Object.prototype.hasOwnProperty.call(u, E) ? u[E] : f.ABSENT_PATH,
12831
+ Object.prototype.hasOwnProperty.call(d, E) ? d[E] : f.ABSENT_PATH,
12742
12832
  i,
12743
- D
12833
+ T
12744
12834
  );
12745
- N !== f.ABSENT_PATH && (g[A] = N), N !== (Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH) && (y = !0);
12835
+ N !== f.ABSENT_PATH && (g[E] = N), N !== (Object.prototype.hasOwnProperty.call(d, E) ? d[E] : f.ABSENT_PATH) && (y = !0);
12746
12836
  }
12747
12837
  return y ? g : d;
12748
12838
  }
12749
12839
  const s = f.resolveArrayPairing(e, t, r, n);
12750
12840
  if (s !== null) {
12751
12841
  const u = t, d = r, g = d.map(
12752
- (y, E) => f.mergePathAuthority(
12842
+ (y, A) => f.mergePathAuthority(
12753
12843
  e,
12754
- u[E],
12844
+ u[A],
12755
12845
  y,
12756
12846
  i,
12757
- `${n}[${s[E]}]`
12847
+ `${n}[${s[A]}]`
12758
12848
  )
12759
12849
  );
12760
- return g.some((y, E) => y !== d[E]) ? g : d;
12850
+ return g.some((y, A) => y !== d[A]) ? g : d;
12761
12851
  }
12762
12852
  if (f.isSameBindingValue(t, r))
12763
12853
  return r;
@@ -13099,29 +13189,29 @@ const f = class f {
13099
13189
  const i = e.hasAttribute(`${l.prefix}derive`), n = e.hasAttribute(`${l.prefix}if`), s = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
13100
13190
  let c = !1, u = !1, d = null;
13101
13191
  if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
13102
- const E = f.createDeriveInputSignature(
13192
+ const A = f.createDeriveInputSignature(
13103
13193
  e,
13104
13194
  a,
13105
13195
  o
13106
13196
  );
13107
- E === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
13197
+ A === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
13108
13198
  () => f.evaluateDerive(e, a, o).then(
13109
13199
  () => {
13110
13200
  }
13111
13201
  )
13112
- )) : e.getDeriveInputSignature() !== E && (r = r.then(() => f.evaluateDerive(
13202
+ )) : e.getDeriveInputSignature() !== A && (r = r.then(() => f.evaluateDerive(
13113
13203
  e,
13114
13204
  a,
13115
13205
  o
13116
13206
  ).then(() => {
13117
- e.setDeriveInputSignature(E);
13207
+ e.setDeriveInputSignature(A);
13118
13208
  })));
13119
13209
  }
13120
13210
  let g = !1, y = 0;
13121
13211
  return n && (r = r.then(() => {
13122
- const E = e.isVisible();
13212
+ const A = e.isVisible();
13123
13213
  return y = S.currentSequence(), f.evaluateIf(e).then(() => {
13124
- g = !E && e.isVisible();
13214
+ g = !A && e.isVisible();
13125
13215
  });
13126
13216
  })), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => f.evaluateEachFixedChildren(e)).then(() => f.evaluateEach(e)).then(() => {
13127
13217
  if (g)
@@ -13142,14 +13232,14 @@ const f = class f {
13142
13232
  })), r.then(() => {
13143
13233
  if (c)
13144
13234
  return;
13145
- const E = [];
13146
- return e.getChildren().forEach((A) => {
13147
- if (A instanceof S) {
13148
- if (f.canSkipUnchangedNestedEach(A))
13235
+ const A = [];
13236
+ return e.getChildren().forEach((E) => {
13237
+ if (E instanceof S) {
13238
+ if (f.canSkipUnchangedNestedEach(E))
13149
13239
  return;
13150
- E.push(f.evaluateAll(A, t));
13151
- } else A instanceof ne && E.push(f.evaluateText(A));
13152
- }), Promise.all(E).then(() => {
13240
+ A.push(f.evaluateAll(E, t));
13241
+ } else E instanceof ne && A.push(f.evaluateText(E));
13242
+ }), Promise.all(A).then(() => {
13153
13243
  });
13154
13244
  }).then(() => {
13155
13245
  u && d !== null && e.setDeriveSubtreeSignature(d);
@@ -14059,60 +14149,60 @@ ${r}
14059
14149
  );
14060
14150
  const g = d.map((F) => F.getListKey()), y = /* @__PURE__ */ new Set();
14061
14151
  d = d.filter((F, j) => {
14062
- const J = String(F.getListKey()), _ = c.get(J) ?? 0;
14152
+ const Z = String(F.getListKey()), _ = c.get(Z) ?? 0;
14063
14153
  if (_ === 0) {
14064
14154
  y.add(F);
14065
14155
  const P = F.getListKey();
14066
14156
  return P !== null && H.rowRemove(F.getTarget(), P, j), u.push(F.remove()), !1;
14067
14157
  }
14068
- return c.set(J, _ - 1), !0;
14158
+ return c.set(Z, _ - 1), !0;
14069
14159
  });
14070
- const E = d.map((F) => F.getListKey()), A = /* @__PURE__ */ new Map();
14160
+ const A = d.map((F) => F.getListKey()), E = /* @__PURE__ */ new Map();
14071
14161
  d.forEach((F) => {
14072
14162
  const j = F.getListKey();
14073
14163
  if (j === null)
14074
14164
  return;
14075
- const J = A.get(j);
14076
- J ? J.push(F) : A.set(j, [F]);
14165
+ const Z = E.get(j);
14166
+ Z ? Z.push(F) : E.set(j, [F]);
14077
14167
  });
14078
- const D = e.getChildElementFragments().filter((F) => !y.has(F)), N = D.filter(
14168
+ const T = e.getChildElementFragments().filter((F) => !y.has(F)), N = T.filter(
14079
14169
  (F) => F.hasAttribute(`${l.prefix}each-before`)
14080
14170
  ).length;
14081
14171
  let B = Promise.resolve();
14082
14172
  return a.forEach((F, j) => {
14083
- const J = t[j], _ = j;
14173
+ const Z = t[j], _ = j;
14084
14174
  let P;
14085
- const se = A.get(F)?.shift();
14175
+ const se = E.get(F)?.shift();
14086
14176
  if (se) {
14087
14177
  P = se;
14088
- const G = N + j;
14178
+ const Y = N + j;
14089
14179
  B = B.then(
14090
14180
  () => f.updateRowFragment(
14091
14181
  P,
14092
- J,
14182
+ Z,
14093
14183
  i,
14094
14184
  _,
14095
14185
  s ? String(s) : null,
14096
14186
  F
14097
14187
  ).then(
14098
- (T) => (
14188
+ (D) => (
14099
14189
  // 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
14100
14190
  // ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
14101
14191
  // される)で DOM の順序が古いまま残る。
14102
14192
  f.repositionEachRow(
14103
14193
  e,
14104
14194
  P,
14105
- D,
14106
- G
14195
+ T,
14196
+ Y
14107
14197
  ).then((L) => {
14108
14198
  if (L !== null && H.rowMove(
14109
14199
  P.getTarget(),
14110
14200
  F,
14111
14201
  L - N,
14112
14202
  j
14113
- ), !(!T && f.isRowLocalEachTemplate(e)))
14203
+ ), !(!D && f.isRowLocalEachTemplate(e)))
14114
14204
  return f.evaluateAll(P).then(
14115
- () => f.applyRowFormValues(e, P, J)
14205
+ () => f.applyRowFormValues(e, P, Z)
14116
14206
  );
14117
14207
  })
14118
14208
  )
@@ -14120,34 +14210,34 @@ ${r}
14120
14210
  );
14121
14211
  } else {
14122
14212
  P = r.clone();
14123
- const G = N + j;
14213
+ const Y = N + j;
14124
14214
  B = B.then(
14125
14215
  () => f.updateRowFragment(
14126
14216
  P,
14127
- J,
14217
+ Z,
14128
14218
  i,
14129
14219
  _,
14130
14220
  s ? String(s) : null,
14131
14221
  F
14132
14222
  ).then(() => {
14133
- const T = D[G] ?? null;
14134
- return e.insertBefore(P, T).then(() => {
14135
- D.splice(G, 0, P);
14136
- }).then(() => f.initializeFreshEachRow(P)).then(() => f.applyRowFormValues(e, P, J)).then(() => {
14137
- H.rowAdd(P.getTarget(), F, _, J);
14223
+ const D = T[Y] ?? null;
14224
+ return e.insertBefore(P, D).then(() => {
14225
+ T.splice(Y, 0, P);
14226
+ }).then(() => f.initializeFreshEachRow(P)).then(() => f.applyRowFormValues(e, P, Z)).then(() => {
14227
+ H.rowAdd(P.getTarget(), F, _, Z);
14138
14228
  });
14139
14229
  })
14140
14230
  );
14141
14231
  }
14142
14232
  }), Promise.all(u).then(() => B).then(() => {
14143
14233
  const F = a.filter(
14144
- (G) => G !== null
14145
- ), j = E.filter(
14146
- (G) => G !== null
14147
- ), J = new Set(j), _ = F.filter((G) => !J.has(G)), se = g.filter(
14148
- (G) => G !== null
14234
+ (Y) => Y !== null
14235
+ ), j = A.filter(
14236
+ (Y) => Y !== null
14237
+ ), Z = new Set(j), _ = F.filter((Y) => !Z.has(Y)), se = g.filter(
14238
+ (Y) => Y !== null
14149
14239
  ).filter(
14150
- (G) => !o.has(G)
14240
+ (Y) => !o.has(Y)
14151
14241
  );
14152
14242
  H.eachUpdate(
14153
14243
  e.getTarget(),
@@ -14410,7 +14500,7 @@ f.ATTRIBUTE_ALIAS_SUFFIX = "attr-", f.PRIORITY_ATTRIBUTE_SUFFIXES = [
14410
14500
  "derive",
14411
14501
  "if",
14412
14502
  "each"
14413
- ], f.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], f.initialValueRestore = null, f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
14503
+ ], f.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], f.initialValueRestores = /* @__PURE__ */ new Set(), f.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
14414
14504
  "bind",
14415
14505
  "derive",
14416
14506
  "derive-name",
@@ -14603,11 +14693,31 @@ const we = class we {
14603
14693
  if (i.getAttribute(this.onAttributeName) !== e)
14604
14694
  return;
14605
14695
  const n = I.get(i);
14606
- n instanceof S && new ae(n, "on", t).run().catch((s) => {
14696
+ n instanceof S && this.isFromTarget(n, t) && new ae(n, "on", t).run().catch((s) => {
14607
14697
  m.error("[Haori]", "Procedure execution error:", s);
14608
14698
  });
14609
14699
  });
14610
14700
  }
14701
+ /**
14702
+ * イベントが `data-on-target` で指定した要素(とその子孫)から発火したかを
14703
+ * 判定します。
14704
+ *
14705
+ * 仕様「カスタムイベント `data-on`」の「`data-on-target`」。宣言が無い場合は
14706
+ * 発火元で絞り込みません。
14707
+ *
14708
+ * @param fragment `data-on` を宣言したフラグメント
14709
+ * @param event 発火したイベント
14710
+ * @returns 手続きを実行する場合は true
14711
+ */
14712
+ isFromTarget(e, t) {
14713
+ const r = `${this.onAttributeName}-target`;
14714
+ if (!e.hasAttribute(r))
14715
+ return !0;
14716
+ const i = K.read(e, r), n = t.target;
14717
+ return i === null || !(n instanceof Node) ? !1 : K.queryAll(i, r).some(
14718
+ (s) => s.contains(n)
14719
+ );
14720
+ }
14611
14721
  /**
14612
14722
  * `data-import` 等で後から挿入される `data-on` 宣言を購読対象へ追加するため、
14613
14723
  * DOM の追加を監視します。
@@ -14972,7 +15082,7 @@ const V = class V {
14972
15082
  const r = e.getAttribute(t);
14973
15083
  if (typeof r != "string" || r.trim() === "")
14974
15084
  return null;
14975
- const i = Z.query(r, t, document);
15085
+ const i = K.query(r, t, document);
14976
15086
  return V.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
14977
15087
  }
14978
15088
  static resolveRootMargin(e) {
@@ -15000,7 +15110,7 @@ V.CONFIG_KEYS = /* @__PURE__ */ new Set([
15000
15110
  "disabled",
15001
15111
  "once"
15002
15112
  ]), V.registrations = /* @__PURE__ */ new Map();
15003
- let Ee = V;
15113
+ let Ae = V;
15004
15114
  const v = class v {
15005
15115
  /**
15006
15116
  * 指定ノードとその子孫を走査し、`data-poll-*` の監視状態を同期します。
@@ -15368,7 +15478,7 @@ const v = class v {
15368
15478
  const i = r.getAttribute(t);
15369
15479
  if (typeof i != "string" || i.trim() === "")
15370
15480
  return r.getTarget().isConnected ? [r] : [];
15371
- const n = Z.queryAll(
15481
+ const n = K.queryAll(
15372
15482
  i,
15373
15483
  t,
15374
15484
  document
@@ -15527,8 +15637,8 @@ v.CONFIG_KEYS = /* @__PURE__ */ new Set([
15527
15637
  "disabled",
15528
15638
  "state"
15529
15639
  ]), v.DEFAULT_INTERVAL_MS = 5e3, v.MIN_INTERVAL_MS = 100, v.registrations = /* @__PURE__ */ new Map(), v.visibilityListener = null;
15530
- let Ae = v;
15531
- const zt = "0.57.1";
15640
+ let Ee = v;
15641
+ const zt = "0.59.0";
15532
15642
  function Gt(b) {
15533
15643
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => b()) : Promise.resolve().then(b);
15534
15644
  }
@@ -15667,7 +15777,7 @@ const O = class O {
15667
15777
  const r = e.getAttribute(t);
15668
15778
  if (typeof r != "string" || r.trim() === "")
15669
15779
  return null;
15670
- const i = Z.query(r, t, document);
15780
+ const i = K.query(r, t, document);
15671
15781
  return O.isHtmlElement(i) ? i : (m.error("[Haori]", `Visible range root element not found: ${r}`), null);
15672
15782
  }
15673
15783
  /**
@@ -15843,7 +15953,7 @@ const U = class U {
15843
15953
  "[Haori]",
15844
15954
  "Failed to build body fragment:",
15845
15955
  i.reason
15846
- ), await U.waitInitialIntakes(), await K.wait(), document.body.setAttribute("data-haori-ready", ""), U.observe(document.head), U.observe(document.body), Ee.syncTree(document.body), Ae.syncTree(document.body), ge.syncTree(document.body);
15956
+ ), await U.waitInitialIntakes(), await z.wait(), document.body.setAttribute("data-haori-ready", ""), U.observe(document.head), U.observe(document.body), Ae.syncTree(document.body), Ee.syncTree(document.body), ge.syncTree(document.body);
15847
15957
  } finally {
15848
15958
  U._initialIntakes = null, e.release();
15849
15959
  }
@@ -16076,17 +16186,17 @@ const U = class U {
16076
16186
  !0,
16077
16187
  t
16078
16188
  );
16079
- U._initialIntakes?.push(n), Ee.syncElement(i), Ae.syncElement(i), ge.syncElement(i);
16189
+ U._initialIntakes?.push(n), Ae.syncElement(i), Ee.syncElement(i), ge.syncElement(i);
16080
16190
  break;
16081
16191
  }
16082
16192
  case "childList": {
16083
16193
  Array.from(r.removedNodes).forEach((i) => {
16084
- U.isStaleExternalRemoval(r, i) || (Ee.cleanupTree(i), Ae.cleanupTree(i), ge.cleanupTree(i), $.removeNode(i));
16194
+ U.isStaleExternalRemoval(r, i) || (Ae.cleanupTree(i), Ee.cleanupTree(i), ge.cleanupTree(i), $.removeNode(i));
16085
16195
  }), Array.from(r.addedNodes).forEach((i) => {
16086
16196
  if (!(i.parentElement instanceof Element))
16087
16197
  return;
16088
16198
  const n = $.addNode(i.parentElement, i);
16089
- U._initialIntakes?.push(n), Ee.syncTree(i), Ae.syncTree(i), ge.syncTree(i);
16199
+ U._initialIntakes?.push(n), Ae.syncTree(i), Ee.syncTree(i), ge.syncTree(i);
16090
16200
  }), r.target instanceof Element && ge.syncElement(r.target);
16091
16201
  break;
16092
16202
  }
@@ -16108,9 +16218,9 @@ const U = class U {
16108
16218
  }
16109
16219
  };
16110
16220
  U._initialized = !1, U._mutationObservers = [], U._dispatcher = null, U._initialIntakes = null;
16111
- let ke = U;
16112
- te.setMutationCapture((b) => ke.captureMutations(b));
16113
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", ke.init) : ke.init();
16221
+ let Ne = U;
16222
+ te.setMutationCapture((b) => Ne.captureMutations(b));
16223
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Ne.init) : Ne.init();
16114
16224
  const Yt = () => Se.waitForRenders(), Xt = Se.enhancers;
16115
16225
  export {
16116
16226
  $ as Core,
@@ -16120,7 +16230,7 @@ export {
16120
16230
  I as Fragment,
16121
16231
  Se as Haori,
16122
16232
  m as Log,
16123
- K as Queue,
16233
+ z as Queue,
16124
16234
  Se as default,
16125
16235
  Xt as enhancers,
16126
16236
  zt as version,