haori 0.4.2 → 0.4.4

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 (51) hide show
  1. package/README.ja.md +4 -1
  2. package/README.md +4 -1
  3. package/dist/haori.cjs.js +11 -9
  4. package/dist/haori.cjs.js.map +1 -1
  5. package/dist/haori.es.js +705 -547
  6. package/dist/haori.es.js.map +1 -1
  7. package/dist/haori.iife.js +9 -7
  8. package/dist/haori.iife.js.map +1 -1
  9. package/dist/index.d.ts +67 -4
  10. package/dist/package.json +1 -1
  11. package/dist/src/core.d.ts +17 -0
  12. package/dist/src/core.d.ts.map +1 -1
  13. package/dist/src/core.js +75 -22
  14. package/dist/src/core.js.map +1 -1
  15. package/dist/src/form.d.ts +12 -1
  16. package/dist/src/form.d.ts.map +1 -1
  17. package/dist/src/form.js +23 -3
  18. package/dist/src/form.js.map +1 -1
  19. package/dist/src/fragment.d.ts +27 -0
  20. package/dist/src/fragment.d.ts.map +1 -1
  21. package/dist/src/fragment.js +62 -8
  22. package/dist/src/fragment.js.map +1 -1
  23. package/dist/src/haori.d.ts +10 -2
  24. package/dist/src/haori.d.ts.map +1 -1
  25. package/dist/src/haori.js +23 -11
  26. package/dist/src/haori.js.map +1 -1
  27. package/dist/src/index.d.ts +1 -1
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/observer.d.ts.map +1 -1
  30. package/dist/src/observer.js +4 -0
  31. package/dist/src/observer.js.map +1 -1
  32. package/dist/src/procedure.d.ts +18 -0
  33. package/dist/src/procedure.d.ts.map +1 -1
  34. package/dist/src/procedure.js +75 -11
  35. package/dist/src/procedure.js.map +1 -1
  36. package/dist/tests/core.test.js +40 -0
  37. package/dist/tests/core.test.js.map +1 -1
  38. package/dist/tests/fetch-and-procedure-scenarios.test.js +54 -0
  39. package/dist/tests/fetch-and-procedure-scenarios.test.js.map +1 -1
  40. package/dist/tests/form.test.js +27 -0
  41. package/dist/tests/form.test.js.map +1 -1
  42. package/dist/tests/haori.test.d.ts +2 -0
  43. package/dist/tests/haori.test.d.ts.map +1 -0
  44. package/dist/tests/haori.test.js +149 -0
  45. package/dist/tests/haori.test.js.map +1 -0
  46. package/dist/tests/helpers/async.d.ts.map +1 -1
  47. package/dist/tests/helpers/async.js +1 -0
  48. package/dist/tests/helpers/async.js.map +1 -1
  49. package/dist/tests/procedure-action-operations.test.js +149 -3
  50. package/dist/tests/procedure-action-operations.test.js.map +1 -1
  51. package/package.json +1 -1
package/dist/haori.es.js CHANGED
@@ -29,22 +29,22 @@ const O = class O {
29
29
  }
30
30
  };
31
31
  O.devMode = !1;
32
- let I = O;
33
- const W = "embedded";
34
- function Z(S) {
35
- return S === "embedded" || S === "demo";
32
+ let B = O;
33
+ const Y = "embedded";
34
+ function tt(F) {
35
+ return F === "embedded" || F === "demo";
36
36
  }
37
- function tt(S) {
38
- return S === null ? null : Z(S) ? S : W;
37
+ function et(F) {
38
+ return F === null ? null : tt(F) ? F : Y;
39
39
  }
40
- const M = class M {
40
+ const D = class D {
41
41
  /**
42
42
  * 実行モードを取得します。
43
43
  *
44
44
  * @returns 実行モード。
45
45
  */
46
46
  static get runtime() {
47
- return M._runtime;
47
+ return D._runtime;
48
48
  }
49
49
  /**
50
50
  * 実行モードを設定します。
@@ -53,7 +53,7 @@ const M = class M {
53
53
  * @return 戻り値はありません。
54
54
  */
55
55
  static setRuntime(t) {
56
- M._runtime = Z(t) ? t : W;
56
+ D._runtime = tt(t) ? t : Y;
57
57
  }
58
58
  /**
59
59
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -65,23 +65,23 @@ const M = class M {
65
65
  try {
66
66
  const t = document.currentScript || document.querySelector('script[src*="haori"]');
67
67
  if (t instanceof HTMLScriptElement) {
68
- const r = t.getAttribute("data-prefix") || M._prefix;
69
- M._prefix = r.endsWith("-") ? r : r + "-";
70
- const i = tt(
68
+ const r = t.getAttribute("data-prefix") || D._prefix;
69
+ D._prefix = r.endsWith("-") ? r : r + "-";
70
+ const i = et(
71
71
  t.getAttribute("data-runtime")
72
72
  );
73
- i !== null && (M._runtime = i);
73
+ i !== null && (D._runtime = i);
74
74
  }
75
- if (t instanceof HTMLScriptElement && t.hasAttribute(`${M._prefix}dev`)) {
76
- I.set(!0);
75
+ if (t instanceof HTMLScriptElement && t.hasAttribute(`${D._prefix}dev`)) {
76
+ B.set(!0);
77
77
  return;
78
78
  }
79
79
  const e = window.location.hostname;
80
80
  if (e === "localhost" || e.endsWith(".localhost") || e === "127.0.0.1" || e === "::1" || e.endsWith(".local")) {
81
- I.set(!0);
81
+ B.set(!0);
82
82
  return;
83
83
  }
84
- I.set(!1);
84
+ B.set(!1);
85
85
  } catch {
86
86
  }
87
87
  }
@@ -91,13 +91,13 @@ const M = class M {
91
91
  * @returns プレフィックス
92
92
  */
93
93
  static get prefix() {
94
- return M._prefix;
94
+ return D._prefix;
95
95
  }
96
96
  };
97
- M._prefix = "data-", M._runtime = W;
98
- let l = M;
97
+ D._prefix = "data-", D._runtime = Y;
98
+ let l = D;
99
99
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
100
- class h {
100
+ class f {
101
101
  /**
102
102
  * 開発モードでのみコンソールに情報を出力します。
103
103
  *
@@ -105,7 +105,7 @@ class h {
105
105
  * @param args 追加の引数
106
106
  */
107
107
  static info(t, ...e) {
108
- I.isEnabled() && console.log && console.log(t, ...e);
108
+ B.isEnabled() && console.log && console.log(t, ...e);
109
109
  }
110
110
  /**
111
111
  * 開発モードでのみコンソールに警告を出力します。
@@ -114,7 +114,7 @@ class h {
114
114
  * @param args 追加の引数
115
115
  */
116
116
  static warn(t, ...e) {
117
- I.isEnabled() && console.warn && console.warn(t, ...e);
117
+ B.isEnabled() && console.warn && console.warn(t, ...e);
118
118
  }
119
119
  /**
120
120
  * モードに関係なくコンソールにエラーを出力します。
@@ -126,7 +126,7 @@ class h {
126
126
  console.error(t, ...e);
127
127
  }
128
128
  }
129
- class et {
129
+ class rt {
130
130
  constructor() {
131
131
  this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
132
132
  }
@@ -168,13 +168,13 @@ class et {
168
168
  const r = await e.task();
169
169
  e.resolve(r);
170
170
  } catch (r) {
171
- e.reject(r), h.error("[Haori]", `Task ${e.timestamp} failed:`, r);
171
+ e.reject(r), f.error("[Haori]", `Task ${e.timestamp} failed:`, r);
172
172
  }
173
173
  if (performance.now() - t > this.MAX_BUDGET)
174
174
  break;
175
175
  }
176
176
  } catch (t) {
177
- h.error("[Haori]", "Error processing queue:", t);
177
+ f.error("[Haori]", "Error processing queue:", t);
178
178
  } finally {
179
179
  this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
180
180
  }
@@ -202,7 +202,7 @@ class et {
202
202
  t.length > 0 && await Promise.allSettled(t);
203
203
  }
204
204
  }
205
- const z = class z {
205
+ const Q = class Q {
206
206
  /**
207
207
  * タスクをキューに追加します。
208
208
  *
@@ -220,9 +220,9 @@ const z = class z {
220
220
  return this.ASYNC_QUEUE.wait();
221
221
  }
222
222
  };
223
- z.ASYNC_QUEUE = new et();
224
- let F = z;
225
- class _ {
223
+ Q.ASYNC_QUEUE = new rt();
224
+ let P = Q;
225
+ class X {
226
226
  /**
227
227
  * 実行モードを取得します。
228
228
  *
@@ -247,7 +247,7 @@ class _ {
247
247
  * @returns 通知が閉じられると解決されるPromise
248
248
  */
249
249
  static dialog(t) {
250
- return F.enqueue(() => {
250
+ return P.enqueue(() => {
251
251
  window.alert(t);
252
252
  }, !0);
253
253
  }
@@ -255,12 +255,12 @@ class _ {
255
255
  * 通知トーストを表示します。
256
256
  *
257
257
  * @param message 表示メッセージ
258
- * @param level メッセージのレベル('info' | 'warning' | 'error'
258
+ * @param level メッセージのレベル(省略時は 'info')
259
259
  * @return 通知が表示されると解決されるPromise
260
260
  */
261
- static async toast(t, e) {
261
+ static async toast(t, e = "info") {
262
262
  const r = document.createElement("div");
263
- r.className = `haori-toast haori-toast-${e}`, r.textContent = t, r.setAttribute("popover", "manual"), r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite"), document.body.appendChild(r), r.showPopover(), setTimeout(() => {
263
+ r.className = `haori-toast haori-toast-${e}`, r.textContent = t, r.setAttribute("popover", "manual"), r.setAttribute("role", "status"), r.setAttribute("aria-live", e === "error" ? "assertive" : "polite"), document.body.appendChild(r), r.showPopover(), setTimeout(() => {
264
264
  try {
265
265
  r.hidePopover();
266
266
  } finally {
@@ -275,7 +275,7 @@ class _ {
275
275
  * @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
276
276
  */
277
277
  static confirm(t) {
278
- return F.enqueue(() => window.confirm(t), !0);
278
+ return P.enqueue(() => window.confirm(t), !0);
279
279
  }
280
280
  /**
281
281
  * ダイアログを開きます。
@@ -283,8 +283,8 @@ class _ {
283
283
  * @param element 開くダイアログのHTML要素
284
284
  */
285
285
  static openDialog(t) {
286
- return F.enqueue(() => {
287
- t instanceof HTMLDialogElement ? t.showModal() : h.error("[Haori]", "Element is not a dialog: ", t);
286
+ return P.enqueue(() => {
287
+ t instanceof HTMLDialogElement ? t.showModal() : f.error("[Haori]", "Element is not a dialog: ", t);
288
288
  }, !0);
289
289
  }
290
290
  /**
@@ -293,8 +293,8 @@ class _ {
293
293
  * @param element 閉じるダイアログのHTML要素
294
294
  */
295
295
  static closeDialog(t) {
296
- return F.enqueue(() => {
297
- t instanceof HTMLDialogElement ? t.close() : h.error("[Haori]", "Element is not a dialog: ", t);
296
+ return P.enqueue(() => {
297
+ t instanceof HTMLDialogElement ? t.close() : f.error("[Haori]", "Element is not a dialog: ", t);
298
298
  }, !0);
299
299
  }
300
300
  /**
@@ -304,16 +304,19 @@ class _ {
304
304
  * @param message エラーメッセージ
305
305
  */
306
306
  static addErrorMessage(t, e) {
307
- return F.enqueue(() => {
308
- if (t instanceof HTMLFormElement) {
309
- t.setAttribute("data-message", e);
310
- return;
311
- }
312
- if (t.parentElement) {
313
- t.parentElement.setAttribute("data-message", e);
314
- return;
315
- }
316
- t.setAttribute("data-message", e);
307
+ return X.addMessage(t, e, "error");
308
+ }
309
+ /**
310
+ * メッセージをレベル付きで追加します。
311
+ *
312
+ * @param target メッセージを表示する要素
313
+ * @param message メッセージ
314
+ * @param level メッセージのレベル(省略可能)
315
+ */
316
+ static addMessage(t, e, r) {
317
+ return P.enqueue(() => {
318
+ const i = t instanceof HTMLFormElement ? t : t.parentElement ?? t;
319
+ i.setAttribute("data-message", e), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
317
320
  }, !0);
318
321
  }
319
322
  /**
@@ -322,21 +325,21 @@ class _ {
322
325
  * @param parent メッセージをクリアする親要素
323
326
  */
324
327
  static clearMessages(t) {
325
- return F.enqueue(() => {
326
- t.removeAttribute("data-message"), t.querySelectorAll("[data-message]").forEach((e) => {
327
- e.removeAttribute("data-message");
328
+ return P.enqueue(() => {
329
+ t.removeAttribute("data-message"), t.removeAttribute("data-message-level"), t.querySelectorAll("[data-message]").forEach((e) => {
330
+ e.removeAttribute("data-message"), e.removeAttribute("data-message-level");
328
331
  });
329
332
  }, !0);
330
333
  }
331
334
  }
332
- const rt = ["addErrorMessage", "clearMessages"];
333
- function Q() {
335
+ const it = ["addErrorMessage", "clearMessages"];
336
+ function _() {
334
337
  const t = globalThis.window?.Haori;
335
- return rt.every(
338
+ return it.every(
336
339
  (r) => typeof t?.[r] == "function"
337
- ) ? t : _;
340
+ ) ? t : X;
338
341
  }
339
- class m {
342
+ class b {
340
343
  /**
341
344
  * フォーム内にある入力エレメントの値をオブジェクトとして取得します。
342
345
  * data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
@@ -347,7 +350,7 @@ class m {
347
350
  */
348
351
  static getValues(t) {
349
352
  const e = {};
350
- return m.getPartValues(t, e);
353
+ return b.getPartValues(t, e);
351
354
  }
352
355
  /**
353
356
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
@@ -360,17 +363,17 @@ class m {
360
363
  static getPartValues(t, e) {
361
364
  const r = t.getAttribute("name"), i = t.getAttribute(`${l.prefix}form-object`), s = t.getAttribute(`${l.prefix}form-list`);
362
365
  if (r) {
363
- s ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && h.warn(
366
+ s ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && f.warn(
364
367
  "Haori",
365
368
  `Element cannot have both ${l.prefix}form-object and name attributes.`
366
369
  );
367
370
  for (const n of t.getChildElementFragments())
368
- m.getPartValues(n, e);
371
+ b.getPartValues(n, e);
369
372
  } else if (i) {
370
373
  const n = {};
371
374
  for (const a of t.getChildElementFragments())
372
- m.getPartValues(a, n);
373
- Object.keys(n).length > 0 && (e[String(i)] = n), s && h.warn(
375
+ b.getPartValues(a, n);
376
+ Object.keys(n).length > 0 && (e[String(i)] = n), s && f.warn(
374
377
  "Haori",
375
378
  `Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
376
379
  );
@@ -378,12 +381,12 @@ class m {
378
381
  const n = [];
379
382
  for (const a of t.getChildElementFragments()) {
380
383
  const o = {};
381
- m.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
384
+ b.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
382
385
  }
383
386
  n.length > 0 && (e[String(s)] = n);
384
387
  } else
385
388
  for (const n of t.getChildElementFragments())
386
- m.getPartValues(n, e);
389
+ b.getPartValues(n, e);
387
390
  return e;
388
391
  }
389
392
  /**
@@ -396,7 +399,7 @@ class m {
396
399
  * @returns Promise(DOMの更新が完了したら解決される)
397
400
  */
398
401
  static setValues(t, e, r = !1) {
399
- return m.setPartValues(t, e, null, r, !0);
402
+ return b.setPartValues(t, e, null, r, !0);
400
403
  }
401
404
  /**
402
405
  * フォーム内にある入力エレメントに値をイベントなしで設定します。
@@ -408,7 +411,7 @@ class m {
408
411
  * @returns Promise(DOMの更新が完了したら解決される)
409
412
  */
410
413
  static syncValues(t, e, r = !1) {
411
- return m.setPartValues(t, e, null, r, !1);
414
+ return b.setPartValues(t, e, null, r, !1);
412
415
  }
413
416
  /**
414
417
  * 単一フラグメントへ値を設定します。
@@ -431,50 +434,50 @@ class m {
431
434
  * @returns Promise(DOMの更新が完了したら解決される)
432
435
  */
433
436
  static setPartValues(t, e, r = null, i = !1, s = !0) {
434
- const n = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), d = t.getAttribute(`${l.prefix}form-list`), y = t.getAttribute(`${l.prefix}form-detach`);
437
+ const n = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), d = t.getAttribute(`${l.prefix}form-list`), m = t.getAttribute(`${l.prefix}form-detach`);
435
438
  if (a) {
436
- if (!y || i) {
437
- const b = e[String(a)];
438
- d && Array.isArray(b) && r !== null ? n.push(
439
- m.applyFragmentValue(t, b[r] ?? null, s)
440
- ) : typeof b == "string" || typeof b == "number" || typeof b == "boolean" || b === null ? n.push(m.applyFragmentValue(t, b, s)) : n.push(
441
- m.applyFragmentValue(t, String(b), s)
442
- );
439
+ if (!m || i) {
440
+ const y = e[String(a)];
441
+ d && Array.isArray(y) && r !== null ? n.push(
442
+ b.applyFragmentValue(t, y[r] ?? null, s)
443
+ ) : typeof y > "u" || (typeof y == "string" || typeof y == "number" || typeof y == "boolean" || y === null ? n.push(b.applyFragmentValue(t, y, s)) : n.push(
444
+ b.applyFragmentValue(t, String(y), s)
445
+ ));
443
446
  }
444
447
  } else if (o) {
445
- const b = e[String(o)];
446
- if (b && typeof b == "object")
447
- for (const v of t.getChildElementFragments())
448
+ const y = e[String(o)];
449
+ if (y && typeof y == "object")
450
+ for (const E of t.getChildElementFragments())
448
451
  n.push(
449
- m.setPartValues(
450
- v,
451
- b,
452
+ b.setPartValues(
453
+ E,
454
+ y,
452
455
  null,
453
456
  i,
454
457
  s
455
458
  )
456
459
  );
457
460
  } else if (d) {
458
- const b = e[String(d)];
459
- if (Array.isArray(b)) {
460
- const v = t.getChildElementFragments();
461
- for (let f = 0; f < v.length; f++) {
462
- const u = v[f];
463
- b.length > f ? n.push(
464
- m.setPartValues(
461
+ const y = e[String(d)];
462
+ if (Array.isArray(y)) {
463
+ const E = t.getChildElementFragments();
464
+ for (let S = 0; S < E.length; S++) {
465
+ const u = E[S];
466
+ y.length > S ? n.push(
467
+ b.setPartValues(
465
468
  u,
466
- b[f],
467
- f,
469
+ y[S],
470
+ S,
468
471
  i,
469
472
  s
470
473
  )
471
- ) : n.push(m.setPartValues(u, {}, f, i, s));
474
+ ) : n.push(b.setPartValues(u, {}, S, i, s));
472
475
  }
473
476
  }
474
477
  } else
475
- for (const b of t.getChildElementFragments())
478
+ for (const y of t.getChildElementFragments())
476
479
  n.push(
477
- m.setPartValues(b, e, null, i, s)
480
+ b.setPartValues(y, e, null, i, s)
478
481
  );
479
482
  return Promise.all(n).then(() => {
480
483
  });
@@ -487,10 +490,10 @@ class m {
487
490
  * @returns すべての初期化処理が完了するPromise
488
491
  */
489
492
  static async reset(t) {
490
- m.clearValues(t), await Promise.all([
491
- m.clearMessages(t),
492
- m.clearEachClones(t)
493
- ]), await F.enqueue(() => {
493
+ b.clearValues(t), await Promise.all([
494
+ b.clearMessages(t),
495
+ b.clearEachClones(t)
496
+ ]), await P.enqueue(() => {
494
497
  const e = t.getTarget();
495
498
  if (e instanceof HTMLFormElement)
496
499
  e.reset();
@@ -535,7 +538,7 @@ class m {
535
538
  static clearValues(t) {
536
539
  t.clearValue();
537
540
  for (const e of t.getChildElementFragments())
538
- m.clearValues(e);
541
+ b.clearValues(e);
539
542
  }
540
543
  /**
541
544
  * フラグメントとその子要素のメッセージをクリアします。
@@ -544,7 +547,7 @@ class m {
544
547
  * @returns Promise(メッセージのクリアが完了したら解決される)
545
548
  */
546
549
  static clearMessages(t) {
547
- return Q().clearMessages(
550
+ return _().clearMessages(
548
551
  t.getTarget()
549
552
  );
550
553
  }
@@ -554,18 +557,27 @@ class m {
554
557
  *
555
558
  * @param fragment 対象フラグメント
556
559
  * @param key キー(ドット区切りの文字列)
557
- * @param message 追加するエラーメッセージ]
560
+ * @param message 追加するエラーメッセージ
558
561
  * @return Promise(メッセージの追加が完了したら解決される)
559
562
  */
560
563
  static addErrorMessage(t, e, r) {
561
- const i = [], s = Q(), n = m.findFragmentsByKey(t, e);
562
- return n.forEach((a) => {
563
- i.push(
564
- s.addErrorMessage(a.getTarget(), r)
565
- );
566
- }), n.length === 0 && i.push(
567
- s.addErrorMessage(t.getTarget(), r)
568
- ), Promise.all(i).then(() => {
564
+ return b.addMessage(t, e, r, "error");
565
+ }
566
+ /**
567
+ * キーに一致するフラグメントにレベル付きメッセージを追加します。
568
+ * キーに一致するフラグメントが見つからない場合は、指定されたフラグメントにメッセージを追加します。
569
+ *
570
+ * @param fragment 対象フラグメント
571
+ * @param key キー(ドット区切りの文字列)
572
+ * @param message 追加するメッセージ
573
+ * @param level メッセージのレベル(省略可能)
574
+ * @return Promise(メッセージの追加が完了したら解決される)
575
+ */
576
+ static addMessage(t, e, r, i) {
577
+ const s = [], n = _(), a = n.addMessage, o = (m) => typeof a == "function" ? a.call(n, m, r, i) : n.addErrorMessage(m, r), d = b.findFragmentsByKey(t, e);
578
+ return d.forEach((m) => {
579
+ s.push(o(m.getTarget()));
580
+ }), d.length === 0 && s.push(o(t.getTarget())), Promise.all(s).then(() => {
569
581
  });
570
582
  }
571
583
  /**
@@ -576,7 +588,7 @@ class m {
576
588
  * @returns 一致するフラグメントの配列
577
589
  */
578
590
  static findFragmentsByKey(t, e) {
579
- return m.findFragmentByKeyParts(t, e.split("."));
591
+ return b.findFragmentByKeyParts(t, e.split("."));
580
592
  }
581
593
  /**
582
594
  * 指定されたキーに一致するフラグメントを検索します。
@@ -590,7 +602,7 @@ class m {
590
602
  const r = [], i = e[0];
591
603
  if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
592
604
  e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((n) => {
593
- r.push(...m.findFragmentByKeyParts(n, e.slice(1)));
605
+ r.push(...b.findFragmentByKeyParts(n, e.slice(1)));
594
606
  });
595
607
  else if (t.hasAttribute(`${l.prefix}form-list`)) {
596
608
  if (e.length > 1) {
@@ -598,13 +610,13 @@ class m {
598
610
  if (n !== -1 && a !== -1 && n < a) {
599
611
  const o = i.substring(0, n);
600
612
  if (s === o) {
601
- const d = i.substring(n + 1, a), y = Number(d);
602
- if (isNaN(y))
603
- h.error("Haori", `Invalid index: ${i}`);
613
+ const d = i.substring(n + 1, a), m = Number(d);
614
+ if (isNaN(m))
615
+ f.error("Haori", `Invalid index: ${i}`);
604
616
  else {
605
- const b = t.getChildElementFragments().filter((v) => v.hasAttribute(`${l.prefix}row`));
606
- y < b.length && r.push(
607
- ...m.findFragmentByKeyParts(b[y], e.slice(1))
617
+ const y = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
618
+ m < y.length && r.push(
619
+ ...b.findFragmentByKeyParts(y[m], e.slice(1))
608
620
  );
609
621
  }
610
622
  }
@@ -612,7 +624,7 @@ class m {
612
624
  }
613
625
  } else
614
626
  t.getChildElementFragments().forEach((s) => {
615
- r.push(...m.findFragmentByKeyParts(s, e));
627
+ r.push(...b.findFragmentByKeyParts(s, e));
616
628
  });
617
629
  return r;
618
630
  }
@@ -629,7 +641,7 @@ class m {
629
641
  return r ? this.getFormFragment(r) : null;
630
642
  }
631
643
  }
632
- const P = class P {
644
+ const M = class M {
633
645
  /**
634
646
  * 明示バインド内に持ち込まれてはならない危険値を返します。
635
647
  *
@@ -674,13 +686,13 @@ const P = class P {
674
686
  */
675
687
  static evaluate(t, e = {}) {
676
688
  if (t.trim() === "")
677
- return h.warn("[Haori]", t, "Expression is empty"), null;
689
+ return f.warn("[Haori]", t, "Expression is empty"), null;
678
690
  if (this.containsDangerousPatterns(t))
679
- return h.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
691
+ return f.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
680
692
  if (this.containsForbiddenKeys(e))
681
- return h.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
693
+ return f.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
682
694
  if (this.containsForbiddenBindingValues(e))
683
- return h.warn(
695
+ return f.warn(
684
696
  "[Haori]",
685
697
  e,
686
698
  "Binded values contain forbidden values"
@@ -695,7 +707,7 @@ return (${t});`;
695
707
  try {
696
708
  s = new Function(...r, a), this.EXPRESSION_CACHE.set(i, s);
697
709
  } catch (o) {
698
- return h.error(
710
+ return f.error(
699
711
  "[Haori]",
700
712
  "Failed to compile expression:",
701
713
  t,
@@ -709,7 +721,7 @@ return (${t});`;
709
721
  n.push(a[o]);
710
722
  }), this.withBlockedPropertyAccess(() => s(...n));
711
723
  } catch (n) {
712
- return h.error("[Haori]", "Expression evaluation error:", t, n), n instanceof ReferenceError ? void 0 : null;
724
+ return f.error("[Haori]", "Expression evaluation error:", t, n), n instanceof ReferenceError ? void 0 : null;
713
725
  }
714
726
  }
715
727
  /**
@@ -1122,7 +1134,7 @@ return (${t});`;
1122
1134
  return !1;
1123
1135
  }
1124
1136
  };
1125
- P.FORBIDDEN_NAMES = [
1137
+ M.FORBIDDEN_NAMES = [
1126
1138
  // グローバルオブジェクト
1127
1139
  "window",
1128
1140
  "self",
@@ -1154,19 +1166,19 @@ P.FORBIDDEN_NAMES = [
1154
1166
  "sessionStorage",
1155
1167
  "IndexedDB",
1156
1168
  "history"
1157
- ], P.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], P.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), P.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
1158
- ...P.FORBIDDEN_NAMES.filter(
1159
- (t) => !P.REBINDABLE_FORBIDDEN_NAMES.has(t)
1169
+ ], M.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], M.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), M.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
1170
+ ...M.FORBIDDEN_NAMES.filter(
1171
+ (t) => !M.REBINDABLE_FORBIDDEN_NAMES.has(t)
1160
1172
  ),
1161
1173
  "constructor",
1162
1174
  "__proto__",
1163
1175
  "prototype",
1164
- ...P.STRICT_FORBIDDEN_NAMES
1165
- ]), P.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
1176
+ ...M.STRICT_FORBIDDEN_NAMES
1177
+ ]), M.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
1166
1178
  "constructor",
1167
1179
  "__proto__",
1168
1180
  "prototype"
1169
- ]), P.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
1181
+ ]), M.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
1170
1182
  "await",
1171
1183
  "break",
1172
1184
  "case",
@@ -1200,8 +1212,8 @@ P.FORBIDDEN_NAMES = [
1200
1212
  "while",
1201
1213
  "with",
1202
1214
  "yield"
1203
- ]), P.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
1204
- let j = P;
1215
+ ]), M.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
1216
+ let j = M;
1205
1217
  const C = class C {
1206
1218
  /**
1207
1219
  * フラグメントのコンストラクタ。
@@ -1219,16 +1231,16 @@ const C = class C {
1219
1231
  let e;
1220
1232
  switch (t.nodeType) {
1221
1233
  case Node.ELEMENT_NODE:
1222
- e = new D(t);
1234
+ e = new R(t);
1223
1235
  break;
1224
1236
  case Node.TEXT_NODE:
1225
- e = new L(t);
1237
+ e = new H(t);
1226
1238
  break;
1227
1239
  case Node.COMMENT_NODE:
1228
- e = new Y(t);
1240
+ e = new z(t);
1229
1241
  break;
1230
1242
  default:
1231
- return h.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1243
+ return f.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1232
1244
  }
1233
1245
  return e;
1234
1246
  }
@@ -1250,7 +1262,7 @@ const C = class C {
1250
1262
  return Promise.resolve();
1251
1263
  if (this.parent) {
1252
1264
  const t = this.parent, e = t.skipMutationNodes;
1253
- return F.enqueue(() => {
1265
+ return P.enqueue(() => {
1254
1266
  t.skipMutationNodes = !0, this.target.parentNode === t.getTarget() && t.getTarget().removeChild(this.target), this.mounted = !1;
1255
1267
  }).finally(() => {
1256
1268
  t.skipMutationNodes = e;
@@ -1258,7 +1270,7 @@ const C = class C {
1258
1270
  } else {
1259
1271
  const t = this.target.parentNode;
1260
1272
  if (t)
1261
- return F.enqueue(() => {
1273
+ return P.enqueue(() => {
1262
1274
  this.target.parentNode === t && t.removeChild(this.target), this.mounted = !1;
1263
1275
  });
1264
1276
  this.mounted = !1;
@@ -1275,7 +1287,7 @@ const C = class C {
1275
1287
  return Promise.resolve();
1276
1288
  if (this.parent) {
1277
1289
  const t = this.parent, e = t.skipMutationNodes;
1278
- return F.enqueue(() => {
1290
+ return P.enqueue(() => {
1279
1291
  t.skipMutationNodes = !0, this.target.parentNode !== t.getTarget() && t.getTarget().appendChild(this.target), this.mounted = !0;
1280
1292
  }).finally(() => {
1281
1293
  t.skipMutationNodes = e;
@@ -1334,8 +1346,8 @@ const C = class C {
1334
1346
  }
1335
1347
  };
1336
1348
  C.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1337
- let N = C;
1338
- class D extends N {
1349
+ let T = C;
1350
+ class R extends T {
1339
1351
  /**
1340
1352
  * エレメントフラグメントのコンストラクタ。
1341
1353
  * アトリビュートや子フラグメントの作成も行います。
@@ -1361,11 +1373,11 @@ class D extends N {
1361
1373
  ], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingDataCache = null, this.visible = !0, this.display = null, this.template = null, this.listKey = null, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.syncValue(), t.getAttributeNames().forEach((e) => {
1362
1374
  const r = t.getAttribute(e);
1363
1375
  if (r !== null && !this.attributeMap.has(e)) {
1364
- const i = new q(e, r);
1376
+ const i = new U(e, r);
1365
1377
  this.attributeMap.set(e, i);
1366
1378
  }
1367
1379
  }), t.childNodes.forEach((e) => {
1368
- const r = N.get(e);
1380
+ const r = T.get(e);
1369
1381
  r.setParent(this), this.children.push(r);
1370
1382
  });
1371
1383
  }
@@ -1384,7 +1396,7 @@ class D extends N {
1384
1396
  */
1385
1397
  getChildElementFragments() {
1386
1398
  return this.children.filter(
1387
- (t) => t instanceof D
1399
+ (t) => t instanceof R
1388
1400
  );
1389
1401
  }
1390
1402
  /**
@@ -1405,7 +1417,7 @@ class D extends N {
1405
1417
  removeChild(t) {
1406
1418
  const e = this.children.indexOf(t);
1407
1419
  if (e < 0) {
1408
- h.warn("[Haori]", "Child fragment not found.", t);
1420
+ f.warn("[Haori]", "Child fragment not found.", t);
1409
1421
  return;
1410
1422
  }
1411
1423
  this.children.splice(e, 1), t.setParent(null);
@@ -1416,7 +1428,7 @@ class D extends N {
1416
1428
  * @returns クローンされたフラグメント
1417
1429
  */
1418
1430
  clone() {
1419
- const t = new D(
1431
+ const t = new R(
1420
1432
  this.target.cloneNode(!1)
1421
1433
  );
1422
1434
  return this.attributeMap.forEach((e, r) => {
@@ -1484,7 +1496,7 @@ class D extends N {
1484
1496
  */
1485
1497
  clearBindingDataCache() {
1486
1498
  this.bindingDataCache = null, this.children.forEach((t) => {
1487
- t instanceof D && t.clearBindingDataCache();
1499
+ t instanceof R && t.clearBindingDataCache();
1488
1500
  });
1489
1501
  }
1490
1502
  /**
@@ -1554,16 +1566,16 @@ class D extends N {
1554
1566
  if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
1555
1567
  const i = this.getAttribute("value"), s = r.type === "checkbox" && i === "true";
1556
1568
  let n;
1557
- return s ? n = t === !0 || t === "true" : i === "false" ? n = t === !1 : n = i === String(t), this.value = s ? n : n ? t : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, F.enqueue(() => {
1569
+ return s ? n = t === !0 || t === "true" : i === "false" ? n = t === !1 : n = i === String(t), this.value = s ? n : n ? t : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, P.enqueue(() => {
1558
1570
  r.checked = n, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
1559
1571
  }).finally(() => {
1560
1572
  this.skipChangeValue = !1;
1561
1573
  }));
1562
- } else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0, F.enqueue(() => {
1574
+ } else return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0, P.enqueue(() => {
1563
1575
  r.value = t === null ? "" : String(t), e && ((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 })));
1564
1576
  }).finally(() => {
1565
1577
  this.skipChangeValue = !1;
1566
- })) : (h.warn(
1578
+ })) : (f.warn(
1567
1579
  "[Haori]",
1568
1580
  "setValue is not supported for this element type.",
1569
1581
  r
@@ -1614,19 +1626,60 @@ class D extends N {
1614
1626
  * @returns 属性の更新のPromise
1615
1627
  */
1616
1628
  setAttribute(t, e) {
1629
+ return this.setAttributeInternal(t, t, e, !0);
1630
+ }
1631
+ /**
1632
+ * data-attr-* の生値を保持しつつ、別名の属性へ評価結果を反映します。
1633
+ *
1634
+ * @param rawName 生の属性名
1635
+ * @param targetName 反映先の属性名
1636
+ * @param value 生の属性値
1637
+ * @returns 属性更新の Promise
1638
+ */
1639
+ setAliasedAttribute(t, e, r) {
1640
+ return this.setAttributeInternal(t, e, r, !1);
1641
+ }
1642
+ /**
1643
+ * data-attr-* の生属性と反映先属性を同時に削除します。
1644
+ *
1645
+ * @param rawName 生の属性名
1646
+ * @param targetName 反映先の属性名
1647
+ * @returns 属性削除の Promise
1648
+ */
1649
+ removeAliasedAttribute(t, e) {
1617
1650
  if (this.skipMutationAttributes)
1618
1651
  return Promise.resolve();
1619
- if (e === null)
1620
- return this.removeAttribute(t);
1621
- const r = new q(t, e);
1622
- this.attributeMap.set(t, r), this.skipMutationAttributes = !0;
1623
- const i = this.getTarget(), s = r.isForceEvaluation() ? e : this.getAttribute(t);
1624
- return F.enqueue(() => {
1625
- if (s === null || s === !1)
1626
- i.removeAttribute(t);
1652
+ this.attributeMap.delete(t), this.skipMutationAttributes = !0;
1653
+ const r = this.getTarget();
1654
+ return P.enqueue(() => {
1655
+ r.removeAttribute(t), e !== t && r.removeAttribute(e);
1656
+ }).finally(() => {
1657
+ this.skipMutationAttributes = !1;
1658
+ });
1659
+ }
1660
+ /**
1661
+ * 生の属性値を保持しつつ、必要に応じて別名属性へ評価結果を反映します。
1662
+ *
1663
+ * @param rawName 生の属性名
1664
+ * @param targetName 反映先の属性名
1665
+ * @param value 生の属性値
1666
+ * @param syncValueProperty value 属性更新時に DOM property も同期するかどうか
1667
+ * @returns 属性更新の Promise
1668
+ */
1669
+ setAttributeInternal(t, e, r, i) {
1670
+ if (this.skipMutationAttributes)
1671
+ return Promise.resolve();
1672
+ if (r === null)
1673
+ return t === e ? this.removeAttribute(t) : this.removeAliasedAttribute(t, e);
1674
+ const s = new U(t, r);
1675
+ this.attributeMap.set(t, s), this.skipMutationAttributes = !0;
1676
+ const n = this.getTarget(), a = s.isForceEvaluation() ? r : this.getAttribute(t);
1677
+ return P.enqueue(() => {
1678
+ if (n.getAttribute(t) !== r && n.setAttribute(t, r), a === null || a === !1)
1679
+ n.removeAttribute(e);
1627
1680
  else {
1628
- const n = String(s);
1629
- i.getAttribute(t) !== n && i.setAttribute(t, n), t === "value" && (i instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement) && (this.value = n, i.value !== n && (i.value = n));
1681
+ const o = String(a);
1682
+ n.getAttribute(e) !== o && n.setAttribute(e, o), i && s.isEvaluate && e === "value" && (n instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(n.type) || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && (this.value = o, n.value !== o && (n.value = o));
1630
1683
  }
1631
1684
  }).finally(() => {
1632
1685
  this.skipMutationAttributes = !1;
@@ -1643,7 +1696,7 @@ class D extends N {
1643
1696
  return Promise.resolve();
1644
1697
  this.attributeMap.delete(t), this.skipMutationAttributes = !0;
1645
1698
  const e = this.getTarget();
1646
- return F.enqueue(() => {
1699
+ return P.enqueue(() => {
1647
1700
  e.removeAttribute(t);
1648
1701
  }).finally(() => {
1649
1702
  this.skipMutationAttributes = !1;
@@ -1704,7 +1757,7 @@ class D extends N {
1704
1757
  const i = e ? r.nextSibling : r;
1705
1758
  let s = e ? r.nextSibling : r;
1706
1759
  for (; s !== null; ) {
1707
- const n = N.get(s);
1760
+ const n = T.get(s);
1708
1761
  if (n !== null) {
1709
1762
  const a = this.children.indexOf(n);
1710
1763
  if (a !== -1)
@@ -1726,42 +1779,42 @@ class D extends N {
1726
1779
  if (this.skipMutationNodes)
1727
1780
  return Promise.resolve();
1728
1781
  if (t === this)
1729
- return h.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1782
+ return f.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1730
1783
  const i = /* @__PURE__ */ new Set();
1731
1784
  let s = this.parent;
1732
1785
  for (; s; )
1733
1786
  i.add(s), s = s.getParent();
1734
1787
  if (i.has(t))
1735
- return h.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1788
+ return f.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1736
1789
  const n = t.getParent() === this;
1737
1790
  let a = -1, o = -1;
1738
1791
  n && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1739
1792
  const d = t.getParent();
1740
1793
  d !== null && d.removeChild(t);
1741
- let y = r === void 0 ? e?.getTarget() || null : r;
1794
+ let m = r === void 0 ? e?.getTarget() || null : r;
1742
1795
  if (e === null)
1743
1796
  this.children.push(t);
1744
1797
  else {
1745
- let v;
1746
- if (n ? a !== -1 && a < o ? v = o - 1 : v = o : v = this.children.indexOf(e), v === -1) {
1747
- const f = this.resolveInsertionPointFromDom(
1798
+ let E;
1799
+ if (n ? a !== -1 && a < o ? E = o - 1 : E = o : E = this.children.indexOf(e), E === -1) {
1800
+ const S = this.resolveInsertionPointFromDom(
1748
1801
  e,
1749
1802
  !1
1750
1803
  );
1751
- f === null ? (h.warn(
1804
+ S === null ? (f.warn(
1752
1805
  "[Haori]",
1753
1806
  "Reference child not found in children.",
1754
1807
  e
1755
- ), this.children.push(t)) : (this.children.splice(f.index, 0, t), y = f.referenceNode);
1808
+ ), this.children.push(t)) : (this.children.splice(S.index, 0, t), m = S.referenceNode);
1756
1809
  } else
1757
- this.children.splice(v, 0, t);
1810
+ this.children.splice(E, 0, t);
1758
1811
  }
1759
1812
  t.setParent(this), t.setMounted(this.mounted);
1760
- const b = this.skipMutationNodes;
1761
- return this.skipMutationNodes = !0, F.enqueue(() => {
1762
- this.target.insertBefore(t.getTarget(), y);
1813
+ const y = this.skipMutationNodes;
1814
+ return this.skipMutationNodes = !0, P.enqueue(() => {
1815
+ this.target.insertBefore(t.getTarget(), m);
1763
1816
  }).finally(() => {
1764
- this.skipMutationNodes = b;
1817
+ this.skipMutationNodes = y;
1765
1818
  });
1766
1819
  }
1767
1820
  /**
@@ -1780,7 +1833,7 @@ class D extends N {
1780
1833
  e,
1781
1834
  !0
1782
1835
  );
1783
- return i === null ? (h.warn(
1836
+ return i === null ? (f.warn(
1784
1837
  "[Haori]",
1785
1838
  "Reference child not found in children.",
1786
1839
  e
@@ -1856,7 +1909,7 @@ class D extends N {
1856
1909
  return e === null ? null : e.closestByAttribute(t);
1857
1910
  }
1858
1911
  }
1859
- class L extends N {
1912
+ class H extends T {
1860
1913
  /**
1861
1914
  * テキストフラグメントのコンストラクタ。
1862
1915
  * 対象テキストノードの内容を初期化します。
@@ -1872,7 +1925,7 @@ class L extends N {
1872
1925
  * @returns クローンされたフラグメント
1873
1926
  */
1874
1927
  clone() {
1875
- const t = new L(this.target.cloneNode(!0));
1928
+ const t = new H(this.target.cloneNode(!0));
1876
1929
  return t.mounted = !1, t.text = this.text, t.contents = this.contents, t;
1877
1930
  }
1878
1931
  /**
@@ -1900,7 +1953,7 @@ class L extends N {
1900
1953
  evaluate() {
1901
1954
  return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
1902
1955
  new Error("Parent fragment is required for raw evaluation")
1903
- ) : F.enqueue(() => {
1956
+ ) : P.enqueue(() => {
1904
1957
  this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
1905
1958
  this.parent.getBindingData()
1906
1959
  )[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
@@ -1911,7 +1964,7 @@ class L extends N {
1911
1964
  });
1912
1965
  }
1913
1966
  }
1914
- class Y extends N {
1967
+ class z extends T {
1915
1968
  /**
1916
1969
  * コメントフラグメントのコンストラクタ。
1917
1970
  * 対象コメントノードの内容を初期化します。
@@ -1927,7 +1980,7 @@ class Y extends N {
1927
1980
  * @returns クローンされたフラグメント
1928
1981
  */
1929
1982
  clone() {
1930
- const t = new Y(this.target.cloneNode(!0));
1983
+ const t = new z(this.target.cloneNode(!0));
1931
1984
  return t.mounted = !1, t.text = this.text, t;
1932
1985
  }
1933
1986
  /**
@@ -1945,14 +1998,14 @@ class Y extends N {
1945
1998
  * @return 更新のPromise
1946
1999
  */
1947
2000
  setContent(t) {
1948
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, F.enqueue(() => {
2001
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, P.enqueue(() => {
1949
2002
  this.skipMutation = !0, this.target.textContent = this.text;
1950
2003
  }).finally(() => {
1951
2004
  this.skipMutation = !1;
1952
2005
  }));
1953
2006
  }
1954
2007
  }
1955
- const K = class K {
2008
+ const G = class G {
1956
2009
  /**
1957
2010
  * コンストラクタ。
1958
2011
  *
@@ -1960,7 +2013,7 @@ const K = class K {
1960
2013
  */
1961
2014
  constructor(t) {
1962
2015
  this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = t;
1963
- const e = [...t.matchAll(K.PLACEHOLDER_REGEX)];
2016
+ const e = [...t.matchAll(G.PLACEHOLDER_REGEX)];
1964
2017
  let r = 0, i = !1, s = !1;
1965
2018
  for (const n of e) {
1966
2019
  n.index > r && this.contents.push({
@@ -2003,7 +2056,7 @@ const K = class K {
2003
2056
  */
2004
2057
  checkRawExpressions() {
2005
2058
  for (let t = 0; t < this.contents.length; t++)
2006
- this.contents[t].type === 2 && this.contents.length > 1 && (h.error(
2059
+ this.contents[t].type === 2 && this.contents.length > 1 && (f.error(
2007
2060
  "[Haori]",
2008
2061
  "Raw expressions are not allowed in multi-content expressions."
2009
2062
  ), this.contents[t].type = 1);
@@ -2026,7 +2079,7 @@ const K = class K {
2026
2079
  } else
2027
2080
  e.push(r.text);
2028
2081
  } catch (i) {
2029
- h.error(
2082
+ f.error(
2030
2083
  "[Haori]",
2031
2084
  `Error evaluating text expression: ${r.text}`,
2032
2085
  i
@@ -2035,9 +2088,9 @@ const K = class K {
2035
2088
  }), e;
2036
2089
  }
2037
2090
  };
2038
- K.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2039
- let $ = K;
2040
- const J = class J extends $ {
2091
+ G.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2092
+ let $ = G;
2093
+ const K = class K extends $ {
2041
2094
  /**
2042
2095
  * コンストラクタ。
2043
2096
  *
@@ -2045,7 +2098,7 @@ const J = class J extends $ {
2045
2098
  * @param text 属性値
2046
2099
  */
2047
2100
  constructor(t, e) {
2048
- super(e), this.forceEvaluation = J.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2101
+ super(e), this.forceEvaluation = K.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2049
2102
  }
2050
2103
  /**
2051
2104
  * 強制評価フラグを取得します。
@@ -2073,26 +2126,26 @@ const J = class J extends $ {
2073
2126
  } else
2074
2127
  e.push(r.text);
2075
2128
  } catch (i) {
2076
- h.error(
2129
+ f.error(
2077
2130
  "[Haori]",
2078
2131
  `Error evaluating attribute expression: ${r.text}`,
2079
2132
  i
2080
2133
  ), e.push("");
2081
2134
  }
2082
- }), this.forceEvaluation && e.length > 1 ? (h.error(
2135
+ }), this.forceEvaluation && e.length > 1 ? (f.error(
2083
2136
  "[Haori]",
2084
2137
  "each or if expressions must have a single content.",
2085
2138
  e
2086
2139
  ), [e[0]]) : e;
2087
2140
  }
2088
2141
  };
2089
- J.FORCE_EVALUATION_ATTRIBUTES = [
2142
+ K.FORCE_EVALUATION_ATTRIBUTES = [
2090
2143
  "data-if",
2091
2144
  "hor-if",
2092
2145
  "data-each",
2093
2146
  "hor-each"
2094
2147
  ];
2095
- let q = J;
2148
+ let U = K;
2096
2149
  class w {
2097
2150
  /**
2098
2151
  * カスタムイベントを発火します。
@@ -2175,8 +2228,8 @@ class w {
2175
2228
  static bindChange(t, e, r, i = "other") {
2176
2229
  const s = [], n = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...n, ...a]);
2177
2230
  for (const d of o) {
2178
- const y = e?.[d], b = r[d];
2179
- y !== b && s.push(d);
2231
+ const m = e?.[d], y = r[d];
2232
+ m !== y && s.push(d);
2180
2233
  }
2181
2234
  w.dispatch(t, "bindchange", {
2182
2235
  previous: e || {},
@@ -2301,7 +2354,7 @@ class w {
2301
2354
  });
2302
2355
  }
2303
2356
  }
2304
- const it = [
2357
+ const st = [
2305
2358
  "addErrorMessage",
2306
2359
  "closeDialog",
2307
2360
  "confirm",
@@ -2309,25 +2362,25 @@ const it = [
2309
2362
  "openDialog",
2310
2363
  "toast"
2311
2364
  ];
2312
- function X() {
2365
+ function W() {
2313
2366
  const t = globalThis.window?.Haori;
2314
- return it.every(
2367
+ return st.every(
2315
2368
  (r) => typeof t?.[r] == "function"
2316
- ) ? t : _;
2369
+ ) ? t : X;
2317
2370
  }
2318
- const st = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
2319
- function nt(S) {
2320
- return st.has(S.toUpperCase());
2371
+ const nt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
2372
+ function at(F) {
2373
+ return nt.has(F.toUpperCase());
2321
2374
  }
2322
- function at(S, t) {
2375
+ function ot(F, t) {
2323
2376
  for (const [e, r] of Object.entries(t))
2324
- r !== void 0 && (r === null ? S.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
2325
- S.append(e, String(i));
2326
- }) : typeof r == "object" || typeof r == "function" ? S.append(e, JSON.stringify(r)) : S.append(e, String(r)));
2377
+ r !== void 0 && (r === null ? F.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
2378
+ F.append(e, String(i));
2379
+ }) : typeof r == "object" || typeof r == "function" ? F.append(e, JSON.stringify(r)) : F.append(e, String(r)));
2327
2380
  }
2328
- function ot(S, t) {
2329
- const e = new URL(S, window.location.href), r = new URLSearchParams(e.search);
2330
- return at(r, t), e.search = r.toString(), e.toString();
2381
+ function lt(F, t) {
2382
+ const e = new URL(F, window.location.href), r = new URLSearchParams(e.search);
2383
+ return ot(r, t), e.search = r.toString(), e.toString();
2331
2384
  }
2332
2385
  const c = class c {
2333
2386
  /**
@@ -2465,26 +2518,27 @@ const c = class c {
2465
2518
  if (e) {
2466
2519
  if (t.hasAttribute(c.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(c.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2467
2520
  c.attrName(e, "confirm")
2468
- )), t.hasAttribute(c.attrName(e, "data")) && (r.data = c.resolveDataAttribute(
2521
+ ).replace(/\\n/g, `
2522
+ `)), t.hasAttribute(c.attrName(e, "data")) && (r.data = c.resolveDataAttribute(
2469
2523
  t,
2470
2524
  c.attrName(e, "data")
2471
2525
  )), t.hasAttribute(c.attrName(e, "form"))) {
2472
- const f = t.getRawAttribute(
2526
+ const u = t.getRawAttribute(
2473
2527
  c.attrName(e, "form")
2474
2528
  );
2475
- if (f) {
2476
- const u = document.body.querySelector(f);
2477
- u !== null ? r.formFragment = m.getFormFragment(
2478
- N.get(u)
2479
- ) : h.error(
2529
+ if (u) {
2530
+ const h = document.body.querySelector(u);
2531
+ h !== null ? r.formFragment = b.getFormFragment(
2532
+ T.get(h)
2533
+ ) : f.error(
2480
2534
  "Haori",
2481
- `Form element not found: ${f} (${c.attrName(e, "form")})`
2535
+ `Form element not found: ${u} (${c.attrName(e, "form")})`
2482
2536
  );
2483
2537
  } else
2484
- r.formFragment = m.getFormFragment(t);
2485
- } else e === "change" && (r.formFragment = m.getFormFragment(t));
2538
+ r.formFragment = b.getFormFragment(t);
2539
+ } else e === "change" && (r.formFragment = b.getFormFragment(t));
2486
2540
  if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
2487
- const f = t.getRawAttribute(
2541
+ const u = t.getRawAttribute(
2488
2542
  `${l.prefix}${e}-before-run`
2489
2543
  );
2490
2544
  try {
@@ -2493,11 +2547,11 @@ const c = class c {
2493
2547
  "fetchOptions",
2494
2548
  `
2495
2549
  "use strict";
2496
- ${f}
2550
+ ${u}
2497
2551
  `
2498
2552
  );
2499
- } catch (u) {
2500
- h.error("Haori", `Invalid before script: ${u}`);
2553
+ } catch (h) {
2554
+ f.error("Haori", `Invalid before script: ${h}`);
2501
2555
  }
2502
2556
  }
2503
2557
  }
@@ -2505,58 +2559,58 @@ ${f}
2505
2559
  s && (r.fetchUrl = t.getAttribute(i));
2506
2560
  const n = {};
2507
2561
  if (e) {
2508
- const f = c.attrName(e, "fetch-method");
2509
- t.hasAttribute(f) && (n.method = t.getAttribute(
2510
- f
2562
+ const u = c.attrName(e, "fetch-method");
2563
+ t.hasAttribute(u) && (n.method = t.getAttribute(
2564
+ u
2511
2565
  ));
2512
2566
  } else {
2513
- const f = c.attrName(null, "method", !0);
2514
- t.hasAttribute(f) && (n.method = t.getAttribute(
2515
- f
2567
+ const u = c.attrName(null, "method", !0);
2568
+ t.hasAttribute(u) && (n.method = t.getAttribute(
2569
+ u
2516
2570
  ));
2517
2571
  }
2518
2572
  if (e) {
2519
- const f = c.attrName(e, "fetch-headers");
2520
- if (t.hasAttribute(f)) {
2521
- const u = t.getRawAttribute(
2522
- f
2573
+ const u = c.attrName(e, "fetch-headers");
2574
+ if (t.hasAttribute(u)) {
2575
+ const h = t.getRawAttribute(
2576
+ u
2523
2577
  );
2524
2578
  try {
2525
- n.headers = x.parseDataBind(u);
2526
- } catch (p) {
2527
- h.error("Haori", `Invalid fetch headers: ${p}`);
2579
+ n.headers = x.parseDataBind(h);
2580
+ } catch (g) {
2581
+ f.error("Haori", `Invalid fetch headers: ${g}`);
2528
2582
  }
2529
2583
  }
2530
2584
  } else {
2531
- const f = c.attrName(
2585
+ const u = c.attrName(
2532
2586
  null,
2533
2587
  "headers",
2534
2588
  !0
2535
2589
  );
2536
- if (t.hasAttribute(f)) {
2537
- const u = t.getRawAttribute(
2538
- f
2590
+ if (t.hasAttribute(u)) {
2591
+ const h = t.getRawAttribute(
2592
+ u
2539
2593
  );
2540
2594
  try {
2541
- n.headers = x.parseDataBind(u);
2542
- } catch (p) {
2543
- h.error("Haori", `Invalid fetch headers: ${p}`);
2595
+ n.headers = x.parseDataBind(h);
2596
+ } catch (g) {
2597
+ f.error("Haori", `Invalid fetch headers: ${g}`);
2544
2598
  }
2545
2599
  }
2546
2600
  }
2547
2601
  if (e) {
2548
- const f = c.attrName(
2602
+ const u = c.attrName(
2549
2603
  e,
2550
2604
  "fetch-content-type"
2551
2605
  );
2552
- if (t.hasAttribute(f))
2606
+ if (t.hasAttribute(u))
2553
2607
  n.headers = {
2554
2608
  ...n.headers,
2555
- "Content-Type": t.getAttribute(f)
2609
+ "Content-Type": t.getAttribute(u)
2556
2610
  };
2557
2611
  else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2558
- let u = !1;
2559
- n.headers && typeof n.headers == "object" && (u = "Content-Type" in n.headers), u || (n.headers = {
2612
+ let h = !1;
2613
+ n.headers && typeof n.headers == "object" && (h = "Content-Type" in n.headers), h || (n.headers = {
2560
2614
  ...n.headers,
2561
2615
  "Content-Type": "application/json"
2562
2616
  });
@@ -2565,19 +2619,19 @@ ${f}
2565
2619
  "Content-Type": "application/x-www-form-urlencoded"
2566
2620
  });
2567
2621
  } else {
2568
- const f = c.attrName(
2622
+ const u = c.attrName(
2569
2623
  null,
2570
2624
  "content-type",
2571
2625
  !0
2572
2626
  );
2573
- if (t.hasAttribute(f))
2627
+ if (t.hasAttribute(u))
2574
2628
  n.headers = {
2575
2629
  ...n.headers,
2576
- "Content-Type": t.getAttribute(f)
2630
+ "Content-Type": t.getAttribute(u)
2577
2631
  };
2578
2632
  else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2579
- let u = !1;
2580
- n.headers && typeof n.headers == "object" && (u = "Content-Type" in n.headers), u || (n.headers = {
2633
+ let h = !1;
2634
+ n.headers && typeof n.headers == "object" && (h = "Content-Type" in n.headers), h || (n.headers = {
2581
2635
  ...n.headers,
2582
2636
  "Content-Type": "application/json"
2583
2637
  });
@@ -2589,15 +2643,15 @@ ${f}
2589
2643
  Object.keys(n).length > 0 && (r.fetchOptions = n);
2590
2644
  const a = e ? c.attrName(e, "bind") : c.attrName(null, "bind", !0);
2591
2645
  if (t.hasAttribute(a)) {
2592
- const f = t.getRawAttribute(a);
2593
- if (f) {
2594
- const u = document.body.querySelectorAll(f);
2595
- u.length > 0 ? (r.bindFragments = [], u.forEach((p) => {
2596
- const E = N.get(p);
2597
- E && r.bindFragments.push(E);
2598
- })) : h.error(
2646
+ const u = t.getRawAttribute(a);
2647
+ if (u) {
2648
+ const h = document.body.querySelectorAll(u);
2649
+ h.length > 0 ? (r.bindFragments = [], h.forEach((g) => {
2650
+ const A = T.get(g);
2651
+ A && r.bindFragments.push(A);
2652
+ })) : f.error(
2599
2653
  "Haori",
2600
- `Bind element not found: ${f} (${a})`
2654
+ `Bind element not found: ${u} (${a})`
2601
2655
  );
2602
2656
  }
2603
2657
  }
@@ -2605,48 +2659,55 @@ ${f}
2605
2659
  null,
2606
2660
  "arg",
2607
2661
  !0
2608
- ), y = c.attrName(
2662
+ ), m = c.attrName(
2609
2663
  null,
2610
2664
  "bind-arg",
2611
2665
  !0
2612
2666
  );
2613
2667
  e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(d) ? r.bindArg = t.getRawAttribute(
2614
2668
  d
2615
- ) : t.hasAttribute(y) && (r.bindArg = t.getRawAttribute(y));
2616
- const b = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2617
- if (t.hasAttribute(b)) {
2618
- const f = t.getRawAttribute(b);
2619
- r.bindParams = f.split("&").map((u) => u.trim());
2669
+ ) : t.hasAttribute(m) && (r.bindArg = t.getRawAttribute(m));
2670
+ const y = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2671
+ if (t.hasAttribute(y)) {
2672
+ const u = t.getRawAttribute(y);
2673
+ r.bindParams = u.split("&").map((h) => h.trim());
2674
+ }
2675
+ const E = e ? c.attrName(e, "bind-append") : c.attrName(null, "bind-append", !0);
2676
+ if (t.hasAttribute(E)) {
2677
+ const u = t.getRawAttribute(E);
2678
+ r.bindAppendParams = u.split("&").map((h) => h.trim()).filter(Boolean);
2620
2679
  }
2621
- const v = e ? c.attrName(e, "bind-append") : c.attrName(null, "bind-append", !0);
2622
- if (t.hasAttribute(v)) {
2623
- const f = t.getRawAttribute(v);
2624
- r.bindAppendParams = f.split("&").map((u) => u.trim()).filter(Boolean);
2680
+ const S = e ? c.attrName(e, "copy-params") : null;
2681
+ if (S && t.hasAttribute(S)) {
2682
+ const u = t.getRawAttribute(
2683
+ S
2684
+ );
2685
+ r.copyParams = u.split("&").map((h) => h.trim()).filter(Boolean);
2625
2686
  }
2626
2687
  if (e) {
2627
2688
  if (t.hasAttribute(c.attrName(e, "adjust"))) {
2628
- const u = t.getRawAttribute(
2689
+ const h = t.getRawAttribute(
2629
2690
  c.attrName(e, "adjust")
2630
2691
  );
2631
- if (u) {
2632
- const p = document.body.querySelectorAll(u);
2633
- p.length > 0 ? (r.adjustFragments = [], p.forEach((E) => {
2634
- const A = N.get(E);
2635
- A && r.adjustFragments.push(A);
2636
- })) : h.error(
2692
+ if (h) {
2693
+ const g = document.body.querySelectorAll(h);
2694
+ g.length > 0 ? (r.adjustFragments = [], g.forEach((A) => {
2695
+ const v = T.get(A);
2696
+ v && r.adjustFragments.push(v);
2697
+ })) : f.error(
2637
2698
  "Haori",
2638
- `Adjust element not found: ${u} (${c.attrName(e, "adjust")})`
2699
+ `Adjust element not found: ${h} (${c.attrName(e, "adjust")})`
2639
2700
  );
2640
2701
  }
2641
2702
  if (t.hasAttribute(c.attrName(e, "adjust-value"))) {
2642
- const p = t.getRawAttribute(
2703
+ const g = t.getRawAttribute(
2643
2704
  c.attrName(e, "adjust-value")
2644
- ), E = Number(p);
2645
- isNaN(E) || (r.adjustValue = E);
2705
+ ), A = Number(g);
2706
+ isNaN(A) || (r.adjustValue = A);
2646
2707
  }
2647
2708
  }
2648
2709
  if (t.hasAttribute(c.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(c.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(c.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(c.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${l.prefix}${e}-after-run`)) {
2649
- const u = t.getRawAttribute(
2710
+ const h = t.getRawAttribute(
2650
2711
  `${l.prefix}${e}-after-run`
2651
2712
  );
2652
2713
  try {
@@ -2654,18 +2715,26 @@ ${f}
2654
2715
  "response",
2655
2716
  `
2656
2717
  "use strict";
2657
- ${u}
2718
+ ${h}
2658
2719
  `
2659
2720
  );
2660
- } catch (p) {
2661
- h.error("Haori", `Invalid after script: ${p}`);
2721
+ } catch (g) {
2722
+ f.error("Haori", `Invalid after script: ${g}`);
2662
2723
  }
2663
2724
  }
2664
2725
  if (t.hasAttribute(c.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2665
2726
  c.attrName(e, "dialog")
2666
- )), t.hasAttribute(c.attrName(e, "toast")) && (r.toastMessage = t.getAttribute(
2667
- c.attrName(e, "toast")
2668
- )), t.hasAttribute(c.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2727
+ ).replace(/\\n/g, `
2728
+ `)), t.hasAttribute(c.attrName(e, "toast"))) {
2729
+ r.toastMessage = t.getAttribute(
2730
+ c.attrName(e, "toast")
2731
+ );
2732
+ const h = t.getRawAttribute(
2733
+ c.attrName(e, "toast-level")
2734
+ ), A = ["info", "warning", "error", "success"].includes(h);
2735
+ r.toastLevel = A ? h : null;
2736
+ }
2737
+ if (t.hasAttribute(c.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2669
2738
  c.attrName(e, "redirect")
2670
2739
  )), t.hasAttribute(c.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
2671
2740
  c.attrName(e, "history")
@@ -2673,50 +2742,54 @@ ${u}
2673
2742
  t,
2674
2743
  c.attrName(e, "history-data")
2675
2744
  )), t.hasAttribute(c.attrName(e, "history-form"))) {
2676
- const u = t.getRawAttribute(
2745
+ const h = t.getRawAttribute(
2677
2746
  c.attrName(e, "history-form")
2678
2747
  );
2679
- if (u) {
2680
- const p = document.body.querySelector(u);
2681
- p !== null ? r.historyFormFragment = m.getFormFragment(
2682
- N.get(p)
2683
- ) : h.error(
2748
+ if (h) {
2749
+ const g = document.body.querySelector(h);
2750
+ g !== null ? r.historyFormFragment = b.getFormFragment(
2751
+ T.get(g)
2752
+ ) : f.error(
2684
2753
  "Haori",
2685
- `Form element not found: ${u} (${c.attrName(e, "history-form")})`
2754
+ `Form element not found: ${h} (${c.attrName(e, "history-form")})`
2686
2755
  );
2687
2756
  } else
2688
- r.historyFormFragment = m.getFormFragment(t);
2757
+ r.historyFormFragment = b.getFormFragment(t);
2689
2758
  }
2690
2759
  [
2691
2760
  "reset",
2692
2761
  "refetch",
2693
2762
  "click",
2763
+ "copy",
2694
2764
  "open",
2695
2765
  "close"
2696
- ].forEach((u) => {
2697
- const p = c.attrName(e, u);
2698
- if (!t.hasAttribute(p))
2766
+ ].forEach((h) => {
2767
+ const g = c.attrName(e, h);
2768
+ if (!t.hasAttribute(g))
2699
2769
  return;
2700
- const E = t.getRawAttribute(p), A = [];
2701
- if (E ? (document.body.querySelectorAll(E).forEach((k) => {
2702
- const U = N.get(k);
2703
- U && A.push(U);
2704
- }), A.length === 0 && h.error("Haori", `Element not found: ${E} (${p})`)) : A.push(t), A.length > 0)
2705
- switch (u) {
2770
+ const A = t.getRawAttribute(g), v = [];
2771
+ if (A ? (document.body.querySelectorAll(A).forEach((J) => {
2772
+ const Z = T.get(J);
2773
+ Z && v.push(Z);
2774
+ }), v.length === 0 && f.error("Haori", `Element not found: ${A} (${g})`)) : v.push(t), v.length > 0)
2775
+ switch (h) {
2706
2776
  case "reset":
2707
- r.resetFragments = A;
2777
+ r.resetFragments = v;
2708
2778
  break;
2709
2779
  case "refetch":
2710
- r.refetchFragments = A;
2780
+ r.refetchFragments = v;
2711
2781
  break;
2712
2782
  case "click":
2713
- r.clickFragments = A;
2783
+ r.clickFragments = v;
2784
+ break;
2785
+ case "copy":
2786
+ r.copyFragments = v;
2714
2787
  break;
2715
2788
  case "open":
2716
- r.openFragments = A;
2789
+ r.openFragments = v;
2717
2790
  break;
2718
2791
  case "close":
2719
- r.closeFragments = A;
2792
+ r.closeFragments = v;
2720
2793
  break;
2721
2794
  }
2722
2795
  });
@@ -2725,19 +2798,19 @@ ${u}
2725
2798
  t,
2726
2799
  c.attrName(null, "data", !0)
2727
2800
  )), t.hasAttribute(c.attrName(null, "form", !0)))) {
2728
- const f = t.getRawAttribute(
2801
+ const u = t.getRawAttribute(
2729
2802
  c.attrName(null, "form", !0)
2730
2803
  );
2731
- if (f) {
2732
- const u = document.body.querySelector(f);
2733
- u !== null ? r.formFragment = m.getFormFragment(
2734
- N.get(u)
2735
- ) : h.error(
2804
+ if (u) {
2805
+ const h = document.body.querySelector(u);
2806
+ h !== null ? r.formFragment = b.getFormFragment(
2807
+ T.get(h)
2808
+ ) : f.error(
2736
2809
  "Haori",
2737
- `Form element not found: ${f} (${c.attrName(null, "fetch-form", !0)})`
2810
+ `Form element not found: ${u} (${c.attrName(null, "fetch-form", !0)})`
2738
2811
  );
2739
2812
  } else
2740
- r.formFragment = m.getFormFragment(t);
2813
+ r.formFragment = b.getFormFragment(t);
2741
2814
  }
2742
2815
  return s && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
2743
2816
  }
@@ -2801,7 +2874,7 @@ ${u}
2801
2874
  }
2802
2875
  const i = {};
2803
2876
  if (this.options.formFragment) {
2804
- const o = m.getValues(this.options.formFragment);
2877
+ const o = b.getValues(this.options.formFragment);
2805
2878
  Object.assign(i, o);
2806
2879
  }
2807
2880
  this.options.data && typeof this.options.data == "object" && Object.assign(i, this.options.data);
@@ -2809,59 +2882,59 @@ ${u}
2809
2882
  if (e) {
2810
2883
  const o = { ...r || {} }, d = new Headers(
2811
2884
  o.headers || void 0
2812
- ), y = (o.method || "GET").toUpperCase(), b = l.runtime === "demo" && !nt(y), v = b ? "GET" : y;
2813
- if (o.method = v, v === "GET" || v === "HEAD" || v === "OPTIONS")
2814
- s && (e = ot(e, i));
2885
+ ), m = (o.method || "GET").toUpperCase(), y = l.runtime === "demo" && !at(m), E = y ? "GET" : m;
2886
+ if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
2887
+ s && (e = lt(e, i));
2815
2888
  else if (s) {
2816
2889
  const u = d.get("Content-Type") || "";
2817
2890
  if (/multipart\/form-data/i.test(u)) {
2818
2891
  d.delete("Content-Type");
2819
- const p = new FormData();
2820
- for (const [E, A] of Object.entries(i))
2821
- A == null ? p.append(E, "") : A instanceof Blob ? p.append(E, A) : Array.isArray(A) ? A.forEach((R) => p.append(E, String(R))) : typeof A == "object" ? p.append(E, JSON.stringify(A)) : p.append(E, String(A));
2822
- o.body = p;
2892
+ const h = new FormData();
2893
+ for (const [g, A] of Object.entries(i))
2894
+ A == null ? h.append(g, "") : A instanceof Blob ? h.append(g, A) : Array.isArray(A) ? A.forEach((v) => h.append(g, String(v))) : typeof A == "object" ? h.append(g, JSON.stringify(A)) : h.append(g, String(A));
2895
+ o.body = h;
2823
2896
  } else if (/application\/x-www-form-urlencoded/i.test(u)) {
2824
- const p = new URLSearchParams();
2825
- for (const [E, A] of Object.entries(i))
2826
- A !== void 0 && (A === null ? p.append(E, "") : Array.isArray(A) ? A.forEach((R) => p.append(E, String(R))) : typeof A == "object" ? p.append(E, JSON.stringify(A)) : p.append(E, String(A)));
2827
- o.body = p;
2897
+ const h = new URLSearchParams();
2898
+ for (const [g, A] of Object.entries(i))
2899
+ A !== void 0 && (A === null ? h.append(g, "") : Array.isArray(A) ? A.forEach((v) => h.append(g, String(v))) : typeof A == "object" ? h.append(g, JSON.stringify(A)) : h.append(g, String(A)));
2900
+ o.body = h;
2828
2901
  } else
2829
2902
  d.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
2830
2903
  }
2831
2904
  o.headers = d;
2832
- let f;
2833
- if (b && (f = e && new URL(e, window.location.href).search || void 0, d.delete("Content-Type"), h.info("Haori demo fetch normalization", {
2905
+ let S;
2906
+ if (y && (S = e && new URL(e, window.location.href).search || void 0, d.delete("Content-Type"), f.info("Haori demo fetch normalization", {
2834
2907
  runtime: l.runtime,
2835
- requestedMethod: y,
2836
- effectiveMethod: v,
2908
+ requestedMethod: m,
2909
+ effectiveMethod: E,
2837
2910
  transportMode: "query-get",
2838
2911
  url: e,
2839
2912
  payload: s ? i : void 0,
2840
- queryString: f
2913
+ queryString: S
2841
2914
  })), this.options.targetFragment && e) {
2842
- const u = performance.now(), p = {
2915
+ const u = performance.now(), h = {
2843
2916
  runtime: l.runtime,
2844
- requestedMethod: y,
2845
- effectiveMethod: v,
2846
- transportMode: b ? "query-get" : "http",
2847
- ...b ? { queryString: f } : {}
2917
+ requestedMethod: m,
2918
+ effectiveMethod: E,
2919
+ transportMode: y ? "query-get" : "http",
2920
+ ...y ? { queryString: S } : {}
2848
2921
  };
2849
2922
  return w.fetchStart(
2850
2923
  this.options.targetFragment.getTarget(),
2851
2924
  e,
2852
2925
  o,
2853
2926
  s ? i : void 0,
2854
- p
2855
- ), fetch(e, o).then((E) => this.handleFetchResult(
2856
- E,
2927
+ h
2928
+ ), fetch(e, o).then((g) => this.handleFetchResult(
2929
+ g,
2857
2930
  e || void 0,
2858
2931
  u
2859
- )).catch((E) => {
2932
+ )).catch((g) => {
2860
2933
  throw e && w.fetchError(
2861
2934
  this.options.targetFragment.getTarget(),
2862
2935
  e,
2863
- E
2864
- ), E;
2936
+ g
2937
+ ), g;
2865
2938
  });
2866
2939
  }
2867
2940
  return fetch(e, o).then((u) => this.handleFetchResult(u, e || void 0));
@@ -2872,8 +2945,8 @@ ${u}
2872
2945
  `${l.prefix}bind`,
2873
2946
  JSON.stringify(i)
2874
2947
  );
2875
- const y = o.getBindingData();
2876
- return Object.assign(y, i), await x.setBindingData(d, y), !0;
2948
+ const m = o.getBindingData();
2949
+ Object.assign(m, i), await x.setBindingData(d, m);
2877
2950
  }
2878
2951
  const n = s ? i : {}, a = new Response(JSON.stringify(n), {
2879
2952
  headers: { "Content-Type": "application/json" }
@@ -2884,7 +2957,7 @@ ${u}
2884
2957
  * フェッチ後の処理を実行します。
2885
2958
  */
2886
2959
  async handleFetchResult(t, e, r) {
2887
- const i = X();
2960
+ const i = W();
2888
2961
  if (!t.ok)
2889
2962
  return this.options.targetFragment && e && w.fetchError(
2890
2963
  this.options.targetFragment.getTarget(),
@@ -2899,30 +2972,35 @@ ${u}
2899
2972
  t.status,
2900
2973
  r
2901
2974
  ), this.options.afterCallback) {
2902
- const n = this.options.afterCallback(t);
2903
- if (n != null) {
2904
- if (n === !1 || typeof n == "object" && n.stop)
2975
+ const a = this.options.afterCallback(t);
2976
+ if (a != null) {
2977
+ if (a === !1 || typeof a == "object" && a.stop)
2905
2978
  return !1;
2906
- typeof n == "object" && "response" in n && (t = "response" in n ? n.response : t);
2979
+ typeof a == "object" && "response" in a && (t = "response" in a ? a.response : t);
2907
2980
  }
2908
2981
  }
2909
2982
  const s = [];
2910
- return s.push(this.bindResult(t)), s.push(this.adjust()), s.push(this.addRow()), s.push(this.removeRow()), s.push(this.movePrevRow()), s.push(this.moveNextRow()), this.options.resetFragments && this.options.resetFragments.length > 0 && this.options.resetFragments.forEach((n) => {
2911
- s.push(m.reset(n));
2912
- }), this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((n) => {
2913
- s.push(new c(n, null).run());
2914
- }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((n) => {
2915
- const a = n.getTarget();
2916
- typeof a.click == "function" ? a.click() : a.dispatchEvent(
2983
+ s.push(this.bindResult(t)), 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(
2984
+ this.options.resetFragments.map((a) => b.reset(a))
2985
+ ), await this.copy();
2986
+ const n = [];
2987
+ return this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
2988
+ n.push(new c(a, null).run());
2989
+ }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((a) => {
2990
+ const o = a.getTarget();
2991
+ typeof o.click == "function" ? o.click() : o.dispatchEvent(
2917
2992
  new MouseEvent("click", { bubbles: !0, cancelable: !0 })
2918
2993
  );
2919
- }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((n) => {
2920
- const a = n.getTarget();
2921
- a instanceof HTMLElement ? s.push(i.openDialog(a)) : h.error("Haori", "Element is not an HTML element: ", a);
2922
- }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((n) => {
2923
- const a = n.getTarget();
2924
- a instanceof HTMLElement ? s.push(i.closeDialog(a)) : h.error("Haori", "Element is not an HTML element: ", a);
2925
- }), await Promise.all(s), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(this.options.toastMessage, "info"), this.pushHistory(), this.options.redirectUrl && (window.location.href = this.options.redirectUrl), !0;
2994
+ }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
2995
+ const o = a.getTarget();
2996
+ o instanceof HTMLElement ? n.push(i.openDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
2997
+ }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
2998
+ const o = a.getTarget();
2999
+ o instanceof HTMLElement ? n.push(i.closeDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
3000
+ }), await Promise.all(n), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
3001
+ this.options.toastMessage,
3002
+ this.options.toastLevel ?? "info"
3003
+ ), this.pushHistory(), this.options.redirectUrl && (window.location.href = this.options.redirectUrl), !0;
2926
3004
  }
2927
3005
  /**
2928
3006
  * history.pushState を実行します。
@@ -2938,7 +3016,7 @@ ${u}
2938
3016
  const i = t ? this.options.historyUrl : window.location.pathname, s = new URL(i, window.location.href);
2939
3017
  if (s.origin !== window.location.origin) {
2940
3018
  const a = "history.pushState: cross-origin URL is not allowed: " + s.toString();
2941
- h.error(
3019
+ f.error(
2942
3020
  "Haori",
2943
3021
  a
2944
3022
  );
@@ -2946,15 +3024,15 @@ ${u}
2946
3024
  }
2947
3025
  const n = (a) => {
2948
3026
  for (const [o, d] of Object.entries(a))
2949
- d != null && (Array.isArray(d) ? d.forEach((y) => s.searchParams.append(o, String(y))) : typeof d == "object" ? s.searchParams.set(o, JSON.stringify(d)) : s.searchParams.set(o, String(d)));
3027
+ d != null && (Array.isArray(d) ? d.forEach((m) => s.searchParams.append(o, String(m))) : typeof d == "object" ? s.searchParams.set(o, JSON.stringify(d)) : s.searchParams.set(o, String(d)));
2950
3028
  };
2951
3029
  e && n(this.options.historyData), r && n(
2952
- m.getValues(
3030
+ b.getValues(
2953
3031
  this.options.historyFormFragment
2954
3032
  )
2955
3033
  ), history.pushState({}, "", s.toString());
2956
3034
  } catch (i) {
2957
- h.error("Haori", `history.pushState failed: ${i}`);
3035
+ f.error("Haori", `history.pushState failed: ${i}`);
2958
3036
  }
2959
3037
  }
2960
3038
  /**
@@ -2962,10 +3040,10 @@ ${u}
2962
3040
  */
2963
3041
  async handleFetchError(t) {
2964
3042
  let e = null;
2965
- this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = m.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3043
+ this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = b.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
2966
3044
  const r = async (s) => {
2967
3045
  const n = e ? e.getTarget() : document.body;
2968
- await X().addErrorMessage(n, s);
3046
+ await W().addErrorMessage(n, s);
2969
3047
  };
2970
3048
  if ((t.headers.get("Content-Type") || "").includes("application/json"))
2971
3049
  try {
@@ -2986,7 +3064,7 @@ ${u}
2986
3064
  if (n.length === 0)
2987
3065
  return await r(`${t.status} ${t.statusText}`), !1;
2988
3066
  for (const a of n)
2989
- a.key && e ? await m.addErrorMessage(e, a.key, a.message) : await r(a.message);
3067
+ a.key && e ? await b.addErrorMessage(e, a.key, a.message) : await r(a.message);
2990
3068
  return !1;
2991
3069
  } catch {
2992
3070
  }
@@ -3032,7 +3110,7 @@ ${u}
3032
3110
  */
3033
3111
  confirm() {
3034
3112
  const t = this.options.confirmMessage;
3035
- return t == null ? Promise.resolve(!0) : X().confirm(t);
3113
+ return t == null ? Promise.resolve(!0) : W().confirm(t);
3036
3114
  }
3037
3115
  /**
3038
3116
  * 結果データを対象のフラグメントにバインドします。
@@ -3064,7 +3142,7 @@ ${u}
3064
3142
  });
3065
3143
  else {
3066
3144
  if (typeof r == "string")
3067
- return h.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3145
+ return f.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3068
3146
  new Error("string data cannot be bound without a bindArg.")
3069
3147
  );
3070
3148
  this.options.bindFragments.forEach((s) => {
@@ -3097,6 +3175,39 @@ ${u}
3097
3175
  }
3098
3176
  return i;
3099
3177
  }
3178
+ /**
3179
+ * 指定されたフラグメントへバインディングデータをコピーします。
3180
+ */
3181
+ copy() {
3182
+ if (!this.options.copyFragments || this.options.copyFragments.length === 0)
3183
+ return Promise.resolve();
3184
+ const t = this.resolveCopySourceData(), e = this.pickCopyData(t), r = this.options.copyFragments.map((i) => {
3185
+ const s = {
3186
+ ...i.getBindingData(),
3187
+ ...e
3188
+ };
3189
+ return x.setBindingData(i.getTarget(), s);
3190
+ });
3191
+ return Promise.all(r).then(() => {
3192
+ });
3193
+ }
3194
+ /**
3195
+ * copy のコピー元データを取得します。
3196
+ */
3197
+ resolveCopySourceData() {
3198
+ return this.options.formFragment ? b.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
3199
+ }
3200
+ /**
3201
+ * copy-params が指定されている場合は対象キーだけ抽出します。
3202
+ */
3203
+ pickCopyData(t) {
3204
+ if (!this.options.copyParams || this.options.copyParams.length === 0)
3205
+ return t;
3206
+ const e = {};
3207
+ return this.options.copyParams.forEach((r) => {
3208
+ r in t && (e[r] = t[r]);
3209
+ }), e;
3210
+ }
3100
3211
  /**
3101
3212
  * 値の増減を行います。
3102
3213
  */
@@ -3120,11 +3231,11 @@ ${u}
3120
3231
  */
3121
3232
  getRowFragment() {
3122
3233
  if (!this.options.targetFragment)
3123
- return h.error("Haori", "Target fragment is not specified for row operation."), null;
3234
+ return f.error("Haori", "Target fragment is not specified for row operation."), null;
3124
3235
  const t = this.options.targetFragment.closestByAttribute(
3125
3236
  `${l.prefix}row`
3126
3237
  );
3127
- return t || (h.error("Haori", "Row fragment not found."), null);
3238
+ return t || (f.error("Haori", "Row fragment not found."), null);
3128
3239
  }
3129
3240
  /**
3130
3241
  * 行を追加します。
@@ -3140,7 +3251,7 @@ ${u}
3140
3251
  const e = [], r = t.clone();
3141
3252
  return e.push(
3142
3253
  t.getParent().insertAfter(r, t)
3143
- ), e.push(x.evaluateAll(r)), e.push(m.reset(r)), Promise.all(e).then(() => {
3254
+ ), e.push(x.evaluateAll(r)), e.push(b.reset(r)), Promise.all(e).then(() => {
3144
3255
  });
3145
3256
  }
3146
3257
  /**
@@ -3194,7 +3305,7 @@ ${u}
3194
3305
  };
3195
3306
  c.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, c.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
3196
3307
  let V = c;
3197
- class lt {
3308
+ class ut {
3198
3309
  /**
3199
3310
  * URLのクエリパラメータを取得します。
3200
3311
  *
@@ -3207,7 +3318,7 @@ class lt {
3207
3318
  }), t;
3208
3319
  }
3209
3320
  }
3210
- class ut {
3321
+ class ct {
3211
3322
  /**
3212
3323
  * 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
3213
3324
  *
@@ -3225,27 +3336,27 @@ class ut {
3225
3336
  try {
3226
3337
  r = await fetch(t, e);
3227
3338
  } catch (s) {
3228
- throw h.error("[Haori]", "Failed to fetch import source:", t, s), new Error(`Failed to fetch: ${t}`);
3339
+ throw f.error("[Haori]", "Failed to fetch import source:", t, s), new Error(`Failed to fetch: ${t}`);
3229
3340
  }
3230
3341
  if (!r.ok) {
3231
3342
  const s = `${r.status} ${r.statusText}`;
3232
- throw h.error("[Haori]", "Import HTTP error:", t, s), new Error(`Failed to load ${t}: ${s}`);
3343
+ throw f.error("[Haori]", "Import HTTP error:", t, s), new Error(`Failed to load ${t}: ${s}`);
3233
3344
  }
3234
3345
  let i;
3235
3346
  try {
3236
3347
  i = await r.text();
3237
3348
  } catch (s) {
3238
- throw h.error("[Haori]", "Failed to read response text:", t, s), new Error(`Failed to read response from: ${t}`);
3349
+ throw f.error("[Haori]", "Failed to read response text:", t, s), new Error(`Failed to read response from: ${t}`);
3239
3350
  }
3240
3351
  try {
3241
3352
  const n = new DOMParser().parseFromString(i, "text/html");
3242
- return n && n.body ? n.body.innerHTML : (h.warn("[Haori]", "No body found in imported document:", t), i);
3353
+ return n && n.body ? n.body.innerHTML : (f.warn("[Haori]", "No body found in imported document:", t), i);
3243
3354
  } catch (s) {
3244
- return h.error("[Haori]", "Failed to parse imported HTML:", t, s), i;
3355
+ return f.error("[Haori]", "Failed to parse imported HTML:", t, s), i;
3245
3356
  }
3246
3357
  }
3247
3358
  }
3248
- const g = class g {
3359
+ const p = class p {
3249
3360
  /**
3250
3361
  * 遅延属性かどうか(完全名で判定)を判定します。
3251
3362
  *
@@ -3253,7 +3364,7 @@ const g = class g {
3253
3364
  * @returns 遅延属性かどうか
3254
3365
  */
3255
3366
  static isDeferredAttributeName(t) {
3256
- return g.DEFERRED_ATTRIBUTE_SUFFIXES.some(
3367
+ return p.DEFERRED_ATTRIBUTE_SUFFIXES.some(
3257
3368
  (e) => t === `${l.prefix}${e}`
3258
3369
  );
3259
3370
  }
@@ -3264,7 +3375,7 @@ const g = class g {
3264
3375
  * @returns 除外対象かどうか
3265
3376
  */
3266
3377
  static isEvaluateAllExcludedAttributeName(t) {
3267
- return g.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
3378
+ return p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
3268
3379
  (e) => t === `${l.prefix}${e}`
3269
3380
  );
3270
3381
  }
@@ -3276,7 +3387,30 @@ const g = class g {
3276
3387
  * @returns 再評価する場合は true
3277
3388
  */
3278
3389
  static shouldReevaluateAttribute(t, e) {
3279
- return e !== null && !g.isEvaluateAllExcludedAttributeName(t) && g.ATTRIBUTE_PLACEHOLDER_REGEX.test(e);
3390
+ return e !== null && !p.isEvaluateAllExcludedAttributeName(t) && p.ATTRIBUTE_PLACEHOLDER_REGEX.test(e);
3391
+ }
3392
+ /**
3393
+ * data-attr-* 形式の属性名から実際に更新する属性名を取得します。
3394
+ *
3395
+ * @param name 属性名
3396
+ * @returns 実際の属性名。data-attr-* でない場合は null
3397
+ */
3398
+ static getAliasedAttributeName(t) {
3399
+ const e = `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
3400
+ return !t.startsWith(e) || t.length <= e.length ? null : t.slice(e.length);
3401
+ }
3402
+ /**
3403
+ * 実属性の変更が data-attr-* の内部反映かどうかを判定します。
3404
+ *
3405
+ * @param element 対象要素
3406
+ * @param name 変更された属性名
3407
+ * @returns data-attr-* の内部反映なら true
3408
+ */
3409
+ static isAliasedAttributeReflection(t, e) {
3410
+ const r = T.get(t);
3411
+ return r instanceof R ? r.hasAttribute(
3412
+ `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
3413
+ ) : !1;
3280
3414
  }
3281
3415
  /**
3282
3416
  * プレースホルダを含む通常属性を再評価します。
@@ -3289,7 +3423,9 @@ const g = class g {
3289
3423
  let e = Promise.resolve();
3290
3424
  for (const r of t.getAttributeNames()) {
3291
3425
  const i = t.getRawAttribute(r);
3292
- g.shouldReevaluateAttribute(r, i) && (e = e.then(() => t.setAttribute(r, i)));
3426
+ p.shouldReevaluateAttribute(r, i) && (e = e.then(
3427
+ () => p.setAttribute(t.getTarget(), r, i)
3428
+ ));
3293
3429
  }
3294
3430
  return e.then(() => {
3295
3431
  });
@@ -3301,15 +3437,16 @@ const g = class g {
3301
3437
  * @returns Promise (スキャンが完了したときに解決される)
3302
3438
  */
3303
3439
  static scan(t) {
3304
- const e = N.get(t);
3440
+ const e = T.get(t);
3305
3441
  if (!e)
3306
3442
  return Promise.resolve();
3307
- t.parentNode && (N.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
3308
- const r = [], i = /* @__PURE__ */ new Set();
3309
- for (const s of g.PRIORITY_ATTRIBUTE_SUFFIXES) {
3443
+ t.parentNode && (T.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
3444
+ let r = Promise.resolve();
3445
+ const i = /* @__PURE__ */ new Set();
3446
+ for (const s of p.PRIORITY_ATTRIBUTE_SUFFIXES) {
3310
3447
  const n = l.prefix + s;
3311
- e.hasAttribute(n) && (r.push(
3312
- g.setAttribute(
3448
+ e.hasAttribute(n) && (r = r.then(
3449
+ () => p.setAttribute(
3313
3450
  e.getTarget(),
3314
3451
  n,
3315
3452
  e.getRawAttribute(n)
@@ -3317,24 +3454,30 @@ const g = class g {
3317
3454
  ), i.add(n));
3318
3455
  }
3319
3456
  for (const s of e.getAttributeNames()) {
3320
- if (i.has(s) || g.isDeferredAttributeName(s))
3457
+ if (i.has(s) || p.isDeferredAttributeName(s))
3321
3458
  continue;
3322
3459
  const n = e.getRawAttribute(s);
3323
- n !== null && r.push(g.setAttribute(e.getTarget(), s, n));
3460
+ n !== null && (r = r.then(
3461
+ () => p.setAttribute(e.getTarget(), s, n)
3462
+ ));
3324
3463
  }
3325
- for (const s of g.DEFERRED_ATTRIBUTE_SUFFIXES) {
3464
+ for (const s of p.DEFERRED_ATTRIBUTE_SUFFIXES) {
3326
3465
  const n = l.prefix + s;
3327
- e.hasAttribute(n) && (r.push(
3328
- g.setAttribute(
3466
+ e.hasAttribute(n) && (r = r.then(
3467
+ () => p.setAttribute(
3329
3468
  e.getTarget(),
3330
3469
  n,
3331
3470
  e.getRawAttribute(n)
3332
3471
  )
3333
3472
  ), i.add(n));
3334
3473
  }
3335
- return e.getChildren().forEach((s) => {
3336
- s instanceof D ? r.push(g.scan(s.getTarget())) : s instanceof L && r.push(g.evaluateText(s));
3337
- }), Promise.all(r).then(() => {
3474
+ return r.then(() => {
3475
+ const s = [];
3476
+ return e.getChildren().forEach((n) => {
3477
+ n instanceof R ? s.push(p.scan(n.getTarget())) : n instanceof H && s.push(p.evaluateText(n));
3478
+ }), Promise.all(s).then(() => {
3479
+ });
3480
+ }).then(() => {
3338
3481
  });
3339
3482
  }
3340
3483
  /**
@@ -3347,54 +3490,57 @@ const g = class g {
3347
3490
  * @returns Promise (DOM操作が完了したときに解決される)
3348
3491
  */
3349
3492
  static setAttribute(t, e, r) {
3350
- const i = N.get(t), s = [];
3493
+ const i = T.get(t), s = p.getAliasedAttributeName(e);
3494
+ if (s !== null)
3495
+ return r === null ? i.removeAliasedAttribute(e, s) : i.setAliasedAttribute(e, s, r);
3496
+ const n = [];
3351
3497
  switch (e) {
3352
3498
  case `${l.prefix}bind`: {
3353
- r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(g.parseDataBind(r));
3499
+ r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(p.parseDataBind(r));
3354
3500
  break;
3355
3501
  }
3356
3502
  case `${l.prefix}if`:
3357
- s.push(g.evaluateIf(i));
3503
+ n.push(p.evaluateIf(i));
3358
3504
  break;
3359
3505
  case `${l.prefix}each`:
3360
- s.push(g.evaluateEach(i));
3506
+ n.push(p.evaluateEach(i));
3361
3507
  break;
3362
3508
  case `${l.prefix}fetch`:
3363
- s.push(
3509
+ n.push(
3364
3510
  new V(i, null).run().then(() => {
3365
3511
  })
3366
3512
  );
3367
3513
  break;
3368
3514
  case `${l.prefix}import`: {
3369
3515
  if (typeof r == "string") {
3370
- const n = i.getTarget(), a = performance.now();
3371
- w.importStart(n, r), s.push(
3372
- ut.load(r).then((o) => {
3373
- const d = new TextEncoder().encode(o).length;
3374
- return F.enqueue(() => {
3375
- n.innerHTML = o;
3516
+ const a = i.getTarget(), o = performance.now();
3517
+ w.importStart(a, r), n.push(
3518
+ ct.load(r).then((d) => {
3519
+ const m = new TextEncoder().encode(d).length;
3520
+ return P.enqueue(() => {
3521
+ a.innerHTML = d;
3376
3522
  }).then(() => {
3377
- w.importEnd(n, r, d, a);
3523
+ w.importEnd(a, r, m, o);
3378
3524
  });
3379
- }).catch((o) => {
3380
- w.importError(n, r, o), h.error("[Haori]", "Failed to import HTML:", r, o);
3525
+ }).catch((d) => {
3526
+ w.importError(a, r, d), f.error("[Haori]", "Failed to import HTML:", r, d);
3381
3527
  })
3382
3528
  );
3383
3529
  }
3384
3530
  break;
3385
3531
  }
3386
3532
  case `${l.prefix}url-param`: {
3387
- const n = i.getAttribute(`${l.prefix}url-arg`), a = lt.readParams();
3388
- if (n === null)
3389
- g.setBindingData(t, a);
3533
+ const a = i.getAttribute(`${l.prefix}url-arg`), o = ut.readParams();
3534
+ if (a === null)
3535
+ n.push(p.setBindingData(t, o));
3390
3536
  else {
3391
- const o = i.getRawBindingData() || {};
3392
- o[String(n)] = a, g.setBindingData(t, o);
3537
+ const d = i.getRawBindingData() || {};
3538
+ d[String(a)] = o, n.push(p.setBindingData(t, d));
3393
3539
  }
3394
3540
  break;
3395
3541
  }
3396
3542
  }
3397
- return r === null ? s.push(i.removeAttribute(e)) : s.push(i.setAttribute(e, r)), Promise.all(s).then(() => {
3543
+ return r === null ? n.push(i.removeAttribute(e)) : n.push(i.setAttribute(e, r)), Promise.all(n).then(() => {
3398
3544
  });
3399
3545
  }
3400
3546
  /**
@@ -3406,16 +3552,17 @@ const g = class g {
3406
3552
  * @returns Promise (DOM操作が完了したときに解決される)
3407
3553
  */
3408
3554
  static setBindingData(t, e) {
3409
- const r = N.get(t), i = r.getRawBindingData();
3555
+ const r = T.get(t), i = r.getRawBindingData();
3410
3556
  r.setBindingData(e);
3411
- const s = [];
3412
- if (s.push(
3413
- r.setAttribute(`${l.prefix}bind`, JSON.stringify(e))
3414
- ), t.tagName === "FORM") {
3557
+ let s = r.setAttribute(
3558
+ `${l.prefix}bind`,
3559
+ JSON.stringify(e)
3560
+ );
3561
+ if (t.tagName === "FORM") {
3415
3562
  const n = r.getAttribute(`${l.prefix}form-arg`), a = n && e[String(n)] && typeof e[String(n)] == "object" && !Array.isArray(e[String(n)]) ? e[String(n)] : n ? {} : e;
3416
- s.push(m.syncValues(r, a));
3563
+ s = s.then(() => b.syncValues(r, a));
3417
3564
  }
3418
- return s.push(g.evaluateAll(r)), w.bindChange(t, i, e, "manual"), Promise.all(s).then(() => {
3565
+ return s = s.then(() => p.evaluateAll(r)), w.bindChange(t, i, e, "manual"), s.then(() => {
3419
3566
  });
3420
3567
  }
3421
3568
  /**
@@ -3429,7 +3576,7 @@ const g = class g {
3429
3576
  try {
3430
3577
  return JSON.parse(t);
3431
3578
  } catch (e) {
3432
- return h.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3579
+ return f.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3433
3580
  }
3434
3581
  else {
3435
3582
  const e = new URLSearchParams(t), r = {};
@@ -3445,11 +3592,11 @@ const g = class g {
3445
3592
  * @param node 追加するノード
3446
3593
  */
3447
3594
  static addNode(t, e) {
3448
- const r = N.get(t);
3595
+ const r = T.get(t);
3449
3596
  if (r.isSkipMutationNodes())
3450
3597
  return;
3451
- const i = N.get(e.nextSibling), s = N.get(e);
3452
- s && (r.insertBefore(s, i), s instanceof D ? g.scan(s.getTarget()) : s instanceof L && g.evaluateText(s));
3598
+ const i = T.get(e.nextSibling), s = T.get(e);
3599
+ s && (r.insertBefore(s, i), s instanceof R ? p.scan(s.getTarget()) : s instanceof H && p.evaluateText(s));
3453
3600
  }
3454
3601
  /**
3455
3602
  * ノードを親要素から削除します。
@@ -3457,7 +3604,7 @@ const g = class g {
3457
3604
  * @param node 削除するノード
3458
3605
  */
3459
3606
  static removeNode(t) {
3460
- const e = N.get(t);
3607
+ const e = T.get(t);
3461
3608
  if (e) {
3462
3609
  const r = e.getParent();
3463
3610
  if (r && r.isSkipMutationNodes())
@@ -3472,7 +3619,7 @@ const g = class g {
3472
3619
  * @param text 新しいテキスト
3473
3620
  */
3474
3621
  static changeText(t, e) {
3475
- const r = N.get(t);
3622
+ const r = T.get(t);
3476
3623
  r && r.setContent(e);
3477
3624
  }
3478
3625
  /**
@@ -3484,16 +3631,16 @@ const g = class g {
3484
3631
  * @returns Promise (DOM操作が完了したときに解決される)
3485
3632
  */
3486
3633
  static changeValue(t, e) {
3487
- const r = N.get(t);
3634
+ const r = T.get(t);
3488
3635
  if (r.getValue() === e)
3489
3636
  return Promise.resolve();
3490
3637
  const i = [];
3491
3638
  i.push(r.setValue(e));
3492
- const s = g.getFormFragment(r);
3639
+ const s = p.getFormFragment(r);
3493
3640
  if (s) {
3494
- const n = m.getValues(s), a = s.getAttribute(`${l.prefix}form-arg`);
3641
+ const n = b.getValues(s), a = s.getAttribute(`${l.prefix}form-arg`);
3495
3642
  let o;
3496
- a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(g.setBindingData(s.getTarget(), o));
3643
+ a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(p.setBindingData(s.getTarget(), o));
3497
3644
  }
3498
3645
  return Promise.all(i).then(() => {
3499
3646
  });
@@ -3508,7 +3655,7 @@ const g = class g {
3508
3655
  if (t.getTarget() instanceof HTMLFormElement)
3509
3656
  return t;
3510
3657
  const e = t.getParent();
3511
- return e ? g.getFormFragment(e) : null;
3658
+ return e ? p.getFormFragment(e) : null;
3512
3659
  }
3513
3660
  /**
3514
3661
  * フラグメントとその子要素を評価します。
@@ -3518,10 +3665,16 @@ const g = class g {
3518
3665
  */
3519
3666
  static evaluateAll(t) {
3520
3667
  const e = [];
3521
- return e.push(g.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${l.prefix}if`) && e.push(g.evaluateIf(t)), t.hasAttribute(`${l.prefix}each`) && e.push(g.evaluateEach(t)), t.getChildren().forEach((r) => {
3522
- r instanceof D ? e.push(g.evaluateAll(r)) : r instanceof L && e.push(g.evaluateText(r));
3668
+ return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${l.prefix}if`) && e.push(p.evaluateIf(t)), t.hasAttribute(`${l.prefix}each`) ? Promise.all(e).then(() => p.evaluateEach(t)).then(() => {
3669
+ const r = [];
3670
+ return t.getChildren().forEach((i) => {
3671
+ i instanceof R ? r.push(p.evaluateAll(i)) : i instanceof H && r.push(p.evaluateText(i));
3672
+ }), Promise.all(r).then(() => {
3673
+ });
3674
+ }) : (t.getChildren().forEach((r) => {
3675
+ r instanceof R ? e.push(p.evaluateAll(r)) : r instanceof H && e.push(p.evaluateText(r));
3523
3676
  }), Promise.all(e).then(() => {
3524
- });
3677
+ }));
3525
3678
  }
3526
3679
  /**
3527
3680
  * テキストフラグメントを評価します。
@@ -3549,7 +3702,7 @@ const g = class g {
3549
3702
  t.show().then(() => {
3550
3703
  w.show(t.getTarget());
3551
3704
  })
3552
- ), e.push(g.evaluateAll(t))), Promise.all(e).then(() => {
3705
+ ), e.push(p.evaluateAll(t))), Promise.all(e).then(() => {
3553
3706
  });
3554
3707
  }
3555
3708
  /**
@@ -3565,7 +3718,7 @@ const g = class g {
3565
3718
  if (e === null) {
3566
3719
  let i = !1;
3567
3720
  t.getChildren().forEach((n) => {
3568
- if (!i && n instanceof D) {
3721
+ if (!i && n instanceof R) {
3569
3722
  if (n.hasAttribute(`${l.prefix}each-before`) || n.hasAttribute(`${l.prefix}each-after`))
3570
3723
  return;
3571
3724
  e = n.clone(), t.setTemplate(e), i = !0, t.removeChild(n);
@@ -3574,10 +3727,10 @@ const g = class g {
3574
3727
  }
3575
3728
  });
3576
3729
  const s = t.getAttribute(`${l.prefix}each`);
3577
- return Array.isArray(s) ? this.updateDiff(t, s) : (h.error("[Haori]", "Invalid each attribute:", s), Promise.reject(new Error("Invalid each attribute.")));
3730
+ return Array.isArray(s) ? this.updateDiff(t, s) : (f.error("[Haori]", "Invalid each attribute:", s), Promise.reject(new Error("Invalid each attribute.")));
3578
3731
  }
3579
3732
  const r = t.getAttribute(`${l.prefix}each`);
3580
- return Array.isArray(r) ? this.updateDiff(t, r) : (h.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3733
+ return Array.isArray(r) ? this.updateDiff(t, r) : (f.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3581
3734
  }
3582
3735
  /**
3583
3736
  * 差分を更新します。
@@ -3588,71 +3741,71 @@ const g = class g {
3588
3741
  static updateDiff(t, e) {
3589
3742
  const r = t.getTemplate();
3590
3743
  if (r === null)
3591
- return h.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3744
+ return f.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3592
3745
  let i = t.getAttribute(`${l.prefix}each-index`);
3593
3746
  i && (i = String(i));
3594
3747
  const s = t.getAttribute(`${l.prefix}each-key`), n = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3595
- e.forEach((u, p) => {
3596
- const E = g.createListKey(
3748
+ e.forEach((u, h) => {
3749
+ const g = p.createListKey(
3597
3750
  u,
3598
3751
  s ? String(s) : null,
3599
- p
3752
+ h
3600
3753
  );
3601
- o.push(E), a.set(E, { item: u, itemIndex: p });
3754
+ o.push(g), a.set(g, { item: u, itemIndex: h });
3602
3755
  });
3603
3756
  const d = [];
3604
- let y = t.getChildren().filter((u) => u instanceof D).filter(
3757
+ let m = t.getChildren().filter((u) => u instanceof R).filter(
3605
3758
  (u) => !u.hasAttribute(`${l.prefix}each-before`) && !u.hasAttribute(`${l.prefix}each-after`)
3606
3759
  );
3607
- y = y.filter((u) => o.indexOf(String(u.getListKey())) === -1 ? (d.push(u.remove()), !1) : !0);
3608
- const b = y.map((u) => u.getListKey()), v = t.getChildren().filter((u) => u instanceof D).filter((u) => u.hasAttribute(`${l.prefix}each-before`)).length;
3609
- let f = Promise.resolve();
3610
- return o.forEach((u, p) => {
3611
- const E = b.indexOf(u), { item: A, itemIndex: R } = a.get(u);
3760
+ m = m.filter((u) => o.indexOf(String(u.getListKey())) === -1 ? (d.push(u.remove()), !1) : !0);
3761
+ const y = m.map((u) => u.getListKey()), E = t.getChildren().filter((u) => u instanceof R).filter((u) => u.hasAttribute(`${l.prefix}each-before`)).length;
3762
+ let S = Promise.resolve();
3763
+ return o.forEach((u, h) => {
3764
+ const g = y.indexOf(u), { item: A, itemIndex: v } = a.get(u);
3612
3765
  let k;
3613
- if (E !== -1)
3614
- k = y[E], f = f.then(
3615
- () => g.updateRowFragment(
3766
+ if (g !== -1)
3767
+ k = m[g], S = S.then(
3768
+ () => p.updateRowFragment(
3616
3769
  k,
3617
3770
  A,
3618
3771
  i,
3619
- R,
3772
+ v,
3620
3773
  n ? String(n) : null,
3621
3774
  u
3622
- ).then(() => g.evaluateAll(k))
3775
+ ).then(() => p.evaluateAll(k))
3623
3776
  );
3624
3777
  else {
3625
3778
  k = r.clone();
3626
- const U = v + p;
3627
- f = f.then(
3628
- () => g.updateRowFragment(
3779
+ const J = E + h;
3780
+ S = S.then(
3781
+ () => p.updateRowFragment(
3629
3782
  k,
3630
3783
  A,
3631
3784
  i,
3632
- R,
3785
+ v,
3633
3786
  n ? String(n) : null,
3634
3787
  u
3635
3788
  ).then(
3636
3789
  () => t.insertBefore(
3637
3790
  k,
3638
- t.getChildren()[U] || null
3639
- ).then(() => g.evaluateAll(k))
3791
+ t.getChildren()[J] || null
3792
+ ).then(() => p.evaluateAll(k))
3640
3793
  )
3641
3794
  );
3642
3795
  }
3643
- }), Promise.all(d).then(() => f).then(() => {
3796
+ }), Promise.all(d).then(() => S).then(() => {
3644
3797
  const u = o.filter(
3645
- (R) => R !== null
3646
- ), p = b.filter(
3647
- (R) => R !== null
3648
- ), E = u.filter(
3649
- (R) => !p.includes(R)
3650
- ), A = p.filter(
3651
- (R) => !u.includes(R)
3798
+ (v) => v !== null
3799
+ ), h = y.filter(
3800
+ (v) => v !== null
3801
+ ), g = u.filter(
3802
+ (v) => !h.includes(v)
3803
+ ), A = h.filter(
3804
+ (v) => !u.includes(v)
3652
3805
  );
3653
3806
  w.eachUpdate(
3654
3807
  t.getTarget(),
3655
- E,
3808
+ g,
3656
3809
  A,
3657
3810
  u
3658
3811
  );
@@ -3700,23 +3853,23 @@ const g = class g {
3700
3853
  [s]: e
3701
3854
  }, r && (a[r] = i);
3702
3855
  else
3703
- return h.error(
3856
+ return f.error(
3704
3857
  "[Haori]",
3705
3858
  `Primitive value requires '${l.prefix}each-arg' attribute: ${e}`
3706
3859
  ), Promise.resolve();
3707
3860
  return t.setListKey(n), t.setBindingData(a), t.setAttribute(`${l.prefix}row`, n);
3708
3861
  }
3709
3862
  };
3710
- g.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if", "each"], g.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch", "url-param"], g.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
3863
+ p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if", "each"], p.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch", "url-param"], p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
3711
3864
  "bind",
3712
3865
  "if",
3713
3866
  "each",
3714
3867
  "fetch",
3715
3868
  "import",
3716
3869
  "url-param"
3717
- ], g.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;
3718
- let x = g;
3719
- class ct {
3870
+ ], p.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;
3871
+ let x = p;
3872
+ class ht {
3720
3873
  /**
3721
3874
  * コンストラクタ。
3722
3875
  *
@@ -3724,7 +3877,7 @@ class ct {
3724
3877
  */
3725
3878
  constructor(t = document) {
3726
3879
  this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
3727
- const e = document.documentElement, r = N.get(e);
3880
+ const e = document.documentElement, r = T.get(e);
3728
3881
  r && new V(r, "load").run();
3729
3882
  }, this.root = t;
3730
3883
  }
@@ -3751,9 +3904,9 @@ class ct {
3751
3904
  const r = this.getElementFromTarget(t.target);
3752
3905
  if (!r)
3753
3906
  return;
3754
- const i = N.get(r);
3755
- i && (e === "change" && i instanceof D && i.syncValue(), new V(i, e).run().catch((s) => {
3756
- h.error("[Haori]", "Procedure execution error:", s);
3907
+ const i = T.get(r);
3908
+ i && (e === "change" && i instanceof R && i.syncValue(), new V(i, e).run().catch((s) => {
3909
+ f.error("[Haori]", "Procedure execution error:", s);
3757
3910
  }));
3758
3911
  }
3759
3912
  /**
@@ -3766,44 +3919,44 @@ class ct {
3766
3919
  return t ? t instanceof HTMLElement ? t : t instanceof Node ? t.parentElement : null : null;
3767
3920
  }
3768
3921
  }
3769
- const T = class T {
3922
+ const N = class N {
3770
3923
  static syncTree(t) {
3771
- (t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement && T.syncElement(t), t.querySelectorAll("*").forEach((e) => {
3772
- T.syncElement(e);
3924
+ (t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement && N.syncElement(t), t.querySelectorAll("*").forEach((e) => {
3925
+ N.syncElement(e);
3773
3926
  }));
3774
3927
  }
3775
3928
  static syncElement(t) {
3776
- const e = T.registrations.get(t), r = N.get(t);
3777
- if (!r || !T.shouldObserve(r)) {
3778
- e && (e.observer.disconnect(), T.registrations.delete(t));
3929
+ const e = N.registrations.get(t), r = T.get(t);
3930
+ if (!r || !N.shouldObserve(r)) {
3931
+ e && (e.observer.disconnect(), N.registrations.delete(t));
3779
3932
  return;
3780
3933
  }
3781
3934
  if (typeof IntersectionObserver > "u")
3782
3935
  return;
3783
- const i = T.resolveRoot(r), s = T.resolveRootMargin(r), n = T.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
3784
- if (e && e.observer.root === i && e.observer.rootMargin === s && T.sameThreshold(
3936
+ const i = N.resolveRoot(r), s = N.resolveRootMargin(r), n = N.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
3937
+ if (e && e.observer.root === i && e.observer.rootMargin === s && N.sameThreshold(
3785
3938
  e.observer.thresholds,
3786
3939
  n
3787
3940
  ) && e.once === a) {
3788
3941
  e.fragment = r;
3789
3942
  return;
3790
3943
  }
3791
- e && (e.observer.disconnect(), T.registrations.delete(t));
3944
+ e && (e.observer.disconnect(), N.registrations.delete(t));
3792
3945
  const o = new IntersectionObserver(
3793
3946
  (d) => {
3794
- const y = T.registrations.get(t);
3795
- y && d.forEach((b) => {
3796
- !b.isIntersecting || y.running || T.isDisabled(y.fragment) || (y.running = !0, new V(y.fragment, "intersect").runWithResult().then((v) => {
3797
- v && y.once && (y.observer.disconnect(), T.registrations.delete(t));
3798
- }).catch((v) => {
3799
- h.error(
3947
+ const m = N.registrations.get(t);
3948
+ m && d.forEach((y) => {
3949
+ !y.isIntersecting || m.running || N.isDisabled(m.fragment) || (m.running = !0, new V(m.fragment, "intersect").runWithResult().then((E) => {
3950
+ E && m.once && (m.observer.disconnect(), N.registrations.delete(t));
3951
+ }).catch((E) => {
3952
+ f.error(
3800
3953
  "[Haori]",
3801
3954
  "Intersect procedure execution error:",
3802
- v
3955
+ E
3803
3956
  );
3804
3957
  }).finally(() => {
3805
- const v = T.registrations.get(t);
3806
- v && (v.running = !1);
3958
+ const E = N.registrations.get(t);
3959
+ E && (E.running = !1);
3807
3960
  }));
3808
3961
  });
3809
3962
  },
@@ -3813,7 +3966,7 @@ const T = class T {
3813
3966
  threshold: n
3814
3967
  }
3815
3968
  );
3816
- o.observe(t), T.registrations.set(t, {
3969
+ o.observe(t), N.registrations.set(t, {
3817
3970
  fragment: r,
3818
3971
  observer: o,
3819
3972
  once: a,
@@ -3822,25 +3975,25 @@ const T = class T {
3822
3975
  }
3823
3976
  static cleanupTree(t) {
3824
3977
  if (t instanceof HTMLElement) {
3825
- const e = T.registrations.get(t);
3826
- e && (e.observer.disconnect(), T.registrations.delete(t));
3978
+ const e = N.registrations.get(t);
3979
+ e && (e.observer.disconnect(), N.registrations.delete(t));
3827
3980
  }
3828
3981
  (t instanceof Element || t instanceof DocumentFragment) && t.querySelectorAll("*").forEach((e) => {
3829
- const r = T.registrations.get(e);
3830
- r && (r.observer.disconnect(), T.registrations.delete(e));
3982
+ const r = N.registrations.get(e);
3983
+ r && (r.observer.disconnect(), N.registrations.delete(e));
3831
3984
  });
3832
3985
  }
3833
3986
  static disconnectAll() {
3834
- T.registrations.forEach((t) => {
3987
+ N.registrations.forEach((t) => {
3835
3988
  t.observer.disconnect();
3836
- }), T.registrations.clear();
3989
+ }), N.registrations.clear();
3837
3990
  }
3838
3991
  static shouldObserve(t) {
3839
3992
  return t.getAttributeNames().some((e) => {
3840
3993
  if (!e.startsWith(`${l.prefix}intersect-`))
3841
3994
  return !1;
3842
3995
  const r = e.slice(`${l.prefix}intersect-`.length);
3843
- return !T.CONFIG_KEYS.has(r);
3996
+ return !N.CONFIG_KEYS.has(r);
3844
3997
  });
3845
3998
  }
3846
3999
  static resolveRoot(t) {
@@ -3851,7 +4004,7 @@ const T = class T {
3851
4004
  if (typeof r != "string" || r.trim() === "")
3852
4005
  return null;
3853
4006
  const i = document.querySelector(r);
3854
- return i instanceof HTMLElement ? i : (h.error("[Haori]", `Intersect root element not found: ${r}`), null);
4007
+ return i instanceof HTMLElement ? i : (f.error("[Haori]", `Intersect root element not found: ${r}`), null);
3855
4008
  }
3856
4009
  static resolveRootMargin(t) {
3857
4010
  const e = `${l.prefix}intersect-root-margin`, r = t.getAttribute(e);
@@ -3874,28 +4027,28 @@ const T = class T {
3874
4027
  return t.length === 1 && t[0] === e;
3875
4028
  }
3876
4029
  };
3877
- T.CONFIG_KEYS = /* @__PURE__ */ new Set([
4030
+ N.CONFIG_KEYS = /* @__PURE__ */ new Set([
3878
4031
  "root",
3879
4032
  "root-margin",
3880
4033
  "threshold",
3881
4034
  "disabled",
3882
4035
  "once"
3883
- ]), T.registrations = /* @__PURE__ */ new Map();
3884
- let B = T;
3885
- const H = class H {
4036
+ ]), N.registrations = /* @__PURE__ */ new Map();
4037
+ let L = N;
4038
+ const I = class I {
3886
4039
  /**
3887
4040
  * 初期化メソッド。
3888
4041
  * ドキュメントのheadとbodyを監視対象として設定します。
3889
4042
  */
3890
4043
  static async init() {
3891
- if (H._initialized)
4044
+ if (I._initialized)
3892
4045
  return;
3893
- H._initialized = !0;
4046
+ I._initialized = !0;
3894
4047
  const t = await Promise.allSettled([
3895
4048
  x.scan(document.head),
3896
4049
  x.scan(document.body)
3897
4050
  ]), [e, r] = t;
3898
- e.status !== "fulfilled" && h.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && h.error("[Haori]", "Failed to build body fragment:", r.reason), H.observe(document.head), H.observe(document.body), new ct().start(), B.syncTree(document.body);
4051
+ e.status !== "fulfilled" && f.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && f.error("[Haori]", "Failed to build body fragment:", r.reason), I.observe(document.head), I.observe(document.body), new ht().start(), L.syncTree(document.body);
3899
4052
  }
3900
4053
  /**
3901
4054
  * 指定された要素を監視します。
@@ -3908,40 +4061,45 @@ const H = class H {
3908
4061
  try {
3909
4062
  switch (i.type) {
3910
4063
  case "attributes": {
3911
- h.info(
4064
+ f.info(
3912
4065
  "[Haori]",
3913
4066
  "Attribute changed:",
3914
4067
  i.target,
3915
4068
  i.attributeName
3916
4069
  );
3917
4070
  const s = i.target;
4071
+ if (i.attributeName && x.isAliasedAttributeReflection(
4072
+ s,
4073
+ i.attributeName
4074
+ ))
4075
+ break;
3918
4076
  x.setAttribute(
3919
4077
  s,
3920
4078
  i.attributeName,
3921
4079
  s.getAttribute(i.attributeName)
3922
- ), B.syncElement(s);
4080
+ ), L.syncElement(s);
3923
4081
  break;
3924
4082
  }
3925
4083
  case "childList": {
3926
- h.info(
4084
+ f.info(
3927
4085
  "[Haori]",
3928
4086
  "Child list changed:",
3929
4087
  Array.from(i.removedNodes).map((s) => s.nodeName),
3930
4088
  Array.from(i.addedNodes).map((s) => s.nodeName)
3931
4089
  ), Array.from(i.removedNodes).forEach((s) => {
3932
- B.cleanupTree(s), x.removeNode(s);
4090
+ L.cleanupTree(s), x.removeNode(s);
3933
4091
  }), Array.from(i.addedNodes).forEach((s) => {
3934
- s.parentElement instanceof HTMLElement && (x.addNode(s.parentElement, s), B.syncTree(s));
4092
+ s.parentElement instanceof HTMLElement && (x.addNode(s.parentElement, s), L.syncTree(s));
3935
4093
  });
3936
4094
  break;
3937
4095
  }
3938
4096
  case "characterData": {
3939
- h.info(
4097
+ f.info(
3940
4098
  "[Haori]",
3941
4099
  "Character data changed:",
3942
4100
  i.target,
3943
4101
  i.target.textContent
3944
- ), i.target instanceof Text || i.target instanceof Comment ? x.changeText(i.target, i.target.textContent) : h.warn(
4102
+ ), i.target instanceof Text || i.target instanceof Comment ? x.changeText(i.target, i.target.textContent) : f.warn(
3945
4103
  "[Haori]",
3946
4104
  "Unsupported character data type:",
3947
4105
  i.target
@@ -3949,33 +4107,33 @@ const H = class H {
3949
4107
  break;
3950
4108
  }
3951
4109
  default:
3952
- h.warn("[Haori]", "Unknown mutation type:", i.type);
4110
+ f.warn("[Haori]", "Unknown mutation type:", i.type);
3953
4111
  continue;
3954
4112
  }
3955
4113
  } catch (s) {
3956
- h.error("[Haori]", "Error processing mutation:", s);
4114
+ f.error("[Haori]", "Error processing mutation:", s);
3957
4115
  }
3958
4116
  }).observe(t, {
3959
4117
  childList: !0,
3960
4118
  subtree: !0,
3961
4119
  attributes: !0,
3962
4120
  characterData: !0
3963
- }), h.info("[Haori]", "Observer initialized for", t);
4121
+ }), f.info("[Haori]", "Observer initialized for", t);
3964
4122
  }
3965
4123
  };
3966
- H._initialized = !1;
3967
- let G = H;
3968
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", G.init) : G.init();
3969
- const ht = "0.4.2";
4124
+ I._initialized = !1;
4125
+ let q = I;
4126
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", q.init) : q.init();
4127
+ const ft = "0.4.3";
3970
4128
  export {
3971
4129
  x as Core,
3972
4130
  l as Env,
3973
- m as Form,
3974
- N as Fragment,
3975
- _ as Haori,
3976
- h as Log,
3977
- F as Queue,
3978
- _ as default,
3979
- ht as version
4131
+ b as Form,
4132
+ T as Fragment,
4133
+ X as Haori,
4134
+ f as Log,
4135
+ P as Queue,
4136
+ X as default,
4137
+ ft as version
3980
4138
  };
3981
4139
  //# sourceMappingURL=haori.es.js.map