haori-bootstrap 0.5.57 → 0.5.59

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.
@@ -1,37 +1,37 @@
1
- function ae(e) {
1
+ function ce(e) {
2
2
  return typeof e == "function";
3
3
  }
4
- function le(e) {
5
- return ae(e?.Modal) ? e?.Modal : void 0;
4
+ function de(e) {
5
+ return ce(e?.Modal) ? e?.Modal : void 0;
6
6
  }
7
- function ce(e) {
8
- return ae(e?.Toast) ? e?.Toast : void 0;
7
+ function ue(e) {
8
+ return ce(e?.Toast) ? e?.Toast : void 0;
9
9
  }
10
- function y(e) {
11
- return !!le(e);
10
+ function I(e) {
11
+ return !!de(e);
12
12
  }
13
- function Pe(e) {
14
- return !!ce(e);
13
+ function Ue(e) {
14
+ return !!ue(e);
15
15
  }
16
- function D(e, t, n) {
17
- const o = le(n);
16
+ function P(e, t, n) {
17
+ const o = de(n);
18
18
  if (o)
19
19
  return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, t) : new o(e, t);
20
20
  }
21
- function xe(e, t, n) {
22
- const o = ce(n);
21
+ function Fe(e, t, n) {
22
+ const o = ue(n);
23
23
  if (o)
24
24
  return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, t) : new o(e, t);
25
25
  }
26
- const Oe = "data-haori-dialog", qe = "data-haori-confirm", $e = "data-haori-dialog-title", de = "data-haori-dialog-ok", ue = "data-haori-confirm-ok", fe = "data-haori-confirm-cancel", Ue = "OK", Fe = "Cancel";
27
- let We = 0;
28
- function me() {
26
+ const We = "data-haori-dialog", ze = "data-haori-confirm", Ge = "data-haori-dialog-title", fe = "data-haori-dialog-ok", me = "data-haori-confirm-ok", be = "data-haori-confirm-cancel", Ke = "OK", Ve = "Cancel";
27
+ let je = 0;
28
+ function he() {
29
29
  return {
30
30
  backdrop: "static",
31
31
  keyboard: !1
32
32
  };
33
33
  }
34
- function be(e, t) {
34
+ function Ee(e, t) {
35
35
  if (t.dialogContainerSelector) {
36
36
  const n = e.querySelector(
37
37
  t.dialogContainerSelector
@@ -41,17 +41,17 @@ function be(e, t) {
41
41
  }
42
42
  return e.body;
43
43
  }
44
- function he(e, t, n, o) {
44
+ function ve(e, t, n, o) {
45
45
  const r = o.dialogTitle, s = e.createElement("div");
46
- s.className = "modal fade", s.tabIndex = -1, s.setAttribute(n ? qe : Oe, "true"), s.setAttribute("aria-hidden", "true");
46
+ s.className = "modal fade", s.tabIndex = -1, s.setAttribute(n ? ze : We, "true"), s.setAttribute("aria-hidden", "true");
47
47
  const c = e.createElement("div");
48
48
  c.className = "modal-dialog modal-dialog-centered";
49
49
  const a = e.createElement("div");
50
50
  if (a.className = "modal-content", r) {
51
- const m = `haori-dialog-title-${++We}`, C = e.createElement("div");
51
+ const m = `haori-dialog-title-${++je}`, C = e.createElement("div");
52
52
  C.className = "modal-header";
53
53
  const E = e.createElement("h5");
54
- E.className = "modal-title", E.id = m, E.setAttribute($e, "true"), E.textContent = r, C.appendChild(E), a.appendChild(C), s.setAttribute("aria-labelledby", m);
54
+ E.className = "modal-title", E.id = m, E.setAttribute(Ge, "true"), E.textContent = r, C.appendChild(E), a.appendChild(C), s.setAttribute("aria-labelledby", m);
55
55
  }
56
56
  const u = e.createElement("div");
57
57
  u.className = "modal-body";
@@ -60,12 +60,12 @@ function he(e, t, n, o) {
60
60
  const f = e.createElement("div");
61
61
  if (f.className = "modal-footer", n) {
62
62
  const m = e.createElement("button");
63
- m.type = "button", m.className = "btn btn-secondary", m.setAttribute(fe, "true"), m.textContent = o.dialogCancelLabel ?? Fe, f.appendChild(m);
63
+ m.type = "button", m.className = "btn btn-secondary", m.setAttribute(be, "true"), m.textContent = o.dialogCancelLabel ?? Ve, f.appendChild(m);
64
64
  }
65
65
  const d = e.createElement("button");
66
- return d.type = "button", d.className = "btn btn-primary", d.setAttribute(n ? ue : de, "true"), d.textContent = o.dialogOkLabel ?? Ue, f.appendChild(d), a.append(u, f), c.appendChild(a), s.appendChild(c), s;
66
+ return d.type = "button", d.className = "btn btn-primary", d.setAttribute(n ? me : fe, "true"), d.textContent = o.dialogOkLabel ?? Ke, f.appendChild(d), a.append(u, f), c.appendChild(a), s.appendChild(c), s;
67
67
  }
68
- function Ee(e) {
68
+ function pe(e) {
69
69
  let t = !1, n = !1;
70
70
  return {
71
71
  requestClose: (o) => {
@@ -76,12 +76,12 @@ function Ee(e) {
76
76
  }
77
77
  };
78
78
  }
79
- function ze(e, t) {
80
- const n = globalThis.document, o = he(n, e, !1, t);
81
- be(n, t).appendChild(o);
82
- const r = D(
79
+ function Je(e, t) {
80
+ const n = globalThis.document, o = ve(n, e, !1, t);
81
+ Ee(n, t).appendChild(o);
82
+ const r = P(
83
83
  o,
84
- me(),
84
+ he(),
85
85
  t.bootstrap
86
86
  );
87
87
  return r ? new Promise((s, c) => {
@@ -89,8 +89,8 @@ function ze(e, t) {
89
89
  o.removeEventListener("shown.bs.modal", f), o.removeEventListener("hidden.bs.modal", u), o.remove(), r.dispose?.(), s();
90
90
  }, u = () => {
91
91
  a();
92
- }, l = Ee(r), f = l.handleShown;
93
- o.querySelector(`[${de}]`)?.addEventListener("click", () => {
92
+ }, l = pe(r), f = l.handleShown;
93
+ o.querySelector(`[${fe}]`)?.addEventListener("click", () => {
94
94
  l.requestClose();
95
95
  }), o.addEventListener("shown.bs.modal", f), o.addEventListener("hidden.bs.modal", u, { once: !0 });
96
96
  try {
@@ -100,12 +100,12 @@ function ze(e, t) {
100
100
  }
101
101
  }) : (o.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
102
102
  }
103
- function Ge(e, t) {
104
- const n = globalThis.document, o = he(n, e, !0, t);
105
- be(n, t).appendChild(o);
106
- const r = D(
103
+ function Xe(e, t) {
104
+ const n = globalThis.document, o = ve(n, e, !0, t);
105
+ Ee(n, t).appendChild(o);
106
+ const r = P(
107
107
  o,
108
- me(),
108
+ he(),
109
109
  t.bootstrap
110
110
  );
111
111
  return r ? new Promise((s, c) => {
@@ -114,8 +114,8 @@ function Ge(e, t) {
114
114
  o.removeEventListener("shown.bs.modal", d), o.removeEventListener("hidden.bs.modal", l), o.remove(), r.dispose?.(), s(a);
115
115
  }, l = () => {
116
116
  u();
117
- }, f = Ee(r), d = f.handleShown, m = o.querySelector(`[${ue}]`), C = o.querySelector(
118
- `[${fe}]`
117
+ }, f = pe(r), d = f.handleShown, m = o.querySelector(`[${me}]`), C = o.querySelector(
118
+ `[${be}]`
119
119
  );
120
120
  m?.addEventListener("click", () => {
121
121
  f.requestClose(() => {
@@ -133,7 +133,7 @@ function Ge(e, t) {
133
133
  }
134
134
  }) : (o.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
135
135
  }
136
- const A = "data-haori-owned", h = "data-haori-message-container", w = "data-haori-invalid-target", L = "data-haori-valid-target", Ke = /* @__PURE__ */ new Set([
136
+ const A = "data-haori-owned", h = "data-haori-message-container", w = "data-haori-invalid-target", L = "data-haori-valid-target", Qe = /* @__PURE__ */ new Set([
137
137
  "button",
138
138
  "a",
139
139
  "area",
@@ -149,38 +149,38 @@ const A = "data-haori-owned", h = "data-haori-message-container", w = "data-haor
149
149
  function S(e) {
150
150
  return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio");
151
151
  }
152
- function T(e) {
152
+ function g(e) {
153
153
  return e instanceof HTMLInputElement && e.type === "radio";
154
154
  }
155
155
  function M(e) {
156
156
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
157
157
  }
158
- function z(e) {
159
- return Ke.has(e.localName);
158
+ function G(e) {
159
+ return Qe.has(e.localName);
160
160
  }
161
- function pe(e) {
161
+ function ge(e) {
162
162
  const t = e.nextElementSibling;
163
163
  return t instanceof HTMLElement && t.getAttribute(h) === "true" ? t : void 0;
164
164
  }
165
- function P(e) {
165
+ function x(e) {
166
166
  return Array.from(e.children).find(
167
167
  (t) => t instanceof HTMLElement && t.getAttribute(h) === "true"
168
168
  );
169
169
  }
170
- function ve(e, t) {
170
+ function Ae(e, t) {
171
171
  const n = e.createElement("div");
172
172
  return n.setAttribute(A, "true"), n.textContent = t, n;
173
173
  }
174
174
  function Te(e) {
175
- return z(e) ? pe(e) : P(e);
175
+ return G(e) ? ge(e) : x(e);
176
176
  }
177
- function Ae(e, t) {
177
+ function we(e, t) {
178
178
  e.insertAdjacentElement(
179
- z(e) ? "afterend" : "afterbegin",
179
+ G(e) ? "afterend" : "afterbegin",
180
180
  t
181
181
  );
182
182
  }
183
- function I(e) {
183
+ function y(e) {
184
184
  if (e.name) {
185
185
  const t = e.form ?? e.ownerDocument, n = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e.name) : e.name.replace(/(["\\])/g, "\\$1"), o = Array.from(
186
186
  t.querySelectorAll(`input[type="radio"][name="${n}"]`)
@@ -190,7 +190,7 @@ function I(e) {
190
190
  }
191
191
  return [e];
192
192
  }
193
- function Ve(e) {
193
+ function Ye(e) {
194
194
  const [t, ...n] = e;
195
195
  if (!t)
196
196
  return;
@@ -201,50 +201,50 @@ function Ve(e) {
201
201
  o = o.parentElement;
202
202
  }
203
203
  }
204
- function G(e) {
205
- const n = I(e).map((o) => o.closest(".form-check")).filter((o) => o instanceof HTMLElement);
204
+ function K(e) {
205
+ const n = y(e).map((o) => o.closest(".form-check")).filter((o) => o instanceof HTMLElement);
206
206
  if (n.length > 1) {
207
- const o = Ve(n);
207
+ const o = Ye(n);
208
208
  if (o && !n.includes(o))
209
209
  return o;
210
210
  }
211
- return x(e);
211
+ return O(e);
212
212
  }
213
- function x(e) {
213
+ function O(e) {
214
214
  const t = e.closest(".form-check");
215
215
  return t instanceof HTMLElement ? t : void 0;
216
216
  }
217
- function ge(e) {
217
+ function Ce(e) {
218
218
  const t = e.nextElementSibling;
219
219
  if (t instanceof HTMLElement && t.getAttribute(h) === "true")
220
220
  return t;
221
221
  const n = document.createElement("div");
222
222
  return n.className = "invalid-feedback d-block", n.setAttribute(A, "true"), n.setAttribute(h, "true"), e.insertAdjacentElement("afterend", n), n;
223
223
  }
224
- function je(e) {
225
- const t = T(e) ? G(e) : x(e);
224
+ function Ze(e) {
225
+ const t = g(e) ? K(e) : O(e);
226
226
  if (!t)
227
- return ge(e);
228
- const n = P(t);
227
+ return Ce(e);
228
+ const n = x(t);
229
229
  if (n)
230
230
  return n;
231
231
  const o = document.createElement("div");
232
232
  return o.className = "invalid-feedback d-block", o.setAttribute(A, "true"), o.setAttribute(h, "true"), t.appendChild(o), o;
233
233
  }
234
- function Je(e) {
234
+ function et(e) {
235
235
  const t = Te(e);
236
236
  if (t)
237
237
  return t;
238
238
  const n = document.createElement("div");
239
- return n.className = "alert alert-danger", n.setAttribute("role", "alert"), n.setAttribute(A, "true"), n.setAttribute(h, "true"), Ae(e, n), n;
239
+ return n.className = "alert alert-danger", n.setAttribute("role", "alert"), n.setAttribute(A, "true"), n.setAttribute(h, "true"), we(e, n), n;
240
240
  }
241
- function p(e) {
241
+ function v(e) {
242
242
  e.getAttribute(w) === "true" && (e.classList.remove("is-invalid"), e.removeAttribute(w));
243
243
  }
244
- function v(e) {
244
+ function p(e) {
245
245
  e.getAttribute(L) === "true" && (e.classList.remove("is-valid"), e.removeAttribute(L));
246
246
  }
247
- function X(e) {
247
+ function Y(e) {
248
248
  switch (e) {
249
249
  case "success":
250
250
  return "alert alert-success";
@@ -259,62 +259,62 @@ function X(e) {
259
259
  function k(e) {
260
260
  return e === "success" ? "valid-feedback d-block" : "invalid-feedback d-block";
261
261
  }
262
- function we(e) {
263
- (T(e) ? I(e) : [e]).forEach((n) => {
262
+ function Le(e) {
263
+ (g(e) ? y(e) : [e]).forEach((n) => {
264
264
  n.classList.add("is-invalid"), n.setAttribute(w, "true");
265
265
  });
266
266
  }
267
- function Xe(e) {
268
- (T(e) ? I(e) : [e]).forEach((n) => {
269
- p(n);
267
+ function tt(e) {
268
+ (g(e) ? y(e) : [e]).forEach((n) => {
269
+ v(n);
270
270
  });
271
271
  }
272
- function Ce(e, t) {
272
+ function Se(e, t) {
273
273
  const n = e.nextElementSibling;
274
274
  if (n instanceof HTMLElement && n.getAttribute(h) === "true")
275
275
  return n.className = k(t), n;
276
276
  const o = document.createElement("div");
277
277
  return o.className = k(t), o.setAttribute(A, "true"), o.setAttribute(h, "true"), e.insertAdjacentElement("afterend", o), o;
278
278
  }
279
- function Qe(e, t) {
280
- const n = T(e) ? G(e) : x(e);
279
+ function nt(e, t) {
280
+ const n = g(e) ? K(e) : O(e);
281
281
  if (!n)
282
- return Ce(e, t);
283
- const o = P(n);
282
+ return Se(e, t);
283
+ const o = x(n);
284
284
  if (o)
285
285
  return o.className = k(t), o;
286
286
  const r = document.createElement("div");
287
287
  return r.className = k(t), r.setAttribute(A, "true"), r.setAttribute(h, "true"), n.appendChild(r), r;
288
288
  }
289
- function Ye(e, t) {
289
+ function ot(e, t) {
290
290
  const n = Te(e);
291
291
  if (n)
292
- return n.className = X(t), n;
292
+ return n.className = Y(t), n;
293
293
  const o = document.createElement("div");
294
- return o.className = X(t), o.setAttribute("role", "alert"), o.setAttribute(A, "true"), o.setAttribute(h, "true"), Ae(e, o), o;
294
+ return o.className = Y(t), o.setAttribute("role", "alert"), o.setAttribute(A, "true"), o.setAttribute(h, "true"), we(e, o), o;
295
295
  }
296
- function Ze(e, t) {
297
- return (S(e) ? je(e) : M(e) ? ge(e) : Je(e)).appendChild(ve(document, t)), S(e) ? we(e) : M(e) && (e.classList.add("is-invalid"), e.setAttribute(w, "true")), Promise.resolve();
296
+ function rt(e, t) {
297
+ return (S(e) ? Ze(e) : M(e) ? Ce(e) : et(e)).appendChild(Ae(document, t)), S(e) ? Le(e) : M(e) && (e.classList.add("is-invalid"), e.setAttribute(w, "true")), Promise.resolve();
298
298
  }
299
- function et(e, t, n) {
300
- if ((S(e) ? Qe(e, n) : M(e) ? Ce(e, n) : Ye(e, n)).appendChild(ve(document, t)), S(e)) {
301
- const r = T(e) ? I(e) : [e];
299
+ function st(e, t, n) {
300
+ if ((S(e) ? nt(e, n) : M(e) ? Se(e, n) : ot(e, n)).appendChild(Ae(document, t)), S(e)) {
301
+ const r = g(e) ? y(e) : [e];
302
302
  n === "success" ? r.forEach((s) => {
303
- p(s), s.classList.add("is-valid"), s.setAttribute(L, "true");
304
- }) : !n || n === "error" ? (r.forEach((s) => v(s)), we(e)) : r.forEach((s) => {
305
- v(s), p(s);
303
+ v(s), s.classList.add("is-valid"), s.setAttribute(L, "true");
304
+ }) : !n || n === "error" ? (r.forEach((s) => p(s)), Le(e)) : r.forEach((s) => {
305
+ p(s), v(s);
306
306
  });
307
- } else M(e) && (n === "success" ? (p(e), e.classList.add("is-valid"), e.setAttribute(L, "true")) : !n || n === "error" ? (v(e), e.classList.add("is-invalid"), e.setAttribute(w, "true")) : (v(e), p(e)));
307
+ } else M(e) && (n === "success" ? (v(e), e.classList.add("is-valid"), e.setAttribute(L, "true")) : !n || n === "error" ? (p(e), e.classList.add("is-invalid"), e.setAttribute(w, "true")) : (p(e), v(e)));
308
308
  return Promise.resolve();
309
309
  }
310
- function Le(e) {
310
+ function Me(e) {
311
311
  if (S(e)) {
312
- const r = T(e) ? G(e) : x(e);
313
- (r ? P(r) : void 0)?.remove(), Xe(e), (T(e) ? I(e) : [e]).forEach((a) => v(a));
312
+ const r = g(e) ? K(e) : O(e);
313
+ (r ? x(r) : void 0)?.remove(), tt(e), (g(e) ? y(e) : [e]).forEach((a) => p(a));
314
314
  } else if (M(e)) {
315
315
  const r = e.nextElementSibling;
316
- r instanceof HTMLElement && r.getAttribute(h) === "true" && r.remove(), p(e), v(e);
317
- } else z(e) && pe(e)?.remove();
316
+ r instanceof HTMLElement && r.getAttribute(h) === "true" && r.remove(), v(e), p(e);
317
+ } else G(e) && ge(e)?.remove();
318
318
  return e.querySelectorAll(
319
319
  `[${h}="true"]`
320
320
  ).forEach((r) => {
@@ -322,66 +322,84 @@ function Le(e) {
322
322
  }), e.querySelectorAll(
323
323
  `[${w}="true"]`
324
324
  ).forEach((r) => {
325
- p(r);
325
+ v(r);
326
326
  }), e.querySelectorAll(
327
327
  `[${L}="true"]`
328
328
  ).forEach((r) => {
329
- v(r);
329
+ p(r);
330
330
  }), Promise.resolve();
331
331
  }
332
- const K = /* @__PURE__ */ new WeakSet(), tt = "data-haori-dismiss-lock", U = /* @__PURE__ */ new WeakSet();
333
- let H = !1, F;
334
- const Se = (e) => {
335
- e.target instanceof HTMLElement && K.add(e.target);
336
- }, Me = (e) => {
337
- e.target instanceof HTMLElement && K.delete(e.target);
338
- }, Ie = (e) => {
332
+ const V = /* @__PURE__ */ new WeakSet(), it = "data-haori-dismiss-lock", F = /* @__PURE__ */ new WeakSet();
333
+ let H = null, j = /* @__PURE__ */ new WeakMap(), R = !1, W;
334
+ function ye(e) {
335
+ return Array.from(e.ownerDocument.querySelectorAll(".modal.show")).filter(
336
+ (t) => t !== e
337
+ );
338
+ }
339
+ const Ie = (e) => {
340
+ e.target instanceof HTMLElement && (H = e.target);
341
+ }, Ne = (e) => {
342
+ if (!(e.target instanceof HTMLElement))
343
+ return;
344
+ const t = e.target;
345
+ V.add(t), H && j.set(t, H);
346
+ }, ke = (e) => {
347
+ if (!(e.target instanceof HTMLElement))
348
+ return;
339
349
  const t = e.target;
340
- t instanceof HTMLElement && t.hasAttribute(tt) && !U.has(t) && e.preventDefault();
350
+ V.delete(t), t.getAttribute("data-bs-focus") !== "false" && ye(t).length > 0 && !t.contains(t.ownerDocument.activeElement) && t.focus();
351
+ }, He = (e) => {
352
+ if (!(e.target instanceof HTMLElement))
353
+ return;
354
+ const t = e.target, n = j.get(t), o = ye(t), r = t.ownerDocument.activeElement;
355
+ o.length === 0 || o.some((s) => s.contains(r)) || n && o.some((s) => s.contains(n)) && (n.focus(), t.ownerDocument.activeElement === n) || o[o.length - 1].focus();
356
+ }, Re = (e) => {
357
+ const t = e.target;
358
+ t instanceof HTMLElement && t.hasAttribute(it) && !F.has(t) && e.preventDefault();
341
359
  };
342
- function Q(e, t) {
343
- U.add(e);
360
+ function Z(e, t) {
361
+ F.add(e);
344
362
  try {
345
363
  t.hide();
346
364
  } finally {
347
- U.delete(e);
365
+ F.delete(e);
348
366
  }
349
367
  }
350
- function nt(e = document) {
351
- H || (H = !0, F = e, e.addEventListener("show.bs.modal", Se), e.addEventListener("shown.bs.modal", Me), e.addEventListener("hide.bs.modal", Ie));
368
+ function at(e = document) {
369
+ R || (R = !0, W = e, e.addEventListener("focusin", Ie), e.addEventListener("show.bs.modal", Ne), e.addEventListener("shown.bs.modal", ke), e.addEventListener("hide.bs.modal", Re), e.addEventListener("hidden.bs.modal", He));
352
370
  }
353
- function ot(e = F ?? document) {
354
- H && (H = !1, e.removeEventListener("show.bs.modal", Se), e.removeEventListener("shown.bs.modal", Me), e.removeEventListener("hide.bs.modal", Ie), F = void 0);
371
+ function lt(e = W ?? document) {
372
+ R && (R = !1, e.removeEventListener("focusin", Ie), e.removeEventListener("show.bs.modal", Ne), e.removeEventListener("shown.bs.modal", ke), e.removeEventListener("hide.bs.modal", Re), e.removeEventListener("hidden.bs.modal", He), W = void 0, H = null, j = /* @__PURE__ */ new WeakMap());
355
373
  }
356
- function ye(e) {
374
+ function De(e) {
357
375
  return e.classList.contains("modal") ? e : e.closest(".modal");
358
376
  }
359
- function Ne(e) {
377
+ function _e(e) {
360
378
  e.tabIndex < 0 && (e.tabIndex = -1), e.hasAttribute("aria-hidden") || e.setAttribute("aria-hidden", "true");
361
379
  }
362
- function rt(e, t) {
363
- const n = ye(e);
380
+ function ct(e, t) {
381
+ const n = De(e);
364
382
  if (!n)
365
383
  return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
366
- Ne(n), Le(n);
367
- const o = D(n, void 0, t.bootstrap);
384
+ _e(n), Me(n);
385
+ const o = P(n, void 0, t.bootstrap);
368
386
  return o ? (o.show(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
369
387
  }
370
- function st(e, t) {
371
- const n = ye(e);
388
+ function dt(e, t) {
389
+ const n = De(e);
372
390
  if (!n)
373
391
  return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
374
- Ne(n);
375
- const o = D(n, void 0, t.bootstrap);
376
- return o ? K.has(n) ? (n.addEventListener(
392
+ _e(n);
393
+ const o = P(n, void 0, t.bootstrap);
394
+ return o ? V.has(n) ? (n.addEventListener(
377
395
  "shown.bs.modal",
378
396
  () => {
379
- Q(n, o);
397
+ Z(n, o);
380
398
  },
381
399
  { once: !0 }
382
- ), Promise.resolve()) : (Q(n, o), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
400
+ ), Promise.resolve()) : (Z(n, o), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
383
401
  }
384
- const Y = "data-haori-toast-container", it = "data-haori-toast", at = "data-haori-toast-level", lt = "data-haori-toast-accent", ct = "data-haori-toast-dismiss", Z = {
402
+ const ee = "data-haori-toast-container", ut = "data-haori-toast", ft = "data-haori-toast-level", mt = "data-haori-toast-accent", bt = "data-haori-toast-dismiss", te = {
385
403
  "top-start": "top-0 start-0",
386
404
  "top-center": "top-0 start-50 translate-middle-x",
387
405
  "top-end": "top-0 end-0",
@@ -389,7 +407,7 @@ const Y = "data-haori-toast-container", it = "data-haori-toast", at = "data-haor
389
407
  "bottom-center": "bottom-0 start-50 translate-middle-x",
390
408
  "bottom-end": "bottom-0 end-0"
391
409
  };
392
- function dt(e) {
410
+ function ht(e) {
393
411
  switch (e) {
394
412
  case "success":
395
413
  return { accentClassName: "bg-success", level: "success" };
@@ -401,7 +419,7 @@ function dt(e) {
401
419
  return { accentClassName: "bg-info", level: "info" };
402
420
  }
403
421
  }
404
- function ut(e, t) {
422
+ function Et(e, t) {
405
423
  if (t.toastContainerSelector) {
406
424
  const n = e.querySelector(
407
425
  t.toastContainerSelector
@@ -411,29 +429,29 @@ function ut(e, t) {
411
429
  }
412
430
  return e.body;
413
431
  }
414
- function ft(e, t) {
415
- const n = ut(e, t), o = Z[t.toastPosition ?? "bottom-end"], r = n.querySelector(
416
- `[${Y}="true"]`
432
+ function vt(e, t) {
433
+ const n = Et(e, t), o = te[t.toastPosition ?? "bottom-end"], r = n.querySelector(
434
+ `[${ee}="true"]`
417
435
  );
418
436
  if (r) {
419
- const c = Object.values(Z).flatMap((a) => a.split(" "));
437
+ const c = Object.values(te).flatMap((a) => a.split(" "));
420
438
  return r.classList.remove(...c), r.classList.add(...o.split(" ")), r;
421
439
  }
422
440
  const s = e.createElement("div");
423
- return s.className = `toast-container position-fixed ${o} p-3`, s.setAttribute(Y, "true"), n.appendChild(s), s;
441
+ return s.className = `toast-container position-fixed ${o} p-3`, s.setAttribute(ee, "true"), n.appendChild(s), s;
424
442
  }
425
- function mt(e, t, n) {
426
- const o = globalThis.document, r = dt(t), s = o.createElement("div");
427
- s.className = "toast border bg-body text-body shadow-sm", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute(it, "true"), s.setAttribute(at, r.level);
443
+ function pt(e, t, n) {
444
+ const o = globalThis.document, r = ht(t), s = o.createElement("div");
445
+ s.className = "toast border bg-body text-body shadow-sm", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute(ut, "true"), s.setAttribute(ft, r.level);
428
446
  const c = o.createElement("div");
429
447
  c.className = "d-flex align-items-stretch";
430
448
  const a = o.createElement("div");
431
- a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(lt, "true");
449
+ a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(mt, "true");
432
450
  const u = o.createElement("div");
433
451
  u.className = "toast-body", u.style.whiteSpace = "pre-line", u.textContent = e;
434
452
  const l = o.createElement("button");
435
- l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(ct, "true"), c.appendChild(a), c.appendChild(u), c.appendChild(l), s.appendChild(c), ft(o, n).appendChild(s);
436
- const f = n.toastDelay !== void 0 ? { delay: n.toastDelay } : void 0, d = xe(s, f, n.bootstrap);
453
+ l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(bt, "true"), c.appendChild(a), c.appendChild(u), c.appendChild(l), s.appendChild(c), vt(o, n).appendChild(s);
454
+ const f = n.toastDelay !== void 0 ? { delay: n.toastDelay } : void 0, d = Fe(s, f, n.bootstrap);
437
455
  if (!d)
438
456
  return s.remove(), Promise.reject(new Error("Bootstrap Toast is unavailable."));
439
457
  l.addEventListener("click", () => {
@@ -451,58 +469,58 @@ function mt(e, t, n) {
451
469
  return s.remove(), d.dispose?.(), Promise.reject(m);
452
470
  }
453
471
  }
454
- const bt = {
472
+ const gt = {
455
473
  options: {
456
474
  fallbackToNative: !0
457
475
  }
458
476
  };
459
- let b = bt;
460
- function g(e) {
477
+ let b = gt;
478
+ function T(e) {
461
479
  return e ? String(e).replace(/\\n/g, `
462
480
  `) : "";
463
481
  }
464
- function ke() {
482
+ function Be() {
465
483
  return globalThis.window;
466
484
  }
467
- function V(e) {
485
+ function J(e) {
468
486
  return Promise.resolve(e).then(() => {
469
487
  });
470
488
  }
471
- function O(e) {
489
+ function q(e) {
472
490
  const t = b.originalHaori?.[e];
473
491
  return typeof t == "function" ? t : void 0;
474
492
  }
475
- function q(e) {
493
+ function $(e) {
476
494
  console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`);
477
495
  }
478
- function ee(e) {
479
- const t = g(e), n = O("dialog");
496
+ function ne(e) {
497
+ const t = T(e), n = q("dialog");
480
498
  if (n)
481
- return V(n(t));
482
- const o = ke();
483
- return b.options.fallbackToNative && typeof o?.alert == "function" ? (o.alert(t), Promise.resolve()) : (q("dialog"), Promise.resolve());
499
+ return J(n(t));
500
+ const o = Be();
501
+ return b.options.fallbackToNative && typeof o?.alert == "function" ? (o.alert(t), Promise.resolve()) : ($("dialog"), Promise.resolve());
484
502
  }
485
- function te(e) {
486
- const t = g(e), n = O("confirm");
503
+ function oe(e) {
504
+ const t = T(e), n = q("confirm");
487
505
  if (n)
488
506
  return Promise.resolve(n(t)).then(
489
507
  (r) => !!r
490
508
  );
491
- const o = ke();
492
- return b.options.fallbackToNative && typeof o?.confirm == "function" ? Promise.resolve(o.confirm(t)) : (q("confirm"), Promise.resolve(!1));
509
+ const o = Be();
510
+ return b.options.fallbackToNative && typeof o?.confirm == "function" ? Promise.resolve(o.confirm(t)) : ($("confirm"), Promise.resolve(!1));
493
511
  }
494
- function ne(e, t) {
495
- const n = g(e), o = O("toast");
496
- return o ? V(o(n, t)) : (q("toast"), Promise.resolve());
512
+ function re(e, t) {
513
+ const n = T(e), o = q("toast");
514
+ return o ? J(o(n, t)) : ($("toast"), Promise.resolve());
497
515
  }
498
516
  function N(e, t) {
499
- const n = O(e);
500
- return n ? V(n(t)) : (q(e), Promise.resolve());
517
+ const n = q(e);
518
+ return n ? J(n(t)) : ($(e), Promise.resolve());
501
519
  }
502
- function ht(e) {
520
+ function At(e) {
503
521
  b = e;
504
522
  }
505
- class Et {
523
+ class Tt {
506
524
  /**
507
525
  * 情報表示ダイアログを表示する。
508
526
  *
@@ -510,10 +528,10 @@ class Et {
510
528
  * @return 完了時に解決される Promise。
511
529
  */
512
530
  static dialog(t) {
513
- const n = g(t);
514
- return y(b.options.bootstrap) ? ze(n, b.options).catch(
515
- () => ee(n)
516
- ) : ee(n);
531
+ const n = T(t);
532
+ return I(b.options.bootstrap) ? Je(n, b.options).catch(
533
+ () => ne(n)
534
+ ) : ne(n);
517
535
  }
518
536
  /**
519
537
  * 確認ダイアログを表示する。
@@ -522,10 +540,10 @@ class Et {
522
540
  * @return OK のみ true を返す Promise。
523
541
  */
524
542
  static confirm(t) {
525
- const n = g(t);
526
- return y(b.options.bootstrap) ? Ge(n, b.options).catch(
527
- () => te(n)
528
- ) : te(n);
543
+ const n = T(t);
544
+ return I(b.options.bootstrap) ? Xe(n, b.options).catch(
545
+ () => oe(n)
546
+ ) : oe(n);
529
547
  }
530
548
  /**
531
549
  * トースト通知を表示する。
@@ -535,10 +553,10 @@ class Et {
535
553
  * @return 完了時に解決される Promise。
536
554
  */
537
555
  static toast(t, n) {
538
- const o = g(t);
539
- return Pe(b.options.bootstrap) ? mt(o, n, b.options).catch(
540
- () => ne(o, n)
541
- ) : ne(o, n);
556
+ const o = T(t);
557
+ return Ue(b.options.bootstrap) ? pt(o, n, b.options).catch(
558
+ () => re(o, n)
559
+ ) : re(o, n);
542
560
  }
543
561
  /**
544
562
  * 任意のダイアログ要素を開く。
@@ -547,7 +565,7 @@ class Et {
547
565
  * @return 完了時に解決される Promise。
548
566
  */
549
567
  static openDialog(t) {
550
- return y(b.options.bootstrap) ? rt(t, b.options).catch(
568
+ return I(b.options.bootstrap) ? ct(t, b.options).catch(
551
569
  () => N("openDialog", t)
552
570
  ) : N("openDialog", t);
553
571
  }
@@ -558,7 +576,7 @@ class Et {
558
576
  * @return 完了時に解決される Promise。
559
577
  */
560
578
  static closeDialog(t) {
561
- return y(b.options.bootstrap) ? st(t, b.options).catch(
579
+ return I(b.options.bootstrap) ? dt(t, b.options).catch(
562
580
  () => N("closeDialog", t)
563
581
  ) : N("closeDialog", t);
564
582
  }
@@ -570,7 +588,7 @@ class Et {
570
588
  * @return 完了時に解決される Promise。
571
589
  */
572
590
  static addErrorMessage(t, n) {
573
- return Ze(t, n);
591
+ return rt(t, n);
574
592
  }
575
593
  /**
576
594
  * 管理対象のメッセージをレベル付きで追加する。
@@ -581,7 +599,7 @@ class Et {
581
599
  * @return 完了時に解決される Promise。
582
600
  */
583
601
  static addMessage(t, n, o) {
584
- return et(t, n, o);
602
+ return st(t, n, o);
585
603
  }
586
604
  /**
587
605
  * 管理対象のメッセージを削除する。
@@ -590,29 +608,29 @@ class Et {
590
608
  * @return 完了時に解決される Promise。
591
609
  */
592
610
  static clearMessages(t) {
593
- return Le(t);
611
+ return Me(t);
594
612
  }
595
613
  }
596
- const pt = "haori-bootstrap:collapse:", R = "data-haori-persist";
597
- let _ = !1, B, W;
598
- function He(e) {
599
- return pt + e;
614
+ const wt = "haori-bootstrap:collapse:", D = "data-haori-persist";
615
+ let _ = !1, B, z;
616
+ function Pe(e) {
617
+ return wt + e;
600
618
  }
601
- function vt(e) {
619
+ function Ct(e) {
602
620
  try {
603
- const t = window.sessionStorage.getItem(He(e));
621
+ const t = window.sessionStorage.getItem(Pe(e));
604
622
  return t === "shown" || t === "hidden" ? t : void 0;
605
623
  } catch {
606
624
  return;
607
625
  }
608
626
  }
609
- function Tt(e, t) {
627
+ function Lt(e, t) {
610
628
  try {
611
- window.sessionStorage.setItem(He(e), t);
629
+ window.sessionStorage.setItem(Pe(e), t);
612
630
  } catch {
613
631
  }
614
632
  }
615
- function oe(e, t) {
633
+ function se(e, t) {
616
634
  const n = e.id, o = [`[data-bs-toggle="collapse"][data-bs-target="#${n}"]`];
617
635
  if (n && o.push(`[data-bs-toggle="collapse"][href="#${n}"]`), !n)
618
636
  return;
@@ -620,45 +638,45 @@ function oe(e, t) {
620
638
  s.setAttribute("aria-expanded", t ? "true" : "false"), s.classList.toggle("collapsed", !t);
621
639
  });
622
640
  }
623
- function re(e) {
624
- const t = e.getAttribute(R);
641
+ function ie(e) {
642
+ const t = e.getAttribute(D);
625
643
  if (!t)
626
644
  return;
627
- const n = vt(t);
645
+ const n = Ct(t);
628
646
  if (!n)
629
647
  return;
630
648
  const o = e.classList.contains("show");
631
- n === "shown" && !o ? (e.classList.add("show"), oe(e, !0)) : n === "hidden" && o && (e.classList.remove("show"), oe(e, !1));
649
+ n === "shown" && !o ? (e.classList.add("show"), se(e, !0)) : n === "hidden" && o && (e.classList.remove("show"), se(e, !1));
632
650
  }
633
- function se(e) {
634
- e instanceof HTMLElement && e.hasAttribute(R) && re(e), e.querySelectorAll(`[${R}]`).forEach(re);
651
+ function ae(e) {
652
+ e instanceof HTMLElement && e.hasAttribute(D) && ie(e), e.querySelectorAll(`[${D}]`).forEach(ie);
635
653
  }
636
- function Re(e, t) {
654
+ function xe(e, t) {
637
655
  const n = e.target;
638
656
  if (!(n instanceof HTMLElement))
639
657
  return;
640
- const o = n.getAttribute(R);
641
- o && Tt(o, t);
658
+ const o = n.getAttribute(D);
659
+ o && Lt(o, t);
642
660
  }
643
- const _e = (e) => Re(e, "shown"), Be = (e) => Re(e, "hidden");
644
- function At(e = document) {
661
+ const Oe = (e) => xe(e, "shown"), qe = (e) => xe(e, "hidden");
662
+ function St(e = document) {
645
663
  if (_)
646
664
  return;
647
- _ = !0, W = e, e.addEventListener("shown.bs.collapse", _e), e.addEventListener("hidden.bs.collapse", Be);
665
+ _ = !0, z = e, e.addEventListener("shown.bs.collapse", Oe), e.addEventListener("hidden.bs.collapse", qe);
648
666
  const t = () => {
649
- se(e), B = new MutationObserver((n) => {
667
+ ae(e), B = new MutationObserver((n) => {
650
668
  for (const o of n)
651
669
  o.addedNodes.forEach((r) => {
652
- r instanceof HTMLElement && se(r);
670
+ r instanceof HTMLElement && ae(r);
653
671
  });
654
672
  }), e.body && B.observe(e.body, { childList: !0, subtree: !0 });
655
673
  };
656
674
  e.body ? t() : e.addEventListener("DOMContentLoaded", t, { once: !0 });
657
675
  }
658
- function gt(e = W ?? document) {
659
- _ && (_ = !1, e.removeEventListener("shown.bs.collapse", _e), e.removeEventListener("hidden.bs.collapse", Be), B?.disconnect(), B = void 0, W = void 0);
676
+ function Mt(e = z ?? document) {
677
+ _ && (_ = !1, e.removeEventListener("shown.bs.collapse", Oe), e.removeEventListener("hidden.bs.collapse", qe), B?.disconnect(), B = void 0, z = void 0);
660
678
  }
661
- const wt = [
679
+ const yt = [
662
680
  {
663
681
  attribute: "dialog-ok-label",
664
682
  apply: (e, t) => {
@@ -671,23 +689,23 @@ const wt = [
671
689
  e.dialogCancelLabel = t;
672
690
  }
673
691
  }
674
- ], Ct = typeof document < "u" && document.currentScript instanceof HTMLScriptElement ? document.currentScript : null;
675
- function $(e, t) {
692
+ ], It = typeof document < "u" && document.currentScript instanceof HTMLScriptElement ? document.currentScript : null;
693
+ function U(e, t) {
676
694
  const n = e?.getAttribute(t) ?? null;
677
695
  if (!(n === null || n.trim() === ""))
678
696
  return n;
679
697
  }
680
- function Lt(e = typeof document > "u" ? null : document, t = Ct) {
698
+ function Nt(e = typeof document > "u" ? null : document, t = It) {
681
699
  const n = {};
682
- for (const { attribute: o, apply: r } of wt) {
683
- const s = $(t, `data-${o}`) ?? $(e?.documentElement ?? null, `data-haori-${o}`) ?? $(e?.body ?? null, `data-haori-${o}`);
700
+ for (const { attribute: o, apply: r } of yt) {
701
+ const s = U(t, `data-${o}`) ?? U(e?.documentElement ?? null, `data-haori-${o}`) ?? U(e?.body ?? null, `data-haori-${o}`);
684
702
  s !== void 0 && r(n, s);
685
703
  }
686
704
  return n;
687
705
  }
688
- const j = {
706
+ const X = {
689
707
  fallbackToNative: !0
690
- }, ie = /* @__PURE__ */ new Set([
708
+ }, le = /* @__PURE__ */ new Set([
691
709
  "dialog",
692
710
  "confirm",
693
711
  "toast",
@@ -697,29 +715,29 @@ const j = {
697
715
  "addMessage",
698
716
  "clearMessages"
699
717
  ]);
700
- function St(e) {
701
- const t = Et;
718
+ function kt(e) {
719
+ const t = Tt;
702
720
  return new Proxy(e, {
703
721
  get(n, o, r) {
704
- return typeof o == "string" && ie.has(o) ? t[o] : Reflect.get(n, o, r);
722
+ return typeof o == "string" && le.has(o) ? t[o] : Reflect.get(n, o, r);
705
723
  },
706
724
  has(n, o) {
707
- return typeof o == "string" && ie.has(o) ? !0 : Reflect.has(n, o);
725
+ return typeof o == "string" && le.has(o) ? !0 : Reflect.has(n, o);
708
726
  }
709
727
  });
710
728
  }
711
729
  const i = {
712
730
  installed: !1,
713
- options: j
731
+ options: X
714
732
  };
715
- function J() {
733
+ function Q() {
716
734
  return globalThis.window;
717
735
  }
718
- function Mt(e, t) {
719
- const n = Lt();
736
+ function Ht(e, t) {
737
+ const n = Nt();
720
738
  return {
721
739
  bootstrap: e.bootstrap ?? t?.bootstrap,
722
- fallbackToNative: e.fallbackToNative ?? j.fallbackToNative,
740
+ fallbackToNative: e.fallbackToNative ?? X.fallbackToNative,
723
741
  runtime: e.runtime ?? i.options.runtime ?? t?.Haori?.runtime,
724
742
  toastContainerSelector: e.toastContainerSelector ?? i.options.toastContainerSelector,
725
743
  dialogContainerSelector: e.dialogContainerSelector ?? i.options.dialogContainerSelector,
@@ -730,68 +748,68 @@ function Mt(e, t) {
730
748
  toastDelay: e.toastDelay ?? i.options.toastDelay
731
749
  };
732
750
  }
733
- function It(e = J()) {
751
+ function Rt(e = Q()) {
734
752
  return !!(e?.Haori && e.bootstrap);
735
753
  }
736
- function yt(e = {}) {
737
- const t = J();
754
+ function Dt(e = {}) {
755
+ const t = Q();
738
756
  if (!t?.Haori)
739
757
  throw new Error("window.Haori is required before calling install().");
740
- if (i.originalHaori || (i.originalHaori = t.Haori, i.originalRuntime = t.Haori.runtime), i.options = Mt(e, t), i.options.runtime) {
758
+ if (i.originalHaori || (i.originalHaori = t.Haori, i.originalRuntime = t.Haori.runtime), i.options = Ht(e, t), i.options.runtime) {
741
759
  const n = i.originalHaori ?? t.Haori;
742
760
  typeof n.setRuntime == "function" ? n.setRuntime(i.options.runtime) : console.warn(
743
761
  "[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。"
744
762
  );
745
763
  }
746
- ht({
764
+ At({
747
765
  originalHaori: i.originalHaori,
748
766
  options: i.options
749
- }), t.Haori = St(i.originalHaori), At(), nt(), i.installed = !0;
767
+ }), t.Haori = kt(i.originalHaori), St(), at(), i.installed = !0;
750
768
  }
751
- function _t() {
752
- const e = J();
769
+ function Ot() {
770
+ const e = Q();
753
771
  if (!e || !i.originalHaori)
754
772
  return;
755
773
  const t = i.originalHaori;
756
- typeof t.setRuntime == "function" ? t.setRuntime(i.originalRuntime) : t.runtime = i.originalRuntime, e.Haori = i.originalHaori, gt(), ot(), i.installed = !1, i.originalHaori = void 0, i.originalRuntime = void 0, i.options = j;
774
+ typeof t.setRuntime == "function" ? t.setRuntime(i.originalRuntime) : t.runtime = i.originalRuntime, e.Haori = i.originalHaori, Mt(), lt(), i.installed = !1, i.originalHaori = void 0, i.originalRuntime = void 0, i.options = X;
757
775
  }
758
- function Bt() {
776
+ function qt() {
759
777
  return i.installed;
760
778
  }
761
- const De = "__haoriJsBootstrapAutoEnabled__";
762
- function Nt() {
779
+ const $e = "__haoriJsBootstrapAutoEnabled__";
780
+ function _t() {
763
781
  return globalThis.window;
764
782
  }
765
- function kt(e) {
766
- return !!e[De];
783
+ function Bt(e) {
784
+ return !!e[$e];
767
785
  }
768
- function Ht(e) {
769
- e[De] = !0;
786
+ function Pt(e) {
787
+ e[$e] = !0;
770
788
  }
771
- function Rt() {
772
- const e = Nt();
773
- if (!(!e || kt(e))) {
774
- if (!It(e)) {
789
+ function xt() {
790
+ const e = _t();
791
+ if (!(!e || Bt(e))) {
792
+ if (!Rt(e)) {
775
793
  console.warn(
776
794
  "[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing."
777
795
  );
778
796
  return;
779
797
  }
780
798
  try {
781
- yt({ bootstrap: e.bootstrap }), Ht(e);
799
+ Dt({ bootstrap: e.bootstrap }), Pt(e);
782
800
  } catch (t) {
783
801
  console.warn("[haori-bootstrap] Auto-enable failed.", t);
784
802
  }
785
803
  }
786
804
  }
787
- Rt();
788
- const Dt = "0.5.57";
805
+ xt();
806
+ const $t = "0.5.59";
789
807
  export {
790
- Et as BootstrapHaori,
791
- It as hasAutoEnablePrerequisites,
792
- yt as install,
793
- Bt as isInstalled,
794
- _t as uninstall,
795
- Dt as version
808
+ Tt as BootstrapHaori,
809
+ Rt as hasAutoEnablePrerequisites,
810
+ Dt as install,
811
+ qt as isInstalled,
812
+ Ot as uninstall,
813
+ $t as version
796
814
  };
797
815
  //# sourceMappingURL=haori-bootstrap.js.map