haori 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +21 -21
  2. package/README.ja.md +182 -167
  3. package/README.md +184 -169
  4. package/dist/haori.cjs.js +11 -10
  5. package/dist/haori.cjs.js.map +1 -1
  6. package/dist/haori.es.js +889 -683
  7. package/dist/haori.es.js.map +1 -1
  8. package/dist/haori.iife.js +10 -9
  9. package/dist/haori.iife.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/package.json +1 -1
  12. package/dist/src/expression.d.ts +27 -3
  13. package/dist/src/expression.d.ts.map +1 -1
  14. package/dist/src/expression.js +97 -24
  15. package/dist/src/expression.js.map +1 -1
  16. package/dist/src/form.d.ts.map +1 -1
  17. package/dist/src/form.js +17 -3
  18. package/dist/src/form.js.map +1 -1
  19. package/dist/src/index.d.ts +1 -1
  20. package/dist/src/index.js +1 -1
  21. package/dist/src/procedure.d.ts +50 -0
  22. package/dist/src/procedure.d.ts.map +1 -1
  23. package/dist/src/procedure.js +166 -20
  24. package/dist/src/procedure.js.map +1 -1
  25. package/dist/tests/core.test.js +46 -46
  26. package/dist/tests/data-each-browserlike.test.js +10 -10
  27. package/dist/tests/data-each-fragment-debug.test.js +36 -36
  28. package/dist/tests/data-each-table.test.js +93 -10
  29. package/dist/tests/data-each-table.test.js.map +1 -1
  30. package/dist/tests/data-fetch-tbody-dom.test.js +12 -12
  31. package/dist/tests/expression.test.js +37 -21
  32. package/dist/tests/expression.test.js.map +1 -1
  33. package/dist/tests/form.test.js +241 -241
  34. package/dist/tests/import.test.js +34 -34
  35. package/dist/tests/procedure-action-operations.test.js +85 -0
  36. package/dist/tests/procedure-action-operations.test.js.map +1 -1
  37. package/dist/tests/procedure-fetch-options.test.js +58 -0
  38. package/dist/tests/procedure-fetch-options.test.js.map +1 -1
  39. package/dist/tests/procedure_events.test.d.ts.map +1 -1
  40. package/dist/tests/procedure_events.test.js +65 -0
  41. package/dist/tests/procedure_events.test.js.map +1 -1
  42. package/dist/tests/row-move.test.js +67 -67
  43. package/dist/tests/row-operations.test.js +84 -84
  44. package/package.json +70 -70
package/dist/haori.es.js CHANGED
@@ -30,7 +30,7 @@ const R = class R {
30
30
  };
31
31
  R.devMode = !1;
32
32
  let O = R;
33
- const D = class D {
33
+ const M = class M {
34
34
  /**
35
35
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
36
36
  * scriptタグにdata-prefixがある場合は、その値+"-"をプレフィックスとして使用します。
@@ -41,10 +41,10 @@ const D = class D {
41
41
  try {
42
42
  const t = document.currentScript || document.querySelector('script[src*="haori"]');
43
43
  if (t instanceof HTMLScriptElement) {
44
- const r = t.getAttribute("data-prefix") || D._prefix;
45
- D._prefix = r.endsWith("-") ? r : r + "-";
44
+ const r = t.getAttribute("data-prefix") || M._prefix;
45
+ M._prefix = r.endsWith("-") ? r : r + "-";
46
46
  }
47
- if (t instanceof HTMLScriptElement && t.hasAttribute(`${D._prefix}dev`)) {
47
+ if (t instanceof HTMLScriptElement && t.hasAttribute(`${M._prefix}dev`)) {
48
48
  O.set(!0);
49
49
  return;
50
50
  }
@@ -63,13 +63,13 @@ const D = class D {
63
63
  * @returns プレフィックス
64
64
  */
65
65
  static get prefix() {
66
- return D._prefix;
66
+ return M._prefix;
67
67
  }
68
68
  };
69
- D._prefix = "data-";
70
- let c = D;
71
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", c.detect) : c.detect();
72
- class h {
69
+ M._prefix = "data-";
70
+ let h = M;
71
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", h.detect) : h.detect();
72
+ class f {
73
73
  /**
74
74
  * 開発モードでのみコンソールに情報を出力します。
75
75
  *
@@ -98,7 +98,7 @@ class h {
98
98
  console.error(t, ...e);
99
99
  }
100
100
  }
101
- class Y {
101
+ class z {
102
102
  constructor() {
103
103
  this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
104
104
  }
@@ -110,17 +110,17 @@ class Y {
110
110
  * @returns 処理完了Promise
111
111
  */
112
112
  enqueue(t, e = !1) {
113
- let r, i;
113
+ let r, n;
114
114
  const s = new Promise((a, o) => {
115
- r = a, i = o;
116
- }), n = {
115
+ r = a, n = o;
116
+ }), i = {
117
117
  task: t,
118
118
  timestamp: performance.now(),
119
119
  promise: s,
120
120
  resolve: r,
121
- reject: i
121
+ reject: n
122
122
  };
123
- return e ? this.queue.unshift(n) : this.queue.push(n), this.scheduleProcessing(), s;
123
+ return e ? this.queue.unshift(i) : this.queue.push(i), this.scheduleProcessing(), s;
124
124
  }
125
125
  /**
126
126
  * キューを処理します。
@@ -140,13 +140,13 @@ class Y {
140
140
  const r = await e.task();
141
141
  e.resolve(r);
142
142
  } catch (r) {
143
- e.reject(r), h.error("[Haori]", `Task ${e.timestamp} failed:`, r);
143
+ e.reject(r), f.error("[Haori]", `Task ${e.timestamp} failed:`, r);
144
144
  }
145
145
  if (performance.now() - t > this.MAX_BUDGET)
146
146
  break;
147
147
  }
148
148
  } catch (t) {
149
- h.error("[Haori]", "Error processing queue:", t);
149
+ f.error("[Haori]", "Error processing queue:", t);
150
150
  } finally {
151
151
  this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
152
152
  }
@@ -174,7 +174,7 @@ class Y {
174
174
  t.length > 0 && await Promise.allSettled(t);
175
175
  }
176
176
  }
177
- const G = class G {
177
+ const J = class J {
178
178
  /**
179
179
  * タスクをキューに追加します。
180
180
  *
@@ -192,9 +192,9 @@ const G = class G {
192
192
  return this.ASYNC_QUEUE.wait();
193
193
  }
194
194
  };
195
- G.ASYNC_QUEUE = new Y();
196
- let T = G;
197
- class M {
195
+ J.ASYNC_QUEUE = new z();
196
+ let N = J;
197
+ class X {
198
198
  /**
199
199
  * 通知ダイアログを表示します。
200
200
  *
@@ -202,7 +202,7 @@ class M {
202
202
  * @returns 通知が閉じられると解決されるPromise
203
203
  */
204
204
  static dialog(t) {
205
- return T.enqueue(() => {
205
+ return N.enqueue(() => {
206
206
  window.alert(t);
207
207
  }, !0);
208
208
  }
@@ -230,7 +230,7 @@ class M {
230
230
  * @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
231
231
  */
232
232
  static confirm(t) {
233
- return T.enqueue(() => window.confirm(t), !0);
233
+ return N.enqueue(() => window.confirm(t), !0);
234
234
  }
235
235
  /**
236
236
  * ダイアログを開きます。
@@ -238,8 +238,8 @@ class M {
238
238
  * @param element 開くダイアログのHTML要素
239
239
  */
240
240
  static openDialog(t) {
241
- return T.enqueue(() => {
242
- t instanceof HTMLDialogElement ? t.showModal() : h.error("[Haori]", "Element is not a dialog: ", t);
241
+ return N.enqueue(() => {
242
+ t instanceof HTMLDialogElement ? t.showModal() : f.error("[Haori]", "Element is not a dialog: ", t);
243
243
  }, !0);
244
244
  }
245
245
  /**
@@ -248,8 +248,8 @@ class M {
248
248
  * @param element 閉じるダイアログのHTML要素
249
249
  */
250
250
  static closeDialog(t) {
251
- return T.enqueue(() => {
252
- t instanceof HTMLDialogElement ? t.close() : h.error("[Haori]", "Element is not a dialog: ", t);
251
+ return N.enqueue(() => {
252
+ t instanceof HTMLDialogElement ? t.close() : f.error("[Haori]", "Element is not a dialog: ", t);
253
253
  }, !0);
254
254
  }
255
255
  /**
@@ -259,7 +259,7 @@ class M {
259
259
  * @param message エラーメッセージ
260
260
  */
261
261
  static addErrorMessage(t, e) {
262
- return T.enqueue(() => {
262
+ return N.enqueue(() => {
263
263
  if (t instanceof HTMLFormElement) {
264
264
  t.setAttribute("data-message", e);
265
265
  return;
@@ -277,14 +277,21 @@ class M {
277
277
  * @param parent メッセージをクリアする親要素
278
278
  */
279
279
  static clearMessages(t) {
280
- return T.enqueue(() => {
280
+ return N.enqueue(() => {
281
281
  t.removeAttribute("data-message"), t.querySelectorAll("[data-message]").forEach((e) => {
282
282
  e.removeAttribute("data-message");
283
283
  });
284
284
  }, !0);
285
285
  }
286
286
  }
287
- class y {
287
+ const Q = ["addErrorMessage", "clearMessages"];
288
+ function W() {
289
+ const t = globalThis.window?.Haori;
290
+ return Q.every(
291
+ (r) => typeof t?.[r] == "function"
292
+ ) ? t : X;
293
+ }
294
+ class E {
288
295
  /**
289
296
  * フォーム内にある入力エレメントの値をオブジェクトとして取得します。
290
297
  * data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
@@ -295,7 +302,7 @@ class y {
295
302
  */
296
303
  static getValues(t) {
297
304
  const e = {};
298
- return y.getPartValues(t, e);
305
+ return E.getPartValues(t, e);
299
306
  }
300
307
  /**
301
308
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
@@ -306,32 +313,32 @@ class y {
306
313
  * @returns values と同じオブジェクト
307
314
  */
308
315
  static getPartValues(t, e) {
309
- const r = t.getAttribute("name"), i = t.getAttribute(`${c.prefix}form-object`), s = t.getAttribute(`${c.prefix}form-list`);
316
+ const r = t.getAttribute("name"), n = t.getAttribute(`${h.prefix}form-object`), s = t.getAttribute(`${h.prefix}form-list`);
310
317
  if (r) {
311
- s ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && h.warn(
318
+ s ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), n && f.warn(
312
319
  "Haori",
313
- `Element cannot have both ${c.prefix}form-object and name attributes.`
320
+ `Element cannot have both ${h.prefix}form-object and name attributes.`
314
321
  );
315
- for (const n of t.getChildElementFragments())
316
- y.getPartValues(n, e);
317
- } else if (i) {
318
- const n = {};
322
+ for (const i of t.getChildElementFragments())
323
+ E.getPartValues(i, e);
324
+ } else if (n) {
325
+ const i = {};
319
326
  for (const a of t.getChildElementFragments())
320
- y.getPartValues(a, n);
321
- Object.keys(n).length > 0 && (e[String(i)] = n), s && h.warn(
327
+ E.getPartValues(a, i);
328
+ Object.keys(i).length > 0 && (e[String(n)] = i), s && f.warn(
322
329
  "Haori",
323
- `Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
330
+ `Element cannot have both ${h.prefix}form-list and ${h.prefix}form-object attributes.`
324
331
  );
325
332
  } else if (s) {
326
- const n = [];
333
+ const i = [];
327
334
  for (const a of t.getChildElementFragments()) {
328
335
  const o = {};
329
- y.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
336
+ E.getPartValues(a, o), Object.keys(o).length > 0 && i.push(o);
330
337
  }
331
- n.length > 0 && (e[String(s)] = n);
338
+ i.length > 0 && (e[String(s)] = i);
332
339
  } else
333
- for (const n of t.getChildElementFragments())
334
- y.getPartValues(n, e);
340
+ for (const i of t.getChildElementFragments())
341
+ E.getPartValues(i, e);
335
342
  return e;
336
343
  }
337
344
  /**
@@ -344,7 +351,7 @@ class y {
344
351
  * @returns Promise(DOMの更新が完了したら解決される)
345
352
  */
346
353
  static setValues(t, e, r = !1) {
347
- return y.setPartValues(t, e, null, r);
354
+ return E.setPartValues(t, e, null, r);
348
355
  }
349
356
  /**
350
357
  * フラグメント内にある各入力エレメントに値を設定します。
@@ -355,11 +362,11 @@ class y {
355
362
  * @param force data-form-detach属性があるエレメントにも値を反映するかどうか
356
363
  * @returns Promise(DOMの更新が完了したら解決される)
357
364
  */
358
- static setPartValues(t, e, r = null, i = !1) {
359
- const s = [], n = t.getAttribute("name"), a = t.getAttribute(`${c.prefix}form-object`), o = t.getAttribute(`${c.prefix}form-list`), g = t.getAttribute(`${c.prefix}form-detach`);
360
- if (n) {
361
- if (!g || i) {
362
- const u = e[String(n)];
365
+ static setPartValues(t, e, r = null, n = !1) {
366
+ const s = [], i = t.getAttribute("name"), a = t.getAttribute(`${h.prefix}form-object`), o = t.getAttribute(`${h.prefix}form-list`), g = t.getAttribute(`${h.prefix}form-detach`);
367
+ if (i) {
368
+ if (!g || n) {
369
+ const u = e[String(i)];
363
370
  o && Array.isArray(u) && r !== null ? s.push(t.setValue(u[r])) : typeof u == "string" || typeof u == "number" || typeof u == "boolean" || u === null ? s.push(t.setValue(u)) : s.push(t.setValue(String(u)));
364
371
  }
365
372
  } else if (a) {
@@ -367,11 +374,11 @@ class y {
367
374
  if (u && typeof u == "object")
368
375
  for (const b of t.getChildElementFragments())
369
376
  s.push(
370
- y.setPartValues(
377
+ E.setPartValues(
371
378
  b,
372
379
  u,
373
380
  null,
374
- i
381
+ n
375
382
  )
376
383
  );
377
384
  } else if (o) {
@@ -379,20 +386,20 @@ class y {
379
386
  if (Array.isArray(u)) {
380
387
  const b = t.getChildElementFragments();
381
388
  for (let l = 0; l < b.length; l++) {
382
- const f = b[l];
389
+ const d = b[l];
383
390
  u.length > l ? s.push(
384
- y.setPartValues(
385
- f,
391
+ E.setPartValues(
392
+ d,
386
393
  u[l],
387
394
  l,
388
- i
395
+ n
389
396
  )
390
- ) : s.push(y.setPartValues(f, {}, l, i));
397
+ ) : s.push(E.setPartValues(d, {}, l, n));
391
398
  }
392
399
  }
393
400
  } else
394
401
  for (const u of t.getChildElementFragments())
395
- s.push(y.setPartValues(u, e, null, i));
402
+ s.push(E.setPartValues(u, e, null, n));
396
403
  return Promise.all(s).then(() => {
397
404
  });
398
405
  }
@@ -404,21 +411,21 @@ class y {
404
411
  * @returns すべての初期化処理が完了するPromise
405
412
  */
406
413
  static async reset(t) {
407
- y.clearValues(t), await Promise.all([
408
- y.clearMessages(t),
409
- y.clearEachClones(t)
410
- ]), await T.enqueue(() => {
414
+ E.clearValues(t), await Promise.all([
415
+ E.clearMessages(t),
416
+ E.clearEachClones(t)
417
+ ]), await N.enqueue(() => {
411
418
  const e = t.getTarget();
412
419
  if (e instanceof HTMLFormElement)
413
420
  e.reset();
414
421
  else {
415
422
  const r = e.parentElement;
416
423
  if (r) {
417
- const i = e.nextElementSibling, s = document.createElement("form");
418
- s.appendChild(e), s.reset(), r.insertBefore(e, i);
424
+ const n = e.nextElementSibling, s = document.createElement("form");
425
+ s.appendChild(e), s.reset(), r.insertBefore(e, n);
419
426
  }
420
427
  }
421
- }), await N.evaluateAll(t);
428
+ }), await T.evaluateAll(t);
422
429
  }
423
430
  /**
424
431
  * data-each によって生成された複製(テンプレート以外)を削除します。
@@ -428,19 +435,19 @@ class y {
428
435
  */
429
436
  static clearEachClones(t) {
430
437
  const e = [], r = (s) => {
431
- if (s.hasAttribute(`${c.prefix}each`))
432
- for (const n of s.getChildElementFragments()) {
433
- const a = n.hasAttribute(`${c.prefix}each-before`), o = n.hasAttribute(`${c.prefix}each-after`);
434
- !a && !o && e.push(n.remove());
438
+ if (s.hasAttribute(`${h.prefix}each`))
439
+ for (const i of s.getChildElementFragments()) {
440
+ const a = i.hasAttribute(`${h.prefix}each-before`), o = i.hasAttribute(`${h.prefix}each-after`);
441
+ !a && !o && e.push(i.remove());
435
442
  }
436
- }, i = (s) => {
443
+ }, n = (s) => {
437
444
  r(s);
438
- for (const n of s.getChildElementFragments())
439
- i(n);
445
+ for (const i of s.getChildElementFragments())
446
+ n(i);
440
447
  };
441
448
  r(t);
442
449
  for (const s of t.getChildElementFragments())
443
- i(s);
450
+ n(s);
444
451
  return Promise.all(e).then(() => {
445
452
  });
446
453
  }
@@ -452,7 +459,7 @@ class y {
452
459
  static clearValues(t) {
453
460
  t.clearValue();
454
461
  for (const e of t.getChildElementFragments())
455
- y.clearValues(e);
462
+ E.clearValues(e);
456
463
  }
457
464
  /**
458
465
  * フラグメントとその子要素のメッセージをクリアします。
@@ -461,7 +468,9 @@ class y {
461
468
  * @returns Promise(メッセージのクリアが完了したら解決される)
462
469
  */
463
470
  static clearMessages(t) {
464
- return M.clearMessages(t.getTarget());
471
+ return W().clearMessages(
472
+ t.getTarget()
473
+ );
465
474
  }
466
475
  /**
467
476
  * キーに一致するフラグメントにエラーメッセージを追加します。
@@ -473,10 +482,14 @@ class y {
473
482
  * @return Promise(メッセージの追加が完了したら解決される)
474
483
  */
475
484
  static addErrorMessage(t, e, r) {
476
- const i = [], s = y.findFragmentsByKey(t, e);
477
- return s.forEach((n) => {
478
- i.push(M.addErrorMessage(n.getTarget(), r));
479
- }), s.length === 0 && i.push(M.addErrorMessage(t.getTarget(), r)), Promise.all(i).then(() => {
485
+ const n = [], s = W(), i = E.findFragmentsByKey(t, e);
486
+ return i.forEach((a) => {
487
+ n.push(
488
+ s.addErrorMessage(a.getTarget(), r)
489
+ );
490
+ }), i.length === 0 && n.push(
491
+ s.addErrorMessage(t.getTarget(), r)
492
+ ), Promise.all(n).then(() => {
480
493
  });
481
494
  }
482
495
  /**
@@ -487,7 +500,7 @@ class y {
487
500
  * @returns 一致するフラグメントの配列
488
501
  */
489
502
  static findFragmentsByKey(t, e) {
490
- return y.findFragmentByKeyParts(t, e.split("."));
503
+ return E.findFragmentByKeyParts(t, e.split("."));
491
504
  }
492
505
  /**
493
506
  * 指定されたキーに一致するフラグメントを検索します。
@@ -498,24 +511,24 @@ class y {
498
511
  * @returns 一致するフラグメントの配列
499
512
  */
500
513
  static findFragmentByKeyParts(t, e) {
501
- const r = [], i = e[0];
502
- if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${c.prefix}form-object`))
503
- e.length > 1 && t.getAttribute(`${c.prefix}form-object`) === i && t.getChildElementFragments().forEach((n) => {
504
- r.push(...y.findFragmentByKeyParts(n, e.slice(1)));
514
+ const r = [], n = e[0];
515
+ if (e.length == 1 && t.getAttribute("name") === n && r.push(t), t.hasAttribute(`${h.prefix}form-object`))
516
+ e.length > 1 && t.getAttribute(`${h.prefix}form-object`) === n && t.getChildElementFragments().forEach((i) => {
517
+ r.push(...E.findFragmentByKeyParts(i, e.slice(1)));
505
518
  });
506
- else if (t.hasAttribute(`${c.prefix}form-list`)) {
519
+ else if (t.hasAttribute(`${h.prefix}form-list`)) {
507
520
  if (e.length > 1) {
508
- const s = t.getAttribute(`${c.prefix}form-list`), n = i.lastIndexOf("["), a = i.lastIndexOf("]");
509
- if (n !== -1 && a !== -1 && n < a) {
510
- const o = i.substring(0, n);
521
+ const s = t.getAttribute(`${h.prefix}form-list`), i = n.lastIndexOf("["), a = n.lastIndexOf("]");
522
+ if (i !== -1 && a !== -1 && i < a) {
523
+ const o = n.substring(0, i);
511
524
  if (s === o) {
512
- const g = i.substring(n + 1, a), u = Number(g);
525
+ const g = n.substring(i + 1, a), u = Number(g);
513
526
  if (isNaN(u))
514
- h.error("Haori", `Invalid index: ${i}`);
527
+ f.error("Haori", `Invalid index: ${n}`);
515
528
  else {
516
- const b = t.getChildElementFragments().filter((l) => l.hasAttribute(`${c.prefix}row`));
529
+ const b = t.getChildElementFragments().filter((l) => l.hasAttribute(`${h.prefix}row`));
517
530
  u < b.length && r.push(
518
- ...y.findFragmentByKeyParts(b[u], e.slice(1))
531
+ ...E.findFragmentByKeyParts(b[u], e.slice(1))
519
532
  );
520
533
  }
521
534
  }
@@ -523,7 +536,7 @@ class y {
523
536
  }
524
537
  } else
525
538
  t.getChildElementFragments().forEach((s) => {
526
- r.push(...y.findFragmentByKeyParts(s, e));
539
+ r.push(...E.findFragmentByKeyParts(s, e));
527
540
  });
528
541
  return r;
529
542
  }
@@ -540,7 +553,43 @@ class y {
540
553
  return r ? this.getFormFragment(r) : null;
541
554
  }
542
555
  }
543
- const k = class k {
556
+ const P = class P {
557
+ /**
558
+ * 明示バインド内に持ち込まれてはならない危険値を返します。
559
+ *
560
+ * @returns 危険値の配列
561
+ */
562
+ static getForbiddenBindingValues() {
563
+ const t = globalThis, e = [
564
+ t,
565
+ t.window,
566
+ t.document,
567
+ t.navigator,
568
+ t.history,
569
+ t.localStorage,
570
+ t.sessionStorage,
571
+ t.fetch,
572
+ t.Function,
573
+ t.setTimeout,
574
+ t.setInterval,
575
+ t.requestAnimationFrame,
576
+ t.alert,
577
+ t.confirm,
578
+ t.prompt
579
+ ];
580
+ return t.window?.location && e.push(t.window.location), e.filter((r) => r != null);
581
+ }
582
+ /**
583
+ * 現在のバインド識別子に含まれない禁止グローバルを遮断するコードを生成します。
584
+ *
585
+ * @param bindKeys 現在の式で利用するバインド識別子一覧
586
+ * @returns 評価前に挿入する初期化コード
587
+ */
588
+ static buildAssignments(t) {
589
+ const e = new Set(t);
590
+ return this.FORBIDDEN_NAMES.filter((r) => !e.has(r)).map((r) => `const ${r} = undefined`).join(`;
591
+ `);
592
+ }
544
593
  /**
545
594
  * 式を評価します。
546
595
  *
@@ -549,37 +598,42 @@ const k = class k {
549
598
  */
550
599
  static evaluate(t, e = {}) {
551
600
  if (t.trim() === "")
552
- return h.warn("[Haori]", t, "Expression is empty"), null;
601
+ return f.warn("[Haori]", t, "Expression is empty"), null;
553
602
  if (this.containsDangerousPatterns(t))
554
- return h.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
603
+ return f.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
555
604
  if (this.containsForbiddenKeys(e))
556
- return h.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
557
- const r = Object.keys(e).filter(
558
- (n) => !this.FORBIDDEN_NAMES.includes(n) && !this.STRICT_FORBIDDEN_NAMES.includes(n)
559
- ).sort(), i = `${t}:${r.join(",")}`;
560
- let s = this.EXPRESSION_CACHE.get(i);
605
+ return f.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
606
+ if (this.containsForbiddenBindingValues(e))
607
+ return f.warn(
608
+ "[Haori]",
609
+ e,
610
+ "Binded values contain forbidden values"
611
+ ), null;
612
+ const r = Object.keys(e).filter((i) => !this.FORBIDDEN_BINDING_NAMES.has(i)).sort(), n = `${t}:${r.join(",")}`;
613
+ let s = this.EXPRESSION_CACHE.get(n);
561
614
  if (!s) {
562
- const n = `"use strict";
563
- ${this.assignments};
615
+ const i = this.buildAssignments(r), a = i ? `"use strict";
616
+ ${i};
617
+ return (${t});` : `"use strict";
564
618
  return (${t});`;
565
619
  try {
566
- s = new Function(...r, n), this.EXPRESSION_CACHE.set(i, s);
567
- } catch (a) {
568
- return h.error(
620
+ s = new Function(...r, a), this.EXPRESSION_CACHE.set(n, s);
621
+ } catch (o) {
622
+ return f.error(
569
623
  "[Haori]",
570
624
  "Failed to compile expression:",
571
625
  t,
572
- a
626
+ o
573
627
  ), null;
574
628
  }
575
629
  }
576
630
  try {
577
- const n = [], a = this.wrapBoundValues(e);
631
+ const i = [], a = this.wrapBoundValues(e);
578
632
  return r.forEach((o) => {
579
- n.push(a[o]);
580
- }), this.withBlockedPropertyAccess(() => s(...n));
581
- } catch (n) {
582
- return h.error("[Haori]", "Expression evaluation error:", t, n), n instanceof ReferenceError ? void 0 : null;
633
+ i.push(a[o]);
634
+ }), this.withBlockedPropertyAccess(() => s(...i));
635
+ } catch (i) {
636
+ return f.error("[Haori]", "Expression evaluation error:", t, i), i instanceof ReferenceError ? void 0 : null;
583
637
  }
584
638
  }
585
639
  /**
@@ -609,14 +663,14 @@ return (${t});`;
609
663
  if (e === null || e.length === 0)
610
664
  return !1;
611
665
  const r = [];
612
- let i = null;
666
+ let n = null;
613
667
  for (let s = 0; s < e.length; s++) {
614
- const n = e[s], a = e[s + 1] || null, o = r[r.length - 1] || null;
615
- if (n.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(n.value) || this.STRICT_FORBIDDEN_NAMES.includes(n.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(n.value)) || o === "member" && n.value !== "]" && n.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
616
- this.decodeStringLiteral(n.value)
617
- ) || n.value === "." && a?.type !== "identifier" || n.value === "?." && a?.type !== "identifier" && a?.value !== "[" && a?.value !== "(")
668
+ const i = e[s], a = e[s + 1] || null, o = r[r.length - 1] || null;
669
+ if (i.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(i.value) || this.STRICT_FORBIDDEN_NAMES.includes(i.value) || (n?.value === "." || n?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(i.value)) || o === "member" && i.value !== "]" && i.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
670
+ this.decodeStringLiteral(i.value)
671
+ ) || i.value === "." && a?.type !== "identifier" || i.value === "?." && a?.type !== "identifier" && a?.value !== "[" && a?.value !== "(")
618
672
  return !1;
619
- switch (n.value) {
673
+ switch (i.value) {
620
674
  case "(":
621
675
  r.push("paren");
622
676
  break;
@@ -626,7 +680,7 @@ return (${t});`;
626
680
  break;
627
681
  }
628
682
  case "[": {
629
- const g = this.startsMemberAccess(i) ? "member" : "array";
683
+ const g = this.startsMemberAccess(n) ? "member" : "array";
630
684
  r.push(g);
631
685
  break;
632
686
  }
@@ -636,7 +690,7 @@ return (${t});`;
636
690
  break;
637
691
  }
638
692
  }
639
- i = n;
693
+ n = i;
640
694
  }
641
695
  return r.length === 0;
642
696
  }
@@ -659,7 +713,7 @@ return (${t});`;
659
713
  "==",
660
714
  "!=",
661
715
  "=>"
662
- ], i = /* @__PURE__ */ new Set([
716
+ ], n = /* @__PURE__ */ new Set([
663
717
  "(",
664
718
  ")",
665
719
  "[",
@@ -679,14 +733,14 @@ return (${t});`;
679
733
  ]);
680
734
  let s = 0;
681
735
  for (; s < t.length; ) {
682
- const n = t[s];
683
- if (/\s/.test(n)) {
736
+ const i = t[s];
737
+ if (/\s/.test(i)) {
684
738
  s += 1;
685
739
  continue;
686
740
  }
687
- if (n === "/" && (t[s + 1] === "/" || t[s + 1] === "*"))
741
+ if (i === "/" && (t[s + 1] === "/" || t[s + 1] === "*"))
688
742
  return null;
689
- if (n === '"' || n === "'") {
743
+ if (i === '"' || i === "'") {
690
744
  const o = this.readStringToken(t, s);
691
745
  if (o === null)
692
746
  return null;
@@ -700,18 +754,18 @@ return (${t});`;
700
754
  e.push({ type: "operator", value: a, position: s }), s += a.length;
701
755
  continue;
702
756
  }
703
- if (/[0-9]/.test(n)) {
757
+ if (/[0-9]/.test(i)) {
704
758
  const o = this.readNumberToken(t, s);
705
759
  e.push(o.token), s = o.nextIndex;
706
760
  continue;
707
761
  }
708
- if (/[A-Za-z_$]/.test(n)) {
762
+ if (/[A-Za-z_$]/.test(i)) {
709
763
  const o = this.readIdentifierToken(t, s);
710
764
  e.push(o.token), s = o.nextIndex;
711
765
  continue;
712
766
  }
713
- if (i.has(n)) {
714
- e.push({ type: "operator", value: n, position: s }), s += 1;
767
+ if (n.has(i)) {
768
+ e.push({ type: "operator", value: i, position: s }), s += 1;
715
769
  continue;
716
770
  }
717
771
  return null;
@@ -727,23 +781,23 @@ return (${t});`;
727
781
  */
728
782
  static readStringToken(t, e) {
729
783
  const r = t[e];
730
- let i = e + 1;
731
- for (; i < t.length; ) {
732
- const s = t[i];
784
+ let n = e + 1;
785
+ for (; n < t.length; ) {
786
+ const s = t[n];
733
787
  if (s === "\\") {
734
- i += 2;
788
+ n += 2;
735
789
  continue;
736
790
  }
737
791
  if (s === r)
738
792
  return {
739
793
  token: {
740
794
  type: "string",
741
- value: t.slice(e, i + 1),
795
+ value: t.slice(e, n + 1),
742
796
  position: e
743
797
  },
744
- nextIndex: i + 1
798
+ nextIndex: n + 1
745
799
  };
746
- i += 1;
800
+ n += 1;
747
801
  }
748
802
  return null;
749
803
  }
@@ -842,8 +896,8 @@ return (${t});`;
842
896
  */
843
897
  static wrapBoundValues(t) {
844
898
  const e = /* @__PURE__ */ new WeakMap(), r = {};
845
- return Object.entries(t).forEach(([i, s]) => {
846
- r[i] = this.wrapBoundValue(s, e);
899
+ return Object.entries(t).forEach(([n, s]) => {
900
+ r[n] = this.wrapBoundValue(s, e);
847
901
  }), r;
848
902
  }
849
903
  /**
@@ -856,35 +910,35 @@ return (${t});`;
856
910
  static wrapBoundValue(t, e) {
857
911
  if (!this.shouldWrapValue(t))
858
912
  return t;
859
- const r = t, i = e.get(r);
860
- if (i !== void 0)
861
- return i;
913
+ const r = t, n = e.get(r);
914
+ if (n !== void 0)
915
+ return n;
862
916
  const s = new Proxy(r, {
863
- get: (n, a, o) => {
917
+ get: (i, a, o) => {
864
918
  if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
865
919
  return;
866
- const g = Reflect.get(n, a, o);
920
+ const g = Reflect.get(i, a, o);
867
921
  return typeof a == "symbol" ? g : this.wrapBoundValue(
868
922
  g,
869
923
  e
870
924
  );
871
925
  },
872
- has: (n, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(n, a),
873
- getOwnPropertyDescriptor: (n, a) => {
926
+ has: (i, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(i, a),
927
+ getOwnPropertyDescriptor: (i, a) => {
874
928
  if (!(typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a)))
875
- return Reflect.getOwnPropertyDescriptor(n, a);
929
+ return Reflect.getOwnPropertyDescriptor(i, a);
876
930
  },
877
- apply: (n, a, o) => {
931
+ apply: (i, a, o) => {
878
932
  const g = Reflect.apply(
879
- n,
933
+ i,
880
934
  a,
881
935
  o
882
936
  );
883
937
  return this.isIteratorLike(g) ? g : this.wrapBoundValue(g, e);
884
938
  },
885
- construct: (n, a, o) => this.wrapBoundValue(
939
+ construct: (i, a, o) => this.wrapBoundValue(
886
940
  Reflect.construct(
887
- n,
941
+ i,
888
942
  a,
889
943
  o
890
944
  ),
@@ -920,12 +974,12 @@ return (${t});`;
920
974
  { target: Object.prototype, property: "constructor" },
921
975
  { target: Function.prototype, property: "constructor" },
922
976
  { target: Object.prototype, property: "__proto__" }
923
- ].map((i) => ({
924
- ...i,
925
- descriptor: Object.getOwnPropertyDescriptor(i.target, i.property)
926
- })).filter((i) => i.descriptor?.configurable === !0);
927
- r.forEach(({ target: i, property: s }) => {
928
- Object.defineProperty(i, s, {
977
+ ].map((n) => ({
978
+ ...n,
979
+ descriptor: Object.getOwnPropertyDescriptor(n.target, n.property)
980
+ })).filter((n) => n.descriptor?.configurable === !0);
981
+ r.forEach(({ target: n, property: s }) => {
982
+ Object.defineProperty(n, s, {
929
983
  configurable: !0,
930
984
  enumerable: !1,
931
985
  get: () => {
@@ -937,8 +991,8 @@ return (${t});`;
937
991
  try {
938
992
  return t();
939
993
  } finally {
940
- r.forEach(({ target: i, property: s, descriptor: n }) => {
941
- n !== void 0 && Object.defineProperty(i, s, n);
994
+ r.forEach(({ target: n, property: s, descriptor: i }) => {
995
+ i !== void 0 && Object.defineProperty(n, s, i);
942
996
  });
943
997
  }
944
998
  }
@@ -952,21 +1006,47 @@ return (${t});`;
952
1006
  return t === null || typeof t != "object" ? !1 : typeof t.next == "function";
953
1007
  }
954
1008
  /**
955
- * valuesオブジェクトに禁止識別子が含まれていないか再帰的にチェックします。
1009
+ * トップレベルのバインド識別子に拒否対象名が含まれていないかを判定します。
1010
+ * ネストしたオブジェクトのプロパティ名は識別子として評価されないため、ここでは拒否しません。
956
1011
  *
957
1012
  * @param obj チェック対象のオブジェクト
958
1013
  * @return 禁止識別子が含まれていればtrue
959
1014
  */
960
1015
  static containsForbiddenKeys(t) {
961
- if (t && typeof t == "object") {
962
- for (const e of Object.keys(t))
963
- if (this.FORBIDDEN_NAMES.includes(e) || this.STRICT_FORBIDDEN_NAMES.includes(e) || this.containsForbiddenKeys(t[e]))
1016
+ if (!t || typeof t != "object")
1017
+ return !1;
1018
+ for (const e of Object.keys(t))
1019
+ if (this.FORBIDDEN_BINDING_NAMES.has(e))
1020
+ return !0;
1021
+ return !1;
1022
+ }
1023
+ /**
1024
+ * バインド値に危険なホストオブジェクトやグローバル関数が含まれていないかを再帰的に判定します。
1025
+ *
1026
+ * @param obj チェック対象の値
1027
+ * @param seen 循環参照検出用の訪問済み集合
1028
+ * @return 危険値が含まれていればtrue
1029
+ */
1030
+ static containsForbiddenBindingValues(t, e = /* @__PURE__ */ new WeakSet()) {
1031
+ if (!t || typeof t != "object" || e.has(t))
1032
+ return !1;
1033
+ if (e.add(t), this.getForbiddenBindingValues().some((r) => r === t))
1034
+ return !0;
1035
+ for (const r of Object.values(t)) {
1036
+ if (typeof r == "function") {
1037
+ if (this.getForbiddenBindingValues().some(
1038
+ (n) => n === r
1039
+ ))
964
1040
  return !0;
1041
+ continue;
1042
+ }
1043
+ if (this.containsForbiddenBindingValues(r, e))
1044
+ return !0;
965
1045
  }
966
1046
  return !1;
967
1047
  }
968
1048
  };
969
- k.FORBIDDEN_NAMES = [
1049
+ P.FORBIDDEN_NAMES = [
970
1050
  // グローバルオブジェクト
971
1051
  "window",
972
1052
  "self",
@@ -998,11 +1078,19 @@ k.FORBIDDEN_NAMES = [
998
1078
  "sessionStorage",
999
1079
  "IndexedDB",
1000
1080
  "history"
1001
- ], k.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], k.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
1081
+ ], P.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], P.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set(["location"]), P.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
1082
+ ...P.FORBIDDEN_NAMES.filter(
1083
+ (t) => !P.REBINDABLE_FORBIDDEN_NAMES.has(t)
1084
+ ),
1085
+ "constructor",
1086
+ "__proto__",
1087
+ "prototype",
1088
+ ...P.STRICT_FORBIDDEN_NAMES
1089
+ ]), P.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
1002
1090
  "constructor",
1003
1091
  "__proto__",
1004
1092
  "prototype"
1005
- ]), k.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
1093
+ ]), P.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
1006
1094
  "await",
1007
1095
  "break",
1008
1096
  "case",
@@ -1036,41 +1124,35 @@ k.FORBIDDEN_NAMES = [
1036
1124
  "while",
1037
1125
  "with",
1038
1126
  "yield"
1039
- ]), k.EXPRESSION_CACHE = /* @__PURE__ */ new Map(), (() => {
1040
- const t = [];
1041
- k.FORBIDDEN_NAMES.forEach((e) => {
1042
- t.push(`const ${e} = undefined`);
1043
- }), k.assignments = t.join(`;
1044
- `);
1045
- })();
1046
- let H = k;
1047
- const P = class P {
1127
+ ]), P.EXPRESSION_CACHE = /* @__PURE__ */ new Map();
1128
+ let H = P;
1129
+ const k = class k {
1048
1130
  /**
1049
1131
  * フラグメントのコンストラクタ。
1050
1132
  *
1051
1133
  * @param target 対象ノード
1052
1134
  */
1053
1135
  constructor(t) {
1054
- this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = t, P.FRAGMENT_CACHE.set(t, this);
1136
+ this.parent = null, this.mounted = !1, this.skipMutationNodes = !1, this.target = t, k.FRAGMENT_CACHE.set(t, this);
1055
1137
  }
1056
1138
  static get(t) {
1057
1139
  if (t == null)
1058
1140
  return null;
1059
- if (P.FRAGMENT_CACHE.has(t))
1060
- return P.FRAGMENT_CACHE.get(t);
1141
+ if (k.FRAGMENT_CACHE.has(t))
1142
+ return k.FRAGMENT_CACHE.get(t);
1061
1143
  let e;
1062
1144
  switch (t.nodeType) {
1063
1145
  case Node.ELEMENT_NODE:
1064
- e = new S(t);
1146
+ e = new x(t);
1065
1147
  break;
1066
1148
  case Node.TEXT_NODE:
1067
- e = new j(t);
1149
+ e = new I(t);
1068
1150
  break;
1069
1151
  case Node.COMMENT_NODE:
1070
- e = new K(t);
1152
+ e = new G(t);
1071
1153
  break;
1072
1154
  default:
1073
- return h.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1155
+ return f.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1074
1156
  }
1075
1157
  return e;
1076
1158
  }
@@ -1092,7 +1174,7 @@ const P = class P {
1092
1174
  return Promise.resolve();
1093
1175
  if (this.parent) {
1094
1176
  const t = this.parent, e = t.skipMutationNodes;
1095
- return T.enqueue(() => {
1177
+ return N.enqueue(() => {
1096
1178
  t.skipMutationNodes = !0, this.target.parentNode === t.getTarget() && t.getTarget().removeChild(this.target), this.mounted = !1;
1097
1179
  }).finally(() => {
1098
1180
  t.skipMutationNodes = e;
@@ -1100,7 +1182,7 @@ const P = class P {
1100
1182
  } else {
1101
1183
  const t = this.target.parentNode;
1102
1184
  if (t)
1103
- return T.enqueue(() => {
1185
+ return N.enqueue(() => {
1104
1186
  this.target.parentNode === t && t.removeChild(this.target), this.mounted = !1;
1105
1187
  });
1106
1188
  this.mounted = !1;
@@ -1117,7 +1199,7 @@ const P = class P {
1117
1199
  return Promise.resolve();
1118
1200
  if (this.parent) {
1119
1201
  const t = this.parent, e = t.skipMutationNodes;
1120
- return T.enqueue(() => {
1202
+ return N.enqueue(() => {
1121
1203
  t.skipMutationNodes = !0, this.target.parentNode !== t.getTarget() && t.getTarget().appendChild(this.target), this.mounted = !0;
1122
1204
  }).finally(() => {
1123
1205
  t.skipMutationNodes = e;
@@ -1148,7 +1230,7 @@ const P = class P {
1148
1230
  * @return 除去のPromise
1149
1231
  */
1150
1232
  remove(t = !0) {
1151
- return this.parent && this.parent.removeChild(this), P.FRAGMENT_CACHE.delete(this.target), t ? this.unmount() : Promise.resolve();
1233
+ return this.parent && this.parent.removeChild(this), k.FRAGMENT_CACHE.delete(this.target), t ? this.unmount() : Promise.resolve();
1152
1234
  }
1153
1235
  /**
1154
1236
  * 対象ノードを取得します。
@@ -1175,9 +1257,9 @@ const P = class P {
1175
1257
  this.parent = t;
1176
1258
  }
1177
1259
  };
1178
- P.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1179
- let A = P;
1180
- class S extends A {
1260
+ k.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1261
+ let A = k;
1262
+ class x extends A {
1181
1263
  /**
1182
1264
  * エレメントフラグメントのコンストラクタ。
1183
1265
  * アトリビュートや子フラグメントの作成も行います。
@@ -1203,8 +1285,8 @@ class S extends A {
1203
1285
  ], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingDataCache = null, this.visible = !0, this.display = null, this.template = null, this.listKey = null, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.syncValue(), t.getAttributeNames().forEach((e) => {
1204
1286
  const r = t.getAttribute(e);
1205
1287
  if (r !== null && !this.attributeMap.has(e)) {
1206
- const i = new L(e, r);
1207
- this.attributeMap.set(e, i);
1288
+ const n = new L(e, r);
1289
+ this.attributeMap.set(e, n);
1208
1290
  }
1209
1291
  }), t.childNodes.forEach((e) => {
1210
1292
  const r = A.get(e);
@@ -1226,7 +1308,7 @@ class S extends A {
1226
1308
  */
1227
1309
  getChildElementFragments() {
1228
1310
  return this.children.filter(
1229
- (t) => t instanceof S
1311
+ (t) => t instanceof x
1230
1312
  );
1231
1313
  }
1232
1314
  /**
@@ -1247,7 +1329,7 @@ class S extends A {
1247
1329
  removeChild(t) {
1248
1330
  const e = this.children.indexOf(t);
1249
1331
  if (e < 0) {
1250
- h.warn("[Haori]", "Child fragment not found.", t);
1332
+ f.warn("[Haori]", "Child fragment not found.", t);
1251
1333
  return;
1252
1334
  }
1253
1335
  this.children.splice(e, 1), t.setParent(null);
@@ -1258,7 +1340,7 @@ class S extends A {
1258
1340
  * @returns クローンされたフラグメント
1259
1341
  */
1260
1342
  clone() {
1261
- const t = new S(
1343
+ const t = new x(
1262
1344
  this.target.cloneNode(!1)
1263
1345
  );
1264
1346
  return this.children.forEach((e) => {
@@ -1316,7 +1398,7 @@ class S extends A {
1316
1398
  */
1317
1399
  clearBindingDataCache() {
1318
1400
  this.bindingDataCache = null, this.children.forEach((t) => {
1319
- t instanceof S && t.clearBindingDataCache();
1401
+ t instanceof x && t.clearBindingDataCache();
1320
1402
  });
1321
1403
  }
1322
1404
  /**
@@ -1364,17 +1446,17 @@ class S extends A {
1364
1446
  const e = this.getTarget();
1365
1447
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1366
1448
  const r = this.getAttribute("value");
1367
- let i;
1368
- return r === "true" ? i = t === !0 : r === "false" ? i = t === !1 : i = r === String(t), this.value = i ? t : null, e.checked === i ? Promise.resolve() : (this.skipChangeValue = !0, T.enqueue(() => {
1369
- e.checked = i, e.dispatchEvent(new Event("change", { bubbles: !0 }));
1449
+ let n;
1450
+ return r === "true" ? n = t === !0 : r === "false" ? n = t === !1 : n = r === String(t), this.value = n ? t : null, e.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, N.enqueue(() => {
1451
+ e.checked = n, e.dispatchEvent(new Event("change", { bubbles: !0 }));
1370
1452
  }).finally(() => {
1371
1453
  this.skipChangeValue = !1;
1372
1454
  }));
1373
- } else return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0, T.enqueue(() => {
1455
+ } else return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? (this.value = t, this.skipChangeValue = !0, N.enqueue(() => {
1374
1456
  e.value = t === null ? "" : String(t), (e instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(e.type) || e instanceof HTMLTextAreaElement) && e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
1375
1457
  }).finally(() => {
1376
1458
  this.skipChangeValue = !1;
1377
- })) : (h.warn(
1459
+ })) : (f.warn(
1378
1460
  "[Haori]",
1379
1461
  "setValue is not supported for this element type.",
1380
1462
  e
@@ -1430,13 +1512,13 @@ class S extends A {
1430
1512
  return this.removeAttribute(t);
1431
1513
  const r = new L(t, e);
1432
1514
  this.attributeMap.set(t, r), this.skipMutationAttributes = !0;
1433
- const i = this.getTarget(), s = r.isForceEvaluation() ? e : this.getAttribute(t);
1434
- return T.enqueue(() => {
1515
+ const n = this.getTarget(), s = r.isForceEvaluation() ? e : this.getAttribute(t);
1516
+ return N.enqueue(() => {
1435
1517
  if (s === null || s === !1)
1436
- i.removeAttribute(t);
1518
+ n.removeAttribute(t);
1437
1519
  else {
1438
- const n = String(s);
1439
- i.getAttribute(t) !== n && i.setAttribute(t, n);
1520
+ const i = String(s);
1521
+ n.getAttribute(t) !== i && n.setAttribute(t, i);
1440
1522
  }
1441
1523
  }).finally(() => {
1442
1524
  this.skipMutationAttributes = !1;
@@ -1453,7 +1535,7 @@ class S extends A {
1453
1535
  return Promise.resolve();
1454
1536
  this.attributeMap.delete(t), this.skipMutationAttributes = !0;
1455
1537
  const e = this.getTarget();
1456
- return T.enqueue(() => {
1538
+ return N.enqueue(() => {
1457
1539
  e.removeAttribute(t);
1458
1540
  }).finally(() => {
1459
1541
  this.skipMutationAttributes = !1;
@@ -1471,7 +1553,7 @@ class S extends A {
1471
1553
  if (e === void 0)
1472
1554
  return null;
1473
1555
  const r = e.evaluate(this.getBindingData());
1474
- return r.length === 1 ? r[0] : $.joinEvaluateResults(r);
1556
+ return r.length === 1 ? r[0] : B.joinEvaluateResults(r);
1475
1557
  }
1476
1558
  /**
1477
1559
  * 属性の生の値を取得します。
@@ -1511,18 +1593,18 @@ class S extends A {
1511
1593
  const r = t.getTarget();
1512
1594
  if (r.parentNode !== this.target)
1513
1595
  return null;
1514
- const i = e ? r.nextSibling : r;
1596
+ const n = e ? r.nextSibling : r;
1515
1597
  let s = e ? r.nextSibling : r;
1516
1598
  for (; s !== null; ) {
1517
- const n = A.get(s);
1518
- if (n !== null) {
1519
- const a = this.children.indexOf(n);
1599
+ const i = A.get(s);
1600
+ if (i !== null) {
1601
+ const a = this.children.indexOf(i);
1520
1602
  if (a !== -1)
1521
- return { index: a, referenceNode: i };
1603
+ return { index: a, referenceNode: n };
1522
1604
  }
1523
1605
  s = s.nextSibling;
1524
1606
  }
1525
- return { index: this.children.length, referenceNode: i };
1607
+ return { index: this.children.length, referenceNode: n };
1526
1608
  }
1527
1609
  /**
1528
1610
  * 子ノードを参照ノードの前に挿入します。
@@ -1536,16 +1618,16 @@ class S extends A {
1536
1618
  if (this.skipMutationNodes)
1537
1619
  return Promise.resolve();
1538
1620
  if (t === this)
1539
- return h.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1540
- const i = /* @__PURE__ */ new Set();
1621
+ return f.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1622
+ const n = /* @__PURE__ */ new Set();
1541
1623
  let s = this.parent;
1542
1624
  for (; s; )
1543
- i.add(s), s = s.getParent();
1544
- if (i.has(t))
1545
- return h.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1546
- const n = t.getParent() === this;
1625
+ n.add(s), s = s.getParent();
1626
+ if (n.has(t))
1627
+ return f.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1628
+ const i = t.getParent() === this;
1547
1629
  let a = -1, o = -1;
1548
- n && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1630
+ i && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1549
1631
  const g = t.getParent();
1550
1632
  g !== null && g.removeChild(t);
1551
1633
  let u = r === void 0 ? e?.getTarget() || null : r;
@@ -1553,22 +1635,22 @@ class S extends A {
1553
1635
  this.children.push(t);
1554
1636
  else {
1555
1637
  let l;
1556
- if (n ? a !== -1 && a < o ? l = o - 1 : l = o : l = this.children.indexOf(e), l === -1) {
1557
- const f = this.resolveInsertionPointFromDom(
1638
+ if (i ? a !== -1 && a < o ? l = o - 1 : l = o : l = this.children.indexOf(e), l === -1) {
1639
+ const d = this.resolveInsertionPointFromDom(
1558
1640
  e,
1559
1641
  !1
1560
1642
  );
1561
- f === null ? (h.warn(
1643
+ d === null ? (f.warn(
1562
1644
  "[Haori]",
1563
1645
  "Reference child not found in children.",
1564
1646
  e
1565
- ), this.children.push(t)) : (this.children.splice(f.index, 0, t), u = f.referenceNode);
1647
+ ), this.children.push(t)) : (this.children.splice(d.index, 0, t), u = d.referenceNode);
1566
1648
  } else
1567
1649
  this.children.splice(l, 0, t);
1568
1650
  }
1569
1651
  t.setParent(this), t.setMounted(this.mounted);
1570
1652
  const b = this.skipMutationNodes;
1571
- return this.skipMutationNodes = !0, T.enqueue(() => {
1653
+ return this.skipMutationNodes = !0, N.enqueue(() => {
1572
1654
  this.target.insertBefore(t.getTarget(), u);
1573
1655
  }).finally(() => {
1574
1656
  this.skipMutationNodes = b;
@@ -1586,18 +1668,18 @@ class S extends A {
1586
1668
  return this.insertBefore(t, null);
1587
1669
  const r = this.children.indexOf(e);
1588
1670
  if (r === -1) {
1589
- const i = this.resolveInsertionPointFromDom(
1671
+ const n = this.resolveInsertionPointFromDom(
1590
1672
  e,
1591
1673
  !0
1592
1674
  );
1593
- return i === null ? (h.warn(
1675
+ return n === null ? (f.warn(
1594
1676
  "[Haori]",
1595
1677
  "Reference child not found in children.",
1596
1678
  e
1597
1679
  ), this.insertBefore(t, null)) : this.insertBefore(
1598
1680
  t,
1599
- this.children[i.index] || null,
1600
- i.referenceNode
1681
+ this.children[n.index] || null,
1682
+ n.referenceNode
1601
1683
  );
1602
1684
  }
1603
1685
  return this.insertBefore(t, this.children[r + 1] || null);
@@ -1642,7 +1724,7 @@ class S extends A {
1642
1724
  * @returns エレメントの非表示のPromise
1643
1725
  */
1644
1726
  hide() {
1645
- return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${c.prefix}if-false`, ""), Promise.resolve();
1727
+ return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${h.prefix}if-false`, ""), Promise.resolve();
1646
1728
  }
1647
1729
  /**
1648
1730
  * エレメントを表示します。
@@ -1650,7 +1732,7 @@ class S extends A {
1650
1732
  * @return エレメントの表示のPromise
1651
1733
  */
1652
1734
  show() {
1653
- return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${c.prefix}if-false`), this.visible = !0, Promise.resolve();
1735
+ return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${h.prefix}if-false`), this.visible = !0, Promise.resolve();
1654
1736
  }
1655
1737
  /**
1656
1738
  * 指定した属性名を持つ最も近い親要素を返します。
@@ -1666,7 +1748,7 @@ class S extends A {
1666
1748
  return e === null ? null : e.closestByAttribute(t);
1667
1749
  }
1668
1750
  }
1669
- class j extends A {
1751
+ class I extends A {
1670
1752
  /**
1671
1753
  * テキストフラグメントのコンストラクタ。
1672
1754
  * 対象テキストノードの内容を初期化します。
@@ -1674,7 +1756,7 @@ class j extends A {
1674
1756
  * @param target 対象テキストノード
1675
1757
  */
1676
1758
  constructor(t) {
1677
- super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new $(this.text);
1759
+ super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new B(this.text);
1678
1760
  }
1679
1761
  /**
1680
1762
  * フラグメントをクローンします。
@@ -1682,7 +1764,7 @@ class j extends A {
1682
1764
  * @returns クローンされたフラグメント
1683
1765
  */
1684
1766
  clone() {
1685
- const t = new j(this.target.cloneNode(!0));
1767
+ const t = new I(this.target.cloneNode(!0));
1686
1768
  return t.mounted = !1, t.text = this.text, t.contents = this.contents, t;
1687
1769
  }
1688
1770
  /**
@@ -1700,7 +1782,7 @@ class j extends A {
1700
1782
  * @returns 更新のPromise
1701
1783
  */
1702
1784
  setContent(t) {
1703
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new $(t), this.evaluate());
1785
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new B(t), this.evaluate());
1704
1786
  }
1705
1787
  /**
1706
1788
  * フラグメントを評価します。
@@ -1710,10 +1792,10 @@ class j extends A {
1710
1792
  evaluate() {
1711
1793
  return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
1712
1794
  new Error("Parent fragment is required for raw evaluation")
1713
- ) : T.enqueue(() => {
1795
+ ) : N.enqueue(() => {
1714
1796
  this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
1715
1797
  this.parent.getBindingData()
1716
- )[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
1798
+ )[0] : this.contents.isEvaluate ? this.target.textContent = B.joinEvaluateResults(
1717
1799
  this.contents.evaluate(this.parent.getBindingData())
1718
1800
  ) : this.target.textContent = this.text;
1719
1801
  }).finally(() => {
@@ -1721,7 +1803,7 @@ class j extends A {
1721
1803
  });
1722
1804
  }
1723
1805
  }
1724
- class K extends A {
1806
+ class G extends A {
1725
1807
  /**
1726
1808
  * コメントフラグメントのコンストラクタ。
1727
1809
  * 対象コメントノードの内容を初期化します。
@@ -1737,7 +1819,7 @@ class K extends A {
1737
1819
  * @returns クローンされたフラグメント
1738
1820
  */
1739
1821
  clone() {
1740
- const t = new K(this.target.cloneNode(!0));
1822
+ const t = new G(this.target.cloneNode(!0));
1741
1823
  return t.mounted = !1, t.text = this.text, t;
1742
1824
  }
1743
1825
  /**
@@ -1755,7 +1837,7 @@ class K extends A {
1755
1837
  * @return 更新のPromise
1756
1838
  */
1757
1839
  setContent(t) {
1758
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, T.enqueue(() => {
1840
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, N.enqueue(() => {
1759
1841
  this.skipMutation = !0, this.target.textContent = this.text;
1760
1842
  }).finally(() => {
1761
1843
  this.skipMutation = !1;
@@ -1771,25 +1853,25 @@ const q = class q {
1771
1853
  constructor(t) {
1772
1854
  this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = t;
1773
1855
  const e = [...t.matchAll(q.PLACEHOLDER_REGEX)];
1774
- let r = 0, i = !1, s = !1;
1775
- for (const n of e) {
1776
- n.index > r && this.contents.push({
1777
- text: t.slice(r, n.index),
1856
+ let r = 0, n = !1, s = !1;
1857
+ for (const i of e) {
1858
+ i.index > r && this.contents.push({
1859
+ text: t.slice(r, i.index),
1778
1860
  type: 0
1779
1861
  /* TEXT */
1780
1862
  });
1781
1863
  const a = {
1782
- text: n[1] ?? n[2],
1783
- type: n[1] ? 2 : 1
1864
+ text: i[1] ?? i[2],
1865
+ type: i[1] ? 2 : 1
1784
1866
  /* EXPRESSION */
1785
1867
  };
1786
- i = !0, s = s || a.type === 2, this.contents.push(a), r = n.index + n[0].length;
1868
+ n = !0, s = s || a.type === 2, this.contents.push(a), r = i.index + i[0].length;
1787
1869
  }
1788
1870
  r < t.length && this.contents.push({
1789
1871
  text: t.slice(r),
1790
1872
  type: 0
1791
1873
  /* TEXT */
1792
- }), this.isEvaluate = i, this.isRawEvaluate = s, this.checkRawExpressions();
1874
+ }), this.isEvaluate = n, this.isRawEvaluate = s, this.checkRawExpressions();
1793
1875
  }
1794
1876
  /**
1795
1877
  * 評価結果を結合して文字列にします。
@@ -1813,7 +1895,7 @@ const q = class q {
1813
1895
  */
1814
1896
  checkRawExpressions() {
1815
1897
  for (let t = 0; t < this.contents.length; t++)
1816
- this.contents[t].type === 2 && this.contents.length > 1 && (h.error(
1898
+ this.contents[t].type === 2 && this.contents.length > 1 && (f.error(
1817
1899
  "[Haori]",
1818
1900
  "Raw expressions are not allowed in multi-content expressions."
1819
1901
  ), this.contents[t].type = 1);
@@ -1831,23 +1913,23 @@ const q = class q {
1831
1913
  return this.contents.forEach((r) => {
1832
1914
  try {
1833
1915
  if (r.type === 1 || r.type === 2) {
1834
- const i = H.evaluate(r.text, t);
1835
- e.push(i);
1916
+ const n = H.evaluate(r.text, t);
1917
+ e.push(n);
1836
1918
  } else
1837
1919
  e.push(r.text);
1838
- } catch (i) {
1839
- h.error(
1920
+ } catch (n) {
1921
+ f.error(
1840
1922
  "[Haori]",
1841
1923
  `Error evaluating text expression: ${r.text}`,
1842
- i
1924
+ n
1843
1925
  ), e.push("");
1844
1926
  }
1845
1927
  }), e;
1846
1928
  }
1847
1929
  };
1848
1930
  q.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
1849
- let $ = q;
1850
- const U = class U extends $ {
1931
+ let B = q;
1932
+ const U = class U extends B {
1851
1933
  /**
1852
1934
  * コンストラクタ。
1853
1935
  *
@@ -1878,18 +1960,18 @@ const U = class U extends $ {
1878
1960
  return this.contents.forEach((r) => {
1879
1961
  try {
1880
1962
  if (this.forceEvaluation && r.type === 0 || r.type === 1 || r.type === 2) {
1881
- const i = H.evaluate(r.text, t);
1882
- e.push(i);
1963
+ const n = H.evaluate(r.text, t);
1964
+ e.push(n);
1883
1965
  } else
1884
1966
  e.push(r.text);
1885
- } catch (i) {
1886
- h.error(
1967
+ } catch (n) {
1968
+ f.error(
1887
1969
  "[Haori]",
1888
1970
  `Error evaluating attribute expression: ${r.text}`,
1889
- i
1971
+ n
1890
1972
  ), e.push("");
1891
1973
  }
1892
- }), this.forceEvaluation && e.length > 1 ? (h.error(
1974
+ }), this.forceEvaluation && e.length > 1 ? (f.error(
1893
1975
  "[Haori]",
1894
1976
  "each or if expressions must have a single content.",
1895
1977
  e
@@ -1903,7 +1985,7 @@ U.FORCE_EVALUATION_ATTRIBUTES = [
1903
1985
  "hor-each"
1904
1986
  ];
1905
1987
  let L = U;
1906
- class E {
1988
+ class y {
1907
1989
  /**
1908
1990
  * カスタムイベントを発火します。
1909
1991
  *
@@ -1912,11 +1994,11 @@ class E {
1912
1994
  * @param detail イベントの詳細データ
1913
1995
  * @param options イベントオプション
1914
1996
  */
1915
- static dispatch(t, e, r, i) {
1997
+ static dispatch(t, e, r, n) {
1916
1998
  const s = new CustomEvent(`haori:${e}`, {
1917
- bubbles: i?.bubbles ?? !0,
1918
- cancelable: i?.cancelable ?? !1,
1919
- composed: i?.composed ?? !0,
1999
+ bubbles: n?.bubbles ?? !0,
2000
+ cancelable: n?.cancelable ?? !1,
2001
+ composed: n?.composed ?? !0,
1920
2002
  detail: r
1921
2003
  });
1922
2004
  return t.dispatchEvent(s);
@@ -1927,7 +2009,7 @@ class E {
1927
2009
  * @param version ライブラリバージョン
1928
2010
  */
1929
2011
  static ready(t) {
1930
- E.dispatch(document, "ready", { version: t });
2012
+ y.dispatch(document, "ready", { version: t });
1931
2013
  }
1932
2014
  /**
1933
2015
  * renderイベントを発火します。
@@ -1935,7 +2017,7 @@ class E {
1935
2017
  * @param target 評価対象要素
1936
2018
  */
1937
2019
  static render(t) {
1938
- E.dispatch(t, "render", { target: t });
2020
+ y.dispatch(t, "render", { target: t });
1939
2021
  }
1940
2022
  /**
1941
2023
  * importstartイベントを発火します。
@@ -1944,7 +2026,7 @@ class E {
1944
2026
  * @param url インポート対象URL
1945
2027
  */
1946
2028
  static importStart(t, e) {
1947
- E.dispatch(t, "importstart", {
2029
+ y.dispatch(t, "importstart", {
1948
2030
  url: e,
1949
2031
  startedAt: performance.now()
1950
2032
  });
@@ -1957,11 +2039,11 @@ class E {
1957
2039
  * @param bytes 取得バイト数
1958
2040
  * @param startedAt 開始時刻
1959
2041
  */
1960
- static importEnd(t, e, r, i) {
1961
- E.dispatch(t, "importend", {
2042
+ static importEnd(t, e, r, n) {
2043
+ y.dispatch(t, "importend", {
1962
2044
  url: e,
1963
2045
  bytes: r,
1964
- durationMs: performance.now() - i
2046
+ durationMs: performance.now() - n
1965
2047
  });
1966
2048
  }
1967
2049
  /**
@@ -1972,7 +2054,7 @@ class E {
1972
2054
  * @param error エラー内容
1973
2055
  */
1974
2056
  static importError(t, e, r) {
1975
- E.dispatch(t, "importerror", { url: e, error: r });
2057
+ y.dispatch(t, "importerror", { url: e, error: r });
1976
2058
  }
1977
2059
  /**
1978
2060
  * bindchangeイベントを発火します。
@@ -1982,17 +2064,17 @@ class E {
1982
2064
  * @param next 変更後のデータ
1983
2065
  * @param reason 変更理由
1984
2066
  */
1985
- static bindChange(t, e, r, i = "other") {
1986
- const s = [], n = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...n, ...a]);
2067
+ static bindChange(t, e, r, n = "other") {
2068
+ const s = [], i = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...i, ...a]);
1987
2069
  for (const g of o) {
1988
2070
  const u = e?.[g], b = r[g];
1989
2071
  u !== b && s.push(g);
1990
2072
  }
1991
- E.dispatch(t, "bindchange", {
2073
+ y.dispatch(t, "bindchange", {
1992
2074
  previous: e || {},
1993
2075
  next: r,
1994
2076
  changedKeys: s,
1995
- reason: i
2077
+ reason: n
1996
2078
  });
1997
2079
  }
1998
2080
  /**
@@ -2003,12 +2085,12 @@ class E {
2003
2085
  * @param removed 削除された行のキー
2004
2086
  * @param order 現在の順序
2005
2087
  */
2006
- static eachUpdate(t, e, r, i) {
2007
- E.dispatch(t, "eachupdate", {
2088
+ static eachUpdate(t, e, r, n) {
2089
+ y.dispatch(t, "eachupdate", {
2008
2090
  added: e,
2009
2091
  removed: r,
2010
- order: i,
2011
- total: i.length
2092
+ order: n,
2093
+ total: n.length
2012
2094
  });
2013
2095
  }
2014
2096
  /**
@@ -2019,8 +2101,8 @@ class E {
2019
2101
  * @param index インデックス
2020
2102
  * @param item 行データ
2021
2103
  */
2022
- static rowAdd(t, e, r, i) {
2023
- E.dispatch(t, "rowadd", { key: e, index: r, item: i });
2104
+ static rowAdd(t, e, r, n) {
2105
+ y.dispatch(t, "rowadd", { key: e, index: r, item: n });
2024
2106
  }
2025
2107
  /**
2026
2108
  * rowremoveイベントを発火します。
@@ -2030,7 +2112,7 @@ class E {
2030
2112
  * @param index インデックス
2031
2113
  */
2032
2114
  static rowRemove(t, e, r) {
2033
- E.dispatch(t, "rowremove", { key: e, index: r });
2115
+ y.dispatch(t, "rowremove", { key: e, index: r });
2034
2116
  }
2035
2117
  /**
2036
2118
  * rowmoveイベントを発火します。
@@ -2040,8 +2122,8 @@ class E {
2040
2122
  * @param from 移動前インデックス
2041
2123
  * @param to 移動後インデックス
2042
2124
  */
2043
- static rowMove(t, e, r, i) {
2044
- E.dispatch(t, "rowmove", { key: e, from: r, to: i });
2125
+ static rowMove(t, e, r, n) {
2126
+ y.dispatch(t, "rowmove", { key: e, from: r, to: n });
2045
2127
  }
2046
2128
  /**
2047
2129
  * showイベントを発火します。
@@ -2049,7 +2131,7 @@ class E {
2049
2131
  * @param target data-if要素
2050
2132
  */
2051
2133
  static show(t) {
2052
- E.dispatch(t, "show", { visible: !0 });
2134
+ y.dispatch(t, "show", { visible: !0 });
2053
2135
  }
2054
2136
  /**
2055
2137
  * hideイベントを発火します。
@@ -2057,7 +2139,7 @@ class E {
2057
2139
  * @param target data-if要素
2058
2140
  */
2059
2141
  static hide(t) {
2060
- E.dispatch(t, "hide", { visible: !1 });
2142
+ y.dispatch(t, "hide", { visible: !1 });
2061
2143
  }
2062
2144
  /**
2063
2145
  * fetchstartイベントを発火します。
@@ -2067,11 +2149,11 @@ class E {
2067
2149
  * @param options フェッチオプション
2068
2150
  * @param payload 送信データ
2069
2151
  */
2070
- static fetchStart(t, e, r, i) {
2071
- E.dispatch(t, "fetchstart", {
2152
+ static fetchStart(t, e, r, n) {
2153
+ y.dispatch(t, "fetchstart", {
2072
2154
  url: e,
2073
2155
  options: r || {},
2074
- payload: i,
2156
+ payload: n,
2075
2157
  startedAt: performance.now()
2076
2158
  });
2077
2159
  }
@@ -2083,11 +2165,11 @@ class E {
2083
2165
  * @param status HTTPステータス
2084
2166
  * @param startedAt 開始時刻
2085
2167
  */
2086
- static fetchEnd(t, e, r, i) {
2087
- E.dispatch(t, "fetchend", {
2168
+ static fetchEnd(t, e, r, n) {
2169
+ y.dispatch(t, "fetchend", {
2088
2170
  url: e,
2089
2171
  status: r,
2090
- durationMs: performance.now() - i
2172
+ durationMs: performance.now() - n
2091
2173
  });
2092
2174
  }
2093
2175
  /**
@@ -2099,16 +2181,30 @@ class E {
2099
2181
  * @param status HTTPステータス(存在する場合)
2100
2182
  * @param startedAt 開始時刻(存在する場合)
2101
2183
  */
2102
- static fetchError(t, e, r, i, s) {
2103
- E.dispatch(t, "fetcherror", {
2184
+ static fetchError(t, e, r, n, s) {
2185
+ y.dispatch(t, "fetcherror", {
2104
2186
  url: e,
2105
- status: i,
2187
+ status: n,
2106
2188
  error: r,
2107
2189
  durationMs: s ? performance.now() - s : void 0
2108
2190
  });
2109
2191
  }
2110
2192
  }
2111
- class d {
2193
+ const Z = [
2194
+ "addErrorMessage",
2195
+ "closeDialog",
2196
+ "confirm",
2197
+ "dialog",
2198
+ "openDialog",
2199
+ "toast"
2200
+ ];
2201
+ function K() {
2202
+ const t = globalThis.window?.Haori;
2203
+ return Z.every(
2204
+ (r) => typeof t?.[r] == "function"
2205
+ ) ? t : X;
2206
+ }
2207
+ const c = class c {
2112
2208
  /**
2113
2209
  * イベント属性名を正しく生成します。
2114
2210
  * 例: ("click", "fetch") => "data-click-fetch"
@@ -2117,7 +2213,118 @@ class d {
2117
2213
  * 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
2118
2214
  */
2119
2215
  static attrName(t, e, r = !1) {
2120
- return t ? `${c.prefix}${t}-${e}` : r ? `${c.prefix}fetch-${e}` : `${c.prefix}${e}`;
2216
+ return t ? `${h.prefix}${t}-${e}` : r ? `${h.prefix}fetch-${e}` : `${h.prefix}${e}`;
2217
+ }
2218
+ /**
2219
+ * data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
2220
+ *
2221
+ * @param rawAttribute 生の属性値
2222
+ * @param bindingValues バインディング値
2223
+ * @returns パラメータ形式として扱える文字列
2224
+ */
2225
+ static resolveDataParamString(t, e) {
2226
+ return t.replace(
2227
+ c.DATA_PLACEHOLDER_REGEX,
2228
+ (r, n, s) => {
2229
+ const i = H.evaluate(
2230
+ n ?? s ?? "",
2231
+ e
2232
+ );
2233
+ return i == null || Number.isNaN(i) ? "" : encodeURIComponent(typeof i == "object" ? JSON.stringify(i) : String(i));
2234
+ }
2235
+ );
2236
+ }
2237
+ /**
2238
+ * JSON 文字列中のテンプレート式かどうかを判定します。
2239
+ *
2240
+ * @param source 生の属性値
2241
+ * @param offset プレースホルダ開始位置
2242
+ * @returns JSON 文字列中なら true
2243
+ */
2244
+ static isJsonStringContext(t, e) {
2245
+ let r = !1, n = !1;
2246
+ for (let s = 0; s < e; s += 1) {
2247
+ const i = t[s];
2248
+ if (n) {
2249
+ n = !1;
2250
+ continue;
2251
+ }
2252
+ if (i === "\\") {
2253
+ n = !0;
2254
+ continue;
2255
+ }
2256
+ i === '"' && (r = !r);
2257
+ }
2258
+ return r;
2259
+ }
2260
+ /**
2261
+ * JSON 値コンテキスト向けにテンプレート式の評価結果を直列化します。
2262
+ *
2263
+ * @param result テンプレート式の評価結果
2264
+ * @returns JSON 値として埋め込める文字列
2265
+ */
2266
+ static stringifyJsonTemplateValue(t) {
2267
+ if (t === void 0 || Number.isNaN(t))
2268
+ return "null";
2269
+ try {
2270
+ return JSON.stringify(t) ?? JSON.stringify(String(t));
2271
+ } catch {
2272
+ return JSON.stringify(String(t));
2273
+ }
2274
+ }
2275
+ /**
2276
+ * JSON 文字列コンテキスト向けにテンプレート式の評価結果を直列化します。
2277
+ *
2278
+ * @param result テンプレート式の評価結果
2279
+ * @returns JSON 文字列へ安全に埋め込める文字列
2280
+ */
2281
+ static stringifyJsonTemplateStringContent(t) {
2282
+ if (t == null || Number.isNaN(t))
2283
+ return "";
2284
+ const e = typeof t == "object" ? c.stringifyJsonTemplateValue(t) : String(t);
2285
+ return JSON.stringify(e).slice(1, -1);
2286
+ }
2287
+ /**
2288
+ * JSON 形式 data 属性内のテンプレート式を安全に解決します。
2289
+ *
2290
+ * @param rawAttribute 生の属性値
2291
+ * @param bindingValues バインディング値
2292
+ * @returns JSON として解釈可能な文字列
2293
+ */
2294
+ static resolveDataJsonString(t, e) {
2295
+ return t.replace(
2296
+ c.DATA_PLACEHOLDER_REGEX,
2297
+ (r, n, s, i) => {
2298
+ const a = H.evaluate(
2299
+ n ?? s ?? "",
2300
+ e
2301
+ );
2302
+ return c.isJsonStringContext(t, i) ? c.stringifyJsonTemplateStringContent(a) : c.stringifyJsonTemplateValue(a);
2303
+ }
2304
+ );
2305
+ }
2306
+ /**
2307
+ * data 属性を評価済みの値として取得します。
2308
+ *
2309
+ * @param fragment フラグメント
2310
+ * @param attrName 属性名
2311
+ * @returns 送信データ
2312
+ */
2313
+ static resolveDataAttribute(t, e) {
2314
+ const r = t.getRawAttribute(e), n = t.getAttribute(e);
2315
+ if (n && typeof n == "object" && !Array.isArray(n))
2316
+ return n;
2317
+ if (typeof n != "string" || r === null)
2318
+ return null;
2319
+ const s = r.trim();
2320
+ return c.SINGLE_PLACEHOLDER_REGEX.test(s) ? T.parseDataBind(n) : s.startsWith("{") || s.startsWith("[") ? T.parseDataBind(
2321
+ c.resolveDataJsonString(
2322
+ r,
2323
+ t.getBindingData()
2324
+ )
2325
+ ) : T.parseDataBind(
2326
+ c.resolveDataParamString(r, t.getBindingData())
2327
+ );
2121
2328
  }
2122
2329
  /**
2123
2330
  * オプションをフラグメントの属性から構築します。
@@ -2131,28 +2338,29 @@ class d {
2131
2338
  targetFragment: t
2132
2339
  };
2133
2340
  if (e) {
2134
- if (t.hasAttribute(d.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(d.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2135
- d.attrName(e, "confirm")
2136
- )), t.hasAttribute(d.attrName(e, "data")) && (r.data = N.parseDataBind(
2137
- t.getRawAttribute(d.attrName(e, "data"))
2138
- )), t.hasAttribute(d.attrName(e, "form"))) {
2341
+ if (t.hasAttribute(c.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(c.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2342
+ c.attrName(e, "confirm")
2343
+ )), t.hasAttribute(c.attrName(e, "data")) && (r.data = c.resolveDataAttribute(
2344
+ t,
2345
+ c.attrName(e, "data")
2346
+ )), t.hasAttribute(c.attrName(e, "form"))) {
2139
2347
  const l = t.getRawAttribute(
2140
- d.attrName(e, "form")
2348
+ c.attrName(e, "form")
2141
2349
  );
2142
2350
  if (l) {
2143
- const f = document.body.querySelector(l);
2144
- f !== null ? r.formFragment = y.getFormFragment(
2145
- A.get(f)
2146
- ) : h.error(
2351
+ const d = document.body.querySelector(l);
2352
+ d !== null ? r.formFragment = E.getFormFragment(
2353
+ A.get(d)
2354
+ ) : f.error(
2147
2355
  "Haori",
2148
- `Form element not found: ${l} (${d.attrName(e, "form")})`
2356
+ `Form element not found: ${l} (${c.attrName(e, "form")})`
2149
2357
  );
2150
2358
  } else
2151
- r.formFragment = y.getFormFragment(t);
2152
- } else e === "change" && (r.formFragment = y.getFormFragment(t));
2153
- if (t.hasAttribute(`${c.prefix}${e}-before-run`)) {
2359
+ r.formFragment = E.getFormFragment(t);
2360
+ } else e === "change" && (r.formFragment = E.getFormFragment(t));
2361
+ if (t.hasAttribute(`${h.prefix}${e}-before-run`)) {
2154
2362
  const l = t.getRawAttribute(
2155
- `${c.prefix}${e}-before-run`
2363
+ `${h.prefix}${e}-before-run`
2156
2364
  );
2157
2365
  try {
2158
2366
  r.beforeCallback = new Function(
@@ -2163,116 +2371,116 @@ class d {
2163
2371
  ${l}
2164
2372
  `
2165
2373
  );
2166
- } catch (f) {
2167
- h.error("Haori", `Invalid before script: ${f}`);
2374
+ } catch (d) {
2375
+ f.error("Haori", `Invalid before script: ${d}`);
2168
2376
  }
2169
2377
  }
2170
2378
  }
2171
- const i = d.attrName(e, "fetch"), s = t.hasAttribute(i);
2172
- s && (r.fetchUrl = t.getAttribute(i));
2173
- const n = {};
2379
+ const n = c.attrName(e, "fetch"), s = t.hasAttribute(n);
2380
+ s && (r.fetchUrl = t.getAttribute(n));
2381
+ const i = {};
2174
2382
  if (e) {
2175
- const l = d.attrName(e, "fetch-method");
2176
- t.hasAttribute(l) && (n.method = t.getAttribute(
2383
+ const l = c.attrName(e, "fetch-method");
2384
+ t.hasAttribute(l) && (i.method = t.getAttribute(
2177
2385
  l
2178
2386
  ));
2179
2387
  } else {
2180
- const l = d.attrName(null, "method", !0);
2181
- t.hasAttribute(l) && (n.method = t.getAttribute(
2388
+ const l = c.attrName(null, "method", !0);
2389
+ t.hasAttribute(l) && (i.method = t.getAttribute(
2182
2390
  l
2183
2391
  ));
2184
2392
  }
2185
2393
  if (e) {
2186
- const l = d.attrName(e, "fetch-headers");
2394
+ const l = c.attrName(e, "fetch-headers");
2187
2395
  if (t.hasAttribute(l)) {
2188
- const f = t.getRawAttribute(
2396
+ const d = t.getRawAttribute(
2189
2397
  l
2190
2398
  );
2191
2399
  try {
2192
- n.headers = N.parseDataBind(f);
2400
+ i.headers = T.parseDataBind(d);
2193
2401
  } catch (p) {
2194
- h.error("Haori", `Invalid fetch headers: ${p}`);
2402
+ f.error("Haori", `Invalid fetch headers: ${p}`);
2195
2403
  }
2196
2404
  }
2197
2405
  } else {
2198
- const l = d.attrName(
2406
+ const l = c.attrName(
2199
2407
  null,
2200
2408
  "headers",
2201
2409
  !0
2202
2410
  );
2203
2411
  if (t.hasAttribute(l)) {
2204
- const f = t.getRawAttribute(
2412
+ const d = t.getRawAttribute(
2205
2413
  l
2206
2414
  );
2207
2415
  try {
2208
- n.headers = N.parseDataBind(f);
2416
+ i.headers = T.parseDataBind(d);
2209
2417
  } catch (p) {
2210
- h.error("Haori", `Invalid fetch headers: ${p}`);
2418
+ f.error("Haori", `Invalid fetch headers: ${p}`);
2211
2419
  }
2212
2420
  }
2213
2421
  }
2214
2422
  if (e) {
2215
- const l = d.attrName(
2423
+ const l = c.attrName(
2216
2424
  e,
2217
2425
  "fetch-content-type"
2218
2426
  );
2219
2427
  if (t.hasAttribute(l))
2220
- n.headers = {
2221
- ...n.headers,
2428
+ i.headers = {
2429
+ ...i.headers,
2222
2430
  "Content-Type": t.getAttribute(l)
2223
2431
  };
2224
- else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2225
- let f = !1;
2226
- n.headers && typeof n.headers == "object" && (f = "Content-Type" in n.headers), f || (n.headers = {
2227
- ...n.headers,
2432
+ else if (i.method && i.method !== "GET" && i.method !== "HEAD" && i.method !== "OPTIONS") {
2433
+ let d = !1;
2434
+ i.headers && typeof i.headers == "object" && (d = "Content-Type" in i.headers), d || (i.headers = {
2435
+ ...i.headers,
2228
2436
  "Content-Type": "application/json"
2229
2437
  });
2230
- } else n.method && (n.method === "GET" || n.method === "HEAD" || n.method === "OPTIONS") && (n.headers = {
2231
- ...n.headers,
2438
+ } else i.method && (i.method === "GET" || i.method === "HEAD" || i.method === "OPTIONS") && (i.headers = {
2439
+ ...i.headers,
2232
2440
  "Content-Type": "application/x-www-form-urlencoded"
2233
2441
  });
2234
2442
  } else {
2235
- const l = d.attrName(
2443
+ const l = c.attrName(
2236
2444
  null,
2237
2445
  "content-type",
2238
2446
  !0
2239
2447
  );
2240
2448
  if (t.hasAttribute(l))
2241
- n.headers = {
2242
- ...n.headers,
2449
+ i.headers = {
2450
+ ...i.headers,
2243
2451
  "Content-Type": t.getAttribute(l)
2244
2452
  };
2245
- else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2246
- let f = !1;
2247
- n.headers && typeof n.headers == "object" && (f = "Content-Type" in n.headers), f || (n.headers = {
2248
- ...n.headers,
2453
+ else if (i.method && i.method !== "GET" && i.method !== "HEAD" && i.method !== "OPTIONS") {
2454
+ let d = !1;
2455
+ i.headers && typeof i.headers == "object" && (d = "Content-Type" in i.headers), d || (i.headers = {
2456
+ ...i.headers,
2249
2457
  "Content-Type": "application/json"
2250
2458
  });
2251
- } else n.method && (n.method === "GET" || n.method === "HEAD" || n.method === "OPTIONS") && (n.headers = {
2252
- ...n.headers,
2459
+ } else i.method && (i.method === "GET" || i.method === "HEAD" || i.method === "OPTIONS") && (i.headers = {
2460
+ ...i.headers,
2253
2461
  "Content-Type": "application/x-www-form-urlencoded"
2254
2462
  });
2255
2463
  }
2256
- Object.keys(n).length > 0 && (r.fetchOptions = n);
2257
- const a = e ? d.attrName(e, "bind") : d.attrName(null, "bind", !0);
2464
+ Object.keys(i).length > 0 && (r.fetchOptions = i);
2465
+ const a = e ? c.attrName(e, "bind") : c.attrName(null, "bind", !0);
2258
2466
  if (t.hasAttribute(a)) {
2259
2467
  const l = t.getRawAttribute(a);
2260
2468
  if (l) {
2261
- const f = document.body.querySelectorAll(l);
2262
- f.length > 0 ? (r.bindFragments = [], f.forEach((p) => {
2263
- const w = A.get(p);
2264
- w && r.bindFragments.push(w);
2265
- })) : h.error(
2469
+ const d = document.body.querySelectorAll(l);
2470
+ d.length > 0 ? (r.bindFragments = [], d.forEach((p) => {
2471
+ const v = A.get(p);
2472
+ v && r.bindFragments.push(v);
2473
+ })) : f.error(
2266
2474
  "Haori",
2267
2475
  `Bind element not found: ${l} (${a})`
2268
2476
  );
2269
2477
  }
2270
2478
  }
2271
- const o = d.attrName(e, "bind-arg"), g = d.attrName(
2479
+ const o = c.attrName(e, "bind-arg"), g = c.attrName(
2272
2480
  null,
2273
2481
  "arg",
2274
2482
  !0
2275
- ), u = d.attrName(
2483
+ ), u = c.attrName(
2276
2484
  null,
2277
2485
  "bind-arg",
2278
2486
  !0
@@ -2280,111 +2488,106 @@ ${l}
2280
2488
  e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(g) ? r.bindArg = t.getRawAttribute(
2281
2489
  g
2282
2490
  ) : t.hasAttribute(u) && (r.bindArg = t.getRawAttribute(u));
2283
- const b = e ? d.attrName(e, "bind-params") : d.attrName(null, "bind-params", !0);
2491
+ const b = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2284
2492
  if (t.hasAttribute(b)) {
2285
2493
  const l = t.getRawAttribute(b);
2286
- r.bindParams = l.split("&").map((f) => f.trim());
2494
+ r.bindParams = l.split("&").map((d) => d.trim());
2287
2495
  }
2288
2496
  if (e) {
2289
- if (t.hasAttribute(d.attrName(e, "adjust"))) {
2290
- const f = t.getRawAttribute(
2291
- d.attrName(e, "adjust")
2497
+ if (t.hasAttribute(c.attrName(e, "adjust"))) {
2498
+ const d = t.getRawAttribute(
2499
+ c.attrName(e, "adjust")
2292
2500
  );
2293
- if (f) {
2294
- const p = document.body.querySelectorAll(f);
2295
- p.length > 0 ? (r.adjustFragments = [], p.forEach((w) => {
2296
- const v = A.get(w);
2297
- v && r.adjustFragments.push(v);
2298
- })) : h.error(
2501
+ if (d) {
2502
+ const p = document.body.querySelectorAll(d);
2503
+ p.length > 0 ? (r.adjustFragments = [], p.forEach((v) => {
2504
+ const w = A.get(v);
2505
+ w && r.adjustFragments.push(w);
2506
+ })) : f.error(
2299
2507
  "Haori",
2300
- `Adjust element not found: ${f} (${d.attrName(e, "adjust")})`
2508
+ `Adjust element not found: ${d} (${c.attrName(e, "adjust")})`
2301
2509
  );
2302
2510
  }
2303
- if (t.hasAttribute(d.attrName(e, "adjust-value"))) {
2511
+ if (t.hasAttribute(c.attrName(e, "adjust-value"))) {
2304
2512
  const p = t.getRawAttribute(
2305
- d.attrName(e, "adjust-value")
2306
- ), w = Number(p);
2307
- isNaN(w) || (r.adjustValue = w);
2513
+ c.attrName(e, "adjust-value")
2514
+ ), v = Number(p);
2515
+ isNaN(v) || (r.adjustValue = v);
2308
2516
  }
2309
2517
  }
2310
- if (t.hasAttribute(d.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(d.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(d.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(d.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${c.prefix}${e}-after-run`)) {
2311
- const f = t.getRawAttribute(
2312
- `${c.prefix}${e}-after-run`
2518
+ 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(`${h.prefix}${e}-after-run`)) {
2519
+ const d = t.getRawAttribute(
2520
+ `${h.prefix}${e}-after-run`
2313
2521
  );
2314
2522
  try {
2315
2523
  r.afterCallback = new Function(
2316
2524
  "response",
2317
2525
  `
2318
2526
  "use strict";
2319
- ${f}
2527
+ ${d}
2320
2528
  `
2321
2529
  );
2322
2530
  } catch (p) {
2323
- h.error("Haori", `Invalid after script: ${p}`);
2531
+ f.error("Haori", `Invalid after script: ${p}`);
2324
2532
  }
2325
2533
  }
2326
- t.hasAttribute(d.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2327
- d.attrName(e, "dialog")
2328
- )), t.hasAttribute(d.attrName(e, "toast")) && (r.toastMessage = t.getAttribute(
2329
- d.attrName(e, "toast")
2330
- )), t.hasAttribute(d.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2331
- d.attrName(e, "redirect")
2534
+ t.hasAttribute(c.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2535
+ c.attrName(e, "dialog")
2536
+ )), t.hasAttribute(c.attrName(e, "toast")) && (r.toastMessage = t.getAttribute(
2537
+ c.attrName(e, "toast")
2538
+ )), t.hasAttribute(c.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2539
+ c.attrName(e, "redirect")
2332
2540
  )), [
2333
2541
  "reset",
2334
2542
  "refetch",
2335
2543
  "click",
2336
2544
  "open",
2337
2545
  "close"
2338
- ].forEach((f) => {
2339
- const p = d.attrName(e, f);
2546
+ ].forEach((d) => {
2547
+ const p = c.attrName(e, d);
2340
2548
  if (!t.hasAttribute(p))
2341
2549
  return;
2342
- const w = t.getRawAttribute(p), v = [];
2343
- if (w ? (document.body.querySelectorAll(w).forEach((x) => {
2344
- const F = A.get(x);
2345
- F && v.push(F);
2346
- }), v.length === 0 && h.error("Haori", `Element not found: ${w} (${p})`)) : v.push(t), v.length > 0)
2347
- switch (f) {
2550
+ const v = t.getRawAttribute(p), w = [];
2551
+ if (v ? (document.body.querySelectorAll(v).forEach((S) => {
2552
+ const F = A.get(S);
2553
+ F && w.push(F);
2554
+ }), w.length === 0 && f.error("Haori", `Element not found: ${v} (${p})`)) : w.push(t), w.length > 0)
2555
+ switch (d) {
2348
2556
  case "reset":
2349
- r.resetFragments = v;
2557
+ r.resetFragments = w;
2350
2558
  break;
2351
2559
  case "refetch":
2352
- r.refetchFragments = v;
2560
+ r.refetchFragments = w;
2353
2561
  break;
2354
2562
  case "click":
2355
- r.clickFragments = v;
2563
+ r.clickFragments = w;
2356
2564
  break;
2357
2565
  case "open":
2358
- r.openFragments = v;
2566
+ r.openFragments = w;
2359
2567
  break;
2360
2568
  case "close":
2361
- r.closeFragments = v;
2569
+ r.closeFragments = w;
2362
2570
  break;
2363
2571
  }
2364
2572
  });
2365
2573
  }
2366
- if (!e) {
2367
- if (t.hasAttribute(d.attrName(null, "data", !0))) {
2368
- const l = t.getRawAttribute(
2369
- d.attrName(null, "data", !0)
2370
- );
2371
- r.data = N.parseDataBind(l);
2372
- }
2373
- if (t.hasAttribute(d.attrName(null, "form", !0))) {
2374
- const l = t.getRawAttribute(
2375
- d.attrName(null, "form", !0)
2574
+ if (!e && (t.hasAttribute(c.attrName(null, "data", !0)) && (r.data = c.resolveDataAttribute(
2575
+ t,
2576
+ c.attrName(null, "data", !0)
2577
+ )), t.hasAttribute(c.attrName(null, "form", !0)))) {
2578
+ const l = t.getRawAttribute(
2579
+ c.attrName(null, "form", !0)
2580
+ );
2581
+ if (l) {
2582
+ const d = document.body.querySelector(l);
2583
+ d !== null ? r.formFragment = E.getFormFragment(
2584
+ A.get(d)
2585
+ ) : f.error(
2586
+ "Haori",
2587
+ `Form element not found: ${l} (${c.attrName(null, "fetch-form", !0)})`
2376
2588
  );
2377
- if (l) {
2378
- const f = document.body.querySelector(l);
2379
- f !== null ? r.formFragment = y.getFormFragment(
2380
- A.get(f)
2381
- ) : h.error(
2382
- "Haori",
2383
- `Form element not found: ${l} (${d.attrName(null, "fetch-form", !0)})`
2384
- );
2385
- } else
2386
- r.formFragment = y.getFormFragment(t);
2387
- }
2589
+ } else
2590
+ r.formFragment = E.getFormFragment(t);
2388
2591
  }
2389
2592
  return s && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
2390
2593
  }
@@ -2407,7 +2610,7 @@ ${f}
2407
2610
  * @param arg2 イベント名
2408
2611
  */
2409
2612
  constructor(t, e = null) {
2410
- d.isElementFragment(t) ? this.options = d.buildOptions(t, e) : this.options = t;
2613
+ c.isElementFragment(t) ? this.options = c.buildOptions(t, e) : this.options = t;
2411
2614
  }
2412
2615
  /**
2413
2616
  * 一連の処理を実行します。オプションが空の場合は即座にresolveされます。
@@ -2420,33 +2623,33 @@ ${f}
2420
2623
  return Promise.resolve();
2421
2624
  let e = this.options.fetchUrl, r = this.options.fetchOptions;
2422
2625
  if (this.options.beforeCallback) {
2423
- const n = this.options.beforeCallback(
2626
+ const i = this.options.beforeCallback(
2424
2627
  e || null,
2425
2628
  r || null
2426
2629
  );
2427
- if (n != null) {
2428
- if (n === !1 || typeof n == "object" && n.stop)
2630
+ if (i != null) {
2631
+ if (i === !1 || typeof i == "object" && i.stop)
2429
2632
  return Promise.resolve();
2430
- typeof n == "object" && (e = "fetchUrl" in n ? n.fetchUrl : e, r = "fetchOptions" in n ? n.fetchOptions : r);
2633
+ typeof i == "object" && (e = "fetchUrl" in i ? i.fetchUrl : e, r = "fetchOptions" in i ? i.fetchOptions : r);
2431
2634
  }
2432
2635
  }
2433
- const i = {};
2636
+ const n = {};
2434
2637
  if (this.options.formFragment) {
2435
- const n = y.getValues(this.options.formFragment);
2436
- Object.assign(i, n);
2638
+ const i = E.getValues(this.options.formFragment);
2639
+ Object.assign(n, i);
2437
2640
  }
2438
- this.options.data && typeof this.options.data == "object" && Object.assign(i, this.options.data);
2439
- const s = Object.keys(i).length > 0;
2641
+ this.options.data && typeof this.options.data == "object" && Object.assign(n, this.options.data);
2642
+ const s = Object.keys(n).length > 0;
2440
2643
  if (e) {
2441
- const n = { ...r || {} }, a = new Headers(
2442
- n.headers || void 0
2443
- ), o = (n.method || "GET").toUpperCase();
2644
+ const i = { ...r || {} }, a = new Headers(
2645
+ i.headers || void 0
2646
+ ), o = (i.method || "GET").toUpperCase();
2444
2647
  if (o === "GET" || o === "HEAD" || o === "OPTIONS") {
2445
2648
  if (s) {
2446
2649
  const g = new URL(e, window.location.href), u = new URLSearchParams(g.search);
2447
- for (const [b, l] of Object.entries(i))
2448
- l !== void 0 && (l === null ? u.append(b, "") : Array.isArray(l) ? l.forEach((f) => {
2449
- u.append(b, String(f));
2650
+ for (const [b, l] of Object.entries(n))
2651
+ l !== void 0 && (l === null ? u.append(b, "") : Array.isArray(l) ? l.forEach((d) => {
2652
+ u.append(b, String(d));
2450
2653
  }) : typeof l == "object" || typeof l == "function" ? u.append(b, JSON.stringify(l)) : u.append(b, String(l)));
2451
2654
  g.search = u.toString(), e = g.toString();
2452
2655
  }
@@ -2455,47 +2658,47 @@ ${f}
2455
2658
  if (/multipart\/form-data/i.test(g)) {
2456
2659
  a.delete("Content-Type");
2457
2660
  const u = new FormData();
2458
- for (const [b, l] of Object.entries(i))
2459
- l == null ? u.append(b, "") : l instanceof Blob ? u.append(b, l) : Array.isArray(l) ? l.forEach((f) => u.append(b, String(f))) : typeof l == "object" ? u.append(b, JSON.stringify(l)) : u.append(b, String(l));
2460
- n.body = u;
2661
+ for (const [b, l] of Object.entries(n))
2662
+ l == null ? u.append(b, "") : l instanceof Blob ? u.append(b, l) : Array.isArray(l) ? l.forEach((d) => u.append(b, String(d))) : typeof l == "object" ? u.append(b, JSON.stringify(l)) : u.append(b, String(l));
2663
+ i.body = u;
2461
2664
  } else if (/application\/x-www-form-urlencoded/i.test(g)) {
2462
2665
  const u = new URLSearchParams();
2463
- for (const [b, l] of Object.entries(i))
2464
- l !== void 0 && (l === null ? u.append(b, "") : Array.isArray(l) ? l.forEach((f) => u.append(b, String(f))) : typeof l == "object" ? u.append(b, JSON.stringify(l)) : u.append(b, String(l)));
2465
- n.body = u;
2666
+ for (const [b, l] of Object.entries(n))
2667
+ l !== void 0 && (l === null ? u.append(b, "") : Array.isArray(l) ? l.forEach((d) => u.append(b, String(d))) : typeof l == "object" ? u.append(b, JSON.stringify(l)) : u.append(b, String(l)));
2668
+ i.body = u;
2466
2669
  } else
2467
- a.set("Content-Type", "application/json"), n.body = JSON.stringify(i);
2670
+ a.set("Content-Type", "application/json"), i.body = JSON.stringify(n);
2468
2671
  }
2469
- if (n.headers = a, this.options.targetFragment && e) {
2672
+ if (i.headers = a, this.options.targetFragment && e) {
2470
2673
  const g = performance.now();
2471
- return E.fetchStart(
2674
+ return y.fetchStart(
2472
2675
  this.options.targetFragment.getTarget(),
2473
2676
  e,
2474
- n,
2475
- s ? i : void 0
2476
- ), fetch(e, n).then((u) => this.handleFetchResult(
2677
+ i,
2678
+ s ? n : void 0
2679
+ ), fetch(e, i).then((u) => this.handleFetchResult(
2477
2680
  u,
2478
2681
  e || void 0,
2479
2682
  g
2480
2683
  )).catch((u) => {
2481
- throw e && E.fetchError(
2684
+ throw e && y.fetchError(
2482
2685
  this.options.targetFragment.getTarget(),
2483
2686
  e,
2484
2687
  u
2485
2688
  ), u;
2486
2689
  });
2487
- } else return e ? fetch(e, n).then((g) => this.handleFetchResult(g, e || void 0)) : Promise.resolve();
2690
+ } else return e ? fetch(e, i).then((g) => this.handleFetchResult(g, e || void 0)) : Promise.resolve();
2488
2691
  } else {
2489
2692
  if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && s) {
2490
2693
  const o = this.options.formFragment, g = o.getTarget();
2491
2694
  g.setAttribute(
2492
- `${c.prefix}bind`,
2493
- JSON.stringify(i)
2695
+ `${h.prefix}bind`,
2696
+ JSON.stringify(n)
2494
2697
  );
2495
2698
  const u = o.getBindingData();
2496
- return Object.assign(u, i), N.setBindingData(g, u);
2699
+ return Object.assign(u, n), T.setBindingData(g, u);
2497
2700
  }
2498
- const n = s ? i : {}, a = new Response(JSON.stringify(n), {
2701
+ const i = s ? n : {}, a = new Response(JSON.stringify(i), {
2499
2702
  headers: { "Content-Type": "application/json" }
2500
2703
  });
2501
2704
  return this.handleFetchResult(a);
@@ -2506,77 +2709,78 @@ ${f}
2506
2709
  * フェッチ後の処理を実行します。
2507
2710
  */
2508
2711
  handleFetchResult(t, e, r) {
2712
+ const n = K();
2509
2713
  if (!t.ok)
2510
- return this.options.targetFragment && e && E.fetchError(
2714
+ return this.options.targetFragment && e && y.fetchError(
2511
2715
  this.options.targetFragment.getTarget(),
2512
2716
  e,
2513
2717
  new Error(`${t.status} ${t.statusText}`),
2514
2718
  t.status,
2515
2719
  r
2516
2720
  ), this.handleFetchError(t);
2517
- if (this.options.targetFragment && e && r && E.fetchEnd(
2721
+ if (this.options.targetFragment && e && r && y.fetchEnd(
2518
2722
  this.options.targetFragment.getTarget(),
2519
2723
  e,
2520
2724
  t.status,
2521
2725
  r
2522
2726
  ), this.options.afterCallback) {
2523
- const s = this.options.afterCallback(t);
2524
- if (s != null) {
2525
- if (s === !1 || typeof s == "object" && s.stop)
2727
+ const i = this.options.afterCallback(t);
2728
+ if (i != null) {
2729
+ if (i === !1 || typeof i == "object" && i.stop)
2526
2730
  return Promise.resolve();
2527
- typeof s == "object" && "response" in s && (t = "response" in s ? s.response : t);
2731
+ typeof i == "object" && "response" in i && (t = "response" in i ? i.response : t);
2528
2732
  }
2529
2733
  }
2530
- const i = [];
2531
- return i.push(this.bindResult(t)), i.push(this.adjust()), i.push(this.addRow()), i.push(this.removeRow()), i.push(this.movePrevRow()), i.push(this.moveNextRow()), this.options.resetFragments && this.options.resetFragments.length > 0 && this.options.resetFragments.forEach((s) => {
2532
- i.push(y.reset(s));
2533
- }), this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((s) => {
2534
- i.push(new d(s, null).run());
2535
- }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((s) => {
2536
- const n = s.getTarget();
2537
- typeof n.click == "function" ? n.click() : n.dispatchEvent(
2734
+ const s = [];
2735
+ return s.push(this.bindResult(t)), s.push(this.adjust()), s.push(this.addRow()), s.push(this.removeRow()), s.push(this.movePrevRow()), s.push(this.moveNextRow()), this.options.resetFragments && this.options.resetFragments.length > 0 && this.options.resetFragments.forEach((i) => {
2736
+ s.push(E.reset(i));
2737
+ }), this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((i) => {
2738
+ s.push(new c(i, null).run());
2739
+ }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((i) => {
2740
+ const a = i.getTarget();
2741
+ typeof a.click == "function" ? a.click() : a.dispatchEvent(
2538
2742
  new MouseEvent("click", { bubbles: !0, cancelable: !0 })
2539
2743
  );
2540
- }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((s) => {
2541
- const n = s.getTarget();
2542
- n instanceof HTMLDialogElement ? i.push(M.openDialog(n)) : h.error("Haori", "Element is not a dialog: ", n);
2543
- }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((s) => {
2544
- const n = s.getTarget();
2545
- n instanceof HTMLDialogElement ? i.push(M.closeDialog(n)) : h.error("Haori", "Element is not a dialog: ", n);
2546
- }), Promise.all(i).then(() => this.options.dialogMessage ? M.dialog(this.options.dialogMessage) : Promise.resolve()).then(() => this.options.toastMessage ? M.toast(this.options.toastMessage, "info") : Promise.resolve()).then(() => (this.options.redirectUrl && (window.location.href = this.options.redirectUrl), Promise.resolve()));
2744
+ }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((i) => {
2745
+ const a = i.getTarget();
2746
+ a instanceof HTMLElement ? s.push(n.openDialog(a)) : f.error("Haori", "Element is not an HTML element: ", a);
2747
+ }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((i) => {
2748
+ const a = i.getTarget();
2749
+ a instanceof HTMLElement ? s.push(n.closeDialog(a)) : f.error("Haori", "Element is not an HTML element: ", a);
2750
+ }), Promise.all(s).then(() => this.options.dialogMessage ? n.dialog(this.options.dialogMessage) : Promise.resolve()).then(() => this.options.toastMessage ? n.toast(this.options.toastMessage, "info") : Promise.resolve()).then(() => (this.options.redirectUrl && (window.location.href = this.options.redirectUrl), Promise.resolve()));
2547
2751
  }
2548
2752
  /**
2549
2753
  * フェッチエラー応答のメッセージを適切な要素へ伝播します。
2550
2754
  */
2551
2755
  async handleFetchError(t) {
2552
2756
  let e = null;
2553
- this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = y.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
2757
+ this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = E.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
2554
2758
  const r = async (s) => {
2555
- const n = e ? e.getTarget() : document.body;
2556
- await M.addErrorMessage(n, s);
2759
+ const i = e ? e.getTarget() : document.body;
2760
+ await K().addErrorMessage(i, s);
2557
2761
  };
2558
2762
  if ((t.headers.get("Content-Type") || "").includes("application/json"))
2559
2763
  try {
2560
- const s = await t.json(), n = [];
2764
+ const s = await t.json(), i = [];
2561
2765
  if (s && typeof s == "object") {
2562
- if (typeof s.message == "string" && n.push({ message: s.message }), Array.isArray(s.messages))
2766
+ if (typeof s.message == "string" && i.push({ message: s.message }), Array.isArray(s.messages))
2563
2767
  for (const a of s.messages)
2564
- typeof a == "string" && n.push({ message: a });
2768
+ typeof a == "string" && i.push({ message: a });
2565
2769
  if (s.errors && typeof s.errors == "object")
2566
2770
  for (const [a, o] of Object.entries(s.errors))
2567
- Array.isArray(o) ? n.push({ key: a, message: o.join(`
2568
- `) }) : typeof o == "string" ? n.push({ key: a, message: o }) : o != null && n.push({ key: a, message: String(o) });
2569
- if (n.length === 0)
2771
+ Array.isArray(o) ? i.push({ key: a, message: o.join(`
2772
+ `) }) : typeof o == "string" ? i.push({ key: a, message: o }) : o != null && i.push({ key: a, message: String(o) });
2773
+ if (i.length === 0)
2570
2774
  for (const [a, o] of Object.entries(s))
2571
- a === "message" || a === "messages" || a === "errors" || (Array.isArray(o) ? n.push({ key: a, message: o.join(`
2572
- `) }) : typeof o == "string" && n.push({ key: a, message: o }));
2775
+ a === "message" || a === "messages" || a === "errors" || (Array.isArray(o) ? i.push({ key: a, message: o.join(`
2776
+ `) }) : typeof o == "string" && i.push({ key: a, message: o }));
2573
2777
  }
2574
- if (n.length === 0) {
2778
+ if (i.length === 0) {
2575
2779
  await r(`${t.status} ${t.statusText}`);
2576
2780
  return;
2577
2781
  }
2578
- for (const a of n)
2579
- a.key && e ? await y.addErrorMessage(e, a.key, a.message) : await r(a.message);
2782
+ for (const a of i)
2783
+ a.key && e ? await E.addErrorMessage(e, a.key, a.message) : await r(a.message);
2580
2784
  return;
2581
2785
  } catch {
2582
2786
  }
@@ -2599,8 +2803,8 @@ ${f}
2599
2803
  return !0;
2600
2804
  const e = t.getTarget();
2601
2805
  let r = this.validateOne(t);
2602
- return r || e.focus(), t.getChildElementFragments().reverse().forEach((i) => {
2603
- r &&= this.validate(i);
2806
+ return r || e.focus(), t.getChildElementFragments().reverse().forEach((n) => {
2807
+ r &&= this.validate(n);
2604
2808
  }), r;
2605
2809
  }
2606
2810
  /**
@@ -2621,7 +2825,7 @@ ${f}
2621
2825
  */
2622
2826
  confirm() {
2623
2827
  const t = this.options.confirmMessage;
2624
- return t == null ? Promise.resolve(!0) : M.confirm(t);
2828
+ return t == null ? Promise.resolve(!0) : K().confirm(t);
2625
2829
  }
2626
2830
  /**
2627
2831
  * 結果データを対象のフラグメントにバインドします。
@@ -2632,31 +2836,31 @@ ${f}
2632
2836
  return !this.options.bindFragments || this.options.bindFragments.length === 0 ? Promise.resolve() : (t.headers.get("Content-Type")?.includes("application/json") ? t.json() : t.text()).then((r) => {
2633
2837
  if (this.options.bindParams) {
2634
2838
  const s = {};
2635
- this.options.bindParams.forEach((n) => {
2636
- r && typeof r == "object" && n in r && (s[n] = r[n]);
2839
+ this.options.bindParams.forEach((i) => {
2840
+ r && typeof r == "object" && i in r && (s[i] = r[i]);
2637
2841
  }), r = s;
2638
2842
  }
2639
- const i = [];
2843
+ const n = [];
2640
2844
  if (this.options.bindArg)
2641
2845
  this.options.bindFragments.forEach((s) => {
2642
- const n = s.getBindingData();
2643
- n[this.options.bindArg] = r, i.push(N.setBindingData(s.getTarget(), n));
2846
+ const i = s.getBindingData();
2847
+ i[this.options.bindArg] = r, n.push(T.setBindingData(s.getTarget(), i));
2644
2848
  });
2645
2849
  else {
2646
2850
  if (typeof r == "string")
2647
- return h.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
2851
+ return f.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
2648
2852
  new Error("string data cannot be bound without a bindArg.")
2649
2853
  );
2650
2854
  this.options.bindFragments.forEach((s) => {
2651
- i.push(
2652
- N.setBindingData(
2855
+ n.push(
2856
+ T.setBindingData(
2653
2857
  s.getTarget(),
2654
2858
  r
2655
2859
  )
2656
2860
  );
2657
2861
  });
2658
2862
  }
2659
- return Promise.all(i).then(() => {
2863
+ return Promise.all(n).then(() => {
2660
2864
  });
2661
2865
  });
2662
2866
  }
@@ -2668,9 +2872,9 @@ ${f}
2668
2872
  return Promise.resolve();
2669
2873
  const t = this.options.adjustValue ?? 0, e = [];
2670
2874
  for (const r of this.options.adjustFragments) {
2671
- let i = r.getValue();
2672
- (i == null || i === "") && (i = "0");
2673
- let s = Number(i);
2875
+ let n = r.getValue();
2876
+ (n == null || n === "") && (n = "0");
2877
+ let s = Number(n);
2674
2878
  isNaN(s) && (s = 0), s += t, e.push(r.setValue(String(s)));
2675
2879
  }
2676
2880
  return Promise.all(e).then(() => {
@@ -2683,11 +2887,11 @@ ${f}
2683
2887
  */
2684
2888
  getRowFragment() {
2685
2889
  if (!this.options.targetFragment)
2686
- return h.error("Haori", "Target fragment is not specified for row operation."), null;
2890
+ return f.error("Haori", "Target fragment is not specified for row operation."), null;
2687
2891
  const t = this.options.targetFragment.closestByAttribute(
2688
- `${c.prefix}row`
2892
+ `${h.prefix}row`
2689
2893
  );
2690
- return t || (h.error("Haori", "Row fragment not found."), null);
2894
+ return t || (f.error("Haori", "Row fragment not found."), null);
2691
2895
  }
2692
2896
  /**
2693
2897
  * 行を追加します。
@@ -2703,7 +2907,7 @@ ${f}
2703
2907
  const e = [], r = t.clone();
2704
2908
  return e.push(
2705
2909
  t.getParent().insertAfter(r, t)
2706
- ), e.push(N.evaluateAll(r)), e.push(y.reset(r)), Promise.all(e).then(() => {
2910
+ ), e.push(T.evaluateAll(r)), e.push(E.reset(r)), Promise.all(e).then(() => {
2707
2911
  });
2708
2912
  }
2709
2913
  /**
@@ -2718,7 +2922,7 @@ ${f}
2718
2922
  if (!t)
2719
2923
  return Promise.reject(new Error("Row fragment not found."));
2720
2924
  const e = t.getParent();
2721
- return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${c.prefix}each-before`) && !i.hasAttribute(`${c.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
2925
+ return e && e.getChildElementFragments().filter((n) => !n.hasAttribute(`${h.prefix}each-before`) && !n.hasAttribute(`${h.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
2722
2926
  }
2723
2927
  /**
2724
2928
  * 前の行へ移動します。
@@ -2754,8 +2958,10 @@ ${f}
2754
2958
  const r = t.getParent();
2755
2959
  return r ? r.insertAfter(t, e) : Promise.resolve();
2756
2960
  }
2757
- }
2758
- class X {
2961
+ };
2962
+ c.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, c.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
2963
+ let j = c;
2964
+ class _ {
2759
2965
  /**
2760
2966
  * URLのクエリパラメータを取得します。
2761
2967
  *
@@ -2763,12 +2969,12 @@ class X {
2763
2969
  */
2764
2970
  static readParams() {
2765
2971
  const t = {}, e = window.location.search;
2766
- return new URLSearchParams(e).forEach((i, s) => {
2767
- t[s] = i;
2972
+ return new URLSearchParams(e).forEach((n, s) => {
2973
+ t[s] = n;
2768
2974
  }), t;
2769
2975
  }
2770
2976
  }
2771
- class J {
2977
+ class tt {
2772
2978
  /**
2773
2979
  * 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
2774
2980
  *
@@ -2786,23 +2992,23 @@ class J {
2786
2992
  try {
2787
2993
  r = await fetch(t, e);
2788
2994
  } catch (s) {
2789
- throw h.error("[Haori]", "Failed to fetch import source:", t, s), new Error(`Failed to fetch: ${t}`);
2995
+ throw f.error("[Haori]", "Failed to fetch import source:", t, s), new Error(`Failed to fetch: ${t}`);
2790
2996
  }
2791
2997
  if (!r.ok) {
2792
2998
  const s = `${r.status} ${r.statusText}`;
2793
- throw h.error("[Haori]", "Import HTTP error:", t, s), new Error(`Failed to load ${t}: ${s}`);
2999
+ throw f.error("[Haori]", "Import HTTP error:", t, s), new Error(`Failed to load ${t}: ${s}`);
2794
3000
  }
2795
- let i;
3001
+ let n;
2796
3002
  try {
2797
- i = await r.text();
3003
+ n = await r.text();
2798
3004
  } catch (s) {
2799
- throw h.error("[Haori]", "Failed to read response text:", t, s), new Error(`Failed to read response from: ${t}`);
3005
+ throw f.error("[Haori]", "Failed to read response text:", t, s), new Error(`Failed to read response from: ${t}`);
2800
3006
  }
2801
3007
  try {
2802
- const n = new DOMParser().parseFromString(i, "text/html");
2803
- return n && n.body ? n.body.innerHTML : (h.warn("[Haori]", "No body found in imported document:", t), i);
3008
+ const i = new DOMParser().parseFromString(n, "text/html");
3009
+ return i && i.body ? i.body.innerHTML : (f.warn("[Haori]", "No body found in imported document:", t), n);
2804
3010
  } catch (s) {
2805
- return h.error("[Haori]", "Failed to parse imported HTML:", t, s), i;
3011
+ return f.error("[Haori]", "Failed to parse imported HTML:", t, s), n;
2806
3012
  }
2807
3013
  }
2808
3014
  }
@@ -2815,7 +3021,7 @@ const m = class m {
2815
3021
  */
2816
3022
  static isDeferredAttributeName(t) {
2817
3023
  return m.DEFERRED_ATTRIBUTE_SUFFIXES.some(
2818
- (e) => t === `${c.prefix}${e}`
3024
+ (e) => t === `${h.prefix}${e}`
2819
3025
  );
2820
3026
  }
2821
3027
  /**
@@ -2829,35 +3035,35 @@ const m = class m {
2829
3035
  if (!e)
2830
3036
  return Promise.resolve();
2831
3037
  t.parentNode && (A.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
2832
- const r = [], i = /* @__PURE__ */ new Set();
3038
+ const r = [], n = /* @__PURE__ */ new Set();
2833
3039
  for (const s of m.PRIORITY_ATTRIBUTE_SUFFIXES) {
2834
- const n = c.prefix + s;
2835
- e.hasAttribute(n) && (r.push(
3040
+ const i = h.prefix + s;
3041
+ e.hasAttribute(i) && (r.push(
2836
3042
  m.setAttribute(
2837
3043
  e.getTarget(),
2838
- n,
2839
- e.getRawAttribute(n)
3044
+ i,
3045
+ e.getRawAttribute(i)
2840
3046
  )
2841
- ), i.add(n));
3047
+ ), n.add(i));
2842
3048
  }
2843
3049
  for (const s of e.getAttributeNames()) {
2844
- if (i.has(s) || m.isDeferredAttributeName(s))
3050
+ if (n.has(s) || m.isDeferredAttributeName(s))
2845
3051
  continue;
2846
- const n = e.getRawAttribute(s);
2847
- n !== null && r.push(m.setAttribute(e.getTarget(), s, n));
3052
+ const i = e.getRawAttribute(s);
3053
+ i !== null && r.push(m.setAttribute(e.getTarget(), s, i));
2848
3054
  }
2849
3055
  for (const s of m.DEFERRED_ATTRIBUTE_SUFFIXES) {
2850
- const n = c.prefix + s;
2851
- e.hasAttribute(n) && (r.push(
3056
+ const i = h.prefix + s;
3057
+ e.hasAttribute(i) && (r.push(
2852
3058
  m.setAttribute(
2853
3059
  e.getTarget(),
2854
- n,
2855
- e.getRawAttribute(n)
3060
+ i,
3061
+ e.getRawAttribute(i)
2856
3062
  )
2857
- ), i.add(n));
3063
+ ), n.add(i));
2858
3064
  }
2859
3065
  return e.getChildren().forEach((s) => {
2860
- s instanceof S ? r.push(m.scan(s.getTarget())) : s instanceof j && r.push(m.evaluateText(s));
3066
+ s instanceof x ? r.push(m.scan(s.getTarget())) : s instanceof I && r.push(m.evaluateText(s));
2861
3067
  }), Promise.all(r).then(() => {
2862
3068
  });
2863
3069
  }
@@ -2871,51 +3077,51 @@ const m = class m {
2871
3077
  * @returns Promise (DOM操作が完了したときに解決される)
2872
3078
  */
2873
3079
  static setAttribute(t, e, r) {
2874
- const i = A.get(t), s = [];
3080
+ const n = A.get(t), s = [];
2875
3081
  switch (e) {
2876
- case `${c.prefix}bind`: {
2877
- r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(m.parseDataBind(r));
3082
+ case `${h.prefix}bind`: {
3083
+ r === null ? (n.clearBindingDataCache(), n.setBindingData({})) : n.setBindingData(m.parseDataBind(r));
2878
3084
  break;
2879
3085
  }
2880
- case `${c.prefix}if`:
2881
- s.push(m.evaluateIf(i));
3086
+ case `${h.prefix}if`:
3087
+ s.push(m.evaluateIf(n));
2882
3088
  break;
2883
- case `${c.prefix}each`:
2884
- s.push(m.evaluateEach(i));
3089
+ case `${h.prefix}each`:
3090
+ s.push(m.evaluateEach(n));
2885
3091
  break;
2886
- case `${c.prefix}fetch`:
2887
- s.push(new d(i, null).run());
3092
+ case `${h.prefix}fetch`:
3093
+ s.push(new j(n, null).run());
2888
3094
  break;
2889
- case `${c.prefix}import`: {
3095
+ case `${h.prefix}import`: {
2890
3096
  if (typeof r == "string") {
2891
- const n = i.getTarget(), a = performance.now();
2892
- E.importStart(n, r), s.push(
2893
- J.load(r).then((o) => {
3097
+ const i = n.getTarget(), a = performance.now();
3098
+ y.importStart(i, r), s.push(
3099
+ tt.load(r).then((o) => {
2894
3100
  const g = new TextEncoder().encode(o).length;
2895
- return T.enqueue(() => {
2896
- n.innerHTML = o;
3101
+ return N.enqueue(() => {
3102
+ i.innerHTML = o;
2897
3103
  }).then(() => {
2898
- E.importEnd(n, r, g, a);
3104
+ y.importEnd(i, r, g, a);
2899
3105
  });
2900
3106
  }).catch((o) => {
2901
- E.importError(n, r, o), h.error("[Haori]", "Failed to import HTML:", r, o);
3107
+ y.importError(i, r, o), f.error("[Haori]", "Failed to import HTML:", r, o);
2902
3108
  })
2903
3109
  );
2904
3110
  }
2905
3111
  break;
2906
3112
  }
2907
- case `${c.prefix}url-param`: {
2908
- const n = i.getAttribute(`${c.prefix}url-arg`), a = X.readParams();
2909
- if (n === null)
3113
+ case `${h.prefix}url-param`: {
3114
+ const i = n.getAttribute(`${h.prefix}url-arg`), a = _.readParams();
3115
+ if (i === null)
2910
3116
  m.setBindingData(t, a);
2911
3117
  else {
2912
- const o = i.getRawBindingData() || {};
2913
- o[String(n)] = a, m.setBindingData(t, o);
3118
+ const o = n.getRawBindingData() || {};
3119
+ o[String(i)] = a, m.setBindingData(t, o);
2914
3120
  }
2915
3121
  break;
2916
3122
  }
2917
3123
  }
2918
- return r === null ? s.push(i.removeAttribute(e)) : s.push(i.setAttribute(e, r)), Promise.all(s).then(() => {
3124
+ return r === null ? s.push(n.removeAttribute(e)) : s.push(n.setAttribute(e, r)), Promise.all(s).then(() => {
2919
3125
  });
2920
3126
  }
2921
3127
  /**
@@ -2927,12 +3133,12 @@ const m = class m {
2927
3133
  * @returns Promise (DOM操作が完了したときに解決される)
2928
3134
  */
2929
3135
  static setBindingData(t, e) {
2930
- const r = A.get(t), i = r.getRawBindingData();
3136
+ const r = A.get(t), n = r.getRawBindingData();
2931
3137
  r.setBindingData(e);
2932
3138
  const s = [];
2933
3139
  return s.push(
2934
- r.setAttribute(`${c.prefix}bind`, JSON.stringify(e))
2935
- ), s.push(m.evaluateAll(r)), E.bindChange(t, i, e, "manual"), Promise.all(s).then(() => {
3140
+ r.setAttribute(`${h.prefix}bind`, JSON.stringify(e))
3141
+ ), s.push(m.evaluateAll(r)), y.bindChange(t, n, e, "manual"), Promise.all(s).then(() => {
2936
3142
  });
2937
3143
  }
2938
3144
  /**
@@ -2946,12 +3152,12 @@ const m = class m {
2946
3152
  try {
2947
3153
  return JSON.parse(t);
2948
3154
  } catch (e) {
2949
- return h.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3155
+ return f.error("[Haori]", "Invalid JSON in data-bind:", e), {};
2950
3156
  }
2951
3157
  else {
2952
3158
  const e = new URLSearchParams(t), r = {};
2953
- for (const [i, s] of e.entries())
2954
- r[i] !== void 0 ? Array.isArray(r[i]) ? r[i].push(s) : r[i] = [r[i], s] : r[i] = s;
3159
+ for (const [n, s] of e.entries())
3160
+ r[n] !== void 0 ? Array.isArray(r[n]) ? r[n].push(s) : r[n] = [r[n], s] : r[n] = s;
2955
3161
  return r;
2956
3162
  }
2957
3163
  }
@@ -2965,8 +3171,8 @@ const m = class m {
2965
3171
  const r = A.get(t);
2966
3172
  if (r.isSkipMutationNodes())
2967
3173
  return;
2968
- const i = A.get(e.nextSibling), s = A.get(e);
2969
- s && (r.insertBefore(s, i), s instanceof S ? m.scan(s.getTarget()) : s instanceof j && m.evaluateText(s));
3174
+ const n = A.get(e.nextSibling), s = A.get(e);
3175
+ s && (r.insertBefore(s, n), s instanceof x ? m.scan(s.getTarget()) : s instanceof I && m.evaluateText(s));
2970
3176
  }
2971
3177
  /**
2972
3178
  * ノードを親要素から削除します。
@@ -3004,15 +3210,15 @@ const m = class m {
3004
3210
  const r = A.get(t);
3005
3211
  if (r.getValue() === e)
3006
3212
  return Promise.resolve();
3007
- const i = [];
3008
- i.push(r.setValue(e));
3213
+ const n = [];
3214
+ n.push(r.setValue(e));
3009
3215
  const s = m.getFormFragment(r);
3010
3216
  if (s) {
3011
- const n = y.getValues(s), a = s.getAttribute(`${c.prefix}form-arg`);
3217
+ const i = E.getValues(s), a = s.getAttribute(`${h.prefix}form-arg`);
3012
3218
  let o;
3013
- a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(m.setBindingData(s.getTarget(), o));
3219
+ a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = i) : o = i, n.push(m.setBindingData(s.getTarget(), o));
3014
3220
  }
3015
- return Promise.all(i).then(() => {
3221
+ return Promise.all(n).then(() => {
3016
3222
  });
3017
3223
  }
3018
3224
  /**
@@ -3035,8 +3241,8 @@ const m = class m {
3035
3241
  */
3036
3242
  static evaluateAll(t) {
3037
3243
  const e = [];
3038
- return t.hasAttribute(`${c.prefix}if`) && e.push(m.evaluateIf(t)), t.hasAttribute(`${c.prefix}each`) && e.push(m.evaluateEach(t)), t.getChildren().forEach((r) => {
3039
- r instanceof S ? e.push(m.evaluateAll(r)) : r instanceof j && e.push(m.evaluateText(r));
3244
+ return t.hasAttribute(`${h.prefix}if`) && e.push(m.evaluateIf(t)), t.hasAttribute(`${h.prefix}each`) && e.push(m.evaluateEach(t)), t.getChildren().forEach((r) => {
3245
+ r instanceof x ? e.push(m.evaluateAll(r)) : r instanceof I && e.push(m.evaluateText(r));
3040
3246
  }), Promise.all(e).then(() => {
3041
3247
  });
3042
3248
  }
@@ -3057,14 +3263,14 @@ const m = class m {
3057
3263
  * @return Promise (DOM操作が完了したときに解決される)
3058
3264
  */
3059
3265
  static evaluateIf(t) {
3060
- const e = [], r = t.getAttribute(`${c.prefix}if`);
3266
+ const e = [], r = t.getAttribute(`${h.prefix}if`);
3061
3267
  return r === !1 || r === void 0 || r === null || Number.isNaN(r) ? t.isVisible() && e.push(
3062
3268
  t.hide().then(() => {
3063
- E.hide(t.getTarget());
3269
+ y.hide(t.getTarget());
3064
3270
  })
3065
3271
  ) : t.isVisible() || (e.push(
3066
3272
  t.show().then(() => {
3067
- E.show(t.getTarget());
3273
+ y.show(t.getTarget());
3068
3274
  })
3069
3275
  ), e.push(m.evaluateAll(t))), Promise.all(e).then(() => {
3070
3276
  });
@@ -3080,21 +3286,21 @@ const m = class m {
3080
3286
  return Promise.resolve();
3081
3287
  let e = t.getTemplate();
3082
3288
  if (e === null) {
3083
- let i = !1;
3084
- t.getChildren().forEach((n) => {
3085
- if (!i && n instanceof S) {
3086
- if (n.hasAttribute(`${c.prefix}each-before`) || n.hasAttribute(`${c.prefix}each-after`))
3289
+ let n = !1;
3290
+ t.getChildren().forEach((i) => {
3291
+ if (!n && i instanceof x) {
3292
+ if (i.hasAttribute(`${h.prefix}each-before`) || i.hasAttribute(`${h.prefix}each-after`))
3087
3293
  return;
3088
- e = n.clone(), t.setTemplate(e), i = !0, t.removeChild(n);
3089
- const a = n.getTarget();
3090
- a.parentNode && a.parentNode.removeChild(a), n.setMounted(!1);
3294
+ e = i.clone(), t.setTemplate(e), n = !0, t.removeChild(i);
3295
+ const a = i.getTarget();
3296
+ a.parentNode && a.parentNode.removeChild(a), i.setMounted(!1);
3091
3297
  }
3092
3298
  });
3093
- const s = t.getAttribute(`${c.prefix}each`);
3094
- return Array.isArray(s) ? this.updateDiff(t, s) : (h.error("[Haori]", "Invalid each attribute:", s), Promise.reject(new Error("Invalid each attribute.")));
3299
+ const s = t.getAttribute(`${h.prefix}each`);
3300
+ return Array.isArray(s) ? this.updateDiff(t, s) : (f.error("[Haori]", "Invalid each attribute:", s), Promise.reject(new Error("Invalid each attribute.")));
3095
3301
  }
3096
- const r = t.getAttribute(`${c.prefix}each`);
3097
- return Array.isArray(r) ? this.updateDiff(t, r) : (h.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3302
+ const r = t.getAttribute(`${h.prefix}each`);
3303
+ return Array.isArray(r) ? this.updateDiff(t, r) : (f.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3098
3304
  }
3099
3305
  /**
3100
3306
  * 差分を更新します。
@@ -3105,68 +3311,68 @@ const m = class m {
3105
3311
  static updateDiff(t, e) {
3106
3312
  const r = t.getTemplate();
3107
3313
  if (r === null)
3108
- return h.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3109
- let i = t.getAttribute(`${c.prefix}each-index`);
3110
- i && (i = String(i));
3111
- const s = t.getAttribute(`${c.prefix}each-key`), n = t.getAttribute(`${c.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3112
- e.forEach((p, w) => {
3113
- const v = m.createListKey(
3314
+ return f.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3315
+ let n = t.getAttribute(`${h.prefix}each-index`);
3316
+ n && (n = String(n));
3317
+ const s = t.getAttribute(`${h.prefix}each-key`), i = t.getAttribute(`${h.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3318
+ e.forEach((p, v) => {
3319
+ const w = m.createListKey(
3114
3320
  p,
3115
3321
  s ? String(s) : null,
3116
- w
3322
+ v
3117
3323
  );
3118
- o.push(v), a.set(v, { item: p, itemIndex: w });
3324
+ o.push(w), a.set(w, { item: p, itemIndex: v });
3119
3325
  });
3120
3326
  const g = [];
3121
- let u = t.getChildren().filter((p) => p instanceof S).filter(
3122
- (p) => !p.hasAttribute(`${c.prefix}each-before`) && !p.hasAttribute(`${c.prefix}each-after`)
3327
+ let u = t.getChildren().filter((p) => p instanceof x).filter(
3328
+ (p) => !p.hasAttribute(`${h.prefix}each-before`) && !p.hasAttribute(`${h.prefix}each-after`)
3123
3329
  );
3124
3330
  u = u.filter((p) => o.indexOf(String(p.getListKey())) === -1 ? (g.push(p.remove()), !1) : !0);
3125
- const b = u.map((p) => p.getListKey()), l = t.getChildren().filter((p) => p instanceof S).filter((p) => p.hasAttribute(`${c.prefix}each-before`)).length;
3126
- let f = Promise.resolve();
3127
- return o.forEach((p, w) => {
3128
- const v = b.indexOf(p), { item: B, itemIndex: x } = a.get(p);
3331
+ const b = u.map((p) => p.getListKey()), l = t.getChildren().filter((p) => p instanceof x).filter((p) => p.hasAttribute(`${h.prefix}each-before`)).length;
3332
+ let d = Promise.resolve();
3333
+ return o.forEach((p, v) => {
3334
+ const w = b.indexOf(p), { item: $, itemIndex: S } = a.get(p);
3129
3335
  let F;
3130
- if (v !== -1)
3131
- F = u[v], m.updateRowFragment(
3336
+ if (w !== -1)
3337
+ F = u[w], m.updateRowFragment(
3132
3338
  F,
3133
- B,
3134
- i,
3135
- x,
3136
- n ? String(n) : null,
3339
+ $,
3340
+ n,
3341
+ S,
3342
+ i ? String(i) : null,
3137
3343
  p
3138
- ), typeof F.clearBindingDataCache == "function" && F.clearBindingDataCache(), f = f.then(() => m.evaluateAll(F));
3344
+ ), typeof F.clearBindingDataCache == "function" && F.clearBindingDataCache(), d = d.then(() => m.evaluateAll(F));
3139
3345
  else {
3140
3346
  F = r.clone(), m.updateRowFragment(
3141
3347
  F,
3142
- B,
3143
- i,
3144
- x,
3145
- n ? String(n) : null,
3348
+ $,
3349
+ n,
3350
+ S,
3351
+ i ? String(i) : null,
3146
3352
  p
3147
3353
  ), typeof F.clearBindingDataCache == "function" && F.clearBindingDataCache();
3148
- const W = l + w;
3149
- f = f.then(
3354
+ const Y = l + v;
3355
+ d = d.then(
3150
3356
  () => t.insertBefore(
3151
3357
  F,
3152
- t.getChildren()[W] || null
3358
+ t.getChildren()[Y] || null
3153
3359
  ).then(() => m.evaluateAll(F))
3154
3360
  );
3155
3361
  }
3156
- }), Promise.all(g).then(() => f).then(() => {
3362
+ }), Promise.all(g).then(() => d).then(() => {
3157
3363
  const p = o.filter(
3158
- (x) => x !== null
3159
- ), w = b.filter(
3160
- (x) => x !== null
3161
- ), v = p.filter(
3162
- (x) => !w.includes(x)
3163
- ), B = w.filter(
3164
- (x) => !p.includes(x)
3364
+ (S) => S !== null
3365
+ ), v = b.filter(
3366
+ (S) => S !== null
3367
+ ), w = p.filter(
3368
+ (S) => !v.includes(S)
3369
+ ), $ = v.filter(
3370
+ (S) => !p.includes(S)
3165
3371
  );
3166
- E.eachUpdate(
3372
+ y.eachUpdate(
3167
3373
  t.getTarget(),
3168
- v,
3169
- B,
3374
+ w,
3375
+ $,
3170
3376
  p
3171
3377
  );
3172
3378
  });
@@ -3180,16 +3386,16 @@ const m = class m {
3180
3386
  * @returns リストキー
3181
3387
  */
3182
3388
  static createListKey(t, e, r) {
3183
- let i;
3389
+ let n;
3184
3390
  if (typeof t == "object" && t !== null)
3185
3391
  if (e) {
3186
3392
  const s = t[e];
3187
- s == null ? i = `__index_${r}` : typeof s == "object" ? i = JSON.stringify(s) : i = String(s);
3393
+ s == null ? n = `__index_${r}` : typeof s == "object" ? n = JSON.stringify(s) : n = String(s);
3188
3394
  } else
3189
- i = `__index_${r}`;
3395
+ n = `__index_${r}`;
3190
3396
  else
3191
- i = String(t);
3192
- return i;
3397
+ n = String(t);
3398
+ return n;
3193
3399
  }
3194
3400
  /**
3195
3401
  * 行フラグメントにデータを設定します。
@@ -3201,29 +3407,29 @@ const m = class m {
3201
3407
  * @param arg バインドデータパラメータ名
3202
3408
  * @param listKey リストキー
3203
3409
  */
3204
- static updateRowFragment(t, e, r, i, s, n) {
3410
+ static updateRowFragment(t, e, r, n, s, i) {
3205
3411
  let a = e;
3206
3412
  if (typeof e == "object" && e !== null)
3207
- a = { ...e }, r && (a[r] = i), s && (a = {
3413
+ a = { ...e }, r && (a[r] = n), s && (a = {
3208
3414
  [s]: a
3209
3415
  });
3210
3416
  else if (s)
3211
3417
  a = {
3212
3418
  [s]: e
3213
- }, r && (a[r] = i);
3419
+ }, r && (a[r] = n);
3214
3420
  else {
3215
- h.error(
3421
+ f.error(
3216
3422
  "[Haori]",
3217
- `Primitive value requires '${c.prefix}each-arg' attribute: ${e}`
3423
+ `Primitive value requires '${h.prefix}each-arg' attribute: ${e}`
3218
3424
  );
3219
3425
  return;
3220
3426
  }
3221
- t.setListKey(n), t.setAttribute(`${c.prefix}row`, n), t.setBindingData(a);
3427
+ t.setListKey(i), t.setAttribute(`${h.prefix}row`, i), t.setBindingData(a);
3222
3428
  }
3223
3429
  };
3224
3430
  m.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if", "each"], m.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch", "url-param"];
3225
- let N = m;
3226
- class z {
3431
+ let T = m;
3432
+ class et {
3227
3433
  /**
3228
3434
  * コンストラクタ。
3229
3435
  *
@@ -3232,7 +3438,7 @@ class z {
3232
3438
  constructor(t = document) {
3233
3439
  this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
3234
3440
  const e = document.documentElement, r = A.get(e);
3235
- r && new d(r, "load").run();
3441
+ r && new j(r, "load").run();
3236
3442
  }, this.root = t;
3237
3443
  }
3238
3444
  /**
@@ -3258,9 +3464,9 @@ class z {
3258
3464
  const r = this.getElementFromTarget(t.target);
3259
3465
  if (!r)
3260
3466
  return;
3261
- const i = A.get(r);
3262
- i && (e === "change" && i instanceof S && i.syncValue(), new d(i, e).run().catch((s) => {
3263
- h.error("[Haori]", "Procedure execution error:", s);
3467
+ const n = A.get(r);
3468
+ n && (e === "change" && n instanceof x && n.syncValue(), new j(n, e).run().catch((s) => {
3469
+ f.error("[Haori]", "Procedure execution error:", s);
3264
3470
  }));
3265
3471
  }
3266
3472
  /**
@@ -3283,10 +3489,10 @@ const C = class C {
3283
3489
  return;
3284
3490
  C._initialized = !0;
3285
3491
  const t = await Promise.allSettled([
3286
- N.scan(document.head),
3287
- N.scan(document.body)
3492
+ T.scan(document.head),
3493
+ T.scan(document.body)
3288
3494
  ]), [e, r] = t;
3289
- e.status !== "fulfilled" && h.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && h.error("[Haori]", "Failed to build body fragment:", r.reason), C.observe(document.head), C.observe(document.body), new z().start();
3495
+ 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), C.observe(document.head), C.observe(document.body), new et().start();
3290
3496
  }
3291
3497
  /**
3292
3498
  * 指定された要素を監視します。
@@ -3295,78 +3501,78 @@ const C = class C {
3295
3501
  */
3296
3502
  static observe(t) {
3297
3503
  new MutationObserver(async (r) => {
3298
- for (const i of r)
3504
+ for (const n of r)
3299
3505
  try {
3300
- switch (i.type) {
3506
+ switch (n.type) {
3301
3507
  case "attributes": {
3302
- h.info(
3508
+ f.info(
3303
3509
  "[Haori]",
3304
3510
  "Attribute changed:",
3305
- i.target,
3306
- i.attributeName
3511
+ n.target,
3512
+ n.attributeName
3307
3513
  );
3308
- const s = i.target;
3309
- N.setAttribute(
3514
+ const s = n.target;
3515
+ T.setAttribute(
3310
3516
  s,
3311
- i.attributeName,
3312
- s.getAttribute(i.attributeName)
3517
+ n.attributeName,
3518
+ s.getAttribute(n.attributeName)
3313
3519
  );
3314
3520
  break;
3315
3521
  }
3316
3522
  case "childList": {
3317
- h.info(
3523
+ f.info(
3318
3524
  "[Haori]",
3319
3525
  "Child list changed:",
3320
- Array.from(i.removedNodes).map((s) => s.nodeName),
3321
- Array.from(i.addedNodes).map((s) => s.nodeName)
3322
- ), Array.from(i.removedNodes).forEach((s) => {
3323
- N.removeNode(s);
3324
- }), Array.from(i.addedNodes).forEach((s) => {
3325
- s.parentElement instanceof HTMLElement && N.addNode(s.parentElement, s);
3526
+ Array.from(n.removedNodes).map((s) => s.nodeName),
3527
+ Array.from(n.addedNodes).map((s) => s.nodeName)
3528
+ ), Array.from(n.removedNodes).forEach((s) => {
3529
+ T.removeNode(s);
3530
+ }), Array.from(n.addedNodes).forEach((s) => {
3531
+ s.parentElement instanceof HTMLElement && T.addNode(s.parentElement, s);
3326
3532
  });
3327
3533
  break;
3328
3534
  }
3329
3535
  case "characterData": {
3330
- h.info(
3536
+ f.info(
3331
3537
  "[Haori]",
3332
3538
  "Character data changed:",
3333
- i.target,
3334
- i.target.textContent
3335
- ), i.target instanceof Text || i.target instanceof Comment ? N.changeText(i.target, i.target.textContent) : h.warn(
3539
+ n.target,
3540
+ n.target.textContent
3541
+ ), n.target instanceof Text || n.target instanceof Comment ? T.changeText(n.target, n.target.textContent) : f.warn(
3336
3542
  "[Haori]",
3337
3543
  "Unsupported character data type:",
3338
- i.target
3544
+ n.target
3339
3545
  );
3340
3546
  break;
3341
3547
  }
3342
3548
  default:
3343
- h.warn("[Haori]", "Unknown mutation type:", i.type);
3549
+ f.warn("[Haori]", "Unknown mutation type:", n.type);
3344
3550
  continue;
3345
3551
  }
3346
3552
  } catch (s) {
3347
- h.error("[Haori]", "Error processing mutation:", s);
3553
+ f.error("[Haori]", "Error processing mutation:", s);
3348
3554
  }
3349
3555
  }).observe(t, {
3350
3556
  childList: !0,
3351
3557
  subtree: !0,
3352
3558
  attributes: !0,
3353
3559
  characterData: !0
3354
- }), h.info("[Haori]", "Observer initialized for", t);
3560
+ }), f.info("[Haori]", "Observer initialized for", t);
3355
3561
  }
3356
3562
  };
3357
3563
  C._initialized = !1;
3358
3564
  let V = C;
3359
3565
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", V.init) : V.init();
3360
- const Q = "0.1.2";
3566
+ const rt = "0.1.4";
3361
3567
  export {
3362
- N as Core,
3363
- c as Env,
3364
- y as Form,
3568
+ T as Core,
3569
+ h as Env,
3570
+ E as Form,
3365
3571
  A as Fragment,
3366
- M as Haori,
3367
- h as Log,
3368
- T as Queue,
3369
- M as default,
3370
- Q as version
3572
+ X as Haori,
3573
+ f as Log,
3574
+ N as Queue,
3575
+ X as default,
3576
+ rt as version
3371
3577
  };
3372
3578
  //# sourceMappingURL=haori.es.js.map