haori 0.6.2 → 0.8.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.
Files changed (47) hide show
  1. package/dist/haori.cjs.js +11 -11
  2. package/dist/haori.cjs.js.map +1 -1
  3. package/dist/haori.es.js +751 -650
  4. package/dist/haori.es.js.map +1 -1
  5. package/dist/haori.iife.js +11 -11
  6. package/dist/haori.iife.js.map +1 -1
  7. package/dist/index.d.ts +46 -2
  8. package/dist/package.json +1 -1
  9. package/dist/src/core.d.ts +45 -1
  10. package/dist/src/core.d.ts.map +1 -1
  11. package/dist/src/core.js +103 -10
  12. package/dist/src/core.js.map +1 -1
  13. package/dist/src/event.d.ts +12 -0
  14. package/dist/src/event.d.ts.map +1 -1
  15. package/dist/src/event.js +14 -0
  16. package/dist/src/event.js.map +1 -1
  17. package/dist/src/index.d.ts +1 -1
  18. package/dist/src/index.d.ts.map +1 -1
  19. package/dist/src/index.js +1 -1
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/procedure.d.ts +7 -0
  22. package/dist/src/procedure.d.ts.map +1 -1
  23. package/dist/src/procedure.js +58 -4
  24. package/dist/src/procedure.js.map +1 -1
  25. package/dist/tests/data-bind-arg-reeval.test.d.ts +2 -0
  26. package/dist/tests/data-bind-arg-reeval.test.d.ts.map +1 -0
  27. package/dist/tests/data-bind-arg-reeval.test.js +119 -0
  28. package/dist/tests/data-bind-arg-reeval.test.js.map +1 -0
  29. package/dist/tests/data-bind-merge.test.d.ts +2 -0
  30. package/dist/tests/data-bind-merge.test.d.ts.map +1 -0
  31. package/dist/tests/data-bind-merge.test.js +86 -0
  32. package/dist/tests/data-bind-merge.test.js.map +1 -0
  33. package/dist/tests/data-if-falsy.test.d.ts +2 -0
  34. package/dist/tests/data-if-falsy.test.d.ts.map +1 -0
  35. package/dist/tests/data-if-falsy.test.js +73 -0
  36. package/dist/tests/data-if-falsy.test.js.map +1 -0
  37. package/dist/tests/data-load-on-show.test.d.ts +2 -0
  38. package/dist/tests/data-load-on-show.test.d.ts.map +1 -0
  39. package/dist/tests/data-load-on-show.test.js +98 -0
  40. package/dist/tests/data-load-on-show.test.js.map +1 -0
  41. package/dist/tests/each-update-event.test.d.ts +2 -0
  42. package/dist/tests/each-update-event.test.d.ts.map +1 -0
  43. package/dist/tests/each-update-event.test.js +83 -0
  44. package/dist/tests/each-update-event.test.js.map +1 -0
  45. package/dist/tests/procedure-action-operations.test.js +128 -0
  46. package/dist/tests/procedure-action-operations.test.js.map +1 -1
  47. package/package.json +1 -1
package/dist/haori.es.js CHANGED
@@ -1,23 +1,23 @@
1
- const q = class q {
1
+ const z = class z {
2
2
  /**
3
3
  * 開発モードの状態を取得します。
4
4
  *
5
5
  * @returns 開発モードならtrue、そうでなければfalse
6
6
  */
7
7
  static isEnabled() {
8
- return q.devMode;
8
+ return z.devMode;
9
9
  }
10
10
  /**
11
11
  * 開発モードを有効化します。
12
12
  */
13
13
  static enable() {
14
- q.devMode = !0;
14
+ z.devMode = !0;
15
15
  }
16
16
  /**
17
17
  * 開発モードを無効化します。
18
18
  */
19
19
  static disable() {
20
- q.devMode = !1;
20
+ z.devMode = !1;
21
21
  }
22
22
  /**
23
23
  * 開発モードを切り替えます。
@@ -25,11 +25,11 @@ const q = class q {
25
25
  * @param enabled trueで有効化、falseで無効化
26
26
  */
27
27
  static set(e) {
28
- q.devMode = e;
28
+ z.devMode = e;
29
29
  }
30
30
  };
31
- q.devMode = !1;
32
- let H = q;
31
+ z.devMode = !1;
32
+ let L = z;
33
33
  const se = "embedded";
34
34
  function ue(S) {
35
35
  return S === "embedded" || S === "demo";
@@ -73,15 +73,15 @@ const $ = class $ {
73
73
  i !== null && ($._runtime = i);
74
74
  }
75
75
  if (e instanceof HTMLScriptElement && e.hasAttribute(`${$._prefix}dev`)) {
76
- H.set(!0);
76
+ L.set(!0);
77
77
  return;
78
78
  }
79
79
  const t = window.location.hostname;
80
80
  if (t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "::1" || t.endsWith(".local")) {
81
- H.set(!0);
81
+ L.set(!0);
82
82
  return;
83
83
  }
84
- H.set(!1);
84
+ L.set(!1);
85
85
  } catch {
86
86
  }
87
87
  }
@@ -95,9 +95,9 @@ const $ = class $ {
95
95
  }
96
96
  };
97
97
  $._prefix = "data-", $._runtime = se;
98
- let l = $;
99
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
100
- class m {
98
+ let u = $;
99
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect();
100
+ class p {
101
101
  /**
102
102
  * 開発モードでのみコンソールに情報を出力します。
103
103
  *
@@ -105,7 +105,7 @@ class m {
105
105
  * @param args 追加の引数
106
106
  */
107
107
  static info(e, ...t) {
108
- H.isEnabled() && console.log && console.log(e, ...t);
108
+ L.isEnabled() && console.log && console.log(e, ...t);
109
109
  }
110
110
  /**
111
111
  * 開発モードでのみコンソールに警告を出力します。
@@ -114,7 +114,7 @@ class m {
114
114
  * @param args 追加の引数
115
115
  */
116
116
  static warn(e, ...t) {
117
- H.isEnabled() && console.warn && console.warn(e, ...t);
117
+ L.isEnabled() && console.warn && console.warn(e, ...t);
118
118
  }
119
119
  /**
120
120
  * モードに関係なくコンソールにエラーを出力します。
@@ -126,7 +126,7 @@ class m {
126
126
  console.error(e, ...t);
127
127
  }
128
128
  }
129
- const P = class P {
129
+ const I = class I {
130
130
  /**
131
131
  * 明示バインド内に持ち込まれてはならない危険値を返します。
132
132
  *
@@ -197,18 +197,18 @@ const P = class P {
197
197
  */
198
198
  static evaluateDetailed(e, t = {}) {
199
199
  if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
200
- return m.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
200
+ return p.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
201
201
  if (this.containsDangerousPatterns(e))
202
- return m.warn("[Haori]", e, "Expression contains dangerous patterns"), { value: null, unresolvedReference: !1 };
202
+ return p.warn("[Haori]", e, "Expression contains dangerous patterns"), { value: null, unresolvedReference: !1 };
203
203
  if (this.containsForbiddenKeys(t))
204
- return m.warn("[Haori]", t, "Binded values contain forbidden keys"), { value: null, unresolvedReference: !1 };
204
+ return p.warn("[Haori]", t, "Binded values contain forbidden keys"), { value: null, unresolvedReference: !1 };
205
205
  const r = this.getForbiddenBindingValueSet();
206
206
  if (this.containsForbiddenBindingValues(
207
207
  t,
208
208
  /* @__PURE__ */ new WeakSet(),
209
209
  r
210
210
  ))
211
- return m.warn(
211
+ return p.warn(
212
212
  "[Haori]",
213
213
  t,
214
214
  "Binded values contain forbidden values"
@@ -236,10 +236,10 @@ const P = class P {
236
236
  continue;
237
237
  }
238
238
  }
239
- return m.error("[Haori]", "Expression evaluation error:", e, o), o instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
239
+ return p.error("[Haori]", "Expression evaluation error:", e, o), o instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
240
240
  }
241
241
  }
242
- return m.error(
242
+ return p.error(
243
243
  "[Haori]",
244
244
  "Failed to recover missing identifiers:",
245
245
  e,
@@ -273,7 +273,7 @@ return (${e});`;
273
273
  compileFailed: !1
274
274
  };
275
275
  } catch (o) {
276
- return m.error(
276
+ return p.error(
277
277
  "[Haori]",
278
278
  "Failed to compile expression:",
279
279
  e,
@@ -755,7 +755,7 @@ return (${e});`;
755
755
  return this.forbiddenBindingValueCache.set(e, !1), !1;
756
756
  }
757
757
  };
758
- P.MAX_IDENTIFIER_RECOVERY_COUNT = 8, P.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), P.forbiddenBindingValueCacheResetScheduled = !1, P.FORBIDDEN_NAMES = [
758
+ I.MAX_IDENTIFIER_RECOVERY_COUNT = 8, I.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), I.forbiddenBindingValueCacheResetScheduled = !1, I.FORBIDDEN_NAMES = [
759
759
  // グローバルオブジェクト
760
760
  "window",
761
761
  "self",
@@ -787,23 +787,23 @@ P.MAX_IDENTIFIER_RECOVERY_COUNT = 8, P.forbiddenBindingValueCache = /* @__PURE__
787
787
  "sessionStorage",
788
788
  "IndexedDB",
789
789
  "history"
790
- ], P.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], P.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), P.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
791
- ...P.FORBIDDEN_NAMES.filter(
792
- (e) => !P.REBINDABLE_FORBIDDEN_NAMES.has(e)
790
+ ], I.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], I.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), I.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
791
+ ...I.FORBIDDEN_NAMES.filter(
792
+ (e) => !I.REBINDABLE_FORBIDDEN_NAMES.has(e)
793
793
  ),
794
794
  "constructor",
795
795
  "__proto__",
796
796
  "prototype",
797
- ...P.STRICT_FORBIDDEN_NAMES
798
- ]), P.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
797
+ ...I.STRICT_FORBIDDEN_NAMES
798
+ ]), I.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
799
799
  "constructor",
800
800
  "__proto__",
801
801
  "prototype"
802
- ]), P.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
802
+ ]), I.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
803
803
  "get",
804
804
  "set",
805
805
  "async"
806
- ]), P.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
806
+ ]), I.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
807
807
  "await",
808
808
  "break",
809
809
  "case",
@@ -837,8 +837,8 @@ P.MAX_IDENTIFIER_RECOVERY_COUNT = 8, P.forbiddenBindingValueCache = /* @__PURE__
837
837
  "while",
838
838
  "with",
839
839
  "yield"
840
- ]), P.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
841
- let W = P;
840
+ ]), I.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
841
+ let Y = I;
842
842
  class de {
843
843
  constructor() {
844
844
  this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
@@ -881,13 +881,13 @@ class de {
881
881
  const r = await t.task();
882
882
  t.resolve(r);
883
883
  } catch (r) {
884
- t.reject(r), m.error("[Haori]", `Task ${t.timestamp} failed:`, r);
884
+ t.reject(r), p.error("[Haori]", `Task ${t.timestamp} failed:`, r);
885
885
  }
886
886
  if (performance.now() - e > this.MAX_BUDGET)
887
887
  break;
888
888
  }
889
889
  } catch (e) {
890
- m.error("[Haori]", "Error processing queue:", e);
890
+ p.error("[Haori]", "Error processing queue:", e);
891
891
  } finally {
892
892
  this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
893
893
  }
@@ -934,7 +934,7 @@ const oe = class oe {
934
934
  }
935
935
  };
936
936
  oe.ASYNC_QUEUE = new de();
937
- let N = oe;
937
+ let M = oe;
938
938
  class te {
939
939
  /**
940
940
  * 実行モードを取得します。
@@ -942,7 +942,7 @@ class te {
942
942
  * @return 実行モード。
943
943
  */
944
944
  static get runtime() {
945
- return l.runtime;
945
+ return u.runtime;
946
946
  }
947
947
  /**
948
948
  * 実行モードを設定します。
@@ -951,7 +951,7 @@ class te {
951
951
  * @return 戻り値はありません。
952
952
  */
953
953
  static setRuntime(e) {
954
- l.setRuntime(e);
954
+ u.setRuntime(e);
955
955
  }
956
956
  /**
957
957
  * 通知ダイアログを表示します。
@@ -960,7 +960,7 @@ class te {
960
960
  * @returns 通知が閉じられると解決されるPromise
961
961
  */
962
962
  static dialog(e) {
963
- return N.enqueue(() => {
963
+ return M.enqueue(() => {
964
964
  window.alert(e);
965
965
  }, !0);
966
966
  }
@@ -988,7 +988,7 @@ class te {
988
988
  * @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
989
989
  */
990
990
  static confirm(e) {
991
- return N.enqueue(() => window.confirm(e), !0);
991
+ return M.enqueue(() => window.confirm(e), !0);
992
992
  }
993
993
  /**
994
994
  * ダイアログを開きます。
@@ -996,8 +996,8 @@ class te {
996
996
  * @param element 開くダイアログのHTML要素
997
997
  */
998
998
  static openDialog(e) {
999
- return N.enqueue(() => {
1000
- e instanceof HTMLDialogElement ? e.showModal() : m.error("[Haori]", "Element is not a dialog: ", e);
999
+ return M.enqueue(() => {
1000
+ e instanceof HTMLDialogElement ? e.showModal() : p.error("[Haori]", "Element is not a dialog: ", e);
1001
1001
  }, !0);
1002
1002
  }
1003
1003
  /**
@@ -1006,8 +1006,8 @@ class te {
1006
1006
  * @param element 閉じるダイアログのHTML要素
1007
1007
  */
1008
1008
  static closeDialog(e) {
1009
- return N.enqueue(() => {
1010
- e instanceof HTMLDialogElement ? e.close() : m.error("[Haori]", "Element is not a dialog: ", e);
1009
+ return M.enqueue(() => {
1010
+ e instanceof HTMLDialogElement ? e.close() : p.error("[Haori]", "Element is not a dialog: ", e);
1011
1011
  }, !0);
1012
1012
  }
1013
1013
  /**
@@ -1027,7 +1027,7 @@ class te {
1027
1027
  * @param level メッセージのレベル(省略可能)
1028
1028
  */
1029
1029
  static addMessage(e, t, r) {
1030
- return N.enqueue(() => {
1030
+ return M.enqueue(() => {
1031
1031
  const i = e instanceof HTMLFormElement ? e : e.parentElement ?? e;
1032
1032
  i.setAttribute("data-message", t), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
1033
1033
  }, !0);
@@ -1038,7 +1038,7 @@ class te {
1038
1038
  * @param parent メッセージをクリアする親要素
1039
1039
  */
1040
1040
  static clearMessages(e) {
1041
- return N.enqueue(() => {
1041
+ return M.enqueue(() => {
1042
1042
  e.removeAttribute("data-message"), e.removeAttribute("data-message-level"), e.querySelectorAll("[data-message]").forEach((t) => {
1043
1043
  t.removeAttribute("data-message"), t.removeAttribute("data-message-level");
1044
1044
  });
@@ -1052,7 +1052,7 @@ function le() {
1052
1052
  (r) => typeof e?.[r] == "function"
1053
1053
  ) ? e : te;
1054
1054
  }
1055
- class E {
1055
+ class A {
1056
1056
  /**
1057
1057
  * フォーム内にある入力エレメントの値をオブジェクトとして取得します。
1058
1058
  * data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
@@ -1063,7 +1063,7 @@ class E {
1063
1063
  */
1064
1064
  static getValues(e) {
1065
1065
  const t = {};
1066
- return E.getPartValues(e, t);
1066
+ return A.getPartValues(e, t);
1067
1067
  }
1068
1068
  /**
1069
1069
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
@@ -1074,32 +1074,32 @@ class E {
1074
1074
  * @returns values と同じオブジェクト
1075
1075
  */
1076
1076
  static getPartValues(e, t) {
1077
- const r = e.getAttribute("name"), i = e.getAttribute(`${l.prefix}form-object`), s = e.getAttribute(`${l.prefix}form-list`);
1077
+ const r = e.getAttribute("name"), i = e.getAttribute(`${u.prefix}form-object`), s = e.getAttribute(`${u.prefix}form-list`);
1078
1078
  if (r) {
1079
- s ? Array.isArray(t[String(r)]) ? t[String(r)].push(e.getValue()) : t[String(r)] = [e.getValue()] : t[String(r)] = e.getValue(), i && m.warn(
1079
+ s ? Array.isArray(t[String(r)]) ? t[String(r)].push(e.getValue()) : t[String(r)] = [e.getValue()] : t[String(r)] = e.getValue(), i && p.warn(
1080
1080
  "Haori",
1081
- `Element cannot have both ${l.prefix}form-object and name attributes.`
1081
+ `Element cannot have both ${u.prefix}form-object and name attributes.`
1082
1082
  );
1083
1083
  for (const n of e.getChildElementFragments())
1084
- E.getPartValues(n, t);
1084
+ A.getPartValues(n, t);
1085
1085
  } else if (i) {
1086
1086
  const n = {};
1087
1087
  for (const a of e.getChildElementFragments())
1088
- E.getPartValues(a, n);
1089
- Object.keys(n).length > 0 && (t[String(i)] = n), s && m.warn(
1088
+ A.getPartValues(a, n);
1089
+ Object.keys(n).length > 0 && (t[String(i)] = n), s && p.warn(
1090
1090
  "Haori",
1091
- `Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
1091
+ `Element cannot have both ${u.prefix}form-list and ${u.prefix}form-object attributes.`
1092
1092
  );
1093
1093
  } else if (s) {
1094
1094
  const n = [];
1095
1095
  for (const a of e.getChildElementFragments()) {
1096
1096
  const o = {};
1097
- E.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
1097
+ A.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
1098
1098
  }
1099
1099
  n.length > 0 && (t[String(s)] = n);
1100
1100
  } else
1101
1101
  for (const n of e.getChildElementFragments())
1102
- E.getPartValues(n, t);
1102
+ A.getPartValues(n, t);
1103
1103
  return t;
1104
1104
  }
1105
1105
  /**
@@ -1112,7 +1112,7 @@ class E {
1112
1112
  * @returns Promise(DOMの更新が完了したら解決される)
1113
1113
  */
1114
1114
  static setValues(e, t, r = !1) {
1115
- return E.setPartValues(e, t, null, r, !0);
1115
+ return A.setPartValues(e, t, null, r, !0);
1116
1116
  }
1117
1117
  /**
1118
1118
  * フォーム内にある入力エレメントに値をイベントなしで設定します。
@@ -1124,7 +1124,7 @@ class E {
1124
1124
  * @returns Promise(DOMの更新が完了したら解決される)
1125
1125
  */
1126
1126
  static syncValues(e, t, r = !1) {
1127
- return E.setPartValues(e, t, null, r, !1);
1127
+ return A.setPartValues(e, t, null, r, !1);
1128
1128
  }
1129
1129
  /**
1130
1130
  * 単一フラグメントへ値を設定します。
@@ -1147,23 +1147,23 @@ class E {
1147
1147
  * @returns Promise(DOMの更新が完了したら解決される)
1148
1148
  */
1149
1149
  static setPartValues(e, t, r = null, i = !1, s = !0) {
1150
- const n = [], a = e.getAttribute("name"), o = e.getAttribute(`${l.prefix}form-object`), c = e.getAttribute(`${l.prefix}form-list`), d = e.getAttribute(`${l.prefix}form-detach`);
1150
+ const n = [], a = e.getAttribute("name"), o = e.getAttribute(`${u.prefix}form-object`), c = e.getAttribute(`${u.prefix}form-list`), d = e.getAttribute(`${u.prefix}form-detach`);
1151
1151
  if (a) {
1152
1152
  if (!d || i) {
1153
1153
  const f = t[String(a)];
1154
1154
  c && Array.isArray(f) && r !== null ? n.push(
1155
- E.applyFragmentValue(e, f[r] ?? null, s)
1156
- ) : typeof f > "u" || (typeof f == "string" || typeof f == "number" || typeof f == "boolean" || f === null ? n.push(E.applyFragmentValue(e, f, s)) : n.push(
1157
- E.applyFragmentValue(e, String(f), s)
1155
+ A.applyFragmentValue(e, f[r] ?? null, s)
1156
+ ) : typeof f > "u" || (typeof f == "string" || typeof f == "number" || typeof f == "boolean" || f === null ? n.push(A.applyFragmentValue(e, f, s)) : n.push(
1157
+ A.applyFragmentValue(e, String(f), s)
1158
1158
  ));
1159
1159
  }
1160
1160
  } else if (o) {
1161
1161
  const f = t[String(o)];
1162
1162
  if (f && typeof f == "object")
1163
- for (const b of e.getChildElementFragments())
1163
+ for (const g of e.getChildElementFragments())
1164
1164
  n.push(
1165
- E.setPartValues(
1166
- b,
1165
+ A.setPartValues(
1166
+ g,
1167
1167
  f,
1168
1168
  null,
1169
1169
  i,
@@ -1173,24 +1173,24 @@ class E {
1173
1173
  } else if (c) {
1174
1174
  const f = t[String(c)];
1175
1175
  if (Array.isArray(f)) {
1176
- const b = e.getChildElementFragments();
1177
- for (let v = 0; v < b.length; v++) {
1178
- const p = b[v];
1179
- f.length > v ? n.push(
1180
- E.setPartValues(
1181
- p,
1182
- f[v],
1183
- v,
1176
+ const g = e.getChildElementFragments();
1177
+ for (let y = 0; y < g.length; y++) {
1178
+ const T = g[y];
1179
+ f.length > y ? n.push(
1180
+ A.setPartValues(
1181
+ T,
1182
+ f[y],
1183
+ y,
1184
1184
  i,
1185
1185
  s
1186
1186
  )
1187
- ) : n.push(E.setPartValues(p, {}, v, i, s));
1187
+ ) : n.push(A.setPartValues(T, {}, y, i, s));
1188
1188
  }
1189
1189
  }
1190
1190
  } else
1191
1191
  for (const f of e.getChildElementFragments())
1192
1192
  n.push(
1193
- E.setPartValues(f, t, null, i, s)
1193
+ A.setPartValues(f, t, null, i, s)
1194
1194
  );
1195
1195
  return Promise.all(n).then(() => {
1196
1196
  });
@@ -1203,10 +1203,10 @@ class E {
1203
1203
  * @returns すべての初期化処理が完了するPromise
1204
1204
  */
1205
1205
  static async reset(e) {
1206
- E.clearValues(e), await Promise.all([
1207
- E.clearMessages(e),
1208
- E.clearEachClones(e)
1209
- ]), await N.enqueue(() => {
1206
+ A.clearValues(e), await Promise.all([
1207
+ A.clearMessages(e),
1208
+ A.clearEachClones(e)
1209
+ ]), await M.enqueue(() => {
1210
1210
  const t = e.getTarget();
1211
1211
  if (t instanceof HTMLFormElement)
1212
1212
  t.reset();
@@ -1217,7 +1217,7 @@ class E {
1217
1217
  s.appendChild(t), s.reset(), r.insertBefore(t, i);
1218
1218
  }
1219
1219
  }
1220
- }), await x.evaluateAll(e);
1220
+ }), await P.evaluateAll(e);
1221
1221
  }
1222
1222
  /**
1223
1223
  * data-each によって生成された複製(テンプレート以外)を削除します。
@@ -1227,9 +1227,9 @@ class E {
1227
1227
  */
1228
1228
  static clearEachClones(e) {
1229
1229
  const t = [], r = (s) => {
1230
- if (s.hasAttribute(`${l.prefix}each`))
1230
+ if (s.hasAttribute(`${u.prefix}each`))
1231
1231
  for (const n of s.getChildElementFragments()) {
1232
- const a = n.hasAttribute(`${l.prefix}each-before`), o = n.hasAttribute(`${l.prefix}each-after`);
1232
+ const a = n.hasAttribute(`${u.prefix}each-before`), o = n.hasAttribute(`${u.prefix}each-after`);
1233
1233
  !a && !o && t.push(n.remove());
1234
1234
  }
1235
1235
  }, i = (s) => {
@@ -1251,7 +1251,7 @@ class E {
1251
1251
  static clearValues(e) {
1252
1252
  e.clearValue();
1253
1253
  for (const t of e.getChildElementFragments())
1254
- E.clearValues(t);
1254
+ A.clearValues(t);
1255
1255
  }
1256
1256
  /**
1257
1257
  * フラグメントとその子要素のメッセージをクリアします。
@@ -1274,7 +1274,7 @@ class E {
1274
1274
  * @return Promise(メッセージの追加が完了したら解決される)
1275
1275
  */
1276
1276
  static addErrorMessage(e, t, r) {
1277
- return E.addMessage(e, t, r, "error");
1277
+ return A.addMessage(e, t, r, "error");
1278
1278
  }
1279
1279
  /**
1280
1280
  * キーに一致するフラグメントにレベル付きメッセージを追加します。
@@ -1287,7 +1287,7 @@ class E {
1287
1287
  * @return Promise(メッセージの追加が完了したら解決される)
1288
1288
  */
1289
1289
  static addMessage(e, t, r, i) {
1290
- const s = [], n = le(), a = n.addMessage, o = (d) => typeof a == "function" ? a.call(n, d, r, i) : n.addErrorMessage(d, r), c = E.findFragmentsByKey(e, t);
1290
+ const s = [], n = le(), a = n.addMessage, o = (d) => typeof a == "function" ? a.call(n, d, r, i) : n.addErrorMessage(d, r), c = A.findFragmentsByKey(e, t);
1291
1291
  return c.forEach((d) => {
1292
1292
  s.push(o(d.getTarget()));
1293
1293
  }), c.length === 0 && s.push(o(e.getTarget())), Promise.all(s).then(() => {
@@ -1301,7 +1301,7 @@ class E {
1301
1301
  * @returns 一致するフラグメントの配列
1302
1302
  */
1303
1303
  static findFragmentsByKey(e, t) {
1304
- return E.findFragmentByKeyParts(e, t.split("."));
1304
+ return A.findFragmentByKeyParts(e, t.split("."));
1305
1305
  }
1306
1306
  /**
1307
1307
  * 指定されたキーに一致するフラグメントを検索します。
@@ -1313,23 +1313,23 @@ class E {
1313
1313
  */
1314
1314
  static findFragmentByKeyParts(e, t) {
1315
1315
  const r = [], i = t[0];
1316
- if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${l.prefix}form-object`))
1317
- t.length > 1 && e.getAttribute(`${l.prefix}form-object`) === i && e.getChildElementFragments().forEach((n) => {
1318
- r.push(...E.findFragmentByKeyParts(n, t.slice(1)));
1316
+ if (t.length == 1 && e.getAttribute("name") === i && r.push(e), e.hasAttribute(`${u.prefix}form-object`))
1317
+ t.length > 1 && e.getAttribute(`${u.prefix}form-object`) === i && e.getChildElementFragments().forEach((n) => {
1318
+ r.push(...A.findFragmentByKeyParts(n, t.slice(1)));
1319
1319
  });
1320
- else if (e.hasAttribute(`${l.prefix}form-list`)) {
1320
+ else if (e.hasAttribute(`${u.prefix}form-list`)) {
1321
1321
  if (t.length > 1) {
1322
- const s = e.getAttribute(`${l.prefix}form-list`), n = i.lastIndexOf("["), a = i.lastIndexOf("]");
1322
+ const s = e.getAttribute(`${u.prefix}form-list`), n = i.lastIndexOf("["), a = i.lastIndexOf("]");
1323
1323
  if (n !== -1 && a !== -1 && n < a) {
1324
1324
  const o = i.substring(0, n);
1325
1325
  if (s === o) {
1326
1326
  const c = i.substring(n + 1, a), d = Number(c);
1327
1327
  if (isNaN(d))
1328
- m.error("Haori", `Invalid index: ${i}`);
1328
+ p.error("Haori", `Invalid index: ${i}`);
1329
1329
  else {
1330
- const f = e.getChildElementFragments().filter((b) => b.hasAttribute(`${l.prefix}row`));
1330
+ const f = e.getChildElementFragments().filter((g) => g.hasAttribute(`${u.prefix}row`));
1331
1331
  d < f.length && r.push(
1332
- ...E.findFragmentByKeyParts(f[d], t.slice(1))
1332
+ ...A.findFragmentByKeyParts(f[d], t.slice(1))
1333
1333
  );
1334
1334
  }
1335
1335
  }
@@ -1337,7 +1337,7 @@ class E {
1337
1337
  }
1338
1338
  } else
1339
1339
  e.getChildElementFragments().forEach((s) => {
1340
- r.push(...E.findFragmentByKeyParts(s, t));
1340
+ r.push(...A.findFragmentByKeyParts(s, t));
1341
1341
  });
1342
1342
  return r;
1343
1343
  }
@@ -1354,12 +1354,12 @@ class E {
1354
1354
  return r ? this.getFormFragment(r) : null;
1355
1355
  }
1356
1356
  }
1357
- const F = class F {
1357
+ const N = class N {
1358
1358
  /**
1359
1359
  * 集計状態を初期化します。
1360
1360
  */
1361
1361
  static reset() {
1362
- F.ELEMENT_STORES.clear(), F.ensureGlobalAccess();
1362
+ N.ELEMENT_STORES.clear(), N.ensureGlobalAccess();
1363
1363
  }
1364
1364
  /**
1365
1365
  * 現在の集計結果スナップショットを返します。
@@ -1367,7 +1367,7 @@ const F = class F {
1367
1367
  * @returns エレメントごとの集計結果
1368
1368
  */
1369
1369
  static snapshot() {
1370
- return F.ensureGlobalAccess(), [...F.ELEMENT_STORES.entries()].map(([e, t]) => ({
1370
+ return N.ensureGlobalAccess(), [...N.ELEMENT_STORES.entries()].map(([e, t]) => ({
1371
1371
  elementId: e,
1372
1372
  tagName: t.tagName,
1373
1373
  attributes: [...t.attributes.entries()].map(([r, i]) => ({
@@ -1376,7 +1376,7 @@ const F = class F {
1376
1376
  calls: i.calls,
1377
1377
  totalDurationMs: i.totalDurationMs,
1378
1378
  maxDurationMs: i.maxDurationMs,
1379
- placeholders: F.sortPlaceholders(
1379
+ placeholders: N.sortPlaceholders(
1380
1380
  i.placeholders
1381
1381
  )
1382
1382
  })).sort((r, i) => i.calls - r.calls),
@@ -1386,7 +1386,7 @@ const F = class F {
1386
1386
  calls: i.calls,
1387
1387
  totalDurationMs: i.totalDurationMs,
1388
1388
  maxDurationMs: i.maxDurationMs,
1389
- placeholders: F.sortPlaceholders(
1389
+ placeholders: N.sortPlaceholders(
1390
1390
  i.placeholders
1391
1391
  )
1392
1392
  })).sort((r, i) => i.calls - r.calls)
@@ -1402,31 +1402,31 @@ const F = class F {
1402
1402
  * @param expressions 今回評価した式一覧
1403
1403
  */
1404
1404
  static record(e, t, r) {
1405
- if (!H.isEnabled() || !e || t.length === 0)
1405
+ if (!L.isEnabled() || !e || t.length === 0)
1406
1406
  return;
1407
- F.ensureGlobalAccess();
1408
- const i = F.getOrCreateElementStore(
1407
+ N.ensureGlobalAccess();
1408
+ const i = N.getOrCreateElementStore(
1409
1409
  e.element
1410
1410
  );
1411
1411
  if (e.kind === "attribute") {
1412
- const n = F.getOrCreateCounter(
1412
+ const n = N.getOrCreateCounter(
1413
1413
  i.attributes,
1414
1414
  e.rawName,
1415
1415
  e.template
1416
1416
  );
1417
- F.updateCounter(
1417
+ N.updateCounter(
1418
1418
  n,
1419
1419
  t,
1420
1420
  r
1421
1421
  );
1422
1422
  return;
1423
1423
  }
1424
- const s = F.getOrCreateCounter(
1424
+ const s = N.getOrCreateCounter(
1425
1425
  i.texts,
1426
1426
  String(e.childIndex),
1427
1427
  e.template
1428
1428
  );
1429
- F.updateCounter(
1429
+ N.updateCounter(
1430
1430
  s,
1431
1431
  t,
1432
1432
  r
@@ -1436,12 +1436,12 @@ const F = class F {
1436
1436
  * globalThis から dev-only の取得窓口を参照できるようにします。
1437
1437
  */
1438
1438
  static ensureGlobalAccess() {
1439
- if (!H.isEnabled())
1439
+ if (!L.isEnabled())
1440
1440
  return;
1441
1441
  const e = globalThis;
1442
- e[F.GLOBAL_KEY] === void 0 && (e[F.GLOBAL_KEY] = {
1443
- reset: () => F.reset(),
1444
- snapshot: () => F.snapshot()
1442
+ e[N.GLOBAL_KEY] === void 0 && (e[N.GLOBAL_KEY] = {
1443
+ reset: () => N.reset(),
1444
+ snapshot: () => N.snapshot()
1445
1445
  });
1446
1446
  }
1447
1447
  /**
@@ -1451,7 +1451,7 @@ const F = class F {
1451
1451
  * @returns 集計ストア
1452
1452
  */
1453
1453
  static getOrCreateElementStore(e) {
1454
- const t = F.createElementId(e), r = F.ELEMENT_STORES.get(t);
1454
+ const t = N.createElementId(e), r = N.ELEMENT_STORES.get(t);
1455
1455
  if (r)
1456
1456
  return r;
1457
1457
  const i = {
@@ -1459,7 +1459,7 @@ const F = class F {
1459
1459
  attributes: /* @__PURE__ */ new Map(),
1460
1460
  texts: /* @__PURE__ */ new Map()
1461
1461
  };
1462
- return F.ELEMENT_STORES.set(t, i), i;
1462
+ return N.ELEMENT_STORES.set(t, i), i;
1463
1463
  }
1464
1464
  /**
1465
1465
  * カウンタを取得または初期化します。
@@ -1509,7 +1509,7 @@ const F = class F {
1509
1509
  */
1510
1510
  static updateCounter(e, t, r) {
1511
1511
  e.calls += 1, e.totalDurationMs += r, e.maxDurationMs = Math.max(e.maxDurationMs, r), t.forEach((i) => {
1512
- const s = F.getOrCreatePlaceholder(
1512
+ const s = N.getOrCreatePlaceholder(
1513
1513
  e.placeholders,
1514
1514
  i.expression
1515
1515
  );
@@ -1548,10 +1548,10 @@ const F = class F {
1548
1548
  * @returns 結果と所要時間
1549
1549
  */
1550
1550
  static measure(e) {
1551
- const t = F.now();
1551
+ const t = N.now();
1552
1552
  return {
1553
1553
  value: e(),
1554
- durationMs: F.now() - t
1554
+ durationMs: N.now() - t
1555
1555
  };
1556
1556
  }
1557
1557
  /**
@@ -1570,43 +1570,43 @@ const F = class F {
1570
1570
  i += `#${s.trim()}`, t.unshift(i);
1571
1571
  break;
1572
1572
  }
1573
- const n = r.getAttribute(`${l.prefix}derive-name`);
1574
- n && n.trim() !== "" && (i += `[${l.prefix}derive-name="${n.trim()}"]`);
1573
+ const n = r.getAttribute(`${u.prefix}derive-name`);
1574
+ n && n.trim() !== "" && (i += `[${u.prefix}derive-name="${n.trim()}"]`);
1575
1575
  const a = r.parentElement;
1576
1576
  a && (i += `:nth-child(${[...a.children].indexOf(r) + 1})`), t.unshift(i), r = a;
1577
1577
  }
1578
1578
  return t.join(" > ");
1579
1579
  }
1580
1580
  };
1581
- F.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", F.ELEMENT_STORES = /* @__PURE__ */ new Map();
1582
- let J = F;
1583
- const K = class K {
1581
+ N.GLOBAL_KEY = "__HAORI_EVALUATION_PROFILE__", N.ELEMENT_STORES = /* @__PURE__ */ new Map();
1582
+ let J = N;
1583
+ const G = class G {
1584
1584
  /**
1585
1585
  * フラグメントのコンストラクタ。
1586
1586
  *
1587
1587
  * @param target 対象ノード
1588
1588
  */
1589
1589
  constructor(e) {
1590
- this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = e, K.FRAGMENT_CACHE.set(e, this);
1590
+ this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = e, G.FRAGMENT_CACHE.set(e, this);
1591
1591
  }
1592
1592
  static get(e) {
1593
1593
  if (e == null)
1594
1594
  return null;
1595
- if (K.FRAGMENT_CACHE.has(e))
1596
- return K.FRAGMENT_CACHE.get(e);
1595
+ if (G.FRAGMENT_CACHE.has(e))
1596
+ return G.FRAGMENT_CACHE.get(e);
1597
1597
  let t;
1598
1598
  switch (e.nodeType) {
1599
1599
  case Node.ELEMENT_NODE:
1600
- t = new M(e);
1600
+ t = new C(e);
1601
1601
  break;
1602
1602
  case Node.TEXT_NODE:
1603
- t = new L(e);
1603
+ t = new H(e);
1604
1604
  break;
1605
1605
  case Node.COMMENT_NODE:
1606
1606
  t = new ae(e);
1607
1607
  break;
1608
1608
  default:
1609
- return m.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
1609
+ return p.warn("[Haori]", "Unsupported node type:", e.nodeType), null;
1610
1610
  }
1611
1611
  return t;
1612
1612
  }
@@ -1628,7 +1628,7 @@ const K = class K {
1628
1628
  return Promise.resolve();
1629
1629
  if (this.parent) {
1630
1630
  const e = this.parent, t = e.skipMutationNodes;
1631
- return N.enqueue(() => {
1631
+ return M.enqueue(() => {
1632
1632
  e.skipMutationNodes = !0, this.target.parentNode === e.getTarget() && e.getTarget().removeChild(this.target), this.mounted = !1;
1633
1633
  }).finally(() => {
1634
1634
  e.skipMutationNodes = t;
@@ -1636,7 +1636,7 @@ const K = class K {
1636
1636
  } else {
1637
1637
  const e = this.target.parentNode;
1638
1638
  if (e)
1639
- return N.enqueue(() => {
1639
+ return M.enqueue(() => {
1640
1640
  this.target.parentNode === e && e.removeChild(this.target), this.mounted = !1;
1641
1641
  });
1642
1642
  this.mounted = !1;
@@ -1653,7 +1653,7 @@ const K = class K {
1653
1653
  return Promise.resolve();
1654
1654
  if (this.parent) {
1655
1655
  const e = this.parent, t = e.skipMutationNodes;
1656
- return N.enqueue(() => {
1656
+ return M.enqueue(() => {
1657
1657
  e.skipMutationNodes = !0, this.target.parentNode !== e.getTarget() && e.getTarget().appendChild(this.target), this.mounted = !0;
1658
1658
  }).finally(() => {
1659
1659
  e.skipMutationNodes = t;
@@ -1684,7 +1684,7 @@ const K = class K {
1684
1684
  * @return 除去のPromise
1685
1685
  */
1686
1686
  remove(e = !0) {
1687
- return this.parent && this.parent.removeChild(this), K.FRAGMENT_CACHE.delete(this.target), e ? this.unmount() : Promise.resolve();
1687
+ return this.parent && this.parent.removeChild(this), G.FRAGMENT_CACHE.delete(this.target), e ? this.unmount() : Promise.resolve();
1688
1688
  }
1689
1689
  /**
1690
1690
  * 対象ノードを取得します。
@@ -1711,8 +1711,8 @@ const K = class K {
1711
1711
  this.parent = e;
1712
1712
  }
1713
1713
  };
1714
- K.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1715
- let w = K;
1714
+ G.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1715
+ let w = G;
1716
1716
  const V = class V extends w {
1717
1717
  /**
1718
1718
  * エレメントフラグメントのコンストラクタ。
@@ -1783,7 +1783,7 @@ const V = class V extends w {
1783
1783
  removeChild(e) {
1784
1784
  const t = this.children.indexOf(e);
1785
1785
  if (t < 0) {
1786
- m.warn("[Haori]", "Child fragment not found.", e);
1786
+ p.warn("[Haori]", "Child fragment not found.", e);
1787
1787
  return;
1788
1788
  }
1789
1789
  this.children.splice(t, 1), e.setParent(null);
@@ -1808,7 +1808,7 @@ const V = class V extends w {
1808
1808
  * clone 時に runtime の hidden 状態だけを落とします。
1809
1809
  */
1810
1810
  normalizeClonedVisibilityState() {
1811
- (this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${l.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${l.prefix}if-false`)), this.children.forEach((e) => {
1811
+ (this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${u.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${u.prefix}if-false`)), this.children.forEach((e) => {
1812
1812
  e instanceof V && e.normalizeClonedVisibilityState();
1813
1813
  });
1814
1814
  }
@@ -2047,16 +2047,16 @@ const V = class V extends w {
2047
2047
  if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
2048
2048
  const i = this.getAttribute("value"), s = r.type === "checkbox" && i === "true";
2049
2049
  let n;
2050
- return s ? n = e === !0 || e === "true" : i === "false" ? n = e === !1 : n = i === String(e), this.value = s ? n : n ? e : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, N.enqueue(() => {
2050
+ return s ? n = e === !0 || e === "true" : i === "false" ? n = e === !1 : n = i === String(e), this.value = s ? n : n ? e : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, M.enqueue(() => {
2051
2051
  r.checked = n, t && r.dispatchEvent(new Event("change", { bubbles: !0 }));
2052
2052
  }).finally(() => {
2053
2053
  this.skipChangeValue = !1;
2054
2054
  }));
2055
- } else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = e, this.skipChangeValue = !0, N.enqueue(() => {
2055
+ } else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = e, this.skipChangeValue = !0, M.enqueue(() => {
2056
2056
  r.value = e === null ? "" : String(e), t && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
2057
2057
  }).finally(() => {
2058
2058
  this.skipChangeValue = !1;
2059
- })) : (m.warn(
2059
+ })) : (p.warn(
2060
2060
  "[Haori]",
2061
2061
  "setValue is not supported for this element type.",
2062
2062
  r
@@ -2138,7 +2138,7 @@ const V = class V extends w {
2138
2138
  return Promise.resolve();
2139
2139
  this.attributeMap.delete(e), this.skipMutationAttributes = !0;
2140
2140
  const r = this.getTarget();
2141
- return N.enqueue(() => {
2141
+ return M.enqueue(() => {
2142
2142
  r.removeAttribute(e), t !== e && r.removeAttribute(t);
2143
2143
  }).finally(() => {
2144
2144
  this.skipMutationAttributes = !1;
@@ -2160,9 +2160,9 @@ const V = class V extends w {
2160
2160
  return e === t ? this.removeAttribute(e) : this.removeAliasedAttribute(e, t);
2161
2161
  const n = new X(e, r);
2162
2162
  if (s) {
2163
- const B = this.attributeMap.get(e);
2164
- if (B && (B.isEvaluate || B.isForceEvaluation()) && !n.isEvaluate && !n.isForceEvaluation())
2165
- return this.skipMutationAttributes = !0, N.enqueue(() => {
2163
+ const U = this.attributeMap.get(e);
2164
+ if (U && (U.isEvaluate || U.isForceEvaluation()) && !n.isEvaluate && !n.isForceEvaluation())
2165
+ return this.skipMutationAttributes = !0, M.enqueue(() => {
2166
2166
  }).finally(() => {
2167
2167
  this.skipMutationAttributes = !1;
2168
2168
  });
@@ -2173,9 +2173,9 @@ const V = class V extends w {
2173
2173
  element: a,
2174
2174
  rawName: e,
2175
2175
  template: r
2176
- }), c = n.isEvaluate || n.isRawEvaluate, d = e === t && V.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), f = n.isSingleExpression(), b = j.joinEvaluateResults(o.results), v = o.results.length === 1 ? o.results[0] : b, p = !n.isForceEvaluation() && (t !== e || d || f ? o.hasUnresolvedReference || v === null || v === void 0 || v === !1 : c && b === ""), g = n.isForceEvaluation() ? r : f ? v : b, D = i && n.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), A = p || g === null || g === !1 ? null : String(g), y = e !== t && a.getAttribute(e) !== r, C = A === null ? a.hasAttribute(t) : a.getAttribute(t) !== A, k = D && A !== null && a.value !== A;
2177
- return !y && !C && !k ? (D && A !== null && (this.value = A), Promise.resolve()) : (this.skipMutationAttributes = !0, N.enqueue(() => {
2178
- y && a.setAttribute(e, r), A === null ? a.removeAttribute(t) : (C && a.setAttribute(t, A), D && (this.value = A, k && (a.value = A)));
2176
+ }), c = n.isEvaluate || n.isRawEvaluate, d = e === t && V.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), f = n.isSingleExpression(), g = j.joinEvaluateResults(o.results), y = o.results.length === 1 ? o.results[0] : g, T = !n.isForceEvaluation() && (t !== e || d || f ? o.hasUnresolvedReference || y === null || y === void 0 || y === !1 : c && g === ""), m = n.isForceEvaluation() ? r : f ? y : g, b = i && n.isEvaluate && t === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), E = T || m === null || m === !1 ? null : String(m), v = e !== t && a.getAttribute(e) !== r, F = E === null ? a.hasAttribute(t) : a.getAttribute(t) !== E, x = b && E !== null && a.value !== E;
2177
+ return !v && !F && !x ? (b && E !== null && (this.value = E), Promise.resolve()) : (this.skipMutationAttributes = !0, M.enqueue(() => {
2178
+ v && a.setAttribute(e, r), E === null ? a.removeAttribute(t) : (F && a.setAttribute(t, E), b && (this.value = E, x && (a.value = E)));
2179
2179
  }).finally(() => {
2180
2180
  this.skipMutationAttributes = !1;
2181
2181
  }));
@@ -2191,7 +2191,7 @@ const V = class V extends w {
2191
2191
  return Promise.resolve();
2192
2192
  this.attributeMap.delete(e), this.skipMutationAttributes = !0;
2193
2193
  const t = this.getTarget();
2194
- return N.enqueue(() => {
2194
+ return M.enqueue(() => {
2195
2195
  t.removeAttribute(e);
2196
2196
  }).finally(() => {
2197
2197
  this.skipMutationAttributes = !1;
@@ -2294,13 +2294,13 @@ const V = class V extends w {
2294
2294
  if (this.skipMutationNodes)
2295
2295
  return Promise.resolve();
2296
2296
  if (e === this)
2297
- return m.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
2297
+ return p.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
2298
2298
  const i = /* @__PURE__ */ new Set();
2299
2299
  let s = this.parent;
2300
2300
  for (; s; )
2301
2301
  i.add(s), s = s.getParent();
2302
2302
  if (i.has(e))
2303
- return m.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
2303
+ return p.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
2304
2304
  const n = e.getParent() === this;
2305
2305
  let a = -1, o = -1;
2306
2306
  n && (a = this.children.indexOf(e), t !== null && (o = this.children.indexOf(t)));
@@ -2310,23 +2310,23 @@ const V = class V extends w {
2310
2310
  if (t === null)
2311
2311
  this.children.push(e);
2312
2312
  else {
2313
- let b;
2314
- if (n ? a !== -1 && a < o ? b = o - 1 : b = o : b = this.children.indexOf(t), b === -1) {
2315
- const v = this.resolveInsertionPointFromDom(
2313
+ let g;
2314
+ if (n ? a !== -1 && a < o ? g = o - 1 : g = o : g = this.children.indexOf(t), g === -1) {
2315
+ const y = this.resolveInsertionPointFromDom(
2316
2316
  t,
2317
2317
  !1
2318
2318
  );
2319
- v === null ? (m.warn(
2319
+ y === null ? (p.warn(
2320
2320
  "[Haori]",
2321
2321
  "Reference child not found in children.",
2322
2322
  t
2323
- ), this.children.push(e)) : (this.children.splice(v.index, 0, e), d = v.referenceNode);
2323
+ ), this.children.push(e)) : (this.children.splice(y.index, 0, e), d = y.referenceNode);
2324
2324
  } else
2325
- this.children.splice(b, 0, e);
2325
+ this.children.splice(g, 0, e);
2326
2326
  }
2327
2327
  e.setParent(this), e.setMounted(this.mounted);
2328
2328
  const f = this.skipMutationNodes;
2329
- return this.skipMutationNodes = !0, N.enqueue(() => {
2329
+ return this.skipMutationNodes = !0, M.enqueue(() => {
2330
2330
  this.target.insertBefore(e.getTarget(), d);
2331
2331
  }).finally(() => {
2332
2332
  this.skipMutationNodes = f;
@@ -2348,7 +2348,7 @@ const V = class V extends w {
2348
2348
  t,
2349
2349
  !0
2350
2350
  );
2351
- return i === null ? (m.warn(
2351
+ return i === null ? (p.warn(
2352
2352
  "[Haori]",
2353
2353
  "Reference child not found in children.",
2354
2354
  t
@@ -2404,7 +2404,7 @@ const V = class V extends w {
2404
2404
  return Promise.resolve();
2405
2405
  this.visible = !1;
2406
2406
  const e = this.getTarget();
2407
- return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${l.prefix}if-false`, ""), Promise.resolve();
2407
+ return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${u.prefix}if-false`, ""), Promise.resolve();
2408
2408
  }
2409
2409
  /**
2410
2410
  * エレメントを表示します。
@@ -2419,7 +2419,7 @@ const V = class V extends w {
2419
2419
  "display",
2420
2420
  this.display,
2421
2421
  this.displayPriority ?? ""
2422
- ), this.display = null, this.displayPriority = null, e.removeAttribute(`${l.prefix}if-false`), this.visible = !0, Promise.resolve();
2422
+ ), this.display = null, this.displayPriority = null, e.removeAttribute(`${u.prefix}if-false`), this.visible = !0, Promise.resolve();
2423
2423
  }
2424
2424
  /**
2425
2425
  * 指定した属性名を持つ最も近い親要素を返します。
@@ -2460,8 +2460,8 @@ V.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
2460
2460
  "reversed",
2461
2461
  "selected"
2462
2462
  ]);
2463
- let M = V;
2464
- class L extends w {
2463
+ let C = V;
2464
+ class H extends w {
2465
2465
  /**
2466
2466
  * テキストフラグメントのコンストラクタ。
2467
2467
  * 対象テキストノードの内容を初期化します。
@@ -2477,7 +2477,7 @@ class L extends w {
2477
2477
  * @returns クローンされたフラグメント
2478
2478
  */
2479
2479
  clone() {
2480
- const e = new L(this.target.cloneNode(!0));
2480
+ const e = new H(this.target.cloneNode(!0));
2481
2481
  return e.mounted = !1, e.text = this.text, e.contents = this.contents, e.renderedText = this.renderedText, e;
2482
2482
  }
2483
2483
  /**
@@ -2513,7 +2513,7 @@ class L extends w {
2513
2513
  evaluate() {
2514
2514
  return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
2515
2515
  new Error("Parent fragment is required for raw evaluation")
2516
- ) : N.enqueue(() => {
2516
+ ) : M.enqueue(() => {
2517
2517
  this.skipMutation = !0;
2518
2518
  let e = this.text;
2519
2519
  this.contents.isRawEvaluate ? e = this.contents.evaluate(
@@ -2573,7 +2573,7 @@ class ae extends w {
2573
2573
  * @return 更新のPromise
2574
2574
  */
2575
2575
  setContent(e) {
2576
- return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, N.enqueue(() => {
2576
+ return this.skipMutation || this.text === e ? Promise.resolve() : (this.text = e, M.enqueue(() => {
2577
2577
  this.skipMutation = !0, this.target.textContent = this.text;
2578
2578
  }).finally(() => {
2579
2579
  this.skipMutation = !1;
@@ -2639,7 +2639,7 @@ const Z = class Z {
2639
2639
  */
2640
2640
  checkRawExpressions() {
2641
2641
  for (let e = 0; e < this.contents.length; e++)
2642
- this.contents[e].type === 2 && this.contents.length > 1 && (m.error(
2642
+ this.contents[e].type === 2 && this.contents.length > 1 && (p.error(
2643
2643
  "[Haori]",
2644
2644
  "Raw expressions are not allowed in multi-content expressions."
2645
2645
  ), this.contents[e].type = 1);
@@ -2686,7 +2686,7 @@ const Z = class Z {
2686
2686
  try {
2687
2687
  if (r(c)) {
2688
2688
  const d = J.measure(
2689
- () => W.evaluateDetailed(c.text, e)
2689
+ () => Y.evaluateDetailed(c.text, e)
2690
2690
  ), f = d.value;
2691
2691
  a += d.durationMs, n.push({
2692
2692
  expression: c.text,
@@ -2695,7 +2695,7 @@ const Z = class Z {
2695
2695
  } else
2696
2696
  s.push(c.text);
2697
2697
  } catch (d) {
2698
- m.error(
2698
+ p.error(
2699
2699
  "[Haori]",
2700
2700
  `Error evaluating ${i} expression: ${c.text}`,
2701
2701
  d
@@ -2758,7 +2758,7 @@ const _ = class _ extends j {
2758
2758
  (i) => this.forceEvaluation && i.type === 0 || i.type === 1 || i.type === 2,
2759
2759
  "attribute"
2760
2760
  );
2761
- return this.forceEvaluation && r.results.length > 1 ? (m.error(
2761
+ return this.forceEvaluation && r.results.length > 1 ? (p.error(
2762
2762
  "[Haori]",
2763
2763
  "each or if expressions must have a single content.",
2764
2764
  r.results
@@ -2869,6 +2869,20 @@ class R {
2869
2869
  reason: i
2870
2870
  });
2871
2871
  }
2872
+ /**
2873
+ * bindcompleteイベントを発火します。
2874
+ *
2875
+ * Procedure(data-*-bind / data-*-bind-arg など)によるバインドと、それに伴う
2876
+ * 対象要素配下の再評価(data-if / data-each 等)が完了したタイミングで発火します。
2877
+ * 外部スクリプトがバインド完了を契機に同期処理を行うために利用できます。
2878
+ *
2879
+ * @param target バインド対象要素
2880
+ * @param bindArg バインド時に使用したネストキー(指定がない場合は null)
2881
+ * @param reason 変更理由
2882
+ */
2883
+ static bindComplete(e, t = null, r = "other") {
2884
+ R.dispatch(e, "bindcomplete", { bindArg: t, reason: r });
2885
+ }
2872
2886
  /**
2873
2887
  * eachupdateイベントを発火します。
2874
2888
  *
@@ -3046,7 +3060,7 @@ const h = class h {
3046
3060
  * 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
3047
3061
  */
3048
3062
  static attrName(e, t, r = !1) {
3049
- return e ? `${l.prefix}${e}-${t}` : r ? `${l.prefix}fetch-${t}` : `${l.prefix}${t}`;
3063
+ return e ? `${u.prefix}${e}-${t}` : r ? `${u.prefix}fetch-${t}` : `${u.prefix}${t}`;
3050
3064
  }
3051
3065
  /**
3052
3066
  * data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
@@ -3070,7 +3084,7 @@ const h = class h {
3070
3084
  return { value: e.replace(
3071
3085
  h.DATA_PLACEHOLDER_REGEX,
3072
3086
  (s, n, a) => {
3073
- const o = W.evaluateDetailed(
3087
+ const o = Y.evaluateDetailed(
3074
3088
  n ?? a ?? "",
3075
3089
  t
3076
3090
  );
@@ -3150,7 +3164,7 @@ const h = class h {
3150
3164
  return { value: e.replace(
3151
3165
  h.DATA_PLACEHOLDER_REGEX,
3152
3166
  (s, n, a, o) => {
3153
- const c = W.evaluateDetailed(
3167
+ const c = Y.evaluateDetailed(
3154
3168
  n ?? a ?? "",
3155
3169
  t
3156
3170
  );
@@ -3187,7 +3201,7 @@ const h = class h {
3187
3201
  const a = r.trim();
3188
3202
  if (h.SINGLE_PLACEHOLDER_REGEX.test(a))
3189
3203
  return {
3190
- value: x.parseDataBind(s),
3204
+ value: P.parseDataBind(s),
3191
3205
  hasUnresolvedReference: n
3192
3206
  };
3193
3207
  if (a.startsWith("{") || a.startsWith("[")) {
@@ -3196,7 +3210,7 @@ const h = class h {
3196
3210
  e.getBindingData()
3197
3211
  );
3198
3212
  return {
3199
- value: x.parseDataBind(c.value),
3213
+ value: P.parseDataBind(c.value),
3200
3214
  hasUnresolvedReference: n || c.hasUnresolvedReference
3201
3215
  };
3202
3216
  }
@@ -3205,7 +3219,7 @@ const h = class h {
3205
3219
  e.getBindingData()
3206
3220
  );
3207
3221
  return {
3208
- value: x.parseDataBind(o.value),
3222
+ value: P.parseDataBind(o.value),
3209
3223
  hasUnresolvedReference: n || o.hasUnresolvedReference
3210
3224
  };
3211
3225
  }
@@ -3223,23 +3237,23 @@ const h = class h {
3223
3237
  if (t) {
3224
3238
  if (e.hasAttribute(h.attrName(t, "validate")) && (r.valid = !0), e.hasAttribute(h.attrName(t, "confirm")) && (r.confirmMessage = e.getAttribute(h.attrName(t, "confirm")).replace(/\\n/g, `
3225
3239
  `)), e.hasAttribute(h.attrName(t, "data")) && (r.dataAttrName = h.attrName(t, "data")), e.hasAttribute(h.attrName(t, "form"))) {
3226
- const p = e.getRawAttribute(
3240
+ const m = e.getRawAttribute(
3227
3241
  h.attrName(t, "form")
3228
3242
  );
3229
- if (p) {
3230
- const g = document.body.querySelector(p);
3231
- g !== null ? r.formFragment = E.getFormFragment(
3232
- w.get(g)
3233
- ) : m.error(
3243
+ if (m) {
3244
+ const b = document.body.querySelector(m);
3245
+ b !== null ? r.formFragment = A.getFormFragment(
3246
+ w.get(b)
3247
+ ) : p.error(
3234
3248
  "Haori",
3235
- `Form element not found: ${p} (${h.attrName(t, "form")})`
3249
+ `Form element not found: ${m} (${h.attrName(t, "form")})`
3236
3250
  );
3237
3251
  } else
3238
- r.formFragment = E.getFormFragment(e);
3239
- } else t === "change" && (r.formFragment = E.getFormFragment(e));
3240
- if (e.hasAttribute(`${l.prefix}${t}-before-run`)) {
3241
- const p = e.getRawAttribute(
3242
- `${l.prefix}${t}-before-run`
3252
+ r.formFragment = A.getFormFragment(e);
3253
+ } else t === "change" && (r.formFragment = A.getFormFragment(e));
3254
+ if (e.hasAttribute(`${u.prefix}${t}-before-run`)) {
3255
+ const m = e.getRawAttribute(
3256
+ `${u.prefix}${t}-before-run`
3243
3257
  );
3244
3258
  try {
3245
3259
  r.beforeCallback = new Function(
@@ -3247,75 +3261,75 @@ const h = class h {
3247
3261
  "fetchOptions",
3248
3262
  `
3249
3263
  "use strict";
3250
- ${p}
3264
+ ${m}
3251
3265
  `
3252
3266
  );
3253
- } catch (g) {
3254
- m.error("Haori", `Invalid before script: ${g}`);
3267
+ } catch (b) {
3268
+ p.error("Haori", `Invalid before script: ${b}`);
3255
3269
  }
3256
3270
  }
3257
3271
  }
3258
3272
  const i = h.attrName(t, "fetch"), s = e.hasAttribute(i);
3259
3273
  if (s) {
3260
- const p = e.getAttributeEvaluation(i);
3261
- p && (r.fetchHasUnresolvedReference = p.hasUnresolvedReference, r.fetchUrl = p.hasUnresolvedReference ? null : p.value);
3274
+ const m = e.getAttributeEvaluation(i);
3275
+ m && (r.fetchHasUnresolvedReference = m.hasUnresolvedReference, r.fetchUrl = m.hasUnresolvedReference ? null : m.value);
3262
3276
  }
3263
3277
  const n = {};
3264
3278
  if (t) {
3265
- const p = h.attrName(t, "fetch-method");
3266
- if (e.hasAttribute(p)) {
3267
- const g = e.getAttributeEvaluation(p);
3268
- g?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = g?.value;
3279
+ const m = h.attrName(t, "fetch-method");
3280
+ if (e.hasAttribute(m)) {
3281
+ const b = e.getAttributeEvaluation(m);
3282
+ b?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = b?.value;
3269
3283
  }
3270
3284
  } else {
3271
- const p = h.attrName(null, "method", !0);
3272
- if (e.hasAttribute(p)) {
3273
- const g = e.getAttributeEvaluation(
3274
- p
3285
+ const m = h.attrName(null, "method", !0);
3286
+ if (e.hasAttribute(m)) {
3287
+ const b = e.getAttributeEvaluation(
3288
+ m
3275
3289
  );
3276
- g?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = g?.value;
3290
+ b?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : n.method = b?.value;
3277
3291
  }
3278
3292
  }
3279
3293
  if (t) {
3280
- const p = h.attrName(t, "fetch-headers");
3281
- if (e.hasAttribute(p)) {
3282
- const g = e.getRawAttribute(
3283
- p
3294
+ const m = h.attrName(t, "fetch-headers");
3295
+ if (e.hasAttribute(m)) {
3296
+ const b = e.getRawAttribute(
3297
+ m
3284
3298
  );
3285
3299
  try {
3286
- n.headers = x.parseDataBind(g);
3287
- } catch (D) {
3288
- m.error("Haori", `Invalid fetch headers: ${D}`);
3300
+ n.headers = P.parseDataBind(b);
3301
+ } catch (E) {
3302
+ p.error("Haori", `Invalid fetch headers: ${E}`);
3289
3303
  }
3290
3304
  }
3291
3305
  } else {
3292
- const p = h.attrName(
3306
+ const m = h.attrName(
3293
3307
  null,
3294
3308
  "headers",
3295
3309
  !0
3296
3310
  );
3297
- if (e.hasAttribute(p)) {
3298
- const g = e.getRawAttribute(
3299
- p
3311
+ if (e.hasAttribute(m)) {
3312
+ const b = e.getRawAttribute(
3313
+ m
3300
3314
  );
3301
3315
  try {
3302
- n.headers = x.parseDataBind(g);
3303
- } catch (D) {
3304
- m.error("Haori", `Invalid fetch headers: ${D}`);
3316
+ n.headers = P.parseDataBind(b);
3317
+ } catch (E) {
3318
+ p.error("Haori", `Invalid fetch headers: ${E}`);
3305
3319
  }
3306
3320
  }
3307
3321
  }
3308
3322
  if (t) {
3309
- const p = h.attrName(t, "fetch-content-type");
3310
- if (e.hasAttribute(p)) {
3311
- const g = e.getAttributeEvaluation(p);
3312
- g?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
3323
+ const m = h.attrName(t, "fetch-content-type");
3324
+ if (e.hasAttribute(m)) {
3325
+ const b = e.getAttributeEvaluation(m);
3326
+ b?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
3313
3327
  ...n.headers,
3314
- "Content-Type": g?.value
3328
+ "Content-Type": b?.value
3315
3329
  };
3316
3330
  } else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
3317
- let g = !1;
3318
- n.headers && typeof n.headers == "object" && (g = "Content-Type" in n.headers), g || (n.headers = {
3331
+ let b = !1;
3332
+ n.headers && typeof n.headers == "object" && (b = "Content-Type" in n.headers), b || (n.headers = {
3319
3333
  ...n.headers,
3320
3334
  "Content-Type": "application/json"
3321
3335
  });
@@ -3324,20 +3338,20 @@ ${p}
3324
3338
  "Content-Type": "application/x-www-form-urlencoded"
3325
3339
  });
3326
3340
  } else {
3327
- const p = h.attrName(
3341
+ const m = h.attrName(
3328
3342
  null,
3329
3343
  "content-type",
3330
3344
  !0
3331
3345
  );
3332
- if (e.hasAttribute(p)) {
3333
- const g = e.getAttributeEvaluation(p);
3334
- g?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
3346
+ if (e.hasAttribute(m)) {
3347
+ const b = e.getAttributeEvaluation(m);
3348
+ b?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), n.headers = {
3335
3349
  ...n.headers,
3336
- "Content-Type": g?.value
3350
+ "Content-Type": b?.value
3337
3351
  };
3338
3352
  } else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
3339
- let g = !1;
3340
- n.headers && typeof n.headers == "object" && (g = "Content-Type" in n.headers), g || (n.headers = {
3353
+ let b = !1;
3354
+ n.headers && typeof n.headers == "object" && (b = "Content-Type" in n.headers), b || (n.headers = {
3341
3355
  ...n.headers,
3342
3356
  "Content-Type": "application/json"
3343
3357
  });
@@ -3349,15 +3363,15 @@ ${p}
3349
3363
  Object.keys(n).length > 0 && (r.fetchOptions = n);
3350
3364
  const a = t ? h.attrName(t, "bind") : h.attrName(null, "bind", !0);
3351
3365
  if (e.hasAttribute(a)) {
3352
- const p = e.getRawAttribute(a);
3353
- if (p) {
3354
- const g = document.body.querySelectorAll(p);
3355
- g.length > 0 ? (r.bindFragments = [], g.forEach((D) => {
3356
- const A = w.get(D);
3357
- A && r.bindFragments.push(A);
3358
- })) : m.error(
3366
+ const m = e.getRawAttribute(a);
3367
+ if (m) {
3368
+ const b = document.body.querySelectorAll(m);
3369
+ b.length > 0 ? (r.bindFragments = [], b.forEach((E) => {
3370
+ const v = w.get(E);
3371
+ v && r.bindFragments.push(v);
3372
+ })) : p.error(
3359
3373
  "Haori",
3360
- `Bind element not found: ${p} (${a})`
3374
+ `Bind element not found: ${m} (${a})`
3361
3375
  );
3362
3376
  }
3363
3377
  }
@@ -3375,55 +3389,57 @@ ${p}
3375
3389
  ) : e.hasAttribute(d) && (r.bindArg = e.getRawAttribute(d));
3376
3390
  const f = t ? h.attrName(t, "bind-params") : h.attrName(null, "bind-params", !0);
3377
3391
  if (e.hasAttribute(f)) {
3378
- const p = e.getRawAttribute(f);
3379
- r.bindParams = p.split("&").map((g) => g.trim());
3392
+ const m = e.getRawAttribute(f);
3393
+ r.bindParams = m.split("&").map((b) => b.trim());
3380
3394
  }
3381
- const b = t ? h.attrName(t, "bind-append") : h.attrName(null, "bind-append", !0);
3382
- if (e.hasAttribute(b)) {
3383
- const p = e.getRawAttribute(b);
3384
- r.bindAppendParams = p.split("&").map((g) => g.trim()).filter(Boolean);
3395
+ const g = t ? h.attrName(t, "bind-append") : h.attrName(null, "bind-append", !0);
3396
+ if (e.hasAttribute(g)) {
3397
+ const m = e.getRawAttribute(g);
3398
+ r.bindAppendParams = m.split("&").map((b) => b.trim()).filter(Boolean);
3385
3399
  }
3386
- const v = t ? h.attrName(t, "copy-params") : null;
3387
- if (v && e.hasAttribute(v)) {
3388
- const p = e.getRawAttribute(v);
3389
- r.copyParams = p.split("&").map((g) => g.trim()).filter(Boolean);
3400
+ const y = t ? h.attrName(t, "bind-merge") : h.attrName(null, "bind-merge", !0);
3401
+ e.hasAttribute(y) && (r.bindMerge = !0);
3402
+ const T = t ? h.attrName(t, "copy-params") : null;
3403
+ if (T && e.hasAttribute(T)) {
3404
+ const m = e.getRawAttribute(T);
3405
+ r.copyParams = m.split("&").map((b) => b.trim()).filter(Boolean);
3390
3406
  }
3391
3407
  if (t) {
3392
3408
  if (e.hasAttribute(h.attrName(t, "adjust"))) {
3393
- const g = e.getRawAttribute(
3409
+ const E = e.getRawAttribute(
3394
3410
  h.attrName(t, "adjust")
3395
3411
  );
3396
- if (g) {
3397
- const D = document.body.querySelectorAll(g);
3398
- D.length > 0 ? (r.adjustFragments = [], D.forEach((A) => {
3399
- const y = w.get(A);
3400
- y && r.adjustFragments.push(y);
3401
- })) : m.error(
3412
+ if (E) {
3413
+ const v = document.body.querySelectorAll(E);
3414
+ v.length > 0 ? (r.adjustFragments = [], v.forEach((F) => {
3415
+ const x = w.get(F);
3416
+ x && r.adjustFragments.push(x);
3417
+ })) : p.error(
3402
3418
  "Haori",
3403
- `Adjust element not found: ${g} (${h.attrName(t, "adjust")})`
3419
+ `Adjust element not found: ${E} (${h.attrName(t, "adjust")})`
3404
3420
  );
3405
3421
  }
3406
3422
  if (e.hasAttribute(h.attrName(t, "adjust-value"))) {
3407
- const D = e.getRawAttribute(
3423
+ const v = e.getRawAttribute(
3408
3424
  h.attrName(t, "adjust-value")
3409
- ), A = Number(D);
3410
- isNaN(A) || (r.adjustValue = A);
3425
+ ), F = Number(v);
3426
+ isNaN(F) || (r.adjustValue = F);
3411
3427
  }
3412
3428
  }
3413
- if (e.hasAttribute(h.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(h.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(h.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(h.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${l.prefix}${t}-after-run`)) {
3414
- const g = e.getRawAttribute(
3415
- `${l.prefix}${t}-after-run`
3429
+ if (e.hasAttribute(h.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(h.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(h.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(h.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${u.prefix}${t}-after-run`)) {
3430
+ const E = e.getRawAttribute(
3431
+ `${u.prefix}${t}-after-run`
3416
3432
  );
3417
3433
  try {
3418
3434
  r.afterCallback = new Function(
3419
3435
  "response",
3420
3436
  `
3421
3437
  "use strict";
3422
- ${g}
3438
+ ${E}
3423
3439
  `
3424
3440
  );
3425
- } catch (D) {
3426
- m.error("Haori", `Invalid after script: ${D}`);
3441
+ } catch (v) {
3442
+ p.error("Haori", `Invalid after script: ${v}`);
3427
3443
  }
3428
3444
  }
3429
3445
  if (e.hasAttribute(h.attrName(t, "dialog")) && (r.dialogMessage = e.getAttribute(h.attrName(t, "dialog")).replace(/\\n/g, `
@@ -3431,10 +3447,10 @@ ${g}
3431
3447
  r.toastMessage = e.getAttribute(
3432
3448
  h.attrName(t, "toast")
3433
3449
  );
3434
- const g = e.getRawAttribute(
3450
+ const E = e.getRawAttribute(
3435
3451
  h.attrName(t, "toast-level")
3436
- ), A = ["info", "warning", "error", "success"].includes(g);
3437
- r.toastLevel = A ? g : null;
3452
+ ), F = ["info", "warning", "error", "success"].includes(E);
3453
+ r.toastLevel = F ? E : null;
3438
3454
  }
3439
3455
  if (e.hasAttribute(h.attrName(t, "redirect")) && (r.redirectUrl = e.getAttribute(
3440
3456
  h.attrName(t, "redirect")
@@ -3443,19 +3459,19 @@ ${g}
3443
3459
  )), e.hasAttribute(h.attrName(t, "history")) && (r.historyUrl = e.getAttribute(
3444
3460
  h.attrName(t, "history")
3445
3461
  )), e.hasAttribute(h.attrName(t, "history-data")) && (r.historyDataAttrName = h.attrName(t, "history-data")), e.hasAttribute(h.attrName(t, "history-form"))) {
3446
- const g = e.getRawAttribute(
3462
+ const E = e.getRawAttribute(
3447
3463
  h.attrName(t, "history-form")
3448
3464
  );
3449
- if (g) {
3450
- const D = document.body.querySelector(g);
3451
- D !== null ? r.historyFormFragment = E.getFormFragment(
3452
- w.get(D)
3453
- ) : m.error(
3465
+ if (E) {
3466
+ const v = document.body.querySelector(E);
3467
+ v !== null ? r.historyFormFragment = A.getFormFragment(
3468
+ w.get(v)
3469
+ ) : p.error(
3454
3470
  "Haori",
3455
- `Form element not found: ${g} (${h.attrName(t, "history-form")})`
3471
+ `Form element not found: ${E} (${h.attrName(t, "history-form")})`
3456
3472
  );
3457
3473
  } else
3458
- r.historyFormFragment = E.getFormFragment(e);
3474
+ r.historyFormFragment = A.getFormFragment(e);
3459
3475
  }
3460
3476
  [
3461
3477
  "reset-before",
@@ -3465,54 +3481,75 @@ ${g}
3465
3481
  "copy",
3466
3482
  "open",
3467
3483
  "close"
3468
- ].forEach((g) => {
3469
- const D = h.attrName(t, g);
3470
- if (!e.hasAttribute(D))
3484
+ ].forEach((E) => {
3485
+ const v = h.attrName(t, E);
3486
+ if (!e.hasAttribute(v))
3471
3487
  return;
3472
- const A = e.getRawAttribute(D), y = [];
3473
- if (A ? (document.body.querySelectorAll(A).forEach((k) => {
3474
- const B = w.get(k);
3475
- B && y.push(B);
3476
- }), y.length === 0 && m.error("Haori", `Element not found: ${A} (${D})`)) : y.push(e), y.length > 0)
3477
- switch (g) {
3488
+ const F = e.getRawAttribute(v), x = [];
3489
+ if (F ? (document.body.querySelectorAll(F).forEach((B) => {
3490
+ const K = w.get(B);
3491
+ K && x.push(K);
3492
+ }), x.length === 0 && p.error("Haori", `Element not found: ${F} (${v})`)) : x.push(e), x.length > 0)
3493
+ switch (E) {
3478
3494
  case "reset-before":
3479
- r.resetBeforeFragments = y;
3495
+ r.resetBeforeFragments = x;
3480
3496
  break;
3481
3497
  case "reset":
3482
- r.resetFragments = y;
3498
+ r.resetFragments = x;
3483
3499
  break;
3484
3500
  case "refetch":
3485
- r.refetchFragments = y;
3501
+ r.refetchFragments = x;
3486
3502
  break;
3487
3503
  case "click":
3488
- r.clickFragments = y;
3504
+ r.clickFragments = x;
3489
3505
  break;
3490
3506
  case "copy":
3491
- r.copyFragments = y;
3507
+ r.copyFragments = x;
3492
3508
  break;
3493
3509
  case "open":
3494
- r.openFragments = y;
3510
+ r.openFragments = x;
3495
3511
  break;
3496
3512
  case "close":
3497
- r.closeFragments = y;
3513
+ r.closeFragments = x;
3498
3514
  break;
3499
3515
  }
3500
3516
  });
3517
+ const b = h.attrName(t, "copy-source");
3518
+ if (e.hasAttribute(b)) {
3519
+ const E = e.getRawAttribute(
3520
+ b
3521
+ );
3522
+ if (E) {
3523
+ const v = document.body.querySelector(E);
3524
+ if (v !== null) {
3525
+ const F = w.get(v);
3526
+ F ? r.copySourceFragment = F : p.error(
3527
+ "Haori",
3528
+ `Element is not managed by Haori: ${E} (${b})`
3529
+ );
3530
+ } else
3531
+ p.error(
3532
+ "Haori",
3533
+ `Element not found: ${E} (${b})`
3534
+ );
3535
+ } else
3536
+ r.copySourceFragment = e;
3537
+ }
3501
3538
  }
3502
3539
  if (!t && (e.hasAttribute(h.attrName(null, "data", !0)) && (r.dataAttrName = h.attrName(null, "data", !0)), e.hasAttribute(h.attrName(null, "form", !0)))) {
3503
- const p = e.getRawAttribute(
3540
+ const m = e.getRawAttribute(
3504
3541
  h.attrName(null, "form", !0)
3505
3542
  );
3506
- if (p) {
3507
- const g = document.body.querySelector(p);
3508
- g !== null ? r.formFragment = E.getFormFragment(
3509
- w.get(g)
3510
- ) : m.error(
3543
+ if (m) {
3544
+ const b = document.body.querySelector(m);
3545
+ b !== null ? r.formFragment = A.getFormFragment(
3546
+ w.get(b)
3547
+ ) : p.error(
3511
3548
  "Haori",
3512
- `Form element not found: ${p} (${h.attrName(null, "fetch-form", !0)})`
3549
+ `Form element not found: ${m} (${h.attrName(null, "fetch-form", !0)})`
3513
3550
  );
3514
3551
  } else
3515
- r.formFragment = E.getFormFragment(e);
3552
+ r.formFragment = A.getFormFragment(e);
3516
3553
  }
3517
3554
  return s && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [e]), r;
3518
3555
  }
@@ -3577,7 +3614,7 @@ ${g}
3577
3614
  return !1;
3578
3615
  this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
3579
3616
  this.options.resetBeforeFragments.map(
3580
- (d) => E.reset(d)
3617
+ (d) => A.reset(d)
3581
3618
  )
3582
3619
  ), this.captureHistorySnapshots());
3583
3620
  const r = this.prepareFetchRequest(), i = r.payload;
@@ -3595,48 +3632,48 @@ ${g}
3595
3632
  }
3596
3633
  const a = Object.keys(i).length > 0;
3597
3634
  if (s) {
3598
- const d = { ...n || {} }, f = r.requestedMethod, b = r.effectiveMethod, v = r.transportMode === "query-get", p = r.queryString;
3599
- if (v && m.info("Haori demo fetch normalization", {
3600
- runtime: l.runtime,
3635
+ const d = { ...n || {} }, f = r.requestedMethod, g = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
3636
+ if (y && p.info("Haori demo fetch normalization", {
3637
+ runtime: u.runtime,
3601
3638
  requestedMethod: f,
3602
- effectiveMethod: b,
3639
+ effectiveMethod: g,
3603
3640
  transportMode: "query-get",
3604
3641
  url: s,
3605
3642
  payload: a ? i : void 0,
3606
- queryString: p
3643
+ queryString: T
3607
3644
  }), this.options.targetFragment && s) {
3608
- const g = performance.now(), D = {
3609
- runtime: l.runtime,
3645
+ const m = performance.now(), b = {
3646
+ runtime: u.runtime,
3610
3647
  requestedMethod: f,
3611
- effectiveMethod: b,
3612
- transportMode: v ? "query-get" : "http",
3613
- ...v ? { queryString: p } : {}
3648
+ effectiveMethod: g,
3649
+ transportMode: y ? "query-get" : "http",
3650
+ ...y ? { queryString: T } : {}
3614
3651
  };
3615
3652
  return R.fetchStart(
3616
3653
  this.options.targetFragment.getTarget(),
3617
3654
  s,
3618
3655
  d,
3619
3656
  a ? i : void 0,
3620
- D
3621
- ), fetch(s, d).then((A) => this.handleFetchResult(
3622
- A,
3657
+ b
3658
+ ), fetch(s, d).then((E) => this.handleFetchResult(
3659
+ E,
3623
3660
  s || void 0,
3624
- g
3625
- )).catch((A) => {
3661
+ m
3662
+ )).catch((E) => {
3626
3663
  throw s && R.fetchError(
3627
3664
  this.options.targetFragment.getTarget(),
3628
3665
  s,
3629
- A
3630
- ), A;
3666
+ E
3667
+ ), E;
3631
3668
  });
3632
3669
  }
3633
- return fetch(s, d).then((g) => this.handleFetchResult(g, s || void 0));
3670
+ return fetch(s, d).then((m) => this.handleFetchResult(m, s || void 0));
3634
3671
  }
3635
3672
  if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
3636
- const d = this.options.formFragment, f = d.getTarget(), b = /* @__PURE__ */ new Set();
3637
- e && e.appliedDisabledAttribute && this.options.targetFragment && b.add(this.options.targetFragment), f.setAttribute(`${l.prefix}bind`, JSON.stringify(i));
3638
- const v = d.getBindingData();
3639
- Object.assign(v, i), await x.setBindingData(f, v, b);
3673
+ const d = this.options.formFragment, f = d.getTarget(), g = /* @__PURE__ */ new Set();
3674
+ e && e.appliedDisabledAttribute && this.options.targetFragment && g.add(this.options.targetFragment), f.setAttribute(`${u.prefix}bind`, JSON.stringify(i));
3675
+ const y = d.getBindingData();
3676
+ Object.assign(y, i), await P.setBindingData(f, y, g);
3640
3677
  }
3641
3678
  const o = a ? i : {}, c = new Response(JSON.stringify(o), {
3642
3679
  headers: { "Content-Type": "application/json" }
@@ -3697,22 +3734,25 @@ ${g}
3697
3734
  }
3698
3735
  const s = [];
3699
3736
  s.push(this.bindResult(e)), s.push(this.adjust()), s.push(this.addRow()), s.push(this.removeRow()), s.push(this.movePrevRow()), s.push(this.moveNextRow()), await Promise.all(s), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
3700
- this.options.resetFragments.map((a) => E.reset(a))
3737
+ this.options.resetFragments.map((a) => A.reset(a))
3701
3738
  ), await this.copy();
3702
3739
  const n = [];
3703
- return this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
3740
+ if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
3704
3741
  n.push(new h(a, null).run());
3705
- }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((a) => {
3706
- const o = a.getTarget();
3707
- typeof o.click == "function" ? o.click() : o.dispatchEvent(
3708
- new MouseEvent("click", { bubbles: !0, cancelable: !0 })
3709
- );
3710
- }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
3742
+ }), this.options.clickFragments && this.options.clickFragments.length > 0)
3743
+ for (const a of this.options.clickFragments) {
3744
+ await P.evaluateAll(a);
3745
+ const o = a.getTarget();
3746
+ typeof o.click == "function" ? o.click() : o.dispatchEvent(
3747
+ new MouseEvent("click", { bubbles: !0, cancelable: !0 })
3748
+ );
3749
+ }
3750
+ return this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
3711
3751
  const o = a.getTarget();
3712
- o instanceof HTMLElement ? n.push(i.openDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
3752
+ o instanceof HTMLElement ? n.push(i.openDialog(o)) : p.error("Haori", "Element is not an HTML element: ", o);
3713
3753
  }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
3714
3754
  const o = a.getTarget();
3715
- o instanceof HTMLElement ? n.push(i.closeDialog(o)) : m.error("Haori", "Element is not an HTML element: ", o);
3755
+ o instanceof HTMLElement ? n.push(i.closeDialog(o)) : p.error("Haori", "Element is not an HTML element: ", o);
3716
3756
  }), await Promise.all(n), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
3717
3757
  this.options.toastMessage,
3718
3758
  this.options.toastLevel ?? "info"
@@ -3732,12 +3772,12 @@ ${g}
3732
3772
  const n = e ? this.options.historyUrl : window.location.pathname, a = new URL(n, window.location.href);
3733
3773
  if (a.origin !== window.location.origin) {
3734
3774
  const c = "history.pushState: cross-origin URL is not allowed: " + a.toString();
3735
- m.error("Haori", c);
3775
+ p.error("Haori", c);
3736
3776
  return;
3737
3777
  }
3738
3778
  const o = (c) => {
3739
3779
  for (const [d, f] of Object.entries(c))
3740
- f != null && (Array.isArray(f) ? f.forEach((b) => a.searchParams.append(d, String(b))) : typeof f == "object" ? a.searchParams.set(d, JSON.stringify(f)) : a.searchParams.set(d, String(f)));
3780
+ f != null && (Array.isArray(f) ? f.forEach((g) => a.searchParams.append(d, String(g))) : typeof f == "object" ? a.searchParams.set(d, JSON.stringify(f)) : a.searchParams.set(d, String(f)));
3741
3781
  };
3742
3782
  i && o(t), s && o(r), history.pushState(
3743
3783
  { [ge]: !0 },
@@ -3745,7 +3785,7 @@ ${g}
3745
3785
  a.toString()
3746
3786
  );
3747
3787
  } catch (n) {
3748
- m.error("Haori", `history.pushState failed: ${n}`);
3788
+ p.error("Haori", `history.pushState failed: ${n}`);
3749
3789
  }
3750
3790
  }
3751
3791
  /**
@@ -3753,7 +3793,7 @@ ${g}
3753
3793
  */
3754
3794
  async handleFetchError(e) {
3755
3795
  let t = null;
3756
- this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t = E.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3796
+ this.options.formFragment ? t = this.options.formFragment : this.options.targetFragment && (t = A.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3757
3797
  const r = async (n) => {
3758
3798
  const a = t ? t.getTarget() : document.body;
3759
3799
  await ie().addErrorMessage(a, n);
@@ -3782,7 +3822,7 @@ ${g}
3782
3822
  if (a.length === 0)
3783
3823
  return await r(`${e.status} ${e.statusText}`), i(), !1;
3784
3824
  for (const o of a)
3785
- o.key && t ? await E.addErrorMessage(t, o.key, o.message) : await r(o.message);
3825
+ o.key && t ? await A.addErrorMessage(t, o.key, o.message) : await r(o.message);
3786
3826
  return i(), !1;
3787
3827
  } catch {
3788
3828
  }
@@ -3869,24 +3909,26 @@ ${g}
3869
3909
  );
3870
3910
  } else
3871
3911
  n[a] = r;
3872
- i.push(x.setBindingData(s.getTarget(), n));
3912
+ i.push(P.setBindingData(s.getTarget(), n));
3873
3913
  });
3874
3914
  else {
3875
3915
  if (typeof r == "string")
3876
- return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3916
+ return p.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3877
3917
  new Error("string data cannot be bound without a bindArg.")
3878
3918
  );
3879
3919
  this.options.bindFragments.forEach((s) => {
3880
3920
  const n = this.mergeAppendBindingData(
3881
3921
  s,
3882
3922
  r
3883
- );
3884
- i.push(
3885
- x.setBindingData(s.getTarget(), n)
3886
- );
3923
+ ), a = this.options.bindMerge ? { ...s.getRawBindingData() ?? {}, ...n } : n;
3924
+ i.push(P.setBindingData(s.getTarget(), a));
3887
3925
  });
3888
3926
  }
3889
3927
  return Promise.all(i).then(() => {
3928
+ const s = this.options.bindArg ?? null;
3929
+ this.options.bindFragments.forEach((n) => {
3930
+ R.bindComplete(n.getTarget(), s);
3931
+ });
3890
3932
  });
3891
3933
  });
3892
3934
  }
@@ -3914,7 +3956,7 @@ ${g}
3914
3956
  ...i.getBindingData(),
3915
3957
  ...t
3916
3958
  };
3917
- return x.setBindingData(i.getTarget(), s);
3959
+ return P.setBindingData(i.getTarget(), s);
3918
3960
  });
3919
3961
  return Promise.all(r).then(() => {
3920
3962
  });
@@ -3923,7 +3965,7 @@ ${g}
3923
3965
  * copy のコピー元データを取得します。
3924
3966
  */
3925
3967
  resolveCopySourceData() {
3926
- return this.options.formFragment ? E.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
3968
+ return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? A.getValues(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? A.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
3927
3969
  }
3928
3970
  /**
3929
3971
  * data 属性とフォーム値を統合した送信データを作成します。
@@ -3941,7 +3983,7 @@ ${g}
3941
3983
  buildPayloadResolution() {
3942
3984
  const e = {};
3943
3985
  let t = !1;
3944
- if (this.options.formFragment && Object.assign(e, E.getValues(this.options.formFragment)), this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
3986
+ if (this.options.formFragment && Object.assign(e, A.getValues(this.options.formFragment)), this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
3945
3987
  const r = h.resolveDataAttributeDetailed(
3946
3988
  this.options.targetFragment,
3947
3989
  this.options.dataAttrName
@@ -3983,22 +4025,22 @@ ${g}
3983
4025
  let i = this.options.fetchUrl;
3984
4026
  const s = { ...this.options.fetchOptions || {} }, n = new Headers(
3985
4027
  s.headers || void 0
3986
- ), a = (s.method || "GET").toUpperCase(), o = l.runtime === "demo" && !be(a), c = o ? "GET" : a;
4028
+ ), a = (s.method || "GET").toUpperCase(), o = u.runtime === "demo" && !be(a), c = o ? "GET" : a;
3987
4029
  if (s.method = c, c === "GET" || c === "HEAD" || c === "OPTIONS")
3988
4030
  Object.keys(t).length > 0 && (i = ye(i, t));
3989
4031
  else if (Object.keys(t).length > 0) {
3990
4032
  const f = n.get("Content-Type") || "";
3991
4033
  if (/multipart\/form-data/i.test(f)) {
3992
4034
  n.delete("Content-Type");
3993
- const b = new FormData();
3994
- for (const [v, p] of Object.entries(t))
3995
- p == null ? b.append(v, "") : p instanceof Blob ? b.append(v, p) : Array.isArray(p) ? p.forEach((g) => b.append(v, String(g))) : typeof p == "object" ? b.append(v, JSON.stringify(p)) : b.append(v, String(p));
3996
- s.body = b;
4035
+ const g = new FormData();
4036
+ for (const [y, T] of Object.entries(t))
4037
+ T == null ? g.append(y, "") : T instanceof Blob ? g.append(y, T) : Array.isArray(T) ? T.forEach((m) => g.append(y, String(m))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T));
4038
+ s.body = g;
3997
4039
  } else if (/application\/x-www-form-urlencoded/i.test(f)) {
3998
- const b = new URLSearchParams();
3999
- for (const [v, p] of Object.entries(t))
4000
- p !== void 0 && (p === null ? b.append(v, "") : Array.isArray(p) ? p.forEach((g) => b.append(v, String(g))) : typeof p == "object" ? b.append(v, JSON.stringify(p)) : b.append(v, String(p)));
4001
- s.body = b;
4040
+ const g = new URLSearchParams();
4041
+ for (const [y, T] of Object.entries(t))
4042
+ T !== void 0 && (T === null ? g.append(y, "") : Array.isArray(T) ? T.forEach((m) => g.append(y, String(m))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T)));
4043
+ s.body = g;
4002
4044
  } else
4003
4045
  n.set("Content-Type", "application/json"), s.body = JSON.stringify(t);
4004
4046
  }
@@ -4023,7 +4065,7 @@ ${g}
4023
4065
  this.options.targetFragment && this.options.historyDataAttrName ? this.historyDataSnapshot = h.resolveDataAttribute(
4024
4066
  this.options.targetFragment,
4025
4067
  this.options.historyDataAttrName
4026
- ) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? E.getValues(this.options.historyFormFragment) : void 0;
4068
+ ) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? A.getValues(this.options.historyFormFragment) : void 0;
4027
4069
  }
4028
4070
  /**
4029
4071
  * history-data の評価値を取得します。
@@ -4045,7 +4087,7 @@ ${g}
4045
4087
  if (this.historyFormSnapshot !== void 0)
4046
4088
  return this.historyFormSnapshot;
4047
4089
  if (this.options.historyFormFragment)
4048
- return E.getValues(this.options.historyFormFragment);
4090
+ return A.getValues(this.options.historyFormFragment);
4049
4091
  }
4050
4092
  /**
4051
4093
  * copy-params が指定されている場合は include / exclude を考慮して抽出します。
@@ -4093,11 +4135,11 @@ ${g}
4093
4135
  */
4094
4136
  getRowFragment() {
4095
4137
  if (!this.options.targetFragment)
4096
- return m.error("Haori", "Target fragment is not specified for row operation."), null;
4138
+ return p.error("Haori", "Target fragment is not specified for row operation."), null;
4097
4139
  const e = this.options.targetFragment.closestByAttribute(
4098
- `${l.prefix}row`
4140
+ `${u.prefix}row`
4099
4141
  );
4100
- return e || (m.error("Haori", "Row fragment not found."), null);
4142
+ return e || (p.error("Haori", "Row fragment not found."), null);
4101
4143
  }
4102
4144
  /**
4103
4145
  * 行を追加します。
@@ -4113,7 +4155,7 @@ ${g}
4113
4155
  const t = [], r = e.clone();
4114
4156
  return t.push(
4115
4157
  e.getParent().insertAfter(r, e)
4116
- ), t.push(x.evaluateAll(r)), t.push(E.reset(r)), Promise.all(t).then(() => {
4158
+ ), t.push(P.evaluateAll(r)), t.push(A.reset(r)), Promise.all(t).then(() => {
4117
4159
  });
4118
4160
  }
4119
4161
  /**
@@ -4128,7 +4170,7 @@ ${g}
4128
4170
  if (!e)
4129
4171
  return Promise.reject(new Error("Row fragment not found."));
4130
4172
  const t = e.getParent();
4131
- return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${l.prefix}each-before`) && !i.hasAttribute(`${l.prefix}each-after`)).length <= 1 ? Promise.resolve() : e.remove();
4173
+ return t && t.getChildElementFragments().filter((i) => !i.hasAttribute(`${u.prefix}each-before`) && !i.hasAttribute(`${u.prefix}each-after`)).length <= 1 ? Promise.resolve() : e.remove();
4132
4174
  }
4133
4175
  /**
4134
4176
  * 前の行へ移動します。
@@ -4166,7 +4208,7 @@ ${g}
4166
4208
  }
4167
4209
  };
4168
4210
  h.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, h.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/, h.RUNNING_CLICK_TARGETS = /* @__PURE__ */ new WeakSet();
4169
- let z = h;
4211
+ let q = h;
4170
4212
  class Se {
4171
4213
  /**
4172
4214
  * URLのクエリパラメータを取得します。
@@ -4180,7 +4222,7 @@ class Se {
4180
4222
  }), e;
4181
4223
  }
4182
4224
  }
4183
- class De {
4225
+ class Te {
4184
4226
  /**
4185
4227
  * 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
4186
4228
  *
@@ -4198,27 +4240,27 @@ class De {
4198
4240
  try {
4199
4241
  r = await fetch(e, t);
4200
4242
  } catch (s) {
4201
- throw m.error("[Haori]", "Failed to fetch import source:", e, s), new Error(`Failed to fetch: ${e}`);
4243
+ throw p.error("[Haori]", "Failed to fetch import source:", e, s), new Error(`Failed to fetch: ${e}`);
4202
4244
  }
4203
4245
  if (!r.ok) {
4204
4246
  const s = `${r.status} ${r.statusText}`;
4205
- throw m.error("[Haori]", "Import HTTP error:", e, s), new Error(`Failed to load ${e}: ${s}`);
4247
+ throw p.error("[Haori]", "Import HTTP error:", e, s), new Error(`Failed to load ${e}: ${s}`);
4206
4248
  }
4207
4249
  let i;
4208
4250
  try {
4209
4251
  i = await r.text();
4210
4252
  } catch (s) {
4211
- throw m.error("[Haori]", "Failed to read response text:", e, s), new Error(`Failed to read response from: ${e}`);
4253
+ throw p.error("[Haori]", "Failed to read response text:", e, s), new Error(`Failed to read response from: ${e}`);
4212
4254
  }
4213
4255
  try {
4214
4256
  const n = new DOMParser().parseFromString(i, "text/html");
4215
- return n && n.body ? n.body.innerHTML : (m.warn("[Haori]", "No body found in imported document:", e), i);
4257
+ return n && n.body ? n.body.innerHTML : (p.warn("[Haori]", "No body found in imported document:", e), i);
4216
4258
  } catch (s) {
4217
- return m.error("[Haori]", "Failed to parse imported HTML:", e, s), i;
4259
+ return p.error("[Haori]", "Failed to parse imported HTML:", e, s), i;
4218
4260
  }
4219
4261
  }
4220
4262
  }
4221
- const u = class u {
4263
+ const l = class l {
4222
4264
  /**
4223
4265
  * 遅延属性かどうか(完全名で判定)を判定します。
4224
4266
  *
@@ -4226,8 +4268,8 @@ const u = class u {
4226
4268
  * @returns 遅延属性かどうか
4227
4269
  */
4228
4270
  static isDeferredAttributeName(e) {
4229
- return u.DEFERRED_ATTRIBUTE_SUFFIXES.some(
4230
- (t) => e === `${l.prefix}${t}`
4271
+ return l.DEFERRED_ATTRIBUTE_SUFFIXES.some(
4272
+ (t) => e === `${u.prefix}${t}`
4231
4273
  );
4232
4274
  }
4233
4275
  /**
@@ -4237,8 +4279,8 @@ const u = class u {
4237
4279
  * @returns 除外対象かどうか
4238
4280
  */
4239
4281
  static isEvaluateAllExcludedAttributeName(e) {
4240
- return u.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
4241
- (t) => e === `${l.prefix}${t}`
4282
+ return l.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
4283
+ (t) => e === `${u.prefix}${t}`
4242
4284
  );
4243
4285
  }
4244
4286
  /**
@@ -4249,7 +4291,7 @@ const u = class u {
4249
4291
  * @returns 再評価する場合は true
4250
4292
  */
4251
4293
  static shouldReevaluateAttribute(e, t) {
4252
- return t !== null && !u.isEvaluateAllExcludedAttributeName(e) && u.ATTRIBUTE_PLACEHOLDER_REGEX.test(t);
4294
+ return t !== null && !l.isEvaluateAllExcludedAttributeName(e) && l.ATTRIBUTE_PLACEHOLDER_REGEX.test(t);
4253
4295
  }
4254
4296
  /**
4255
4297
  * data-attr-* 形式の属性名から実際に更新する属性名を取得します。
@@ -4258,7 +4300,7 @@ const u = class u {
4258
4300
  * @returns 実際の属性名。data-attr-* でない場合は null
4259
4301
  */
4260
4302
  static getAliasedAttributeName(e) {
4261
- const t = `${l.prefix}${u.ATTRIBUTE_ALIAS_SUFFIX}`;
4303
+ const t = `${u.prefix}${l.ATTRIBUTE_ALIAS_SUFFIX}`;
4262
4304
  return !e.startsWith(t) || e.length <= t.length ? null : e.slice(t.length);
4263
4305
  }
4264
4306
  /**
@@ -4270,8 +4312,8 @@ const u = class u {
4270
4312
  */
4271
4313
  static isAliasedAttributeReflection(e, t) {
4272
4314
  const r = w.get(e);
4273
- return r instanceof M ? r.hasAttribute(
4274
- `${l.prefix}${u.ATTRIBUTE_ALIAS_SUFFIX}${t}`
4315
+ return r instanceof C ? r.hasAttribute(
4316
+ `${u.prefix}${l.ATTRIBUTE_ALIAS_SUFFIX}${t}`
4275
4317
  ) : !1;
4276
4318
  }
4277
4319
  /**
@@ -4285,8 +4327,8 @@ const u = class u {
4285
4327
  let t = Promise.resolve();
4286
4328
  for (const r of e.getAttributeNames()) {
4287
4329
  const i = e.getRawAttribute(r);
4288
- u.shouldReevaluateAttribute(r, i) && (t = t.then(
4289
- () => u.setAttribute(e.getTarget(), r, i)
4330
+ l.shouldReevaluateAttribute(r, i) && (t = t.then(
4331
+ () => l.setAttribute(e.getTarget(), r, i)
4290
4332
  ));
4291
4333
  }
4292
4334
  return t.then(() => {
@@ -4301,7 +4343,7 @@ const u = class u {
4301
4343
  static reevaluateChildren(e) {
4302
4344
  const t = [];
4303
4345
  return e.getChildren().forEach((r) => {
4304
- r instanceof M ? t.push(u.evaluateAll(r)) : r instanceof L && t.push(u.evaluateText(r));
4346
+ r instanceof C ? t.push(l.evaluateAll(r)) : r instanceof H && t.push(l.evaluateText(r));
4305
4347
  }), Promise.all(t).then(() => {
4306
4348
  });
4307
4349
  }
@@ -4312,7 +4354,7 @@ const u = class u {
4312
4354
  * @returns 再評価状態
4313
4355
  */
4314
4356
  static getReactiveFetchState(e) {
4315
- const t = u.REACTIVE_FETCH_STATES.get(e);
4357
+ const t = l.REACTIVE_FETCH_STATES.get(e);
4316
4358
  if (t)
4317
4359
  return t;
4318
4360
  const r = {
@@ -4320,7 +4362,7 @@ const u = class u {
4320
4362
  running: !1,
4321
4363
  rerunRequested: !1
4322
4364
  };
4323
- return u.REACTIVE_FETCH_STATES.set(e, r), r;
4365
+ return l.REACTIVE_FETCH_STATES.set(e, r), r;
4324
4366
  }
4325
4367
  /**
4326
4368
  * data-import の再評価状態を取得します。
@@ -4329,7 +4371,7 @@ const u = class u {
4329
4371
  * @returns 再評価状態
4330
4372
  */
4331
4373
  static getReactiveImportState(e) {
4332
- const t = u.REACTIVE_IMPORT_STATES.get(e);
4374
+ const t = l.REACTIVE_IMPORT_STATES.get(e);
4333
4375
  if (t)
4334
4376
  return t;
4335
4377
  const r = {
@@ -4337,7 +4379,7 @@ const u = class u {
4337
4379
  running: !1,
4338
4380
  rerunRequested: !1
4339
4381
  };
4340
- return u.REACTIVE_IMPORT_STATES.set(e, r), r;
4382
+ return l.REACTIVE_IMPORT_STATES.set(e, r), r;
4341
4383
  }
4342
4384
  /**
4343
4385
  * bind 更新時に data-fetch / data-import を専用ルートで再評価します。
@@ -4350,9 +4392,9 @@ const u = class u {
4350
4392
  if (t.has(e))
4351
4393
  return Promise.resolve();
4352
4394
  const r = [];
4353
- return e.hasAttribute(`${l.prefix}fetch`) && r.push(u.executeManagedFetch(e)), e.hasAttribute(`${l.prefix}import`) && r.push(u.executeManagedImport(e)), e.getChildren().forEach((i) => {
4354
- i instanceof M && r.push(
4355
- u.reevaluateReactiveSpecialAttributes(i, t)
4395
+ return e.hasAttribute(`${u.prefix}fetch`) && r.push(l.executeManagedFetch(e)), e.hasAttribute(`${u.prefix}import`) && r.push(l.executeManagedImport(e)), e.getChildren().forEach((i) => {
4396
+ i instanceof C && r.push(
4397
+ l.reevaluateReactiveSpecialAttributes(i, t)
4356
4398
  );
4357
4399
  }), Promise.all(r).then(() => {
4358
4400
  });
@@ -4364,11 +4406,11 @@ const u = class u {
4364
4406
  * @returns 実行完了の Promise
4365
4407
  */
4366
4408
  static executeManagedFetch(e) {
4367
- const t = e.getTarget(), r = u.getReactiveFetchState(t), i = z.resolveAutoFetchSignature(e);
4368
- return r.running ? ((i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve()) : i.hasUnresolvedReference || i.signature === null ? (r.lastSignature = null, Promise.resolve()) : r.lastSignature === i.signature ? Promise.resolve() : (r.lastSignature = i.signature, r.running = !0, new z(e, null).runWithResult().then(() => {
4409
+ const t = e.getTarget(), r = l.getReactiveFetchState(t), i = q.resolveAutoFetchSignature(e);
4410
+ return r.running ? ((i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve()) : i.hasUnresolvedReference || i.signature === null ? (r.lastSignature = null, Promise.resolve()) : r.lastSignature === i.signature ? Promise.resolve() : (r.lastSignature = i.signature, r.running = !0, new q(e, null).runWithResult().then(() => {
4369
4411
  }).finally(() => {
4370
4412
  if (r.running = !1, r.rerunRequested)
4371
- return r.rerunRequested = !1, u.executeManagedFetch(e);
4413
+ return r.rerunRequested = !1, l.executeManagedFetch(e);
4372
4414
  }));
4373
4415
  }
4374
4416
  /**
@@ -4378,8 +4420,8 @@ const u = class u {
4378
4420
  * @returns 実行完了の Promise
4379
4421
  */
4380
4422
  static executeManagedImport(e) {
4381
- const t = e.getTarget(), r = u.getReactiveImportState(t), i = e.getAttributeEvaluation(
4382
- `${l.prefix}import`
4423
+ const t = e.getTarget(), r = l.getReactiveImportState(t), i = e.getAttributeEvaluation(
4424
+ `${u.prefix}import`
4383
4425
  ), s = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
4384
4426
  if (r.running)
4385
4427
  return s !== r.lastUrl && (r.rerunRequested = !0), Promise.resolve();
@@ -4389,25 +4431,25 @@ const u = class u {
4389
4431
  return Promise.resolve();
4390
4432
  r.lastUrl = s, r.running = !0;
4391
4433
  const n = performance.now();
4392
- return t.setAttribute(`${l.prefix}importing`, ""), R.importStart(t, s), De.load(s).then((a) => {
4434
+ return t.setAttribute(`${u.prefix}importing`, ""), R.importStart(t, s), Te.load(s).then((a) => {
4393
4435
  const o = new TextEncoder().encode(a).length;
4394
- return N.enqueue(() => {
4436
+ return M.enqueue(() => {
4395
4437
  t.innerHTML = a;
4396
4438
  }).then(() => {
4397
- if (t.removeAttribute(`${l.prefix}importing`), R.importEnd(t, s, o, n), !document.body.hasAttribute("data-haori-ready")) {
4439
+ if (t.removeAttribute(`${u.prefix}importing`), R.importEnd(t, s, o, n), !document.body.hasAttribute("data-haori-ready")) {
4398
4440
  const c = [];
4399
4441
  return t.childNodes.forEach((d) => {
4400
4442
  const f = w.get(d);
4401
- f instanceof M ? c.push(u.scan(f.getTarget())) : f instanceof L && c.push(u.evaluateText(f));
4443
+ f instanceof C ? c.push(l.scan(f.getTarget())) : f instanceof H && c.push(l.evaluateText(f));
4402
4444
  }), Promise.all(c).then(() => {
4403
4445
  });
4404
4446
  }
4405
4447
  });
4406
4448
  }).catch((a) => {
4407
- t.removeAttribute(`${l.prefix}importing`), R.importError(t, s, a), m.error("[Haori]", "Failed to import HTML:", s, a);
4449
+ t.removeAttribute(`${u.prefix}importing`), R.importError(t, s, a), p.error("[Haori]", "Failed to import HTML:", s, a);
4408
4450
  }).finally(() => {
4409
4451
  if (r.running = !1, r.rerunRequested)
4410
- return r.rerunRequested = !1, u.executeManagedImport(e);
4452
+ return r.rerunRequested = !1, l.executeManagedImport(e);
4411
4453
  });
4412
4454
  }
4413
4455
  /**
@@ -4418,7 +4460,7 @@ const u = class u {
4418
4460
  */
4419
4461
  static scan(e) {
4420
4462
  const t = w.get(e);
4421
- return t ? u.initializeElementFragment(t, !1) : Promise.resolve();
4463
+ return t ? l.initializeElementFragment(t, !1) : Promise.resolve();
4422
4464
  }
4423
4465
  /**
4424
4466
  * 新規 each 行を局所初期化します。
@@ -4428,8 +4470,8 @@ const u = class u {
4428
4470
  * @returns 初期化完了の Promise
4429
4471
  */
4430
4472
  static initializeFreshEachRow(e) {
4431
- return u.initializeElementFragment(e, !0).then(() => {
4432
- u.needsScheduledEvaluateAll(e) && u.scheduleEvaluateAll(e);
4473
+ return l.initializeElementFragment(e, !0).then(() => {
4474
+ l.needsScheduledEvaluateAll(e) && l.scheduleEvaluateAll(e);
4433
4475
  });
4434
4476
  }
4435
4477
  /**
@@ -4440,16 +4482,16 @@ const u = class u {
4440
4482
  * @returns 初期化完了の Promise
4441
4483
  */
4442
4484
  static initializeElementFragment(e, t) {
4443
- return u.syncMountedState(e), t && e.isFreshInitializationSkippable() ? Promise.resolve() : u.initializeElementAttributes(e).then(() => {
4444
- if (u.shouldSkipChildInitialization(e, t)) {
4445
- u.refreshDerivedSubtreeSignature(e);
4485
+ return l.syncMountedState(e), t && e.isFreshInitializationSkippable() ? Promise.resolve() : l.initializeElementAttributes(e).then(() => {
4486
+ if (l.shouldSkipChildInitialization(e, t)) {
4487
+ l.refreshDerivedSubtreeSignature(e);
4446
4488
  return;
4447
4489
  }
4448
4490
  const r = [];
4449
4491
  return e.getChildren().forEach((i) => {
4450
- i instanceof M ? r.push(u.initializeElementFragment(i, t)) : i instanceof L && r.push(u.evaluateText(i));
4492
+ i instanceof C ? r.push(l.initializeElementFragment(i, t)) : i instanceof H && r.push(l.evaluateText(i));
4451
4493
  }), Promise.all(r).then(() => {
4452
- u.refreshDerivedSubtreeSignature(e);
4494
+ l.refreshDerivedSubtreeSignature(e);
4453
4495
  });
4454
4496
  });
4455
4497
  }
@@ -4479,10 +4521,10 @@ const u = class u {
4479
4521
  static initializeElementAttributes(e) {
4480
4522
  let t = Promise.resolve();
4481
4523
  const r = /* @__PURE__ */ new Set();
4482
- for (const i of u.PRIORITY_ATTRIBUTE_SUFFIXES) {
4483
- const s = l.prefix + i;
4524
+ for (const i of l.PRIORITY_ATTRIBUTE_SUFFIXES) {
4525
+ const s = u.prefix + i;
4484
4526
  e.hasAttribute(s) && (t = t.then(
4485
- () => u.setAttribute(
4527
+ () => l.setAttribute(
4486
4528
  e.getTarget(),
4487
4529
  s,
4488
4530
  e.getRawAttribute(s)
@@ -4490,17 +4532,17 @@ const u = class u {
4490
4532
  ), r.add(s));
4491
4533
  }
4492
4534
  for (const i of e.getAttributeNames()) {
4493
- if (r.has(i) || u.isDeferredAttributeName(i))
4535
+ if (r.has(i) || l.isDeferredAttributeName(i))
4494
4536
  continue;
4495
4537
  const s = e.getRawAttribute(i);
4496
4538
  s !== null && (t = t.then(
4497
- () => u.setAttribute(e.getTarget(), i, s)
4539
+ () => l.setAttribute(e.getTarget(), i, s)
4498
4540
  ));
4499
4541
  }
4500
- for (const i of u.DEFERRED_ATTRIBUTE_SUFFIXES) {
4501
- const s = l.prefix + i;
4542
+ for (const i of l.DEFERRED_ATTRIBUTE_SUFFIXES) {
4543
+ const s = u.prefix + i;
4502
4544
  e.hasAttribute(s) && (t = t.then(
4503
- () => u.setAttribute(
4545
+ () => l.setAttribute(
4504
4546
  e.getTarget(),
4505
4547
  s,
4506
4548
  e.getRawAttribute(s)
@@ -4518,8 +4560,8 @@ const u = class u {
4518
4560
  * @returns 子孫初期化をスキップするなら true
4519
4561
  */
4520
4562
  static shouldSkipChildInitialization(e, t) {
4521
- const r = e.getAttribute(`${l.prefix}if`);
4522
- return e.hasAttribute(`${l.prefix}if`) && (r === !1 || r === void 0 || r === null || Number.isNaN(r)) ? !0 : t && e.hasAttribute(`${l.prefix}each`);
4563
+ const r = e.getAttribute(`${u.prefix}if`);
4564
+ return e.hasAttribute(`${u.prefix}if`) && l.isHiddenIfCondition(r) ? !0 : t && e.hasAttribute(`${u.prefix}each`);
4523
4565
  }
4524
4566
  /**
4525
4567
  * エレメントに属性を設定します。
@@ -4531,7 +4573,7 @@ const u = class u {
4531
4573
  * @returns Promise (DOM操作が完了したときに解決される)
4532
4574
  */
4533
4575
  static setAttribute(e, t, r, i = !1) {
4534
- const s = w.get(e), n = u.getAliasedAttributeName(t);
4576
+ const s = w.get(e), n = l.getAliasedAttributeName(t);
4535
4577
  if (n !== null)
4536
4578
  return r === null ? s.removeAliasedAttribute(t, n) : s.setAliasedAttribute(
4537
4579
  t,
@@ -4542,53 +4584,53 @@ const u = class u {
4542
4584
  const a = [];
4543
4585
  let o = null, c = null;
4544
4586
  switch (t) {
4545
- case `${l.prefix}bind`: {
4546
- r === null ? (s.clearBindingDataCache(), s.setBindingData({})) : s.setBindingData(u.parseDataBind(r));
4587
+ case `${u.prefix}bind`: {
4588
+ r === null ? (s.clearBindingDataCache(), s.setBindingData({})) : s.setBindingData(l.parseDataBind(r));
4547
4589
  break;
4548
4590
  }
4549
- case `${l.prefix}derive`:
4550
- c = u.createDeriveInputSignature(
4591
+ case `${u.prefix}derive`:
4592
+ c = l.createDeriveInputSignature(
4551
4593
  s,
4552
4594
  r,
4553
- s.getRawAttribute(`${l.prefix}derive-name`)
4554
- ), o = u.evaluateDerive(
4595
+ s.getRawAttribute(`${u.prefix}derive-name`)
4596
+ ), o = l.evaluateDerive(
4555
4597
  s,
4556
4598
  r,
4557
- s.getRawAttribute(`${l.prefix}derive-name`)
4599
+ s.getRawAttribute(`${u.prefix}derive-name`)
4558
4600
  ), a.push(o.then(() => {
4559
4601
  }));
4560
4602
  break;
4561
- case `${l.prefix}derive-name`:
4562
- c = u.createDeriveInputSignature(
4603
+ case `${u.prefix}derive-name`:
4604
+ c = l.createDeriveInputSignature(
4563
4605
  s,
4564
- s.getRawAttribute(`${l.prefix}derive`),
4606
+ s.getRawAttribute(`${u.prefix}derive`),
4565
4607
  r
4566
- ), o = u.evaluateDerive(
4608
+ ), o = l.evaluateDerive(
4567
4609
  s,
4568
- s.getRawAttribute(`${l.prefix}derive`),
4610
+ s.getRawAttribute(`${u.prefix}derive`),
4569
4611
  r
4570
4612
  ), a.push(o.then(() => {
4571
4613
  }));
4572
4614
  break;
4573
- case `${l.prefix}if`:
4574
- a.push(u.evaluateIf(s));
4615
+ case `${u.prefix}if`:
4616
+ a.push(l.evaluateIf(s));
4575
4617
  break;
4576
- case `${l.prefix}each`:
4577
- a.push(u.evaluateEach(s));
4618
+ case `${u.prefix}each`:
4619
+ a.push(l.evaluateEach(s));
4578
4620
  break;
4579
- case `${l.prefix}fetch`:
4580
- a.push(u.executeManagedFetch(s));
4621
+ case `${u.prefix}fetch`:
4622
+ a.push(l.executeManagedFetch(s));
4581
4623
  break;
4582
- case `${l.prefix}import`:
4583
- typeof r == "string" && a.push(u.executeManagedImport(s));
4624
+ case `${u.prefix}import`:
4625
+ typeof r == "string" && a.push(l.executeManagedImport(s));
4584
4626
  break;
4585
- case `${l.prefix}url-param`: {
4586
- const d = s.getAttribute(`${l.prefix}url-arg`), f = Se.readParams();
4627
+ case `${u.prefix}url-param`: {
4628
+ const d = s.getAttribute(`${u.prefix}url-arg`), f = Se.readParams();
4587
4629
  if (d === null)
4588
- a.push(u.setBindingData(e, f));
4630
+ a.push(l.setBindingData(e, f));
4589
4631
  else {
4590
- const b = s.getRawBindingData() || {};
4591
- b[String(d)] = f, a.push(u.setBindingData(e, b));
4632
+ const g = s.getRawBindingData() || {};
4633
+ g[String(d)] = f, a.push(l.setBindingData(e, g));
4592
4634
  }
4593
4635
  break;
4594
4636
  }
@@ -4597,7 +4639,7 @@ const u = class u {
4597
4639
  if (o !== null)
4598
4640
  return s.setDeriveInputSignature(c), o.then((d) => {
4599
4641
  if (d)
4600
- return u.reevaluateChildren(s);
4642
+ return l.reevaluateChildren(s);
4601
4643
  });
4602
4644
  }).then(() => {
4603
4645
  });
@@ -4614,15 +4656,15 @@ const u = class u {
4614
4656
  const i = w.get(e), s = i.getRawBindingData();
4615
4657
  i.setBindingData(t);
4616
4658
  let n = i.setAttribute(
4617
- `${l.prefix}bind`,
4659
+ `${u.prefix}bind`,
4618
4660
  JSON.stringify(t)
4619
4661
  );
4620
4662
  if (e.tagName === "FORM") {
4621
- const a = i.getAttribute(`${l.prefix}form-arg`), o = a && t[String(a)] && typeof t[String(a)] == "object" && !Array.isArray(t[String(a)]) ? t[String(a)] : a ? {} : t;
4622
- n = n.then(() => E.syncValues(i, o));
4663
+ const a = i.getAttribute(`${u.prefix}form-arg`), o = a && t[String(a)] && typeof t[String(a)] == "object" && !Array.isArray(t[String(a)]) ? t[String(a)] : a ? {} : t;
4664
+ n = n.then(() => A.syncValues(i, o));
4623
4665
  }
4624
- return n = n.then(() => u.evaluateAll(i, r)), n = n.then(
4625
- () => u.reevaluateReactiveSpecialAttributes(i, r)
4666
+ return n = n.then(() => l.evaluateAll(i, r)), n = n.then(
4667
+ () => l.reevaluateReactiveSpecialAttributes(i, r)
4626
4668
  ), R.bindChange(e, s, t, "manual"), n.then(() => {
4627
4669
  });
4628
4670
  }
@@ -4637,7 +4679,7 @@ const u = class u {
4637
4679
  try {
4638
4680
  return JSON.parse(e);
4639
4681
  } catch (t) {
4640
- return m.error("[Haori]", "Invalid JSON in data-bind:", t), {};
4682
+ return p.error("[Haori]", "Invalid JSON in data-bind:", t), {};
4641
4683
  }
4642
4684
  else {
4643
4685
  const t = new URLSearchParams(e), r = {};
@@ -4657,7 +4699,7 @@ const u = class u {
4657
4699
  if (r.isSkipMutationNodes())
4658
4700
  return;
4659
4701
  const i = w.get(t.nextSibling), s = w.get(t);
4660
- s && (r.insertBefore(s, i), s instanceof M ? u.scan(s.getTarget()) : s instanceof L && u.evaluateText(s));
4702
+ s && (r.insertBefore(s, i), s instanceof C ? l.scan(s.getTarget()) : s instanceof H && l.evaluateText(s));
4661
4703
  }
4662
4704
  /**
4663
4705
  * ノードを親要素から削除します。
@@ -4697,11 +4739,11 @@ const u = class u {
4697
4739
  return Promise.resolve();
4698
4740
  const i = [];
4699
4741
  i.push(r.setValue(t));
4700
- const s = u.getFormFragment(r);
4742
+ const s = l.getFormFragment(r);
4701
4743
  if (s) {
4702
- const n = E.getValues(s), a = s.getAttribute(`${l.prefix}form-arg`);
4744
+ const n = A.getValues(s), a = s.getAttribute(`${u.prefix}form-arg`);
4703
4745
  let o;
4704
- a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(u.setBindingData(s.getTarget(), o));
4746
+ a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(l.setBindingData(s.getTarget(), o));
4705
4747
  }
4706
4748
  return Promise.all(i).then(() => {
4707
4749
  });
@@ -4716,7 +4758,7 @@ const u = class u {
4716
4758
  if (e.getTarget() instanceof HTMLFormElement)
4717
4759
  return e;
4718
4760
  const t = e.getParent();
4719
- return t ? u.getFormFragment(t) : null;
4761
+ return t ? l.getFormFragment(t) : null;
4720
4762
  }
4721
4763
  /**
4722
4764
  * フラグメントとその子要素を評価します。
@@ -4727,52 +4769,52 @@ const u = class u {
4727
4769
  static evaluateAll(e, t = /* @__PURE__ */ new Set()) {
4728
4770
  if (t.has(e))
4729
4771
  return Promise.resolve();
4730
- let r = u.reevaluateInterpolatedAttributes(e);
4731
- const i = e.hasAttribute(`${l.prefix}derive`), s = e.hasAttribute(`${l.prefix}if`), n = e.hasAttribute(`${l.prefix}each`), a = e.getRawAttribute(`${l.prefix}derive`), o = e.getRawAttribute(`${l.prefix}derive-name`);
4772
+ let r = l.reevaluateInterpolatedAttributes(e);
4773
+ const i = e.hasAttribute(`${u.prefix}derive`), s = e.hasAttribute(`${u.prefix}if`), n = e.hasAttribute(`${u.prefix}each`), a = e.getRawAttribute(`${u.prefix}derive`), o = e.getRawAttribute(`${u.prefix}derive-name`);
4732
4774
  let c = !1, d = !1, f = null;
4733
4775
  if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
4734
- const b = u.createDeriveInputSignature(
4776
+ const g = l.createDeriveInputSignature(
4735
4777
  e,
4736
4778
  a,
4737
4779
  o
4738
4780
  );
4739
- b === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
4740
- () => u.evaluateDerive(e, a, o).then(
4781
+ g === null ? (e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), r = r.then(
4782
+ () => l.evaluateDerive(e, a, o).then(
4741
4783
  () => {
4742
4784
  }
4743
4785
  )
4744
- )) : e.getDeriveInputSignature() !== b && (r = r.then(() => u.evaluateDerive(
4786
+ )) : e.getDeriveInputSignature() !== g && (r = r.then(() => l.evaluateDerive(
4745
4787
  e,
4746
4788
  a,
4747
4789
  o
4748
4790
  ).then(() => {
4749
- e.setDeriveInputSignature(b);
4791
+ e.setDeriveInputSignature(g);
4750
4792
  })));
4751
4793
  }
4752
- return s && (r = r.then(() => u.evaluateIf(e))), n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => u.evaluateEach(e))) : s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
4794
+ return s && (r = r.then(() => l.evaluateIf(e))), n ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => l.evaluateEach(e))) : s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => {
4753
4795
  })) : (i && (r = r.then(() => {
4754
- if (!u.canSkipStableDerivedSubtree(e)) {
4755
- e.setDeriveSubtreeSignature(null), u.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
4796
+ if (!l.canSkipStableDerivedSubtree(e)) {
4797
+ e.setDeriveSubtreeSignature(null), l.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
4756
4798
  return;
4757
4799
  }
4758
- f = u.createDescendantBindingSignature(
4800
+ f = l.createDescendantBindingSignature(
4759
4801
  e,
4760
4802
  "evaluateAll"
4761
- ), d = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === f, u.logDerivedSubtreeProfileSnapshot(
4803
+ ), d = !0, c = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === f, l.logDerivedSubtreeProfileSnapshot(
4762
4804
  e,
4763
4805
  c ? "skip-hit" : "skip-miss"
4764
4806
  );
4765
4807
  })), r.then(() => {
4766
4808
  if (c)
4767
4809
  return;
4768
- const b = [];
4769
- return e.getChildren().forEach((v) => {
4770
- if (v instanceof M) {
4771
- if (u.canSkipUnchangedNestedEach(v))
4810
+ const g = [];
4811
+ return e.getChildren().forEach((y) => {
4812
+ if (y instanceof C) {
4813
+ if (l.canSkipUnchangedNestedEach(y))
4772
4814
  return;
4773
- b.push(u.evaluateAll(v, t));
4774
- } else v instanceof L && b.push(u.evaluateText(v));
4775
- }), Promise.all(b).then(() => {
4815
+ g.push(l.evaluateAll(y, t));
4816
+ } else y instanceof H && g.push(l.evaluateText(y));
4817
+ }), Promise.all(g).then(() => {
4776
4818
  });
4777
4819
  }).then(() => {
4778
4820
  d && f !== null && e.setDeriveSubtreeSignature(f);
@@ -4787,14 +4829,14 @@ const u = class u {
4787
4829
  * @returns Promise (評価完了時に解決)
4788
4830
  */
4789
4831
  static evaluateDerive(e, t = e.getRawAttribute(
4790
- `${l.prefix}derive`
4832
+ `${u.prefix}derive`
4791
4833
  ), r = e.getRawAttribute(
4792
- `${l.prefix}derive-name`
4834
+ `${u.prefix}derive-name`
4793
4835
  )) {
4794
4836
  const i = e.getRawDerivedBindingData(), s = typeof r == "string" ? r.trim() : "";
4795
4837
  if (!t || s === "")
4796
4838
  return i === null ? Promise.resolve(!1) : (e.setDerivedBindingData(null), Promise.resolve(!0));
4797
- const n = W.evaluateDetailed(
4839
+ const n = Y.evaluateDetailed(
4798
4840
  t,
4799
4841
  e.getBindingData()
4800
4842
  );
@@ -4803,7 +4845,7 @@ const u = class u {
4803
4845
  const a = {
4804
4846
  [s]: n.value
4805
4847
  };
4806
- return u.createBindingSignature(i) === u.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
4848
+ return l.createBindingSignature(i) === l.createBindingSignature(a) ? Promise.resolve(!1) : (e.setDerivedBindingData(a), Promise.resolve(!0));
4807
4849
  }
4808
4850
  /**
4809
4851
  * テキストフラグメントを評価します。
@@ -4814,61 +4856,120 @@ const u = class u {
4814
4856
  static evaluateText(e) {
4815
4857
  return e.evaluate();
4816
4858
  }
4859
+ /**
4860
+ * data-if の評価値が「非表示」とみなされるかどうかを判定します。
4861
+ *
4862
+ * JavaScript の falsy 判定に準拠し、`false`・`null`・`undefined`・`NaN` に加えて
4863
+ * `0`・空文字列 `''` も非表示とします(例: `data-if="items.length"` は要素数 0 で
4864
+ * 非表示)。空配列 `[]` や空オブジェクト `{}` は JavaScript 同様 truthy なので表示されます。
4865
+ *
4866
+ * @param condition data-if の評価結果
4867
+ * @return 非表示とみなす場合は true
4868
+ */
4869
+ static isHiddenIfCondition(e) {
4870
+ return !e;
4871
+ }
4817
4872
  /**
4818
4873
  * if要素を評価します。
4819
- * 値がfalsenullundefinedNaNの場合は非表示にし、それ以外の場合は表示します。
4874
+ * 値が falsy(falsenullundefinedNaN・0・空文字列)の場合は非表示にし、
4875
+ * それ以外の場合は表示します。
4820
4876
  *
4821
4877
  * @param fragment 対象フラグメント
4822
4878
  * @return Promise (DOM操作が完了したときに解決される)
4823
4879
  */
4824
4880
  static evaluateIf(e) {
4825
- const t = [], r = e.getAttribute(`${l.prefix}if`);
4826
- if (r === !1 || r === void 0 || r === null || Number.isNaN(r))
4881
+ const t = [], r = e.getAttribute(`${u.prefix}if`);
4882
+ if (l.isHiddenIfCondition(r))
4827
4883
  t.push(
4828
4884
  e.hide().then(() => {
4829
4885
  R.hide(e.getTarget());
4830
4886
  })
4831
4887
  );
4832
4888
  else {
4833
- const i = [];
4834
- e.getChildren().forEach((s) => {
4835
- s instanceof M ? i.push(
4836
- s.isMounted() ? u.evaluateAll(s) : u.scan(s.getTarget())
4837
- ) : s instanceof L && i.push(u.evaluateText(s));
4889
+ const i = e.isVisible(), s = [];
4890
+ e.getChildren().forEach((n) => {
4891
+ n instanceof C ? s.push(
4892
+ n.isMounted() ? l.evaluateAll(n) : l.scan(n.getTarget())
4893
+ ) : n instanceof H && s.push(l.evaluateText(n));
4838
4894
  }), t.push(
4839
4895
  e.show().then(() => {
4840
- R.show(e.getTarget());
4896
+ R.show(e.getTarget()), i || l.triggerLoadOnShow(e);
4841
4897
  })
4842
- ), t.push(Promise.all(i).then(() => {
4898
+ ), t.push(Promise.all(s).then(() => {
4843
4899
  }));
4844
4900
  }
4845
4901
  return Promise.all(t).then(() => {
4846
4902
  });
4847
4903
  }
4904
+ /**
4905
+ * data-if 表示時に data-load-* 手続きを発火します。
4906
+ *
4907
+ * 対象要素が data-load-* 属性を持つ場合のみ、load 種別の Procedure を1回実行します。
4908
+ * 結果は待機せず(fire-and-forget)、表示処理の完了をブロックしません。
4909
+ *
4910
+ * @param fragment 対象フラグメント
4911
+ * @return 戻り値はありません。
4912
+ */
4913
+ static triggerLoadOnShow(e) {
4914
+ const t = `${u.prefix}load-`;
4915
+ e.getTarget().getAttributeNames().some((i) => i.startsWith(t)) && new q(e, "load").run().catch((i) => {
4916
+ p.error("[Haori]", "data-load procedure error (on show):", i);
4917
+ });
4918
+ }
4919
+ /**
4920
+ * data-each フラグメントの差分更新の再入制御状態を取得します。
4921
+ *
4922
+ * @param fragment 対象フラグメント
4923
+ * @return 再入制御状態
4924
+ */
4925
+ static getEachUpdateState(e) {
4926
+ let t = l.EACH_UPDATE_STATES.get(e);
4927
+ return t || (t = { running: !1, rerunRequested: !1 }, l.EACH_UPDATE_STATES.set(e, t)), t;
4928
+ }
4848
4929
  /**
4849
4930
  * each要素を評価します。
4850
4931
  * 非表示または未マウントの場合は処理をスキップします。
4851
4932
  *
4933
+ * 同一フラグメントに対する差分更新が並行・再入しないように直列化します。
4934
+ * 実行中に再度呼び出された場合は再評価要求だけを記録し、現在の更新完了後に
4935
+ * 最新データで一度だけ再実行します。これにより、bind 直後のリアクティブ再評価が
4936
+ * 重なっても data-each の描画が破壊されないようにします。
4937
+ *
4852
4938
  * @param fragment 対象フラグメント
4939
+ * @return 差分更新完了の Promise
4853
4940
  */
4854
4941
  static evaluateEach(e) {
4855
4942
  if (!e.isVisible() || !e.isMounted())
4856
4943
  return Promise.resolve();
4857
- const t = u.resolveEachItems(e);
4944
+ const t = l.getEachUpdateState(e);
4945
+ return t.running ? (t.rerunRequested = !0, Promise.resolve()) : (t.running = !0, l.performEachUpdate(e).catch((r) => {
4946
+ throw r;
4947
+ }).finally(() => {
4948
+ t.running = !1, t.rerunRequested && (t.rerunRequested = !1, l.evaluateEach(e));
4949
+ }));
4950
+ }
4951
+ /**
4952
+ * data-each の差分更新本体を実行します(再入制御は呼び出し側で行います)。
4953
+ *
4954
+ * @param fragment 対象フラグメント
4955
+ * @return 差分更新完了の Promise
4956
+ */
4957
+ static performEachUpdate(e) {
4958
+ const t = l.resolveEachItems(e);
4858
4959
  if (t === null)
4859
4960
  return Promise.reject(new Error("Invalid each attribute."));
4860
4961
  let r = e.getTemplate();
4861
- const i = e.getAttribute(`${l.prefix}each-key`), s = u.createBindingSignature({
4962
+ const i = e.getAttribute(`${u.prefix}each-key`), s = l.createBindingSignature({
4862
4963
  key: i ? String(i) : null,
4863
4964
  items: t
4864
4965
  });
4865
4966
  if (r === null) {
4866
4967
  let n = !1;
4867
4968
  return e.getChildren().forEach((a) => {
4868
- if (!n && a instanceof M) {
4869
- if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
4969
+ if (!n && a instanceof C) {
4970
+ if (a.hasAttribute(`${u.prefix}each-before`) || a.hasAttribute(`${u.prefix}each-after`))
4870
4971
  return;
4871
- r = a.clone(), u.markFreshInitializationSkippable(r), e.setTemplate(r), n = !0, e.removeChild(a);
4972
+ r = a.clone(), l.markFreshInitializationSkippable(r), e.setTemplate(r), n = !0, e.removeChild(a);
4872
4973
  const o = a.getTarget();
4873
4974
  o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
4874
4975
  }
@@ -4887,8 +4988,8 @@ const u = class u {
4887
4988
  * @returns 配列。無効な場合は null
4888
4989
  */
4889
4990
  static resolveEachItems(e) {
4890
- const t = e.getAttributeEvaluation(`${l.prefix}each`), r = t?.value;
4891
- return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (m.error("[Haori]", "Invalid each attribute:", r), null);
4991
+ const t = e.getAttributeEvaluation(`${u.prefix}each`), r = t?.value;
4992
+ return t?.hasUnresolvedReference || r === !1 || r === null || r === void 0 ? [] : Array.isArray(r) ? r : (p.error("[Haori]", "Invalid each attribute:", r), null);
4892
4993
  }
4893
4994
  /**
4894
4995
  * nested data-each の入力が同値で、要素自身に他の動的要素が無い場合は
@@ -4898,15 +4999,15 @@ const u = class u {
4898
4999
  * @returns 省略可能なら true
4899
5000
  */
4900
5001
  static canSkipUnchangedNestedEach(e) {
4901
- if (!e.hasAttribute(`${l.prefix}each`) || e.getEachInputSignature() === null)
5002
+ if (!e.hasAttribute(`${u.prefix}each`) || e.getEachInputSignature() === null)
4902
5003
  return !1;
4903
5004
  const t = e.getParent();
4904
- if (t?.closestByAttribute(`${l.prefix}derive`) || t?.closestByAttribute(`${l.prefix}derive-name`) || t?.closestByAttribute(`${l.prefix}if`) || t?.closestByAttribute(`${l.prefix}fetch`) || t?.closestByAttribute(`${l.prefix}import`) || u.hasNonEachDynamicElementState(e))
5005
+ if (t?.closestByAttribute(`${u.prefix}derive`) || t?.closestByAttribute(`${u.prefix}derive-name`) || t?.closestByAttribute(`${u.prefix}if`) || t?.closestByAttribute(`${u.prefix}fetch`) || t?.closestByAttribute(`${u.prefix}import`) || l.hasNonEachDynamicElementState(e))
4905
5006
  return !1;
4906
- const r = u.resolveEachItems(e);
5007
+ const r = l.resolveEachItems(e);
4907
5008
  if (r === null)
4908
5009
  return !1;
4909
- const i = e.getAttribute(`${l.prefix}each-key`), s = u.createBindingSignature({
5010
+ const i = e.getAttribute(`${u.prefix}each-key`), s = l.createBindingSignature({
4910
5011
  key: i ? String(i) : null,
4911
5012
  items: r
4912
5013
  });
@@ -4920,7 +5021,7 @@ const u = class u {
4920
5021
  * @returns 省略可能なら true
4921
5022
  */
4922
5023
  static canSkipStableDerivedSubtree(e) {
4923
- return !e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}if`) || e.hasAttribute(`${l.prefix}each`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !1 : !u.hasDisallowedDerivedSubtreeDescendant(e);
5024
+ return !e.hasAttribute(`${u.prefix}derive`) || e.hasAttribute(`${u.prefix}if`) || e.hasAttribute(`${u.prefix}each`) || e.hasAttribute(`${u.prefix}fetch`) || e.hasAttribute(`${u.prefix}import`) ? !1 : !l.hasDisallowedDerivedSubtreeDescendant(e);
4924
5025
  }
4925
5026
  /**
4926
5027
  * data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
@@ -4929,7 +5030,7 @@ const u = class u {
4929
5030
  * @returns 含むなら true
4930
5031
  */
4931
5032
  static hasDisallowedDerivedSubtreeDescendant(e) {
4932
- return e.getChildren().some((t) => t instanceof M ? t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}derive-name`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !0 : u.hasDisallowedDerivedSubtreeDescendant(t) : !1);
5033
+ return e.getChildren().some((t) => t instanceof C ? t.hasAttribute(`${u.prefix}derive`) || t.hasAttribute(`${u.prefix}derive-name`) || t.hasAttribute(`${u.prefix}fetch`) || t.hasAttribute(`${u.prefix}import`) ? !0 : l.hasDisallowedDerivedSubtreeDescendant(t) : !1);
4933
5034
  }
4934
5035
  /**
4935
5036
  * data-derive host が子孫要素へ公開している binding の署名を返します。
@@ -4938,7 +5039,7 @@ const u = class u {
4938
5039
  * @returns binding 署名
4939
5040
  */
4940
5041
  static createDescendantBindingSignature(e, t) {
4941
- return u.recordDerivedSubtreeSignatureComputation(e, t), u.createBindingSignature(e.getDescendantBindingData());
5042
+ return l.recordDerivedSubtreeSignatureComputation(e, t), l.createBindingSignature(e.getDescendantBindingData());
4942
5043
  }
4943
5044
  /**
4944
5045
  * data-derive 実行前の入力署名を返します。
@@ -4950,7 +5051,7 @@ const u = class u {
4950
5051
  */
4951
5052
  static createDeriveInputSignature(e, t, r) {
4952
5053
  const i = typeof r == "string" ? r.trim() : "";
4953
- return !t || i === "" ? null : u.createBindingSignature({
5054
+ return !t || i === "" ? null : l.createBindingSignature({
4954
5055
  expression: t,
4955
5056
  name: i,
4956
5057
  scope: e.getBindingData()
@@ -4962,13 +5063,13 @@ const u = class u {
4962
5063
  * @param fragment 対象フラグメント
4963
5064
  */
4964
5065
  static refreshDerivedSubtreeSignature(e) {
4965
- if (!u.canSkipStableDerivedSubtree(e)) {
4966
- e.setDeriveSubtreeSignature(null), u.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
5066
+ if (!l.canSkipStableDerivedSubtree(e)) {
5067
+ e.setDeriveSubtreeSignature(null), l.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
4967
5068
  return;
4968
5069
  }
4969
5070
  e.setDeriveSubtreeSignature(
4970
- u.createDescendantBindingSignature(e, "refresh")
4971
- ), u.logDerivedSubtreeProfileSnapshot(e, "refresh");
5071
+ l.createDescendantBindingSignature(e, "refresh")
5072
+ ), l.logDerivedSubtreeProfileSnapshot(e, "refresh");
4972
5073
  }
4973
5074
  /**
4974
5075
  * data-derive subtree skip のプロファイルを取得または初期化します。
@@ -4977,13 +5078,13 @@ const u = class u {
4977
5078
  * @returns プロファイル
4978
5079
  */
4979
5080
  static getOrCreateDerivedSubtreeProfile(e) {
4980
- if (!H.isEnabled() || !e.hasAttribute(`${l.prefix}derive`))
5081
+ if (!L.isEnabled() || !e.hasAttribute(`${u.prefix}derive`))
4981
5082
  return null;
4982
- const t = u.DERIVE_SUBTREE_PROFILES.get(e);
5083
+ const t = l.DERIVE_SUBTREE_PROFILES.get(e);
4983
5084
  if (t)
4984
5085
  return t;
4985
5086
  const r = {
4986
- hostId: u.createDerivedSubtreeHostId(e),
5087
+ hostId: l.createDerivedSubtreeHostId(e),
4987
5088
  signatureComputeTotal: 0,
4988
5089
  signatureComputeFromEvaluateAll: 0,
4989
5090
  signatureComputeFromRefresh: 0,
@@ -4991,7 +5092,7 @@ const u = class u {
4991
5092
  skipMissCount: 0,
4992
5093
  skipIneligibleCount: 0
4993
5094
  };
4994
- return u.DERIVE_SUBTREE_PROFILES.set(e, r), r;
5095
+ return l.DERIVE_SUBTREE_PROFILES.set(e, r), r;
4995
5096
  }
4996
5097
  /**
4997
5098
  * data-derive subtree host の識別子を作成します。
@@ -5011,11 +5112,11 @@ const u = class u {
5011
5112
  s += `#${i.id.trim()}`, t.unshift(s);
5012
5113
  break;
5013
5114
  }
5014
- const n = r.getRawAttribute(`${l.prefix}derive-name`);
5015
- typeof n == "string" && n.trim() !== "" && (s += `[${l.prefix}derive-name="${n.trim()}"]`);
5115
+ const n = r.getRawAttribute(`${u.prefix}derive-name`);
5116
+ typeof n == "string" && n.trim() !== "" && (s += `[${u.prefix}derive-name="${n.trim()}"]`);
5016
5117
  const a = r.getParent();
5017
5118
  if (a) {
5018
- const o = a.getChildren().filter((c) => c instanceof M).findIndex((c) => c === r);
5119
+ const o = a.getChildren().filter((c) => c instanceof C).findIndex((c) => c === r);
5019
5120
  s += `:nth-child(${o + 1})`;
5020
5121
  }
5021
5122
  t.unshift(s), r = a;
@@ -5029,7 +5130,7 @@ const u = class u {
5029
5130
  * @param source 計算元
5030
5131
  */
5031
5132
  static recordDerivedSubtreeSignatureComputation(e, t) {
5032
- const r = u.getOrCreateDerivedSubtreeProfile(e);
5133
+ const r = l.getOrCreateDerivedSubtreeProfile(e);
5033
5134
  if (r !== null) {
5034
5135
  if (r.signatureComputeTotal += 1, t === "refresh") {
5035
5136
  r.signatureComputeFromRefresh += 1;
@@ -5045,8 +5146,8 @@ const u = class u {
5045
5146
  * @param reason ログ理由
5046
5147
  */
5047
5148
  static logDerivedSubtreeProfileSnapshot(e, t) {
5048
- const r = u.getOrCreateDerivedSubtreeProfile(e);
5049
- r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
5149
+ const r = l.getOrCreateDerivedSubtreeProfile(e);
5150
+ r !== null && (t === "skip-hit" ? r.skipHitCount += 1 : t === "skip-miss" ? r.skipMissCount += 1 : t === "skip-ineligible" && (r.skipIneligibleCount += 1), p.info("[Haori][derive-profile]", {
5050
5151
  reason: t,
5051
5152
  hostId: r.hostId,
5052
5153
  signatureComputeTotal: r.signatureComputeTotal,
@@ -5065,20 +5166,20 @@ const u = class u {
5065
5166
  */
5066
5167
  static hasNonEachDynamicElementState(e) {
5067
5168
  const t = /* @__PURE__ */ new Set([
5068
- `${l.prefix}each`,
5069
- `${l.prefix}each-key`,
5070
- `${l.prefix}each-arg`,
5071
- `${l.prefix}each-index`
5169
+ `${u.prefix}each`,
5170
+ `${u.prefix}each-key`,
5171
+ `${u.prefix}each-arg`,
5172
+ `${u.prefix}each-index`
5072
5173
  ]);
5073
5174
  return e.getAttributeNames().some((i) => {
5074
5175
  if (t.has(i))
5075
5176
  return !1;
5076
- if (i.startsWith(`${l.prefix}attr-`) || i.startsWith(l.prefix))
5177
+ if (i.startsWith(`${u.prefix}attr-`) || i.startsWith(u.prefix))
5077
5178
  return !0;
5078
5179
  const s = e.getRawAttribute(i);
5079
5180
  return typeof s == "string" && s.includes("{{");
5080
5181
  }) ? !0 : e.getChildren().some(
5081
- (i) => i instanceof L && i.hasDynamicContent()
5182
+ (i) => i instanceof H && i.hasDynamicContent()
5082
5183
  );
5083
5184
  }
5084
5185
  /**
@@ -5088,7 +5189,7 @@ const u = class u {
5088
5189
  * @returns subtree 全体を省略可能なら true
5089
5190
  */
5090
5191
  static markFreshInitializationSkippable(e) {
5091
- const t = e.getAttributeNames().some((s) => u.isFreshInitializationDynamicAttribute(e, s)), r = e.getChildren().some((s) => s instanceof M ? !u.markFreshInitializationSkippable(s) : s instanceof L ? s.hasDynamicContent() : !1), i = !t && !r;
5192
+ const t = e.getAttributeNames().some((s) => l.isFreshInitializationDynamicAttribute(e, s)), r = e.getChildren().some((s) => s instanceof C ? !l.markFreshInitializationSkippable(s) : s instanceof H ? s.hasDynamicContent() : !1), i = !t && !r;
5092
5193
  return e.setFreshInitializationSkippable(i), i;
5093
5194
  }
5094
5195
  /**
@@ -5099,7 +5200,7 @@ const u = class u {
5099
5200
  * @returns 再評価が必要なら true
5100
5201
  */
5101
5202
  static isFreshInitializationDynamicAttribute(e, t) {
5102
- if (t.startsWith(`${l.prefix}attr-`) || t.startsWith(l.prefix))
5203
+ if (t.startsWith(`${u.prefix}attr-`) || t.startsWith(u.prefix))
5103
5204
  return !0;
5104
5205
  const r = e.getRawAttribute(t);
5105
5206
  return typeof r == "string" && r.includes("{{");
@@ -5113,85 +5214,85 @@ const u = class u {
5113
5214
  static updateDiff(e, t) {
5114
5215
  const r = e.getTemplate();
5115
5216
  if (r === null)
5116
- return m.error("[Haori]", "Template is not set for each element."), Promise.resolve();
5117
- let i = e.getAttribute(`${l.prefix}each-index`);
5217
+ return p.error("[Haori]", "Template is not set for each element."), Promise.resolve();
5218
+ let i = e.getAttribute(`${u.prefix}each-index`);
5118
5219
  i && (i = String(i));
5119
- const s = e.getAttribute(`${l.prefix}each-key`), n = e.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
5120
- t.forEach((y, C) => {
5121
- const k = u.createListKey(
5122
- y,
5220
+ const s = e.getAttribute(`${u.prefix}each-key`), n = e.getAttribute(`${u.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
5221
+ t.forEach((v, F) => {
5222
+ const x = l.createListKey(
5223
+ v,
5123
5224
  s ? String(s) : null,
5124
- C
5225
+ F
5125
5226
  );
5126
- o.push(k), a.set(k, { item: y, itemIndex: C });
5227
+ o.push(x), a.set(x, { item: v, itemIndex: F });
5127
5228
  });
5128
5229
  const c = new Set(o), d = [];
5129
- let f = e.getChildren().filter((y) => y instanceof M).filter(
5130
- (y) => !y.hasAttribute(`${l.prefix}each-before`) && !y.hasAttribute(`${l.prefix}each-after`)
5230
+ let f = e.getChildren().filter((v) => v instanceof C).filter(
5231
+ (v) => !v.hasAttribute(`${u.prefix}each-before`) && !v.hasAttribute(`${u.prefix}each-after`)
5131
5232
  );
5132
- const b = f.map((y) => y.getListKey());
5133
- f = f.filter((y) => c.has(String(y.getListKey())) ? !0 : (d.push(y.remove()), !1));
5134
- const v = f.map((y) => y.getListKey()), p = /* @__PURE__ */ new Map();
5135
- f.forEach((y) => {
5136
- const C = y.getListKey();
5137
- C !== null && !p.has(C) && p.set(C, y);
5233
+ const g = f.map((v) => v.getListKey());
5234
+ f = f.filter((v) => c.has(String(v.getListKey())) ? !0 : (d.push(v.remove()), !1));
5235
+ const y = f.map((v) => v.getListKey()), T = /* @__PURE__ */ new Map();
5236
+ f.forEach((v) => {
5237
+ const F = v.getListKey();
5238
+ F !== null && !T.has(F) && T.set(F, v);
5138
5239
  });
5139
- const g = e.getChildElementFragments().slice(), D = g.filter(
5140
- (y) => y.hasAttribute(`${l.prefix}each-before`)
5240
+ const m = e.getChildElementFragments().slice(), b = m.filter(
5241
+ (v) => v.hasAttribute(`${u.prefix}each-before`)
5141
5242
  ).length;
5142
- let A = Promise.resolve();
5143
- return o.forEach((y, C) => {
5144
- const { item: k, itemIndex: B } = a.get(y);
5145
- let U;
5146
- const Y = p.get(y);
5147
- if (Y)
5148
- U = Y, A = A.then(
5149
- () => u.updateRowFragment(
5150
- U,
5151
- k,
5152
- i,
5243
+ let E = Promise.resolve();
5244
+ return o.forEach((v, F) => {
5245
+ const { item: x, itemIndex: U } = a.get(v);
5246
+ let B;
5247
+ const K = T.get(v);
5248
+ if (K)
5249
+ B = K, E = E.then(
5250
+ () => l.updateRowFragment(
5153
5251
  B,
5252
+ x,
5253
+ i,
5254
+ U,
5154
5255
  n ? String(n) : null,
5155
- y
5156
- ).then((I) => {
5157
- if (I)
5158
- return u.evaluateAll(U);
5256
+ v
5257
+ ).then((k) => {
5258
+ if (k)
5259
+ return l.evaluateAll(B);
5159
5260
  })
5160
5261
  );
5161
5262
  else {
5162
- U = r.clone();
5163
- const I = D + C;
5164
- A = A.then(
5165
- () => u.updateRowFragment(
5166
- U,
5167
- k,
5168
- i,
5263
+ B = r.clone();
5264
+ const k = b + F;
5265
+ E = E.then(
5266
+ () => l.updateRowFragment(
5169
5267
  B,
5268
+ x,
5269
+ i,
5270
+ U,
5170
5271
  n ? String(n) : null,
5171
- y
5272
+ v
5172
5273
  ).then(() => {
5173
- const ce = g[I] ?? null;
5174
- return e.insertBefore(U, ce).then(() => {
5175
- g.splice(I, 0, U);
5176
- }).then(() => u.initializeFreshEachRow(U));
5274
+ const ce = m[k] ?? null;
5275
+ return e.insertBefore(B, ce).then(() => {
5276
+ m.splice(k, 0, B);
5277
+ }).then(() => l.initializeFreshEachRow(B));
5177
5278
  })
5178
5279
  );
5179
5280
  }
5180
- }), Promise.all(d).then(() => A).then(() => {
5181
- const y = o.filter(
5182
- (I) => I !== null
5183
- ), C = v.filter(
5184
- (I) => I !== null
5185
- ), k = new Set(C), B = y.filter((I) => !k.has(I)), Y = b.filter(
5186
- (I) => I !== null
5281
+ }), Promise.all(d).then(() => E).then(() => {
5282
+ const v = o.filter(
5283
+ (k) => k !== null
5284
+ ), F = y.filter(
5285
+ (k) => k !== null
5286
+ ), x = new Set(F), U = v.filter((k) => !x.has(k)), K = g.filter(
5287
+ (k) => k !== null
5187
5288
  ).filter(
5188
- (I) => !c.has(I)
5289
+ (k) => !c.has(k)
5189
5290
  );
5190
5291
  R.eachUpdate(
5191
5292
  e.getTarget(),
5192
- B,
5193
- Y,
5194
- y
5293
+ U,
5294
+ K,
5295
+ v
5195
5296
  );
5196
5297
  });
5197
5298
  }
@@ -5237,15 +5338,15 @@ const u = class u {
5237
5338
  [s]: t
5238
5339
  }, r && (a[r] = i);
5239
5340
  else
5240
- return m.error(
5341
+ return p.error(
5241
5342
  "[Haori]",
5242
- `Primitive value requires '${l.prefix}each-arg' attribute: ${t}`
5343
+ `Primitive value requires '${u.prefix}each-arg' attribute: ${t}`
5243
5344
  ), Promise.resolve(!1);
5244
- const o = a, c = u.createBindingSignature({
5345
+ const o = a, c = l.createBindingSignature({
5245
5346
  listKey: n,
5246
5347
  bindingData: o
5247
5348
  });
5248
- return e.getListKey() === n && e.getRenderSignature() === c ? Promise.resolve(!1) : (e.setListKey(n), e.setRenderSignature(c), e.setBindingData(o), e.setAttribute(`${l.prefix}row`, n).then(() => !0));
5349
+ return e.getListKey() === n && e.getRenderSignature() === c ? Promise.resolve(!1) : (e.setListKey(n), e.setRenderSignature(c), e.setBindingData(o), e.setAttribute(`${u.prefix}row`, n).then(() => !0));
5249
5350
  }
5250
5351
  /**
5251
5352
  * 新規挿入行に遅延再評価が必要かどうかを判定します。
@@ -5259,7 +5360,7 @@ const u = class u {
5259
5360
  const r = t.pop();
5260
5361
  if (r.getChildElementFragments().forEach((i) => {
5261
5362
  t.push(i);
5262
- }), r !== e && !r.isMounted() && u.hasMountSensitiveAttribute(r))
5363
+ }), r !== e && !r.isMounted() && l.hasMountSensitiveAttribute(r))
5263
5364
  return !0;
5264
5365
  }
5265
5366
  return !1;
@@ -5272,7 +5373,7 @@ const u = class u {
5272
5373
  */
5273
5374
  static hasMountSensitiveAttribute(e) {
5274
5375
  return ["fetch", "import"].some(
5275
- (t) => e.hasAttribute(`${l.prefix}${t}`)
5376
+ (t) => e.hasAttribute(`${u.prefix}${t}`)
5276
5377
  );
5277
5378
  }
5278
5379
  /**
@@ -5302,7 +5403,7 @@ const u = class u {
5302
5403
  if (t.has(e))
5303
5404
  return `[Circular:${t.get(e)}]`;
5304
5405
  const i = `array-${r.value}`;
5305
- return r.value += 1, t.set(e, i), `[${e.map((s) => u.createBindingSignature(s, t, r)).join(",")}]`;
5406
+ return r.value += 1, t.set(e, i), `[${e.map((s) => l.createBindingSignature(s, t, r)).join(",")}]`;
5306
5407
  }
5307
5408
  if (typeof e == "object") {
5308
5409
  if (t.has(e))
@@ -5311,7 +5412,7 @@ const u = class u {
5311
5412
  r.value += 1, t.set(e, i);
5312
5413
  const s = e;
5313
5414
  return `{${Object.keys(s).sort().map(
5314
- (n) => `${JSON.stringify(n)}:${u.createBindingSignature(
5415
+ (n) => `${JSON.stringify(n)}:${l.createBindingSignature(
5315
5416
  s[n],
5316
5417
  t,
5317
5418
  r
@@ -5327,18 +5428,18 @@ const u = class u {
5327
5428
  */
5328
5429
  static scheduleEvaluateAll(e) {
5329
5430
  setTimeout(() => {
5330
- u.evaluateAll(e);
5431
+ l.evaluateAll(e);
5331
5432
  }, 100);
5332
5433
  }
5333
5434
  };
5334
- u.ATTRIBUTE_ALIAS_SUFFIX = "attr-", u.PRIORITY_ATTRIBUTE_SUFFIXES = [
5435
+ l.ATTRIBUTE_ALIAS_SUFFIX = "attr-", l.PRIORITY_ATTRIBUTE_SUFFIXES = [
5335
5436
  "bind",
5336
5437
  "url-param",
5337
5438
  "derive-name",
5338
5439
  "derive",
5339
5440
  "if",
5340
5441
  "each"
5341
- ], u.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], u.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
5442
+ ], l.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], l.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
5342
5443
  "bind",
5343
5444
  "derive",
5344
5445
  "derive-name",
@@ -5347,8 +5448,8 @@ u.ATTRIBUTE_ALIAS_SUFFIX = "attr-", u.PRIORITY_ATTRIBUTE_SUFFIXES = [
5347
5448
  "fetch",
5348
5449
  "import",
5349
5450
  "url-param"
5350
- ], u.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, u.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), u.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), u.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap();
5351
- let x = u;
5451
+ ], l.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, l.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), l.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), l.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), l.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap();
5452
+ let P = l;
5352
5453
  const ee = class ee {
5353
5454
  /**
5354
5455
  * コンストラクタ。
@@ -5358,7 +5459,7 @@ const ee = class ee {
5358
5459
  constructor(e = document) {
5359
5460
  this.onClick = (t) => this.delegate(t, "click"), this.onChange = (t) => this.delegate(t, "change"), this.onLoadCapture = (t) => this.delegate(t, "load"), this.onWindowLoad = () => {
5360
5461
  const t = document.documentElement, r = w.get(t);
5361
- r && new z(r, "load").run();
5462
+ r && new q(r, "load").run();
5362
5463
  }, this.onPopstate = (t) => {
5363
5464
  const r = t.state;
5364
5465
  !r || r[ee.HISTORY_STATE_KEY] !== !0 || location.reload();
@@ -5388,8 +5489,8 @@ const ee = class ee {
5388
5489
  if (!r)
5389
5490
  return;
5390
5491
  const i = w.get(r);
5391
- i && (t === "change" && i instanceof M && i.syncValue(), new z(i, t).run().catch((s) => {
5392
- m.error("[Haori]", "Procedure execution error:", s);
5492
+ i && (t === "change" && i instanceof C && i.syncValue(), new q(i, t).run().catch((s) => {
5493
+ p.error("[Haori]", "Procedure execution error:", s);
5393
5494
  }));
5394
5495
  }
5395
5496
  /**
@@ -5428,7 +5529,7 @@ const ee = class ee {
5428
5529
  };
5429
5530
  ee.HISTORY_STATE_KEY = "__haoriHistoryState__";
5430
5531
  let ne = ee;
5431
- const T = class T {
5532
+ const D = class D {
5432
5533
  /**
5433
5534
  * ノードが現在の Window に属する HTMLElement かどうかを判定します。
5434
5535
  *
@@ -5442,42 +5543,42 @@ const T = class T {
5442
5543
  return typeof t < "u" && e instanceof t;
5443
5544
  }
5444
5545
  static syncTree(e) {
5445
- (e instanceof Element || e instanceof DocumentFragment) && (T.isHtmlElement(e) && T.syncElement(e), e.querySelectorAll("*").forEach((t) => {
5446
- T.syncElement(t);
5546
+ (e instanceof Element || e instanceof DocumentFragment) && (D.isHtmlElement(e) && D.syncElement(e), e.querySelectorAll("*").forEach((t) => {
5547
+ D.syncElement(t);
5447
5548
  }));
5448
5549
  }
5449
5550
  static syncElement(e) {
5450
- const t = T.registrations.get(e), r = w.get(e);
5451
- if (!r || !T.shouldObserve(r)) {
5452
- t && (t.observer.disconnect(), T.registrations.delete(e));
5551
+ const t = D.registrations.get(e), r = w.get(e);
5552
+ if (!r || !D.shouldObserve(r)) {
5553
+ t && (t.observer.disconnect(), D.registrations.delete(e));
5453
5554
  return;
5454
5555
  }
5455
5556
  if (typeof IntersectionObserver > "u")
5456
5557
  return;
5457
- const i = T.resolveRoot(r), s = T.resolveRootMargin(r), n = T.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
5458
- if (t && t.observer.root === i && t.observer.rootMargin === s && T.sameThreshold(
5558
+ const i = D.resolveRoot(r), s = D.resolveRootMargin(r), n = D.resolveThreshold(r), a = r.hasAttribute(`${u.prefix}intersect-once`);
5559
+ if (t && t.observer.root === i && t.observer.rootMargin === s && D.sameThreshold(
5459
5560
  t.observer.thresholds,
5460
5561
  n
5461
5562
  ) && t.once === a) {
5462
5563
  t.fragment = r;
5463
5564
  return;
5464
5565
  }
5465
- t && (t.observer.disconnect(), T.registrations.delete(e));
5566
+ t && (t.observer.disconnect(), D.registrations.delete(e));
5466
5567
  const o = new IntersectionObserver(
5467
5568
  (c) => {
5468
- const d = T.registrations.get(e);
5569
+ const d = D.registrations.get(e);
5469
5570
  d && c.forEach((f) => {
5470
- !f.isIntersecting || d.running || T.isDisabled(d.fragment) || (d.running = !0, new z(d.fragment, "intersect").runWithResult().then((b) => {
5471
- b && d.once && (d.observer.disconnect(), T.registrations.delete(e));
5472
- }).catch((b) => {
5473
- m.error(
5571
+ !f.isIntersecting || d.running || D.isDisabled(d.fragment) || (d.running = !0, new q(d.fragment, "intersect").runWithResult().then((g) => {
5572
+ g && d.once && (d.observer.disconnect(), D.registrations.delete(e));
5573
+ }).catch((g) => {
5574
+ p.error(
5474
5575
  "[Haori]",
5475
5576
  "Intersect procedure execution error:",
5476
- b
5577
+ g
5477
5578
  );
5478
5579
  }).finally(() => {
5479
- const b = T.registrations.get(e);
5480
- b && (b.running = !1);
5580
+ const g = D.registrations.get(e);
5581
+ g && (g.running = !1);
5481
5582
  }));
5482
5583
  });
5483
5584
  },
@@ -5487,7 +5588,7 @@ const T = class T {
5487
5588
  threshold: n
5488
5589
  }
5489
5590
  );
5490
- o.observe(e), T.registrations.set(e, {
5591
+ o.observe(e), D.registrations.set(e, {
5491
5592
  fragment: r,
5492
5593
  observer: o,
5493
5594
  once: a,
@@ -5495,48 +5596,48 @@ const T = class T {
5495
5596
  });
5496
5597
  }
5497
5598
  static cleanupTree(e) {
5498
- if (T.isHtmlElement(e)) {
5499
- const t = T.registrations.get(e);
5500
- t && (t.observer.disconnect(), T.registrations.delete(e));
5599
+ if (D.isHtmlElement(e)) {
5600
+ const t = D.registrations.get(e);
5601
+ t && (t.observer.disconnect(), D.registrations.delete(e));
5501
5602
  }
5502
5603
  (e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
5503
- const r = T.registrations.get(t);
5504
- r && (r.observer.disconnect(), T.registrations.delete(t));
5604
+ const r = D.registrations.get(t);
5605
+ r && (r.observer.disconnect(), D.registrations.delete(t));
5505
5606
  });
5506
5607
  }
5507
5608
  static disconnectAll() {
5508
- T.registrations.forEach((e) => {
5609
+ D.registrations.forEach((e) => {
5509
5610
  e.observer.disconnect();
5510
- }), T.registrations.clear();
5611
+ }), D.registrations.clear();
5511
5612
  }
5512
5613
  static shouldObserve(e) {
5513
5614
  return e.getAttributeNames().some((t) => {
5514
- if (!t.startsWith(`${l.prefix}intersect-`))
5615
+ if (!t.startsWith(`${u.prefix}intersect-`))
5515
5616
  return !1;
5516
- const r = t.slice(`${l.prefix}intersect-`.length);
5517
- return !T.CONFIG_KEYS.has(r);
5617
+ const r = t.slice(`${u.prefix}intersect-`.length);
5618
+ return !D.CONFIG_KEYS.has(r);
5518
5619
  });
5519
5620
  }
5520
5621
  static resolveRoot(e) {
5521
- const t = `${l.prefix}intersect-root`;
5622
+ const t = `${u.prefix}intersect-root`;
5522
5623
  if (!e.hasAttribute(t))
5523
5624
  return null;
5524
5625
  const r = e.getAttribute(t);
5525
5626
  if (typeof r != "string" || r.trim() === "")
5526
5627
  return null;
5527
5628
  const i = document.querySelector(r);
5528
- return T.isHtmlElement(i) ? i : (m.error("[Haori]", `Intersect root element not found: ${r}`), null);
5629
+ return D.isHtmlElement(i) ? i : (p.error("[Haori]", `Intersect root element not found: ${r}`), null);
5529
5630
  }
5530
5631
  static resolveRootMargin(e) {
5531
- const t = `${l.prefix}intersect-root-margin`, r = e.getAttribute(t);
5632
+ const t = `${u.prefix}intersect-root-margin`, r = e.getAttribute(t);
5532
5633
  return r === null || r === !1 || r === "" ? "0px" : String(r);
5533
5634
  }
5534
5635
  static resolveThreshold(e) {
5535
- const t = `${l.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
5636
+ const t = `${u.prefix}intersect-threshold`, r = e.getAttribute(t), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
5536
5637
  return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
5537
5638
  }
5538
5639
  static isDisabled(e) {
5539
- const t = `${l.prefix}intersect-disabled`, r = e.getAttribute(t);
5640
+ const t = `${u.prefix}intersect-disabled`, r = e.getAttribute(t);
5540
5641
  if (r === null || r === !1)
5541
5642
  return !1;
5542
5643
  if (typeof r == "boolean")
@@ -5548,14 +5649,14 @@ const T = class T {
5548
5649
  return e.length === 1 && e[0] === t;
5549
5650
  }
5550
5651
  };
5551
- T.CONFIG_KEYS = /* @__PURE__ */ new Set([
5652
+ D.CONFIG_KEYS = /* @__PURE__ */ new Set([
5552
5653
  "root",
5553
5654
  "root-margin",
5554
5655
  "threshold",
5555
5656
  "disabled",
5556
5657
  "once"
5557
- ]), T.registrations = /* @__PURE__ */ new Map();
5558
- let G = T;
5658
+ ]), D.registrations = /* @__PURE__ */ new Map();
5659
+ let W = D;
5559
5660
  const O = class O {
5560
5661
  /**
5561
5662
  * 既存の MutationObserver をすべて停止します。
@@ -5574,10 +5675,10 @@ const O = class O {
5574
5675
  return;
5575
5676
  O._initialized = !0, O.disconnectMutationObservers();
5576
5677
  const e = await Promise.allSettled([
5577
- x.scan(document.head),
5578
- x.scan(document.body)
5678
+ P.scan(document.head),
5679
+ P.scan(document.body)
5579
5680
  ]), [t, r] = e;
5580
- t.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", t.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await N.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ne().start(), G.syncTree(document.body);
5681
+ t.status !== "fulfilled" && p.error("[Haori]", "Failed to build head fragment:", t.reason), r.status !== "fulfilled" && p.error("[Haori]", "Failed to build body fragment:", r.reason), await M.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ne().start(), W.syncTree(document.body);
5581
5682
  }
5582
5683
  /**
5583
5684
  * 指定された要素を監視します。
@@ -5591,29 +5692,29 @@ const O = class O {
5591
5692
  switch (i.type) {
5592
5693
  case "attributes": {
5593
5694
  const s = i.target;
5594
- if (i.attributeName && s.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName && x.isAliasedAttributeReflection(
5695
+ if (i.attributeName && s.hasAttribute("data-haori-click-lock") && (i.attributeName === "disabled" || i.attributeName === "data-haori-click-lock") || i.attributeName && P.isAliasedAttributeReflection(
5595
5696
  s,
5596
5697
  i.attributeName
5597
5698
  ))
5598
5699
  break;
5599
- x.setAttribute(
5700
+ P.setAttribute(
5600
5701
  s,
5601
5702
  i.attributeName,
5602
5703
  s.getAttribute(i.attributeName),
5603
5704
  !0
5604
- ), G.syncElement(s);
5705
+ ), W.syncElement(s);
5605
5706
  break;
5606
5707
  }
5607
5708
  case "childList": {
5608
5709
  Array.from(i.removedNodes).forEach((s) => {
5609
- G.cleanupTree(s), x.removeNode(s);
5710
+ W.cleanupTree(s), P.removeNode(s);
5610
5711
  }), Array.from(i.addedNodes).forEach((s) => {
5611
- s.parentElement instanceof Element && (x.addNode(s.parentElement, s), G.syncTree(s));
5712
+ s.parentElement instanceof Element && (P.addNode(s.parentElement, s), W.syncTree(s));
5612
5713
  });
5613
5714
  break;
5614
5715
  }
5615
5716
  case "characterData": {
5616
- i.target instanceof Text || i.target instanceof Comment ? x.changeText(i.target, i.target.textContent) : m.warn(
5717
+ i.target instanceof Text || i.target instanceof Comment ? P.changeText(i.target, i.target.textContent) : p.warn(
5617
5718
  "[Haori]",
5618
5719
  "Unsupported character data type:",
5619
5720
  i.target
@@ -5621,11 +5722,11 @@ const O = class O {
5621
5722
  break;
5622
5723
  }
5623
5724
  default:
5624
- m.warn("[Haori]", "Unknown mutation type:", i.type);
5725
+ p.warn("[Haori]", "Unknown mutation type:", i.type);
5625
5726
  continue;
5626
5727
  }
5627
5728
  } catch (s) {
5628
- m.error("[Haori]", "Error processing mutation:", s);
5729
+ p.error("[Haori]", "Error processing mutation:", s);
5629
5730
  }
5630
5731
  });
5631
5732
  t.observe(e, {
@@ -5639,16 +5740,16 @@ const O = class O {
5639
5740
  O._initialized = !1, O._mutationObservers = [];
5640
5741
  let Q = O;
5641
5742
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Q.init) : Q.init();
5642
- const Te = "0.4.13";
5743
+ const De = "0.8.0";
5643
5744
  export {
5644
- x as Core,
5645
- l as Env,
5646
- E as Form,
5745
+ P as Core,
5746
+ u as Env,
5747
+ A as Form,
5647
5748
  w as Fragment,
5648
5749
  te as Haori,
5649
- m as Log,
5650
- N as Queue,
5750
+ p as Log,
5751
+ M as Queue,
5651
5752
  te as default,
5652
- Te as version
5753
+ De as version
5653
5754
  };
5654
5755
  //# sourceMappingURL=haori.es.js.map