haori 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/haori.es.js CHANGED
@@ -29,22 +29,22 @@ const C = class C {
29
29
  }
30
30
  };
31
31
  C.devMode = !1;
32
- let B = C;
32
+ let L = C;
33
33
  const z = "embedded";
34
- function rt(P) {
35
- return P === "embedded" || P === "demo";
34
+ function rt(R) {
35
+ return R === "embedded" || R === "demo";
36
36
  }
37
- function it(P) {
38
- return P === null ? null : rt(P) ? P : z;
37
+ function it(R) {
38
+ return R === null ? null : rt(R) ? R : z;
39
39
  }
40
- const D = class D {
40
+ const k = class k {
41
41
  /**
42
42
  * 実行モードを取得します。
43
43
  *
44
44
  * @returns 実行モード。
45
45
  */
46
46
  static get runtime() {
47
- return D._runtime;
47
+ return k._runtime;
48
48
  }
49
49
  /**
50
50
  * 実行モードを設定します。
@@ -53,7 +53,7 @@ const D = class D {
53
53
  * @return 戻り値はありません。
54
54
  */
55
55
  static setRuntime(t) {
56
- D._runtime = rt(t) ? t : z;
56
+ k._runtime = rt(t) ? t : z;
57
57
  }
58
58
  /**
59
59
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -65,23 +65,23 @@ const D = class D {
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") || D._prefix;
69
- D._prefix = r.endsWith("-") ? r : r + "-";
68
+ const r = t.getAttribute("data-prefix") || k._prefix;
69
+ k._prefix = r.endsWith("-") ? r : r + "-";
70
70
  const i = it(
71
71
  t.getAttribute("data-runtime")
72
72
  );
73
- i !== null && (D._runtime = i);
73
+ i !== null && (k._runtime = i);
74
74
  }
75
- if (t instanceof HTMLScriptElement && t.hasAttribute(`${D._prefix}dev`)) {
76
- B.set(!0);
75
+ if (t instanceof HTMLScriptElement && t.hasAttribute(`${k._prefix}dev`)) {
76
+ L.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
- B.set(!0);
81
+ L.set(!0);
82
82
  return;
83
83
  }
84
- B.set(!1);
84
+ L.set(!1);
85
85
  } catch {
86
86
  }
87
87
  }
@@ -91,13 +91,13 @@ const D = class D {
91
91
  * @returns プレフィックス
92
92
  */
93
93
  static get prefix() {
94
- return D._prefix;
94
+ return k._prefix;
95
95
  }
96
96
  };
97
- D._prefix = "data-", D._runtime = z;
98
- let l = D;
99
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
100
- class d {
97
+ k._prefix = "data-", k._runtime = z;
98
+ let u = k;
99
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect();
100
+ class f {
101
101
  /**
102
102
  * 開発モードでのみコンソールに情報を出力します。
103
103
  *
@@ -105,7 +105,7 @@ class d {
105
105
  * @param args 追加の引数
106
106
  */
107
107
  static info(t, ...e) {
108
- B.isEnabled() && console.log && console.log(t, ...e);
108
+ L.isEnabled() && console.log && console.log(t, ...e);
109
109
  }
110
110
  /**
111
111
  * 開発モードでのみコンソールに警告を出力します。
@@ -114,7 +114,7 @@ class d {
114
114
  * @param args 追加の引数
115
115
  */
116
116
  static warn(t, ...e) {
117
- B.isEnabled() && console.warn && console.warn(t, ...e);
117
+ L.isEnabled() && console.warn && console.warn(t, ...e);
118
118
  }
119
119
  /**
120
120
  * モードに関係なくコンソールにエラーを出力します。
@@ -168,13 +168,13 @@ class st {
168
168
  const r = await e.task();
169
169
  e.resolve(r);
170
170
  } catch (r) {
171
- e.reject(r), d.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
- d.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
  }
@@ -229,7 +229,7 @@ class X {
229
229
  * @return 実行モード。
230
230
  */
231
231
  static get runtime() {
232
- return l.runtime;
232
+ return u.runtime;
233
233
  }
234
234
  /**
235
235
  * 実行モードを設定します。
@@ -238,7 +238,7 @@ class X {
238
238
  * @return 戻り値はありません。
239
239
  */
240
240
  static setRuntime(t) {
241
- l.setRuntime(t);
241
+ u.setRuntime(t);
242
242
  }
243
243
  /**
244
244
  * 通知ダイアログを表示します。
@@ -284,7 +284,7 @@ class X {
284
284
  */
285
285
  static openDialog(t) {
286
286
  return F.enqueue(() => {
287
- t instanceof HTMLDialogElement ? t.showModal() : d.error("[Haori]", "Element is not a dialog: ", t);
287
+ t instanceof HTMLDialogElement ? t.showModal() : f.error("[Haori]", "Element is not a dialog: ", t);
288
288
  }, !0);
289
289
  }
290
290
  /**
@@ -294,7 +294,7 @@ class X {
294
294
  */
295
295
  static closeDialog(t) {
296
296
  return F.enqueue(() => {
297
- t instanceof HTMLDialogElement ? t.close() : d.error("[Haori]", "Element is not a dialog: ", t);
297
+ t instanceof HTMLDialogElement ? t.close() : f.error("[Haori]", "Element is not a dialog: ", t);
298
298
  }, !0);
299
299
  }
300
300
  /**
@@ -339,7 +339,7 @@ function et() {
339
339
  (r) => typeof t?.[r] == "function"
340
340
  ) ? t : X;
341
341
  }
342
- class y {
342
+ class A {
343
343
  /**
344
344
  * フォーム内にある入力エレメントの値をオブジェクトとして取得します。
345
345
  * data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
@@ -350,7 +350,7 @@ class y {
350
350
  */
351
351
  static getValues(t) {
352
352
  const e = {};
353
- return y.getPartValues(t, e);
353
+ return A.getPartValues(t, e);
354
354
  }
355
355
  /**
356
356
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
@@ -361,32 +361,32 @@ class y {
361
361
  * @returns values と同じオブジェクト
362
362
  */
363
363
  static getPartValues(t, e) {
364
- const r = t.getAttribute("name"), i = t.getAttribute(`${l.prefix}form-object`), n = t.getAttribute(`${l.prefix}form-list`);
364
+ const r = t.getAttribute("name"), i = t.getAttribute(`${u.prefix}form-object`), n = t.getAttribute(`${u.prefix}form-list`);
365
365
  if (r) {
366
- n ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && d.warn(
366
+ n ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && f.warn(
367
367
  "Haori",
368
- `Element cannot have both ${l.prefix}form-object and name attributes.`
368
+ `Element cannot have both ${u.prefix}form-object and name attributes.`
369
369
  );
370
370
  for (const s of t.getChildElementFragments())
371
- y.getPartValues(s, e);
371
+ A.getPartValues(s, e);
372
372
  } else if (i) {
373
373
  const s = {};
374
374
  for (const a of t.getChildElementFragments())
375
- y.getPartValues(a, s);
376
- Object.keys(s).length > 0 && (e[String(i)] = s), n && d.warn(
375
+ A.getPartValues(a, s);
376
+ Object.keys(s).length > 0 && (e[String(i)] = s), n && f.warn(
377
377
  "Haori",
378
- `Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
378
+ `Element cannot have both ${u.prefix}form-list and ${u.prefix}form-object attributes.`
379
379
  );
380
380
  } else if (n) {
381
381
  const s = [];
382
382
  for (const a of t.getChildElementFragments()) {
383
383
  const o = {};
384
- y.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
384
+ A.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
385
385
  }
386
386
  s.length > 0 && (e[String(n)] = s);
387
387
  } else
388
388
  for (const s of t.getChildElementFragments())
389
- y.getPartValues(s, e);
389
+ A.getPartValues(s, e);
390
390
  return e;
391
391
  }
392
392
  /**
@@ -399,7 +399,7 @@ class y {
399
399
  * @returns Promise(DOMの更新が完了したら解決される)
400
400
  */
401
401
  static setValues(t, e, r = !1) {
402
- return y.setPartValues(t, e, null, r, !0);
402
+ return A.setPartValues(t, e, null, r, !0);
403
403
  }
404
404
  /**
405
405
  * フォーム内にある入力エレメントに値をイベントなしで設定します。
@@ -411,7 +411,7 @@ class y {
411
411
  * @returns Promise(DOMの更新が完了したら解決される)
412
412
  */
413
413
  static syncValues(t, e, r = !1) {
414
- return y.setPartValues(t, e, null, r, !1);
414
+ return A.setPartValues(t, e, null, r, !1);
415
415
  }
416
416
  /**
417
417
  * 単一フラグメントへ値を設定します。
@@ -434,50 +434,50 @@ class y {
434
434
  * @returns Promise(DOMの更新が完了したら解決される)
435
435
  */
436
436
  static setPartValues(t, e, r = null, i = !1, n = !0) {
437
- const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), h = t.getAttribute(`${l.prefix}form-list`), b = t.getAttribute(`${l.prefix}form-detach`);
437
+ const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${u.prefix}form-object`), l = t.getAttribute(`${u.prefix}form-list`), m = t.getAttribute(`${u.prefix}form-detach`);
438
438
  if (a) {
439
- if (!b || i) {
439
+ if (!m || i) {
440
440
  const g = e[String(a)];
441
- h && Array.isArray(g) && r !== null ? s.push(
442
- y.applyFragmentValue(t, g[r] ?? null, n)
443
- ) : typeof g > "u" || (typeof g == "string" || typeof g == "number" || typeof g == "boolean" || g === null ? s.push(y.applyFragmentValue(t, g, n)) : s.push(
444
- y.applyFragmentValue(t, String(g), n)
441
+ l && Array.isArray(g) && r !== null ? s.push(
442
+ A.applyFragmentValue(t, g[r] ?? null, n)
443
+ ) : typeof g > "u" || (typeof g == "string" || typeof g == "number" || typeof g == "boolean" || g === null ? s.push(A.applyFragmentValue(t, g, n)) : s.push(
444
+ A.applyFragmentValue(t, String(g), n)
445
445
  ));
446
446
  }
447
447
  } else if (o) {
448
448
  const g = e[String(o)];
449
449
  if (g && typeof g == "object")
450
- for (const E of t.getChildElementFragments())
450
+ for (const T of t.getChildElementFragments())
451
451
  s.push(
452
- y.setPartValues(
453
- E,
452
+ A.setPartValues(
453
+ T,
454
454
  g,
455
455
  null,
456
456
  i,
457
457
  n
458
458
  )
459
459
  );
460
- } else if (h) {
461
- const g = e[String(h)];
460
+ } else if (l) {
461
+ const g = e[String(l)];
462
462
  if (Array.isArray(g)) {
463
- const E = t.getChildElementFragments();
464
- for (let v = 0; v < E.length; v++) {
465
- const c = E[v];
463
+ const T = t.getChildElementFragments();
464
+ for (let v = 0; v < T.length; v++) {
465
+ const h = T[v];
466
466
  g.length > v ? s.push(
467
- y.setPartValues(
468
- c,
467
+ A.setPartValues(
468
+ h,
469
469
  g[v],
470
470
  v,
471
471
  i,
472
472
  n
473
473
  )
474
- ) : s.push(y.setPartValues(c, {}, v, i, n));
474
+ ) : s.push(A.setPartValues(h, {}, v, i, n));
475
475
  }
476
476
  }
477
477
  } else
478
478
  for (const g of t.getChildElementFragments())
479
479
  s.push(
480
- y.setPartValues(g, e, null, i, n)
480
+ A.setPartValues(g, e, null, i, n)
481
481
  );
482
482
  return Promise.all(s).then(() => {
483
483
  });
@@ -490,9 +490,9 @@ class y {
490
490
  * @returns すべての初期化処理が完了するPromise
491
491
  */
492
492
  static async reset(t) {
493
- y.clearValues(t), await Promise.all([
494
- y.clearMessages(t),
495
- y.clearEachClones(t)
493
+ A.clearValues(t), await Promise.all([
494
+ A.clearMessages(t),
495
+ A.clearEachClones(t)
496
496
  ]), await F.enqueue(() => {
497
497
  const e = t.getTarget();
498
498
  if (e instanceof HTMLFormElement)
@@ -504,7 +504,7 @@ class y {
504
504
  n.appendChild(e), n.reset(), r.insertBefore(e, i);
505
505
  }
506
506
  }
507
- }), await R.evaluateAll(t);
507
+ }), await P.evaluateAll(t);
508
508
  }
509
509
  /**
510
510
  * data-each によって生成された複製(テンプレート以外)を削除します。
@@ -514,9 +514,9 @@ class y {
514
514
  */
515
515
  static clearEachClones(t) {
516
516
  const e = [], r = (n) => {
517
- if (n.hasAttribute(`${l.prefix}each`))
517
+ if (n.hasAttribute(`${u.prefix}each`))
518
518
  for (const s of n.getChildElementFragments()) {
519
- const a = s.hasAttribute(`${l.prefix}each-before`), o = s.hasAttribute(`${l.prefix}each-after`);
519
+ const a = s.hasAttribute(`${u.prefix}each-before`), o = s.hasAttribute(`${u.prefix}each-after`);
520
520
  !a && !o && e.push(s.remove());
521
521
  }
522
522
  }, i = (n) => {
@@ -538,7 +538,7 @@ class y {
538
538
  static clearValues(t) {
539
539
  t.clearValue();
540
540
  for (const e of t.getChildElementFragments())
541
- y.clearValues(e);
541
+ A.clearValues(e);
542
542
  }
543
543
  /**
544
544
  * フラグメントとその子要素のメッセージをクリアします。
@@ -561,7 +561,7 @@ class y {
561
561
  * @return Promise(メッセージの追加が完了したら解決される)
562
562
  */
563
563
  static addErrorMessage(t, e, r) {
564
- return y.addMessage(t, e, r, "error");
564
+ return A.addMessage(t, e, r, "error");
565
565
  }
566
566
  /**
567
567
  * キーに一致するフラグメントにレベル付きメッセージを追加します。
@@ -574,10 +574,10 @@ class y {
574
574
  * @return Promise(メッセージの追加が完了したら解決される)
575
575
  */
576
576
  static addMessage(t, e, r, i) {
577
- const n = [], s = et(), a = s.addMessage, o = (b) => typeof a == "function" ? a.call(s, b, r, i) : s.addErrorMessage(b, r), h = y.findFragmentsByKey(t, e);
578
- return h.forEach((b) => {
579
- n.push(o(b.getTarget()));
580
- }), h.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
577
+ const n = [], s = et(), a = s.addMessage, o = (m) => typeof a == "function" ? a.call(s, m, r, i) : s.addErrorMessage(m, r), l = A.findFragmentsByKey(t, e);
578
+ return l.forEach((m) => {
579
+ n.push(o(m.getTarget()));
580
+ }), l.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
581
581
  });
582
582
  }
583
583
  /**
@@ -588,7 +588,7 @@ class y {
588
588
  * @returns 一致するフラグメントの配列
589
589
  */
590
590
  static findFragmentsByKey(t, e) {
591
- return y.findFragmentByKeyParts(t, e.split("."));
591
+ return A.findFragmentByKeyParts(t, e.split("."));
592
592
  }
593
593
  /**
594
594
  * 指定されたキーに一致するフラグメントを検索します。
@@ -600,23 +600,23 @@ class y {
600
600
  */
601
601
  static findFragmentByKeyParts(t, e) {
602
602
  const r = [], i = e[0];
603
- if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
604
- e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
605
- r.push(...y.findFragmentByKeyParts(s, e.slice(1)));
603
+ if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${u.prefix}form-object`))
604
+ e.length > 1 && t.getAttribute(`${u.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
605
+ r.push(...A.findFragmentByKeyParts(s, e.slice(1)));
606
606
  });
607
- else if (t.hasAttribute(`${l.prefix}form-list`)) {
607
+ else if (t.hasAttribute(`${u.prefix}form-list`)) {
608
608
  if (e.length > 1) {
609
- const n = t.getAttribute(`${l.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
609
+ const n = t.getAttribute(`${u.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
610
610
  if (s !== -1 && a !== -1 && s < a) {
611
611
  const o = i.substring(0, s);
612
612
  if (n === o) {
613
- const h = i.substring(s + 1, a), b = Number(h);
614
- if (isNaN(b))
615
- d.error("Haori", `Invalid index: ${i}`);
613
+ const l = i.substring(s + 1, a), m = Number(l);
614
+ if (isNaN(m))
615
+ f.error("Haori", `Invalid index: ${i}`);
616
616
  else {
617
- const g = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
618
- b < g.length && r.push(
619
- ...y.findFragmentByKeyParts(g[b], e.slice(1))
617
+ const g = t.getChildElementFragments().filter((T) => T.hasAttribute(`${u.prefix}row`));
618
+ m < g.length && r.push(
619
+ ...A.findFragmentByKeyParts(g[m], e.slice(1))
620
620
  );
621
621
  }
622
622
  }
@@ -624,7 +624,7 @@ class y {
624
624
  }
625
625
  } else
626
626
  t.getChildElementFragments().forEach((n) => {
627
- r.push(...y.findFragmentByKeyParts(n, e));
627
+ r.push(...A.findFragmentByKeyParts(n, e));
628
628
  });
629
629
  return r;
630
630
  }
@@ -686,13 +686,13 @@ const M = class M {
686
686
  */
687
687
  static evaluate(t, e = {}) {
688
688
  if (t.trim() === "")
689
- return d.warn("[Haori]", t, "Expression is empty"), null;
689
+ return f.warn("[Haori]", t, "Expression is empty"), null;
690
690
  if (this.containsDangerousPatterns(t))
691
- return d.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
691
+ return f.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
692
692
  if (this.containsForbiddenKeys(e))
693
- return d.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
693
+ return f.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
694
694
  if (this.containsForbiddenBindingValues(e))
695
- return d.warn(
695
+ return f.warn(
696
696
  "[Haori]",
697
697
  e,
698
698
  "Binded values contain forbidden values"
@@ -707,7 +707,7 @@ return (${t});`;
707
707
  try {
708
708
  n = new Function(...r, a), this.EXPRESSION_CACHE.set(i, n);
709
709
  } catch (o) {
710
- return d.error(
710
+ return f.error(
711
711
  "[Haori]",
712
712
  "Failed to compile expression:",
713
713
  t,
@@ -721,7 +721,7 @@ return (${t});`;
721
721
  s.push(a[o]);
722
722
  }), this.withBlockedPropertyAccess(() => n(...s));
723
723
  } catch (s) {
724
- return d.error("[Haori]", "Expression evaluation error:", t, s), s instanceof ReferenceError ? void 0 : null;
724
+ return f.error("[Haori]", "Expression evaluation error:", t, s), s instanceof ReferenceError ? void 0 : null;
725
725
  }
726
726
  }
727
727
  /**
@@ -753,12 +753,12 @@ return (${t});`;
753
753
  const r = [];
754
754
  let i = null;
755
755
  for (let n = 0; n < e.length; n++) {
756
- const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, h = e[n - 2] || null, b = e[n - 3] || null;
756
+ const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, l = e[n - 2] || null, m = e[n - 3] || null;
757
757
  if (this.startsObjectKey(
758
758
  o,
759
759
  i,
760
- h,
761
- b
760
+ l,
761
+ m
762
762
  ) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
763
763
  this.decodeStringLiteral(s.value)
764
764
  )) || s.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(s.value) || this.STRICT_FORBIDDEN_NAMES.includes(s.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(s.value)) || o === "member" && s.value !== "]" && s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
@@ -1035,9 +1035,9 @@ return (${t});`;
1035
1035
  get: (s, a, o) => {
1036
1036
  if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
1037
1037
  return;
1038
- const h = Reflect.get(s, a, o);
1039
- return typeof a == "symbol" ? h : this.wrapBoundValue(
1040
- h,
1038
+ const l = Reflect.get(s, a, o);
1039
+ return typeof a == "symbol" ? l : this.wrapBoundValue(
1040
+ l,
1041
1041
  e
1042
1042
  );
1043
1043
  },
@@ -1047,12 +1047,12 @@ return (${t});`;
1047
1047
  return Reflect.getOwnPropertyDescriptor(s, a);
1048
1048
  },
1049
1049
  apply: (s, a, o) => {
1050
- const h = Reflect.apply(
1050
+ const l = Reflect.apply(
1051
1051
  s,
1052
1052
  a,
1053
1053
  o
1054
1054
  );
1055
- return this.isIteratorLike(h) ? h : this.wrapBoundValue(h, e);
1055
+ return this.isIteratorLike(l) ? l : this.wrapBoundValue(l, e);
1056
1056
  },
1057
1057
  construct: (s, a, o) => this.wrapBoundValue(
1058
1058
  Reflect.construct(
@@ -1274,7 +1274,7 @@ const I = class I {
1274
1274
  e = new Z(t);
1275
1275
  break;
1276
1276
  default:
1277
- return d.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1277
+ return f.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1278
1278
  }
1279
1279
  return e;
1280
1280
  }
@@ -1451,7 +1451,7 @@ class x extends w {
1451
1451
  removeChild(t) {
1452
1452
  const e = this.children.indexOf(t);
1453
1453
  if (e < 0) {
1454
- d.warn("[Haori]", "Child fragment not found.", t);
1454
+ f.warn("[Haori]", "Child fragment not found.", t);
1455
1455
  return;
1456
1456
  }
1457
1457
  this.children.splice(e, 1), t.setParent(null);
@@ -1476,7 +1476,7 @@ class x extends w {
1476
1476
  * clone 時に runtime の hidden 状態だけを落とします。
1477
1477
  */
1478
1478
  normalizeClonedVisibilityState() {
1479
- (this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${l.prefix}if-false`)) && (this.visible = !0, this.display = "", this.getTarget().style.display = "", this.getTarget().removeAttribute(`${l.prefix}if-false`)), this.children.forEach((t) => {
1479
+ (this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${u.prefix}if-false`)) && (this.visible = !0, this.display = "", this.getTarget().style.display = "", this.getTarget().removeAttribute(`${u.prefix}if-false`)), this.children.forEach((t) => {
1480
1480
  t instanceof x && t.normalizeClonedVisibilityState();
1481
1481
  });
1482
1482
  }
@@ -1617,7 +1617,7 @@ class x extends w {
1617
1617
  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 })));
1618
1618
  }).finally(() => {
1619
1619
  this.skipChangeValue = !1;
1620
- })) : (d.warn(
1620
+ })) : (f.warn(
1621
1621
  "[Haori]",
1622
1622
  "setValue is not supported for this element type.",
1623
1623
  r
@@ -1756,7 +1756,7 @@ class x extends w {
1756
1756
  if (e === void 0)
1757
1757
  return null;
1758
1758
  const r = e.evaluate(this.getBindingData());
1759
- return r.length === 1 ? r[0] : $.joinEvaluateResults(r);
1759
+ return r.length === 1 ? r[0] : B.joinEvaluateResults(r);
1760
1760
  }
1761
1761
  /**
1762
1762
  * 属性の生の値を取得します。
@@ -1821,40 +1821,40 @@ class x extends w {
1821
1821
  if (this.skipMutationNodes)
1822
1822
  return Promise.resolve();
1823
1823
  if (t === this)
1824
- return d.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1824
+ return f.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1825
1825
  const i = /* @__PURE__ */ new Set();
1826
1826
  let n = this.parent;
1827
1827
  for (; n; )
1828
1828
  i.add(n), n = n.getParent();
1829
1829
  if (i.has(t))
1830
- return d.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1830
+ return f.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1831
1831
  const s = t.getParent() === this;
1832
1832
  let a = -1, o = -1;
1833
1833
  s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1834
- const h = t.getParent();
1835
- h !== null && h.removeChild(t);
1836
- let b = r === void 0 ? e?.getTarget() || null : r;
1834
+ const l = t.getParent();
1835
+ l !== null && l.removeChild(t);
1836
+ let m = r === void 0 ? e?.getTarget() || null : r;
1837
1837
  if (e === null)
1838
1838
  this.children.push(t);
1839
1839
  else {
1840
- let E;
1841
- if (s ? a !== -1 && a < o ? E = o - 1 : E = o : E = this.children.indexOf(e), E === -1) {
1840
+ let T;
1841
+ if (s ? a !== -1 && a < o ? T = o - 1 : T = o : T = this.children.indexOf(e), T === -1) {
1842
1842
  const v = this.resolveInsertionPointFromDom(
1843
1843
  e,
1844
1844
  !1
1845
1845
  );
1846
- v === null ? (d.warn(
1846
+ v === null ? (f.warn(
1847
1847
  "[Haori]",
1848
1848
  "Reference child not found in children.",
1849
1849
  e
1850
- ), this.children.push(t)) : (this.children.splice(v.index, 0, t), b = v.referenceNode);
1850
+ ), this.children.push(t)) : (this.children.splice(v.index, 0, t), m = v.referenceNode);
1851
1851
  } else
1852
- this.children.splice(E, 0, t);
1852
+ this.children.splice(T, 0, t);
1853
1853
  }
1854
1854
  t.setParent(this), t.setMounted(this.mounted);
1855
1855
  const g = this.skipMutationNodes;
1856
1856
  return this.skipMutationNodes = !0, F.enqueue(() => {
1857
- this.target.insertBefore(t.getTarget(), b);
1857
+ this.target.insertBefore(t.getTarget(), m);
1858
1858
  }).finally(() => {
1859
1859
  this.skipMutationNodes = g;
1860
1860
  });
@@ -1875,7 +1875,7 @@ class x extends w {
1875
1875
  e,
1876
1876
  !0
1877
1877
  );
1878
- return i === null ? (d.warn(
1878
+ return i === null ? (f.warn(
1879
1879
  "[Haori]",
1880
1880
  "Reference child not found in children.",
1881
1881
  e
@@ -1927,7 +1927,7 @@ class x extends w {
1927
1927
  * @returns エレメントの非表示のPromise
1928
1928
  */
1929
1929
  hide() {
1930
- return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${l.prefix}if-false`, ""), Promise.resolve();
1930
+ return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${u.prefix}if-false`, ""), Promise.resolve();
1931
1931
  }
1932
1932
  /**
1933
1933
  * エレメントを表示します。
@@ -1935,7 +1935,7 @@ class x extends w {
1935
1935
  * @return エレメントの表示のPromise
1936
1936
  */
1937
1937
  show() {
1938
- return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${l.prefix}if-false`), this.visible = !0, Promise.resolve();
1938
+ return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${u.prefix}if-false`), this.visible = !0, Promise.resolve();
1939
1939
  }
1940
1940
  /**
1941
1941
  * 指定した属性名を持つ最も近い親要素を返します。
@@ -1959,7 +1959,7 @@ class O extends w {
1959
1959
  * @param target 対象テキストノード
1960
1960
  */
1961
1961
  constructor(t) {
1962
- super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new $(this.text);
1962
+ super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new B(this.text);
1963
1963
  }
1964
1964
  /**
1965
1965
  * フラグメントをクローンします。
@@ -1985,7 +1985,7 @@ class O extends w {
1985
1985
  * @returns 更新のPromise
1986
1986
  */
1987
1987
  setContent(t) {
1988
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new $(t), this.evaluate());
1988
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new B(t), this.evaluate());
1989
1989
  }
1990
1990
  /**
1991
1991
  * フラグメントを評価します。
@@ -1998,7 +1998,7 @@ class O extends w {
1998
1998
  ) : F.enqueue(() => {
1999
1999
  this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
2000
2000
  this.parent.getBindingData()
2001
- )[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
2001
+ )[0] : this.contents.isEvaluate ? this.target.textContent = B.joinEvaluateResults(
2002
2002
  this.contents.evaluate(this.parent.getBindingData())
2003
2003
  ) : this.target.textContent = this.text;
2004
2004
  }).finally(() => {
@@ -2047,7 +2047,7 @@ class Z extends w {
2047
2047
  }));
2048
2048
  }
2049
2049
  }
2050
- const K = class K {
2050
+ const G = class G {
2051
2051
  /**
2052
2052
  * コンストラクタ。
2053
2053
  *
@@ -2055,7 +2055,7 @@ const K = class K {
2055
2055
  */
2056
2056
  constructor(t) {
2057
2057
  this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = t;
2058
- const e = [...t.matchAll(K.PLACEHOLDER_REGEX)];
2058
+ const e = [...t.matchAll(G.PLACEHOLDER_REGEX)];
2059
2059
  let r = 0, i = !1, n = !1;
2060
2060
  for (const s of e) {
2061
2061
  s.index > r && this.contents.push({
@@ -2098,7 +2098,7 @@ const K = class K {
2098
2098
  */
2099
2099
  checkRawExpressions() {
2100
2100
  for (let t = 0; t < this.contents.length; t++)
2101
- this.contents[t].type === 2 && this.contents.length > 1 && (d.error(
2101
+ this.contents[t].type === 2 && this.contents.length > 1 && (f.error(
2102
2102
  "[Haori]",
2103
2103
  "Raw expressions are not allowed in multi-content expressions."
2104
2104
  ), this.contents[t].type = 1);
@@ -2121,7 +2121,7 @@ const K = class K {
2121
2121
  } else
2122
2122
  e.push(r.text);
2123
2123
  } catch (i) {
2124
- d.error(
2124
+ f.error(
2125
2125
  "[Haori]",
2126
2126
  `Error evaluating text expression: ${r.text}`,
2127
2127
  i
@@ -2130,9 +2130,9 @@ const K = class K {
2130
2130
  }), e;
2131
2131
  }
2132
2132
  };
2133
- K.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2134
- let $ = K;
2135
- const G = class G extends $ {
2133
+ G.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2134
+ let B = G;
2135
+ const K = class K extends B {
2136
2136
  /**
2137
2137
  * コンストラクタ。
2138
2138
  *
@@ -2140,7 +2140,7 @@ const G = class G extends $ {
2140
2140
  * @param text 属性値
2141
2141
  */
2142
2142
  constructor(t, e) {
2143
- super(e), this.forceEvaluation = G.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2143
+ super(e), this.forceEvaluation = K.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2144
2144
  }
2145
2145
  /**
2146
2146
  * 強制評価フラグを取得します。
@@ -2168,26 +2168,26 @@ const G = class G extends $ {
2168
2168
  } else
2169
2169
  e.push(r.text);
2170
2170
  } catch (i) {
2171
- d.error(
2171
+ f.error(
2172
2172
  "[Haori]",
2173
2173
  `Error evaluating attribute expression: ${r.text}`,
2174
2174
  i
2175
2175
  ), e.push("");
2176
2176
  }
2177
- }), this.forceEvaluation && e.length > 1 ? (d.error(
2177
+ }), this.forceEvaluation && e.length > 1 ? (f.error(
2178
2178
  "[Haori]",
2179
2179
  "each or if expressions must have a single content.",
2180
2180
  e
2181
2181
  ), [e[0]]) : e;
2182
2182
  }
2183
2183
  };
2184
- G.FORCE_EVALUATION_ATTRIBUTES = [
2184
+ K.FORCE_EVALUATION_ATTRIBUTES = [
2185
2185
  "data-if",
2186
2186
  "hor-if",
2187
2187
  "data-each",
2188
2188
  "hor-each"
2189
2189
  ];
2190
- let U = G;
2190
+ let U = K;
2191
2191
  class N {
2192
2192
  /**
2193
2193
  * カスタムイベントを発火します。
@@ -2269,9 +2269,9 @@ class N {
2269
2269
  */
2270
2270
  static bindChange(t, e, r, i = "other") {
2271
2271
  const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
2272
- for (const h of o) {
2273
- const b = e?.[h], g = r[h];
2274
- b !== g && n.push(h);
2272
+ for (const l of o) {
2273
+ const m = e?.[l], g = r[l];
2274
+ m !== g && n.push(l);
2275
2275
  }
2276
2276
  N.dispatch(t, "bindchange", {
2277
2277
  previous: e || {},
@@ -2411,20 +2411,20 @@ function W() {
2411
2411
  ) ? t : X;
2412
2412
  }
2413
2413
  const lt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
2414
- function ut(P) {
2415
- return lt.has(P.toUpperCase());
2414
+ function ut(R) {
2415
+ return lt.has(R.toUpperCase());
2416
2416
  }
2417
- function ct(P, t) {
2417
+ function ct(R, t) {
2418
2418
  for (const [e, r] of Object.entries(t))
2419
- r !== void 0 && (r === null ? P.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
2420
- P.append(e, String(i));
2421
- }) : typeof r == "object" || typeof r == "function" ? P.append(e, JSON.stringify(r)) : P.append(e, String(r)));
2419
+ r !== void 0 && (r === null ? R.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
2420
+ R.append(e, String(i));
2421
+ }) : typeof r == "object" || typeof r == "function" ? R.append(e, JSON.stringify(r)) : R.append(e, String(r)));
2422
2422
  }
2423
- function ht(P, t) {
2424
- const e = new URL(P, window.location.href), r = new URLSearchParams(e.search);
2423
+ function ht(R, t) {
2424
+ const e = new URL(R, window.location.href), r = new URLSearchParams(e.search);
2425
2425
  return ct(r, t), e.search = r.toString(), e.toString();
2426
2426
  }
2427
- const u = class u {
2427
+ const c = class c {
2428
2428
  /**
2429
2429
  * イベント属性名を正しく生成します。
2430
2430
  * 例: ("click", "fetch") => "data-click-fetch"
@@ -2433,7 +2433,7 @@ const u = class u {
2433
2433
  * 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
2434
2434
  */
2435
2435
  static attrName(t, e, r = !1) {
2436
- return t ? `${l.prefix}${t}-${e}` : r ? `${l.prefix}fetch-${e}` : `${l.prefix}${e}`;
2436
+ return t ? `${u.prefix}${t}-${e}` : r ? `${u.prefix}fetch-${e}` : `${u.prefix}${e}`;
2437
2437
  }
2438
2438
  /**
2439
2439
  * data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
@@ -2444,7 +2444,7 @@ const u = class u {
2444
2444
  */
2445
2445
  static resolveDataParamString(t, e) {
2446
2446
  return t.replace(
2447
- u.DATA_PLACEHOLDER_REGEX,
2447
+ c.DATA_PLACEHOLDER_REGEX,
2448
2448
  (r, i, n) => {
2449
2449
  const s = j.evaluate(
2450
2450
  i ?? n ?? "",
@@ -2501,7 +2501,7 @@ const u = class u {
2501
2501
  static stringifyJsonTemplateStringContent(t) {
2502
2502
  if (t == null || Number.isNaN(t))
2503
2503
  return "";
2504
- const e = typeof t == "object" ? u.stringifyJsonTemplateValue(t) : String(t);
2504
+ const e = typeof t == "object" ? c.stringifyJsonTemplateValue(t) : String(t);
2505
2505
  return JSON.stringify(e).slice(1, -1);
2506
2506
  }
2507
2507
  /**
@@ -2513,13 +2513,13 @@ const u = class u {
2513
2513
  */
2514
2514
  static resolveDataJsonString(t, e) {
2515
2515
  return t.replace(
2516
- u.DATA_PLACEHOLDER_REGEX,
2516
+ c.DATA_PLACEHOLDER_REGEX,
2517
2517
  (r, i, n, s) => {
2518
2518
  const a = j.evaluate(
2519
2519
  i ?? n ?? "",
2520
2520
  e
2521
2521
  );
2522
- return u.isJsonStringContext(t, s) ? u.stringifyJsonTemplateStringContent(a) : u.stringifyJsonTemplateValue(a);
2522
+ return c.isJsonStringContext(t, s) ? c.stringifyJsonTemplateStringContent(a) : c.stringifyJsonTemplateValue(a);
2523
2523
  }
2524
2524
  );
2525
2525
  }
@@ -2537,13 +2537,13 @@ const u = class u {
2537
2537
  if (typeof i != "string" || r === null)
2538
2538
  return null;
2539
2539
  const n = r.trim();
2540
- return u.SINGLE_PLACEHOLDER_REGEX.test(n) ? R.parseDataBind(i) : n.startsWith("{") || n.startsWith("[") ? R.parseDataBind(
2541
- u.resolveDataJsonString(
2540
+ return c.SINGLE_PLACEHOLDER_REGEX.test(n) ? P.parseDataBind(i) : n.startsWith("{") || n.startsWith("[") ? P.parseDataBind(
2541
+ c.resolveDataJsonString(
2542
2542
  r,
2543
2543
  t.getBindingData()
2544
2544
  )
2545
- ) : R.parseDataBind(
2546
- u.resolveDataParamString(r, t.getBindingData())
2545
+ ) : P.parseDataBind(
2546
+ c.resolveDataParamString(r, t.getBindingData())
2547
2547
  );
2548
2548
  }
2549
2549
  /**
@@ -2558,30 +2558,30 @@ const u = class u {
2558
2558
  targetFragment: t
2559
2559
  };
2560
2560
  if (e) {
2561
- if (t.hasAttribute(u.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(u.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2562
- u.attrName(e, "confirm")
2561
+ if (t.hasAttribute(c.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(c.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2562
+ c.attrName(e, "confirm")
2563
2563
  ).replace(/\\n/g, `
2564
- `)), t.hasAttribute(u.attrName(e, "data")) && (r.data = u.resolveDataAttribute(
2564
+ `)), t.hasAttribute(c.attrName(e, "data")) && (r.data = c.resolveDataAttribute(
2565
2565
  t,
2566
- u.attrName(e, "data")
2567
- )), t.hasAttribute(u.attrName(e, "form"))) {
2568
- const c = t.getRawAttribute(
2569
- u.attrName(e, "form")
2566
+ c.attrName(e, "data")
2567
+ )), t.hasAttribute(c.attrName(e, "form"))) {
2568
+ const h = t.getRawAttribute(
2569
+ c.attrName(e, "form")
2570
2570
  );
2571
- if (c) {
2572
- const f = document.body.querySelector(c);
2573
- f !== null ? r.formFragment = y.getFormFragment(
2574
- w.get(f)
2575
- ) : d.error(
2571
+ if (h) {
2572
+ const d = document.body.querySelector(h);
2573
+ d !== null ? r.formFragment = A.getFormFragment(
2574
+ w.get(d)
2575
+ ) : f.error(
2576
2576
  "Haori",
2577
- `Form element not found: ${c} (${u.attrName(e, "form")})`
2577
+ `Form element not found: ${h} (${c.attrName(e, "form")})`
2578
2578
  );
2579
2579
  } else
2580
- r.formFragment = y.getFormFragment(t);
2581
- } else e === "change" && (r.formFragment = y.getFormFragment(t));
2582
- if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
2583
- const c = t.getRawAttribute(
2584
- `${l.prefix}${e}-before-run`
2580
+ r.formFragment = A.getFormFragment(t);
2581
+ } else e === "change" && (r.formFragment = A.getFormFragment(t));
2582
+ if (t.hasAttribute(`${u.prefix}${e}-before-run`)) {
2583
+ const h = t.getRawAttribute(
2584
+ `${u.prefix}${e}-before-run`
2585
2585
  );
2586
2586
  try {
2587
2587
  r.beforeCallback = new Function(
@@ -2589,70 +2589,70 @@ const u = class u {
2589
2589
  "fetchOptions",
2590
2590
  `
2591
2591
  "use strict";
2592
- ${c}
2592
+ ${h}
2593
2593
  `
2594
2594
  );
2595
- } catch (f) {
2596
- d.error("Haori", `Invalid before script: ${f}`);
2595
+ } catch (d) {
2596
+ f.error("Haori", `Invalid before script: ${d}`);
2597
2597
  }
2598
2598
  }
2599
2599
  }
2600
- const i = u.attrName(e, "fetch"), n = t.hasAttribute(i);
2600
+ const i = c.attrName(e, "fetch"), n = t.hasAttribute(i);
2601
2601
  n && (r.fetchUrl = t.getAttribute(i));
2602
2602
  const s = {};
2603
2603
  if (e) {
2604
- const c = u.attrName(e, "fetch-method");
2605
- t.hasAttribute(c) && (s.method = t.getAttribute(
2606
- c
2604
+ const h = c.attrName(e, "fetch-method");
2605
+ t.hasAttribute(h) && (s.method = t.getAttribute(
2606
+ h
2607
2607
  ));
2608
2608
  } else {
2609
- const c = u.attrName(null, "method", !0);
2610
- t.hasAttribute(c) && (s.method = t.getAttribute(
2611
- c
2609
+ const h = c.attrName(null, "method", !0);
2610
+ t.hasAttribute(h) && (s.method = t.getAttribute(
2611
+ h
2612
2612
  ));
2613
2613
  }
2614
2614
  if (e) {
2615
- const c = u.attrName(e, "fetch-headers");
2616
- if (t.hasAttribute(c)) {
2617
- const f = t.getRawAttribute(
2618
- c
2615
+ const h = c.attrName(e, "fetch-headers");
2616
+ if (t.hasAttribute(h)) {
2617
+ const d = t.getRawAttribute(
2618
+ h
2619
2619
  );
2620
2620
  try {
2621
- s.headers = R.parseDataBind(f);
2622
- } catch (m) {
2623
- d.error("Haori", `Invalid fetch headers: ${m}`);
2621
+ s.headers = P.parseDataBind(d);
2622
+ } catch (b) {
2623
+ f.error("Haori", `Invalid fetch headers: ${b}`);
2624
2624
  }
2625
2625
  }
2626
2626
  } else {
2627
- const c = u.attrName(
2627
+ const h = c.attrName(
2628
2628
  null,
2629
2629
  "headers",
2630
2630
  !0
2631
2631
  );
2632
- if (t.hasAttribute(c)) {
2633
- const f = t.getRawAttribute(
2634
- c
2632
+ if (t.hasAttribute(h)) {
2633
+ const d = t.getRawAttribute(
2634
+ h
2635
2635
  );
2636
2636
  try {
2637
- s.headers = R.parseDataBind(f);
2638
- } catch (m) {
2639
- d.error("Haori", `Invalid fetch headers: ${m}`);
2637
+ s.headers = P.parseDataBind(d);
2638
+ } catch (b) {
2639
+ f.error("Haori", `Invalid fetch headers: ${b}`);
2640
2640
  }
2641
2641
  }
2642
2642
  }
2643
2643
  if (e) {
2644
- const c = u.attrName(
2644
+ const h = c.attrName(
2645
2645
  e,
2646
2646
  "fetch-content-type"
2647
2647
  );
2648
- if (t.hasAttribute(c))
2648
+ if (t.hasAttribute(h))
2649
2649
  s.headers = {
2650
2650
  ...s.headers,
2651
- "Content-Type": t.getAttribute(c)
2651
+ "Content-Type": t.getAttribute(h)
2652
2652
  };
2653
2653
  else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
2654
- let f = !1;
2655
- s.headers && typeof s.headers == "object" && (f = "Content-Type" in s.headers), f || (s.headers = {
2654
+ let d = !1;
2655
+ s.headers && typeof s.headers == "object" && (d = "Content-Type" in s.headers), d || (s.headers = {
2656
2656
  ...s.headers,
2657
2657
  "Content-Type": "application/json"
2658
2658
  });
@@ -2661,19 +2661,19 @@ ${c}
2661
2661
  "Content-Type": "application/x-www-form-urlencoded"
2662
2662
  });
2663
2663
  } else {
2664
- const c = u.attrName(
2664
+ const h = c.attrName(
2665
2665
  null,
2666
2666
  "content-type",
2667
2667
  !0
2668
2668
  );
2669
- if (t.hasAttribute(c))
2669
+ if (t.hasAttribute(h))
2670
2670
  s.headers = {
2671
2671
  ...s.headers,
2672
- "Content-Type": t.getAttribute(c)
2672
+ "Content-Type": t.getAttribute(h)
2673
2673
  };
2674
2674
  else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
2675
- let f = !1;
2676
- s.headers && typeof s.headers == "object" && (f = "Content-Type" in s.headers), f || (s.headers = {
2675
+ let d = !1;
2676
+ s.headers && typeof s.headers == "object" && (d = "Content-Type" in s.headers), d || (s.headers = {
2677
2677
  ...s.headers,
2678
2678
  "Content-Type": "application/json"
2679
2679
  });
@@ -2683,122 +2683,122 @@ ${c}
2683
2683
  });
2684
2684
  }
2685
2685
  Object.keys(s).length > 0 && (r.fetchOptions = s);
2686
- const a = e ? u.attrName(e, "bind") : u.attrName(null, "bind", !0);
2686
+ const a = e ? c.attrName(e, "bind") : c.attrName(null, "bind", !0);
2687
2687
  if (t.hasAttribute(a)) {
2688
- const c = t.getRawAttribute(a);
2689
- if (c) {
2690
- const f = document.body.querySelectorAll(c);
2691
- f.length > 0 ? (r.bindFragments = [], f.forEach((m) => {
2692
- const A = w.get(m);
2693
- A && r.bindFragments.push(A);
2694
- })) : d.error(
2688
+ const h = t.getRawAttribute(a);
2689
+ if (h) {
2690
+ const d = document.body.querySelectorAll(h);
2691
+ d.length > 0 ? (r.bindFragments = [], d.forEach((b) => {
2692
+ const E = w.get(b);
2693
+ E && r.bindFragments.push(E);
2694
+ })) : f.error(
2695
2695
  "Haori",
2696
- `Bind element not found: ${c} (${a})`
2696
+ `Bind element not found: ${h} (${a})`
2697
2697
  );
2698
2698
  }
2699
2699
  }
2700
- const o = u.attrName(e, "bind-arg"), h = u.attrName(
2700
+ const o = c.attrName(e, "bind-arg"), l = c.attrName(
2701
2701
  null,
2702
2702
  "arg",
2703
2703
  !0
2704
- ), b = u.attrName(
2704
+ ), m = c.attrName(
2705
2705
  null,
2706
2706
  "bind-arg",
2707
2707
  !0
2708
2708
  );
2709
- e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(h) ? r.bindArg = t.getRawAttribute(
2710
- h
2711
- ) : t.hasAttribute(b) && (r.bindArg = t.getRawAttribute(b));
2712
- const g = e ? u.attrName(e, "bind-params") : u.attrName(null, "bind-params", !0);
2709
+ e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(l) ? r.bindArg = t.getRawAttribute(
2710
+ l
2711
+ ) : t.hasAttribute(m) && (r.bindArg = t.getRawAttribute(m));
2712
+ const g = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2713
2713
  if (t.hasAttribute(g)) {
2714
- const c = t.getRawAttribute(g);
2715
- r.bindParams = c.split("&").map((f) => f.trim());
2714
+ const h = t.getRawAttribute(g);
2715
+ r.bindParams = h.split("&").map((d) => d.trim());
2716
2716
  }
2717
- const E = e ? u.attrName(e, "bind-append") : u.attrName(null, "bind-append", !0);
2718
- if (t.hasAttribute(E)) {
2719
- const c = t.getRawAttribute(E);
2720
- r.bindAppendParams = c.split("&").map((f) => f.trim()).filter(Boolean);
2717
+ const T = e ? c.attrName(e, "bind-append") : c.attrName(null, "bind-append", !0);
2718
+ if (t.hasAttribute(T)) {
2719
+ const h = t.getRawAttribute(T);
2720
+ r.bindAppendParams = h.split("&").map((d) => d.trim()).filter(Boolean);
2721
2721
  }
2722
- const v = e ? u.attrName(e, "copy-params") : null;
2722
+ const v = e ? c.attrName(e, "copy-params") : null;
2723
2723
  if (v && t.hasAttribute(v)) {
2724
- const c = t.getRawAttribute(
2724
+ const h = t.getRawAttribute(
2725
2725
  v
2726
2726
  );
2727
- r.copyParams = c.split("&").map((f) => f.trim()).filter(Boolean);
2727
+ r.copyParams = h.split("&").map((d) => d.trim()).filter(Boolean);
2728
2728
  }
2729
2729
  if (e) {
2730
- if (t.hasAttribute(u.attrName(e, "adjust"))) {
2731
- const f = t.getRawAttribute(
2732
- u.attrName(e, "adjust")
2730
+ if (t.hasAttribute(c.attrName(e, "adjust"))) {
2731
+ const d = t.getRawAttribute(
2732
+ c.attrName(e, "adjust")
2733
2733
  );
2734
- if (f) {
2735
- const m = document.body.querySelectorAll(f);
2736
- m.length > 0 ? (r.adjustFragments = [], m.forEach((A) => {
2737
- const T = w.get(A);
2738
- T && r.adjustFragments.push(T);
2739
- })) : d.error(
2734
+ if (d) {
2735
+ const b = document.body.querySelectorAll(d);
2736
+ b.length > 0 ? (r.adjustFragments = [], b.forEach((E) => {
2737
+ const y = w.get(E);
2738
+ y && r.adjustFragments.push(y);
2739
+ })) : f.error(
2740
2740
  "Haori",
2741
- `Adjust element not found: ${f} (${u.attrName(e, "adjust")})`
2741
+ `Adjust element not found: ${d} (${c.attrName(e, "adjust")})`
2742
2742
  );
2743
2743
  }
2744
- if (t.hasAttribute(u.attrName(e, "adjust-value"))) {
2745
- const m = t.getRawAttribute(
2746
- u.attrName(e, "adjust-value")
2747
- ), A = Number(m);
2748
- isNaN(A) || (r.adjustValue = A);
2744
+ if (t.hasAttribute(c.attrName(e, "adjust-value"))) {
2745
+ const b = t.getRawAttribute(
2746
+ c.attrName(e, "adjust-value")
2747
+ ), E = Number(b);
2748
+ isNaN(E) || (r.adjustValue = E);
2749
2749
  }
2750
2750
  }
2751
- if (t.hasAttribute(u.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(u.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(u.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(u.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${l.prefix}${e}-after-run`)) {
2752
- const f = t.getRawAttribute(
2753
- `${l.prefix}${e}-after-run`
2751
+ 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(`${u.prefix}${e}-after-run`)) {
2752
+ const d = t.getRawAttribute(
2753
+ `${u.prefix}${e}-after-run`
2754
2754
  );
2755
2755
  try {
2756
2756
  r.afterCallback = new Function(
2757
2757
  "response",
2758
2758
  `
2759
2759
  "use strict";
2760
- ${f}
2760
+ ${d}
2761
2761
  `
2762
2762
  );
2763
- } catch (m) {
2764
- d.error("Haori", `Invalid after script: ${m}`);
2763
+ } catch (b) {
2764
+ f.error("Haori", `Invalid after script: ${b}`);
2765
2765
  }
2766
2766
  }
2767
- if (t.hasAttribute(u.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2768
- u.attrName(e, "dialog")
2767
+ if (t.hasAttribute(c.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2768
+ c.attrName(e, "dialog")
2769
2769
  ).replace(/\\n/g, `
2770
- `)), t.hasAttribute(u.attrName(e, "toast"))) {
2770
+ `)), t.hasAttribute(c.attrName(e, "toast"))) {
2771
2771
  r.toastMessage = t.getAttribute(
2772
- u.attrName(e, "toast")
2772
+ c.attrName(e, "toast")
2773
2773
  );
2774
- const f = t.getRawAttribute(
2775
- u.attrName(e, "toast-level")
2776
- ), A = ["info", "warning", "error", "success"].includes(f);
2777
- r.toastLevel = A ? f : null;
2774
+ const d = t.getRawAttribute(
2775
+ c.attrName(e, "toast-level")
2776
+ ), E = ["info", "warning", "error", "success"].includes(d);
2777
+ r.toastLevel = E ? d : null;
2778
2778
  }
2779
- if (t.hasAttribute(u.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2780
- u.attrName(e, "redirect")
2781
- )), t.hasAttribute(u.attrName(e, "scroll-error")) && (r.scrollOnError = !0), t.hasAttribute(u.attrName(e, "scroll")) && (r.scrollTarget = t.getAttribute(
2782
- u.attrName(e, "scroll")
2783
- )), t.hasAttribute(u.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
2784
- u.attrName(e, "history")
2785
- )), t.hasAttribute(u.attrName(e, "history-data")) && (r.historyData = u.resolveDataAttribute(
2779
+ if (t.hasAttribute(c.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2780
+ c.attrName(e, "redirect")
2781
+ )), t.hasAttribute(c.attrName(e, "scroll-error")) && (r.scrollOnError = !0), t.hasAttribute(c.attrName(e, "scroll")) && (r.scrollTarget = t.getAttribute(
2782
+ c.attrName(e, "scroll")
2783
+ )), t.hasAttribute(c.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
2784
+ c.attrName(e, "history")
2785
+ )), t.hasAttribute(c.attrName(e, "history-data")) && (r.historyData = c.resolveDataAttribute(
2786
2786
  t,
2787
- u.attrName(e, "history-data")
2788
- )), t.hasAttribute(u.attrName(e, "history-form"))) {
2789
- const f = t.getRawAttribute(
2790
- u.attrName(e, "history-form")
2787
+ c.attrName(e, "history-data")
2788
+ )), t.hasAttribute(c.attrName(e, "history-form"))) {
2789
+ const d = t.getRawAttribute(
2790
+ c.attrName(e, "history-form")
2791
2791
  );
2792
- if (f) {
2793
- const m = document.body.querySelector(f);
2794
- m !== null ? r.historyFormFragment = y.getFormFragment(
2795
- w.get(m)
2796
- ) : d.error(
2792
+ if (d) {
2793
+ const b = document.body.querySelector(d);
2794
+ b !== null ? r.historyFormFragment = A.getFormFragment(
2795
+ w.get(b)
2796
+ ) : f.error(
2797
2797
  "Haori",
2798
- `Form element not found: ${f} (${u.attrName(e, "history-form")})`
2798
+ `Form element not found: ${d} (${c.attrName(e, "history-form")})`
2799
2799
  );
2800
2800
  } else
2801
- r.historyFormFragment = y.getFormFragment(t);
2801
+ r.historyFormFragment = A.getFormFragment(t);
2802
2802
  }
2803
2803
  [
2804
2804
  "reset",
@@ -2807,54 +2807,54 @@ ${f}
2807
2807
  "copy",
2808
2808
  "open",
2809
2809
  "close"
2810
- ].forEach((f) => {
2811
- const m = u.attrName(e, f);
2812
- if (!t.hasAttribute(m))
2810
+ ].forEach((d) => {
2811
+ const b = c.attrName(e, d);
2812
+ if (!t.hasAttribute(b))
2813
2813
  return;
2814
- const A = t.getRawAttribute(m), T = [];
2815
- if (A ? (document.body.querySelectorAll(A).forEach((J) => {
2814
+ const E = t.getRawAttribute(b), y = [];
2815
+ if (E ? (document.body.querySelectorAll(E).forEach((J) => {
2816
2816
  const tt = w.get(J);
2817
- tt && T.push(tt);
2818
- }), T.length === 0 && d.error("Haori", `Element not found: ${A} (${m})`)) : T.push(t), T.length > 0)
2819
- switch (f) {
2817
+ tt && y.push(tt);
2818
+ }), y.length === 0 && f.error("Haori", `Element not found: ${E} (${b})`)) : y.push(t), y.length > 0)
2819
+ switch (d) {
2820
2820
  case "reset":
2821
- r.resetFragments = T;
2821
+ r.resetFragments = y;
2822
2822
  break;
2823
2823
  case "refetch":
2824
- r.refetchFragments = T;
2824
+ r.refetchFragments = y;
2825
2825
  break;
2826
2826
  case "click":
2827
- r.clickFragments = T;
2827
+ r.clickFragments = y;
2828
2828
  break;
2829
2829
  case "copy":
2830
- r.copyFragments = T;
2830
+ r.copyFragments = y;
2831
2831
  break;
2832
2832
  case "open":
2833
- r.openFragments = T;
2833
+ r.openFragments = y;
2834
2834
  break;
2835
2835
  case "close":
2836
- r.closeFragments = T;
2836
+ r.closeFragments = y;
2837
2837
  break;
2838
2838
  }
2839
2839
  });
2840
2840
  }
2841
- if (!e && (t.hasAttribute(u.attrName(null, "data", !0)) && (r.data = u.resolveDataAttribute(
2841
+ if (!e && (t.hasAttribute(c.attrName(null, "data", !0)) && (r.data = c.resolveDataAttribute(
2842
2842
  t,
2843
- u.attrName(null, "data", !0)
2844
- )), t.hasAttribute(u.attrName(null, "form", !0)))) {
2845
- const c = t.getRawAttribute(
2846
- u.attrName(null, "form", !0)
2843
+ c.attrName(null, "data", !0)
2844
+ )), t.hasAttribute(c.attrName(null, "form", !0)))) {
2845
+ const h = t.getRawAttribute(
2846
+ c.attrName(null, "form", !0)
2847
2847
  );
2848
- if (c) {
2849
- const f = document.body.querySelector(c);
2850
- f !== null ? r.formFragment = y.getFormFragment(
2851
- w.get(f)
2852
- ) : d.error(
2848
+ if (h) {
2849
+ const d = document.body.querySelector(h);
2850
+ d !== null ? r.formFragment = A.getFormFragment(
2851
+ w.get(d)
2852
+ ) : f.error(
2853
2853
  "Haori",
2854
- `Form element not found: ${c} (${u.attrName(null, "fetch-form", !0)})`
2854
+ `Form element not found: ${h} (${c.attrName(null, "fetch-form", !0)})`
2855
2855
  );
2856
2856
  } else
2857
- r.formFragment = y.getFormFragment(t);
2857
+ r.formFragment = A.getFormFragment(t);
2858
2858
  }
2859
2859
  return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
2860
2860
  }
@@ -2877,7 +2877,7 @@ ${f}
2877
2877
  * @param arg2 イベント名
2878
2878
  */
2879
2879
  constructor(t, e = null) {
2880
- u.isElementFragment(t) ? this.options = u.buildOptions(t, e) : this.options = t;
2880
+ c.isElementFragment(t) ? (this.options = c.buildOptions(t, e), this.eventType = e) : (this.options = t, this.eventType = null);
2881
2881
  }
2882
2882
  /**
2883
2883
  * 一連の処理を実行します。オプションが空の場合は即座にresolveされます。
@@ -2902,100 +2902,130 @@ ${f}
2902
2902
  * @returns 実行成功時は true、停止や失敗時は false
2903
2903
  */
2904
2904
  async execute() {
2905
- if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || !await this.confirm())
2905
+ const t = this.acquireExecutionLock();
2906
+ if (t === !1)
2906
2907
  return !1;
2907
- let e = this.options.fetchUrl, r = this.options.fetchOptions;
2908
- if (this.options.beforeCallback) {
2909
- const o = this.options.beforeCallback(
2910
- e || null,
2911
- r || null
2912
- );
2913
- if (o != null) {
2914
- if (o === !1 || typeof o == "object" && o.stop)
2915
- return !1;
2916
- typeof o == "object" && (e = "fetchUrl" in o ? o.fetchUrl : e, r = "fetchOptions" in o ? o.fetchOptions : r);
2908
+ try {
2909
+ if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1 || !await this.confirm())
2910
+ return !1;
2911
+ let r = this.options.fetchUrl, i = this.options.fetchOptions;
2912
+ if (this.options.beforeCallback) {
2913
+ const l = this.options.beforeCallback(
2914
+ r || null,
2915
+ i || null
2916
+ );
2917
+ if (l != null) {
2918
+ if (l === !1 || typeof l == "object" && l.stop)
2919
+ return !1;
2920
+ typeof l == "object" && (r = "fetchUrl" in l ? l.fetchUrl : r, i = "fetchOptions" in l ? l.fetchOptions : i);
2921
+ }
2917
2922
  }
2918
- }
2919
- const i = {};
2920
- if (this.options.formFragment) {
2921
- const o = y.getValues(this.options.formFragment);
2922
- Object.assign(i, o);
2923
- }
2924
- this.options.data && typeof this.options.data == "object" && Object.assign(i, this.options.data);
2925
- const n = Object.keys(i).length > 0;
2926
- if (e) {
2927
- const o = { ...r || {} }, h = new Headers(
2928
- o.headers || void 0
2929
- ), b = (o.method || "GET").toUpperCase(), g = l.runtime === "demo" && !ut(b), E = g ? "GET" : b;
2930
- if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
2931
- n && (e = ht(e, i));
2932
- else if (n) {
2933
- const c = h.get("Content-Type") || "";
2934
- if (/multipart\/form-data/i.test(c)) {
2935
- h.delete("Content-Type");
2936
- const f = new FormData();
2937
- for (const [m, A] of Object.entries(i))
2938
- A == null ? f.append(m, "") : A instanceof Blob ? f.append(m, A) : Array.isArray(A) ? A.forEach((T) => f.append(m, String(T))) : typeof A == "object" ? f.append(m, JSON.stringify(A)) : f.append(m, String(A));
2939
- o.body = f;
2940
- } else if (/application\/x-www-form-urlencoded/i.test(c)) {
2941
- const f = new URLSearchParams();
2942
- for (const [m, A] of Object.entries(i))
2943
- A !== void 0 && (A === null ? f.append(m, "") : Array.isArray(A) ? A.forEach((T) => f.append(m, String(T))) : typeof A == "object" ? f.append(m, JSON.stringify(A)) : f.append(m, String(A)));
2944
- o.body = f;
2945
- } else
2946
- h.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
2923
+ const n = {};
2924
+ if (this.options.formFragment) {
2925
+ const l = A.getValues(this.options.formFragment);
2926
+ Object.assign(n, l);
2947
2927
  }
2948
- o.headers = h;
2949
- let v;
2950
- if (g && (v = e && new URL(e, window.location.href).search || void 0, h.delete("Content-Type"), d.info("Haori demo fetch normalization", {
2951
- runtime: l.runtime,
2952
- requestedMethod: b,
2953
- effectiveMethod: E,
2954
- transportMode: "query-get",
2955
- url: e,
2956
- payload: n ? i : void 0,
2957
- queryString: v
2958
- })), this.options.targetFragment && e) {
2959
- const c = performance.now(), f = {
2960
- runtime: l.runtime,
2961
- requestedMethod: b,
2962
- effectiveMethod: E,
2963
- transportMode: g ? "query-get" : "http",
2964
- ...g ? { queryString: v } : {}
2965
- };
2966
- return N.fetchStart(
2967
- this.options.targetFragment.getTarget(),
2968
- e,
2969
- o,
2970
- n ? i : void 0,
2971
- f
2972
- ), fetch(e, o).then((m) => this.handleFetchResult(
2973
- m,
2974
- e || void 0,
2975
- c
2976
- )).catch((m) => {
2977
- throw e && N.fetchError(
2928
+ this.options.data && typeof this.options.data == "object" && Object.assign(n, this.options.data);
2929
+ const s = Object.keys(n).length > 0;
2930
+ if (r) {
2931
+ const l = { ...i || {} }, m = new Headers(
2932
+ l.headers || void 0
2933
+ ), g = (l.method || "GET").toUpperCase(), T = u.runtime === "demo" && !ut(g), v = T ? "GET" : g;
2934
+ if (l.method = v, v === "GET" || v === "HEAD" || v === "OPTIONS")
2935
+ s && (r = ht(r, n));
2936
+ else if (s) {
2937
+ const d = m.get("Content-Type") || "";
2938
+ if (/multipart\/form-data/i.test(d)) {
2939
+ m.delete("Content-Type");
2940
+ const b = new FormData();
2941
+ for (const [E, y] of Object.entries(n))
2942
+ y == null ? b.append(E, "") : y instanceof Blob ? b.append(E, y) : Array.isArray(y) ? y.forEach((D) => b.append(E, String(D))) : typeof y == "object" ? b.append(E, JSON.stringify(y)) : b.append(E, String(y));
2943
+ l.body = b;
2944
+ } else if (/application\/x-www-form-urlencoded/i.test(d)) {
2945
+ const b = new URLSearchParams();
2946
+ for (const [E, y] of Object.entries(n))
2947
+ y !== void 0 && (y === null ? b.append(E, "") : Array.isArray(y) ? y.forEach((D) => b.append(E, String(D))) : typeof y == "object" ? b.append(E, JSON.stringify(y)) : b.append(E, String(y)));
2948
+ l.body = b;
2949
+ } else
2950
+ m.set("Content-Type", "application/json"), l.body = JSON.stringify(n);
2951
+ }
2952
+ l.headers = m;
2953
+ let h;
2954
+ if (T && (h = r && new URL(r, window.location.href).search || void 0, m.delete("Content-Type"), f.info("Haori demo fetch normalization", {
2955
+ runtime: u.runtime,
2956
+ requestedMethod: g,
2957
+ effectiveMethod: v,
2958
+ transportMode: "query-get",
2959
+ url: r,
2960
+ payload: s ? n : void 0,
2961
+ queryString: h
2962
+ })), this.options.targetFragment && r) {
2963
+ const d = performance.now(), b = {
2964
+ runtime: u.runtime,
2965
+ requestedMethod: g,
2966
+ effectiveMethod: v,
2967
+ transportMode: T ? "query-get" : "http",
2968
+ ...T ? { queryString: h } : {}
2969
+ };
2970
+ return N.fetchStart(
2978
2971
  this.options.targetFragment.getTarget(),
2979
- e,
2980
- m
2981
- ), m;
2982
- });
2972
+ r,
2973
+ l,
2974
+ s ? n : void 0,
2975
+ b
2976
+ ), fetch(r, l).then((E) => this.handleFetchResult(
2977
+ E,
2978
+ r || void 0,
2979
+ d
2980
+ )).catch((E) => {
2981
+ throw r && N.fetchError(
2982
+ this.options.targetFragment.getTarget(),
2983
+ r,
2984
+ E
2985
+ ), E;
2986
+ });
2987
+ }
2988
+ return fetch(r, l).then((d) => this.handleFetchResult(d, r || void 0));
2983
2989
  }
2984
- return fetch(e, o).then((c) => this.handleFetchResult(c, e || void 0));
2985
- }
2986
- if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && n) {
2987
- const o = this.options.formFragment, h = o.getTarget();
2988
- h.setAttribute(
2989
- `${l.prefix}bind`,
2990
- JSON.stringify(i)
2991
- );
2992
- const b = o.getBindingData();
2993
- Object.assign(b, i), await R.setBindingData(h, b);
2990
+ if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && s) {
2991
+ const l = this.options.formFragment, m = l.getTarget();
2992
+ m.setAttribute(
2993
+ `${u.prefix}bind`,
2994
+ JSON.stringify(n)
2995
+ );
2996
+ const g = l.getBindingData();
2997
+ Object.assign(g, n), await P.setBindingData(m, g);
2998
+ }
2999
+ const a = s ? n : {}, o = new Response(JSON.stringify(a), {
3000
+ headers: { "Content-Type": "application/json" }
3001
+ });
3002
+ return this.handleFetchResult(o);
3003
+ } finally {
3004
+ this.releaseExecutionLock(t);
2994
3005
  }
2995
- const s = n ? i : {}, a = new Response(JSON.stringify(s), {
2996
- headers: { "Content-Type": "application/json" }
3006
+ }
3007
+ /**
3008
+ * click 手続きの重複実行を防ぐためのロックを取得します。
3009
+ *
3010
+ * @returns ロック情報。取得不要なら null、取得失敗なら false。
3011
+ */
3012
+ acquireExecutionLock() {
3013
+ if (this.eventType !== "click" || !this.options.targetFragment)
3014
+ return null;
3015
+ const t = this.options.targetFragment.getTarget();
3016
+ return c.RUNNING_CLICK_TARGETS.has(t) || t.hasAttribute("disabled") ? !1 : (c.RUNNING_CLICK_TARGETS.add(t), t.setAttribute("disabled", ""), {
3017
+ target: t,
3018
+ appliedDisabledAttribute: !0
2997
3019
  });
2998
- return this.handleFetchResult(a);
3020
+ }
3021
+ /**
3022
+ * 取得済みの実行ロックを解放します。
3023
+ *
3024
+ * @param executionLock 解放対象のロック情報。
3025
+ * @returns 戻り値はありません。
3026
+ */
3027
+ releaseExecutionLock(t) {
3028
+ t && (c.RUNNING_CLICK_TARGETS.delete(t.target), t.appliedDisabledAttribute && t.target.removeAttribute("disabled"));
2999
3029
  }
3000
3030
  /**
3001
3031
  * フェッチ後の処理を実行します。
@@ -3025,11 +3055,11 @@ ${f}
3025
3055
  }
3026
3056
  const n = [];
3027
3057
  n.push(this.bindResult(t)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
3028
- this.options.resetFragments.map((a) => y.reset(a))
3058
+ this.options.resetFragments.map((a) => A.reset(a))
3029
3059
  ), await this.copy();
3030
3060
  const s = [];
3031
3061
  return this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
3032
- s.push(new u(a, null).run());
3062
+ s.push(new c(a, null).run());
3033
3063
  }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((a) => {
3034
3064
  const o = a.getTarget();
3035
3065
  typeof o.click == "function" ? o.click() : o.dispatchEvent(
@@ -3037,10 +3067,10 @@ ${f}
3037
3067
  );
3038
3068
  }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
3039
3069
  const o = a.getTarget();
3040
- o instanceof HTMLElement ? s.push(i.openDialog(o)) : d.error("Haori", "Element is not an HTML element: ", o);
3070
+ o instanceof HTMLElement ? s.push(i.openDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
3041
3071
  }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
3042
3072
  const o = a.getTarget();
3043
- o instanceof HTMLElement ? s.push(i.closeDialog(o)) : d.error("Haori", "Element is not an HTML element: ", o);
3073
+ o instanceof HTMLElement ? s.push(i.closeDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
3044
3074
  }), await Promise.all(s), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
3045
3075
  this.options.toastMessage,
3046
3076
  this.options.toastLevel ?? "info"
@@ -3060,18 +3090,18 @@ ${f}
3060
3090
  const i = t ? this.options.historyUrl : window.location.pathname, n = new URL(i, window.location.href);
3061
3091
  if (n.origin !== window.location.origin) {
3062
3092
  const a = "history.pushState: cross-origin URL is not allowed: " + n.toString();
3063
- d.error(
3093
+ f.error(
3064
3094
  "Haori",
3065
3095
  a
3066
3096
  );
3067
3097
  return;
3068
3098
  }
3069
3099
  const s = (a) => {
3070
- for (const [o, h] of Object.entries(a))
3071
- h != null && (Array.isArray(h) ? h.forEach((b) => n.searchParams.append(o, String(b))) : typeof h == "object" ? n.searchParams.set(o, JSON.stringify(h)) : n.searchParams.set(o, String(h)));
3100
+ for (const [o, l] of Object.entries(a))
3101
+ l != null && (Array.isArray(l) ? l.forEach((m) => n.searchParams.append(o, String(m))) : typeof l == "object" ? n.searchParams.set(o, JSON.stringify(l)) : n.searchParams.set(o, String(l)));
3072
3102
  };
3073
3103
  e && s(this.options.historyData), r && s(
3074
- y.getValues(
3104
+ A.getValues(
3075
3105
  this.options.historyFormFragment
3076
3106
  )
3077
3107
  ), history.pushState(
@@ -3080,7 +3110,7 @@ ${f}
3080
3110
  n.toString()
3081
3111
  );
3082
3112
  } catch (i) {
3083
- d.error("Haori", `history.pushState failed: ${i}`);
3113
+ f.error("Haori", `history.pushState failed: ${i}`);
3084
3114
  }
3085
3115
  }
3086
3116
  /**
@@ -3088,7 +3118,7 @@ ${f}
3088
3118
  */
3089
3119
  async handleFetchError(t) {
3090
3120
  let e = null;
3091
- this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = y.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3121
+ this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = A.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3092
3122
  const r = async (s) => {
3093
3123
  const a = e ? e.getTarget() : document.body;
3094
3124
  await W().addErrorMessage(a, s);
@@ -3106,18 +3136,18 @@ ${f}
3106
3136
  for (const o of s.messages)
3107
3137
  typeof o == "string" && a.push({ message: o });
3108
3138
  if (s.errors && typeof s.errors == "object")
3109
- for (const [o, h] of Object.entries(s.errors))
3110
- Array.isArray(h) ? a.push({ key: o, message: h.join(`
3111
- `) }) : typeof h == "string" ? a.push({ key: o, message: h }) : h != null && a.push({ key: o, message: String(h) });
3139
+ for (const [o, l] of Object.entries(s.errors))
3140
+ Array.isArray(l) ? a.push({ key: o, message: l.join(`
3141
+ `) }) : typeof l == "string" ? a.push({ key: o, message: l }) : l != null && a.push({ key: o, message: String(l) });
3112
3142
  if (a.length === 0)
3113
- for (const [o, h] of Object.entries(s))
3114
- o === "message" || o === "messages" || o === "errors" || (Array.isArray(h) ? a.push({ key: o, message: h.join(`
3115
- `) }) : typeof h == "string" && a.push({ key: o, message: h }));
3143
+ for (const [o, l] of Object.entries(s))
3144
+ o === "message" || o === "messages" || o === "errors" || (Array.isArray(l) ? a.push({ key: o, message: l.join(`
3145
+ `) }) : typeof l == "string" && a.push({ key: o, message: l }));
3116
3146
  }
3117
3147
  if (a.length === 0)
3118
3148
  return await r(`${t.status} ${t.statusText}`), i(), !1;
3119
3149
  for (const o of a)
3120
- o.key && e ? await y.addErrorMessage(e, o.key, o.message) : await r(o.message);
3150
+ o.key && e ? await A.addErrorMessage(e, o.key, o.message) : await r(o.message);
3121
3151
  return i(), !1;
3122
3152
  } catch {
3123
3153
  }
@@ -3196,19 +3226,19 @@ ${f}
3196
3226
  this.options.bindFragments.forEach((n) => {
3197
3227
  const s = n.getBindingData(), a = this.options.bindArg;
3198
3228
  if (r && typeof r == "object" && !Array.isArray(r)) {
3199
- const o = s[a], h = o && typeof o == "object" && !Array.isArray(o) ? o : {};
3229
+ const o = s[a], l = o && typeof o == "object" && !Array.isArray(o) ? o : {};
3200
3230
  s[a] = this.mergeAppendBindingData(
3201
3231
  n,
3202
3232
  r,
3203
- h
3233
+ l
3204
3234
  );
3205
3235
  } else
3206
3236
  s[a] = r;
3207
- i.push(R.setBindingData(n.getTarget(), s));
3237
+ i.push(P.setBindingData(n.getTarget(), s));
3208
3238
  });
3209
3239
  else {
3210
3240
  if (typeof r == "string")
3211
- return d.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3241
+ return f.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3212
3242
  new Error("string data cannot be bound without a bindArg.")
3213
3243
  );
3214
3244
  this.options.bindFragments.forEach((n) => {
@@ -3217,7 +3247,7 @@ ${f}
3217
3247
  r
3218
3248
  );
3219
3249
  i.push(
3220
- R.setBindingData(
3250
+ P.setBindingData(
3221
3251
  n.getTarget(),
3222
3252
  s
3223
3253
  )
@@ -3252,7 +3282,7 @@ ${f}
3252
3282
  ...i.getBindingData(),
3253
3283
  ...e
3254
3284
  };
3255
- return R.setBindingData(i.getTarget(), n);
3285
+ return P.setBindingData(i.getTarget(), n);
3256
3286
  });
3257
3287
  return Promise.all(r).then(() => {
3258
3288
  });
@@ -3261,7 +3291,7 @@ ${f}
3261
3291
  * copy のコピー元データを取得します。
3262
3292
  */
3263
3293
  resolveCopySourceData() {
3264
- return this.options.formFragment ? y.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
3294
+ return this.options.formFragment ? A.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
3265
3295
  }
3266
3296
  /**
3267
3297
  * copy-params が指定されている場合は対象キーだけ抽出します。
@@ -3297,11 +3327,11 @@ ${f}
3297
3327
  */
3298
3328
  getRowFragment() {
3299
3329
  if (!this.options.targetFragment)
3300
- return d.error("Haori", "Target fragment is not specified for row operation."), null;
3330
+ return f.error("Haori", "Target fragment is not specified for row operation."), null;
3301
3331
  const t = this.options.targetFragment.closestByAttribute(
3302
- `${l.prefix}row`
3332
+ `${u.prefix}row`
3303
3333
  );
3304
- return t || (d.error("Haori", "Row fragment not found."), null);
3334
+ return t || (f.error("Haori", "Row fragment not found."), null);
3305
3335
  }
3306
3336
  /**
3307
3337
  * 行を追加します。
@@ -3317,7 +3347,7 @@ ${f}
3317
3347
  const e = [], r = t.clone();
3318
3348
  return e.push(
3319
3349
  t.getParent().insertAfter(r, t)
3320
- ), e.push(R.evaluateAll(r)), e.push(y.reset(r)), Promise.all(e).then(() => {
3350
+ ), e.push(P.evaluateAll(r)), e.push(A.reset(r)), Promise.all(e).then(() => {
3321
3351
  });
3322
3352
  }
3323
3353
  /**
@@ -3332,7 +3362,7 @@ ${f}
3332
3362
  if (!t)
3333
3363
  return Promise.reject(new Error("Row fragment not found."));
3334
3364
  const e = t.getParent();
3335
- return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${l.prefix}each-before`) && !i.hasAttribute(`${l.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
3365
+ return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${u.prefix}each-before`) && !i.hasAttribute(`${u.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
3336
3366
  }
3337
3367
  /**
3338
3368
  * 前の行へ移動します。
@@ -3369,8 +3399,8 @@ ${f}
3369
3399
  return r ? r.insertAfter(t, e) : Promise.resolve();
3370
3400
  }
3371
3401
  };
3372
- u.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, u.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
3373
- let V = u;
3402
+ c.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, c.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/, c.RUNNING_CLICK_TARGETS = /* @__PURE__ */ new WeakSet();
3403
+ let V = c;
3374
3404
  class ft {
3375
3405
  /**
3376
3406
  * URLのクエリパラメータを取得します。
@@ -3402,23 +3432,23 @@ class dt {
3402
3432
  try {
3403
3433
  r = await fetch(t, e);
3404
3434
  } catch (n) {
3405
- throw d.error("[Haori]", "Failed to fetch import source:", t, n), new Error(`Failed to fetch: ${t}`);
3435
+ throw f.error("[Haori]", "Failed to fetch import source:", t, n), new Error(`Failed to fetch: ${t}`);
3406
3436
  }
3407
3437
  if (!r.ok) {
3408
3438
  const n = `${r.status} ${r.statusText}`;
3409
- throw d.error("[Haori]", "Import HTTP error:", t, n), new Error(`Failed to load ${t}: ${n}`);
3439
+ throw f.error("[Haori]", "Import HTTP error:", t, n), new Error(`Failed to load ${t}: ${n}`);
3410
3440
  }
3411
3441
  let i;
3412
3442
  try {
3413
3443
  i = await r.text();
3414
3444
  } catch (n) {
3415
- throw d.error("[Haori]", "Failed to read response text:", t, n), new Error(`Failed to read response from: ${t}`);
3445
+ throw f.error("[Haori]", "Failed to read response text:", t, n), new Error(`Failed to read response from: ${t}`);
3416
3446
  }
3417
3447
  try {
3418
3448
  const s = new DOMParser().parseFromString(i, "text/html");
3419
- return s && s.body ? s.body.innerHTML : (d.warn("[Haori]", "No body found in imported document:", t), i);
3449
+ return s && s.body ? s.body.innerHTML : (f.warn("[Haori]", "No body found in imported document:", t), i);
3420
3450
  } catch (n) {
3421
- return d.error("[Haori]", "Failed to parse imported HTML:", t, n), i;
3451
+ return f.error("[Haori]", "Failed to parse imported HTML:", t, n), i;
3422
3452
  }
3423
3453
  }
3424
3454
  }
@@ -3431,7 +3461,7 @@ const p = class p {
3431
3461
  */
3432
3462
  static isDeferredAttributeName(t) {
3433
3463
  return p.DEFERRED_ATTRIBUTE_SUFFIXES.some(
3434
- (e) => t === `${l.prefix}${e}`
3464
+ (e) => t === `${u.prefix}${e}`
3435
3465
  );
3436
3466
  }
3437
3467
  /**
@@ -3442,7 +3472,7 @@ const p = class p {
3442
3472
  */
3443
3473
  static isEvaluateAllExcludedAttributeName(t) {
3444
3474
  return p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
3445
- (e) => t === `${l.prefix}${e}`
3475
+ (e) => t === `${u.prefix}${e}`
3446
3476
  );
3447
3477
  }
3448
3478
  /**
@@ -3462,7 +3492,7 @@ const p = class p {
3462
3492
  * @returns 実際の属性名。data-attr-* でない場合は null
3463
3493
  */
3464
3494
  static getAliasedAttributeName(t) {
3465
- const e = `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
3495
+ const e = `${u.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
3466
3496
  return !t.startsWith(e) || t.length <= e.length ? null : t.slice(e.length);
3467
3497
  }
3468
3498
  /**
@@ -3475,7 +3505,7 @@ const p = class p {
3475
3505
  static isAliasedAttributeReflection(t, e) {
3476
3506
  const r = w.get(t);
3477
3507
  return r instanceof x ? r.hasAttribute(
3478
- `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
3508
+ `${u.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
3479
3509
  ) : !1;
3480
3510
  }
3481
3511
  /**
@@ -3510,7 +3540,7 @@ const p = class p {
3510
3540
  let r = Promise.resolve();
3511
3541
  const i = /* @__PURE__ */ new Set();
3512
3542
  for (const n of p.PRIORITY_ATTRIBUTE_SUFFIXES) {
3513
- const s = l.prefix + n;
3543
+ const s = u.prefix + n;
3514
3544
  e.hasAttribute(s) && (r = r.then(
3515
3545
  () => p.setAttribute(
3516
3546
  e.getTarget(),
@@ -3528,7 +3558,7 @@ const p = class p {
3528
3558
  ));
3529
3559
  }
3530
3560
  for (const n of p.DEFERRED_ATTRIBUTE_SUFFIXES) {
3531
- const s = l.prefix + n;
3561
+ const s = u.prefix + n;
3532
3562
  e.hasAttribute(s) && (r = r.then(
3533
3563
  () => p.setAttribute(
3534
3564
  e.getTarget(),
@@ -3561,54 +3591,54 @@ const p = class p {
3561
3591
  return r === null ? i.removeAliasedAttribute(e, n) : i.setAliasedAttribute(e, n, r);
3562
3592
  const s = [];
3563
3593
  switch (e) {
3564
- case `${l.prefix}bind`: {
3594
+ case `${u.prefix}bind`: {
3565
3595
  r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(p.parseDataBind(r));
3566
3596
  break;
3567
3597
  }
3568
- case `${l.prefix}if`:
3598
+ case `${u.prefix}if`:
3569
3599
  s.push(p.evaluateIf(i));
3570
3600
  break;
3571
- case `${l.prefix}each`:
3601
+ case `${u.prefix}each`:
3572
3602
  s.push(p.evaluateEach(i));
3573
3603
  break;
3574
- case `${l.prefix}fetch`:
3604
+ case `${u.prefix}fetch`:
3575
3605
  s.push(
3576
3606
  new V(i, null).run().then(() => {
3577
3607
  })
3578
3608
  );
3579
3609
  break;
3580
- case `${l.prefix}import`: {
3610
+ case `${u.prefix}import`: {
3581
3611
  if (typeof r == "string") {
3582
3612
  const a = i.getTarget(), o = performance.now();
3583
- a.setAttribute(`${l.prefix}importing`, ""), N.importStart(a, r), s.push(
3584
- dt.load(r).then((h) => {
3585
- const b = new TextEncoder().encode(h).length;
3613
+ a.setAttribute(`${u.prefix}importing`, ""), N.importStart(a, r), s.push(
3614
+ dt.load(r).then((l) => {
3615
+ const m = new TextEncoder().encode(l).length;
3586
3616
  return F.enqueue(() => {
3587
- a.innerHTML = h;
3617
+ a.innerHTML = l;
3588
3618
  }).then(() => {
3589
- if (a.removeAttribute(`${l.prefix}importing`), N.importEnd(a, r, b, o), !document.body.hasAttribute("data-haori-ready")) {
3619
+ if (a.removeAttribute(`${u.prefix}importing`), N.importEnd(a, r, m, o), !document.body.hasAttribute("data-haori-ready")) {
3590
3620
  const g = [];
3591
- return a.childNodes.forEach((E) => {
3592
- const v = w.get(E);
3621
+ return a.childNodes.forEach((T) => {
3622
+ const v = w.get(T);
3593
3623
  v instanceof x ? g.push(p.scan(v.getTarget())) : v instanceof O && g.push(p.evaluateText(v));
3594
3624
  }), Promise.all(g).then(() => {
3595
3625
  });
3596
3626
  }
3597
3627
  });
3598
- }).catch((h) => {
3599
- a.removeAttribute(`${l.prefix}importing`), N.importError(a, r, h), d.error("[Haori]", "Failed to import HTML:", r, h);
3628
+ }).catch((l) => {
3629
+ a.removeAttribute(`${u.prefix}importing`), N.importError(a, r, l), f.error("[Haori]", "Failed to import HTML:", r, l);
3600
3630
  })
3601
3631
  );
3602
3632
  }
3603
3633
  break;
3604
3634
  }
3605
- case `${l.prefix}url-param`: {
3606
- const a = i.getAttribute(`${l.prefix}url-arg`), o = ft.readParams();
3635
+ case `${u.prefix}url-param`: {
3636
+ const a = i.getAttribute(`${u.prefix}url-arg`), o = ft.readParams();
3607
3637
  if (a === null)
3608
3638
  s.push(p.setBindingData(t, o));
3609
3639
  else {
3610
- const h = i.getRawBindingData() || {};
3611
- h[String(a)] = o, s.push(p.setBindingData(t, h));
3640
+ const l = i.getRawBindingData() || {};
3641
+ l[String(a)] = o, s.push(p.setBindingData(t, l));
3612
3642
  }
3613
3643
  break;
3614
3644
  }
@@ -3628,12 +3658,12 @@ const p = class p {
3628
3658
  const r = w.get(t), i = r.getRawBindingData();
3629
3659
  r.setBindingData(e);
3630
3660
  let n = r.setAttribute(
3631
- `${l.prefix}bind`,
3661
+ `${u.prefix}bind`,
3632
3662
  JSON.stringify(e)
3633
3663
  );
3634
3664
  if (t.tagName === "FORM") {
3635
- const s = r.getAttribute(`${l.prefix}form-arg`), a = s && e[String(s)] && typeof e[String(s)] == "object" && !Array.isArray(e[String(s)]) ? e[String(s)] : s ? {} : e;
3636
- n = n.then(() => y.syncValues(r, a));
3665
+ const s = r.getAttribute(`${u.prefix}form-arg`), a = s && e[String(s)] && typeof e[String(s)] == "object" && !Array.isArray(e[String(s)]) ? e[String(s)] : s ? {} : e;
3666
+ n = n.then(() => A.syncValues(r, a));
3637
3667
  }
3638
3668
  return n = n.then(() => p.evaluateAll(r)), N.bindChange(t, i, e, "manual"), n.then(() => {
3639
3669
  });
@@ -3649,7 +3679,7 @@ const p = class p {
3649
3679
  try {
3650
3680
  return JSON.parse(t);
3651
3681
  } catch (e) {
3652
- return d.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3682
+ return f.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3653
3683
  }
3654
3684
  else {
3655
3685
  const e = new URLSearchParams(t), r = {};
@@ -3711,7 +3741,7 @@ const p = class p {
3711
3741
  i.push(r.setValue(e));
3712
3742
  const n = p.getFormFragment(r);
3713
3743
  if (n) {
3714
- const s = y.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`);
3744
+ const s = A.getValues(n), a = n.getAttribute(`${u.prefix}form-arg`);
3715
3745
  let o;
3716
3746
  a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(p.setBindingData(n.getTarget(), o));
3717
3747
  }
@@ -3738,7 +3768,7 @@ const p = class p {
3738
3768
  */
3739
3769
  static evaluateAll(t) {
3740
3770
  const e = [];
3741
- 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(() => {
3771
+ return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${u.prefix}if`) && e.push(p.evaluateIf(t)), t.hasAttribute(`${u.prefix}each`) ? Promise.all(e).then(() => p.evaluateEach(t)).then(() => {
3742
3772
  const r = [];
3743
3773
  return t.getChildren().forEach((i) => {
3744
3774
  i instanceof x ? r.push(p.evaluateAll(i)) : i instanceof O && r.push(p.evaluateText(i));
@@ -3766,7 +3796,7 @@ const p = class p {
3766
3796
  * @return Promise (DOM操作が完了したときに解決される)
3767
3797
  */
3768
3798
  static evaluateIf(t) {
3769
- const e = [], r = t.getAttribute(`${l.prefix}if`);
3799
+ const e = [], r = t.getAttribute(`${u.prefix}if`);
3770
3800
  if (r === !1 || r === void 0 || r === null || Number.isNaN(r))
3771
3801
  e.push(
3772
3802
  t.hide().then(() => {
@@ -3801,18 +3831,18 @@ const p = class p {
3801
3831
  let i = !1;
3802
3832
  t.getChildren().forEach((s) => {
3803
3833
  if (!i && s instanceof x) {
3804
- if (s.hasAttribute(`${l.prefix}each-before`) || s.hasAttribute(`${l.prefix}each-after`))
3834
+ if (s.hasAttribute(`${u.prefix}each-before`) || s.hasAttribute(`${u.prefix}each-after`))
3805
3835
  return;
3806
3836
  e = s.clone(), t.setTemplate(e), i = !0, t.removeChild(s);
3807
3837
  const a = s.getTarget();
3808
3838
  a.parentNode && a.parentNode.removeChild(a), s.setMounted(!1);
3809
3839
  }
3810
3840
  });
3811
- const n = t.getAttribute(`${l.prefix}each`);
3812
- return Array.isArray(n) ? this.updateDiff(t, n) : (d.error("[Haori]", "Invalid each attribute:", n), Promise.reject(new Error("Invalid each attribute.")));
3841
+ const n = t.getAttribute(`${u.prefix}each`);
3842
+ return Array.isArray(n) ? this.updateDiff(t, n) : (f.error("[Haori]", "Invalid each attribute:", n), Promise.reject(new Error("Invalid each attribute.")));
3813
3843
  }
3814
- const r = t.getAttribute(`${l.prefix}each`);
3815
- return Array.isArray(r) ? this.updateDiff(t, r) : (d.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3844
+ const r = t.getAttribute(`${u.prefix}each`);
3845
+ return Array.isArray(r) ? this.updateDiff(t, r) : (f.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3816
3846
  }
3817
3847
  /**
3818
3848
  * 差分を更新します。
@@ -3823,73 +3853,73 @@ const p = class p {
3823
3853
  static updateDiff(t, e) {
3824
3854
  const r = t.getTemplate();
3825
3855
  if (r === null)
3826
- return d.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3827
- let i = t.getAttribute(`${l.prefix}each-index`);
3856
+ return f.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3857
+ let i = t.getAttribute(`${u.prefix}each-index`);
3828
3858
  i && (i = String(i));
3829
- const n = t.getAttribute(`${l.prefix}each-key`), s = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3830
- e.forEach((c, f) => {
3831
- const m = p.createListKey(
3832
- c,
3859
+ const n = t.getAttribute(`${u.prefix}each-key`), s = t.getAttribute(`${u.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3860
+ e.forEach((h, d) => {
3861
+ const b = p.createListKey(
3862
+ h,
3833
3863
  n ? String(n) : null,
3834
- f
3864
+ d
3835
3865
  );
3836
- o.push(m), a.set(m, { item: c, itemIndex: f });
3866
+ o.push(b), a.set(b, { item: h, itemIndex: d });
3837
3867
  });
3838
- const h = [];
3839
- let b = t.getChildren().filter((c) => c instanceof x).filter(
3840
- (c) => !c.hasAttribute(`${l.prefix}each-before`) && !c.hasAttribute(`${l.prefix}each-after`)
3868
+ const l = [];
3869
+ let m = t.getChildren().filter((h) => h instanceof x).filter(
3870
+ (h) => !h.hasAttribute(`${u.prefix}each-before`) && !h.hasAttribute(`${u.prefix}each-after`)
3841
3871
  );
3842
- b = b.filter((c) => o.indexOf(String(c.getListKey())) === -1 ? (h.push(c.remove()), !1) : !0);
3843
- const g = b.map((c) => c.getListKey()), E = t.getChildren().filter((c) => c instanceof x).filter((c) => c.hasAttribute(`${l.prefix}each-before`)).length;
3872
+ m = m.filter((h) => o.indexOf(String(h.getListKey())) === -1 ? (l.push(h.remove()), !1) : !0);
3873
+ const g = m.map((h) => h.getListKey()), T = t.getChildren().filter((h) => h instanceof x).filter((h) => h.hasAttribute(`${u.prefix}each-before`)).length;
3844
3874
  let v = Promise.resolve();
3845
- return o.forEach((c, f) => {
3846
- const m = g.indexOf(c), { item: A, itemIndex: T } = a.get(c);
3847
- let k;
3848
- if (m !== -1)
3849
- k = b[m], v = v.then(
3875
+ return o.forEach((h, d) => {
3876
+ const b = g.indexOf(h), { item: E, itemIndex: y } = a.get(h);
3877
+ let D;
3878
+ if (b !== -1)
3879
+ D = m[b], v = v.then(
3850
3880
  () => p.updateRowFragment(
3851
- k,
3852
- A,
3881
+ D,
3882
+ E,
3853
3883
  i,
3854
- T,
3884
+ y,
3855
3885
  s ? String(s) : null,
3856
- c
3857
- ).then(() => p.evaluateAll(k)).then(() => p.scheduleEvaluateAll(k))
3886
+ h
3887
+ ).then(() => p.evaluateAll(D)).then(() => p.scheduleEvaluateAll(D))
3858
3888
  );
3859
3889
  else {
3860
- k = r.clone();
3861
- const J = E + f;
3890
+ D = r.clone();
3891
+ const J = T + d;
3862
3892
  v = v.then(
3863
3893
  () => p.updateRowFragment(
3864
- k,
3865
- A,
3894
+ D,
3895
+ E,
3866
3896
  i,
3867
- T,
3897
+ y,
3868
3898
  s ? String(s) : null,
3869
- c
3899
+ h
3870
3900
  ).then(
3871
3901
  () => t.insertBefore(
3872
- k,
3902
+ D,
3873
3903
  t.getChildren()[J] || null
3874
- ).then(() => p.evaluateAll(k)).then(() => p.scheduleEvaluateAll(k))
3904
+ ).then(() => p.evaluateAll(D)).then(() => p.scheduleEvaluateAll(D))
3875
3905
  )
3876
3906
  );
3877
3907
  }
3878
- }), Promise.all(h).then(() => v).then(() => {
3879
- const c = o.filter(
3880
- (T) => T !== null
3881
- ), f = g.filter(
3882
- (T) => T !== null
3883
- ), m = c.filter(
3884
- (T) => !f.includes(T)
3885
- ), A = f.filter(
3886
- (T) => !c.includes(T)
3908
+ }), Promise.all(l).then(() => v).then(() => {
3909
+ const h = o.filter(
3910
+ (y) => y !== null
3911
+ ), d = g.filter(
3912
+ (y) => y !== null
3913
+ ), b = h.filter(
3914
+ (y) => !d.includes(y)
3915
+ ), E = d.filter(
3916
+ (y) => !h.includes(y)
3887
3917
  );
3888
3918
  N.eachUpdate(
3889
3919
  t.getTarget(),
3890
- m,
3891
- A,
3892
- c
3920
+ b,
3921
+ E,
3922
+ h
3893
3923
  );
3894
3924
  });
3895
3925
  }
@@ -3935,11 +3965,11 @@ const p = class p {
3935
3965
  [n]: e
3936
3966
  }, r && (a[r] = i);
3937
3967
  else
3938
- return d.error(
3968
+ return f.error(
3939
3969
  "[Haori]",
3940
- `Primitive value requires '${l.prefix}each-arg' attribute: ${e}`
3970
+ `Primitive value requires '${u.prefix}each-arg' attribute: ${e}`
3941
3971
  ), Promise.resolve();
3942
- return t.setListKey(s), t.setBindingData(a), t.setAttribute(`${l.prefix}row`, s);
3972
+ return t.setListKey(s), t.setBindingData(a), t.setAttribute(`${u.prefix}row`, s);
3943
3973
  }
3944
3974
  /**
3945
3975
  * フラグメントの再評価を次のイベントループで実行します。
@@ -3960,7 +3990,7 @@ p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if
3960
3990
  "import",
3961
3991
  "url-param"
3962
3992
  ], p.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;
3963
- let R = p;
3993
+ let P = p;
3964
3994
  const Y = class Y {
3965
3995
  /**
3966
3996
  * コンストラクタ。
@@ -4001,7 +4031,7 @@ const Y = class Y {
4001
4031
  return;
4002
4032
  const i = w.get(r);
4003
4033
  i && (e === "change" && i instanceof x && i.syncValue(), new V(i, e).run().catch((n) => {
4004
- d.error("[Haori]", "Procedure execution error:", n);
4034
+ f.error("[Haori]", "Procedure execution error:", n);
4005
4035
  }));
4006
4036
  }
4007
4037
  /**
@@ -4030,7 +4060,7 @@ const S = class S {
4030
4060
  }
4031
4061
  if (typeof IntersectionObserver > "u")
4032
4062
  return;
4033
- const i = S.resolveRoot(r), n = S.resolveRootMargin(r), s = S.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
4063
+ const i = S.resolveRoot(r), n = S.resolveRootMargin(r), s = S.resolveThreshold(r), a = r.hasAttribute(`${u.prefix}intersect-once`);
4034
4064
  if (e && e.observer.root === i && e.observer.rootMargin === n && S.sameThreshold(
4035
4065
  e.observer.thresholds,
4036
4066
  s
@@ -4040,20 +4070,20 @@ const S = class S {
4040
4070
  }
4041
4071
  e && (e.observer.disconnect(), S.registrations.delete(t));
4042
4072
  const o = new IntersectionObserver(
4043
- (h) => {
4044
- const b = S.registrations.get(t);
4045
- b && h.forEach((g) => {
4046
- !g.isIntersecting || b.running || S.isDisabled(b.fragment) || (b.running = !0, new V(b.fragment, "intersect").runWithResult().then((E) => {
4047
- E && b.once && (b.observer.disconnect(), S.registrations.delete(t));
4048
- }).catch((E) => {
4049
- d.error(
4073
+ (l) => {
4074
+ const m = S.registrations.get(t);
4075
+ m && l.forEach((g) => {
4076
+ !g.isIntersecting || m.running || S.isDisabled(m.fragment) || (m.running = !0, new V(m.fragment, "intersect").runWithResult().then((T) => {
4077
+ T && m.once && (m.observer.disconnect(), S.registrations.delete(t));
4078
+ }).catch((T) => {
4079
+ f.error(
4050
4080
  "[Haori]",
4051
4081
  "Intersect procedure execution error:",
4052
- E
4082
+ T
4053
4083
  );
4054
4084
  }).finally(() => {
4055
- const E = S.registrations.get(t);
4056
- E && (E.running = !1);
4085
+ const T = S.registrations.get(t);
4086
+ T && (T.running = !1);
4057
4087
  }));
4058
4088
  });
4059
4089
  },
@@ -4087,32 +4117,32 @@ const S = class S {
4087
4117
  }
4088
4118
  static shouldObserve(t) {
4089
4119
  return t.getAttributeNames().some((e) => {
4090
- if (!e.startsWith(`${l.prefix}intersect-`))
4120
+ if (!e.startsWith(`${u.prefix}intersect-`))
4091
4121
  return !1;
4092
- const r = e.slice(`${l.prefix}intersect-`.length);
4122
+ const r = e.slice(`${u.prefix}intersect-`.length);
4093
4123
  return !S.CONFIG_KEYS.has(r);
4094
4124
  });
4095
4125
  }
4096
4126
  static resolveRoot(t) {
4097
- const e = `${l.prefix}intersect-root`;
4127
+ const e = `${u.prefix}intersect-root`;
4098
4128
  if (!t.hasAttribute(e))
4099
4129
  return null;
4100
4130
  const r = t.getAttribute(e);
4101
4131
  if (typeof r != "string" || r.trim() === "")
4102
4132
  return null;
4103
4133
  const i = document.querySelector(r);
4104
- return i instanceof HTMLElement ? i : (d.error("[Haori]", `Intersect root element not found: ${r}`), null);
4134
+ return i instanceof HTMLElement ? i : (f.error("[Haori]", `Intersect root element not found: ${r}`), null);
4105
4135
  }
4106
4136
  static resolveRootMargin(t) {
4107
- const e = `${l.prefix}intersect-root-margin`, r = t.getAttribute(e);
4137
+ const e = `${u.prefix}intersect-root-margin`, r = t.getAttribute(e);
4108
4138
  return r === null || r === !1 || r === "" ? "0px" : String(r);
4109
4139
  }
4110
4140
  static resolveThreshold(t) {
4111
- const e = `${l.prefix}intersect-threshold`, r = t.getAttribute(e), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
4141
+ const e = `${u.prefix}intersect-threshold`, r = t.getAttribute(e), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
4112
4142
  return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
4113
4143
  }
4114
4144
  static isDisabled(t) {
4115
- const e = `${l.prefix}intersect-disabled`, r = t.getAttribute(e);
4145
+ const e = `${u.prefix}intersect-disabled`, r = t.getAttribute(e);
4116
4146
  if (r === null || r === !1)
4117
4147
  return !1;
4118
4148
  if (typeof r == "boolean")
@@ -4131,7 +4161,7 @@ S.CONFIG_KEYS = /* @__PURE__ */ new Set([
4131
4161
  "disabled",
4132
4162
  "once"
4133
4163
  ]), S.registrations = /* @__PURE__ */ new Map();
4134
- let L = S;
4164
+ let $ = S;
4135
4165
  const H = class H {
4136
4166
  /**
4137
4167
  * 初期化メソッド。
@@ -4142,10 +4172,10 @@ const H = class H {
4142
4172
  return;
4143
4173
  H._initialized = !0;
4144
4174
  const t = await Promise.allSettled([
4145
- R.scan(document.head),
4146
- R.scan(document.body)
4175
+ P.scan(document.head),
4176
+ P.scan(document.body)
4147
4177
  ]), [e, r] = t;
4148
- e.status !== "fulfilled" && d.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && d.error("[Haori]", "Failed to build body fragment:", r.reason), await F.wait(), document.body.setAttribute("data-haori-ready", ""), H.observe(document.head), H.observe(document.body), new Q().start(), L.syncTree(document.body);
4178
+ 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), await F.wait(), document.body.setAttribute("data-haori-ready", ""), H.observe(document.head), H.observe(document.body), new Q().start(), $.syncTree(document.body);
4149
4179
  }
4150
4180
  /**
4151
4181
  * 指定された要素を監視します。
@@ -4158,45 +4188,45 @@ const H = class H {
4158
4188
  try {
4159
4189
  switch (i.type) {
4160
4190
  case "attributes": {
4161
- d.info(
4191
+ f.info(
4162
4192
  "[Haori]",
4163
4193
  "Attribute changed:",
4164
4194
  i.target,
4165
4195
  i.attributeName
4166
4196
  );
4167
4197
  const n = i.target;
4168
- if (i.attributeName && R.isAliasedAttributeReflection(
4198
+ if (i.attributeName && P.isAliasedAttributeReflection(
4169
4199
  n,
4170
4200
  i.attributeName
4171
4201
  ))
4172
4202
  break;
4173
- R.setAttribute(
4203
+ P.setAttribute(
4174
4204
  n,
4175
4205
  i.attributeName,
4176
4206
  n.getAttribute(i.attributeName)
4177
- ), L.syncElement(n);
4207
+ ), $.syncElement(n);
4178
4208
  break;
4179
4209
  }
4180
4210
  case "childList": {
4181
- d.info(
4211
+ f.info(
4182
4212
  "[Haori]",
4183
4213
  "Child list changed:",
4184
4214
  Array.from(i.removedNodes).map((n) => n.nodeName),
4185
4215
  Array.from(i.addedNodes).map((n) => n.nodeName)
4186
4216
  ), Array.from(i.removedNodes).forEach((n) => {
4187
- L.cleanupTree(n), R.removeNode(n);
4217
+ $.cleanupTree(n), P.removeNode(n);
4188
4218
  }), Array.from(i.addedNodes).forEach((n) => {
4189
- n.parentElement instanceof HTMLElement && (R.addNode(n.parentElement, n), L.syncTree(n));
4219
+ n.parentElement instanceof HTMLElement && (P.addNode(n.parentElement, n), $.syncTree(n));
4190
4220
  });
4191
4221
  break;
4192
4222
  }
4193
4223
  case "characterData": {
4194
- d.info(
4224
+ f.info(
4195
4225
  "[Haori]",
4196
4226
  "Character data changed:",
4197
4227
  i.target,
4198
4228
  i.target.textContent
4199
- ), i.target instanceof Text || i.target instanceof Comment ? R.changeText(i.target, i.target.textContent) : d.warn(
4229
+ ), i.target instanceof Text || i.target instanceof Comment ? P.changeText(i.target, i.target.textContent) : f.warn(
4200
4230
  "[Haori]",
4201
4231
  "Unsupported character data type:",
4202
4232
  i.target
@@ -4204,31 +4234,31 @@ const H = class H {
4204
4234
  break;
4205
4235
  }
4206
4236
  default:
4207
- d.warn("[Haori]", "Unknown mutation type:", i.type);
4237
+ f.warn("[Haori]", "Unknown mutation type:", i.type);
4208
4238
  continue;
4209
4239
  }
4210
4240
  } catch (n) {
4211
- d.error("[Haori]", "Error processing mutation:", n);
4241
+ f.error("[Haori]", "Error processing mutation:", n);
4212
4242
  }
4213
4243
  }).observe(t, {
4214
4244
  childList: !0,
4215
4245
  subtree: !0,
4216
4246
  attributes: !0,
4217
4247
  characterData: !0
4218
- }), d.info("[Haori]", "Observer initialized for", t);
4248
+ }), f.info("[Haori]", "Observer initialized for", t);
4219
4249
  }
4220
4250
  };
4221
4251
  H._initialized = !1;
4222
4252
  let q = H;
4223
4253
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", q.init) : q.init();
4224
- const pt = "0.4.8";
4254
+ const pt = "0.4.9";
4225
4255
  export {
4226
- R as Core,
4227
- l as Env,
4228
- y as Form,
4256
+ P as Core,
4257
+ u as Env,
4258
+ A as Form,
4229
4259
  w as Fragment,
4230
4260
  X as Haori,
4231
- d as Log,
4261
+ f as Log,
4232
4262
  F as Queue,
4233
4263
  X as default,
4234
4264
  pt as version